@desplega.ai/agent-swarm 2.14.0 → 2.14.1
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/acp-adapter-7jv7w8jh.js +17 -0
- package/dist/{acp-targets-23exz4z4.js → acp-targets-0ebmg3et.js} +10 -10
- package/dist/{actions-zcr25x27.js → actions-0ds9dx6c.js} +28 -28
- package/dist/{agent-fs-provision-7fa9e12e.js → agent-fs-provision-zpbxa9jc.js} +4 -4
- package/dist/{amp-adapter-s7ytmv6b.js → amp-adapter-awh5nn7a.js} +3 -3
- package/dist/{anthropic-messages-vdd1zmha.js → anthropic-messages-gtgp9r85.js} +17 -17
- package/dist/{app-5d3sz1hy.js → app-nzejkvpp.js} +10 -10
- package/dist/{approval-notifications-7qgkzkzx.js → approval-notifications-hbqtb2w3.js} +11 -11
- package/dist/{assistant-p2yvhc3j.js → assistant-1paft129.js} +29 -29
- package/dist/{boot-args-schema-ry6cb0p7.js → boot-args-schema-zs435mfx.js} +1 -1
- package/dist/{boot-reembed-2hkm3vz2.js → boot-reembed-7xq2qgg4.js} +1 -1
- package/dist/{boot-reembed-c9643ms3.js → boot-reembed-91qrd4mz.js} +1 -1
- package/dist/{boot-scrub-sweep-3ycxr51t.js → boot-scrub-sweep-3h5xscw6.js} +2 -2
- package/dist/{boot-seeds-2hzvvzg0.js → boot-seeds-xkxqa8zc.js} +4 -4
- package/dist/{boxd-9py3x0jb.js → boxd-464x3w4m.js} +3 -3
- package/dist/{claude-adapter-dnkww93e.js → claude-adapter-6d8eyf2f.js} +12 -13
- package/dist/{claude-managed-adapter-yk0cr5x6.js → claude-managed-adapter-jzxcaf9m.js} +4 -4
- package/dist/{claude-managed-setup-4byxpp47.js → claude-managed-setup-5fcx0qh3.js} +10 -10
- package/dist/{claude-sdk-session-4wf3dbvs.js → claude-sdk-session-11vhz1hc.js} +11442 -12786
- package/dist/{cli-2ckwgs7q.js → cli-02ba8qx5.js} +1 -1
- package/dist/{cli-wvgg7r4j.js → cli-08gfvs58.js} +2 -2
- package/dist/{cli-ad00h1st.js → cli-0dkpdvnn.js} +10 -10
- package/dist/{cli-879txsac.js → cli-0mq8kxfx.js} +4 -4
- package/dist/{cli-rp1n2xpd.js → cli-0nvqg1hb.js} +1 -1
- package/dist/{cli-qrwjk4xy.js → cli-0qyfna7a.js} +5 -5
- package/dist/cli-0vxbrxr3.js +1006 -0
- package/dist/{cli-vxmmttmt.js → cli-132h67ps.js} +52 -52
- package/dist/{cli-yd7e590v.js → cli-1e13gvfn.js} +14 -14
- package/dist/cli-1hj68b3h.js +30 -0
- package/dist/{cli-hzhv7yac.js → cli-1zbj28py.js} +1 -1
- package/dist/{cli-0k7ppk9k.js → cli-20mkgwev.js} +43 -38
- package/dist/{cli-ejnhs815.js → cli-288k5ep1.js} +11 -11
- package/dist/{cli-njvpngc6.js → cli-2n7qdqfv.js} +3 -3
- package/dist/{cli-r04ve9xw.js → cli-2r62jy9s.js} +1 -1
- package/dist/{cli-9j1t3kf6.js → cli-3179w2rz.js} +2 -2
- package/dist/cli-3a3hm1z8.js +15 -0
- package/dist/cli-3bagv8rt.js +37 -0
- package/dist/{cli-6ajyhxh7.js → cli-3bcsc3m7.js} +2 -2
- package/dist/{cli-jgq9xptq.js → cli-3g0vbq46.js} +4 -4
- package/dist/{cli-69szn7w7.js → cli-3ktfe5jx.js} +71 -47
- package/dist/{cli-yjb3cddd.js → cli-44r66df2.js} +1 -1
- package/dist/{cli-mv8ft7b0.js → cli-4y2bekkn.js} +3 -3
- package/dist/cli-547fsc36.js +15 -0
- package/dist/{cli-6p8p2e6r.js → cli-5pyes68e.js} +1278 -23
- package/dist/{cli-930zbczq.js → cli-5t00r6c9.js} +3 -3
- package/dist/{cli-kc7vd07m.js → cli-5xjdft4s.js} +3601 -1700
- package/dist/{cli-4dyzzkfb.js → cli-643skca1.js} +954 -180
- package/dist/{cli-vr4eyq6p.js → cli-6a77m17n.js} +540 -412
- package/dist/{cli-v41kn3cd.js → cli-6prwz0zn.js} +4427 -5566
- package/dist/{cli-1nfabrt4.js → cli-6xrbpj5j.js} +4 -4
- package/dist/{cli-meydjstb.js → cli-6yhjqd6k.js} +4965 -69
- package/dist/{cli-6yy4fepf.js → cli-727sq1f9.js} +4 -4
- package/dist/{cli-snxhtehz.js → cli-7abeph0b.js} +7 -8
- package/dist/{cli-ty3gha1p.js → cli-7b9bwrfg.js} +2 -2
- package/dist/{cli-g6a696c0.js → cli-7dwsn9y5.js} +4 -4
- package/dist/{cli-r9d2tya0.js → cli-7qkbab03.js} +5 -5
- package/dist/{cli-7ca8hczj.js → cli-7svwhw1a.js} +1 -1
- package/dist/{cli-ze1ndjs4.js → cli-83kf2y60.js} +8 -8
- package/dist/{cli-rs1rzwp4.js → cli-8crn0510.js} +1 -1
- package/dist/{cli-wym6rxgt.js → cli-8kemtj1r.js} +10 -15
- package/dist/{cli-md4tn21h.js → cli-967jrz7j.js} +40 -26
- package/dist/{cli-jcnc5ret.js → cli-976m0zcw.js} +38 -28
- package/dist/{cli-cbg0j1yt.js → cli-98sea4d9.js} +3 -3
- package/dist/{cli-xh5fpmg8.js → cli-9txap41q.js} +101 -18
- package/dist/{cli-24wervhz.js → cli-aktk3qt6.js} +3 -3
- package/dist/{cli-096aftq6.js → cli-b70cpf8f.js} +7 -7
- package/dist/{cli-2ap1the6.js → cli-by7s3n4p.js} +1 -1
- package/dist/{cli-w4bvtxet.js → cli-byzq8xht.js} +7 -7
- package/dist/{cli-phe2vcw5.js → cli-d1zkys4j.js} +150 -99
- package/dist/cli-dr6x9qdk.js +15 -0
- package/dist/cli-dt931hb8.js +9740 -0
- package/dist/{cli-0e914dp9.js → cli-e1wprqnd.js} +3 -3
- package/dist/{cli-2ayk9gn8.js → cli-e2wzzw17.js} +2 -2
- package/dist/{cli-1jx0srjt.js → cli-e9p9h14n.js} +1921 -80
- package/dist/{cli-2savn6mm.js → cli-eaqxkeq0.js} +10 -10
- package/dist/{cli-dw9rtjm3.js → cli-etykr11s.js} +3061 -727
- package/dist/{cli-73rmgm45.js → cli-f07sgaax.js} +2 -2
- package/dist/{cli-gc6b94tj.js → cli-fe8he9cy.js} +2 -2
- package/dist/{cli-s4pccby1.js → cli-h0edykd1.js} +1 -1
- package/dist/cli-h5cveb69.js +15 -0
- package/dist/{cli-gcyws2bp.js → cli-hamdfjtx.js} +2 -2
- package/dist/{cli-jwnac23b.js → cli-hh5m39pt.js} +1 -1
- package/dist/{cli-f9g96z28.js → cli-j8fmn3wv.js} +11 -11
- package/dist/cli-jngvszex.js +1514 -0
- package/dist/{cli-8vbxjzk0.js → cli-k791mabe.js} +6 -6
- package/dist/{cli-9fwznq4p.js → cli-k9m8fckz.js} +7 -7
- package/dist/{cli-39t9d248.js → cli-kz8rar0g.js} +1 -1
- package/dist/{cli-rzbsh6bw.js → cli-n15fhd43.js} +1 -1
- package/dist/{cli-wvbaq052.js → cli-nmdy8bzf.js} +10 -3
- package/dist/{cli-t9pzz2eq.js → cli-ntmjzyte.js} +4 -1
- package/dist/{cli-adzmmcvf.js → cli-ny8f5g7t.js} +2 -2
- package/dist/cli-p0g0erm9.js +15 -0
- package/dist/{cli-2zjxake1.js → cli-pgdqhdkw.js} +4 -4
- package/dist/cli-ph1jce1b.js +16 -0
- package/dist/{cli-v4z5v3jd.js → cli-phantfg3.js} +480 -328
- package/dist/{cli-2414h5r9.js → cli-rb1z91g8.js} +10221 -1397
- package/dist/{cli-a49frv85.js → cli-redtbppc.js} +1 -1
- package/dist/{cli-91amj3md.js → cli-s7bfz1ye.js} +15 -15
- package/dist/{cli-kg63yp1r.js → cli-sf5kp73f.js} +18 -18
- package/dist/{cli-fww016hh.js → cli-sq32dgfe.js} +1373 -7129
- package/dist/{cli-enavhq6r.js → cli-tbrjvrrg.js} +1 -1
- package/dist/{cli-84xn7bgz.js → cli-tdd9dvw6.js} +1 -1
- package/dist/{cli-qkbevqer.js → cli-tjrrabez.js} +3 -3
- package/dist/{cli-q457ga28.js → cli-tkrp183j.js} +11 -11
- package/dist/{cli-7w1fs01q.js → cli-trvtxwzt.js} +2 -2
- package/dist/{cli-ayxxkk3p.js → cli-v1rhq77v.js} +8 -8
- package/dist/{cli-9j47sgzy.js → cli-v3jxx8dv.js} +2 -2
- package/dist/{cli-f2rwt43y.js → cli-v84kb7af.js} +13 -13
- package/dist/{cli-3mhdmcd4.js → cli-vp2ksaq9.js} +1 -1
- package/dist/{cli-b0m3bg0f.js → cli-vrb8pvrf.js} +6 -6
- package/dist/cli-vxxdf2ma.js +15 -0
- package/dist/{cli-wd7b5hgc.js → cli-w81s97bn.js} +1 -1
- package/dist/{cli-bqfx72e6.js → cli-wkzrknpt.js} +1 -1
- package/dist/{cli-cg1q8ymp.js → cli-wqpvfq2m.js} +1 -1
- package/dist/{cli-pq0kv31y.js → cli-wsh5vfa7.js} +9 -9
- package/dist/{cli-shyhb4t5.js → cli-wtwe8vng.js} +39 -39
- package/dist/{cli-3wsabyt0.js → cli-ww8wxfzx.js} +2 -2
- package/dist/{cli-e8trbfx1.js → cli-x80zagf5.js} +1 -1
- package/dist/{cli-r495stwd.js → cli-xd6ntv7x.js} +2 -2
- package/dist/{cli-0h6m6z5g.js → cli-xmc2nrtv.js} +1 -1
- package/dist/{cli-q5n3deaf.js → cli-ytgtqsy9.js} +1 -1
- package/dist/{cli-srq69pn1.js → cli-yvnnyjxm.js} +1 -1
- package/dist/{cli-krk8y8c7.js → cli-z0c98h7h.js} +1747 -439
- package/dist/{cli-mw1tmn3x.js → cli-z0effej1.js} +7 -7
- package/dist/{cli-7g5qj2ca.js → cli-zcb64xzv.js} +1 -1
- package/dist/{cli-m0ea8ggd.js → cli-zdkcp8p0.js} +2 -2
- package/dist/{cli-37p61fcg.js → cli-zgsd2w2k.js} +20 -22
- package/dist/{cli-tc165vrb.js → cli-zmfs06hg.js} +7 -6
- package/dist/{cli-edxfzgah.js → cli-zvsy4abb.js} +4 -4
- package/dist/{cli-z8t4485r.js → cli-zyf288rw.js} +2 -2
- package/dist/cli.js +58 -59
- package/dist/{codex-adapter-eq61radw.js → codex-adapter-seht4h9t.js} +9 -9
- package/dist/{codex-hook-8nmepvz6.js → codex-hook-w5nmtrn2.js} +2 -2
- package/dist/{codex-login-vbd9707w.js → codex-login-67qarfcg.js} +1 -1
- package/dist/{codex-session-runner-rfx355h4.js → codex-session-runner-tq95x3gq.js} +10 -10
- package/dist/{commands-d1z0sx62.js → commands-0awwqxq5.js} +3 -3
- package/dist/{controller-9hz6d8x3.js → controller-hgjx521c.js} +4 -4
- package/dist/{controllers-connect-tz07d2xr.js → controllers-connect-j4kdmhfj.js} +28 -28
- package/dist/core-8fw1gwg7.js +41 -0
- package/dist/{cursor-adapter-ef22ze3j.js → cursor-adapter-0rg8wk6j.js} +2 -2
- package/dist/{db-gd81d68c.js → db-8xs2js3s.js} +3 -3
- package/dist/{db-vrckks6q.js → db-dd6hj211.js} +2 -2
- package/dist/{devin-adapter-kdt6a2bh.js → devin-adapter-tn1twrha.js} +1 -1
- package/dist/{devtools-qxfgbsqz.js → devtools-b8qts77k.js} +1 -1
- package/dist/{dispatcher-76as8w2t.js → dispatcher-v7drd034.js} +24 -24
- package/dist/{docker-51ta7jsh.js → docker-6007r2fj.js} +2 -2
- package/dist/{dsh-adapter-ypfvcdyz.js → dsh-adapter-ah8npj2x.js} +2 -2
- package/dist/{e2b-dm9r8hpy.js → e2b-hg80w0qr.js} +2 -2
- package/dist/{e2b-05kn3kpq.js → e2b-z1g7vpz6.js} +4 -4
- package/dist/{easter-egg-3d-sg21j15g.js → easter-egg-3d-8n4w3s9k.js} +1 -1
- package/dist/{embedding-space-zsdw37bb.js → embedding-space-0p921zt3.js} +5 -5
- package/dist/{embeddings-p4e3e1m6.js → embeddings-9s7kbrc6.js} +1 -1
- package/dist/emscripten-module-Q67P5WYC-3sde6cre.js +2458 -0
- package/dist/{event-bus-tvf2grf4.js → event-bus-pawddp92.js} +1 -1
- package/dist/{execute-nztd0af0.js → execute-x0fy9j0m.js} +1 -1
- package/dist/{external-channel-717yzn4d.js → external-channel-ktfvn29c.js} +2 -2
- package/dist/ffi-cbfmmtqk.js +85 -0
- package/dist/fx-adapter-15vjxvgm.js +20 -0
- package/dist/getMachineId-bsd-2rd3pnz7.js +36 -0
- package/dist/getMachineId-bsd-3p48mkt1.js +36 -0
- package/dist/{getMachineId-bsd-637a7rbk.js → getMachineId-bsd-bk6tmeen.js} +5 -5
- package/dist/getMachineId-bsd-pssqgwmm.js +37 -0
- package/dist/getMachineId-bsd-v218x3xd.js +36 -0
- package/dist/getMachineId-bsd-wbxcazef.js +36 -0
- package/dist/getMachineId-bsd-x0942pbz.js +36 -0
- package/dist/getMachineId-darwin-5qsy4qcg.js +36 -0
- package/dist/getMachineId-darwin-6v7zsshx.js +37 -0
- package/dist/getMachineId-darwin-fcc3fjag.js +36 -0
- package/dist/getMachineId-darwin-pg84hftj.js +36 -0
- package/dist/{getMachineId-darwin-9vytrcnn.js → getMachineId-darwin-tyyevt26.js} +5 -5
- package/dist/getMachineId-darwin-wagmbf0d.js +36 -0
- package/dist/getMachineId-darwin-zvkmwr3y.js +36 -0
- package/dist/{getMachineId-linux-mkzsvyyz.js → getMachineId-linux-2ncg1epd.js} +3 -3
- package/dist/getMachineId-linux-2tmt2ptc.js +29 -0
- package/dist/getMachineId-linux-empwyp2y.js +29 -0
- package/dist/getMachineId-linux-fanqd45b.js +29 -0
- package/dist/getMachineId-linux-h6fyga0x.js +29 -0
- package/dist/getMachineId-linux-tbhgz1k9.js +29 -0
- package/dist/getMachineId-linux-zrbyw7dt.js +29 -0
- package/dist/getMachineId-unsupported-29g9dkgv.js +19 -0
- package/dist/getMachineId-unsupported-8xfq8djv.js +19 -0
- package/dist/getMachineId-unsupported-8y9cag1p.js +19 -0
- package/dist/getMachineId-unsupported-a6sjrm02.js +19 -0
- package/dist/getMachineId-unsupported-bp3w7ds0.js +19 -0
- package/dist/{getMachineId-unsupported-4cfs2n11.js → getMachineId-unsupported-sj6fk8sw.js} +3 -3
- package/dist/getMachineId-unsupported-v0p5gdxp.js +19 -0
- package/dist/getMachineId-win-hc996p0x.js +38 -0
- package/dist/{getMachineId-win-154s3qma.js → getMachineId-win-msq9ad87.js} +6 -6
- package/dist/getMachineId-win-tajyqwd6.js +38 -0
- package/dist/getMachineId-win-tzc163da.js +38 -0
- package/dist/getMachineId-win-xdaa0mgq.js +38 -0
- package/dist/getMachineId-win-xk6p98m5.js +38 -0
- package/dist/getMachineId-win-xtk658fm.js +38 -0
- package/dist/{google-generative-ai-sw77egmr.js → google-generative-ai-nzndg246.js} +1 -1
- package/dist/{google-vertex-rrw93g8h.js → google-vertex-ragh3nnw.js} +1 -1
- package/dist/grok-adapter-77httan0.js +20 -0
- package/dist/handlers-c1jp5b6h.js +39 -0
- package/dist/heartbeat-5yaj6dym.js +49 -0
- package/dist/{hook-ctz0xmp3.js → hook-2jttae8s.js} +10 -11
- package/dist/hook-c99nycyh.js +21 -0
- package/dist/{http-zregegrx.js → http-7y9dbfrr.js} +155 -122
- package/dist/{index-kzdqn3dd.js → index-6g9rdcrj.js} +3036 -758
- package/dist/index-7dwh9kxh.js +41 -0
- package/dist/{index-ym9fgxad.js → index-8p03vx1h.js} +8 -8
- package/dist/{index-maddg9ys.js → index-cw8nxnba.js} +4330 -15375
- package/dist/{index-fdym6ryb.js → index-dm7c6hw5.js} +28 -28
- package/dist/index-fqf82sbk.js +10584 -0
- package/dist/{index-126v2d0t.js → index-g7rthzrv.js} +11 -2923
- package/dist/{index-x9qf8dg7.js → index-h9xnzfhx.js} +21 -20
- package/dist/{index-42jq9yy3.js → index-jvfp0j47.js} +516 -10
- package/dist/{index-mtnbhe12.js → index-q60mhcpd.js} +23631 -19921
- package/dist/{index-evay0xyk.js → index-qxcfv8vq.js} +1 -1
- package/dist/{index-rz8ve510.js → index-t274qhhs.js} +6 -6
- package/dist/{index-kdmkfjt7.js → index-t4n9z755.js} +3491 -2487
- package/dist/{index-7dgxveck.js → index-tcegcysh.js} +5 -5
- package/dist/{index-whysn1wf.js → index-tn1m3q9b.js} +3 -3
- package/dist/index-wp9tarbt.js +43 -0
- package/dist/{index-5kx15d19.js → index-xhp7yp3t.js} +1 -1
- package/dist/index-z6np2405.js +38 -0
- package/dist/{k8s-ejkk0aw7.js → k8s-mr1r12th.js} +2 -2
- package/dist/{keepalive-zdqay870.js → keepalive-7eyb8y4t.js} +4 -4
- package/dist/lead-50cgn8s1.js +81 -0
- package/dist/{maintenance-t5ndg11m.js → maintenance-tdrd8nwv.js} +1 -1
- package/dist/module-ES6BEMUI-6htewwha.js +1210 -0
- package/dist/{node-0as4n1ef.js → node-gbx1t3pa.js} +1 -1
- package/dist/{oauth-refresh-sweep-y9zyd7t6.js → oauth-refresh-sweep-f4c7g37h.js} +3 -3
- package/dist/{object-webhooks-mkca91s0.js → object-webhooks-p190rdxp.js} +7 -7
- package/dist/{onboard-ss995244.js → onboard-56h4sks6.js} +7 -7
- package/dist/{opencode-adapter-mwpz0278.js → opencode-adapter-xg3yxfr0.js} +8 -8
- package/dist/{otel-impl-6n6vva3x.js → otel-impl-kepzgm4n.js} +36360 -9179
- package/dist/{pending-2sxh1t6j.js → pending-xgv316w0.js} +25 -25
- package/dist/{pi-mono-adapter-sfb7zy43.js → pi-mono-adapter-txe0syzb.js} +19 -22
- package/dist/{pricing-refresh-h79bg4cf.js → pricing-refresh-041zpyhf.js} +2 -2
- package/dist/{rbac-roles-ckq0czp4.js → rbac-roles-8f3jbcaf.js} +2 -2
- package/dist/{rbac-roles-jg2e260w.js → rbac-roles-cw7rrw5b.js} +3 -3
- package/dist/{render-v2-ymbshmn0.js → render-v2-2ezw4mzt.js} +10 -10
- package/dist/{resume-jdhnt4jk.js → resume-p14wdx8m.js} +13 -13
- package/dist/{runtime-y28jhhnf.js → runtime-he7c9g1r.js} +1 -1
- package/dist/{session-access-k4ta5hvp.js → session-access-8jvq86fj.js} +5 -5
- package/dist/{session-source-backfill-528j4s8j.js → session-source-backfill-6fe3hcgb.js} +3 -3
- package/dist/{setup-d6pj82fr.js → setup-6v0bn4r1.js} +3 -3
- package/dist/thread-buffer-8860v1ta.js +40 -0
- package/dist/{token-util-pjgekqxr.js → token-util-hnzceyn9.js} +1 -1
- package/dist/{token-pgr2w4s3.js → token-xnc02n6w.js} +21 -14
- package/dist/{tree-visibility-kjxv3nxk.js → tree-visibility-g1a8ff4r.js} +2 -2
- package/dist/{user-merge-jobs-rabbncf6.js → user-merge-jobs-vjsps179.js} +3 -3
- package/dist/{virtual-modules-22k51txd.js → virtual-modules-mreda4fp.js} +3 -3
- package/dist/{work-objects-xtjbar3r.js → work-objects-hfw15e35.js} +26 -26
- package/dist/{worker-follow-up-fg48vk6d.js → worker-follow-up-gbaz2ydz.js} +24 -24
- package/dist/worker-hkm8ftqp.js +81 -0
- package/dist/{x-vfsqypht.js → x-k29vmskt.js} +2 -2
- package/openapi.json +57 -1
- package/package.json +39 -39
- package/src/be/db/model-profiles.ts +103 -12
- package/src/be/db/tasks/read.ts +5 -0
- package/src/be/db.ts +14 -4
- package/src/be/model-group-resolution.ts +134 -0
- package/src/be/model-tier-resolution.ts +120 -17
- package/src/be/model-validation.ts +9 -1
- package/src/be/runtime-pools/routing.ts +22 -8
- package/src/be/scripts/extract-schema.ts +7 -0
- package/src/be/swarm-config-guard.ts +17 -7
- package/src/commands/onboard/agent-fs-version.ts +1 -1
- package/src/extensions/contract-types.generated.ts +1 -1
- package/src/http/db-query.ts +8 -2
- package/src/http/operator-actor.ts +3 -8
- package/src/http/poll.ts +20 -1
- package/src/http/repos.ts +3 -1
- package/src/http/schedules.ts +23 -3
- package/src/http/tasks.ts +11 -1
- package/src/prompts/base-prompt.ts +10 -6
- package/src/prompts/session-templates.ts +3 -3
- package/src/providers/acp-targets.ts +1 -1
- package/src/providers/amp-adapter.ts +11 -9
- package/src/providers/cursor-adapter.ts +1 -1
- package/src/realtime/browser.generated.txt +1 -1
- package/src/scheduler/schedule-task.ts +1 -0
- package/src/scripts-runtime/types/swarm-extension.d.ts +2 -0
- package/src/slack/config.ts +4 -0
- package/src/slack/render-v2.ts +2 -1
- package/src/slack/responses.ts +2 -1
- package/src/tasks/follow-up-gate.ts +142 -38
- package/src/tasks/worker-follow-up.ts +126 -37
- package/src/tests/amp-adapter.test.ts +57 -9
- package/src/tests/base-prompt.test.ts +36 -2
- package/src/tests/db-retention-defaults.test.ts +28 -3
- package/src/tests/entrypoint-repo-autoclone-args.test.ts +10 -0
- package/src/tests/follow-up-gate-shadow.test.ts +268 -10
- package/src/tests/linear-outbound-sync.test.ts +59 -25
- package/src/tests/operator-actor-keyless.test.ts +103 -0
- package/src/tests/profile-tier-alias.test.ts +9 -3
- package/src/tests/runner-repo-clone-args.test.ts +15 -6
- package/src/tests/workflow-system-one-extraction.test.ts +21 -0
- package/src/tests/workflow-wait-filter.test.ts +7 -7
- package/src/tests/worktree-reaper.test.ts +15 -4
- package/src/tools/schedules/create-schedule.ts +20 -3
- package/src/tools/schedules/patch-schedule.ts +30 -4
- package/src/tools/schedules/update-schedule.ts +30 -4
- package/src/tools/send-task.ts +17 -3
- package/src/tools/slack-post.ts +7 -2
- package/src/tools/slack-reply.ts +6 -2
- package/src/tools/task-action.ts +16 -3
- package/src/tools/utils.ts +1 -1
- package/src/types.ts +10 -0
- package/src/utils/amp-models.ts +20 -4
- package/src/utils/secret-scrubber.ts +6 -4
- package/src/workflows/engine.ts +36 -8
- package/src/workflows/executors/agent-task.ts +13 -2
- package/src/workflows/executors/code-match.ts +11 -31
- package/src/workflows/executors/script.ts +13 -0
- package/src/workflows/executors/system-one-extraction.ts +9 -6
- package/src/workflows/executors/wait.ts +1 -1
- package/src/workflows/foreach-driver.ts +5 -1
- package/src/workflows/model-validation.ts +13 -1
- package/src/workflows/predicate-sandbox.ts +171 -0
- package/src/workflows/retry-poller.ts +1 -1
- package/src/workflows/wait-filter.ts +14 -192
- package/templates/skills/heartbeat-runbook/content.md +1 -0
- package/templates/skills/slack-interaction/content.md +4 -0
- package/templates/skills/swarm-docs/content.md +1 -0
- package/dist/acp-adapter-99n6z9ky.js +0 -17
- package/dist/cli-5ss6qqt9.js +0 -45
- package/dist/cli-dzzh58sy.js +0 -6996
- package/dist/cli-j9ccfveb.js +0 -1849
- package/dist/cli-mna6pmfx.js +0 -1485
- package/dist/cli-r8ddn0hf.js +0 -25583
- package/dist/core-dynsv289.js +0 -41
- package/dist/fx-adapter-9k0hptnz.js +0 -20
- package/dist/grok-adapter-skdj2pce.js +0 -20
- package/dist/handlers-5btjqkz6.js +0 -39
- package/dist/heartbeat-vfb1gy84.js +0 -49
- package/dist/hook-eh52p7yd.js +0 -22
- package/dist/index-7w8p6em0.js +0 -41
- package/dist/index-t56y945n.js +0 -4
- package/dist/index-vfemrwwk.js +0 -10002
- package/dist/index-vz4semsx.js +0 -38
- package/dist/index-y3s0xp2v.js +0 -43
- package/dist/lead-6cscw8a5.js +0 -82
- package/dist/thread-buffer-9w6x5zec.js +0 -40
- package/dist/worker-g4aj93dt.js +0 -82
- package/dist/{azure-openai-responses-jeaas6x0.js → azure-openai-responses-e76k86gf.js} +4 -4
- package/dist/{openai-codex-responses-70g39cgz.js → openai-codex-responses-z2h941b8.js} +4 -4
- package/dist/{openai-completions-cv3hp4h5.js → openai-completions-5bxdkeg9.js} +4 -4
- package/dist/{openai-responses-trsvnks6.js → openai-responses-dzf3e8r5.js} +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import"./cli-
|
|
2
|
-
import"./cli-
|
|
1
|
+
import"./cli-5pyes68e.js";
|
|
2
|
+
import"./cli-by7s3n4p.js";
|
|
3
3
|
import {
|
|
4
4
|
auditAssetKeys,
|
|
5
5
|
init_asset_key_audit,
|
|
@@ -249,6 +249,8 @@ import {
|
|
|
249
249
|
checkProfileForAgent,
|
|
250
250
|
formatProfileCheckFailures,
|
|
251
251
|
init_model_profile_check,
|
|
252
|
+
resolveGroupForAgent,
|
|
253
|
+
init_model_group_resolution,
|
|
252
254
|
startTaskSearchBackfill,
|
|
253
255
|
stopTaskSearchBackfill,
|
|
254
256
|
init_search_index,
|
|
@@ -275,6 +277,7 @@ import {
|
|
|
275
277
|
MAX_MODEL_PROFILE_FALLBACKS,
|
|
276
278
|
modelProfileFallbacksError,
|
|
277
279
|
taskProfileError,
|
|
280
|
+
modelGroupRefError,
|
|
278
281
|
scheduleProfileUpdate,
|
|
279
282
|
init_model_profiles,
|
|
280
283
|
refreshActiveSessionOnActivity2,
|
|
@@ -544,7 +547,7 @@ import {
|
|
|
544
547
|
countScriptRunJournalSteps2,
|
|
545
548
|
countScriptRunJournalAgentTaskSteps2,
|
|
546
549
|
init_db4
|
|
547
|
-
} from "./cli-
|
|
550
|
+
} from "./cli-z0c98h7h.js";
|
|
548
551
|
import {
|
|
549
552
|
PRIMARY_ROLE_NAMES2,
|
|
550
553
|
OperatorGrantedTargetError2,
|
|
@@ -558,7 +561,7 @@ import {
|
|
|
558
561
|
assertNotLastAdmin2,
|
|
559
562
|
setUserRoles2,
|
|
560
563
|
init_rbac_roles
|
|
561
|
-
} from "./cli-
|
|
564
|
+
} from "./cli-ww8wxfzx.js";
|
|
562
565
|
import {
|
|
563
566
|
MAX_MODEL_GROUP_MEMBERS,
|
|
564
567
|
listModelGroups,
|
|
@@ -568,24 +571,25 @@ import {
|
|
|
568
571
|
modelGroupReferences,
|
|
569
572
|
deleteModelGroup,
|
|
570
573
|
init_model_groups
|
|
571
|
-
} from "./cli-
|
|
574
|
+
} from "./cli-tjrrabez.js";
|
|
572
575
|
import {
|
|
573
576
|
requestModelCatalogRefresh2,
|
|
574
577
|
init_pricing_refresh
|
|
575
|
-
} from "./cli-
|
|
578
|
+
} from "./cli-e2wzzw17.js";
|
|
576
579
|
import {
|
|
577
580
|
workflowEventBus2,
|
|
578
581
|
init_event_bus
|
|
579
|
-
} from "./cli-
|
|
582
|
+
} from "./cli-0nvqg1hb.js";
|
|
580
583
|
import {
|
|
581
584
|
shouldBlockChannel2,
|
|
582
585
|
init_external_channel
|
|
583
|
-
} from "./cli-
|
|
584
|
-
import"./cli-
|
|
585
|
-
import"./cli-
|
|
586
|
-
import
|
|
586
|
+
} from "./cli-zyf288rw.js";
|
|
587
|
+
import"./cli-tdd9dvw6.js";
|
|
588
|
+
import"./cli-6a77m17n.js";
|
|
589
|
+
import {
|
|
590
|
+
require_dist6
|
|
591
|
+
} from "./cli-dt931hb8.js";
|
|
587
592
|
import {
|
|
588
|
-
require_dist4,
|
|
589
593
|
getSlackConnectionState,
|
|
590
594
|
init_connection_state,
|
|
591
595
|
getSlackInboundDiagnostics,
|
|
@@ -621,7 +625,7 @@ import {
|
|
|
621
625
|
startSlackApp2,
|
|
622
626
|
stopSlackApp2,
|
|
623
627
|
init_app4
|
|
624
|
-
} from "./cli-
|
|
628
|
+
} from "./cli-sq32dgfe.js";
|
|
625
629
|
import {
|
|
626
630
|
reconcileAgentMaxTasksPolicy,
|
|
627
631
|
upsertSwarmConfigWithPolicyMirror,
|
|
@@ -635,12 +639,12 @@ import {
|
|
|
635
639
|
reconcileAgentStatusFromRuntimes,
|
|
636
640
|
listRuntimeInstancesForPool,
|
|
637
641
|
init_multi_runtime
|
|
638
|
-
} from "./cli-
|
|
642
|
+
} from "./cli-eaqxkeq0.js";
|
|
639
643
|
import {
|
|
640
644
|
retryFailedRun2,
|
|
641
645
|
cancelWorkflowRun2,
|
|
642
646
|
init_resume
|
|
643
|
-
} from "./cli-
|
|
647
|
+
} from "./cli-d1zkys4j.js";
|
|
644
648
|
import {
|
|
645
649
|
safeParse,
|
|
646
650
|
getObjectShape,
|
|
@@ -1156,7 +1160,7 @@ import {
|
|
|
1156
1160
|
getEnabledCapabilities,
|
|
1157
1161
|
createServer,
|
|
1158
1162
|
init_server
|
|
1159
|
-
} from "./cli-
|
|
1163
|
+
} from "./cli-5xjdft4s.js";
|
|
1160
1164
|
import {
|
|
1161
1165
|
getFileStorageProvider2,
|
|
1162
1166
|
init_registry2
|
|
@@ -1182,7 +1186,7 @@ import {
|
|
|
1182
1186
|
resolvePoolDelivery2,
|
|
1183
1187
|
createPoolAgent2,
|
|
1184
1188
|
init_db2
|
|
1185
|
-
} from "./cli-
|
|
1189
|
+
} from "./cli-0qyfna7a.js";
|
|
1186
1190
|
import {
|
|
1187
1191
|
warnIfCorsAllowsAnyOrigin,
|
|
1188
1192
|
isOriginAllowedForCredentials,
|
|
@@ -1231,7 +1235,7 @@ import {
|
|
|
1231
1235
|
describeRequestRoute,
|
|
1232
1236
|
route,
|
|
1233
1237
|
init_route_def
|
|
1234
|
-
} from "./cli-
|
|
1238
|
+
} from "./cli-byzq8xht.js";
|
|
1235
1239
|
import {
|
|
1236
1240
|
startPoolRouting,
|
|
1237
1241
|
stopPoolRouting,
|
|
@@ -1244,29 +1248,29 @@ import {
|
|
|
1244
1248
|
checkHeartbeatChecklist2,
|
|
1245
1249
|
runHeartbeatSweep2,
|
|
1246
1250
|
stopHeartbeat2
|
|
1247
|
-
} from "./cli-
|
|
1248
|
-
import"./cli-
|
|
1251
|
+
} from "./cli-967jrz7j.js";
|
|
1252
|
+
import"./cli-hamdfjtx.js";
|
|
1249
1253
|
import {
|
|
1250
1254
|
runtimeSupervisorStatus,
|
|
1251
1255
|
startRuntimeSupervisor,
|
|
1252
1256
|
stopRuntimeSupervisor
|
|
1253
|
-
} from "./cli-
|
|
1257
|
+
} from "./cli-v84kb7af.js";
|
|
1254
1258
|
import {
|
|
1255
1259
|
TASK_TITLE_TIMEOUT_MS,
|
|
1256
1260
|
generateTaskTitle
|
|
1257
|
-
} from "./cli-
|
|
1261
|
+
} from "./cli-k791mabe.js";
|
|
1258
1262
|
import"./cli-ns59dc6r.js";
|
|
1259
1263
|
import {
|
|
1260
1264
|
ACP_TARGET_IDS
|
|
1261
|
-
} from "./cli-
|
|
1265
|
+
} from "./cli-tbrjvrrg.js";
|
|
1262
1266
|
import {
|
|
1263
1267
|
reasoningCapability,
|
|
1264
1268
|
supportedReasoningLevels
|
|
1265
|
-
} from "./cli-
|
|
1269
|
+
} from "./cli-08gfvs58.js";
|
|
1266
1270
|
import {
|
|
1267
1271
|
MAX_RATE_LIMIT_RESET_MS,
|
|
1268
1272
|
MAX_SPEND_CAP_HOLD_MS
|
|
1269
|
-
} from "./cli-
|
|
1273
|
+
} from "./cli-8crn0510.js";
|
|
1270
1274
|
import {
|
|
1271
1275
|
AgentFsRequestError2,
|
|
1272
1276
|
resolveAgentFsSharedContext2,
|
|
@@ -1277,10 +1281,10 @@ import {
|
|
|
1277
1281
|
agentFsRequest2,
|
|
1278
1282
|
resolveApiUrl2,
|
|
1279
1283
|
init_agent_fs_provision
|
|
1280
|
-
} from "./cli-
|
|
1284
|
+
} from "./cli-5t00r6c9.js";
|
|
1281
1285
|
import {
|
|
1282
1286
|
Anthropic
|
|
1283
|
-
} from "./cli-
|
|
1287
|
+
} from "./cli-20mkgwev.js";
|
|
1284
1288
|
import {
|
|
1285
1289
|
isLeadChannelMonitoringEnabled,
|
|
1286
1290
|
SIMILARITY_THRESHOLD,
|
|
@@ -1288,19 +1292,19 @@ import {
|
|
|
1288
1292
|
isUnknownModelError,
|
|
1289
1293
|
checkProviderPoolKey,
|
|
1290
1294
|
writeSkillsToFilesystem
|
|
1291
|
-
} from "./cli-
|
|
1295
|
+
} from "./cli-83kf2y60.js";
|
|
1292
1296
|
import {
|
|
1293
1297
|
objectWebhookSecret2,
|
|
1294
1298
|
handleObjectWebhookEvent2,
|
|
1295
1299
|
init_object_webhooks
|
|
1296
|
-
} from "./cli-
|
|
1297
|
-
import"./cli-
|
|
1300
|
+
} from "./cli-0mq8kxfx.js";
|
|
1301
|
+
import"./cli-z0effej1.js";
|
|
1298
1302
|
import {
|
|
1299
1303
|
LOOKUP_USER_TEAM2,
|
|
1300
1304
|
isUserAllowed2,
|
|
1301
1305
|
init_handlers
|
|
1302
|
-
} from "./cli-
|
|
1303
|
-
import"./cli-
|
|
1306
|
+
} from "./cli-v1rhq77v.js";
|
|
1307
|
+
import"./cli-zvsy4abb.js";
|
|
1304
1308
|
import {
|
|
1305
1309
|
createUserMergeJob2,
|
|
1306
1310
|
getUserMergeJob2,
|
|
@@ -1309,7 +1313,7 @@ import {
|
|
|
1309
1313
|
findFailedUserMergeJob2,
|
|
1310
1314
|
requeueUserMergeJob2,
|
|
1311
1315
|
runUserMergeJobs2
|
|
1312
|
-
} from "./cli-
|
|
1316
|
+
} from "./cli-2n7qdqfv.js";
|
|
1313
1317
|
import {
|
|
1314
1318
|
isCodexOAuthConfigKey
|
|
1315
1319
|
} from "./cli-j4bwnpkm.js";
|
|
@@ -1339,8 +1343,8 @@ import {
|
|
|
1339
1343
|
init_person_responder,
|
|
1340
1344
|
handleApprovalRequests,
|
|
1341
1345
|
init_approval_requests
|
|
1342
|
-
} from "./cli-
|
|
1343
|
-
import"./cli-
|
|
1346
|
+
} from "./cli-288k5ep1.js";
|
|
1347
|
+
import"./cli-ytgtqsy9.js";
|
|
1344
1348
|
import {
|
|
1345
1349
|
RATING_MODEL_MAX_LENGTH,
|
|
1346
1350
|
REFERENCES_SOURCE_MAX_LENGTH,
|
|
@@ -1441,7 +1445,7 @@ import {
|
|
|
1441
1445
|
init_typecheck,
|
|
1442
1446
|
parseSkillContent,
|
|
1443
1447
|
init_skill_parser
|
|
1444
|
-
} from "./cli-
|
|
1448
|
+
} from "./cli-phantfg3.js";
|
|
1445
1449
|
import {
|
|
1446
1450
|
signalProcessGroup,
|
|
1447
1451
|
detachedProcessGroup,
|
|
@@ -1458,17 +1462,17 @@ import {
|
|
|
1458
1462
|
forceRefreshAuthorizationOrThrow,
|
|
1459
1463
|
forceRefreshTokenOrThrow,
|
|
1460
1464
|
init_ensure_token
|
|
1461
|
-
} from "./cli-
|
|
1465
|
+
} from "./cli-zdkcp8p0.js";
|
|
1462
1466
|
import {
|
|
1463
1467
|
PRIMITIVE_KINDS,
|
|
1464
1468
|
ObjectsError,
|
|
1465
1469
|
recordObjectVersion,
|
|
1466
1470
|
init_objects
|
|
1467
|
-
} from "./cli-
|
|
1471
|
+
} from "./cli-3g0vbq46.js";
|
|
1468
1472
|
import {
|
|
1469
1473
|
agentFsClientFor,
|
|
1470
1474
|
init_agent_fs_identity
|
|
1471
|
-
} from "./cli-
|
|
1475
|
+
} from "./cli-3bcsc3m7.js";
|
|
1472
1476
|
import {
|
|
1473
1477
|
FilesError,
|
|
1474
1478
|
normalizeFilesError,
|
|
@@ -1477,7 +1481,7 @@ import {
|
|
|
1477
1481
|
AgentFsProvider,
|
|
1478
1482
|
init_agent_fs_provider
|
|
1479
1483
|
} from "./cli-skd2c4ej.js";
|
|
1480
|
-
import"./cli-
|
|
1484
|
+
import"./cli-yvnnyjxm.js";
|
|
1481
1485
|
import {
|
|
1482
1486
|
automationIntegrationFixUrl,
|
|
1483
1487
|
preflightAutomation,
|
|
@@ -1499,7 +1503,7 @@ import {
|
|
|
1499
1503
|
definitionNodeIds,
|
|
1500
1504
|
validateDefinition,
|
|
1501
1505
|
init_definition2
|
|
1502
|
-
} from "./cli-
|
|
1506
|
+
} from "./cli-976m0zcw.js";
|
|
1503
1507
|
import {
|
|
1504
1508
|
_fetchHolder,
|
|
1505
1509
|
CLIENT_ID,
|
|
@@ -1515,23 +1519,19 @@ import {
|
|
|
1515
1519
|
loadAllCodexOAuthSlots,
|
|
1516
1520
|
getValidCodexOAuth,
|
|
1517
1521
|
init_storage
|
|
1518
|
-
} from "./cli-
|
|
1522
|
+
} from "./cli-kz8rar0g.js";
|
|
1519
1523
|
import {
|
|
1520
1524
|
isMultiRuntimeEnabled,
|
|
1521
1525
|
init_multi_runtime2
|
|
1522
1526
|
} from "./cli-mdb054w3.js";
|
|
1523
|
-
import {
|
|
1524
|
-
getApiKey,
|
|
1525
|
-
init_api_key
|
|
1526
|
-
} from "./cli-pax9q4ff.js";
|
|
1527
1527
|
import {
|
|
1528
1528
|
createRuntimeProvider,
|
|
1529
1529
|
init_runtime_providers
|
|
1530
|
-
} from "./cli-
|
|
1530
|
+
} from "./cli-pgdqhdkw.js";
|
|
1531
1531
|
import {
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1532
|
+
getApiKey,
|
|
1533
|
+
init_api_key
|
|
1534
|
+
} from "./cli-pax9q4ff.js";
|
|
1535
1535
|
import {
|
|
1536
1536
|
hasSessionAccess,
|
|
1537
1537
|
getSessionRoot,
|
|
@@ -1541,13 +1541,16 @@ import {
|
|
|
1541
1541
|
toSessionSharesState,
|
|
1542
1542
|
setSessionShares,
|
|
1543
1543
|
init_session_shares
|
|
1544
|
-
} from "./cli-
|
|
1545
|
-
import
|
|
1544
|
+
} from "./cli-hh5m39pt.js";
|
|
1545
|
+
import {
|
|
1546
|
+
require_content_type
|
|
1547
|
+
} from "./cli-e9p9h14n.js";
|
|
1548
|
+
import"./cli-vrb8pvrf.js";
|
|
1546
1549
|
import {
|
|
1547
1550
|
import_websocket,
|
|
1548
1551
|
import_websocket_server,
|
|
1549
1552
|
init_wrapper2
|
|
1550
|
-
} from "./cli-
|
|
1553
|
+
} from "./cli-1hj68b3h.js";
|
|
1551
1554
|
import {
|
|
1552
1555
|
registerSessionTokenConnection,
|
|
1553
1556
|
init_session_token_connections,
|
|
@@ -1577,7 +1580,7 @@ import {
|
|
|
1577
1580
|
revokeAllAgentSessionTokens,
|
|
1578
1581
|
fingerprintApiKey,
|
|
1579
1582
|
init_users
|
|
1580
|
-
} from "./cli-
|
|
1583
|
+
} from "./cli-ny8f5g7t.js";
|
|
1581
1584
|
import {
|
|
1582
1585
|
CORE_TOOLS,
|
|
1583
1586
|
init_tool_config
|
|
@@ -1590,7 +1593,7 @@ import {
|
|
|
1590
1593
|
providerAccountTelemetrySchema,
|
|
1591
1594
|
rateLimitReplacementSchema,
|
|
1592
1595
|
init_provider_account_telemetry
|
|
1593
|
-
} from "./cli-
|
|
1596
|
+
} from "./cli-wqpvfq2m.js";
|
|
1594
1597
|
import {
|
|
1595
1598
|
CODEX_AUTH_FAILURE_BENCH_THRESHOLD,
|
|
1596
1599
|
CODEX_AUTH_WATCH_NAMESPACE,
|
|
@@ -1605,11 +1608,11 @@ import {
|
|
|
1605
1608
|
IDENTITY_FIELD_BUDGETS,
|
|
1606
1609
|
IdentityFieldBudgetError,
|
|
1607
1610
|
init_identity_field_budget
|
|
1608
|
-
} from "./cli-
|
|
1611
|
+
} from "./cli-8kemtj1r.js";
|
|
1609
1612
|
import {
|
|
1610
1613
|
getSlackConfiguration,
|
|
1611
1614
|
init_config5
|
|
1612
|
-
} from "./cli-
|
|
1615
|
+
} from "./cli-ntmjzyte.js";
|
|
1613
1616
|
import {
|
|
1614
1617
|
isSteeringEnabled2,
|
|
1615
1618
|
init_steering_enabled
|
|
@@ -1620,33 +1623,6 @@ import {
|
|
|
1620
1623
|
isSubscriptionPlanId,
|
|
1621
1624
|
init_subscription_plans
|
|
1622
1625
|
} from "./cli-nh7x3133.js";
|
|
1623
|
-
import {
|
|
1624
|
-
MODEL_SCOPED_WINDOWS,
|
|
1625
|
-
KEY_WIDE_WINDOWS,
|
|
1626
|
-
modelFamilyOf,
|
|
1627
|
-
isModelScopedWindow,
|
|
1628
|
-
activeModelBlocks,
|
|
1629
|
-
init_model_rate_limit_windows,
|
|
1630
|
-
CREDENTIAL_SELECTION_STRATEGIES,
|
|
1631
|
-
credentialSelectionStrategy,
|
|
1632
|
-
init_key_usage,
|
|
1633
|
-
CREDENTIAL_POOL_VARS,
|
|
1634
|
-
PROVIDER_CREDENTIAL_VARS,
|
|
1635
|
-
getModelAwareCredentialVars,
|
|
1636
|
-
splitCredentialPool,
|
|
1637
|
-
selectCredential,
|
|
1638
|
-
init_credentials2
|
|
1639
|
-
} from "./cli-wd7b5hgc.js";
|
|
1640
|
-
import {
|
|
1641
|
-
interpolate,
|
|
1642
|
-
init_template2,
|
|
1643
|
-
getTemplateDefinition,
|
|
1644
|
-
getAllTemplateDefinitions,
|
|
1645
|
-
init_registry3,
|
|
1646
|
-
resolveTemplate,
|
|
1647
|
-
init_resolver,
|
|
1648
|
-
init_session_templates
|
|
1649
|
-
} from "./cli-24wervhz.js";
|
|
1650
1626
|
import {
|
|
1651
1627
|
getOpenRouterAttributionHeaders,
|
|
1652
1628
|
init_openrouter_base_url
|
|
@@ -1827,7 +1803,34 @@ import {
|
|
|
1827
1803
|
KvKeySchema,
|
|
1828
1804
|
KvEntrySchema,
|
|
1829
1805
|
init_types5
|
|
1830
|
-
} from "./cli-
|
|
1806
|
+
} from "./cli-zmfs06hg.js";
|
|
1807
|
+
import {
|
|
1808
|
+
MODEL_SCOPED_WINDOWS,
|
|
1809
|
+
KEY_WIDE_WINDOWS,
|
|
1810
|
+
modelFamilyOf,
|
|
1811
|
+
isModelScopedWindow,
|
|
1812
|
+
activeModelBlocks,
|
|
1813
|
+
init_model_rate_limit_windows,
|
|
1814
|
+
CREDENTIAL_SELECTION_STRATEGIES,
|
|
1815
|
+
credentialSelectionStrategy,
|
|
1816
|
+
init_key_usage,
|
|
1817
|
+
CREDENTIAL_POOL_VARS,
|
|
1818
|
+
PROVIDER_CREDENTIAL_VARS,
|
|
1819
|
+
getModelAwareCredentialVars,
|
|
1820
|
+
splitCredentialPool,
|
|
1821
|
+
selectCredential,
|
|
1822
|
+
init_credentials2
|
|
1823
|
+
} from "./cli-w81s97bn.js";
|
|
1824
|
+
import {
|
|
1825
|
+
interpolate,
|
|
1826
|
+
init_template2,
|
|
1827
|
+
getTemplateDefinition,
|
|
1828
|
+
getAllTemplateDefinitions,
|
|
1829
|
+
init_registry3,
|
|
1830
|
+
resolveTemplate,
|
|
1831
|
+
init_resolver,
|
|
1832
|
+
init_session_templates
|
|
1833
|
+
} from "./cli-aktk3qt6.js";
|
|
1831
1834
|
import {
|
|
1832
1835
|
init_zod
|
|
1833
1836
|
} from "./cli-96234j5w.js";
|
|
@@ -1874,6 +1877,10 @@ import {
|
|
|
1874
1877
|
isAgentFsProxyEnabled,
|
|
1875
1878
|
init_constants3
|
|
1876
1879
|
} from "./cli-466jjrwe.js";
|
|
1880
|
+
import {
|
|
1881
|
+
realtimeBus,
|
|
1882
|
+
init_bus
|
|
1883
|
+
} from "./cli-syfdvhkc.js";
|
|
1877
1884
|
import {
|
|
1878
1885
|
parseEnvFlag,
|
|
1879
1886
|
isEnvFlagEnabled,
|
|
@@ -1882,11 +1889,7 @@ import {
|
|
|
1882
1889
|
import {
|
|
1883
1890
|
init_package,
|
|
1884
1891
|
package_default
|
|
1885
|
-
} from "./cli-
|
|
1886
|
-
import {
|
|
1887
|
-
realtimeBus,
|
|
1888
|
-
init_bus
|
|
1889
|
-
} from "./cli-syfdvhkc.js";
|
|
1892
|
+
} from "./cli-wtwe8vng.js";
|
|
1890
1893
|
import {
|
|
1891
1894
|
isAlias,
|
|
1892
1895
|
baseUrlEnvVar,
|
|
@@ -1898,7 +1901,7 @@ import {
|
|
|
1898
1901
|
registerVolatileSecret,
|
|
1899
1902
|
registerEnvSecrets,
|
|
1900
1903
|
init_secret_scrubber
|
|
1901
|
-
} from "./cli-
|
|
1904
|
+
} from "./cli-7qkbab03.js";
|
|
1902
1905
|
import {
|
|
1903
1906
|
__toESM
|
|
1904
1907
|
} from "./cli-242037k3.js";
|
|
@@ -7360,10 +7363,7 @@ function getOperatorActor(req, res) {
|
|
|
7360
7363
|
}
|
|
7361
7364
|
const rawKey = extractBearer(req);
|
|
7362
7365
|
const swarmKey = getApiKey();
|
|
7363
|
-
if (!swarmKey) {
|
|
7364
|
-
return { kind: "operator", id: fingerprintApiKey("") };
|
|
7365
|
-
}
|
|
7366
|
-
if (!rawKey || !verifyTokenEquality(swarmKey, rawKey)) {
|
|
7366
|
+
if (!swarmKey || !rawKey || !verifyTokenEquality(swarmKey, rawKey)) {
|
|
7367
7367
|
jsonError(res, "Unauthorized", 401);
|
|
7368
7368
|
return null;
|
|
7369
7369
|
}
|
|
@@ -13658,6 +13658,7 @@ declare module "swarm-extension" {
|
|
|
13658
13658
|
modelTier?: "smol" | "regular" | "smart" | "ultra" | undefined;
|
|
13659
13659
|
effort?: "low" | "medium" | "high" | "max" | "off" | "xhigh" | undefined;
|
|
13660
13660
|
profile?: string | undefined;
|
|
13661
|
+
modelGroup?: string | undefined;
|
|
13661
13662
|
fallbackHops?:
|
|
13662
13663
|
| {
|
|
13663
13664
|
from: string;
|
|
@@ -13847,6 +13848,7 @@ declare module "swarm-extension" {
|
|
|
13847
13848
|
resolvedEffort?: "low" | "medium" | "high" | "max" | "off" | "xhigh" | undefined;
|
|
13848
13849
|
profile?: string | undefined;
|
|
13849
13850
|
resolvedProfile?: string | undefined;
|
|
13851
|
+
modelGroup?: string | undefined;
|
|
13850
13852
|
fallbackHops?:
|
|
13851
13853
|
| {
|
|
13852
13854
|
from: string;
|
|
@@ -19355,7 +19357,7 @@ init_zod();
|
|
|
19355
19357
|
|
|
19356
19358
|
// src/slack/app-icon.ts
|
|
19357
19359
|
init_app4();
|
|
19358
|
-
var import_web_api = __toESM(
|
|
19360
|
+
var import_web_api = __toESM(require_dist6(), 1);
|
|
19359
19361
|
var TTL_MS = 60 * 60 * 1000;
|
|
19360
19362
|
var REQUEST_TIMEOUT_MS = 2500;
|
|
19361
19363
|
var cached = null;
|
|
@@ -29154,6 +29156,7 @@ var AgentTaskSummarySchema = AgentTaskSchema.pick({
|
|
|
29154
29156
|
resolvedEffort: true,
|
|
29155
29157
|
profile: true,
|
|
29156
29158
|
resolvedProfile: true,
|
|
29159
|
+
modelGroup: true,
|
|
29157
29160
|
provider: true,
|
|
29158
29161
|
requestedByUserId: true,
|
|
29159
29162
|
progress: true,
|
|
@@ -29295,6 +29298,7 @@ var createTask = route({
|
|
|
29295
29298
|
allowCustomModel: boolean().optional(),
|
|
29296
29299
|
effort: ReasoningEffortSchema.optional(),
|
|
29297
29300
|
profile: string2().trim().min(1).optional(),
|
|
29301
|
+
modelGroup: string2().trim().min(1).optional(),
|
|
29298
29302
|
draft: boolean().optional()
|
|
29299
29303
|
}).superRefine((body, ctx) => {
|
|
29300
29304
|
if ((body.agentId !== undefined || body.offeredTo !== undefined) && !body.routingReason) {
|
|
@@ -29985,6 +29989,7 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
29985
29989
|
}
|
|
29986
29990
|
const profileError = await taskProfileError({
|
|
29987
29991
|
profile: parsed.body.profile,
|
|
29992
|
+
modelGroup: parsed.body.modelGroup,
|
|
29988
29993
|
...splitLegacyModelAlias({ model: parsed.body.model, modelTier: parsed.body.modelTier }),
|
|
29989
29994
|
agentId: defaultAgentId,
|
|
29990
29995
|
vcsRepo: vcsRepo ?? parentTask?.vcsRepo
|
|
@@ -30033,7 +30038,8 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
30033
30038
|
modelTier: parsed.body.modelTier
|
|
30034
30039
|
}),
|
|
30035
30040
|
effort: parsed.body.effort,
|
|
30036
|
-
profile: parsed.body.profile
|
|
30041
|
+
profile: parsed.body.profile,
|
|
30042
|
+
modelGroup: parsed.body.modelGroup
|
|
30037
30043
|
}, { origin: "rest", allowCustomModel: parsed.body.allowCustomModel });
|
|
30038
30044
|
const task = claim ? await getDbClient2().transaction(async () => {
|
|
30039
30045
|
if (await findAcceptedTaskCreate(claim))
|
|
@@ -30082,6 +30088,10 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
30082
30088
|
jsonError(res, error.message, 400);
|
|
30083
30089
|
return true;
|
|
30084
30090
|
}
|
|
30091
|
+
if (modelGroupRefError(error)) {
|
|
30092
|
+
jsonError(res, `Unknown model group "${parsed.body.modelGroup}"`, 400);
|
|
30093
|
+
return true;
|
|
30094
|
+
}
|
|
30085
30095
|
if (modelProfileRefError(error) === "missing") {
|
|
30086
30096
|
jsonError(res, `Unknown model profile "${parsed.body.profile}"`, 400);
|
|
30087
30097
|
return true;
|
|
@@ -34327,6 +34337,7 @@ init_api_drain();
|
|
|
34327
34337
|
init_budget_admission();
|
|
34328
34338
|
init_budget_refusal_notify();
|
|
34329
34339
|
init_db4();
|
|
34340
|
+
init_model_group_resolution();
|
|
34330
34341
|
init_model_profile_check();
|
|
34331
34342
|
init_model_tier_resolution();
|
|
34332
34343
|
init_model_validation2();
|
|
@@ -34841,7 +34852,17 @@ async function handlePoll(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
34841
34852
|
profileOk.set(memoKey, ok);
|
|
34842
34853
|
return ok;
|
|
34843
34854
|
};
|
|
34844
|
-
const
|
|
34855
|
+
const groupOk = new Map;
|
|
34856
|
+
const passesGroupCheck = async (group, vcsRepo) => {
|
|
34857
|
+
const memoKey = JSON.stringify([group, vcsRepo ?? null]);
|
|
34858
|
+
const cached = groupOk.get(memoKey);
|
|
34859
|
+
if (cached !== undefined)
|
|
34860
|
+
return cached;
|
|
34861
|
+
const ok = (await resolveGroupForAgent(group, myAgentId, { vcsRepo, includeRepoSecrets })).kind !== "none";
|
|
34862
|
+
groupOk.set(memoKey, ok);
|
|
34863
|
+
return ok;
|
|
34864
|
+
};
|
|
34865
|
+
const unassignedIds = await getUnassignedTaskIdsForAgent2(myAgentId, 5, async (task) => await poolTaskRunsOnHarness(task, harness) && (task.profile ? await passesProfileCheck(task.profile, task.vcsRepo) : !task.modelGroup || await passesGroupCheck(task.modelGroup, task.vcsRepo)));
|
|
34845
34866
|
if (unassignedIds.length > 0) {
|
|
34846
34867
|
if (probe)
|
|
34847
34868
|
return NEEDS_WRITE;
|
|
@@ -35905,7 +35926,7 @@ init_users();
|
|
|
35905
35926
|
init_rbac();
|
|
35906
35927
|
|
|
35907
35928
|
// src/realtime/browser.generated.txt
|
|
35908
|
-
var browser_generated_default = "var J=()=>new Map,Er=(e)=>{let t=J();return e.forEach((r,n)=>{t.set(n,r)}),t},me=(e,t,r)=>{let n=e.get(t);if(n===void 0)e.set(t,n=r());return n},mi=(e,t)=>{let r=[];for(let[n,o]of e)r.push(t(o,n));return r},gi=(e,t)=>{for(let[r,n]of e)if(t(n,r))return!0;return!1};var Ie=()=>new Set;var Ar=(e)=>e[e.length-1];var yi=(e,t)=>{for(let r=0;r<t.length;r++)e.push(t[r])},ge=Array.from,Or=(e,t)=>{for(let r=0;r<e.length;r++)if(!t(e[r],r,e))return!1;return!0},Tr=(e,t)=>{for(let r=0;r<e.length;r++)if(t(e[r],r,e))return!0;return!1};var xi=(e,t)=>{let r=Array(e);for(let n=0;n<e;n++)r[n]=t(n,r);return r};var Me=Array.isArray;class fo{constructor(){this._observers=J()}on(e,t){return me(this._observers,e,Ie).add(t),t}once(e,t){let r=(...n)=>{this.off(e,r),t(...n)};this.on(e,r)}off(e,t){let r=this._observers.get(e);if(r!==void 0){if(r.delete(t),r.size===0)this._observers.delete(e)}}emit(e,t){return ge((this._observers.get(e)||J()).values()).forEach((r)=>r(...t))}destroy(){this._observers=J()}}var K=Math.floor;var Ve=Math.abs;var Pr=(e,t)=>e<t?e:t,Ee=(e,t)=>e>t?e:t;var Zr=(e)=>e!==0?e<0:1/e<0;var po=1,ho=2,Cr=4,Dr=8;var ot=32,ie=64,M=128;var jt=31,Lt=63,Ae=127;var _i=2147483647;var{MAX_SAFE_INTEGER:st,MIN_SAFE_INTEGER:go}=Number;var wi=Number.isInteger||((e)=>typeof e===\"number\"&&isFinite(e)&&K(e)===e);var{fromCharCode:xo,fromCodePoint:Kp}=String,Cy=xo(65535),qp=(e)=>e.toLowerCase(),Gp=/^\\s*/g,Wp=(e)=>e.replace(Gp,\"\"),Hp=/([A-Z])/g,_o=(e,t)=>Wp(e.replace(Hp,(r)=>`${t}${qp(r)}`));var Yp=(e)=>{let t=unescape(encodeURIComponent(e)),r=t.length,n=new Uint8Array(r);for(let o=0;o<r;o++)n[o]=t.codePointAt(o);return n},ct=typeof TextEncoder<\"u\"?new TextEncoder:null,Xp=(e)=>ct.encode(e),bi=ct?Xp:Yp;var it=typeof TextDecoder>\"u\"?null:new TextDecoder(\"utf-8\",{fatal:!0,ignoreBOM:!0});if(it&&it.decode(new Uint8Array).length===1)it=null;var ki=(e,t)=>xi(t,()=>e).join(\"\");class ut{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}var Bt=()=>new ut;var Qp=(e)=>{let t=e.cpos;for(let r=0;r<e.bufs.length;r++)t+=e.bufs[r].length;return t};var ce=(e)=>{let t=new Uint8Array(Qp(e)),r=0;for(let n=0;n<e.bufs.length;n++){let o=e.bufs[n];t.set(o,r),r+=o.length}return t.set(new Uint8Array(e.cbuf.buffer,0,e.cpos),r),t},ed=(e,t)=>{let r=e.cbuf.length;if(r-e.cpos<t)e.bufs.push(new Uint8Array(e.cbuf.buffer,0,e.cpos)),e.cbuf=new Uint8Array(Ee(r,t)*2),e.cpos=0},N=(e,t)=>{let r=e.cbuf.length;if(e.cpos===r)e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(r*2),e.cpos=0;e.cbuf[e.cpos++]=t};var Ur=N;var w=(e,t)=>{while(t>Ae)N(e,M|Ae&t),t=K(t/128);N(e,Ae&t)},Rr=(e,t)=>{let r=Zr(t);if(r)t=-t;N(e,(t>Lt?M:0)|(r?ie:0)|Lt&t),t=K(t/64);while(t>0)N(e,(t>Ae?M:0)|Ae&t),t=K(t/128)},wo=new Uint8Array(30000),td=wo.length/3,rd=(e,t)=>{if(t.length<td){let r=ct.encodeInto(t,wo).written||0;w(e,r);for(let n=0;n<r;n++)N(e,wo[n])}else W(e,bi(t))},nd=(e,t)=>{let r=unescape(encodeURIComponent(t)),n=r.length;w(e,n);for(let o=0;o<n;o++)N(e,r.codePointAt(o))},Fe=ct&&ct.encodeInto?rd:nd;var Mt=(e,t)=>{let r=e.cbuf.length,n=e.cpos,o=Pr(r-n,t.length),s=t.length-o;if(e.cbuf.set(t.subarray(0,o),n),e.cpos+=o,s>0)e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(Ee(r*2,s)),e.cbuf.set(t.subarray(o)),e.cpos=s},W=(e,t)=>{w(e,t.byteLength),Mt(e,t)},bo=(e,t)=>{ed(e,t);let r=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,r},od=(e,t)=>bo(e,4).setFloat32(0,t,!1),sd=(e,t)=>bo(e,8).setFloat64(0,t,!1),id=(e,t)=>bo(e,8).setBigInt64(0,t,!1);var vi=new DataView(new ArrayBuffer(4)),cd=(e)=>(vi.setFloat32(0,e),vi.getFloat32(0)===e),at=(e,t)=>{switch(typeof t){case\"string\":N(e,119),Fe(e,t);break;case\"number\":if(wi(t)&&Ve(t)<=_i)N(e,125),Rr(e,t);else if(cd(t))N(e,124),od(e,t);else N(e,123),sd(e,t);break;case\"bigint\":N(e,122),id(e,t);break;case\"object\":if(t===null)N(e,126);else if(Me(t)){N(e,117),w(e,t.length);for(let r=0;r<t.length;r++)at(e,t[r])}else if(t instanceof Uint8Array)N(e,116),W(e,t);else{N(e,118);let r=Object.keys(t);w(e,r.length);for(let n=0;n<r.length;n++){let o=r[n];Fe(e,o),at(e,t[o])}}break;case\"boolean\":N(e,t?120:121);break;default:N(e,127)}};class jr extends ut{constructor(e){super();this.w=e,this.s=null,this.count=0}write(e){if(this.s===e)this.count++;else{if(this.count>0)w(this,this.count-1);this.count=1,this.w(this,e),this.s=e}}}var Si=(e)=>{if(e.count>0){if(Rr(e.encoder,e.count===1?e.s:-e.s),e.count>1)w(e.encoder,e.count-2)}};class lt{constructor(){this.encoder=new ut,this.s=0,this.count=0}write(e){if(this.s===e)this.count++;else Si(this),this.count=1,this.s=e}toUint8Array(){return Si(this),ce(this.encoder)}}var $i=(e)=>{if(e.count>0){let t=e.diff*2+(e.count===1?0:1);if(Rr(e.encoder,t),e.count>1)w(e.encoder,e.count-2)}};class Vt{constructor(){this.encoder=new ut,this.s=0,this.count=0,this.diff=0}write(e){if(this.diff===e-this.s)this.s=e,this.count++;else $i(this),this.count=1,this.diff=e-this.s,this.s=e}toUint8Array(){return $i(this),ce(this.encoder)}}class ko{constructor(){this.sarr=[],this.s=\"\",this.lensE=new lt}write(e){if(this.s+=e,this.s.length>19)this.sarr.push(this.s),this.s=\"\";this.lensE.write(e.length)}toUint8Array(){let e=new ut;return this.sarr.push(this.s),this.s=\"\",Fe(e,this.sarr.join(\"\")),Mt(e,this.lensE.toUint8Array()),ce(e)}}var X=(e)=>Error(e),Q=()=>{throw X(\"Method unimplemented\")},H=()=>{throw X(\"Unexpected case\")};var zi=X(\"Unexpected end of array\"),Ii=X(\"Integer out of Range\");class Ft{constructor(e){this.arr=e,this.pos=0}}var qe=(e)=>new Ft(e),Ei=(e)=>e.pos!==e.arr.length;var ud=(e,t)=>{let r=new Uint8Array(e.arr.buffer,e.pos+e.arr.byteOffset,t);return e.pos+=t,r},Y=(e)=>ud(e,_(e));var Je=(e)=>e.arr[e.pos++];var _=(e)=>{let t=0,r=1,n=e.arr.length;while(e.pos<n){let o=e.arr[e.pos++];if(t=t+(o&Ae)*r,r*=128,o<M)return t;if(t>st)throw Ii}throw zi},Lr=(e)=>{let t=e.arr[e.pos++],r=t&Lt,n=64,o=(t&ie)>0?-1:1;if((t&M)===0)return o*r;let s=e.arr.length;while(e.pos<s){if(t=e.arr[e.pos++],r=r+(t&Ae)*n,n*=128,t<M)return o*r;if(r>st)throw Ii}throw zi};var ld=(e)=>{let t=_(e);if(t===0)return\"\";else{let r=String.fromCodePoint(Je(e));if(--t<100)while(t--)r+=String.fromCodePoint(Je(e));else while(t>0){let n=t<1e4?t:1e4,o=e.arr.subarray(e.pos,e.pos+n);e.pos+=n,r+=String.fromCodePoint.apply(null,o),t-=n}return decodeURIComponent(escape(r))}},fd=(e)=>it.decode(Y(e)),Ke=it?fd:ld;var So=(e,t)=>{let r=new DataView(e.arr.buffer,e.arr.byteOffset+e.pos,t);return e.pos+=t,r},pd=(e)=>So(e,4).getFloat32(0,!1),dd=(e)=>So(e,8).getFloat64(0,!1),hd=(e)=>So(e,8).getBigInt64(0,!1);var md=[(e)=>{return},(e)=>null,Lr,pd,dd,hd,(e)=>!1,(e)=>!0,Ke,(e)=>{let t=_(e),r={};for(let n=0;n<t;n++){let o=Ke(e);r[o]=ft(e)}return r},(e)=>{let t=_(e),r=[];for(let n=0;n<t;n++)r.push(ft(e));return r},Y],ft=(e)=>md[127-Je(e)](e);class Br extends Ft{constructor(e,t){super(e);this.reader=t,this.s=null,this.count=0}read(){if(this.count===0)if(this.s=this.reader(this),Ei(this))this.count=_(this)+1;else this.count=-1;return this.count--,this.s}}class pt extends Ft{constructor(e){super(e);this.s=0,this.count=0}read(){if(this.count===0){this.s=Lr(this);let e=Zr(this.s);if(this.count=1,e)this.s=-this.s,this.count=_(this)+2}return this.count--,this.s}}class Jt extends Ft{constructor(e){super(e);this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){let e=Lr(this),t=e&1;if(this.diff=K(e/2),this.count=1,t)this.count=_(this)+2}return this.s+=this.diff,this.count--,this.s}}class $o{constructor(e){this.decoder=new pt(e),this.str=Ke(this.decoder),this.spos=0}read(){let e=this.spos+this.decoder.read(),t=this.str.slice(this.spos,e);return this.spos=e,t}}var Uy=crypto.subtle,Ai=crypto.getRandomValues.bind(crypto);var zo=()=>Ai(new Uint32Array(1))[0];var yd=[1e7]+-1000+-4000+-8000+-100000000000,Oi=()=>yd.replace(/[018]/g,(e)=>(e^zo()&15>>e/4).toString(16));var Ti=Date.now;var Io=(e)=>new Promise(e);var Ly=Promise.all.bind(Promise);var Eo=(e)=>e===void 0?null:e;class Pi{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}}var Zi=new Pi,kd=!0;try{if(typeof localStorage<\"u\"&&localStorage)Zi=localStorage,kd=!1}catch(e){}var Ci=Zi;var Ge=Symbol(\"Equality\"),Mr=(e,t)=>e===t||!!e?.[Ge]?.(t)||!1;var Di=(e)=>typeof e===\"object\",{assign:Ni,keys:Sd}=Object;var Ui=(e,t)=>{for(let r in e)t(e[r],r)};var Kt=(e)=>Sd(e).length;var Ri=(e)=>{for(let t in e)return!1;return!0},dt=(e,t)=>{for(let r in e)if(!t(e[r],r))return!1;return!0},qt=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Oo=(e,t)=>e===t||Kt(e)===Kt(t)&&dt(e,(r,n)=>(r!==void 0||qt(t,n))&&Mr(t[n],r)),$d=Object.freeze,To=(e)=>{for(let t in e){let r=e[t];if(typeof r===\"object\"||typeof r===\"function\")To(e[t])}return $d(e)};var Wt=(e,t,r=0)=>{try{for(;r<e.length;r++)e[r](...t)}finally{if(r<e.length)Wt(e,t,r+1)}};var ji=(e)=>e;var Gt=(e,t)=>{if(e===t)return!0;if(e==null||t==null||e.constructor!==t.constructor&&(e.constructor||Object)!==(t.constructor||Object))return!1;if(e[Ge]!=null)return e[Ge](t);switch(e.constructor){case ArrayBuffer:e=new Uint8Array(e),t=new Uint8Array(t);case Uint8Array:{if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;break}case Set:{if(e.size!==t.size)return!1;for(let r of e)if(!t.has(r))return!1;break}case Map:{if(e.size!==t.size)return!1;for(let r of e.keys())if(!t.has(r)||!Gt(e.get(r),t.get(r)))return!1;break}case void 0:case Object:if(Kt(e)!==Kt(t))return!1;for(let r in e)if(!qt(e,r)||!Gt(e[r],t[r]))return!1;break;case Array:if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!Gt(e[r],t[r]))return!1;break;default:return!1}return!0},Li=(e,t)=>t.includes(e);var Ht=typeof process<\"u\"&&process.release&&/node|io\\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<\"u\"?process:0)===\"[object process]\";var By=typeof navigator<\"u\"?/Mac/.test(navigator.platform):!1,ye,zd=[],Id=()=>{if(ye===void 0)if(Ht){ye=J();let e=process.argv,t=null;for(let r=0;r<e.length;r++){let n=e[r];if(n[0]===\"-\"){if(t!==null)ye.set(t,\"\");t=n}else if(t!==null)ye.set(t,n),t=null;else zd.push(n)}if(t!==null)ye.set(t,\"\")}else if(typeof location===\"object\")ye=J(),(location.search||\"?\").slice(1).split(\"&\").forEach((e)=>{if(e.length!==0){let[t,r]=e.split(\"=\");ye.set(`--${_o(t,\"-\")}`,r),ye.set(`-${_o(t,\"-\")}`,r)}});else ye=J();return ye},Co=(e)=>Id().has(e);var Yt=(e)=>Ht?Eo(process.env[e.toUpperCase().replaceAll(\"-\",\"_\")]):Eo(Ci.getItem(e));var Bi=(e)=>Co(\"--\"+e)||Yt(e)!==null,Mi=Bi(\"production\"),Ed=Ht&&Li(process.env.FORCE_COLOR,[\"true\",\"1\",\"2\"]),Vi=Ed||!Co(\"--no-colors\")&&!Bi(\"no-color\")&&(!Ht||process.stdout.isTTY)&&(!Ht||Co(\"--color\")||Yt(\"COLORTERM\")!==null||(Yt(\"TERM\")||\"\").includes(\"color\"));var Ad=(e)=>new Uint8Array(e);var Fi=(e)=>{let t=Ad(e.byteLength);return t.set(e),t};class Ji{constructor(e,t){this.left=e,this.right=t}}var xe=(e,t)=>new Ji(e,t);var No=(e)=>e.next()>=0.5,Vr=(e,t,r)=>K(e.next()*(r+1-t)+t);var Uo=(e,t,r)=>K(e.next()*(r+1-t)+t);var Ro=(e,t,r)=>Uo(e,t,r);var Pd=(e)=>xo(Ro(e,97,122)),Ki=(e,t=0,r=20)=>{let n=Ro(e,t,r),o=\"\";for(let s=0;s<n;s++)o+=Pd(e);return o};var Fr=(e,t)=>t[Ro(e,0,t.length-1)];var Cd=Symbol(\"0schema\");class Gi{constructor(){this._rerrs=[]}extend(e,t,r,n=null){this._rerrs.push({path:e,expected:t,has:r,message:n})}toString(){let e=[];for(let t=this._rerrs.length-1;t>0;t--){let r=this._rerrs[t];e.push(ki(\" \",(this._rerrs.length-t)*2)+`${r.path!=null?`[${r.path}] `:\"\"}${r.has} doesn't match ${r.expected}. ${r.message}`)}return e.join(`\n`)}}var jo=(e,t)=>{if(e===t)return!0;if(e==null||t==null||e.constructor!==t.constructor)return!1;if(e[Ge])return Mr(e,t);if(Me(e))return Or(e,(r)=>Tr(t,(n)=>jo(r,n)));else if(Di(e))return dt(e,(r,n)=>jo(r,t[n]));return!1};class V{static _dilutes=!1;extends(e){let[t,r]=[this.shape,e.shape];if(this.constructor._dilutes)[r,t]=[t,r];return jo(t,r)}equals(e){return this.constructor===e.constructor&&Gt(this.shape,e.shape)}[Cd](){return!0}[Ge](e){return this.equals(e)}validate(e){return this.check(e)}check(e,t){Q()}get nullable(){return yt(this,Qr)}get optional(){return new Lo(this)}cast(e){return qi(e,this),e}expect(e){return qi(e,this),e}}class qr extends V{constructor(e,t){super();this.shape=e,this._c=t}check(e,t=void 0){let r=e?.constructor===this.shape&&(this._c==null||this._c(e));return!r&&t?.extend(null,this.shape.name,e?.constructor.name,e?.constructor!==this.shape?\"Constructor match failed\":\"Check failed\"),r}}var T=(e,t=null)=>new qr(e,t),Vy=T(qr);class Gr extends V{constructor(e){super();this.shape=e}check(e,t){let r=this.shape(e);return!r&&t?.extend(null,\"custom prop\",e?.constructor.name,\"failed to check custom prop\"),r}}var Z=(e)=>new Gr(e),Fy=T(Gr);class Qt extends V{constructor(e){super();this.shape=e}check(e,t){let r=this.shape.some((n)=>n===e);return!r&&t?.extend(null,this.shape.join(\" | \"),e.toString()),r}}var Wr=(...e)=>new Qt(e),Wi=T(Qt),Dd=RegExp.escape||((e)=>e.replace(/[().|&,$^[\\]]/g,(t)=>\"\\\\\"+t)),Hi=(e)=>{if(gt.check(e))return[Dd(e)];if(Wi.check(e))return e.shape.map((t)=>t+\"\");if(oc.check(e))return[\"[+-]?\\\\d+.?\\\\d*\"];if(sc.check(e))return[\".*\"];if(Jr.check(e))return e.shape.map(Hi).flat(1);H()};class Yi extends V{constructor(e){super();this.shape=e,this._r=new RegExp(\"^\"+e.map(Hi).map((t)=>`(${t.join(\"|\")})`).join(\"\")+\"$\")}check(e,t){let r=this._r.exec(e)!=null;return!r&&t?.extend(null,this._r.toString(),e.toString(),\"String doesn't match string template.\"),r}}var Jy=T(Yi),Nd=Symbol(\"optional\");class Lo extends V{constructor(e){super();this.shape=e}check(e,t){let r=e===void 0||this.shape.check(e);return!r&&t?.extend(null,\"undefined (optional)\",\"()\"),r}get[Nd](){return!0}}var Ud=T(Lo);class Bo extends V{check(e,t){return t?.extend(null,\"never\",typeof e),!1}}var Ky=new Bo,qy=T(Bo);class Hr extends V{constructor(e,t=!1){super();this.shape=e,this._isPartial=t}static _dilutes=!0;get partial(){return new Hr(this.shape,!0)}check(e,t){if(e==null)return t?.extend(null,\"object\",\"null\"),!1;return dt(this.shape,(r,n)=>{let o=this._isPartial&&!qt(e,n)||r.check(e[n],t);return!o&&t?.extend(n.toString(),r.toString(),typeof e[n],\"Object property does not match\"),o})}}var Rd=(e)=>new Hr(e),jd=T(Hr),Ld=Z((e)=>e!=null&&(e.constructor===Object||e.constructor==null));class Mo extends V{constructor(e,t){super();this.shape={keys:e,values:t}}check(e,t){return e!=null&&dt(e,(r,n)=>{let o=this.shape.keys.check(n,t);return!o&&t?.extend(n+\"\",\"Record\",typeof e,o?\"Key doesn't match schema\":\"Value doesn't match value\"),o&&this.shape.values.check(r,t)})}}var Xi=(e,t)=>new Mo(e,t),Bd=T(Mo);class Vo extends V{constructor(e){super();this.shape=e}check(e,t){return e!=null&&dt(this.shape,(r,n)=>{let o=r.check(e[n],t);return!o&&t?.extend(n.toString(),\"Tuple\",typeof r),o})}}var Md=(...e)=>new Vo(e),Gy=T(Vo);class Fo extends V{constructor(e){super();this.shape=e.length===1?e[0]:new Yr(e)}check(e,t){let r=Me(e)&&Or(e,(n)=>this.shape.check(n));return!r&&t?.extend(null,\"Array\",\"\"),r}}var Qi=(...e)=>new Fo(e),Vd=T(Fo),Fd=Z((e)=>Me(e));class Jo extends V{constructor(e,t){super();this.shape=e,this._c=t}check(e,t){let r=e instanceof this.shape&&(this._c==null||this._c(e));return!r&&t?.extend(null,this.shape.name,e?.constructor.name),r}}var Jd=(e,t=null)=>new Jo(e,t),Wy=T(Jo),Kd=Jd(V);class ec extends V{constructor(e){super();this.len=e.length-1,this.args=Md(...e.slice(-1)),this.res=e[this.len]}check(e,t){let r=e.constructor===Function&&e.length<=this.len;return!r&&t?.extend(null,\"function\",typeof e),r}}var qd=T(ec),Gd=Z((e)=>typeof e===\"function\");class tc extends V{constructor(e){super();this.shape=e}check(e,t){let r=Or(this.shape,(n)=>n.check(e,t));return!r&&t?.extend(null,\"Intersectinon\",typeof e),r}}var Hy=T(tc,(e)=>e.shape.length>0);class Yr extends V{static _dilutes=!0;constructor(e){super();this.shape=e}check(e,t){let r=Tr(this.shape,(n)=>n.check(e,t));return t?.extend(null,\"Union\",typeof e),r}}var yt=(...e)=>e.findIndex((t)=>Jr.check(t))>=0?yt(...e.map((t)=>Xt(t)).map((t)=>Jr.check(t)?t.shape:[t]).flat(1)):e.length===1?e[0]:new Yr(e),Jr=T(Yr),rc=()=>!0,Kr=Z(rc),Wd=T(Gr,(e)=>e.shape===rc),Ko=Z((e)=>typeof e===\"bigint\"),Hd=Z((e)=>e===Ko),nc=Z((e)=>typeof e===\"symbol\"),Yy=Z((e)=>e===nc),mt=Z((e)=>typeof e===\"number\"),oc=Z((e)=>e===mt),gt=Z((e)=>typeof e===\"string\"),sc=Z((e)=>e===gt),Xr=Z((e)=>typeof e===\"boolean\"),Yd=Z((e)=>e===Xr),ic=Wr(void 0),Xy=T(Qt,(e)=>e.shape.length===1&&e.shape[0]===void 0),Qy=Wr(void 0);var Qr=Wr(null),Xd=T(Qt,(e)=>e.shape.length===1&&e.shape[0]===null),ex=T(Uint8Array),tx=T(qr,(e)=>e.shape===Uint8Array),Qd=yt(mt,gt,Qr,ic,Ko,Xr,nc),rx=(()=>{let e=Qi(Kr),t=Xi(gt,Kr),r=yt(mt,gt,Qr,Xr,e,t);return e.shape=r,t.shape.values=r,r})(),Xt=(e)=>{if(Kd.check(e))return e;else if(Ld.check(e)){let t={};for(let r in e)t[r]=Xt(e[r]);return Rd(t)}else if(Fd.check(e))return yt(...e.map(Xt));else if(Qd.check(e))return Wr(e);else if(Gd.check(e))return T(e);H()},qi=Mi?()=>{}:(e,t)=>{let r=new Gi;if(!t.check(e,r))throw X(`Expected value to be of type ${t.constructor.name}.\n${r.toString()}`)};class cc{constructor(e){this.patterns=[],this.$state=e}if(e,t){return this.patterns.push({if:Xt(e),h:t}),this}else(e){return this.if(Kr,e)}done(){return(e,t)=>{for(let r=0;r<this.patterns.length;r++){let n=this.patterns[r];if(n.if.check(e))return n.h(e,t)}throw X(\"Unhandled pattern\")}}}var eh=(e)=>new cc(e),ac=eh(Kr).if(oc,(e,t)=>Vr(t,go,st)).if(sc,(e,t)=>Ki(t)).if(Yd,(e,t)=>No(t)).if(Hd,(e,t)=>BigInt(Vr(t,go,st))).if(Jr,(e,t)=>ht(t,Fr(t,e.shape))).if(jd,(e,t)=>{let r={};for(let n in e.shape){let o=e.shape[n];if(Ud.check(o)){if(No(t))continue;o=o.shape}r[n]=ac(o,t)}return r}).if(Vd,(e,t)=>{let r=[],n=Uo(t,0,42);for(let o=0;o<n;o++)r.push(ht(t,e.shape));return r}).if(Wi,(e,t)=>Fr(t,e.shape)).if(Xd,(e,t)=>null).if(qd,(e,t)=>{let r=ht(t,e.res);return()=>r}).if(Wd,(e,t)=>ht(t,Fr(t,[mt,gt,Qr,ic,Ko,Xr,Qi(mt),Xi(yt(\"a\",\"b\",\"c\"),mt)]))).if(Bd,(e,t)=>{let r={},n=Vr(t,0,3);for(let o=0;o<n;o++){let s=ht(t,e.shape.keys),i=ht(t,e.shape.values);r[s]=i}return r}).done(),ht=(e,t)=>ac(Xt(t),e);var We=typeof document<\"u\"?document:{};var nx=Z((e)=>e.nodeType===sh);var ox=typeof DOMParser<\"u\"?new DOMParser:null;var sx=Z((e)=>e.nodeType===rh);var ix=Z((e)=>e.nodeType===nh);var uc=(e)=>mi(e,(t,r)=>`${r}:${t};`).join(\"\");var{ELEMENT_NODE:rh,TEXT_NODE:nh,CDATA_SECTION_NODE:cx,COMMENT_NODE:ax,DOCUMENT_NODE:oh,DOCUMENT_TYPE_NODE:ux,DOCUMENT_FRAGMENT_NODE:sh}=We,lx=Z((e)=>e.nodeType===oh);var _e=Symbol;var er=_e(),tr=_e(),qo=_e(),Go=_e(),Wo=_e(),rr=_e(),Ho=_e(),xt=_e(),Yo=_e(),lc=(e)=>{if(e.length===1&&e[0]?.constructor===Function)e=e[0]();let t=[],r=[],n=0;for(;n<e.length;n++){let o=e[n];if(o===void 0)break;else if(o.constructor===String||o.constructor===Number)t.push(o);else if(o.constructor===Object)break}if(n>0)r.push(t.join(\"\"));for(;n<e.length;n++){let o=e[n];if(!(o instanceof Symbol))r.push(o)}return r};var fx=Ti();var uh={[er]:xe(\"font-weight\",\"bold\"),[tr]:xe(\"font-weight\",\"normal\"),[qo]:xe(\"color\",\"blue\"),[Wo]:xe(\"color\",\"green\"),[Go]:xe(\"color\",\"grey\"),[rr]:xe(\"color\",\"red\"),[Ho]:xe(\"color\",\"purple\"),[xt]:xe(\"color\",\"orange\"),[Yo]:xe(\"color\",\"black\")},lh=(e)=>{if(e.length===1&&e[0]?.constructor===Function)e=e[0]();let t=[],r=[],n=J(),o=[],s=0;for(;s<e.length;s++){let i=e[s],c=uh[i];if(c!==void 0)n.set(c.left,c.right);else{if(i===void 0)break;if(i.constructor===String||i.constructor===Number){let a=uc(n);if(s>0||a.length>0)t.push(\"%c\"+i),r.push(a);else t.push(i)}else break}}if(s>0)o=r,o.unshift(t.join(\"\"));for(;s<e.length;s++){let i=e[s];if(!(i instanceof Symbol))o.push(i)}return o},fc=Vi?lh:lc,pc=(...e)=>{console.log(...fc(e)),hc.forEach((t)=>t.print(e))},dc=(...e)=>{console.warn(...fc(e)),e.unshift(xt),hc.forEach((t)=>t.print(e))};var hc=Ie();var mc=(e)=>({[Symbol.iterator](){return this},next:e}),gc=(e,t)=>mc(()=>{let r;do r=e.next();while(!r.done&&!t(r.value));return r}),en=(e,t)=>mc(()=>{let{done:r,value:n}=e.next();return{done:r,value:r?void 0:t(n)}});class ir{constructor(e,t){this.clock=e,this.len=t}}class bt{constructor(){this.clients=new Map}}var Ec=(e,t,r)=>t.clients.forEach((n,o)=>{let s=e.doc.store.clients.get(o);if(s!=null){let i=s[s.length-1],c=i.id.clock+i.length;for(let a=0,l=n[a];a<n.length&&l.clock<c;l=n[++a])Bc(e,s,l.clock,l.len,r)}}),dh=(e,t)=>{let r=0,n=e.length-1;while(r<=n){let o=K((r+n)/2),s=e[o],i=s.clock;if(i<=t){if(t<i+s.len)return o;r=o+1}else n=o-1}return null},Ac=(e,t)=>{let r=e.clients.get(t.client);return r!==void 0&&dh(r,t.clock)!==null},rs=(e)=>{e.clients.forEach((t)=>{t.sort((o,s)=>o.clock-s.clock);let r,n;for(r=1,n=1;r<t.length;r++){let o=t[n-1],s=t[r];if(o.clock+o.len>=s.clock)t[n-1]=new ir(o.clock,Ee(o.len,s.clock+s.len-o.clock));else{if(n<r)t[n]=s;n++}}t.length=n})},hh=(e)=>{let t=new bt;for(let r=0;r<e.length;r++)e[r].clients.forEach((n,o)=>{if(!t.clients.has(o)){let s=n.slice();for(let i=r+1;i<e.length;i++)yi(s,e[i].clients.get(o)||[]);t.clients.set(o,s)}});return rs(t),t},cn=(e,t,r,n)=>{me(e.clients,t,()=>[]).push(new ir(r,n))},Oc=()=>new bt,mh=(e)=>{let t=Oc();return e.clients.forEach((r,n)=>{let o=[];for(let s=0;s<r.length;s++){let i=r[s];if(i.deleted){let c=i.id.clock,a=i.length;if(s+1<r.length)for(let l=r[s+1];s+1<r.length&&l.deleted;l=r[++s+1])a+=l.length;o.push(new ir(c,a))}}if(o.length>0)t.clients.set(n,o)}),t},kt=(e,t)=>{w(e.restEncoder,t.clients.size),ge(t.clients.entries()).sort((r,n)=>n[0]-r[0]).forEach(([r,n])=>{e.resetDsCurVal(),w(e.restEncoder,r);let o=n.length;w(e.restEncoder,o);for(let s=0;s<o;s++){let i=n[s];e.writeDsClock(i.clock),e.writeDsLen(i.len)}})},ns=(e)=>{let t=new bt,r=_(e.restDecoder);for(let n=0;n<r;n++){e.resetDsCurVal();let o=_(e.restDecoder),s=_(e.restDecoder);if(s>0){let i=me(t.clients,o,()=>[]);for(let c=0;c<s;c++)i.push(new ir(e.readDsClock(),e.readDsLen()))}}return t},yc=(e,t,r)=>{let n=new bt,o=_(e.restDecoder);for(let s=0;s<o;s++){e.resetDsCurVal();let i=_(e.restDecoder),c=_(e.restDecoder),a=r.clients.get(i)||[],l=U(r,i);for(let u=0;u<c;u++){let f=e.readDsClock(),p=f+e.readDsLen();if(f<l){if(l<p)cn(n,i,l,p-l);let d=we(a,f),h=a[d];if(!h.deleted&&h.id.clock<f)a.splice(d+1,0,mn(t,h,f-h.id.clock)),d++;while(d<a.length)if(h=a[d++],h.id.clock<p){if(!h.deleted){if(p<h.id.clock+h.length)a.splice(d,0,mn(t,h,p-h.id.clock));h.delete(t)}}else break}else cn(n,i,f,p-f)}}if(n.clients.size>0){let s=new Ne;return w(s.restEncoder,0),kt(s,n),s.toUint8Array()}return null};var Tc=zo;class ke extends fo{constructor({guid:e=Oi(),collectionid:t=null,gc:r=!0,gcFilter:n=()=>!0,meta:o=null,autoLoad:s=!1,shouldLoad:i=!0}={}){super();this.gc=r,this.gcFilter=n,this.clientID=Tc(),this.guid=e,this.collectionid=t,this.share=new Map,this.store=new us,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=i,this.autoLoad=s,this.meta=o,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=Io((a)=>{this.on(\"load\",()=>{this.isLoaded=!0,a(this)})});let c=()=>Io((a)=>{let l=(u)=>{if(u===void 0||u===!0)this.off(\"sync\",l),a()};this.on(\"sync\",l)});this.on(\"sync\",(a)=>{if(a===!1&&this.isSynced)this.whenSynced=c();if(this.isSynced=a===void 0||a===!0,this.isSynced&&!this.isLoaded)this.emit(\"load\",[this])}),this.whenSynced=c()}load(){let e=this._item;if(e!==null&&!this.shouldLoad)v(e.parent.doc,(t)=>{t.subdocsLoaded.add(this)},null,!0);this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(ge(this.subdocs).map((e)=>e.guid))}transact(e,t=null){return v(this,e,t)}get(e,t=R){let r=me(this.share,e,()=>{let o=new t;return o._integrate(this,null),o}),n=r.constructor;if(t!==R&&n!==t)if(n===R){let o=new t;o._map=r._map,r._map.forEach((s)=>{for(;s!==null;s=s.left)s.parent=o}),o._start=r._start;for(let s=o._start;s!==null;s=s.right)s.parent=o;return o._length=r._length,this.share.set(e,o),o._integrate(this,null),o}else throw Error(`Type with the name ${e} has already been defined with a different constructor`);return r}getArray(e=\"\"){return this.get(e,re)}getText(e=\"\"){return this.get(e,ae)}getMap(e=\"\"){return this.get(e,q)}getXmlElement(e=\"\"){return this.get(e,wt)}getXmlFragment(e=\"\"){return this.get(e,Xe)}toJSON(){let e={};return this.share.forEach((t,r)=>{e[r]=t.toJSON()}),e}destroy(){this.isDestroyed=!0,ge(this.subdocs).forEach((t)=>t.destroy());let e=this._item;if(e!==null){this._item=null;let t=e.content;t.doc=new ke({guid:this.guid,...t.opts,shouldLoad:!1}),t.doc._item=e,v(e.parent.doc,(r)=>{let n=t.doc;if(!e.deleted)r.subdocsAdded.add(n);r.subdocsRemoved.add(this)},null,!0)}this.emit(\"destroyed\",[!0]),this.emit(\"destroy\",[this]),super.destroy()}}class os{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return _(this.restDecoder)}readDsLen(){return _(this.restDecoder)}}class ss extends os{readLeftID(){return b(_(this.restDecoder),_(this.restDecoder))}readRightID(){return b(_(this.restDecoder),_(this.restDecoder))}readClient(){return _(this.restDecoder)}readInfo(){return Je(this.restDecoder)}readString(){return Ke(this.restDecoder)}readParentInfo(){return _(this.restDecoder)===1}readTypeRef(){return _(this.restDecoder)}readLen(){return _(this.restDecoder)}readAny(){return ft(this.restDecoder)}readBuf(){return Fi(Y(this.restDecoder))}readJSON(){return JSON.parse(Ke(this.restDecoder))}readKey(){return Ke(this.restDecoder)}}class Pc{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=_(this.restDecoder),this.dsCurrVal}readDsLen(){let e=_(this.restDecoder)+1;return this.dsCurrVal+=e,e}}class Ye extends Pc{constructor(e){super(e);this.keys=[],_(e),this.keyClockDecoder=new Jt(Y(e)),this.clientDecoder=new pt(Y(e)),this.leftClockDecoder=new Jt(Y(e)),this.rightClockDecoder=new Jt(Y(e)),this.infoDecoder=new Br(Y(e),Je),this.stringDecoder=new $o(Y(e)),this.parentInfoDecoder=new Br(Y(e),Je),this.typeRefDecoder=new pt(Y(e)),this.lenDecoder=new pt(Y(e))}readLeftID(){return new He(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new He(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return ft(this.restDecoder)}readBuf(){return Y(this.restDecoder)}readJSON(){return ft(this.restDecoder)}readKey(){let e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];else{let t=this.stringDecoder.read();return this.keys.push(t),t}}}class is{constructor(){this.restEncoder=Bt()}toUint8Array(){return ce(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){w(this.restEncoder,e)}writeDsLen(e){w(this.restEncoder,e)}}class vt extends is{writeLeftID(e){w(this.restEncoder,e.client),w(this.restEncoder,e.clock)}writeRightID(e){w(this.restEncoder,e.client),w(this.restEncoder,e.clock)}writeClient(e){w(this.restEncoder,e)}writeInfo(e){Ur(this.restEncoder,e)}writeString(e){Fe(this.restEncoder,e)}writeParentInfo(e){w(this.restEncoder,e?1:0)}writeTypeRef(e){w(this.restEncoder,e)}writeLen(e){w(this.restEncoder,e)}writeAny(e){at(this.restEncoder,e)}writeBuf(e){W(this.restEncoder,e)}writeJSON(e){Fe(this.restEncoder,JSON.stringify(e))}writeKey(e){Fe(this.restEncoder,e)}}class cs{constructor(){this.restEncoder=Bt(),this.dsCurrVal=0}toUint8Array(){return ce(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){let t=e-this.dsCurrVal;this.dsCurrVal=e,w(this.restEncoder,t)}writeDsLen(e){if(e===0)H();w(this.restEncoder,e-1),this.dsCurrVal+=e}}class Ne extends cs{constructor(){super();this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new Vt,this.clientEncoder=new lt,this.leftClockEncoder=new Vt,this.rightClockEncoder=new Vt,this.infoEncoder=new jr(Ur),this.stringEncoder=new ko,this.parentInfoEncoder=new jr(Ur),this.typeRefEncoder=new lt,this.lenEncoder=new lt}toUint8Array(){let e=Bt();return w(e,0),W(e,this.keyClockEncoder.toUint8Array()),W(e,this.clientEncoder.toUint8Array()),W(e,this.leftClockEncoder.toUint8Array()),W(e,this.rightClockEncoder.toUint8Array()),W(e,ce(this.infoEncoder)),W(e,this.stringEncoder.toUint8Array()),W(e,ce(this.parentInfoEncoder)),W(e,this.typeRefEncoder.toUint8Array()),W(e,this.lenEncoder.toUint8Array()),Mt(e,ce(this.restEncoder)),ce(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(e?1:0)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){at(this.restEncoder,e)}writeBuf(e){W(this.restEncoder,e)}writeJSON(e){at(this.restEncoder,e)}writeKey(e){let t=this.keyMap.get(e);if(t===void 0)this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e);else this.keyClockEncoder.write(t)}}var gh=(e,t,r,n)=>{n=Ee(n,t[0].id.clock);let o=we(t,n);w(e.restEncoder,t.length-o),e.writeClient(r),w(e.restEncoder,n);let s=t[o];s.write(e,n-s.id.clock);for(let i=o+1;i<t.length;i++)t[i].write(e,0)},as=(e,t,r)=>{let n=new Map;r.forEach((o,s)=>{if(U(t,s)>o)n.set(s,o)}),yn(t).forEach((o,s)=>{if(!r.has(s))n.set(s,0)}),w(e.restEncoder,n.size),ge(n.entries()).sort((o,s)=>s[0]-o[0]).forEach(([o,s])=>{gh(e,t.clients.get(o),o,s)})},yh=(e,t)=>{let r=J(),n=_(e.restDecoder);for(let o=0;o<n;o++){let s=_(e.restDecoder),i=Array(s),c=e.readClient(),a=_(e.restDecoder);r.set(c,{i:0,refs:i});for(let l=0;l<s;l++){let u=e.readInfo();switch(jt&u){case 0:{let f=e.readLen();i[l]=new ee(b(c,a),f),a+=f;break}case 10:{let f=_(e.restDecoder);i[l]=new te(b(c,a),f),a+=f;break}default:{let f=(u&(ie|M))===0,p=new C(b(c,a),null,(u&M)===M?e.readLeftID():null,null,(u&ie)===ie?e.readRightID():null,f?e.readParentInfo()?t.get(e.readString()):e.readLeftID():null,f&&(u&ot)===ot?e.readString():null,pa(e,u));i[l]=p,a+=p.length}}}}return r},xh=(e,t,r)=>{let n=[],o=ge(r.keys()).sort((d,h)=>d-h);if(o.length===0)return null;let s=()=>{if(o.length===0)return null;let d=r.get(o[o.length-1]);while(d.refs.length===d.i)if(o.pop(),o.length>0)d=r.get(o[o.length-1]);else return null;return d},i=s();if(i===null)return null;let c=new us,a=new Map,l=(d,h)=>{let g=a.get(d);if(g==null||g>h)a.set(d,h)},u=i.refs[i.i++],f=new Map,p=()=>{for(let d of n){let h=d.id.client,g=r.get(h);if(g)g.i--,c.clients.set(h,g.refs.slice(g.i)),r.delete(h),g.i=0,g.refs=[];else c.clients.set(h,[d]);o=o.filter((x)=>x!==h)}n.length=0};while(!0){if(u.constructor!==te){let h=me(f,u.id.client,()=>U(t,u.id.client))-u.id.clock;if(h<0)n.push(u),l(u.id.client,u.id.clock-1),p();else{let g=u.getMissing(e,t);if(g!==null){n.push(u);let x=r.get(g)||{refs:[],i:0};if(x.refs.length===x.i)l(g,U(t,g)),p();else{u=x.refs[x.i++];continue}}else if(h===0||h<u.length)u.integrate(e,h),f.set(u.id.client,u.id.clock+u.length)}}if(n.length>0)u=n.pop();else if(i!==null&&i.i<i.refs.length)u=i.refs[i.i++];else if(i=s(),i===null)break;else u=i.refs[i.i++]}if(c.clients.size>0){let d=new Ne;return as(d,c,new Map),w(d.restEncoder,0),{missing:a,update:d.toUint8Array()}}return null},_h=(e,t)=>as(e,t.doc.store,t.beforeState),wh=(e,t,r,n=new Ye(e))=>v(t,(o)=>{o.local=!1;let s=!1,i=o.doc,c=i.store,a=yh(n,i),l=xh(o,c,a),u=c.pendingStructs;if(u){for(let[p,d]of u.missing)if(d<U(c,p)){s=!0;break}if(l){for(let[p,d]of l.missing){let h=u.missing.get(p);if(h==null||h>d)u.missing.set(p,d)}u.update=an([u.update,l.update])}}else c.pendingStructs=l;let f=yc(n,o,c);if(c.pendingDs){let p=new Ye(qe(c.pendingDs));_(p.restDecoder);let d=yc(p,o,c);if(f&&d)c.pendingDs=an([f,d]);else c.pendingDs=f||d}else c.pendingDs=f;if(s){let p=c.pendingStructs.update;c.pendingStructs=null,Zc(o.doc,p)}},r,!1);var Zc=(e,t,r,n=Ye)=>{let o=qe(t);wh(o,e,r,new n(o))},gn=(e,t,r)=>Zc(e,t,r,ss),bh=(e,t,r=new Map)=>{as(e,t.store,r),kt(e,mh(t.store))},kh=(e,t=new Uint8Array([0]),r=new Ne)=>{let n=Cc(t);bh(r,e,n);let o=[r.toUint8Array()];if(e.store.pendingDs)o.push(e.store.pendingDs);if(e.store.pendingStructs)o.push(Dh(e.store.pendingStructs.update,t));if(o.length>1){if(r.constructor===vt)return Zh(o.map((s,i)=>i===0?s:Uh(s)));else if(r.constructor===Ne)return an(o)}return o[0]},St=(e,t)=>kh(e,t,new vt),vh=(e)=>{let t=new Map,r=_(e.restDecoder);for(let n=0;n<r;n++){let o=_(e.restDecoder),s=_(e.restDecoder);t.set(o,s)}return t},Cc=(e)=>vh(new os(qe(e))),Dc=(e,t)=>(w(e.restEncoder,t.size),ge(t.entries()).sort((r,n)=>n[0]-r[0]).forEach(([r,n])=>{w(e.restEncoder,r),w(e.restEncoder,n)}),e),Sh=(e,t)=>Dc(e,yn(t.store)),$h=(e,t=new cs)=>{if(e instanceof Map)Dc(t,e);else Sh(t,e);return t.toUint8Array()},Nc=(e)=>$h(e,new is);class Uc{constructor(){this.l=[]}}var xc=()=>new Uc,_c=(e,t)=>e.l.push(t),wc=(e,t)=>{let r=e.l,n=r.length;if(e.l=r.filter((o)=>t!==o),n===e.l.length)console.error(\"[yjs] Tried to remove event handler that doesn't exist.\")},Rc=(e,t,r)=>Wt(e.l,[t,r]);class He{constructor(e,t){this.client=e,this.clock=t}}var tn=(e,t)=>e===t||e!==null&&t!==null&&e.client===t.client&&e.clock===t.clock,b=(e,t)=>new He(e,t);var zh=(e)=>{for(let[t,r]of e.doc.share.entries())if(r===e)return t;throw H()};class jc{constructor(e,t){this.ds=e,this.sv=t}}var Ih=(e,t)=>new jc(e,t),kx=Ih(Oc(),new Map);var _t=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||0)>e.id.clock&&!Ac(t.ds,e.id),es=(e,t)=>{let r=me(e.meta,es,Ie),n=e.doc.store;if(!r.has(t))t.sv.forEach((o,s)=>{if(o<U(n,s))Ue(e,b(s,o))}),Ec(e,t.ds,(o)=>{}),r.add(t)};class us{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}var yn=(e)=>{let t=new Map;return e.clients.forEach((r,n)=>{let o=r[r.length-1];t.set(n,o.id.clock+o.length)}),t},U=(e,t)=>{let r=e.clients.get(t);if(r===void 0)return 0;let n=r[r.length-1];return n.id.clock+n.length},Lc=(e,t)=>{let r=e.clients.get(t.id.client);if(r===void 0)r=[],e.clients.set(t.id.client,r);else{let n=r[r.length-1];if(n.id.clock+n.length!==t.id.clock)throw H()}r.push(t)},we=(e,t)=>{let r=0,n=e.length-1,o=e[n],s=o.id.clock;if(s===t)return n;let i=K(t/(s+o.length-1)*n);while(r<=n){if(o=e[i],s=o.id.clock,s<=t){if(t<s+o.length)return i;r=i+1}else n=i-1;i=K((r+n)/2)}throw H()},Eh=(e,t)=>{let r=e.clients.get(t.client);return r[we(r,t.clock)]},Xo=Eh,ts=(e,t,r)=>{let n=we(t,r),o=t[n];if(o.id.clock<r&&o instanceof C)return t.splice(n+1,0,mn(e,o,r-o.id.clock)),n+1;return n},Ue=(e,t)=>{let r=e.doc.store.clients.get(t.client);return r[ts(e,r,t.clock)]},bc=(e,t,r)=>{let n=t.clients.get(r.client),o=we(n,r.clock),s=n[o];if(r.clock!==s.id.clock+s.length-1&&s.constructor!==ee)n.splice(o+1,0,mn(e,s,r.clock-s.id.clock+1));return s},Ah=(e,t,r)=>{let n=e.clients.get(t.id.client);n[we(n,t.id.clock)]=r},Bc=(e,t,r,n,o)=>{if(n===0)return;let s=r+n,i=ts(e,t,r),c;do{if(c=t[i++],s<c.id.clock+c.length)ts(e,t,s);o(c)}while(i<t.length&&t[i].id.clock<s)};class Mc{constructor(e,t,r){this.doc=e,this.deleteSet=new bt,this.beforeState=yn(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=t,this.meta=new Map,this.local=r,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}var kc=(e,t)=>{if(t.deleteSet.clients.size===0&&!gi(t.afterState,(r,n)=>t.beforeState.get(n)!==r))return!1;return rs(t.deleteSet),_h(e,t),kt(e,t.deleteSet),!0},vc=(e,t,r)=>{let n=t._item;if(n===null||n.id.clock<(e.beforeState.get(n.id.client)||0)&&!n.deleted)me(e.changed,t,Ie).add(r)},on=(e,t)=>{let r=e[t],n=e[t-1],o=t;for(;o>0;r=n,n=e[--o-1]){if(n.deleted===r.deleted&&n.constructor===r.constructor){if(n.mergeWith(r)){if(r instanceof C&&r.parentSub!==null&&r.parent._map.get(r.parentSub)===r)r.parent._map.set(r.parentSub,n);continue}}break}let s=t-o;if(s)e.splice(t+1-s,s);return s},Oh=(e,t,r)=>{for(let[n,o]of e.clients.entries()){let s=t.clients.get(n);for(let i=o.length-1;i>=0;i--){let c=o[i],a=c.clock+c.len;for(let l=we(s,c.clock),u=s[l];l<s.length&&u.id.clock<a;u=s[++l]){let f=s[l];if(c.clock+c.len<=f.id.clock)break;if(f instanceof C&&f.deleted&&!f.keep&&r(f))f.gc(t,!1)}}}},Th=(e,t)=>{e.clients.forEach((r,n)=>{let o=t.clients.get(n);for(let s=r.length-1;s>=0;s--){let i=r[s],c=Pr(o.length-1,1+we(o,i.clock+i.len-1));for(let a=c,l=o[a];a>0&&l.id.clock>=i.clock;l=o[a])a-=1+on(o,a)}})};var Vc=(e,t)=>{if(t<e.length){let r=e[t],n=r.doc,o=n.store,{deleteSet:s,_mergeStructs:i}=r;try{rs(s),r.afterState=yn(r.doc.store),n.emit(\"beforeObserverCalls\",[r,n]);let c=[];r.changed.forEach((a,l)=>c.push(()=>{if(l._item===null||!l._item.deleted)l._callObserver(r,a)})),c.push(()=>{r.changedParentTypes.forEach((a,l)=>{if(l._dEH.l.length>0&&(l._item===null||!l._item.deleted))a=a.filter((u)=>u.target._item===null||!u.target._item.deleted),a.forEach((u)=>{u.currentTarget=l,u._path=null}),a.sort((u,f)=>u.path.length-f.path.length),c.push(()=>{Rc(l._dEH,a,r)})}),c.push(()=>n.emit(\"afterTransaction\",[r,n])),c.push(()=>{if(r._needFormattingCleanup)Gh(r)})}),Wt(c,[])}finally{if(n.gc)Oh(s,o,n.gcFilter);Th(s,o),r.afterState.forEach((u,f)=>{let p=r.beforeState.get(f)||0;if(p!==u){let d=o.clients.get(f),h=Ee(we(d,p),1);for(let g=d.length-1;g>=h;)g-=1+on(d,g)}});for(let u=i.length-1;u>=0;u--){let{client:f,clock:p}=i[u].id,d=o.clients.get(f),h=we(d,p);if(h+1<d.length){if(on(d,h+1)>1)continue}if(h>0)on(d,h)}if(!r.local&&r.afterState.get(n.clientID)!==r.beforeState.get(n.clientID))pc(xt,er,\"[yjs] \",tr,rr,\"Changed the client-id because another client seems to be using it.\"),n.clientID=Tc();if(n.emit(\"afterTransactionCleanup\",[r,n]),n._observers.has(\"update\")){let u=new vt;if(kc(u,r))n.emit(\"update\",[u.toUint8Array(),r.origin,n,r])}if(n._observers.has(\"updateV2\")){let u=new Ne;if(kc(u,r))n.emit(\"updateV2\",[u.toUint8Array(),r.origin,n,r])}let{subdocsAdded:c,subdocsLoaded:a,subdocsRemoved:l}=r;if(c.size>0||l.size>0||a.size>0)c.forEach((u)=>{if(u.clientID=n.clientID,u.collectionid==null)u.collectionid=n.collectionid;n.subdocs.add(u)}),l.forEach((u)=>n.subdocs.delete(u)),n.emit(\"subdocs\",[{loaded:a,added:c,removed:l},n,r]),l.forEach((u)=>u.destroy());if(e.length<=t+1)n._transactionCleanups=[],n.emit(\"afterAllTransactions\",[n,e]);else Vc(e,t+1)}}},v=(e,t,r=null,n=!0)=>{let o=e._transactionCleanups,s=!1,i=null;if(e._transaction===null){if(s=!0,e._transaction=new Mc(e,r,n),o.push(e._transaction),o.length===1)e.emit(\"beforeAllTransactions\",[e]);e.emit(\"beforeTransaction\",[e._transaction,e])}try{i=t(e._transaction)}finally{if(s){let c=e._transaction===o[0];if(e._transaction=null,c)Vc(o,0)}}return i};function*Ph(e){let t=_(e.restDecoder);for(let r=0;r<t;r++){let n=_(e.restDecoder),o=e.readClient(),s=_(e.restDecoder);for(let i=0;i<n;i++){let c=e.readInfo();if(c===10){let a=_(e.restDecoder);yield new te(b(o,s),a),s+=a}else if((jt&c)!==0){let a=(c&(ie|M))===0,l=new C(b(o,s),null,(c&M)===M?e.readLeftID():null,null,(c&ie)===ie?e.readRightID():null,a?e.readParentInfo()?e.readString():e.readLeftID():null,a&&(c&ot)===ot?e.readString():null,pa(e,c));yield l,s+=l.length}else{let a=e.readLen();yield new ee(b(o,s),a),s+=a}}}}class xn{constructor(e,t){this.gen=Ph(e),this.curr=null,this.done=!1,this.filterSkips=t,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===te);return this.curr}}class _n{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}}var Zh=(e)=>an(e,ss,vt);var Ch=(e,t)=>{if(e.constructor===ee){let{client:r,clock:n}=e.id;return new ee(b(r,n+t),e.length-t)}else if(e.constructor===te){let{client:r,clock:n}=e.id;return new te(b(r,n+t),e.length-t)}else{let r=e,{client:n,clock:o}=r.id;return new C(b(n,o+t),null,b(n,o+t-1),null,r.rightOrigin,r.parent,r.parentSub,r.content.splice(t))}},an=(e,t=Ye,r=Ne)=>{if(e.length===1)return e[0];let n=e.map((u)=>new t(qe(u))),o=n.map((u)=>new xn(u,!0)),s=null,i=new r,c=new _n(i);while(!0){if(o=o.filter((p)=>p.curr!==null),o.sort((p,d)=>{if(p.curr.id.client===d.curr.id.client){let h=p.curr.id.clock-d.curr.id.clock;if(h===0)return p.curr.constructor===d.curr.constructor?0:p.curr.constructor===te?1:-1;else return h}else return d.curr.id.client-p.curr.id.client}),o.length===0)break;let u=o[0],f=u.curr.id.client;if(s!==null){let p=u.curr,d=!1;while(p!==null&&p.id.clock+p.length<=s.struct.id.clock+s.struct.length&&p.id.client>=s.struct.id.client)p=u.next(),d=!0;if(p===null||p.id.client!==f||d&&p.id.clock>s.struct.id.clock+s.struct.length)continue;if(f!==s.struct.id.client)Ce(c,s.struct,s.offset),s={struct:p,offset:0},u.next();else if(s.struct.id.clock+s.struct.length<p.id.clock)if(s.struct.constructor===te)s.struct.length=p.id.clock+p.length-s.struct.id.clock;else{Ce(c,s.struct,s.offset);let h=p.id.clock-s.struct.id.clock-s.struct.length;s={struct:new te(b(f,s.struct.id.clock+s.struct.length),h),offset:0}}else{let h=s.struct.id.clock+s.struct.length-p.id.clock;if(h>0)if(s.struct.constructor===te)s.struct.length-=h;else p=Ch(p,h);if(!s.struct.mergeWith(p))Ce(c,s.struct,s.offset),s={struct:p,offset:0},u.next()}}else s={struct:u.curr,offset:0},u.next();for(let p=u.curr;p!==null&&p.id.client===f&&p.id.clock===s.struct.id.clock+s.struct.length&&p.constructor!==te;p=u.next())Ce(c,s.struct,s.offset),s={struct:p,offset:0}}if(s!==null)Ce(c,s.struct,s.offset),s=null;ls(c);let a=n.map((u)=>ns(u)),l=hh(a);return kt(i,l),i.toUint8Array()},Dh=(e,t,r=Ye,n=Ne)=>{let o=Cc(t),s=new n,i=new _n(s),c=new r(qe(e)),a=new xn(c,!1);while(a.curr){let u=a.curr,f=u.id.client,p=o.get(f)||0;if(a.curr.constructor===te){a.next();continue}if(u.id.clock+u.length>p){Ce(i,u,Ee(p-u.id.clock,0)),a.next();while(a.curr&&a.curr.id.client===f)Ce(i,a.curr,0),a.next()}else while(a.curr&&a.curr.id.client===f&&a.curr.id.clock+a.curr.length<=p)a.next()}ls(i);let l=ns(c);return kt(s,l),s.toUint8Array()};var Fc=(e)=>{if(e.written>0)e.clientStructs.push({written:e.written,restEncoder:ce(e.encoder.restEncoder)}),e.encoder.restEncoder=Bt(),e.written=0},Ce=(e,t,r)=>{if(e.written>0&&e.currClient!==t.id.client)Fc(e);if(e.written===0)e.currClient=t.id.client,e.encoder.writeClient(t.id.client),w(e.encoder.restEncoder,t.id.clock+r);t.write(e.encoder,r),e.written++},ls=(e)=>{Fc(e);let t=e.encoder.restEncoder;w(t,e.clientStructs.length);for(let r=0;r<e.clientStructs.length;r++){let n=e.clientStructs[r];w(t,n.written),Mt(t,n.restEncoder)}},Nh=(e,t,r,n)=>{let o=new r(qe(e)),s=new xn(o,!1),i=new n,c=new _n(i);for(let l=s.curr;l!==null;l=s.next())Ce(c,t(l),0);ls(c);let a=ns(o);return kt(i,a),i.toUint8Array()};var Uh=(e)=>Nh(e,ji,Ye,vt),Sc=\"You must not compute changes after the event-handler fired.\";class cr{constructor(e,t){this.target=e,this.currentTarget=e,this.transaction=t,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=Rh(this.currentTarget,this.target))}deletes(e){return Ac(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw X(Sc);let e=new Map,t=this.target;this.transaction.changed.get(t).forEach((n)=>{if(n!==null){let o=t._map.get(n),s,i;if(this.adds(o)){let c=o.left;while(c!==null&&this.adds(c))c=c.left;if(this.deletes(o))if(c!==null&&this.deletes(c))s=\"delete\",i=Ar(c.content.getContent());else return;else if(c!==null&&this.deletes(c))s=\"update\",i=Ar(c.content.getContent());else s=\"add\",i=void 0}else if(this.deletes(o))s=\"delete\",i=Ar(o.content.getContent());else return;e.set(n,{action:s,oldValue:i})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw X(Sc);let t=this.target,r=Ie(),n=Ie(),o=[];if(e={added:r,deleted:n,delta:o,keys:this.keys},this.transaction.changed.get(t).has(null)){let i=null,c=()=>{if(i)o.push(i)};for(let a=t._start;a!==null;a=a.right)if(a.deleted){if(this.deletes(a)&&!this.adds(a)){if(i===null||i.delete===void 0)c(),i={delete:0};i.delete+=a.length,n.add(a)}}else if(this.adds(a)){if(i===null||i.insert===void 0)c(),i={insert:[]};i.insert=i.insert.concat(a.content.getContent()),r.add(a)}else{if(i===null||i.retain===void 0)c(),i={retain:0};i.retain+=a.length}if(i!==null&&i.retain===void 0)c()}this._changes=e}return e}}var Rh=(e,t)=>{let r=[];while(t._item!==null&&t!==e){if(t._item.parentSub!==null)r.unshift(t._item.parentSub);else{let n=0,o=t._item.parent._start;while(o!==t._item&&o!==null){if(!o.deleted&&o.countable)n+=o.length;o=o.right}r.unshift(n)}t=t._item.parent}return r},F=()=>{dc(\"Invalid access: Add Yjs type to a document before reading data.\")},Jc=80,fs=0;class Kc{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=fs++}}var jh=(e)=>{e.timestamp=fs++},qc=(e,t,r)=>{e.p.marker=!1,e.p=t,t.marker=!0,e.index=r,e.timestamp=fs++},Lh=(e,t,r)=>{if(e.length>=Jc){let n=e.reduce((o,s)=>o.timestamp<s.timestamp?o:s);return qc(n,t,r),n}else{let n=new Kc(t,r);return e.push(n),n}},wn=(e,t)=>{if(e._start===null||t===0||e._searchMarker===null)return null;let r=e._searchMarker.length===0?null:e._searchMarker.reduce((s,i)=>Ve(t-s.index)<Ve(t-i.index)?s:i),n=e._start,o=0;if(r!==null)n=r.p,o=r.index,jh(r);while(n.right!==null&&o<t){if(!n.deleted&&n.countable){if(t<o+n.length)break;o+=n.length}n=n.right}while(n.left!==null&&o>t)if(n=n.left,!n.deleted&&n.countable)o-=n.length;while(n.left!==null&&n.left.id.client===n.id.client&&n.left.id.clock+n.left.length===n.id.clock)if(n=n.left,!n.deleted&&n.countable)o-=n.length;if(r!==null&&Ve(r.index-o)<n.parent.length/Jc)return qc(r,n,o),r;else return Lh(e._searchMarker,n,o)},nr=(e,t,r)=>{for(let n=e.length-1;n>=0;n--){let o=e[n];if(r>0){let s=o.p;s.marker=!1;while(s&&(s.deleted||!s.countable))if(s=s.left,s&&!s.deleted&&s.countable)o.index-=s.length;if(s===null||s.marker===!0){e.splice(n,1);continue}o.p=s,s.marker=!0}if(t<o.index||r>0&&t===o.index)o.index=Ee(t,o.index+r)}};var bn=(e,t,r)=>{let n=e,o=t.changedParentTypes;while(!0){if(me(o,e,()=>[]).push(r),e._item===null)break;e=e._item.parent}Rc(n._eH,r,t)};class R{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=xc(),this._dEH=xc(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw Q()}clone(){throw Q()}_write(e){}get _first(){let e=this._start;while(e!==null&&e.deleted)e=e.right;return e}_callObserver(e,t){if(!e.local&&this._searchMarker)this._searchMarker.length=0}observe(e){_c(this._eH,e)}observeDeep(e){_c(this._dEH,e)}unobserve(e){wc(this._eH,e)}unobserveDeep(e){wc(this._dEH,e)}toJSON(){}}var Gc=(e,t,r)=>{if(e.doc??F(),t<0)t=e._length+t;if(r<0)r=e._length+r;let n=r-t,o=[],s=e._start;while(s!==null&&n>0){if(s.countable&&!s.deleted){let i=s.content.getContent();if(i.length<=t)t-=i.length;else{for(let c=t;c<i.length&&n>0;c++)o.push(i[c]),n--;t=0}}s=s.right}return o},Wc=(e)=>{e.doc??F();let t=[],r=e._start;while(r!==null){if(r.countable&&!r.deleted){let n=r.content.getContent();for(let o=0;o<n.length;o++)t.push(n[o])}r=r.right}return t};var or=(e,t)=>{let r=0,n=e._start;e.doc??F();while(n!==null){if(n.countable&&!n.deleted){let o=n.content.getContent();for(let s=0;s<o.length;s++)t(o[s],r++,e)}n=n.right}},Hc=(e,t)=>{let r=[];return or(e,(n,o)=>{r.push(t(n,o,e))}),r},Bh=(e)=>{let t=e._start,r=null,n=0;return{[Symbol.iterator](){return this},next:()=>{if(r===null){while(t!==null&&t.deleted)t=t.right;if(t===null)return{done:!0,value:void 0};r=t.content.getContent(),n=0,t=t.right}let o=r[n++];if(r.length<=n)r=null;return{done:!1,value:o}}}},Yc=(e,t)=>{e.doc??F();let r=wn(e,t),n=e._start;if(r!==null)n=r.p,t-=r.index;for(;n!==null;n=n.right)if(!n.deleted&&n.countable){if(t<n.length)return n.content.getContent()[t];t-=n.length}},un=(e,t,r,n)=>{let o=r,s=e.doc,{clientID:i,store:c}=s,a=r===null?t._start:r.right,l=[],u=()=>{if(l.length>0)o=new C(b(i,U(c,i)),o,o&&o.lastId,a,a&&a.id,t,null,new Qe(l)),o.integrate(e,0),l=[]};n.forEach((f)=>{if(f===null)l.push(f);else switch(f.constructor){case Number:case Object:case Boolean:case Array:case String:l.push(f);break;default:switch(u(),f.constructor){case Uint8Array:case ArrayBuffer:o=new C(b(i,U(c,i)),o,o&&o.lastId,a,a&&a.id,t,null,new ar(new Uint8Array(f))),o.integrate(e,0);break;case ke:o=new C(b(i,U(c,i)),o,o&&o.lastId,a,a&&a.id,t,null,new ur(f)),o.integrate(e,0);break;default:if(f instanceof R)o=new C(b(i,U(c,i)),o,o&&o.lastId,a,a&&a.id,t,null,new Oe(f)),o.integrate(e,0);else throw Error(\"Unexpected content type in insert operation\")}}}),u()},Xc=()=>X(\"Length exceeded!\"),Qc=(e,t,r,n)=>{if(r>t._length)throw Xc();if(r===0){if(t._searchMarker)nr(t._searchMarker,r,n.length);return un(e,t,null,n)}let o=r,s=wn(t,r),i=t._start;if(s!==null){if(i=s.p,r-=s.index,r===0)i=i.prev,r+=i&&i.countable&&!i.deleted?i.length:0}for(;i!==null;i=i.right)if(!i.deleted&&i.countable){if(r<=i.length){if(r<i.length)Ue(e,b(i.id.client,i.id.clock+r));break}r-=i.length}if(t._searchMarker)nr(t._searchMarker,o,n.length);return un(e,t,i,n)},Mh=(e,t,r)=>{let o=(t._searchMarker||[]).reduce((s,i)=>i.index>s.index?i:s,{index:0,p:t._start}).p;if(o)while(o.right)o=o.right;return un(e,t,o,r)},ea=(e,t,r,n)=>{if(n===0)return;let o=r,s=n,i=wn(t,r),c=t._start;if(i!==null)c=i.p,r-=i.index;for(;c!==null&&r>0;c=c.right)if(!c.deleted&&c.countable){if(r<c.length)Ue(e,b(c.id.client,c.id.clock+r));r-=c.length}while(n>0&&c!==null){if(!c.deleted){if(n<c.length)Ue(e,b(c.id.client,c.id.clock+n));c.delete(e),n-=c.length}c=c.right}if(n>0)throw Xc();if(t._searchMarker)nr(t._searchMarker,o,-s+n)},ln=(e,t,r)=>{let n=t._map.get(r);if(n!==void 0)n.delete(e)},ps=(e,t,r,n)=>{let o=t._map.get(r)||null,s=e.doc,i=s.clientID,c;if(n==null)c=new Qe([n]);else switch(n.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:c=new Qe([n]);break;case Uint8Array:c=new ar(n);break;case ke:c=new ur(n);break;default:if(n instanceof R)c=new Oe(n);else throw Error(\"Unexpected content type\")}new C(b(i,U(s.store,i)),o,o&&o.lastId,null,null,t,r,c).integrate(e,0)},ds=(e,t)=>{e.doc??F();let r=e._map.get(t);return r!==void 0&&!r.deleted?r.content.getContent()[r.length-1]:void 0},ta=(e)=>{let t={};return e.doc??F(),e._map.forEach((r,n)=>{if(!r.deleted)t[n]=r.content.getContent()[r.length-1]}),t},ra=(e,t)=>{e.doc??F();let r=e._map.get(t);return r!==void 0&&!r.deleted};var Vh=(e,t)=>{let r={};return e._map.forEach((n,o)=>{let s=n;while(s!==null&&(!t.sv.has(s.id.client)||s.id.clock>=(t.sv.get(s.id.client)||0)))s=s.left;if(s!==null&&_t(s,t))r[o]=s.content.getContent()[s.length-1]}),r},rn=(e)=>(e.doc??F(),gc(e._map.entries(),(t)=>!t[1].deleted));class na extends cr{}class re extends R{constructor(){super();this._prelimContent=[],this._searchMarker=[]}static from(e){let t=new re;return t.push(e),t}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new re}clone(){let e=new re;return e.insert(0,this.toArray().map((t)=>t instanceof R?t.clone():t)),e}get length(){return this.doc??F(),this._length}_callObserver(e,t){super._callObserver(e,t),bn(this,e,new na(this,e))}insert(e,t){if(this.doc!==null)v(this.doc,(r)=>{Qc(r,this,e,t)});else this._prelimContent.splice(e,0,...t)}push(e){if(this.doc!==null)v(this.doc,(t)=>{Mh(t,this,e)});else this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,t=1){if(this.doc!==null)v(this.doc,(r)=>{ea(r,this,e,t)});else this._prelimContent.splice(e,t)}get(e){return Yc(this,e)}toArray(){return Wc(this)}slice(e=0,t=this.length){return Gc(this,e,t)}toJSON(){return this.map((e)=>e instanceof R?e.toJSON():e)}map(e){return Hc(this,e)}forEach(e){or(this,e)}[Symbol.iterator](){return Bh(this)}_write(e){e.writeTypeRef(fm)}}var Fh=(e)=>new re;class oa extends cr{constructor(e,t,r){super(e,t);this.keysChanged=r}}class q extends R{constructor(e){super();if(this._prelimContent=null,e===void 0)this._prelimContent=new Map;else this._prelimContent=new Map(e)}_integrate(e,t){super._integrate(e,t),this._prelimContent.forEach((r,n)=>{this.set(n,r)}),this._prelimContent=null}_copy(){return new q}clone(){let e=new q;return this.forEach((t,r)=>{e.set(r,t instanceof R?t.clone():t)}),e}_callObserver(e,t){bn(this,e,new oa(this,e,t))}toJSON(){this.doc??F();let e={};return this._map.forEach((t,r)=>{if(!t.deleted){let n=t.content.getContent()[t.length-1];e[r]=n instanceof R?n.toJSON():n}}),e}get size(){return[...rn(this)].length}keys(){return en(rn(this),(e)=>e[0])}values(){return en(rn(this),(e)=>e[1].content.getContent()[e[1].length-1])}entries(){return en(rn(this),(e)=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??F(),this._map.forEach((t,r)=>{if(!t.deleted)e(t.content.getContent()[t.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(e){if(this.doc!==null)v(this.doc,(t)=>{ln(t,this,e)});else this._prelimContent.delete(e)}set(e,t){if(this.doc!==null)v(this.doc,(r)=>{ps(r,this,e,t)});else this._prelimContent.set(e,t);return t}get(e){return ds(this,e)}has(e){return ra(this,e)}clear(){if(this.doc!==null)v(this.doc,(e)=>{this.forEach(function(t,r,n){ln(e,n,r)})});else this._prelimContent.clear()}_write(e){e.writeTypeRef(pm)}}var Jh=(e)=>new q,De=(e,t)=>e===t||typeof e===\"object\"&&typeof t===\"object\"&&e&&t&&Oo(e,t);class fn{constructor(e,t,r,n){this.left=e,this.right=t,this.index=r,this.currentAttributes=n}forward(){if(this.right===null)H();switch(this.right.content.constructor){case D:if(!this.right.deleted)$t(this.currentAttributes,this.right.content);break;default:if(!this.right.deleted)this.index+=this.right.length;break}this.left=this.right,this.right=this.right.right}}var $c=(e,t,r)=>{while(t.right!==null&&r>0){switch(t.right.content.constructor){case D:if(!t.right.deleted)$t(t.currentAttributes,t.right.content);break;default:if(!t.right.deleted){if(r<t.right.length)Ue(e,b(t.right.id.client,t.right.id.clock+r));t.index+=t.right.length,r-=t.right.length}break}t.left=t.right,t.right=t.right.right}return t},nn=(e,t,r,n)=>{let o=new Map,s=n?wn(t,r):null;if(s){let i=new fn(s.p.left,s.p,s.index,o);return $c(e,i,r-s.index)}else{let i=new fn(null,t._start,0,o);return $c(e,i,r)}},sa=(e,t,r,n)=>{while(r.right!==null&&(r.right.deleted===!0||r.right.content.constructor===D&&De(n.get(r.right.content.key),r.right.content.value))){if(!r.right.deleted)n.delete(r.right.content.key);r.forward()}let o=e.doc,s=o.clientID;n.forEach((i,c)=>{let{left:a,right:l}=r,u=new C(b(s,U(o.store,s)),a,a&&a.lastId,l,l&&l.id,t,null,new D(c,i));u.integrate(e,0),r.right=u,r.forward()})},$t=(e,t)=>{let{key:r,value:n}=t;if(n===null)e.delete(r);else e.set(r,n)},ia=(e,t)=>{while(!0){if(e.right===null)break;else if(e.right.deleted||e.right.content.constructor===D&&De(t[e.right.content.key]??null,e.right.content.value));else break;e.forward()}},ca=(e,t,r,n)=>{let o=e.doc,s=o.clientID,i=new Map;for(let c in n){let a=n[c],l=r.currentAttributes.get(c)??null;if(!De(l,a)){i.set(c,l);let{left:u,right:f}=r;r.right=new C(b(s,U(o.store,s)),u,u&&u.lastId,f,f&&f.id,t,null,new D(c,a)),r.right.integrate(e,0),r.forward()}}return i},Qo=(e,t,r,n,o)=>{r.currentAttributes.forEach((p,d)=>{if(o[d]===void 0)o[d]=null});let s=e.doc,i=s.clientID;ia(r,o);let c=ca(e,t,r,o),a=n.constructor===String?new be(n):n instanceof R?new Oe(n):new et(n),{left:l,right:u,index:f}=r;if(t._searchMarker)nr(t._searchMarker,r.index,a.getLength());u=new C(b(i,U(s.store,i)),l,l&&l.lastId,u,u&&u.id,t,null,a),u.integrate(e,0),r.right=u,r.index=f,r.forward(),sa(e,t,r,c)},zc=(e,t,r,n,o)=>{let s=e.doc,i=s.clientID;ia(r,o);let c=ca(e,t,r,o);e:while(r.right!==null&&(n>0||c.size>0&&(r.right.deleted||r.right.content.constructor===D))){if(!r.right.deleted)switch(r.right.content.constructor){case D:{let{key:a,value:l}=r.right.content,u=o[a];if(u!==void 0){if(De(u,l))c.delete(a);else{if(n===0)break e;c.set(a,l)}r.right.delete(e)}else r.currentAttributes.set(a,l);break}default:if(n<r.right.length)Ue(e,b(r.right.id.client,r.right.id.clock+n));n-=r.right.length;break}r.forward()}if(n>0){let a=\"\";for(;n>0;n--)a+=`\n`;r.right=new C(b(i,U(s.store,i)),r.left,r.left&&r.left.lastId,r.right,r.right&&r.right.id,t,null,new be(a)),r.right.integrate(e,0),r.forward()}sa(e,t,r,c)},aa=(e,t,r,n,o)=>{let s=t,i=J();while(s&&(!s.countable||s.deleted)){if(!s.deleted&&s.content.constructor===D){let l=s.content;i.set(l.key,l)}s=s.right}let c=0,a=!1;while(t!==s){if(r===t)a=!0;if(!t.deleted){let l=t.content;switch(l.constructor){case D:{let{key:u,value:f}=l,p=n.get(u)??null;if(i.get(u)!==l||p===f){if(t.delete(e),c++,!a&&(o.get(u)??null)===f&&p!==f)if(p===null)o.delete(u);else o.set(u,p)}if(!a&&!t.deleted)$t(o,l);break}}}t=t.right}return c},Kh=(e,t)=>{while(t&&t.right&&(t.right.deleted||!t.right.countable))t=t.right;let r=new Set;while(t&&(t.deleted||!t.countable)){if(!t.deleted&&t.content.constructor===D){let n=t.content.key;if(r.has(n))t.delete(e);else r.add(n)}t=t.left}},qh=(e)=>{let t=0;return v(e.doc,(r)=>{let{_start:n,_start:o}=e,s=J(),i=Er(s);while(o){if(o.deleted===!1)switch(o.content.constructor){case D:$t(i,o.content);break;default:t+=aa(r,n,o,s,i),s=Er(i),n=o;break}o=o.right}}),t},Gh=(e)=>{let t=new Set,r=e.doc;for(let[n,o]of e.afterState.entries()){let s=e.beforeState.get(n)||0;if(o===s)continue;Bc(e,r.store.clients.get(n),s,o,(i)=>{if(!i.deleted&&i.content.constructor===D&&i.constructor!==ee)t.add(i.parent)})}v(r,(n)=>{Ec(e,e.deleteSet,(o)=>{if(o instanceof ee||!o.parent._hasFormatting||t.has(o.parent))return;let s=o.parent;if(o.content.constructor===D)t.add(s);else Kh(n,o)});for(let o of t)qh(o)})},Ic=(e,t,r)=>{let n=r,o=Er(t.currentAttributes),s=t.right;while(r>0&&t.right!==null){if(t.right.deleted===!1)switch(t.right.content.constructor){case Oe:case et:case be:if(r<t.right.length)Ue(e,b(t.right.id.client,t.right.id.clock+r));r-=t.right.length,t.right.delete(e);break}t.forward()}if(s)aa(e,s,t.right,o,t.currentAttributes);let i=(t.left||t.right).parent;if(i._searchMarker)nr(i._searchMarker,t.index,-n+r);return t};class ua extends cr{constructor(e,t,r){super(e,t);this.childListChanged=!1,this.keysChanged=new Set,r.forEach((n)=>{if(n===null)this.childListChanged=!0;else this.keysChanged.add(n)})}get changes(){if(this._changes===null){let e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(this._delta===null){let e=this.target.doc,t=[];v(e,(r)=>{let n=new Map,o=new Map,s=this.target._start,i=null,c={},a=\"\",l=0,u=0,f=()=>{if(i!==null){let p=null;switch(i){case\"delete\":if(u>0)p={delete:u};u=0;break;case\"insert\":if(typeof a===\"object\"||a.length>0){if(p={insert:a},n.size>0)p.attributes={},n.forEach((d,h)=>{if(d!==null)p.attributes[h]=d})}a=\"\";break;case\"retain\":if(l>0){if(p={retain:l},!Ri(c))p.attributes=Ni({},c)}l=0;break}if(p)t.push(p);i=null}};while(s!==null){switch(s.content.constructor){case Oe:case et:if(this.adds(s)){if(!this.deletes(s))f(),i=\"insert\",a=s.content.getContent()[0],f()}else if(this.deletes(s)){if(i!==\"delete\")f(),i=\"delete\";u+=1}else if(!s.deleted){if(i!==\"retain\")f(),i=\"retain\";l+=1}break;case be:if(this.adds(s)){if(!this.deletes(s)){if(i!==\"insert\")f(),i=\"insert\";a+=s.content.str}}else if(this.deletes(s)){if(i!==\"delete\")f(),i=\"delete\";u+=s.length}else if(!s.deleted){if(i!==\"retain\")f(),i=\"retain\";l+=s.length}break;case D:{let{key:p,value:d}=s.content;if(this.adds(s)){if(!this.deletes(s)){let h=n.get(p)??null;if(!De(h,d)){if(i===\"retain\")f();if(De(d,o.get(p)??null))delete c[p];else c[p]=d}else if(d!==null)s.delete(r)}}else if(this.deletes(s)){o.set(p,d);let h=n.get(p)??null;if(!De(h,d)){if(i===\"retain\")f();c[p]=h}}else if(!s.deleted){o.set(p,d);let h=c[p];if(h!==void 0){if(!De(h,d)){if(i===\"retain\")f();if(d===null)delete c[p];else c[p]=d}else if(h!==null)s.delete(r)}}if(!s.deleted){if(i===\"insert\")f();$t(n,s.content)}break}}s=s.right}f();while(t.length>0){let p=t[t.length-1];if(p.retain!==void 0&&p.attributes===void 0)t.pop();else break}}),this._delta=t}return this._delta}}class ae extends R{constructor(e){super();this._pending=e!==void 0?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??F(),this._length}_integrate(e,t){super._integrate(e,t);try{this._pending.forEach((r)=>r())}catch(r){console.error(r)}this._pending=null}_copy(){return new ae}clone(){let e=new ae;return e.applyDelta(this.toDelta()),e}_callObserver(e,t){super._callObserver(e,t);let r=new ua(this,e,t);if(bn(this,e,r),!e.local&&this._hasFormatting)e._needFormattingCleanup=!0}toString(){this.doc??F();let e=\"\",t=this._start;while(t!==null){if(!t.deleted&&t.countable&&t.content.constructor===be)e+=t.content.str;t=t.right}return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:t=!0}={}){if(this.doc!==null)v(this.doc,(r)=>{let n=new fn(null,this._start,0,new Map);for(let o=0;o<e.length;o++){let s=e[o];if(s.insert!==void 0){let i=!t&&typeof s.insert===\"string\"&&o===e.length-1&&n.right===null&&s.insert.slice(-1)===`\n`?s.insert.slice(0,-1):s.insert;if(typeof i!==\"string\"||i.length>0)Qo(r,this,n,i,s.attributes||{})}else if(s.retain!==void 0)zc(r,this,n,s.retain,s.attributes||{});else if(s.delete!==void 0)Ic(r,n,s.delete)}});else this._pending.push(()=>this.applyDelta(e))}toDelta(e,t,r){this.doc??F();let n=[],o=new Map,s=this.doc,i=\"\",c=this._start;function a(){if(i.length>0){let u={},f=!1;o.forEach((d,h)=>{f=!0,u[h]=d});let p={insert:i};if(f)p.attributes=u;n.push(p),i=\"\"}}let l=()=>{while(c!==null){if(_t(c,e)||t!==void 0&&_t(c,t))switch(c.content.constructor){case be:{let u=o.get(\"ychange\");if(e!==void 0&&!_t(c,e)){if(u===void 0||u.user!==c.id.client||u.type!==\"removed\")a(),o.set(\"ychange\",r?r(\"removed\",c.id):{type:\"removed\"})}else if(t!==void 0&&!_t(c,t)){if(u===void 0||u.user!==c.id.client||u.type!==\"added\")a(),o.set(\"ychange\",r?r(\"added\",c.id):{type:\"added\"})}else if(u!==void 0)a(),o.delete(\"ychange\");i+=c.content.str;break}case Oe:case et:{a();let u={insert:c.content.getContent()[0]};if(o.size>0){let f={};u.attributes=f,o.forEach((p,d)=>{f[d]=p})}n.push(u);break}case D:if(_t(c,e))a(),$t(o,c.content);break}c=c.right}a()};if(e||t)v(s,(u)=>{if(e)es(u,e);if(t)es(u,t);l()},\"cleanup\");else l();return n}insert(e,t,r){if(t.length<=0)return;let n=this.doc;if(n!==null)v(n,(o)=>{let s=nn(o,this,e,!r);if(!r)r={},s.currentAttributes.forEach((i,c)=>{r[c]=i});Qo(o,this,s,t,r)});else this._pending.push(()=>this.insert(e,t,r))}insertEmbed(e,t,r){let n=this.doc;if(n!==null)v(n,(o)=>{let s=nn(o,this,e,!r);Qo(o,this,s,t,r||{})});else this._pending.push(()=>this.insertEmbed(e,t,r||{}))}delete(e,t){if(t===0)return;let r=this.doc;if(r!==null)v(r,(n)=>{Ic(n,nn(n,this,e,!0),t)});else this._pending.push(()=>this.delete(e,t))}format(e,t,r){if(t===0)return;let n=this.doc;if(n!==null)v(n,(o)=>{let s=nn(o,this,e,!1);if(s.right===null)return;zc(o,this,s,t,r)});else this._pending.push(()=>this.format(e,t,r))}removeAttribute(e){if(this.doc!==null)v(this.doc,(t)=>{ln(t,this,e)});else this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,t){if(this.doc!==null)v(this.doc,(r)=>{ps(r,this,e,t)});else this._pending.push(()=>this.setAttribute(e,t))}getAttribute(e){return ds(this,e)}getAttributes(){return ta(this)}_write(e){e.writeTypeRef(dm)}}var Wh=(e)=>new ae;class sn{constructor(e,t=()=>!0){this._filter=t,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??F()}[Symbol.iterator](){return this}next(){let e=this._currentNode,t=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(t)))do if(t=e.content.type,!e.deleted&&(t.constructor===wt||t.constructor===Xe)&&t._start!==null)e=t._start;else while(e!==null){let r=e.next;if(r!==null){e=r;break}else if(e.parent===this._root)e=null;else e=e.parent._item}while(e!==null&&(e.deleted||!this._filter(e.content.type)));if(this._firstCall=!1,e===null)return{value:void 0,done:!0};return this._currentNode=e,{value:e.content.type,done:!1}}}class Xe extends R{constructor(){super();this._prelimContent=[]}get firstChild(){let e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Xe}clone(){let e=new Xe;return e.insert(0,this.toArray().map((t)=>t instanceof R?t.clone():t)),e}get length(){return this.doc??F(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new sn(this,e)}querySelector(e){e=e.toUpperCase();let r=new sn(this,(n)=>n.nodeName&&n.nodeName.toUpperCase()===e).next();if(r.done)return null;else return r.value}querySelectorAll(e){return e=e.toUpperCase(),ge(new sn(this,(t)=>t.nodeName&&t.nodeName.toUpperCase()===e))}_callObserver(e,t){bn(this,e,new la(this,t,e))}toString(){return Hc(this,(e)=>e.toString()).join(\"\")}toJSON(){return this.toString()}toDOM(e=document,t={},r){let n=e.createDocumentFragment();if(r!==void 0)r._createAssociation(n,this);return or(this,(o)=>{n.insertBefore(o.toDOM(e,t,r),null)}),n}insert(e,t){if(this.doc!==null)v(this.doc,(r)=>{Qc(r,this,e,t)});else this._prelimContent.splice(e,0,...t)}insertAfter(e,t){if(this.doc!==null)v(this.doc,(r)=>{let n=e&&e instanceof R?e._item:e;un(r,this,n,t)});else{let r=this._prelimContent,n=e===null?0:r.findIndex((o)=>o===e)+1;if(n===0&&e!==null)throw X(\"Reference item not found\");r.splice(n,0,...t)}}delete(e,t=1){if(this.doc!==null)v(this.doc,(r)=>{ea(r,this,e,t)});else this._prelimContent.splice(e,t)}toArray(){return Wc(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return Yc(this,e)}slice(e=0,t=this.length){return Gc(this,e,t)}forEach(e){or(this,e)}_write(e){e.writeTypeRef(mm)}}var Hh=(e)=>new Xe;class wt extends Xe{constructor(e=\"UNDEFINED\"){super();this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){let e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){let e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,t){super._integrate(e,t),this._prelimAttrs.forEach((r,n)=>{this.setAttribute(n,r)}),this._prelimAttrs=null}_copy(){return new wt(this.nodeName)}clone(){let e=new wt(this.nodeName),t=this.getAttributes();return Ui(t,(r,n)=>{e.setAttribute(n,r)}),e.insert(0,this.toArray().map((r)=>r instanceof R?r.clone():r)),e}toString(){let e=this.getAttributes(),t=[],r=[];for(let i in e)r.push(i);r.sort();let n=r.length;for(let i=0;i<n;i++){let c=r[i];t.push(c+'=\"'+e[c]+'\"')}let o=this.nodeName.toLocaleLowerCase(),s=t.length>0?\" \"+t.join(\" \"):\"\";return`<${o}${s}>${super.toString()}</${o}>`}removeAttribute(e){if(this.doc!==null)v(this.doc,(t)=>{ln(t,this,e)});else this._prelimAttrs.delete(e)}setAttribute(e,t){if(this.doc!==null)v(this.doc,(r)=>{ps(r,this,e,t)});else this._prelimAttrs.set(e,t)}getAttribute(e){return ds(this,e)}hasAttribute(e){return ra(this,e)}getAttributes(e){return e?Vh(this,e):ta(this)}toDOM(e=document,t={},r){let n=e.createElement(this.nodeName),o=this.getAttributes();for(let s in o){let i=o[s];if(typeof i===\"string\")n.setAttribute(s,i)}if(or(this,(s)=>{n.appendChild(s.toDOM(e,t,r))}),r!==void 0)r._createAssociation(n,this);return n}_write(e){e.writeTypeRef(hm),e.writeKey(this.nodeName)}}var Yh=(e)=>new wt(e.readKey());class la extends cr{constructor(e,t,r){super(e,r);this.childListChanged=!1,this.attributesChanged=new Set,t.forEach((n)=>{if(n===null)this.childListChanged=!0;else this.attributesChanged.add(n)})}}class pn extends q{constructor(e){super();this.hookName=e}_copy(){return new pn(this.hookName)}clone(){let e=new pn(this.hookName);return this.forEach((t,r)=>{e.set(r,t)}),e}toDOM(e=document,t={},r){let n=t[this.hookName],o;if(n!==void 0)o=n.createDom(this);else o=document.createElement(this.hookName);if(o.setAttribute(\"data-yjs-hook\",this.hookName),r!==void 0)r._createAssociation(o,this);return o}_write(e){e.writeTypeRef(gm),e.writeKey(this.hookName)}}var Xh=(e)=>new pn(e.readKey());class dn extends ae{get nextSibling(){let e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){let e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new dn}clone(){let e=new dn;return e.applyDelta(this.toDelta()),e}toDOM(e=document,t,r){let n=e.createTextNode(this.toString());if(r!==void 0)r._createAssociation(n,this);return n}toString(){return this.toDelta().map((e)=>{let t=[];for(let n in e.attributes){let o=[];for(let s in e.attributes[n])o.push({key:s,value:e.attributes[n][s]});o.sort((s,i)=>s.key<i.key?-1:1),t.push({nodeName:n,attrs:o})}t.sort((n,o)=>n.nodeName<o.nodeName?-1:1);let r=\"\";for(let n=0;n<t.length;n++){let o=t[n];r+=`<${o.nodeName}`;for(let s=0;s<o.attrs.length;s++){let i=o.attrs[s];r+=` ${i.key}=\"${i.value}\"`}r+=\">\"}r+=e.insert;for(let n=t.length-1;n>=0;n--)r+=`</${t[n].nodeName}>`;return r}).join(\"\")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(ym)}}var Qh=(e)=>new dn;class kn{constructor(e,t){this.id=e,this.length=t}get deleted(){throw Q()}mergeWith(e){return!1}write(e,t,r){throw Q()}integrate(e,t){throw Q()}}var em=0;class ee extends kn{get deleted(){return!0}delete(){}mergeWith(e){if(this.constructor!==e.constructor)return!1;return this.length+=e.length,!0}integrate(e,t){if(t>0)this.id.clock+=t,this.length-=t;Lc(e.doc.store,this)}write(e,t){e.writeInfo(em),e.writeLen(this.length-t)}getMissing(e,t){return null}}class ar{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new ar(this.content)}splice(e){throw Q()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeBuf(this.content)}getRef(){return 3}}var tm=(e)=>new ar(e.readBuf());class sr{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new sr(this.len)}splice(e){let t=new sr(this.len-e);return this.len=e,t}mergeWith(e){return this.len+=e.len,!0}integrate(e,t){cn(e.deleteSet,t.id.client,t.id.clock,this.len),t.markDeleted()}delete(e){}gc(e){}write(e,t){e.writeLen(this.len-t)}getRef(){return 1}}var rm=(e)=>new sr(e.readLen()),fa=(e,t)=>new ke({guid:e,...t,shouldLoad:t.shouldLoad||t.autoLoad||!1});class ur{constructor(e){if(e._item)console.error(\"This document was already integrated as a sub-document. You should create a second instance instead with the same guid.\");this.doc=e;let t={};if(this.opts=t,!e.gc)t.gc=!1;if(e.autoLoad)t.autoLoad=!0;if(e.meta!==null)t.meta=e.meta}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new ur(fa(this.doc.guid,this.opts))}splice(e){throw Q()}mergeWith(e){return!1}integrate(e,t){if(this.doc._item=t,e.subdocsAdded.add(this.doc),this.doc.shouldLoad)e.subdocsLoaded.add(this.doc)}delete(e){if(e.subdocsAdded.has(this.doc))e.subdocsAdded.delete(this.doc);else e.subdocsRemoved.add(this.doc)}gc(e){}write(e,t){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}}var nm=(e)=>new ur(fa(e.readString(),e.readAny()));class et{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new et(this.embed)}splice(e){throw Q()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeJSON(this.embed)}getRef(){return 5}}var om=(e)=>new et(e.readJSON());class D{constructor(e,t){this.key=e,this.value=t}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new D(this.key,this.value)}splice(e){throw Q()}mergeWith(e){return!1}integrate(e,t){let r=t.parent;r._searchMarker=null,r._hasFormatting=!0}delete(e){}gc(e){}write(e,t){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}}var sm=(e)=>new D(e.readKey(),e.readJSON());class hn{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new hn(this.arr)}splice(e){let t=new hn(this.arr.slice(e));return this.arr=this.arr.slice(0,e),t}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){let r=this.arr.length;e.writeLen(r-t);for(let n=t;n<r;n++){let o=this.arr[n];e.writeString(o===void 0?\"undefined\":JSON.stringify(o))}}getRef(){return 2}}var im=(e)=>{let t=e.readLen(),r=[];for(let n=0;n<t;n++){let o=e.readString();if(o===\"undefined\")r.push(void 0);else r.push(JSON.parse(o))}return new hn(r)},cm=Yt(\"node_env\")===\"development\";class Qe{constructor(e){this.arr=e,cm&&To(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Qe(this.arr)}splice(e){let t=new Qe(this.arr.slice(e));return this.arr=this.arr.slice(0,e),t}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){let r=this.arr.length;e.writeLen(r-t);for(let n=t;n<r;n++){let o=this.arr[n];e.writeAny(o)}}getRef(){return 8}}var am=(e)=>{let t=e.readLen(),r=[];for(let n=0;n<t;n++)r.push(e.readAny());return new Qe(r)};class be{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split(\"\")}isCountable(){return!0}copy(){return new be(this.str)}splice(e){let t=new be(this.str.slice(e));this.str=this.str.slice(0,e);let r=this.str.charCodeAt(e-1);if(r>=55296&&r<=56319)this.str=this.str.slice(0,e-1)+\"�\",t.str=\"�\"+t.str.slice(1);return t}mergeWith(e){return this.str+=e.str,!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeString(t===0?this.str:this.str.slice(t))}getRef(){return 4}}var um=(e)=>new be(e.readString()),lm=[Fh,Jh,Wh,Yh,Hh,Xh,Qh],fm=0,pm=1,dm=2,hm=3,mm=4,gm=5,ym=6;class Oe{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new Oe(this.type._copy())}splice(e){throw Q()}mergeWith(e){return!1}integrate(e,t){this.type._integrate(e.doc,t)}delete(e){let t=this.type._start;while(t!==null){if(!t.deleted)t.delete(e);else if(t.id.clock<(e.beforeState.get(t.id.client)||0))e._mergeStructs.push(t);t=t.right}this.type._map.forEach((r)=>{if(!r.deleted)r.delete(e);else if(r.id.clock<(e.beforeState.get(r.id.client)||0))e._mergeStructs.push(r)}),e.changed.delete(this.type)}gc(e){let t=this.type._start;while(t!==null)t.gc(e,!0),t=t.right;this.type._start=null,this.type._map.forEach((r)=>{while(r!==null)r.gc(e,!0),r=r.left}),this.type._map=new Map}write(e,t){this.type._write(e)}getRef(){return 7}}var xm=(e)=>new Oe(lm[e.readTypeRef()](e));var mn=(e,t,r)=>{let{client:n,clock:o}=t.id,s=new C(b(n,o+r),t,b(n,o+r-1),t.right,t.rightOrigin,t.parent,t.parentSub,t.content.splice(r));if(t.deleted)s.markDeleted();if(t.keep)s.keep=!0;if(t.redone!==null)s.redone=b(t.redone.client,t.redone.clock+r);if(t.right=s,s.right!==null)s.right.left=s;if(e._mergeStructs.push(s),s.parentSub!==null&&s.right===null)s.parent._map.set(s.parentSub,s);return t.length=r,s};class C extends kn{constructor(e,t,r,n,o,s,i,c){super(e,c.getLength());this.origin=r,this.left=t,this.right=n,this.rightOrigin=o,this.parent=s,this.parentSub=i,this.redone=null,this.content=c,this.info=this.content.isCountable()?ho:0}set marker(e){if((this.info&Dr)>0!==e)this.info^=Dr}get marker(){return(this.info&Dr)>0}get keep(){return(this.info&po)>0}set keep(e){if(this.keep!==e)this.info^=po}get countable(){return(this.info&ho)>0}get deleted(){return(this.info&Cr)>0}set deleted(e){if(this.deleted!==e)this.info^=Cr}markDeleted(){this.info|=Cr}getMissing(e,t){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=U(t,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=U(t,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===He&&this.id.client!==this.parent.client&&this.parent.clock>=U(t,this.parent.client))return this.parent.client;if(this.origin)this.left=bc(e,t,this.origin),this.origin=this.left.lastId;if(this.rightOrigin)this.right=Ue(e,this.rightOrigin),this.rightOrigin=this.right.id;if(this.left&&this.left.constructor===ee||this.right&&this.right.constructor===ee)this.parent=null;else if(!this.parent){if(this.left&&this.left.constructor===C)this.parent=this.left.parent,this.parentSub=this.left.parentSub;else if(this.right&&this.right.constructor===C)this.parent=this.right.parent,this.parentSub=this.right.parentSub}else if(this.parent.constructor===He){let r=Xo(t,this.parent);if(r.constructor===ee)this.parent=null;else this.parent=r.content.type}return null}integrate(e,t){if(t>0)this.id.clock+=t,this.left=bc(e,e.doc.store,b(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(t),this.length-=t;if(this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let r=this.left,n;if(r!==null)n=r.right;else if(this.parentSub!==null){n=this.parent._map.get(this.parentSub)||null;while(n!==null&&n.left!==null)n=n.left}else n=this.parent._start;let o=new Set,s=new Set;while(n!==null&&n!==this.right){if(s.add(n),o.add(n),tn(this.origin,n.origin)){if(n.id.client<this.id.client)r=n,o.clear();else if(tn(this.rightOrigin,n.rightOrigin))break}else if(n.origin!==null&&s.has(Xo(e.doc.store,n.origin))){if(!o.has(Xo(e.doc.store,n.origin)))r=n,o.clear()}else break;n=n.right}this.left=r}if(this.left!==null){let r=this.left.right;this.right=r,this.left.right=this}else{let r;if(this.parentSub!==null){r=this.parent._map.get(this.parentSub)||null;while(r!==null&&r.left!==null)r=r.left}else r=this.parent._start,this.parent._start=this;this.right=r}if(this.right!==null)this.right.left=this;else if(this.parentSub!==null){if(this.parent._map.set(this.parentSub,this),this.left!==null)this.left.delete(e)}if(this.parentSub===null&&this.countable&&!this.deleted)this.parent._length+=this.length;if(Lc(e.doc.store,this),this.content.integrate(e,this),vc(e,this.parent,this.parentSub),this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)this.delete(e)}else new ee(this.id,this.length).integrate(e,0)}get next(){let e=this.right;while(e!==null&&e.deleted)e=e.right;return e}get prev(){let e=this.left;while(e!==null&&e.deleted)e=e.left;return e}get lastId(){return this.length===1?this.id:b(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&tn(e.origin,this.lastId)&&this.right===e&&tn(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){let t=this.parent._searchMarker;if(t)t.forEach((r)=>{if(r.p===e){if(r.p=this,!this.deleted&&this.countable)r.index-=this.length}});if(e.keep)this.keep=!0;if(this.right=e.right,this.right!==null)this.right.left=this;return this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){let t=this.parent;if(this.countable&&this.parentSub===null)t._length-=this.length;this.markDeleted(),cn(e.deleteSet,this.id.client,this.id.clock,this.length),vc(e,t,this.parentSub),this.content.delete(e)}}gc(e,t){if(!this.deleted)throw H();if(this.content.gc(e),t)Ah(e,this,new ee(this.id,this.length));else this.content=new sr(this.length)}write(e,t){let r=t>0?b(this.id.client,this.id.clock+t-1):this.origin,n=this.rightOrigin,o=this.parentSub,s=this.content.getRef()&jt|(r===null?0:M)|(n===null?0:ie)|(o===null?0:ot);if(e.writeInfo(s),r!==null)e.writeLeftID(r);if(n!==null)e.writeRightID(n);if(r===null&&n===null){let i=this.parent;if(i._item!==void 0){let c=i._item;if(c===null){let a=zh(i);e.writeParentInfo(!0),e.writeString(a)}else e.writeParentInfo(!1),e.writeLeftID(c.id)}else if(i.constructor===String)e.writeParentInfo(!0),e.writeString(i);else if(i.constructor===He)e.writeParentInfo(!1),e.writeLeftID(i);else H();if(o!==null)e.writeString(o)}this.content.write(e,t)}}var pa=(e,t)=>_m[t&jt](e),_m=[()=>{H()},rm,im,tm,um,om,sm,xm,am,nm,()=>{H()}],wm=10;class te extends kn{get deleted(){return!0}delete(){}mergeWith(e){if(this.constructor!==e.constructor)return!1;return this.length+=e.length,!0}integrate(e,t){H()}write(e,t){e.writeInfo(wm),w(e.restEncoder,this.length-t)}getMissing(e,t){return null}}var da=typeof globalThis<\"u\"?globalThis:typeof window<\"u\"?window:typeof global<\"u\"?global:{},ha=\"__ $YJS$ __\";if(da[ha]===!0)console.error(\"Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438\");da[ha]=!0;function fr(e){let t=Object.values(e).filter((n)=>typeof n===\"number\");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function ms(e,t=\"|\"){return e.map((r)=>xs(r)).join(t)}function pr(e,t){if(typeof t===\"bigint\")return t.toString();return t}class ga{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function dr(e){return new ga(e)}function ya(e){return e===null||e===void 0}function vn(e){let t=e.startsWith(\"^\")?1:0,r=e.endsWith(\"$\")?e.length-1:e.length;return e.slice(t,r)}function xa(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-n)<o)return 0;return r-n}function ue(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function hr(e){let t=Object.getOwnPropertyDescriptor(e,\"shape\");return t?.get?t.get.raw:t?.value}function Te(e){return hr(e._zod.def)??e._zod.def.shape}function _a(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return ue(this,t,n),n},enumerable:!0,configurable:!0})}function wa(e,t,r){if(t in e)ue(e,t,r);else e[t]=r}function tt(e,t,r,n){let o=Te(t);for(let s of r){let i=Object.getOwnPropertyDescriptor(o,s);if(!i.enumerable)continue;if(i.get)_a(e,s,()=>{let c=t._zod.def.shape[s];return n?n(c,s):c});else wa(e,s,n?n(i.value,s):i.value)}}function bm(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);if(!n.enumerable)continue;if(n.get)_a(e,r,()=>t[r]);else wa(e,r,n.value)}}function ne(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function ba(e){return JSON.stringify(e)}function ka(e){return e.toLowerCase().trim().replace(/[^\\w\\s-]/g,\"\").replace(/[\\s_-]+/g,\"-\").replace(/^-+|-+$/g,\"\")}var gs=\"captureStackTrace\"in Error?Error.captureStackTrace:(...e)=>{};function zt(e){return typeof e===\"object\"&&e!==null&&!Array.isArray(e)}var va=dr(()=>{if(oe.jitless)return!1;if(typeof navigator<\"u\"&&navigator?.userAgent?.includes(\"Cloudflare\"))return!1;try{return new Function(\"\"),!0}catch(e){return!1}});function It(e){if(zt(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!==\"function\")return!0;let r=t.prototype;if(zt(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,\"isPrototypeOf\")===!1)return!1;return!0}function ys(e){if(It(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var Sa=new Set([\"string\",\"number\",\"symbol\"]);function je(e){return e.replace(/[.*+?^${}()|[\\]\\\\]/g,\"\\\\$&\")}function ve(e,t,r){let n=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)n._zod.parent=e;return n}function y(e){let t=e;if(!t)return{};if(typeof t===\"string\")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error(\"Cannot specify both `message` and `error` params\");t.error=t.message}if(delete t.message,typeof t.error===\"string\")return{...t,error:()=>t.error};return t}function xs(e){if(typeof e===\"bigint\")return e.toString()+\"n\";if(typeof e===\"string\")return`\"${e}\"`;return`${e}`}function $a(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===\"optional\")}var Sn=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),_s={int64:[BigInt(\"-9223372036854775808\"),BigInt(\"9223372036854775807\")],uint64:[BigInt(0),BigInt(\"18446744073709551615\")]};function km(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(\".pick() cannot be used on object schemas containing refinements\");let s={};return tt(s,e,$n(e,t)),ve(e,ne(r,{shape:s,checks:[]}))}function $n(e,t){let r=Te(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw Error(`Unrecognized key: \"${String(o)}\"`);if(t[o])n.push(o)}return n}function vm(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(\".omit() cannot be used on object schemas containing refinements\");let s=new Set($n(e,t)),i={};return tt(i,e,Reflect.ownKeys(Te(e)).filter((c)=>!s.has(c))),ve(e,ne(r,{shape:i,checks:[]}))}function Sm(e,t){if(!It(t))throw Error(\"Invalid input to extend: expected a plain object\");let r=e._zod.def.checks;if(r&&r.length>0){let o=Te(e);for(let s of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,s)!==void 0)throw Error(\"Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.\")}return ve(e,ne(e._zod.def,{shape:za(e,t)}))}function za(e,t){let r={};return tt(r,e,Reflect.ownKeys(Te(e))),bm(r,t),r}function $m(e,t){if(!It(t))throw Error(\"Invalid input to safeExtend: expected a plain object\");return ve(e,ne(e._zod.def,{shape:za(e,t)}))}function zm(e,t){if(!t?._zod?.def)throw Error(\"Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.\");if(e._zod.def.checks?.length)throw Error(\".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.\");let r={};tt(r,e,Reflect.ownKeys(Te(e))),tt(r,t,Reflect.ownKeys(Te(t)));let n=ne(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return ve(e,n)}function Ia(e,t,r,n=\"partial\"){let s=t._zod.def.checks;if(s&&s.length>0)throw Error(`.${n}() cannot be used on object schemas containing refinements`);let c=r?new Set($n(t,r)):void 0,a={};return tt(a,t,Reflect.ownKeys(Te(t)),e&&((l,u)=>c&&!c.has(u)?l:new e({type:\"optional\",innerType:l}))),ve(t,ne(t._zod.def,{shape:a,checks:[]}))}function Im(e,t,r){let n=r?new Set($n(t,r)):void 0,o={};return tt(o,t,Reflect.ownKeys(Te(t)),(s,i)=>n&&!n.has(i)?s:new e({type:\"nonoptional\",innerType:s})),ve(t,ne(t._zod.def,{shape:o}))}function Se(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Ea(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function zn(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function lr(e){return typeof e===\"string\"?e:e?.message}function ws(e){let t=[];for(let r of e??[]){let n=r._zod.def;if(!/_(length|size)$|_equals$/.test(n.check))break;let o=n.maximum??n.length??n.size;if(o>=0)t.push([o,r])}return t}function In(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function Le(e,t,r){var n;let o=e.inst?._zod?.traits;if(o?.has(\"$ZodType\"))if(o.has(\"$ZodCheck\"))(n=e).schema??(n.schema=e.inst);else e.schema=e.inst;let s=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,i=e.message?e.message:lr(e.inst?._zod.def?.error?.(e))??lr(s?.(e))??lr(t?.error?.(e))??lr(r.customError?.(e))??lr(r.localeError?.(e))??\"Invalid input\",c={};for(let a of Object.keys(e)){if(a===\"inst\"||a===\"schema\"||a===\"continue\"||a===\"input\"||a===\"__proto__\")continue;c[a]=e[a]}if(c.path??(c.path=[]),c.message=i,t?.reportInput)c.input=e.input;return c}var Em=/[\\uD800-\\uDBFF]/;function En(e){let t=e.length;if(!Em.test(e))return t;let r=t;for(let n=0;n<t-1;n++)if((e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320)r--,n++;return r}function An(e){if(Array.isArray(e))return\"array\";if(typeof e===\"string\")return\"string\";return\"unknown\"}function Aa(e){let t=typeof e;switch(t){case\"number\":return Number.isNaN(e)?\"nan\":\"number\";case\"object\":{if(e===null)return\"null\";if(Array.isArray(e))return\"array\";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&\"constructor\"in r&&r.constructor)return r.constructor.name}}return t}function rt(...e){let[t,r,n]=e;if(typeof t===\"string\")return{message:t,code:\"custom\",input:r,inst:n};return{...t}}function Oa(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);if(n.get)Object.defineProperty(e,r,{...n,enumerable:!1});else Am(e,r,n.value)}}function Pe(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function On(e,t,r){return Pe(e,t,r,!1)}function Ta(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return Pe(this,r,n(this))},set(o){Pe(this,r,o)}})}return t}function Am(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:Pe(this,t,r.bind(this))},set(n){Pe(this,t,n)}})}function Om(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var hs,Re=!1,Tm={configurable:!0,get(){Re=!0;return}};function k(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&hs!==e._zod){hs=void 0;return}hs=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,Tm);let o=Re;Re=!1;try{let s=r(this);if(Re)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:s});return Re=Re||o,s}catch(s){throw delete this[t],Re=Re||o,s}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function Pm(e,t,r,n){let o=Om(e,t);if(!o)return;Object.defineProperty(o,t,{configurable:!0,get(){let s={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,s),s.value=r(this),Object.defineProperty(this,t,s),s.value},set(s){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:s})}})}var Zm=\"~constantCatch\";function Pa(e){let t=()=>e;return t[Zm]=!0,t}var Za;var bs={value:void 0,enumerable:!1},Ca=\"captureStackTrace\"in Error?Error:null;function Cm(e){let t=Ca;if(t){let r=t.stackTraceLimit;if(typeof r===\"number\"){try{t.stackTraceLimit=0}catch{return Ca=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function m(e,t,r,n){let o={};function s(p){this.def=p,this.constr=f,this.traits=new Set}s.prototype=o;let i=r,c=i&&new WeakSet;function a(p,d){if(!p._zod){bs.value=new s(d);try{Object.defineProperty(p,\"_zod\",bs)}finally{bs.value=void 0}}else if(p._zod.traits.has(e))return;if(p._zod.traits.add(e),t(p,d),c){let g=Object.getPrototypeOf(p),x=p._zod.constr.prototype,S=g;while(S&&S!==x)S=Object.getPrototypeOf(S);let de=S??g;if(!c.has(de))c.add(de),Oa(de,i)}let h=f.prototype;for(let g in h){if(!Object.prototype.hasOwnProperty.call(h,g))continue;if(!(g in p))p[g]=h[g].bind(p)}}let l=n?.Parent??Object;class u extends l{}Object.defineProperty(u,\"name\",{value:e});function f(p){let d=n?.Parent?Cm(u):this;a(d,p);let h=d._zod.deferred;if(h){for(let x of h)x();d._zod.deferred=void 0}let g=globalThis.__zod_globalConfig?.postProcessor;if(g)g(d);return d}return Object.defineProperty(f,\"init\",{value:a}),Object.defineProperty(f,Symbol.hasInstance,{value:(p)=>{if(n?.Parent&&p instanceof n.Parent)return!0;return p?._zod?.traits?.has(e)}}),Object.defineProperty(f,\"name\",{value:e}),f}class $e extends Error{constructor(){super(\"Encountered Promise during synchronous parse. Use .parseAsync() instead.\")}}class mr extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name=\"ZodEncodeError\"}}(Za=globalThis).__zod_globalConfig??(Za.__zod_globalConfig={});var oe=globalThis.__zod_globalConfig;function fe(e){if(e)Object.assign(oe,e);return oe}function Dm(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,pr,2)),e.message}function Nm(e){this._zod.message=e}var Um={get:Dm,set:Nm,enumerable:!0,configurable:!0},vs={value:void 0,enumerable:!1},Da=new WeakSet([Object.prototype,Error.prototype]),Na=(e,t)=>{e.name=\"$ZodError\",vs.value=t,Object.defineProperty(e,\"issues\",vs),vs.value=void 0,Object.defineProperty(e,\"message\",Um);let r=Object.getPrototypeOf(e);if(!Da.has(r))Da.add(r),Object.defineProperty(r,\"toString\",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,\"toString\",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,\"toString\",{value:n,configurable:!0,writable:!0})}})},Ua=m(\"$ZodError\",Na),zx=m(\"$ZodError\",Na,void 0,{Parent:Error});function Rm(e,t,r){if(!Object.prototype.hasOwnProperty.call(e,t))if(t===\"__proto__\")Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0});else e[t]=r();return e[t]}function Ra(e,t=(r)=>r.message){let r={},n=[];for(let o of e.issues)if(o.path.length>0)Rm(r,o.path[0],()=>[]).push(t(o));else n.push(t(o));return{formErrors:n,fieldErrors:r}}function ja(e,t=(r)=>r.message){let r={_errors:[]},n=(o,s=[])=>{for(let i of o.issues)if(i.code===\"invalid_union\"&&i.errors.length)i.errors.map((c)=>n({issues:c},[...s,...i.path]));else if(i.code===\"invalid_key\")n({issues:i.issues},[...s,...i.path]);else if(i.code===\"invalid_element\")n({issues:i.issues},[...s,...i.path]);else{let c=[...s,...i.path];if(c.length===0)r._errors.push(t(i));else{let a=r,l=0;while(l<c.length){let u=c[l],f=l===c.length-1;if(u===\"_errors\"){if(f)a._errors.push(t(i));l++;continue}if(!Object.prototype.hasOwnProperty.call(a,u))Object.defineProperty(a,u,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let p=a[u];if(f)p._errors.push(t(i));a=p,l++}}}};return n(e),r}function Tn(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Pn=(e)=>{let t=(r,n,o,s)=>{let i=o?{...o,async:!1}:{async:!1},c=r._zod.run({value:n,issues:[]},i);if(c instanceof Promise)throw new $e;if(c.issues.length){let a=new(s?.Err??e)(c.issues.map((l)=>Le(l,i,fe())));throw gs(a,s?.callee??t),a}return c.value};return t};var Zn=(e)=>{let t=async(r,n,o,s)=>{let i=o?{...o,async:!0}:{async:!0},c=r._zod.run({value:n,issues:[]},i);if(c instanceof Promise)c=await c;if(c.issues.length){let a=new(s?.Err??e)(c.issues.map((l)=>Le(l,i,fe())));throw gs(a,s?.callee??t),a}return c.value};return t};var Cn=(e)=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new $e;return s.issues.length?La(e,s.issues,o):{success:!0,data:s.value}};function La(e,t,r){let n;return{success:!1,get error(){if(!n)n=new e(t.map((o)=>Le(o,r,fe()))),t=void 0,r=void 0;return n},set error(o){n=o,t=void 0,r=void 0}}}var Dn=(e)=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)s=await s;return s.issues.length?La(e,s.issues,o):{success:!0,data:s.value}};var jm=Symbol.for(\"zod.compile.invalid\"),Lm=Symbol.for(\"zod.compile.fallback\"),Ss=(e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==jm)return!0;if(n.definite===!0&&r===void 0)return!1}return Bm(e,t,r)};function Bm(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,s;if(o)n[Lm]=!0,s=o({value:t,issues:[]},n);else s=e._zod.run({value:t,issues:[]},n);if(s instanceof Promise)throw new $e;return s.issues.length===0}var $s=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);if(o instanceof Promise)o=await o;return o.issues.length===0},Ba=(e)=>{let t=Pn(e),r=(n,o,s,i)=>{let c=s?{...s,direction:\"backward\"}:{direction:\"backward\"};return t(n,o,c,Tn(r,i))};return r};var Ma=(e)=>{let t=Pn(e),r=(n,o,s,i)=>t(n,o,s,Tn(r,i));return r};var Va=(e)=>{let t=Zn(e),r=async(n,o,s,i)=>{let c=s?{...s,direction:\"backward\"}:{direction:\"backward\"};return await t(n,o,c,Tn(r,i))};return r};var Fa=(e)=>{let t=Zn(e),r=async(n,o,s,i)=>await t(n,o,s,Tn(r,i));return r};var Ja=(e)=>(t,r,n)=>{let o=n?{...n,direction:\"backward\"}:{direction:\"backward\"};return Cn(e)(t,r,o)};var Ka=(e)=>(t,r,n)=>Cn(e)(t,r,n);var qa=(e)=>async(t,r,n)=>{let o=n?{...n,direction:\"backward\"}:{direction:\"backward\"};return Dn(e)(t,r,o)};var Ga=(e)=>async(t,r,n)=>Dn(e)(t,r,n);var Wa=/^[cC][0-9a-z]{6,}$/,Ha=/^[0-9a-z]+$/,Ya=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Xa=/^[0-9a-vA-V]{20}$/,Qa=/^[A-Za-z0-9]{27}$/,eu=/^[a-zA-Z0-9_-]{21}$/;function tu(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var ru=/^P(?:(\\d+W)|(?!.*W)(?=\\d|T\\d)(\\d+Y)?(\\d+M)?(\\d+D)?(T(?=\\d)(\\d+H)?(\\d+M)?(\\d+([.,]\\d+)?S)?)?)$/;var nu=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Is=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var ou=/^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$/;var Mm=\"^(?=[\\\\s\\\\S]*[\\\\p{Extended_Pictographic}\\\\p{Regional_Indicator}\\\\u20E3])[\\\\p{Extended_Pictographic}\\\\p{Emoji_Component}]+$\";function su(){return new RegExp(Mm,\"u\")}var iu=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,cu=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var au=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/([0-9]|[1-2][0-9]|3[0-2])$/,uu=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,lu=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,fu=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var pu=/^https?$/,du=/^\\+[1-9]\\d{6,14}$/;var hu=\"(?:(?:\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\\\d|30)|(?:02)-(?:0[1-9]|1\\\\d|2[0-8])))\";function Vm(e){return new RegExp(`^${e}$`)}var mu=Vm(hu);function zs(e){return typeof e.precision===\"number\"?e.precision===-1?\"(?:[01]\\\\d|2[0-3]):[0-5]\\\\d\":e.precision===0?\"(?:[01]\\\\d|2[0-3]):[0-5]\\\\d:[0-5]\\\\d\":`(?:[01]\\\\d|2[0-3]):[0-5]\\\\d:[0-5]\\\\d\\\\.\\\\d{${e.precision}}`:e.seconds?\"(?:[01]\\\\d|2[0-3]):[0-5]\\\\d:[0-5]\\\\d(?:\\\\.\\\\d+)?\":\"(?:[01]\\\\d|2[0-3]):[0-5]\\\\d(?::[0-5]\\\\d(?:\\\\.\\\\d+)?)?\"}function gu(e){return new RegExp(`^${zs(e)}$`)}function yu(e){let t=[\"Z\"];if(e.offset)t.push(\"([+-](?:[01]\\\\d|2[0-3]):[0-5]\\\\d)\");let r=`${zs({precision:e.precision,seconds:!0})}(?:${t.join(\"|\")})`,n=e.local?`${r}|${zs({precision:e.precision})}`:r;return new RegExp(`^${hu}T(?:${n})$`)}var xu=/^[\\s\\S]{0,}$/;var Es=/^-?\\d+(?:\\.\\d+)?$/;var _u=/^[^A-Z]*$/,wu=/^[^a-z]*$/;var L=m(\"$ZodCheck\",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var As=(e)=>{let t=e.value;return!ya(t)&&t.length!==void 0},Nn={number:\"number\",bigint:\"bigint\",object:\"date\"},Os=m(\"$ZodCheckLessThan\",(e,t)=>{L.init(e,t);let r=Nn[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value<=t.value:n.value<t.value)return;n.issues.push({origin:Nn[typeof n.value]??r,code:\"too_big\",maximum:typeof t.value===\"object\"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ts=m(\"$ZodCheckGreaterThan\",(e,t)=>{L.init(e,t);let r=Nn[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value>=t.value:n.value>t.value)return;n.issues.push({origin:Nn[typeof n.value]??r,code:\"too_small\",minimum:typeof t.value===\"object\"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),bu=m(\"$ZodCheckMultipleOf\",(e,t)=>{L.init(e,t),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error(\"Cannot mix number and bigint in multiple_of check.\");if(typeof r.value===\"bigint\"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):xa(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:\"not_multiple_of\",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),ku=m(\"$ZodCheckNumberFormat\",(e,t)=>{L.init(e,t),t.format=t.format||\"float64\";let r=t.format?.includes(\"int\"),n=r?\"int\":\"number\",[o,s]=Sn[t.format];e._zod.check=(i)=>{let c=i.value;if(r){if(!Number.isInteger(c)){i.issues.push({expected:n,format:t.format,code:\"invalid_type\",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){if(c>0)i.issues.push({input:c,code:\"too_big\",maximum:Number.MAX_SAFE_INTEGER,note:\"Integers must be within the safe integer range.\",inst:e,origin:n,inclusive:!0,continue:!t.abort});else i.issues.push({input:c,code:\"too_small\",minimum:Number.MIN_SAFE_INTEGER,note:\"Integers must be within the safe integer range.\",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}if(c<o)i.issues.push({origin:\"number\",input:c,code:\"too_small\",minimum:o,inclusive:!0,inst:e,continue:!t.abort});if(c>s)i.issues.push({origin:\"number\",input:c,code:\"too_big\",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var vu=m(\"$ZodCheckMaxLength\",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=As),e._zod.check=(n)=>{let o=n.value,s=o.length;if((typeof o===\"string\"&&s>t.maximum?En(o):s)<=t.maximum)return;let c=An(o);n.issues.push({origin:c,code:\"too_big\",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Su=m(\"$ZodCheckMinLength\",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=As),e._zod.check=(n)=>{let o=n.value,s=o.length;if((typeof o===\"string\"&&s>=t.minimum&&s<t.minimum*2?En(o):s)>=t.minimum)return;let c=An(o);n.issues.push({origin:c,code:\"too_small\",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),$u=m(\"$ZodCheckLengthEquals\",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=As),e._zod.check=(n)=>{let o=n.value,s=o.length,i=typeof o===\"string\"&&s>=t.length&&s<=t.length*2?En(o):s;if(i===t.length)return;let c=An(o),a=i>t.length;n.issues.push({origin:c,...a?{code:\"too_big\",maximum:t.length}:{code:\"too_small\",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),yr=m(\"$ZodCheckStringFormat\",(e,t)=>{var r,n;if(L.init(e,t),t.pattern)(r=e._zod).check??(r.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;o.issues.push({origin:\"string\",code:\"invalid_format\",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(n=e._zod).check??(n.check=()=>{})}),zu=m(\"$ZodCheckRegex\",(e,t)=>{yr.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:\"string\",code:\"invalid_format\",format:\"regex\",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Iu=m(\"$ZodCheckLowerCase\",(e,t)=>{t.pattern??(t.pattern=_u),yr.init(e,t)}),Eu=m(\"$ZodCheckUpperCase\",(e,t)=>{t.pattern??(t.pattern=wu),yr.init(e,t)}),Au=m(\"$ZodCheckIncludes\",(e,t)=>{L.init(e,t);let r=je(t.includes),n=new RegExp(typeof t.position===\"number\"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=(o)=>{if(o.value.includes(t.includes,t.position))return;o.issues.push({origin:\"string\",code:\"invalid_format\",format:\"includes\",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Ou=m(\"$ZodCheckStartsWith\",(e,t)=>{L.init(e,t);let r=new RegExp(`^${je(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.startsWith(t.prefix))return;n.issues.push({origin:\"string\",code:\"invalid_format\",format:\"starts_with\",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Tu=m(\"$ZodCheckEndsWith\",(e,t)=>{L.init(e,t);let r=new RegExp(`.*${je(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.endsWith(t.suffix))return;n.issues.push({origin:\"string\",code:\"invalid_format\",format:\"ends_with\",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var Pu=m(\"$ZodCheckOverwrite\",(e,t)=>{L.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class Ps{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e===\"function\"){e(this,{execution:\"sync\"}),e(this,{execution:\"async\"});return}let r=e.split(`\n`).filter((s)=>s),n=Math.min(...r.map((s)=>s.length-s.trimStart().length)),o=r.map((s)=>s.slice(n)).map((s)=>\" \".repeat(this.indent*2)+s);for(let s of o)this.content.push(s)}compile(){let e=Function,t=this?.content??[\"\"];return new e(...Object.keys(this.closed),`return function (${this.args.join(\", \")}) {\n${t.join(`\n`)}\n};`)(...Object.values(this.closed))}}var Cu={major:4,minor:6,patch:7};var A=m(\"$ZodType\",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Cu;let n=e._zod.def.checks,o=e._zod.traits.has(\"$ZodCheck\")?[e,...n??[]]:n?.length?[...n]:[];for(let s of o)for(let i of s._zod.onattach)i(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let s=(c,a,l)=>{if(c.memo)return c;let u=Se(c),f;for(let p of a){if(p._zod.def.when){if(Ea(c))continue;if(!p._zod.def.when(c))continue}else if(u)continue;let d=c.issues.length,h=p._zod.check(c);if(h instanceof Promise&&l?.async===!1)throw new $e;if(f||h instanceof Promise)f=(f??Promise.resolve()).then(async()=>{if(await h,c.issues.length===d)return;if(In(c.issues,d,e),!u)u=Se(c,d)});else{if(c.issues.length===d)continue;if(In(c.issues,d,e),!u)u=Se(c,d)}}if(f)return f.then(()=>c);return c},i=(c,a,l)=>{if(Se(c))return c.aborted=!0,c;let u=s(a,o,l);if(u instanceof Promise){if(l.async===!1)throw new $e;return u.then((f)=>e._zod.parse(f,l))}return e._zod.parse(u,l)};e._zod.run=(c,a)=>{if(a.skipChecks)return e._zod.parse(c,a);if(a.direction===\"backward\"){let u=e._zod.parse({value:c.value,issues:[]},{...a,skipChecks:!0});if(u instanceof Promise)return u.then((f)=>i(f,c,a));return i(u,c,a)}let l=e._zod.parse(c,a);if(l instanceof Promise){if(a.async===!1)throw new $e;return l.then((u)=>s(u,o,a))}return s(l,o,a)}}},{get \"~standard\"(){return On(this,\"~standard\",Cs(this))},set \"~standard\"(e){Pe(this,\"~standard\",e)}}),Ju=(e,t)=>e.issues.length?{issues:e.issues.map((r)=>Le(r,t,fe()))}:{value:e.value};async function Jm(e,t){let r={async:!0};return Ju(await e._zod.run({value:t,issues:[]},r),r)}function Cs(e){return{validate:(t)=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return Ju(n,r)}catch(n){}return Jm(e,t)},vendor:\"zod\",version:1}}var Ln=m(\"$ZodString\",(e,t)=>{A.init(e,t),e._zod.pattern=t.pattern??xu,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(o){}if(typeof r.value===\"string\")return r;return r.issues.push({expected:\"string\",code:\"invalid_type\",input:r.value,inst:e}),r}}),I=m(\"$ZodStringFormat\",(e,t)=>{yr.init(e,t),Ln.init(e,t)}),Ku=m(\"$ZodGUID\",(e,t)=>{t.pattern??(t.pattern=nu),I.init(e,t)}),qu=m(\"$ZodUUID\",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw Error(`Invalid UUID version: \"${t.version}\"`);t.pattern??(t.pattern=Is(n))}else t.pattern??(t.pattern=Is());I.init(e,t)}),Gu=m(\"$ZodEmail\",(e,t)=>{t.pattern??(t.pattern=ou),I.init(e,t)}),Wu=1,Rn=2;function Hu(e){try{if(typeof URL<\"u\"&&typeof URL.canParse===\"function\")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function Km(e,t){if(!(\"normalize\"in t)&&!(\"hostname\"in t)&&!(\"protocol\"in t))return Hu(e)||Rn;return qm(e,t)}function qm(e,t){if(!t.normalize&&t.protocol?.source===pu.source&&!/^https?:\\/\\//i.test(e))return Wu;try{if(typeof URL<\"u\"){let r=URL;if(typeof r.parse===\"function\")return r.parse(e)??Rn}return new URL(e)}catch{return Rn}}var Gm=/[\\t\\n\\r]/g;function Du(e){return e.replace(Gm,\"\")}function Wm(e,t){return t.lastIndex=0,t.test(e.hostname)}function Hm(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(\":\")?e.protocol.slice(0,-1):e.protocol)}var Yu=m(\"$ZodURL\",(e,t)=>{I.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim(),o=Km(n,t);if(o===Wu){r.issues.push({code:\"invalid_format\",format:\"url\",note:\"Invalid URL format\",input:r.value,inst:e,continue:!t.abort});return}if(o===Rn){r.issues.push({code:\"invalid_format\",format:\"url\",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=Du(n);return}if(t.hostname&&!Wm(o,t.hostname))r.issues.push({code:\"invalid_format\",format:\"url\",note:\"Invalid hostname\",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort});if(t.protocol&&!Hm(o,t.protocol))r.issues.push({code:\"invalid_format\",format:\"url\",note:\"Invalid protocol\",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort});r.value=t.normalize?o.href:Du(n);return}catch(n){r.issues.push({code:\"invalid_format\",format:\"url\",input:r.value,inst:e,continue:!t.abort})}}}),Xu=m(\"$ZodEmoji\",(e,t)=>{t.pattern??(t.pattern=su()),I.init(e,t)}),Qu=m(\"$ZodNanoID\",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?eu:tu(t.length)),I.init(e,t)}),el=m(\"$ZodCUID\",(e,t)=>{t.pattern??(t.pattern=Wa),I.init(e,t)}),tl=m(\"$ZodCUID2\",(e,t)=>{t.pattern??(t.pattern=Ha),I.init(e,t)}),rl=m(\"$ZodULID\",(e,t)=>{t.pattern??(t.pattern=Ya),I.init(e,t)}),nl=m(\"$ZodXID\",(e,t)=>{t.pattern??(t.pattern=Xa),I.init(e,t)}),ol=m(\"$ZodKSUID\",(e,t)=>{t.pattern??(t.pattern=Qa),I.init(e,t)}),sl=m(\"$ZodISODateTime\",(e,t)=>{t.pattern??(t.pattern=yu(t)),I.init(e,t)}),il=m(\"$ZodISODate\",(e,t)=>{t.pattern??(t.pattern=mu),I.init(e,t)}),cl=m(\"$ZodISOTime\",(e,t)=>{t.pattern??(t.pattern=gu(t)),I.init(e,t)}),al=m(\"$ZodISODuration\",(e,t)=>{t.pattern??(t.pattern=ru),I.init(e,t)}),ul=m(\"$ZodIPv4\",(e,t)=>{t.pattern??(t.pattern=iu),I.init(e,t)}),Ym=/^[0-9a-fA-F:.]+$/;function ll(e){if(!Ym.test(e))return!1;return Hu(`http://[${e}]`)}var fl=m(\"$ZodIPv6\",(e,t)=>{t.pattern??(t.pattern=cu),I.init(e,t),e._zod.check=(r)=>{if(!ll(r.value))r.issues.push({code:\"invalid_format\",format:\"ipv6\",input:r.value,inst:e,continue:!t.abort})}});var pl=m(\"$ZodCIDRv4\",(e,t)=>{t.pattern??(t.pattern=au),I.init(e,t)});function Xm(e){let t=e.split(\"/\");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);if(`${o}`!==n)return!1;if(o<0||o>128)return!1;return ll(r)}var dl=m(\"$ZodCIDRv6\",(e,t)=>{t.pattern??(t.pattern=uu),I.init(e,t),e._zod.check=(r)=>{if(!Xm(r.value))r.issues.push({code:\"invalid_format\",format:\"cidrv6\",input:r.value,inst:e,continue:!t.abort})}});function hl(e){if(e===\"\")return!0;if(/\\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Ds=/^[0-9a-zA-Z+/]*={0,2}$/,ml=m(\"$ZodBase64\",(e,t)=>{t.pattern??(t.pattern=Ds),I.init(e,t),e._zod.check=(r)=>{if(hl(r.value))return;r.issues.push({code:\"invalid_format\",format:\"base64\",input:r.value,inst:e,continue:!t.abort})}}),Bn=/^[A-Za-z0-9_-]*$/;function Qm(e){if(!Bn.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n===\"-\"?\"+\":\"/\"),r=t.padEnd(Math.ceil(t.length/4)*4,\"=\");return hl(r)}var gl=m(\"$ZodBase64URL\",(e,t)=>{t.pattern??(t.pattern=Bn),I.init(e,t),e._zod.check=(r)=>{if(Qm(r.value))return;r.issues.push({code:\"invalid_format\",format:\"base64url\",input:r.value,inst:e,continue:!t.abort})}}),yl=m(\"$ZodE164\",(e,t)=>{t.pattern??(t.pattern=du),I.init(e,t)});function eg(e,t=null){try{let r=e.split(\".\");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));if(\"typ\"in o&&o?.typ!==\"JWT\")return!1;if(!o.alg)return!1;if(t&&(!(\"alg\"in o)||o.alg!==t))return!1;return!0}catch{return!1}}var xl=m(\"$ZodJWT\",(e,t)=>{I.init(e,t),e._zod.check=(r)=>{if(eg(r.value,t.alg))return;r.issues.push({code:\"invalid_format\",format:\"jwt\",input:r.value,inst:e,continue:!t.abort})}});var Ns=m(\"$ZodNumber\",(e,t)=>{A.init(e,t),e._zod.pattern=Es,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(i){}let o=r.value;if(typeof o===\"number\"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let s=typeof o===\"number\"?Number.isNaN(o)?\"NaN\":!Number.isFinite(o)?String(o):void 0:void 0;return r.issues.push({expected:\"number\",code:\"invalid_type\",input:o,inst:e,...s?{received:s}:{}}),r}}),_l=m(\"$ZodNumberFormat\",(e,t)=>{ku.init(e,t),Ns.init(e,t)});var wl=m(\"$ZodUnknown\",(e,t)=>{A.init(e,t),e._zod.parse=(r)=>r}),bl=m(\"$ZodNever\",(e,t)=>{A.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:\"never\",code:\"invalid_type\",input:r.value,inst:e}),r)});function tg(e,t){let r=ws(e._zod.def.checks);if(!r.length)return;let n=Math.min(...r.map((s)=>s[0])),o=e._zod.parse;e._zod.parse=(s,i)=>{let c=t(s.value);if(c>n&&!i?.skipChecks&&i?.direction!==\"backward\"){for(let[a,l]of ws(e._zod.def.checks))if(c>a&&l._zod.def.when(s)){let u=s.issues.length;return l._zod.check(s),s.issues[u].continue=!1,In(s.issues,u,e),s}}return o(s,i)}}var rg=(e)=>Array.isArray(e)?e.length:-1;function Nu(e,t,r){if(e.issues.length)t.issues.push(...zn(r,e.issues));t.value[r]=e.value}var kl=m(\"$ZodArray\",(e,t)=>{A.init(e,t);let r=oe.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let s=n.value;if(!Array.isArray(s))return n.issues.push({expected:\"array\",code:\"invalid_type\",input:s,inst:e}),n;n.value=r?r.alloc(e,n,Array(s.length),o):Array(s.length);let i=[],c=o?.abortEarly;for(let a=0;a<s.length;a++){let l=s[a],u=t.element._zod.run({value:l,issues:[]},o);if(u instanceof Promise)i.push(u.then((f)=>Nu(f,n,a)));else if(Nu(u,n,a),c&&u.issues.length!==0&&Se(u))break}if(i.length)return Promise.all(i).then(()=>n);return n},tg(e,rg)});function jn(e,t,r,n,o,s){let i=r in n,c=s===\"optional\";if(!i&&c&&o===\"optional\")return;if(e.issues.length){if(o!==void 0&&c&&!i)return;t.issues.push(...zn(r,e.issues))}if(!i&&o===void 0){if(!e.issues.length)t.issues.push({code:\"invalid_type\",expected:\"nonoptional\",input:void 0,path:[r]});return}if(e.value===void 0){if(i||o===\"defaulted\"&&!c)t.value[r]=void 0}else t.value[r]=e.value}var ng=[];function vl(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:ng,o=n.length?[...t,...n]:t;for(let i of o)if(!e.shape?.[i]?._zod?.traits?.has(\"$ZodType\"))throw Error(`Invalid element at key \"${String(i)}\": expected a Zod schema`);let s=$a(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function Sl(e,t,r,n,o,s,i){let c=[],a=o.keySet,l=o.catchall._zod,u=l.def.type,{optin:f,optout:p}=l,d=0;for(let h in t){if(i&&r.issues.length!==d){if(Se(r,d))break;d=r.issues.length}if(a.has(h))continue;if(h===\"__proto__\"){if(u===\"never\")c.push(h);continue}if(u===\"never\"){c.push(h);continue}let g=l.run({value:t[h],issues:[]},n);if(g instanceof Promise)e.push(g.then((x)=>jn(x,r,h,t,f,p)));else jn(g,r,h,t,f,p)}if(c.length)r.issues.push({code:\"unrecognized_keys\",keys:c,input:t,inst:s,continue:!0});if(!e.length)return r;return Promise.all(e).then(()=>r)}var og=m(\"$ZodObject\",(e,t)=>{A.init(e,t);let r=Object.getOwnPropertyDescriptor(t,\"shape\"),n=r?.get?r.get.raw:t.shape??{};if(n){let l=()=>{let u={...n};return Object.defineProperty(t,\"shape\",{value:u}),l.raw=u,u};l.raw=n,Object.defineProperty(t,\"shape\",{get:l})}let o=dr(()=>vl(t));k(e,\"propValues\",(l)=>{let u=l.def.shape,f={};for(let p in u){let d=u[p]._zod;if(d.values){if(!Object.prototype.hasOwnProperty.call(f,p))ue(f,p,new Set);for(let h of d.values)f[p].add(h);if(d.optin!==void 0)f[p].add(void 0)}}return f});let s=zt,i=t.catchall,c,a=oe.memoizer;a?.attach(e),e._zod.parse=(l,u)=>{c??(c=o.value);let f=l.value;if(!s(f))return l.issues.push({expected:\"object\",code:\"invalid_type\",input:f,inst:e}),l;l.value=a?a.alloc(e,l,{},u):{};let p=[],d=c.shape,h=u?.abortEarly,g=l.issues.length;for(let x of c.allKeys){if(h&&l.issues.length!==g){if(Se(l,g))break;g=l.issues.length}if(x===\"__proto__\")continue;let S=d[x],de=S._zod.optin,Ct=S._zod.optout,Dt=S._zod.run({value:f[x],issues:[]},u);if(Dt instanceof Promise)p.push(Dt.then((P)=>jn(P,l,x,f,de,Ct)));else jn(Dt,l,x,f,de,Ct)}if(!i)return p.length?Promise.all(p).then(()=>l):l;return Sl(p,f,l,u,o.value,e,h===!0)}}),$l=m(\"$ZodObjectJIT\",(e,t)=>{og.init(e,t);let r=e._zod.parse,n=dr(()=>vl(t)),o=oe.memoizer,s=(d)=>{let h=n.value,g=h.symbolKeys,x=new Ps([\"payload\",\"ctx\"],{shape:d,inst:e,memo:o,syms:g}),S=(P)=>`shape[${P}]._zod.run({ value: input[${P}], issues: [] }, ctx)`,de=(P,z)=>`\n let ${P}_ab = false;\n for (let i = 0; i < ${P}.issues.length; i++) {\n const iss = ${P}.issues[i];\n iss.path = iss.path ? [${z}, ...iss.path] : [${z}];\n payload.issues.push(iss);\n if (iss.continue !== true) ${P}_ab = true;\n }\n if (${P}_ab && ctx && ctx.abortEarly) {\n payload.value = newResult;\n return payload;\n }`;x.write(\"const input = payload.value;\");let Ct=Object.create(null),Dt=0;for(let P of h.allKeys)Ct[P]=`key_${Dt++}`;x.write(o?\"const newResult = memo.alloc(inst, payload, {}, ctx);\":\"const newResult = {};\");for(let P of h.allKeys){if(P===\"__proto__\")continue;let z=Ct[P],he=typeof P===\"symbol\"?`syms[${g.indexOf(P)}]`:ba(P),ao=`${he} in input`,di=d[P],uo=di?._zod?.optin,hi=uo!==void 0,Fp=di?._zod?.optout===\"optional\";if(x.write(`const ${z} = ${S(he)};`),hi&&Fp){let Jp=uo===\"optional\"?`${z}_present`:`${z}.value !== undefined || ${z}_present`;x.write(`\n const ${z}_present = ${ao};\n if (!${z}.issues.length || ${z}_present) {\n if (${z}.issues.length) {${de(z,he)}\n }\n\n if (${Jp}) {\n newResult[${he}] = ${z}.value;\n }\n }\n\n `)}else if(!hi)x.write(`\n const ${z}_present = ${ao};\n if (${z}.issues.length) {${de(z,he)}\n }\n if (!${z}_present && !${z}.issues.length) {\n payload.issues.push({\n code: \"invalid_type\",\n expected: \"nonoptional\",\n input: undefined,\n path: [${he}]\n });\n if (ctx && ctx.abortEarly) {\n payload.value = newResult;\n return payload;\n }\n }\n\n if (${z}_present) {\n newResult[${he}] = ${z}.value;\n }\n\n `);else if(x.write(`\n if (${z}.issues.length) {${de(z,he)}\n }\n `),uo===\"defaulted\")x.write(`newResult[${he}] = ${z}.value;`);else x.write(`\n if (${z}.value !== undefined || ${ao}) {\n newResult[${he}] = ${z}.value;\n }\n `)}return x.write(\"payload.value = newResult;\"),x.write(\"return payload;\"),x.compile()},i,c=zt,a=!oe.jitless,u=a&&va.value,f=t.catchall,p;e._zod.parse=(d,h)=>{p??(p=n.value);let g=d.value;if(!c(g))return d.issues.push({expected:\"object\",code:\"invalid_type\",input:g,inst:e}),d;if(a&&u&&h?.async===!1&&h.jitless!==!0){if(!i)i=s(t.shape);if(d=i(d,h),!f)return d;return Sl([],g,d,h,p,e,h?.abortEarly===!0)}return r(d,h)}});function Uu(e,t,r,n){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let o=e.filter((s)=>!Se(s));if(o.length===1)return t.value=o[0].value,o[0];return t.issues.push({code:\"invalid_union\",input:t.value,inst:r,errors:e.map((s)=>s.issues.map((i)=>Le(i,n,fe())))}),t}var Us=m(\"$ZodUnion\",(e,t)=>{A.init(e,t),k(e,\"optin\",(n)=>n.def.options.some((o)=>o._zod.optin===\"defaulted\")?\"defaulted\":n.def.options.some((o)=>o._zod.optin!==void 0)?\"optional\":void 0),k(e,\"optout\",(n)=>n.def.options.some((o)=>o._zod.optout===\"optional\")?\"optional\":void 0),k(e,\"values\",(n)=>{if(n.def.options.every((o)=>o._zod.values))return new Set(n.def.options.flatMap((o)=>Array.from(o._zod.values)));return}),k(e,\"pattern\",(n)=>{if(n.def.options.every((o)=>o._zod.pattern)){let o=n.def.options.map((s)=>s._zod.pattern);return new RegExp(`^(${o.map((s)=>vn(s.source)).join(\"|\")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let s=!1,i=[];for(let c of t.options){let a=c._zod.run({value:n.value,issues:[]},o);if(a instanceof Promise)i.push(a),s=!0;else{if(a.issues.length===0)return a;i.push(a)}}if(!s)return Uu(i,n,e,o);return Promise.all(i).then((c)=>Uu(c,n,e,o))}});function sg(e){let t=new Map;for(let r of e.options){let n=r._zod.propValues?.[e.discriminator];if(!n||n.size===0)throw Error(`Invalid discriminated union option at index \"${e.options.indexOf(r)}\"`);for(let o of n)if(t.has(o)){if(o!==void 0)throw Error(`Duplicate discriminator value \"${String(o)}\"`);t.set(o,null)}else t.set(o,r)}return t}var zl=m(\"$ZodDiscriminatedUnion\",(e,t)=>{t.inclusive=!1,Us.init(e,t);let r=e._zod.parse;k(e,\"propValues\",(o)=>{let s={},i=0;for(let c of o.def.options){let a=c._zod.propValues;if(!a||Object.keys(a).length===0)throw Error(`Invalid discriminated union option at index \"${o.def.options.indexOf(c)}\"`);if(a[o.def.discriminator]?.has(void 0))i++;for(let[l,u]of Object.entries(a)){if(!Object.prototype.hasOwnProperty.call(s,l))ue(s,l,new Set);for(let f of u)s[l].add(f)}}if(!o.def.unionFallback&&i>1)s[o.def.discriminator]?.delete(void 0);return s}),t.options.forEach((o,s)=>{let i=hr(o._zod.def);if(i&&!Object.prototype.hasOwnProperty.call(i,t.discriminator))throw Error(`Invalid discriminated union option at index \"${s}\"`)});let n=dr(()=>sg(t));e._zod.parse=(o,s)=>{let i=o.value;if(!zt(i))return o.issues.push({code:\"invalid_type\",expected:\"object\",input:i,inst:e}),o;let c=i?.[t.discriminator],a=n.value.get(c);if(a&&(c!==void 0||s.direction!==\"backward\"))return a._zod.run(o,s);if(t.unionFallback||s.direction===\"backward\")return r(o,s);return o.issues.push({code:\"invalid_union\",errors:[],note:\"No matching discriminator\",discriminator:t.discriminator,options:Array.from(n.value.keys()).filter((l)=>n.value.get(l)!==null),input:i,path:[t.discriminator],inst:e}),o}}),Il=m(\"$ZodIntersection\",(e,t)=>{A.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,s=t.left._zod.run({value:o,issues:[]},n),i=t.right._zod.run({value:o,issues:[]},n);if(s instanceof Promise||i instanceof Promise)return Promise.all([s,i]).then(([a,l])=>Ru(r,a,l));return Ru(r,s,i)}});function Zs(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(It(e)&&It(t)){let r=Object.keys(t),n=Object.keys(e).filter((s)=>r.indexOf(s)!==-1),o={...e,...t};if(Object.prototype.hasOwnProperty.call(o,\"__proto__\"))delete o.__proto__;for(let s of n){if(s===\"__proto__\")continue;let i=Zs(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],s=t[n],i=Zs(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Ru(e,t,r){let n=new Map,o,s=new Map,i=(l,u)=>{let f;if(l.code===\"unrecognized_keys\"&&!l.path?.length)o??(o=l),f=l.keys;else if(l.code===\"invalid_key\"&&l.origin===\"record\"&&l.path?.length===1){let p=String(l.path[0]);if(!s.has(p))s.set(p,l);f=[p]}else return!1;for(let p of f){if(!n.has(p))n.set(p,{});n.get(p)[u]=!0}return!0};for(let l of t.issues)if(!i(l,\"l\"))e.issues.push(l);for(let l of r.issues)if(!i(l,\"r\"))e.issues.push(l);let c=[...n].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(c.length){let l=o?c.filter((u)=>o.keys.includes(u)):[];if(l.length)e.issues.push({...o,keys:l});for(let u of c)if(!l.includes(u)&&s.has(u))e.issues.push(s.get(u))}let a=Zs(t.value,r.value);if(!a.valid){if(Se(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`)}return e.value=a.data,e}var El=m(\"$ZodEnum\",(e,t)=>{A.init(e,t);let r=fr(t.entries),n=new Set(r);e._zod.values=n,k(e,\"pattern\",(o)=>{let s=fr(o.def.entries).filter((i)=>Sa.has(typeof i));return new RegExp(s.length?`^(${s.map((i)=>je(i.toString())).join(\"|\")})$`:\"^[^\\\\s\\\\S]$\")}),e._zod.parse=(o,s)=>{let i=o.value;if(n.has(i))return o;return o.issues.push({code:\"invalid_value\",values:r,input:i,inst:e}),o}}),Al=m(\"$ZodLiteral\",(e,t)=>{A.init(e,t);let r=new Set(t.values);e._zod.values=r,k(e,\"pattern\",(n)=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map((s)=>typeof s===\"string\"?je(s):s?je(s.toString()):String(s)).join(\"|\")})$`:\"^[^\\\\s\\\\S]$\")}),e._zod.parse=(n,o)=>{let s=n.value;if(r.has(s))return n;return n.issues.push({code:\"invalid_value\",values:t.values,input:s,inst:e}),n}});var Ol=m(\"$ZodTransform\",(e,t)=>{A.init(e,t),e._zod.optin=\"optional\",oe.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction===\"backward\")throw new mr(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then((i)=>(r.value=i,r));if(o instanceof Promise)throw new $e;return r.value=o,r}});function ju(e,t){return e.value=t.issues.length?void 0:t.value,e}var Rs=m(\"$ZodOptional\",(e,t)=>{A.init(e,t),k(e,\"optin\",(r)=>r.def.innerType._zod.optin===\"defaulted\"?\"defaulted\":\"optional\"),e._zod.optout=\"optional\",k(e,\"values\",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),k(e,\"pattern\",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${vn(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!==\"defaulted\")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)return o.then((s)=>ju(r,s));return ju(r,o)}return t.innerType._zod.run(r,n)}}),Tl=m(\"$ZodExactOptional\",(e,t)=>{Rs.init(e,t),k(e,\"values\",(r)=>r.def.innerType._zod.values),k(e,\"pattern\",(r)=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Pl=m(\"$ZodNullable\",(e,t)=>{A.init(e,t),k(e,\"optin\",(r)=>r.def.innerType._zod.optin),k(e,\"optout\",(r)=>r.def.innerType._zod.optout),k(e,\"pattern\",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${vn(n.source)}|null)$`):void 0}),k(e,\"values\",(r)=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>{if(r.value===null)return r;return t.innerType._zod.run(r,n)}}),Zl=m(\"$ZodDefault\",(e,t)=>{A.init(e,t),e._zod.optin=\"defaulted\",k(e,\"values\",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction===\"backward\")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>Lu(s,t));return Lu(o,t)}});function Lu(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var Cl=m(\"$ZodPrefault\",(e,t)=>{A.init(e,t),e._zod.optin=\"defaulted\",k(e,\"values\",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction===\"backward\")return t.innerType._zod.run(r,n);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,n)}}),Dl=m(\"$ZodNonOptional\",(e,t)=>{A.init(e,t),k(e,\"values\",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>Bu(s,e));return Bu(o,e)}});function Bu(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:\"invalid_type\",expected:\"nonoptional\",input:e.value,inst:t});return e}function Mu(e,t,r,n){if(!t.issues.length){if(e.value=t.value,t.memo)e.memo=!0;return e}return e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map((o)=>Le(o,n,fe()))},input:e.value}),e}var Nl=m(\"$ZodCatch\",(e,t)=>{A.init(e,t),k(e,\"optin\",(r)=>r.def.innerType._zod.optin===\"defaulted\"?\"defaulted\":\"optional\"),k(e,\"optout\",(r)=>r.def.innerType._zod.optout),k(e,\"values\",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction===\"backward\")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)return o.then((s)=>Mu(r,s,t,n));return Mu(r,o,t,n)}});var Ul=m(\"$ZodPipe\",(e,t)=>{A.init(e,t),k(e,\"values\",(r)=>r.def.in._zod.values),k(e,\"optin\",(r)=>r.def.in._zod.optin),k(e,\"optout\",(r)=>r.def.out._zod.optout),k(e,\"propValues\",(r)=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction===\"backward\"){let s=t.out._zod.run(r,n);if(s instanceof Promise)return s.then((i)=>Un(i,t.in,n));return Un(s,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>Un(s,t.out,n));return Un(o,t.out,n)}});function Un(e,t,r){if(e.issues.some((n)=>n.code!==\"unrecognized_keys\"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},r)}var Rl=m(\"$ZodReadonly\",(e,t)=>{A.init(e,t),k(e,\"propValues\",(r)=>r.def.innerType._zod.propValues),k(e,\"values\",(r)=>r.def.innerType._zod.values),k(e,\"optin\",(r)=>r.def.innerType?._zod?.optin),k(e,\"optout\",(r)=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction===\"backward\")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then(Vu);return Vu(o)}});function Vu(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var jl=m(\"$ZodCustom\",(e,t)=>{L.init(e,t),A.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=(r)=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then((s)=>Fu(s,r,n,e));Fu(o,r,n,e);return}});function Fu(e,t,r,n){if(!e){let o={code:\"custom\",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};if(n._zod.def.params)o.params=n._zod.def.params;t.issues.push(rt(o))}}class Bl extends Error{constructor(){super(\"Cannot parse a reference cycle that closes through a transform\");this.name=\"ZodCyclicError\"}}var Ls=\"~memo\",Ll=[];function Ml(e){return e!==null&&typeof e===\"object\"}function js(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var Vl=new WeakMap,xr=0,Fn=1,_r=2;function Jn(e,t,r){let n=Vl.get(e);if(n!==void 0)return n?_r:xr;if(t.has(e))return _r;t.add(e);let o=xr,s=(u)=>{if(o!==_r&&u?._zod){let f=Jn(u,t,r);if(f>o)o=f}},i=(u,f)=>{let p=xr;for(let d of Reflect.ownKeys(u)){let h=Object.getOwnPropertyDescriptor(u,d);if(f&&!h.enumerable)continue;let g=h.get?Fn:h.value?._zod?Jn(h.value,t,r):xr;if(g>p)p=g}return p},c=(u)=>{if(u>o)o=u},a=e._zod.def,l=a.type;switch(l){case\"object\":{let u=hr(a);c(u?i(u,!0):Fn),s(a.catchall);break}case\"array\":s(a.element);break;case\"tuple\":for(let u of a.items)s(u);s(a.rest);break;case\"record\":case\"map\":s(a.keyType),s(a.valueType);break;case\"set\":s(a.valueType);break;case\"union\":for(let u of a.options)s(u);break;case\"intersection\":s(a.left),s(a.right);break;case\"optional\":case\"nullable\":case\"default\":case\"prefault\":case\"catch\":case\"readonly\":case\"nonoptional\":case\"promise\":case\"success\":s(a.innerType);break;case\"pipe\":s(a.in),s(a.out);break;case\"function\":s(a.input),s(a.output);break;case\"lazy\":{let u=a._cachedInner??(r?e._zod.innerType:void 0);c(u?Jn(u,t,!1):Fn);break}case\"template_literal\":case\"string\":case\"number\":case\"int\":case\"boolean\":case\"bigint\":case\"symbol\":case\"undefined\":case\"null\":case\"void\":case\"never\":case\"any\":case\"unknown\":case\"date\":case\"nan\":case\"enum\":case\"literal\":case\"file\":case\"transform\":case\"custom\":break;default:for(let u in a){let f=Object.getOwnPropertyDescriptor(a,u);if(!f||f.get)continue;let p=f.value;if(!p||typeof p!==\"object\")continue;if(p._zod)s(p);else if(Array.isArray(p))for(let d of p)s(d)}}return t.delete(e),ig(e,o)}function ig(e,t){if(t!==Fn)Vl.set(e,t===_r);return t}function cg(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}var Mn,Vn=[],ag={alloc(e,t,r){let n=Mn;if(!n)return r;Mn=void 0;let o={value:r,issues:null};return n.set(t.value,o),Vn.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=(o,s)=>{if(s.direction!==\"backward\"&&ug(s,o.value))throw new Bl;return r(o,s)};if(e._zod.parse=n,e._zod.run===r)e._zod.run=n})},attach(e){var t;let r,n=!1,o,s;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let i=e._zod.parse,c=(a,l)=>{if(r===void 0){let S=Jn(e,new Set,!1);if(S===xr){if(e._zod.parse=i,e._zod.run===c)e._zod.run=i;return i(a,l)}if(S===_r||n)r=!0;else n=!0}let u=a.value;if(!Ml(u))return i(a,l);let f=l[Ls];if(!f)f={buckets:new WeakMap,backEdges:void 0},l[Ls]=f;let p;if(o===l)p=s;else p=cg(f,e),o=l,s=p;let d=p.get(u);if(d){if(a.value=d.value,d.issues){if(d.issues.length)a.issues.push(...js(d.issues))}else a.memo=!0,f.backEdges??(f.backEdges=new WeakSet),f.backEdges.add(d.value);return a}Mn=p;let h=Vn.length,g=i(a,l);Mn=void 0;let x=Vn.length>h?Vn.pop():void 0;if(g instanceof Promise)return g.then((S)=>{if(x)x.issues=S.issues.length?js(S.issues):Ll;return S});if(x)x.issues=g.issues.length?js(g.issues):Ll;return g};if(e._zod.parse=c,e._zod.run===i)e._zod.run=c})}};function Fl(){return ag}function ug(e,t){let r=e[Ls]?.backEdges;return r!==void 0&&Ml(t)&&r.has(t)}var lg=()=>{let e={string:{unit:\"characters\",verb:\"to have\"},file:{unit:\"bytes\",verb:\"to have\"},array:{unit:\"items\",verb:\"to have\"},set:{unit:\"items\",verb:\"to have\"},map:{unit:\"entries\",verb:\"to have\"}};function t(s){return e[s]??null}let r={regex:\"input\",email:\"email address\",url:\"URL\",emoji:\"emoji\",uuid:\"UUID\",uuidv4:\"UUIDv4\",uuidv6:\"UUIDv6\",nanoid:\"nanoid\",guid:\"GUID\",cuid:\"cuid\",cuid2:\"cuid2\",ulid:\"ULID\",xid:\"XID\",ksuid:\"KSUID\",datetime:\"ISO datetime\",date:\"ISO date\",time:\"ISO time\",duration:\"ISO duration\",ipv4:\"IPv4 address\",ipv6:\"IPv6 address\",mac:\"MAC address\",cidrv4:\"IPv4 range\",cidrv6:\"IPv6 range\",base64:\"base64-encoded string\",base64url:\"base64url-encoded string\",json_string:\"JSON string\",e164:\"E.164 number\",currency_code:\"currency code\",credit_card:\"credit card number\",iban:\"IBAN\",jwt:\"JWT\",template_literal:\"input\"},n={nan:\"NaN\"};function o(s,i){if(s===\"number\"&&typeof i===\"number\"&&!Number.isFinite(i))return String(i);return n[s]??s}return(s)=>{switch(s.code){case\"invalid_type\":{let i=o(s.expected),c=Aa(s.input),a=o(c,s.input);return`Invalid input: expected ${i}, received ${a}`}case\"invalid_value\":if(s.values.length===1)return`Invalid input: expected ${xs(s.values[0])}`;return`Invalid option: expected one of ${ms(s.values,\"|\")}`;case\"too_big\":{let i=s.exact?\"exactly \":s.inclusive?\"<=\":\"<\",c=t(s.origin);if(c)return`Too big: expected ${s.origin??\"value\"} to have ${i}${s.maximum.toString()} ${c.unit??\"elements\"}`;return`Too big: expected ${s.origin??\"value\"} to be ${i}${s.maximum.toString()}`}case\"too_small\":{let i=s.exact?\"exactly \":s.inclusive?\">=\":\">\",c=t(s.origin);if(c)return`Too small: expected ${s.origin} to have ${i}${s.minimum.toString()} ${c.unit}`;return`Too small: expected ${s.origin} to be ${i}${s.minimum.toString()}`}case\"invalid_format\":{let i=s;if(i.format===\"starts_with\")return`Invalid string: must start with \"${i.prefix}\"`;if(i.format===\"ends_with\")return`Invalid string: must end with \"${i.suffix}\"`;if(i.format===\"includes\")return`Invalid string: must include \"${i.includes}\"`;if(i.format===\"regex\")return`Invalid string: must match pattern ${i.pattern}`;return`Invalid ${r[i.format]??s.format}`}case\"not_multiple_of\":return`Invalid number: must be a multiple of ${s.divisor}`;case\"unrecognized_keys\":return`Unrecognized key${s.keys.length>1?\"s\":\"\"}: ${ms(s.keys,\", \")}`;case\"invalid_key\":return`Invalid key in ${s.origin}`;case\"invalid_union\":if(s.options&&Array.isArray(s.options)&&s.options.length>0)return`Invalid discriminator value. Expected ${s.options.map((c)=>`'${c}'`).join(\" | \")}`;if(s.inclusive===!1)return\"Invalid input: more than one option matched\";return\"Invalid input\";case\"invalid_element\":return`Invalid value in ${s.origin}`;default:return\"Invalid input\"}}};function Bs(){return{localeError:lg()}}var Jl;class Kl{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r===\"object\"&&\"id\"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t===\"object\"&&\"id\"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function fg(){return new Kl}(Jl=globalThis).__zod_globalRegistry??(Jl.__zod_globalRegistry=fg());var nt=globalThis.__zod_globalRegistry;function ql(e){if(e.checks)e.checks=[...e.checks];return e}function Gl(e,t){return new e(ql({type:\"string\",...y(t)}))}function Wl(e,t){return new e({type:\"string\",format:\"email\",check:\"string_format\",abort:!1,...y(t)})}function Hl(e,t){return new e({type:\"string\",format:\"guid\",check:\"string_format\",abort:!1,...y(t)})}function Yl(e,t){return new e({type:\"string\",format:\"uuid\",check:\"string_format\",abort:!1,...y(t)})}function Xl(e,t){return new e({type:\"string\",format:\"uuid\",check:\"string_format\",abort:!1,version:\"v4\",...y(t)})}function Ql(e,t){return new e({type:\"string\",format:\"uuid\",check:\"string_format\",abort:!1,version:\"v6\",...y(t)})}function ef(e,t){return new e({type:\"string\",format:\"uuid\",check:\"string_format\",abort:!1,version:\"v7\",...y(t)})}function tf(e,t){return new e({type:\"string\",format:\"url\",check:\"string_format\",abort:!1,...y(t)})}function rf(e,t){return new e({type:\"string\",format:\"emoji\",check:\"string_format\",abort:!1,...y(t)})}function nf(e,t){return new e({type:\"string\",format:\"nanoid\",check:\"string_format\",abort:!1,...y(t)})}function of(e,t){return new e({type:\"string\",format:\"cuid\",check:\"string_format\",abort:!1,...y(t)})}function sf(e,t){return new e({type:\"string\",format:\"cuid2\",check:\"string_format\",abort:!1,...y(t)})}function cf(e,t){return new e({type:\"string\",format:\"ulid\",check:\"string_format\",abort:!1,...y(t)})}function af(e,t){return new e({type:\"string\",format:\"xid\",check:\"string_format\",abort:!1,...y(t)})}function uf(e,t){return new e({type:\"string\",format:\"ksuid\",check:\"string_format\",abort:!1,...y(t)})}function lf(e,t){return new e({type:\"string\",format:\"ipv4\",check:\"string_format\",abort:!1,...y(t)})}function ff(e,t){return new e({type:\"string\",format:\"ipv6\",check:\"string_format\",abort:!1,...y(t)})}function pf(e,t){return new e({type:\"string\",format:\"cidrv4\",check:\"string_format\",abort:!1,...y(t)})}function df(e,t){return new e({type:\"string\",format:\"cidrv6\",check:\"string_format\",abort:!1,...y(t)})}function hf(e,t){return new e({type:\"string\",format:\"base64\",check:\"string_format\",abort:!1,...y(t)})}function mf(e,t){return new e({type:\"string\",format:\"base64url\",check:\"string_format\",abort:!1,...y(t)})}function gf(e,t){return new e({type:\"string\",format:\"e164\",check:\"string_format\",abort:!1,...y(t)})}function yf(e,t){return new e({type:\"string\",format:\"jwt\",check:\"string_format\",abort:!1,...y(t)})}function xf(e,t){return new e({type:\"string\",format:\"datetime\",check:\"string_format\",offset:!1,local:!1,precision:null,...y(t)})}function _f(e,t){return new e({type:\"string\",format:\"date\",check:\"string_format\",...y(t)})}function wf(e,t){return new e({type:\"string\",format:\"time\",check:\"string_format\",precision:null,...y(t)})}function bf(e,t){return new e({type:\"string\",format:\"duration\",check:\"string_format\",...y(t)})}function kf(e,t){return new e(ql({type:\"number\",checks:[],...y(t)}))}function vf(e,t){return new e({type:\"number\",check:\"number_format\",abort:!1,format:\"safeint\",...y(t)})}function Sf(e){return new e({type:\"unknown\"})}function $f(e,t){return new e({type:\"never\",...y(t)})}function Kn(e,t){return new Os({check:\"less_than\",...y(t),value:e,inclusive:!1})}function wr(e,t){return new Os({check:\"less_than\",...y(t),value:e,inclusive:!0})}function qn(e,t){return new Ts({check:\"greater_than\",...y(t),value:e,inclusive:!1})}function br(e,t){return new Ts({check:\"greater_than\",...y(t),value:e,inclusive:!0})}function Gn(e,t){return new bu({check:\"multiple_of\",...y(t),value:e})}function Wn(e,t){return new vu({check:\"max_length\",...y(t),maximum:e})}function Et(e,t){return new Su({check:\"min_length\",...y(t),minimum:e})}function Hn(e,t){return new $u({check:\"length_equals\",...y(t),length:e})}function Ms(e,t){return new zu({check:\"string_format\",format:\"regex\",...y(t),pattern:e})}function Vs(e){return new Iu({check:\"string_format\",format:\"lowercase\",...y(e)})}function Fs(e){return new Eu({check:\"string_format\",format:\"uppercase\",...y(e)})}function Js(e,t){return new Au({check:\"string_format\",format:\"includes\",...y(t),includes:e})}function Ks(e,t){return new Ou({check:\"string_format\",format:\"starts_with\",...y(t),prefix:e})}function qs(e,t){return new Tu({check:\"string_format\",format:\"ends_with\",...y(t),suffix:e})}function Be(e){return new Pu({check:\"overwrite\",tx:e})}function Gs(e){return Be((t)=>t.normalize(e))}function Ws(){return Be((e)=>e.trim())}function Hs(){return Be((e)=>e.toLowerCase())}function Ys(){return Be((e)=>e.toUpperCase())}function Xs(){return Be((e)=>ka(e))}function zf(e,t,r){return new e({type:\"array\",element:t,...y(r)})}function If(e,t,r){return new e({type:\"custom\",check:\"custom\",fn:t,...y(r)})}function Ef(e,t){let r=pg((n)=>(n.addIssue=(o)=>{if(typeof o===\"string\")n.issues.push(rt(o,n.value,r._zod.def));else{let s=o;if(s.fatal)s.continue=!1;if(s.code??(s.code=\"custom\"),!(\"input\"in s))s.input=n.value;s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),n.issues.push(rt(s))}},e(n.value,n)),t);return r}function pg(e,t){let r=new L({check:\"custom\",...y(t)});return r._zod.check=e,r}function kr(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))if(Object.prototype.propertyIsEnumerable.call(r,n))ue(e,n,r[n]);return e}function ei(e){let t=e?.target??\"draft-2020-12\";if(t===\"draft-4\")t=\"draft-04\";if(t===\"draft-7\")t=\"draft-07\";return{processors:e.processors??{},metadataRegistry:e?.metadata??nt,target:t,unrepresentable:e?.unrepresentable??\"throw\",override:e?.override??(()=>{}),io:e?.io??\"output\",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??\"ref\",reused:e?.reused??\"inline\",intersections:[],deferred:[],external:e?.external??void 0}}function Ze(e,t,r,n,o){let s=typeof t.unrepresentable===\"function\"?t.unrepresentable({zodSchema:e,path:n.path,message:o}):t.unrepresentable;if(s===\"any\")return!1;if(s===void 0||s===\"throw\")throw Error(o);return Object.assign(r,s),!0}function j(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,s=t.seen.get(e);if(s){if(s.count++,r.schemaPath.includes(e))s.cycle=r.path;return s.schema}let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let c=e._zod.toJSONSchema?.();if(c)i.schema=c;else{let u={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,u);else{let p=i.schema,d=t.processors[o.type];if(!d)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);d(e,t,p,u)}let f=e._zod.parent;if(f){if(!i.ref)i.ref=f;j(f,t,u),t.seen.get(f).isParent=!0}}let a=t.metadataRegistry.get(e);if(a)kr(i.schema,a);if(t.io===\"input\"&&G(e))delete i.schema.examples,delete i.schema.default;if(t.io===\"input\"&&\"_prefault\"in i.schema)(n=i.schema).default??(n.default=i.schema._prefault);return delete i.schema._prefault,t.seen.get(e).schema}function Af(e){return e.replace(/~/g,\"~0\").replace(/\\//g,\"~1\")}function ti(e,t){let r=e.seen.get(t);if(!r)throw Error(\"Unprocessed schema. This is a bug in Zod.\");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let i of e.seen.entries()){let c=e.metadataRegistry.get(i[0])?.id;if(c){let a=n.get(c);if(a&&a!==i[0])throw Error(`Duplicate schema id \"${c}\" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(c,i[0])}}let o=(i)=>{let c=e.target===\"draft-2020-12\"?\"$defs\":\"definitions\";if(e.external){let f=e.external.registry.get(i[0])?.id,p=e.external.uri??((h)=>h);if(f)return{ref:p(f)};let d=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=d,{defId:d,ref:`${p(\"__shared\")}#/${c}/${Af(d)}`}}let a=\"#\",l=`${a}/${c}/`;if(i[1]===r&&!i[1].schema.id)return{ref:a};let u=i[1].schema.id??`__schema${e.counter++}`;return{defId:u,ref:l+Af(u)}},s=(i)=>{if(i[1].schema.$ref)return;let c=i[1],{ref:a,defId:l}=o(i);if(c.def={...c.schema},l)c.defId=l;let u=c.schema;for(let f in u)delete u[f];u.$ref=a};if(e.cycles===\"throw\")for(let i of e.seen.entries()){let c=i[1];if(c.cycle)throw Error(`Cycle detected: #/${c.cycle?.join(\"/\")}/<root>\n\nSet the \\`cycles\\` parameter to \\`\"ref\"\\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let c=i[1];if(t===i[0]){s(i);continue}if(e.external){let l=e.external.registry.get(i[0])?.id;if(t!==i[0]&&l){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(c.cycle){s(i);continue}if(c.count>1){if(e.reused===\"ref\")s(i)}}if(e.external)e.sharedDefsExtractedFor=e.external}function Pf(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!==\"object\")return;Pf(n);let o=Object.keys(n);if(o.length!==1||o[0]!==\"type\")return;let s=n.type;for(let i of Array.isArray(s)?s:[s]){if(typeof i!==\"string\")return;if(!r.includes(i))r.push(i)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var Zf=new Set([\"type\",\"properties\",\"required\",\"additionalProperties\"]),Of=[\"oneOf\",\"anyOf\"];function Tf(e){let t=e.additionalProperties;if(t===void 0||t===!1||typeof t!==\"object\"||t===null)return null;return Object.keys(t).length?t:null}function Qs(e){let t=[];for(let s of e){if(typeof s!==\"object\"||s.type!==\"object\")return null;for(let i in s)if(!Zf.has(i))return null;t.push(s)}let r={},n=new Set;for(let s of t){for(let i in s.properties){if(Object.prototype.hasOwnProperty.call(r,i))continue;let c=[];for(let l of t){let u=l.properties?.[i]??Tf(l);if(u===null||u===void 0)continue;if(!c.some((f)=>JSON.stringify(f)===JSON.stringify(u)))c.push(u)}let a=c.length===1?c[0]:Qs(c)??{allOf:c};ue(r,i,a)}for(let i of s.required??[])n.add(i)}let o={type:\"object\",properties:r};if(n.size)o.required=[...n];if(t.every((s)=>s.additionalProperties===!1))o.additionalProperties=!1;else{let s=[];for(let i of t){let c=Tf(i);if(c&&!s.some((a)=>JSON.stringify(a)===JSON.stringify(c)))s.push(c)}if(s.length===1)o.additionalProperties=s[0];else if(s.length>1)o.additionalProperties={allOf:s}}return o}function dg(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of Zf)if(o in e)return;let r=t.filter((o)=>Of.some((s)=>Array.isArray(o[s]))),n=null;if(!r.length)n=Qs(t);else{let o=r[0],s=Of.find((a)=>Array.isArray(o[a]));if(Object.keys(o).length!==1)return;let i=t.filter((a)=>a!==o),c=o[s].map((a)=>Qs([...i,a]));if(c.some((a)=>!a))return;n={[s]:c}}if(!n)return;delete e.allOf,kr(e,n)}function ri(e,t){let r=e.seen.get(t);if(!r)throw Error(\"Unprocessed schema. This is a bug in Zod.\");let n=(c)=>{let a=e.seen.get(c);if(a.ref===null)return;let l=a.def??a.schema,u={...l},f=a.ref;if(a.ref=null,f){n(f);let d=e.seen.get(f),h=d.schema;if(h.$ref&&(e.target===\"draft-07\"||e.target===\"draft-04\"||e.target===\"openapi-3.0\"))l.allOf=l.allOf??[],l.allOf.push(h);else kr(l,h);if(kr(l,u),c._zod.parent===f)for(let x in l){if(x===\"$ref\"||x===\"allOf\")continue;if(!(x in u))delete l[x]}if(h.$ref&&d.def)for(let x in l){if(x===\"$ref\"||x===\"allOf\")continue;if(x in d.def&&JSON.stringify(l[x])===JSON.stringify(d.def[x]))delete l[x]}}let p=c._zod.parent;if(p&&p!==f){n(p);let d=e.seen.get(p);if(d?.schema.$ref){if(l.$ref=d.schema.$ref,d.def)for(let h in l){if(h===\"$ref\"||h===\"allOf\")continue;if(h in d.def&&JSON.stringify(l[h])===JSON.stringify(d.def[h]))delete l[h]}}}e.override({zodSchema:c,jsonSchema:l,path:a.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())n(c[0]);if(e.target!==\"openapi-3.0\")for(let c of e.seen.entries())Pf(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let a of e.seen.values())for(let l of[a.schema,a.def]){let u=l?.allOf;if(!Array.isArray(u))continue;let f=c.get(u);if(f)f.push(l);else c.set(u,[l])}for(let a of e.intersections)for(let l of c.get(a)??[])dg(l)}}let o={};if(e.target===\"draft-2020-12\")o.$schema=\"https://json-schema.org/draft/2020-12/schema\";else if(e.target===\"draft-07\")o.$schema=\"http://json-schema.org/draft-07/schema#\";else if(e.target===\"draft-04\")o.$schema=\"http://json-schema.org/draft-04/schema#\";else if(e.target===\"openapi-3.0\");if(e.external?.uri){let c=e.external.registry.get(t)?.id;if(!c)throw Error(\"Schema is missing an `id` property\");o.$id=e.external.uri(c)}kr(o,r.defId?r.schema:r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;if(s!==void 0&&o.id===s)delete o.id;let i=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let c of e.seen.entries()){let a=c[1];if(a.def&&a.defId){if(a.def.id===a.defId)delete a.def.id;ue(i,a.defId,a.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(i).length>0)if(e.target===\"draft-2020-12\")o.$defs=i;else o.definitions=i;try{let c=JSON.parse(JSON.stringify(o));return Object.defineProperty(c,\"~standard\",{value:{...t[\"~standard\"],jsonSchema:{input:vr(t,\"input\",e.processors),output:vr(t,\"output\",e.processors)}},enumerable:!1,writable:!1}),c}catch(c){throw Error(\"Error converting schema to JSON.\")}}function G(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type===\"transform\")return!0;if(n.type===\"array\")return G(n.element,r);if(n.type===\"set\")return G(n.valueType,r);if(n.type===\"lazy\")return G(n.getter(),r);if(n.type===\"promise\"||n.type===\"optional\"||n.type===\"nonoptional\"||n.type===\"nullable\"||n.type===\"readonly\"||n.type===\"default\"||n.type===\"prefault\"||n.type===\"catch\")return G(n.innerType,r);if(n.type===\"intersection\")return G(n.left,r)||G(n.right,r);if(n.type===\"record\"||n.type===\"map\")return G(n.keyType,r)||G(n.valueType,r);if(n.type===\"pipe\"){if(e._zod.traits.has(\"$ZodCodec\"))return!0;return G(n.in,r)||G(n.out,r)}if(n.type===\"object\"){for(let o in n.shape)if(G(n.shape[o],r))return!0;return!1}if(n.type===\"union\"){for(let o of n.options)if(G(o,r))return!0;return!1}if(n.type===\"tuple\"){for(let o of n.items)if(G(o,r))return!0;if(n.rest&&G(n.rest,r))return!0;return!1}return!1}var Cf=(e,t={})=>(r)=>{let n=ei({...r,processors:t});return j(e,n),ti(n,e),ri(n,e)},vr=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:s}=n??{},i=ei({...o??{},target:s,io:t,processors:r});return j(e,i),ti(i,e),ri(i,e)};var At=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},Ot=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},Df=(e,t)=>{At(e,\"minimum\",t),Ot(e,\"maximum\",t)},jf=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},Lf=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Bf=(e,t)=>{e.mime=e.mime?e.mime.filter((r)=>t.includes(r)):[...t]},Mf=(e,t)=>{if(e.format=t,t.includes(\"int\"))e.isInt=!0},Nf=(e,t)=>At(e,\"minimum\",t.minimum),Uf=(e,t)=>Ot(e,\"maximum\",t.maximum),Rf=(e)=>(t,r)=>{Mf(t,r.format);let[n,o]=e[r.format];At(t,\"minimum\",n),Ot(t,\"maximum\",o)},hg={greater_than:(e,t)=>At(e,t.inclusive?\"minimum\":\"exclusiveMinimum\",t.value),less_than:(e,t)=>Ot(e,t.inclusive?\"maximum\":\"exclusiveMaximum\",t.value),multiple_of:(e,t)=>jf(e,t.value),number_format:Rf(Sn),bigint_format:Rf(_s),min_length:Nf,max_length:Uf,length_equals:(e,t)=>Df(e,t.length),min_size:Nf,max_size:Uf,size_equals:(e,t)=>Df(e,t.size),string_format:(e,t)=>{if(Mf(e,t.format),t.pattern)Lf(e,t.pattern);if(t.format===\"base64\"||t.format===\"base64url\")e.contentEncoding=t.format;if(t.local||t.precision===-1)e.laxFormat=!0},mime_type:(e,t)=>Bf(e,t.mime)};function pe(e){let t={},r=e._zod.def,n=e._zod.traits.has(\"$ZodCheck\")?[e,...r.checks??[]]:r.checks??[];for(let s of n)hg[s._zod.def.check]?.(t,s._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)At(t,\"minimum\",o.minimum);if(o.exclusiveMinimum!==void 0)At(t,\"exclusiveMinimum\",o.exclusiveMinimum);if(o.maximum!==void 0)Ot(t,\"maximum\",o.maximum);if(o.exclusiveMaximum!==void 0)Ot(t,\"exclusiveMaximum\",o.exclusiveMaximum);if(o.multipleOf!==void 0)jf(t,o.multipleOf);if(o.format!==void 0){if(t.format??(t.format=o.format),o.format.includes(\"int\"))t.isInt=!0}if(o.mime)Bf(t,o.mime);for(let s of o.patterns??[])Lf(t,s);return t}var mg={guid:\"uuid\",url:\"uri\",datetime:\"date-time\",json_string:\"json-string\",regex:\"\"},gg=new Map([[Ds,lu],[Bn,fu]]),yg=(e)=>gg.get(e)??e,Vf=(e,t,r,n)=>{let o=r;o.type=\"string\";let{minimum:s,maximum:i,format:c,patterns:a,contentEncoding:l,laxFormat:u}=pe(e);if(typeof s===\"number\")o.minLength=s;if(typeof i===\"number\")o.maxLength=i;if(c){if(o.format=mg[c]??c,o.format===\"\")delete o.format;if(c===\"time\"||u)delete o.format}if(l)o.contentEncoding=l;if(a&&a.size>0){let f=[...a].map(yg);if(f.length===1)o.pattern=f[0].source;else if(f.length>1)o.allOf=[...f.map((p)=>({...t.target===\"draft-07\"||t.target===\"draft-04\"||t.target===\"openapi-3.0\"?{type:\"string\"}:{},pattern:p.source}))]}},Ff=(e,t,r,n)=>{let o=r,{minimum:s,maximum:i,multipleOf:c,exclusiveMaximum:a,exclusiveMinimum:l,isInt:u}=pe(e);o.type=u?\"integer\":\"number\";let f=typeof l===\"number\"&&l>=(s??Number.NEGATIVE_INFINITY),p=typeof a===\"number\"&&a<=(i??Number.POSITIVE_INFINITY),d=t.target===\"draft-04\"||t.target===\"openapi-3.0\";if(f)if(d)o.minimum=l,o.exclusiveMinimum=!0;else o.exclusiveMinimum=l;else if(typeof s===\"number\")o.minimum=s;if(p)if(d)o.maximum=a,o.exclusiveMaximum=!0;else o.exclusiveMaximum=a;else if(typeof i===\"number\")o.maximum=i;if(c){let h=new Set;for(let S of c)if(Number.isFinite(S)&&S!==0)h.add(Math.abs(S));else Ze(e,t,o,n,`A multipleOf divisor of ${S} cannot be represented in JSON Schema`);let[g,...x]=h;if(g!==void 0)o.multipleOf=g;if(x.length)o.allOf=[...o.allOf??[],...x.map((S)=>({multipleOf:S}))]}};var Jf=(e,t,r,n)=>{r.not={}};var Kf=(e,t,r,n)=>{};var qf=(e,t,r,n)=>{let o=e._zod.def,s=fr(o.entries);if(s.length===0){r.not={};return}if(s.every((i)=>typeof i===\"number\"))r.type=\"number\";if(s.every((i)=>typeof i===\"string\"))r.type=\"string\";r.enum=s},Gf=(e,t,r,n)=>{let o=e._zod.def;if(o.values.length===0){r.not={};return}let s=[];for(let i of o.values)if(i===void 0){if(Ze(e,t,r,n,\"Literal `undefined` cannot be represented in JSON Schema\"))return}else if(typeof i===\"bigint\"){if(Ze(e,t,r,n,\"BigInt literals cannot be represented in JSON Schema\"))return;s.push(Number(i))}else s.push(i);if(s.length===0);else if(s.length===1){let i=s[0];if(r.type=i===null?\"null\":typeof i,t.target===\"draft-04\"||t.target===\"openapi-3.0\")r.enum=[i];else r.const=i}else{if(s.every((i)=>typeof i===\"number\"))r.type=\"number\";if(s.every((i)=>typeof i===\"string\"))r.type=\"string\";if(s.every((i)=>typeof i===\"boolean\"))r.type=\"boolean\";if(s.every((i)=>i===null))r.type=\"null\";r.enum=s}};var Wf=(e,t,r,n)=>{Ze(e,t,r,n,\"Custom types cannot be represented in JSON Schema\")};var Hf=(e,t,r,n)=>{Ze(e,t,r,n,\"Transforms cannot be represented in JSON Schema\")};var Yf=(e,t,r,n)=>{let o=r,s=e._zod.def,{minimum:i,maximum:c}=pe(e);if(typeof i===\"number\")o.minItems=i;if(typeof c===\"number\")o.maxItems=c;o.type=\"array\",o.items=j(s.element,t,{...n,path:[...n.path,\"items\"]})};function ni(e){let t=e._zod.def;if(t.type===\"pipe\"&&t.in._zod.traits.has(\"$ZodTransform\"))return ni(t.out);if(t.type===\"catch\")return ni(t.innerType);return e._zod.optin}var Xf=(e,t,r,n)=>{let o=r,s=e._zod.def,i=s.shape;if(Object.getOwnPropertySymbols(i).length&&Ze(e,t,o,n,\"Symbol keys cannot be represented in JSON Schema\"))return;o.type=\"object\",o.properties={};for(let l in i)ue(o.properties,l,j(i[l],t,{...n,path:[...n.path,\"properties\",l]}));let a=[];for(let l of Object.keys(i)){let u=s.shape[l];if(t.io===\"input\"?ni(u)===void 0:u._zod.optout===void 0)a.push(l)}if(a.length>0)o.required=a;if(s.catchall?._zod.def.type===\"never\")o.additionalProperties=!1;else if(!s.catchall){if(t.io===\"output\")o.additionalProperties=!1}else if(s.catchall)o.additionalProperties=j(s.catchall,t,{...n,path:[...n.path,\"additionalProperties\"]})},Qf=(e,t,r,n)=>{let o=e._zod.def,s=o.inclusive===!1,i=o.options.map((c,a)=>j(c,t,{...n,path:[...n.path,s?\"oneOf\":\"anyOf\",a]}));if(s)r.oneOf=i;else r.anyOf=i},ep=(e,t,r,n)=>{let o=e._zod.def,s=j(o.left,t,{...n,path:[...n.path,\"allOf\",0]}),i=j(o.right,t,{...n,path:[...n.path,\"allOf\",1]}),c=(l)=>(\"allOf\"in l)&&Object.keys(l).length===1,a=[...c(s)?s.allOf:[s],...c(i)?i.allOf:[i]];r.allOf=a,t.intersections.push(a)};var tp=(e,t,r,n)=>{let o=e._zod.def,s=j(o.innerType,t,n),i=t.seen.get(e);if(t.target===\"openapi-3.0\")i.ref=o.innerType,r.nullable=!0;else r.anyOf=[s,{type:\"null\"}]},rp=(e,t,r,n)=>{let o=e._zod.def;j(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},oi=Symbol();function np(e,t,r,n,o){let s=!1,i=JSON.stringify(e,(c,a)=>{if(typeof a!==\"bigint\")return a;return s=!0,null});if(!s)return JSON.parse(i);return Ze(t,r,n,o,\"BigInt defaults cannot be represented in JSON Schema\"),oi}var op=(e,t,r,n)=>{let o=e._zod.def;j(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let i=np(o.defaultValue,e,t,r,n);if(i!==oi)r.default=i},sp=(e,t,r,n)=>{let o=e._zod.def;j(o.innerType,t,n);let s=t.seen.get(e);if(s.ref=o.innerType,t.io!==\"input\")return;let i=np(o.defaultValue,e,t,r,n);if(i!==oi)r._prefault=i},ip=(e,t,r,n)=>{let o=e._zod.def;j(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{Ze(e,t,r,n,\"Dynamic catch values are not supported in JSON Schema\");return}r.default=i},cp=(e,t,r,n)=>{let o=e._zod.def,s=o.in._zod.traits.has(\"$ZodTransform\"),i=t.io===\"input\"?s?o.out:o.in:o.out;j(i,t,n);let c=t.seen.get(e);c.ref=i},ap=(e,t,r,n)=>{let o=e._zod.def;j(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,r.readOnly=!0};var si=(e,t,r,n)=>{let o=e._zod.def;j(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType};var up=new WeakSet([Object.prototype,Error.prototype]);function Yn(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var $g=(e,t)=>{Ua.init(e,t),e.name=\"ZodError\";let r=Object.getPrototypeOf(e);if(up.has(r))return;up.add(r),Yn(r,\"format\",(n)=>(o)=>ja(n,o)),Yn(r,\"flatten\",(n)=>(o)=>Ra(n,o)),Yn(r,\"addIssue\",(n)=>(o)=>{n.issues.push(o),n.message=JSON.stringify(n.issues,pr,2)}),Yn(r,\"addIssues\",(n)=>(o)=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,pr,2)}),Object.defineProperty(r,\"isEmpty\",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var se=m(\"ZodError\",$g,void 0,{Parent:Error});var lp=Pn(se),fp=Zn(se),pp=Cn(se),dp=Dn(se),hp=Ba(se),mp=Ma(se),gp=Va(se),yp=Fa(se),xp=Ja(se),_p=Ka(se),wp=qa(se),bp=Ga(se);function Ig(){if(!oe.localeError)fe(Bs())}function ai(){if(!oe.memoizer)fe({memoizer:Fl()})}var O=m(\"ZodType\",(e,t)=>(Ig(),A.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(ne(t,{checks:[...t.checks??[],...e.map((r)=>typeof r===\"function\"?{_zod:{check:r,def:{check:\"custom\"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return ve(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(vy(e,t))},superRefine(e,t){return this.check(Sy(e,t))},overwrite(e){return this.check(Be(e))},optional(){return vp(this)},exactOptional(){return ly(this)},nullable(){return Sp(this)},nullish(){return vp(Sp(this))},nonoptional(e){return gy(this,e)},array(){return Sr(this)},or(e){return li([this,e])},and(e){return sy(this,e)},transform(e){return $p(this,uy(e))},default(e){return dy(this,e)},prefault(e){return my(this,e)},catch(e){return xy(this,e)},pipe(e){return $p(this,e)},readonly(){return by(this)},describe(e){let t=this.clone();return nt.add(t,{description:e}),t},meta(...e){if(e.length===0)return nt.get(this);let t=this.clone();return nt.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get \"~standard\"(){return On(this,\"~standard\",{...Cs(this),jsonSchema:{input:vr(this,\"input\"),output:vr(this,\"output\")}})},set \"~standard\"(e){Pe(this,\"~standard\",e)},parse:function e(t,r){return lp(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await fp(this,t,r,{callee:e})},safeParse(e,t){return pp(this,e,t)},async safeParseAsync(e,t){return dp(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Pe(this,\"spa\",e)},validate(e,t){return Ss(this,e,t)},validateAsync(e,t){return $s(this,e,t)},encode:function e(t,r){return hp(this,t,r,{callee:e})},decode:function e(t,r){return mp(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await gp(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await yp(this,t,r,{callee:e})},safeEncode(e,t){return xp(this,e,t)},safeDecode(e,t){return _p(this,e,t)},async safeEncodeAsync(e,t){return wp(this,e,t)},async safeDecodeAsync(e,t){return bp(this,e,t)},toJSONSchema(e){return Cf(this,{})(e)},get description(){return nt.get(this)?.description},get _def(){return this._zod.def}}),zp=m(\"_ZodString\",(e,t)=>{Ln.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vf(e,r,n,o)},Ta({format:(e)=>pe(e).format??null,minLength:(e)=>pe(e).minimum??null,maxLength:(e)=>pe(e).maximum??null},{regex(...e){return this.check(Ms(...e))},includes(...e){return this.check(Js(...e))},startsWith(...e){return this.check(Ks(...e))},endsWith(...e){return this.check(qs(...e))},min(...e){return this.check(Et(...e))},max(...e){return this.check(Wn(...e))},length(...e){return this.check(Hn(...e))},nonempty(...e){return this.check(Et(1,...e))},lowercase(e){return this.check(Vs(e))},uppercase(e){return this.check(Fs(e))},trim(){return this.check(Ws())},normalize(...e){return this.check(Gs(...e))},toLowerCase(){return this.check(Hs())},toUpperCase(){return this.check(Ys())},slugify(){return this.check(Xs())}})),Eg=m(\"ZodString\",(e,t)=>{Ln.init(e,t),zp.init(e,t)},{email(e){return this.check(Wl(Zg,e))},url(e){return this.check(tf(Dg,e))},jwt(e){return this.check(yf(Hg,e))},emoji(e){return this.check(rf(Ng,e))},guid(e){return this.check(Hl(Cg,e))},uuid(e){return this.check(Yl(Xn,e))},uuidv4(e){return this.check(Xl(Xn,e))},uuidv6(e){return this.check(Ql(Xn,e))},uuidv7(e){return this.check(ef(Xn,e))},nanoid(e){return this.check(nf(Ug,e))},cuid(e){return this.check(of(Rg,e))},cuid2(e){return this.check(sf(jg,e))},ulid(e){return this.check(cf(Lg,e))},base64(e){return this.check(hf(qg,e))},base64url(e){return this.check(mf(Gg,e))},xid(e){return this.check(af(Bg,e))},ksuid(e){return this.check(uf(Mg,e))},ipv4(e){return this.check(lf(Vg,e))},ipv6(e){return this.check(ff(Fg,e))},cidrv4(e){return this.check(pf(Jg,e))},cidrv6(e){return this.check(df(Kg,e))},e164(e){return this.check(gf(Wg,e))},datetime(e){return this.check(xf(Ag,e))},date(e){return this.check(_f(Og,e))},time(e){return this.check(wf(Tg,e))},duration(e){return this.check(bf(Pg,e))}});function ui(e){return Gl(Eg,e)}var E=m(\"ZodStringFormat\",(e,t)=>{I.init(e,t),zp.init(e,t)}),Ag=m(\"ZodISODateTime\",(e,t)=>{sl.init(e,t),E.init(e,t)}),Og=m(\"ZodISODate\",(e,t)=>{il.init(e,t),E.init(e,t)}),Tg=m(\"ZodISOTime\",(e,t)=>{cl.init(e,t),E.init(e,t)}),Pg=m(\"ZodISODuration\",(e,t)=>{al.init(e,t),E.init(e,t)}),Zg=m(\"ZodEmail\",(e,t)=>{Gu.init(e,t),E.init(e,t)});var Cg=m(\"ZodGUID\",(e,t)=>{Ku.init(e,t),E.init(e,t)});var Xn=m(\"ZodUUID\",(e,t)=>{qu.init(e,t),E.init(e,t)});var Dg=m(\"ZodURL\",(e,t)=>{Yu.init(e,t),E.init(e,t)});var Ng=m(\"ZodEmoji\",(e,t)=>{Xu.init(e,t),E.init(e,t)});var Ug=m(\"ZodNanoID\",(e,t)=>{Qu.init(e,t),E.init(e,t)});var Rg=m(\"ZodCUID\",(e,t)=>{el.init(e,t),E.init(e,t)});var jg=m(\"ZodCUID2\",(e,t)=>{tl.init(e,t),E.init(e,t)});var Lg=m(\"ZodULID\",(e,t)=>{rl.init(e,t),E.init(e,t)});var Bg=m(\"ZodXID\",(e,t)=>{nl.init(e,t),E.init(e,t)});var Mg=m(\"ZodKSUID\",(e,t)=>{ol.init(e,t),E.init(e,t)});var Vg=m(\"ZodIPv4\",(e,t)=>{ul.init(e,t),E.init(e,t)});var Fg=m(\"ZodIPv6\",(e,t)=>{fl.init(e,t),E.init(e,t)});var Jg=m(\"ZodCIDRv4\",(e,t)=>{pl.init(e,t),E.init(e,t)});var Kg=m(\"ZodCIDRv6\",(e,t)=>{dl.init(e,t),E.init(e,t)});var qg=m(\"ZodBase64\",(e,t)=>{ml.init(e,t),E.init(e,t)});var Gg=m(\"ZodBase64URL\",(e,t)=>{gl.init(e,t),E.init(e,t)});var Wg=m(\"ZodE164\",(e,t)=>{yl.init(e,t),E.init(e,t)});var Hg=m(\"ZodJWT\",(e,t)=>{xl.init(e,t),E.init(e,t)});var Ip=m(\"ZodNumber\",(e,t)=>{Ns.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ff(e,r,n,o),e.isFinite=!0},Ta({minValue:(e)=>{let{minimum:t,exclusiveMinimum:r}=pe(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:r}=pe(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:r}=pe(e);return!!t||!!r?.some(Number.isSafeInteger)},format:(e)=>pe(e).format??null},{gt(e,t){return this.check(qn(e,t))},gte(e,t){return this.check(br(e,t))},min(e,t){return this.check(br(e,t))},lt(e,t){return this.check(Kn(e,t))},lte(e,t){return this.check(wr(e,t))},max(e,t){return this.check(wr(e,t))},int(e){return this.check(kp(e))},safe(e){return this.check(kp(e))},positive(e){return this.check(qn(0,e))},nonnegative(e){return this.check(br(0,e))},negative(e){return this.check(Kn(0,e))},nonpositive(e){return this.check(wr(0,e))},multipleOf(e,t){return this.check(Gn(e,t))},step(e,t){return this.check(Gn(e,t))},finite(){return this}}));function Tt(e){return kf(Ip,e)}var Yg=m(\"ZodNumberFormat\",(e,t)=>{_l.init(e,t),Ip.init(e,t)});function kp(e){return vf(Yg,e)}var Xg=m(\"ZodUnknown\",(e,t)=>{wl.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Kf(e,r,n,o)});function Qn(){return Sf(Xg)}var Qg=m(\"ZodNever\",(e,t)=>{bl.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jf(e,r,n,o)});function ey(e){return $f(Qg,e)}var ty=m(\"ZodArray\",(e,t)=>{ai(),kl.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Yf(e,r,n,o),e.element=t.element},{min(e,t){return this.check(Et(e,t))},nonempty(e){return this.check(Et(1,e))},max(e,t){return this.check(Wn(e,t))},length(e,t){return this.check(Hn(e,t))},unwrap(){return this.element}});function Sr(e,t){return zf(ty,e,t)}var ry=m(\"ZodObject\",(e,t)=>{ai(),$l.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xf(e,r,n,o),Pm(e,\"shape\",(r)=>r._zod.def.shape,!1)},{keyof(){return iy(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(ne(this._zod.def,{catchall:e}))},passthrough(){return this.clone(ne(this._zod.def,{catchall:Qn()}))},loose(){return this.clone(ne(this._zod.def,{catchall:Qn()}))},strict(){return this.clone(ne(this._zod.def,{catchall:ey()}))},strip(){return this.clone(ne(this._zod.def,{catchall:void 0}))},extend(e){return Sm(this,e)},safeExtend(e){return $m(this,e)},merge(e){return zm(this,e)},pick(e){return km(this,e)},omit(e){return vm(this,e)},partial(...e){return Ia(Op,this,e[0])},exactPartial(...e){return Ia(Tp,this,e[0],\"exactPartial\")},required(...e){return Im(Pp,this,e[0])}});function Pt(e,t){let r={type:\"object\",shape:e??{},...y(t)};return new ry(r)}var Ep=m(\"ZodUnion\",(e,t)=>{Us.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qf(e,r,n,o),e.options=t.options});function li(e,t){return new Ep({type:\"union\",options:e,...y(t)})}var ny=m(\"ZodDiscriminatedUnion\",(e,t)=>{Ep.init(e,t),zl.init(e,t)});function Ap(e,t,r){return new ny({type:\"union\",options:t,discriminator:e,...y(r)})}var oy=m(\"ZodIntersection\",(e,t)=>{Il.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ep(e,r,n,o)});function sy(e,t){return new oy({type:\"intersection\",left:e,right:t})}var ci=m(\"ZodEnum\",(e,t)=>{El.init(e,t),O.init(e,t),e._zod.processJSONSchema=(n,o,s)=>qf(e,n,o,s),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let s={};for(let i of n)if(r.has(i))s[i]=t.entries[i];else throw Error(`Key ${i} not found in enum`);return new ci({...t,checks:[],...y(o),entries:s})},e.exclude=(n,o)=>{let s={...t.entries};for(let i of n)if(r.has(i))delete s[i];else throw Error(`Key ${i} not found in enum`);return new ci({...t,checks:[],...y(o),entries:s})}});function iy(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new ci({type:\"enum\",entries:r,...y(t)})}var cy=m(\"ZodLiteral\",(e,t)=>{Al.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gf(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,\"value\",{get(){if(t.values.length>1)throw Error(\"This schema contains multiple valid literal values. Use `.values` instead.\");return t.values[0]}})});function Zt(e,t){return new cy({type:\"literal\",values:Array.isArray(e)?e:[e],...y(t)})}var ay=m(\"ZodTransform\",(e,t)=>{ai(),Ol.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hf(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction===\"backward\")throw new mr(e.constructor.name);r.addIssue=(s)=>{if(typeof s===\"string\")r.issues.push(rt(s,r.value,t));else{let i=s;if(i.fatal)i.continue=!1;if(i.code??(i.code=\"custom\"),!(\"input\"in i))i.input=r.value;i.inst??(i.inst=e),r.issues.push(rt(i))}};let o=t.transform(r.value,r);if(o instanceof Promise)return o.then((s)=>(r.value=s,r));return r.value=o,r}});function uy(e){return new ay({type:\"transform\",transform:e})}var Op=m(\"ZodOptional\",(e,t)=>{Rs.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>si(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function vp(e){return new Op({type:\"optional\",innerType:e})}var Tp=m(\"ZodExactOptional\",(e,t)=>{Tl.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>si(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ly(e){return new Tp({type:\"optional\",innerType:e})}var fy=m(\"ZodNullable\",(e,t)=>{Pl.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>tp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Sp(e){return new fy({type:\"nullable\",innerType:e})}var py=m(\"ZodDefault\",(e,t)=>{Zl.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>op(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function dy(e,t){return new py({type:\"default\",innerType:e,get defaultValue(){return typeof t===\"function\"?t():ys(t)}})}var hy=m(\"ZodPrefault\",(e,t)=>{Cl.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function my(e,t){return new hy({type:\"prefault\",innerType:e,get defaultValue(){return typeof t===\"function\"?t():ys(t)}})}var Pp=m(\"ZodNonOptional\",(e,t)=>{Dl.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>rp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function gy(e,t){return new Pp({type:\"nonoptional\",innerType:e,...y(t)})}var yy=m(\"ZodCatch\",(e,t)=>{Nl.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ip(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function xy(e,t){return new yy({type:\"catch\",innerType:e,catchValue:typeof t===\"function\"?t:Pa(t)})}var _y=m(\"ZodPipe\",(e,t)=>{Ul.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>cp(e,r,n,o),e.in=t.in,e.out=t.out});function $p(e,t){return new _y({type:\"pipe\",in:e,out:t})}var wy=m(\"ZodReadonly\",(e,t)=>{Rl.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ap(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function by(e){return new wy({type:\"readonly\",innerType:e})}var ky=m(\"ZodCustom\",(e,t)=>{jl.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wf(e,r,n,o)});function vy(e,t={}){return If(ky,e,t)}function Sy(e,t){return Ef(e,t)}var zr=32,oo=new Set([\"__proto__\",\"constructor\",\"prototype\"]),$y=li([ui().min(1).max(512).refine((e)=>!oo.has(e),\"unsafe path key\"),Tt().int().nonnegative()]),$r=Sr($y).min(1).max(zr);function Ir(e,t=0){if(t>zr)return!1;if(e===null||typeof e===\"boolean\"||typeof e===\"string\")return!0;if(typeof e===\"number\")return Number.isFinite(e);if(Array.isArray(e))return e.every((n)=>Ir(n,t+1));if(typeof e!==\"object\")return!1;let r=Object.getPrototypeOf(e);if(r!==Object.prototype&&r!==null)return!1;return Object.entries(e).every(([n,o])=>!oo.has(n)&&Ir(o,t+1))}var Zp=Qn().refine(Ir,\"value must be safe JSON\"),zy=Ap(\"type\",[Pt({type:Zt(\"set\"),path:$r,value:Zp}),Pt({type:Zt(\"delete\"),path:$r}),Pt({type:Zt(\"insert\"),path:$r,index:Tt().int().nonnegative(),values:Sr(Zp).min(1)}),Pt({type:Zt(\"increment\"),path:$r,by:Tt().finite()}),Pt({type:Zt(\"text\"),path:$r,index:Tt().int().nonnegative(),deleteCount:Tt().int().nonnegative().optional(),insert:ui().optional()})]).superRefine((e,t)=>{if(e.type===\"text\"&&(e.deleteCount??0)===0&&(e.insert??\"\").length===0)t.addIssue({code:\"custom\",message:\"text operation must insert or delete content\"})});function ro(e){if(Array.isArray(e)){let t=new re;return t.insert(0,e.map(ro)),t}if(e!==null&&typeof e===\"object\"){let t=new q;for(let[r,n]of Object.entries(e))t.set(r,ro(n));return t}return e}function fi(e,t=0){if(t>zr)throw Error(\"room document exceeds the maximum nesting depth\");if(e instanceof q){let r=Object.create(null);for(let[n,o]of e.entries()){if(oo.has(n))throw Error(`room document contains unsafe key \"${n}\"`);r[n]=fi(o,t+1)}return r}if(e instanceof re)return e.toArray().map((r)=>fi(r,t+1));if(e instanceof ae)return e.toString();if(!Ir(e))throw Error(\"room document contains a non-JSON value\");return e}function so(e){return fi(e.getMap(\"root\"))}function B(e){return e.map(String).join(\".\")}function Up(e){if(e.length===0||e.length>zr)throw Error(`room path must contain 1 to ${zr} segments`);for(let t of e)if(typeof t===\"string\"){if(t.length===0||t.length>512||oo.has(t))throw Error(`invalid room path segment \"${t}\"`)}else if(!Number.isInteger(t)||t<0)throw Error(`invalid room array index ${String(t)}`)}function Rp(e,t,r){if(e instanceof q){if(typeof t!==\"string\")throw Error(`expected an object key at \"${B(r)}\"`);if(!e.has(t))throw Error(`room path does not exist: \"${B(r)}\"`);return e.get(t)}if(typeof t!==\"number\"||t>=e.length)throw Error(`invalid array index at \"${B(r)}\"`);return e.get(t)}function io(e,t){Up(t);let r=e.getMap(\"root\");for(let n=0;n<t.length-1;n+=1){if(!(r instanceof q)&&!(r instanceof re))throw Error(`room path crosses a scalar at \"${B(t.slice(0,n+1))}\"`);r=Rp(r,t[n],t.slice(0,n+1))}if(!(r instanceof q)&&!(r instanceof re))throw Error(`room path parent is not a container: \"${B(t)}\"`);return{parent:r,key:t[t.length-1]}}function eo(e,t){let{parent:r,key:n}=io(e,t);return Rp(r,n,t)}function Cp(e,t,r){let{parent:n,key:o}=io(e,t),s=ro(r);if(n instanceof q){if(typeof o!==\"string\")throw Error(`expected an object key at \"${B(t)}\"`);n.set(o,s);return}if(typeof o!==\"number\"||o>=n.length)throw Error(`invalid array index at \"${B(t)}\"`);n.delete(o,1),n.insert(o,[s])}function Iy(e,t){let{parent:r,key:n}=io(e,t);if(r instanceof q){if(typeof n!==\"string\")throw Error(`expected an object key at \"${B(t)}\"`);if(!r.has(n))throw Error(`room path does not exist: \"${B(t)}\"`);r.delete(n);return}if(typeof n!==\"number\"||n>=r.length)throw Error(`invalid array index at \"${B(t)}\"`);r.delete(n,1)}function Dp(e,t){e.transact(()=>{for(let r of t)switch(r.type){case\"set\":Cp(e,r.path,r.value);break;case\"delete\":Iy(e,r.path);break;case\"insert\":{Up(r.path);let n=eo(e,r.path);if(!(n instanceof re))throw Error(`insert target is not an array: \"${B(r.path)}\"`);if(r.index>n.length)throw Error(`insert index is outside the array: \"${B(r.path)}\"`);n.insert(r.index,r.values.map(ro));break}case\"increment\":{let n=eo(e,r.path);if(typeof n!==\"number\"||!Number.isFinite(n))throw Error(`increment target is not a finite number: \"${B(r.path)}\"`);let o=n+r.by;if(!Number.isFinite(o))throw Error(`increment result is not finite: \"${B(r.path)}\"`);Cp(e,r.path,o);break}case\"text\":{let n=eo(e,r.path),o;if(n instanceof ae)o=n;else if(typeof n===\"string\"){o=new ae(n);let{parent:i,key:c}=io(e,r.path);if(i instanceof q&&typeof c===\"string\")i.set(c,o);else if(i instanceof re&&typeof c===\"number\"&&c<i.length)i.delete(c,1),i.insert(c,[o]);else throw Error(`invalid text path: \"${B(r.path)}\"`)}else throw Error(`text target is not a string: \"${B(r.path)}\"`);let s=r.deleteCount??0;if(r.index>o.length||r.index+s>o.length)throw Error(`text range is outside the string: \"${B(r.path)}\"`);if(s>0)o.delete(r.index,s);if(r.insert)o.insert(r.index,r.insert);break}}})}function Ey(e,t){let r=Sr(zy).min(1).parse(t),n=new ke({gc:!0});try{gn(n,St(e)),Dp(n,r),so(n)}finally{n.destroy()}let o=Nc(e);return Dp(e,r),St(e,o)}function no(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)||Array.isArray(t))return Array.isArray(e)&&Array.isArray(t)&&e.length===t.length&&e.every((o,s)=>no(o,t[s]));if(e===null||t===null||typeof e!==\"object\"||typeof t!==\"object\")return!1;let r=Object.keys(e),n=Object.keys(t);return r.length===n.length&&r.every((o)=>Object.hasOwn(t,o)&&no(e[o],t[o]))}function Ay(e,t){if(no(e,t))return!0;if(e!==null&&t!==null&&!Array.isArray(e)&&!Array.isArray(t)&&typeof e===\"object\"&&typeof t===\"object\"&&Object.hasOwn(e,\"id\")&&Object.hasOwn(t,\"id\")){let r=e.id;return(typeof r===\"string\"||typeof r===\"number\")&&Object.is(r,t.id)}return!1}function pi(e){if(e!==null&&!Array.isArray(e)&&typeof e===\"object\"&&(typeof e.id===\"string\"||typeof e.id===\"number\"))return`id:${typeof e.id}:${String(e.id)}`;return`value:${JSON.stringify(e)}`}function Np(e){let t=[],r=new Set;for(let n of e){if(n===null||Array.isArray(n)||typeof n!==\"object\"||typeof n.id!==\"string\"&&typeof n.id!==\"number\")return null;let o=pi(n);if(r.has(o))return null;r.add(o),t.push(o)}return t}function Oy(e,t){let r=new Map;for(let s=0;s<t.length;s+=1){let i=pi(t[s]),c=r.get(i);if(c)c.push(s);else r.set(i,[s])}let n=[],o=-1;for(let s=0;s<e.length;s+=1){let i=r.get(pi(e[s]));while(i?.length&&i[0]<=o)i.shift();let c=i?.shift();if(c===void 0)continue;if(!Ay(e[s],t[c]))continue;n.push([s,c]),o=c}return n}function Ty(e,t){try{return eo(e,t)}catch{return}}function to(e,t,r,n,o){if(no(t,r))return;if(t!==null&&r!==null&&!Array.isArray(t)&&!Array.isArray(r)&&typeof t===\"object\"&&typeof r===\"object\"){for(let s of Object.keys(t))if(!Object.hasOwn(r,s))o.push({type:\"delete\",path:[...n,s]});for(let[s,i]of Object.entries(r))if(!Object.hasOwn(t,s))o.push({type:\"set\",path:[...n,s],value:i});else to(e,t[s],i,[...n,s],o);return}if(Array.isArray(t)&&Array.isArray(r)){let s=Np(t),i=Np(r),c=s!==null&&i!==null&&(s.length!==i.length||s.some((f,p)=>f!==i[p]));if(t.length===r.length&&!c){for(let f=0;f<r.length;f+=1)to(e,t[f],r[f],[...n,f],o);return}let a=0,l=0,u=0;for(let[f,p]of[...Oy(t,r),[t.length,r.length]]){let d=f-a;for(let g=0;g<d;g+=1)o.push({type:\"delete\",path:[...n,u]});let h=r.slice(l,p);if(h.length>0)o.push({type:\"insert\",path:n,index:u,values:h}),u+=h.length;if(f<t.length&&p<r.length)to(e,t[f],r[p],[...n,u],o),u+=1;a=f+1,l=p+1}return}if(typeof t===\"string\"&&typeof r===\"string\"&&Ty(e,n)instanceof ae){let s=0;while(s<t.length&&s<r.length&&t[s]===r[s])s+=1;let i=0;while(i<t.length-s&&i<r.length-s&&t[t.length-1-i]===r[r.length-1-i])i+=1;o.push({type:\"text\",path:n,index:s,deleteCount:t.length-s-i,insert:r.slice(s,r.length-i)});return}o.push({type:\"set\",path:n,value:r})}function jp(e,t){let r=so(e),n=structuredClone(r),o=t(n);if(o!==null&&(typeof o===\"object\"||typeof o===\"function\")&&typeof o.then===\"function\")throw Error(\"room change callback must be synchronous\");if(!Ir(n)||Array.isArray(n))throw Error(\"room state must be a safe JSON object\");let s=[];if(to(e,r,n,[],s),s.length>0)Ey(e,s);return s}function Lp(e){let t=\"\";for(let r=0;r<e.length;r+=8192)t+=String.fromCharCode(...e.subarray(r,r+8192));return btoa(t)}function Py(e){return Uint8Array.from(atob(e),(t)=>t.charCodeAt(0))}class co{handlers=new Map;on(e,t){let r=this.handlers.get(e)??new Set;return r.add(t),this.handlers.set(e,r),()=>r.delete(t)}emit(e,t){for(let r of this.handlers.get(e)??[])r(t)}}class Bp extends co{socket;rooms=new Map;channels=new Map;pending=new Map;nextId=0;opening;retry;stopped=!1;me;async open(){if(this.socket?.readyState===WebSocket.OPEN)return;if(this.opening)return this.opening;let e=location.pathname.match(/^\\/p\\/([^/.]+)/);if(!e)throw Error(\"Realtime rooms require a Swarm page\");let t=new URL(\"/@swarm/realtime\",location.href);return t.protocol=location.protocol===\"https:\"?\"wss:\":\"ws:\",t.searchParams.set(\"pageId\",decodeURIComponent(e[1])),this.opening=new Promise((r,n)=>{let o=new WebSocket(t);this.socket=o,o.onopen=()=>{this.opening=void 0,r()},o.onerror=()=>n(Error(\"Realtime connection failed\")),o.onmessage=(s)=>{let i=JSON.parse(s.data),c=i;if(c.seq)o.send(JSON.stringify({ack:c.seq}));if(c.type===\"hello\")this.me=c.me;if(c.type===\"room\")this.rooms.get(c.name??\"\")?.receive(i);if(c.type===\"presence\")this.rooms.get(c.name??\"\")?.receivePresence(c.peers);if(c.type===\"channel\")this.channels.get(c.name??\"\")?.emit(\"message\",c.data);if(c.type===\"deleted\")this.rooms.get(c.name??\"\")?.deleted();if(c.id!==void 0){let a=this.pending.get(c.id);if(a)if(clearTimeout(a.timer),this.pending.delete(c.id),c.type===\"error\")a.reject(Error(c.error));else a.resolve(c)}},o.onclose=()=>{this.opening=void 0,n(Error(\"Realtime connection closed\"));for(let s of this.pending.values())clearTimeout(s.timer),s.reject(Error(\"Realtime connection closed\"));if(this.pending.clear(),!this.stopped)this.retry=setTimeout(()=>{this.reconnect()},1000)}}),this.opening}async reconnect(){try{await this.open();for(let e of this.rooms.values())await e.join(!0);for(let e of this.channels.keys())await this.request({op:\"subscribe\",name:e})}catch(e){for(let t of this.rooms.values())t.emit(\"error\",e)}}async request(e){await this.open();let t=++this.nextId;return new Promise((r,n)=>{let o=setTimeout(()=>{this.pending.delete(t),n(Error(\"Realtime request timed out\"))},15000);this.pending.set(t,{resolve:r,reject:n,timer:o}),this.socket.send(JSON.stringify({...e,id:t}))})}close(){this.stopped=!0,clearTimeout(this.retry),this.socket?.close()}}class Mp extends co{connection;name;ydoc=new ke({gc:!0});generation=\"\";stale=!1;bytes=0;me;ready;writes=Promise.resolve();lastWrite=Promise.resolve();peers=[];presenceData={};presenceTimer;closed=!1;schemaVersion;presence;constructor(e,t,r){super();this.connection=e;this.name=t;this.schemaVersion=r.schemaVersion??1;let n=this;this.presence={set(o){if(n.presenceData=structuredClone(o),!n.presenceTimer)n.presenceTimer=setTimeout(()=>{n.presenceTimer=void 0,e.request({op:\"presence\",name:t,data:n.presenceData}).catch((s)=>n.emit(\"error\",s))},50)},get peers(){return n.peers}},this.observe()}get state(){return so(this.ydoc)}observe(){this.ydoc.on(\"update\",(e,t)=>{if(this.emit(\"change\",this.state),t===\"remote\"||!this.generation||this.closed)return;if(this.connection.socket?.readyState!==WebSocket.OPEN)return;let r=Lp(St(this.ydoc)),n=this.generation,o=this.writes.then(async()=>{try{let s=await this.connection.request({op:\"update\",name:this.name,generation:n,schemaVersion:this.schemaVersion,snapshot:r});if(s.room)this.receive(s.room)}catch(s){if(this.connection.socket?.readyState===WebSocket.OPEN){let i=await this.connection.request({op:\"join\",name:this.name,schemaVersion:this.schemaVersion});this.receive(i.room,!0)}throw this.emit(\"error\",s),s}});this.lastWrite=o,this.writes=o.catch(()=>{})})}async join(e=!1){if(this.ready&&!e)return this.ready;return this.ready=(async()=>{let t=this.generation,r=await this.connection.request({op:\"join\",name:this.name,schemaVersion:this.schemaVersion});if(this.me=r.me,this.receive(r.room),this.receivePresence(r.peers),e&&t===this.generation&&!this.stale){let n=await this.connection.request({op:\"update\",name:this.name,schemaVersion:this.schemaVersion,generation:t,snapshot:Lp(St(this.ydoc))});this.receive(n.room)}if(e)this.presence.set(this.presenceData)})(),this.ready}receive(e,t=!1){if(this.closed||!e)return;let r=t||this.generation!==\"\"&&e.generation!==this.generation;if(this.generation=e.generation,this.stale=e.schemaVersion!==this.schemaVersion,this.bytes=e.bytes,r)this.ydoc.destroy(),this.ydoc=new ke({gc:!0}),this.observe();if(gn(this.ydoc,Py(e.snapshot),\"remote\"),r)this.emit(\"reset\",this.state)}receivePresence(e=[]){this.peers=e,this.emit(\"presence\",e)}deleted(){this.closed=!0,this.emit(\"error\",Error(\"Room owner was deleted\")),this.ydoc.destroy()}async change(e){if(this.closed)throw Error(\"Room is closed\");if(this.stale)throw Error(\"Room schema is stale. Read the state and reset explicitly.\");if(jp(this.ydoc,e).length>0)await this.lastWrite}async apply(e){if(this.closed||this.stale)throw Error(\"Room is closed or stale\");await this.writes;let t=await this.connection.request({op:\"change\",name:this.name,generation:this.generation,schemaVersion:this.schemaVersion,operations:e});this.receive(t.room)}async reset(e={}){if(this.closed)throw Error(\"Room is closed\");await this.writes;let t=await this.connection.request({op:\"reset\",name:this.name,schemaVersion:this.schemaVersion,state:e});this.receive(t.room)}async close(){this.closed=!0,clearTimeout(this.presenceTimer),this.connection.rooms.delete(this.name);try{await this.connection.request({op:\"leave\",name:this.name})}finally{this.ydoc.destroy()}}}class Vp extends co{connection;name;constructor(e,t){super();this.connection=e;this.name=t}async publish(e){await this.connection.request({op:\"publish\",name:this.name,data:e})}async close(){this.connection.channels.delete(this.name),await this.connection.request({op:\"unsubscribe\",name:this.name})}}var ze=new Bp;window.addEventListener(\"pagehide\",()=>ze.close());async function rb(e=\"default\",t={}){if(!/^[a-zA-Z0-9_-]{1,64}$/.test(e))throw Error(\"Invalid room name\");let r=ze.rooms.get(e);if(r&&r.schemaVersion!==(t.schemaVersion??1))throw Error(\"Room already opened with a different schema version\");if(!r)r=new Mp(ze,e,t),ze.rooms.set(e,r);try{await r.join()}catch(n){throw ze.rooms.delete(e),n}return r}async function nb(e){if(!/^[a-zA-Z0-9_-]{1,64}$/.test(e))throw Error(\"Invalid channel name\");let t=ze.channels.get(e);if(t)return t;let r=new Vp(ze,e);ze.channels.set(e,r);try{await ze.request({op:\"subscribe\",name:e})}catch(n){throw ze.channels.delete(e),n}return r}export{nb as channel,rb as room};\n\n";
|
|
35929
|
+
var browser_generated_default = "var J=()=>new Map,Er=(e)=>{let t=J();return e.forEach((r,n)=>{t.set(n,r)}),t},me=(e,t,r)=>{let n=e.get(t);if(n===void 0)e.set(t,n=r());return n},mi=(e,t)=>{let r=[];for(let[n,o]of e)r.push(t(o,n));return r},gi=(e,t)=>{for(let[r,n]of e)if(t(n,r))return!0;return!1};var Ie=()=>new Set;var Ar=(e)=>e[e.length-1];var yi=(e,t)=>{for(let r=0;r<t.length;r++)e.push(t[r])},ge=Array.from,Or=(e,t)=>{for(let r=0;r<e.length;r++)if(!t(e[r],r,e))return!1;return!0},Tr=(e,t)=>{for(let r=0;r<e.length;r++)if(t(e[r],r,e))return!0;return!1};var xi=(e,t)=>{let r=Array(e);for(let n=0;n<e;n++)r[n]=t(n,r);return r};var Me=Array.isArray;class fo{constructor(){this._observers=J()}on(e,t){return me(this._observers,e,Ie).add(t),t}once(e,t){let r=(...n)=>{this.off(e,r),t(...n)};this.on(e,r)}off(e,t){let r=this._observers.get(e);if(r!==void 0){if(r.delete(t),r.size===0)this._observers.delete(e)}}emit(e,t){return ge((this._observers.get(e)||J()).values()).forEach((r)=>r(...t))}destroy(){this._observers=J()}}var K=Math.floor;var Ve=Math.abs;var Pr=(e,t)=>e<t?e:t,Ee=(e,t)=>e>t?e:t;var Zr=(e)=>e!==0?e<0:1/e<0;var po=1,ho=2,Cr=4,Dr=8;var ot=32,ie=64,M=128;var jt=31,Lt=63,Ae=127;var _i=2147483647;var{MAX_SAFE_INTEGER:st,MIN_SAFE_INTEGER:go}=Number;var wi=Number.isInteger||((e)=>typeof e===\"number\"&&isFinite(e)&&K(e)===e);var{fromCharCode:xo,fromCodePoint:Kp}=String,Cy=xo(65535),qp=(e)=>e.toLowerCase(),Gp=/^\\s*/g,Wp=(e)=>e.replace(Gp,\"\"),Hp=/([A-Z])/g,_o=(e,t)=>Wp(e.replace(Hp,(r)=>`${t}${qp(r)}`));var Yp=(e)=>{let t=unescape(encodeURIComponent(e)),r=t.length,n=new Uint8Array(r);for(let o=0;o<r;o++)n[o]=t.codePointAt(o);return n},ct=typeof TextEncoder<\"u\"?new TextEncoder:null,Xp=(e)=>ct.encode(e),bi=ct?Xp:Yp;var it=typeof TextDecoder>\"u\"?null:new TextDecoder(\"utf-8\",{fatal:!0,ignoreBOM:!0});if(it&&it.decode(new Uint8Array).length===1)it=null;var ki=(e,t)=>xi(t,()=>e).join(\"\");class ut{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}var Bt=()=>new ut;var Qp=(e)=>{let t=e.cpos;for(let r=0;r<e.bufs.length;r++)t+=e.bufs[r].length;return t};var ce=(e)=>{let t=new Uint8Array(Qp(e)),r=0;for(let n=0;n<e.bufs.length;n++){let o=e.bufs[n];t.set(o,r),r+=o.length}return t.set(new Uint8Array(e.cbuf.buffer,0,e.cpos),r),t},ed=(e,t)=>{let r=e.cbuf.length;if(r-e.cpos<t)e.bufs.push(new Uint8Array(e.cbuf.buffer,0,e.cpos)),e.cbuf=new Uint8Array(Ee(r,t)*2),e.cpos=0},N=(e,t)=>{let r=e.cbuf.length;if(e.cpos===r)e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(r*2),e.cpos=0;e.cbuf[e.cpos++]=t};var Ur=N;var w=(e,t)=>{while(t>Ae)N(e,M|Ae&t),t=K(t/128);N(e,Ae&t)},Rr=(e,t)=>{let r=Zr(t);if(r)t=-t;N(e,(t>Lt?M:0)|(r?ie:0)|Lt&t),t=K(t/64);while(t>0)N(e,(t>Ae?M:0)|Ae&t),t=K(t/128)},wo=new Uint8Array(30000),td=wo.length/3,rd=(e,t)=>{if(t.length<td){let r=ct.encodeInto(t,wo).written||0;w(e,r);for(let n=0;n<r;n++)N(e,wo[n])}else W(e,bi(t))},nd=(e,t)=>{let r=unescape(encodeURIComponent(t)),n=r.length;w(e,n);for(let o=0;o<n;o++)N(e,r.codePointAt(o))},Fe=ct&&ct.encodeInto?rd:nd;var Mt=(e,t)=>{let r=e.cbuf.length,n=e.cpos,o=Pr(r-n,t.length),s=t.length-o;if(e.cbuf.set(t.subarray(0,o),n),e.cpos+=o,s>0)e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(Ee(r*2,s)),e.cbuf.set(t.subarray(o)),e.cpos=s},W=(e,t)=>{w(e,t.byteLength),Mt(e,t)},bo=(e,t)=>{ed(e,t);let r=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,r},od=(e,t)=>bo(e,4).setFloat32(0,t,!1),sd=(e,t)=>bo(e,8).setFloat64(0,t,!1),id=(e,t)=>bo(e,8).setBigInt64(0,t,!1);var vi=new DataView(new ArrayBuffer(4)),cd=(e)=>(vi.setFloat32(0,e),vi.getFloat32(0)===e),at=(e,t)=>{switch(typeof t){case\"string\":N(e,119),Fe(e,t);break;case\"number\":if(wi(t)&&Ve(t)<=_i)N(e,125),Rr(e,t);else if(cd(t))N(e,124),od(e,t);else N(e,123),sd(e,t);break;case\"bigint\":N(e,122),id(e,t);break;case\"object\":if(t===null)N(e,126);else if(Me(t)){N(e,117),w(e,t.length);for(let r=0;r<t.length;r++)at(e,t[r])}else if(t instanceof Uint8Array)N(e,116),W(e,t);else{N(e,118);let r=Object.keys(t);w(e,r.length);for(let n=0;n<r.length;n++){let o=r[n];Fe(e,o),at(e,t[o])}}break;case\"boolean\":N(e,t?120:121);break;default:N(e,127)}};class jr extends ut{constructor(e){super();this.w=e,this.s=null,this.count=0}write(e){if(this.s===e)this.count++;else{if(this.count>0)w(this,this.count-1);this.count=1,this.w(this,e),this.s=e}}}var Si=(e)=>{if(e.count>0){if(Rr(e.encoder,e.count===1?e.s:-e.s),e.count>1)w(e.encoder,e.count-2)}};class lt{constructor(){this.encoder=new ut,this.s=0,this.count=0}write(e){if(this.s===e)this.count++;else Si(this),this.count=1,this.s=e}toUint8Array(){return Si(this),ce(this.encoder)}}var $i=(e)=>{if(e.count>0){let t=e.diff*2+(e.count===1?0:1);if(Rr(e.encoder,t),e.count>1)w(e.encoder,e.count-2)}};class Vt{constructor(){this.encoder=new ut,this.s=0,this.count=0,this.diff=0}write(e){if(this.diff===e-this.s)this.s=e,this.count++;else $i(this),this.count=1,this.diff=e-this.s,this.s=e}toUint8Array(){return $i(this),ce(this.encoder)}}class ko{constructor(){this.sarr=[],this.s=\"\",this.lensE=new lt}write(e){if(this.s+=e,this.s.length>19)this.sarr.push(this.s),this.s=\"\";this.lensE.write(e.length)}toUint8Array(){let e=new ut;return this.sarr.push(this.s),this.s=\"\",Fe(e,this.sarr.join(\"\")),Mt(e,this.lensE.toUint8Array()),ce(e)}}var X=(e)=>Error(e),Q=()=>{throw X(\"Method unimplemented\")},H=()=>{throw X(\"Unexpected case\")};var zi=X(\"Unexpected end of array\"),Ii=X(\"Integer out of Range\");class Ft{constructor(e){this.arr=e,this.pos=0}}var qe=(e)=>new Ft(e),Ei=(e)=>e.pos!==e.arr.length;var ud=(e,t)=>{let r=new Uint8Array(e.arr.buffer,e.pos+e.arr.byteOffset,t);return e.pos+=t,r},Y=(e)=>ud(e,_(e));var Je=(e)=>e.arr[e.pos++];var _=(e)=>{let t=0,r=1,n=e.arr.length;while(e.pos<n){let o=e.arr[e.pos++];if(t=t+(o&Ae)*r,r*=128,o<M)return t;if(t>st)throw Ii}throw zi},Lr=(e)=>{let t=e.arr[e.pos++],r=t&Lt,n=64,o=(t&ie)>0?-1:1;if((t&M)===0)return o*r;let s=e.arr.length;while(e.pos<s){if(t=e.arr[e.pos++],r=r+(t&Ae)*n,n*=128,t<M)return o*r;if(r>st)throw Ii}throw zi};var ld=(e)=>{let t=_(e);if(t===0)return\"\";else{let r=String.fromCodePoint(Je(e));if(--t<100)while(t--)r+=String.fromCodePoint(Je(e));else while(t>0){let n=t<1e4?t:1e4,o=e.arr.subarray(e.pos,e.pos+n);e.pos+=n,r+=String.fromCodePoint.apply(null,o),t-=n}return decodeURIComponent(escape(r))}},fd=(e)=>it.decode(Y(e)),Ke=it?fd:ld;var So=(e,t)=>{let r=new DataView(e.arr.buffer,e.arr.byteOffset+e.pos,t);return e.pos+=t,r},pd=(e)=>So(e,4).getFloat32(0,!1),dd=(e)=>So(e,8).getFloat64(0,!1),hd=(e)=>So(e,8).getBigInt64(0,!1);var md=[(e)=>{return},(e)=>null,Lr,pd,dd,hd,(e)=>!1,(e)=>!0,Ke,(e)=>{let t=_(e),r={};for(let n=0;n<t;n++){let o=Ke(e);r[o]=ft(e)}return r},(e)=>{let t=_(e),r=[];for(let n=0;n<t;n++)r.push(ft(e));return r},Y],ft=(e)=>md[127-Je(e)](e);class Br extends Ft{constructor(e,t){super(e);this.reader=t,this.s=null,this.count=0}read(){if(this.count===0)if(this.s=this.reader(this),Ei(this))this.count=_(this)+1;else this.count=-1;return this.count--,this.s}}class pt extends Ft{constructor(e){super(e);this.s=0,this.count=0}read(){if(this.count===0){this.s=Lr(this);let e=Zr(this.s);if(this.count=1,e)this.s=-this.s,this.count=_(this)+2}return this.count--,this.s}}class Jt extends Ft{constructor(e){super(e);this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){let e=Lr(this),t=e&1;if(this.diff=K(e/2),this.count=1,t)this.count=_(this)+2}return this.s+=this.diff,this.count--,this.s}}class $o{constructor(e){this.decoder=new pt(e),this.str=Ke(this.decoder),this.spos=0}read(){let e=this.spos+this.decoder.read(),t=this.str.slice(this.spos,e);return this.spos=e,t}}var Uy=crypto.subtle,Ai=crypto.getRandomValues.bind(crypto);var zo=()=>Ai(new Uint32Array(1))[0];var yd=[1e7]+-1000+-4000+-8000+-100000000000,Oi=()=>yd.replace(/[018]/g,(e)=>(e^zo()&15>>e/4).toString(16));var Ti=Date.now;var Io=(e)=>new Promise(e);var Ly=Promise.all.bind(Promise);var Eo=(e)=>e===void 0?null:e;class Pi{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}}var Zi=new Pi,kd=!0;try{if(typeof localStorage<\"u\"&&localStorage)Zi=localStorage,kd=!1}catch(e){}var Ci=Zi;var Ge=Symbol(\"Equality\"),Mr=(e,t)=>e===t||!!e?.[Ge]?.(t)||!1;var Di=(e)=>typeof e===\"object\",{assign:Ni,keys:Sd}=Object;var Ui=(e,t)=>{for(let r in e)t(e[r],r)};var Kt=(e)=>Sd(e).length;var Ri=(e)=>{for(let t in e)return!1;return!0},dt=(e,t)=>{for(let r in e)if(!t(e[r],r))return!1;return!0},qt=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Oo=(e,t)=>e===t||Kt(e)===Kt(t)&&dt(e,(r,n)=>(r!==void 0||qt(t,n))&&Mr(t[n],r)),$d=Object.freeze,To=(e)=>{for(let t in e){let r=e[t];if(typeof r===\"object\"||typeof r===\"function\")To(e[t])}return $d(e)};var Wt=(e,t,r=0)=>{try{for(;r<e.length;r++)e[r](...t)}finally{if(r<e.length)Wt(e,t,r+1)}};var ji=(e)=>e;var Gt=(e,t)=>{if(e===t)return!0;if(e==null||t==null||e.constructor!==t.constructor&&(e.constructor||Object)!==(t.constructor||Object))return!1;if(e[Ge]!=null)return e[Ge](t);switch(e.constructor){case ArrayBuffer:e=new Uint8Array(e),t=new Uint8Array(t);case Uint8Array:{if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;break}case Set:{if(e.size!==t.size)return!1;for(let r of e)if(!t.has(r))return!1;break}case Map:{if(e.size!==t.size)return!1;for(let r of e.keys())if(!t.has(r)||!Gt(e.get(r),t.get(r)))return!1;break}case void 0:case Object:if(Kt(e)!==Kt(t))return!1;for(let r in e)if(!qt(e,r)||!Gt(e[r],t[r]))return!1;break;case Array:if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!Gt(e[r],t[r]))return!1;break;default:return!1}return!0},Li=(e,t)=>t.includes(e);var Ht=typeof process<\"u\"&&process.release&&/node|io\\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<\"u\"?process:0)===\"[object process]\";var By=typeof navigator<\"u\"?/Mac/.test(navigator.platform):!1,ye,zd=[],Id=()=>{if(ye===void 0)if(Ht){ye=J();let e=process.argv,t=null;for(let r=0;r<e.length;r++){let n=e[r];if(n[0]===\"-\"){if(t!==null)ye.set(t,\"\");t=n}else if(t!==null)ye.set(t,n),t=null;else zd.push(n)}if(t!==null)ye.set(t,\"\")}else if(typeof location===\"object\")ye=J(),(location.search||\"?\").slice(1).split(\"&\").forEach((e)=>{if(e.length!==0){let[t,r]=e.split(\"=\");ye.set(`--${_o(t,\"-\")}`,r),ye.set(`-${_o(t,\"-\")}`,r)}});else ye=J();return ye},Co=(e)=>Id().has(e);var Yt=(e)=>Ht?Eo(process.env[e.toUpperCase().replaceAll(\"-\",\"_\")]):Eo(Ci.getItem(e));var Bi=(e)=>Co(\"--\"+e)||Yt(e)!==null,Mi=Bi(\"production\"),Ed=Ht&&Li(process.env.FORCE_COLOR,[\"true\",\"1\",\"2\"]),Vi=Ed||!Co(\"--no-colors\")&&!Bi(\"no-color\")&&(!Ht||process.stdout.isTTY)&&(!Ht||Co(\"--color\")||Yt(\"COLORTERM\")!==null||(Yt(\"TERM\")||\"\").includes(\"color\"));var Ad=(e)=>new Uint8Array(e);var Fi=(e)=>{let t=Ad(e.byteLength);return t.set(e),t};class Ji{constructor(e,t){this.left=e,this.right=t}}var xe=(e,t)=>new Ji(e,t);var No=(e)=>e.next()>=0.5,Vr=(e,t,r)=>K(e.next()*(r+1-t)+t);var Uo=(e,t,r)=>K(e.next()*(r+1-t)+t);var Ro=(e,t,r)=>Uo(e,t,r);var Pd=(e)=>xo(Ro(e,97,122)),Ki=(e,t=0,r=20)=>{let n=Ro(e,t,r),o=\"\";for(let s=0;s<n;s++)o+=Pd(e);return o};var Fr=(e,t)=>t[Ro(e,0,t.length-1)];var Cd=Symbol(\"0schema\");class Gi{constructor(){this._rerrs=[]}extend(e,t,r,n=null){this._rerrs.push({path:e,expected:t,has:r,message:n})}toString(){let e=[];for(let t=this._rerrs.length-1;t>0;t--){let r=this._rerrs[t];e.push(ki(\" \",(this._rerrs.length-t)*2)+`${r.path!=null?`[${r.path}] `:\"\"}${r.has} doesn't match ${r.expected}. ${r.message}`)}return e.join(`\n`)}}var jo=(e,t)=>{if(e===t)return!0;if(e==null||t==null||e.constructor!==t.constructor)return!1;if(e[Ge])return Mr(e,t);if(Me(e))return Or(e,(r)=>Tr(t,(n)=>jo(r,n)));else if(Di(e))return dt(e,(r,n)=>jo(r,t[n]));return!1};class V{static _dilutes=!1;extends(e){let[t,r]=[this.shape,e.shape];if(this.constructor._dilutes)[r,t]=[t,r];return jo(t,r)}equals(e){return this.constructor===e.constructor&&Gt(this.shape,e.shape)}[Cd](){return!0}[Ge](e){return this.equals(e)}validate(e){return this.check(e)}check(e,t){Q()}get nullable(){return yt(this,Qr)}get optional(){return new Lo(this)}cast(e){return qi(e,this),e}expect(e){return qi(e,this),e}}class qr extends V{constructor(e,t){super();this.shape=e,this._c=t}check(e,t=void 0){let r=e?.constructor===this.shape&&(this._c==null||this._c(e));return!r&&t?.extend(null,this.shape.name,e?.constructor.name,e?.constructor!==this.shape?\"Constructor match failed\":\"Check failed\"),r}}var T=(e,t=null)=>new qr(e,t),Vy=T(qr);class Gr extends V{constructor(e){super();this.shape=e}check(e,t){let r=this.shape(e);return!r&&t?.extend(null,\"custom prop\",e?.constructor.name,\"failed to check custom prop\"),r}}var Z=(e)=>new Gr(e),Fy=T(Gr);class Qt extends V{constructor(e){super();this.shape=e}check(e,t){let r=this.shape.some((n)=>n===e);return!r&&t?.extend(null,this.shape.join(\" | \"),e.toString()),r}}var Wr=(...e)=>new Qt(e),Wi=T(Qt),Dd=RegExp.escape||((e)=>e.replace(/[().|&,$^[\\]]/g,(t)=>\"\\\\\"+t)),Hi=(e)=>{if(gt.check(e))return[Dd(e)];if(Wi.check(e))return e.shape.map((t)=>t+\"\");if(oc.check(e))return[\"[+-]?\\\\d+.?\\\\d*\"];if(sc.check(e))return[\".*\"];if(Jr.check(e))return e.shape.map(Hi).flat(1);H()};class Yi extends V{constructor(e){super();this.shape=e,this._r=new RegExp(\"^\"+e.map(Hi).map((t)=>`(${t.join(\"|\")})`).join(\"\")+\"$\")}check(e,t){let r=this._r.exec(e)!=null;return!r&&t?.extend(null,this._r.toString(),e.toString(),\"String doesn't match string template.\"),r}}var Jy=T(Yi),Nd=Symbol(\"optional\");class Lo extends V{constructor(e){super();this.shape=e}check(e,t){let r=e===void 0||this.shape.check(e);return!r&&t?.extend(null,\"undefined (optional)\",\"()\"),r}get[Nd](){return!0}}var Ud=T(Lo);class Bo extends V{check(e,t){return t?.extend(null,\"never\",typeof e),!1}}var Ky=new Bo,qy=T(Bo);class Hr extends V{constructor(e,t=!1){super();this.shape=e,this._isPartial=t}static _dilutes=!0;get partial(){return new Hr(this.shape,!0)}check(e,t){if(e==null)return t?.extend(null,\"object\",\"null\"),!1;return dt(this.shape,(r,n)=>{let o=this._isPartial&&!qt(e,n)||r.check(e[n],t);return!o&&t?.extend(n.toString(),r.toString(),typeof e[n],\"Object property does not match\"),o})}}var Rd=(e)=>new Hr(e),jd=T(Hr),Ld=Z((e)=>e!=null&&(e.constructor===Object||e.constructor==null));class Mo extends V{constructor(e,t){super();this.shape={keys:e,values:t}}check(e,t){return e!=null&&dt(e,(r,n)=>{let o=this.shape.keys.check(n,t);return!o&&t?.extend(n+\"\",\"Record\",typeof e,o?\"Key doesn't match schema\":\"Value doesn't match value\"),o&&this.shape.values.check(r,t)})}}var Xi=(e,t)=>new Mo(e,t),Bd=T(Mo);class Vo extends V{constructor(e){super();this.shape=e}check(e,t){return e!=null&&dt(this.shape,(r,n)=>{let o=r.check(e[n],t);return!o&&t?.extend(n.toString(),\"Tuple\",typeof r),o})}}var Md=(...e)=>new Vo(e),Gy=T(Vo);class Fo extends V{constructor(e){super();this.shape=e.length===1?e[0]:new Yr(e)}check(e,t){let r=Me(e)&&Or(e,(n)=>this.shape.check(n));return!r&&t?.extend(null,\"Array\",\"\"),r}}var Qi=(...e)=>new Fo(e),Vd=T(Fo),Fd=Z((e)=>Me(e));class Jo extends V{constructor(e,t){super();this.shape=e,this._c=t}check(e,t){let r=e instanceof this.shape&&(this._c==null||this._c(e));return!r&&t?.extend(null,this.shape.name,e?.constructor.name),r}}var Jd=(e,t=null)=>new Jo(e,t),Wy=T(Jo),Kd=Jd(V);class ec extends V{constructor(e){super();this.len=e.length-1,this.args=Md(...e.slice(-1)),this.res=e[this.len]}check(e,t){let r=e.constructor===Function&&e.length<=this.len;return!r&&t?.extend(null,\"function\",typeof e),r}}var qd=T(ec),Gd=Z((e)=>typeof e===\"function\");class tc extends V{constructor(e){super();this.shape=e}check(e,t){let r=Or(this.shape,(n)=>n.check(e,t));return!r&&t?.extend(null,\"Intersectinon\",typeof e),r}}var Hy=T(tc,(e)=>e.shape.length>0);class Yr extends V{static _dilutes=!0;constructor(e){super();this.shape=e}check(e,t){let r=Tr(this.shape,(n)=>n.check(e,t));return t?.extend(null,\"Union\",typeof e),r}}var yt=(...e)=>e.findIndex((t)=>Jr.check(t))>=0?yt(...e.map((t)=>Xt(t)).map((t)=>Jr.check(t)?t.shape:[t]).flat(1)):e.length===1?e[0]:new Yr(e),Jr=T(Yr),rc=()=>!0,Kr=Z(rc),Wd=T(Gr,(e)=>e.shape===rc),Ko=Z((e)=>typeof e===\"bigint\"),Hd=Z((e)=>e===Ko),nc=Z((e)=>typeof e===\"symbol\"),Yy=Z((e)=>e===nc),mt=Z((e)=>typeof e===\"number\"),oc=Z((e)=>e===mt),gt=Z((e)=>typeof e===\"string\"),sc=Z((e)=>e===gt),Xr=Z((e)=>typeof e===\"boolean\"),Yd=Z((e)=>e===Xr),ic=Wr(void 0),Xy=T(Qt,(e)=>e.shape.length===1&&e.shape[0]===void 0),Qy=Wr(void 0);var Qr=Wr(null),Xd=T(Qt,(e)=>e.shape.length===1&&e.shape[0]===null),ex=T(Uint8Array),tx=T(qr,(e)=>e.shape===Uint8Array),Qd=yt(mt,gt,Qr,ic,Ko,Xr,nc),rx=(()=>{let e=Qi(Kr),t=Xi(gt,Kr),r=yt(mt,gt,Qr,Xr,e,t);return e.shape=r,t.shape.values=r,r})(),Xt=(e)=>{if(Kd.check(e))return e;else if(Ld.check(e)){let t={};for(let r in e)t[r]=Xt(e[r]);return Rd(t)}else if(Fd.check(e))return yt(...e.map(Xt));else if(Qd.check(e))return Wr(e);else if(Gd.check(e))return T(e);H()},qi=Mi?()=>{}:(e,t)=>{let r=new Gi;if(!t.check(e,r))throw X(`Expected value to be of type ${t.constructor.name}.\n${r.toString()}`)};class cc{constructor(e){this.patterns=[],this.$state=e}if(e,t){return this.patterns.push({if:Xt(e),h:t}),this}else(e){return this.if(Kr,e)}done(){return(e,t)=>{for(let r=0;r<this.patterns.length;r++){let n=this.patterns[r];if(n.if.check(e))return n.h(e,t)}throw X(\"Unhandled pattern\")}}}var eh=(e)=>new cc(e),ac=eh(Kr).if(oc,(e,t)=>Vr(t,go,st)).if(sc,(e,t)=>Ki(t)).if(Yd,(e,t)=>No(t)).if(Hd,(e,t)=>BigInt(Vr(t,go,st))).if(Jr,(e,t)=>ht(t,Fr(t,e.shape))).if(jd,(e,t)=>{let r={};for(let n in e.shape){let o=e.shape[n];if(Ud.check(o)){if(No(t))continue;o=o.shape}r[n]=ac(o,t)}return r}).if(Vd,(e,t)=>{let r=[],n=Uo(t,0,42);for(let o=0;o<n;o++)r.push(ht(t,e.shape));return r}).if(Wi,(e,t)=>Fr(t,e.shape)).if(Xd,(e,t)=>null).if(qd,(e,t)=>{let r=ht(t,e.res);return()=>r}).if(Wd,(e,t)=>ht(t,Fr(t,[mt,gt,Qr,ic,Ko,Xr,Qi(mt),Xi(yt(\"a\",\"b\",\"c\"),mt)]))).if(Bd,(e,t)=>{let r={},n=Vr(t,0,3);for(let o=0;o<n;o++){let s=ht(t,e.shape.keys),i=ht(t,e.shape.values);r[s]=i}return r}).done(),ht=(e,t)=>ac(Xt(t),e);var We=typeof document<\"u\"?document:{};var nx=Z((e)=>e.nodeType===sh);var ox=typeof DOMParser<\"u\"?new DOMParser:null;var sx=Z((e)=>e.nodeType===rh);var ix=Z((e)=>e.nodeType===nh);var uc=(e)=>mi(e,(t,r)=>`${r}:${t};`).join(\"\");var{ELEMENT_NODE:rh,TEXT_NODE:nh,CDATA_SECTION_NODE:cx,COMMENT_NODE:ax,DOCUMENT_NODE:oh,DOCUMENT_TYPE_NODE:ux,DOCUMENT_FRAGMENT_NODE:sh}=We,lx=Z((e)=>e.nodeType===oh);var _e=Symbol;var er=_e(),tr=_e(),qo=_e(),Go=_e(),Wo=_e(),rr=_e(),Ho=_e(),xt=_e(),Yo=_e(),lc=(e)=>{if(e.length===1&&e[0]?.constructor===Function)e=e[0]();let t=[],r=[],n=0;for(;n<e.length;n++){let o=e[n];if(o===void 0)break;else if(o.constructor===String||o.constructor===Number)t.push(o);else if(o.constructor===Object)break}if(n>0)r.push(t.join(\"\"));for(;n<e.length;n++){let o=e[n];if(!(o instanceof Symbol))r.push(o)}return r};var fx=Ti();var uh={[er]:xe(\"font-weight\",\"bold\"),[tr]:xe(\"font-weight\",\"normal\"),[qo]:xe(\"color\",\"blue\"),[Wo]:xe(\"color\",\"green\"),[Go]:xe(\"color\",\"grey\"),[rr]:xe(\"color\",\"red\"),[Ho]:xe(\"color\",\"purple\"),[xt]:xe(\"color\",\"orange\"),[Yo]:xe(\"color\",\"black\")},lh=(e)=>{if(e.length===1&&e[0]?.constructor===Function)e=e[0]();let t=[],r=[],n=J(),o=[],s=0;for(;s<e.length;s++){let i=e[s],c=uh[i];if(c!==void 0)n.set(c.left,c.right);else{if(i===void 0)break;if(i.constructor===String||i.constructor===Number){let a=uc(n);if(s>0||a.length>0)t.push(\"%c\"+i),r.push(a);else t.push(i)}else break}}if(s>0)o=r,o.unshift(t.join(\"\"));for(;s<e.length;s++){let i=e[s];if(!(i instanceof Symbol))o.push(i)}return o},fc=Vi?lh:lc,pc=(...e)=>{console.log(...fc(e)),hc.forEach((t)=>t.print(e))},dc=(...e)=>{console.warn(...fc(e)),e.unshift(xt),hc.forEach((t)=>t.print(e))};var hc=Ie();var mc=(e)=>({[Symbol.iterator](){return this},next:e}),gc=(e,t)=>mc(()=>{let r;do r=e.next();while(!r.done&&!t(r.value));return r}),en=(e,t)=>mc(()=>{let{done:r,value:n}=e.next();return{done:r,value:r?void 0:t(n)}});class ir{constructor(e,t){this.clock=e,this.len=t}}class bt{constructor(){this.clients=new Map}}var Ec=(e,t,r)=>t.clients.forEach((n,o)=>{let s=e.doc.store.clients.get(o);if(s!=null){let i=s[s.length-1],c=i.id.clock+i.length;for(let a=0,l=n[a];a<n.length&&l.clock<c;l=n[++a])Bc(e,s,l.clock,l.len,r)}}),dh=(e,t)=>{let r=0,n=e.length-1;while(r<=n){let o=K((r+n)/2),s=e[o],i=s.clock;if(i<=t){if(t<i+s.len)return o;r=o+1}else n=o-1}return null},Ac=(e,t)=>{let r=e.clients.get(t.client);return r!==void 0&&dh(r,t.clock)!==null},rs=(e)=>{e.clients.forEach((t)=>{t.sort((o,s)=>o.clock-s.clock);let r,n;for(r=1,n=1;r<t.length;r++){let o=t[n-1],s=t[r];if(o.clock+o.len>=s.clock)t[n-1]=new ir(o.clock,Ee(o.len,s.clock+s.len-o.clock));else{if(n<r)t[n]=s;n++}}t.length=n})},hh=(e)=>{let t=new bt;for(let r=0;r<e.length;r++)e[r].clients.forEach((n,o)=>{if(!t.clients.has(o)){let s=n.slice();for(let i=r+1;i<e.length;i++)yi(s,e[i].clients.get(o)||[]);t.clients.set(o,s)}});return rs(t),t},cn=(e,t,r,n)=>{me(e.clients,t,()=>[]).push(new ir(r,n))},Oc=()=>new bt,mh=(e)=>{let t=Oc();return e.clients.forEach((r,n)=>{let o=[];for(let s=0;s<r.length;s++){let i=r[s];if(i.deleted){let c=i.id.clock,a=i.length;if(s+1<r.length)for(let l=r[s+1];s+1<r.length&&l.deleted;l=r[++s+1])a+=l.length;o.push(new ir(c,a))}}if(o.length>0)t.clients.set(n,o)}),t},kt=(e,t)=>{w(e.restEncoder,t.clients.size),ge(t.clients.entries()).sort((r,n)=>n[0]-r[0]).forEach(([r,n])=>{e.resetDsCurVal(),w(e.restEncoder,r);let o=n.length;w(e.restEncoder,o);for(let s=0;s<o;s++){let i=n[s];e.writeDsClock(i.clock),e.writeDsLen(i.len)}})},ns=(e)=>{let t=new bt,r=_(e.restDecoder);for(let n=0;n<r;n++){e.resetDsCurVal();let o=_(e.restDecoder),s=_(e.restDecoder);if(s>0){let i=me(t.clients,o,()=>[]);for(let c=0;c<s;c++)i.push(new ir(e.readDsClock(),e.readDsLen()))}}return t},yc=(e,t,r)=>{let n=new bt,o=_(e.restDecoder);for(let s=0;s<o;s++){e.resetDsCurVal();let i=_(e.restDecoder),c=_(e.restDecoder),a=r.clients.get(i)||[],l=U(r,i);for(let u=0;u<c;u++){let f=e.readDsClock(),p=f+e.readDsLen();if(f<l){if(l<p)cn(n,i,l,p-l);let d=we(a,f),h=a[d];if(!h.deleted&&h.id.clock<f)a.splice(d+1,0,mn(t,h,f-h.id.clock)),d++;while(d<a.length)if(h=a[d++],h.id.clock<p){if(!h.deleted){if(p<h.id.clock+h.length)a.splice(d,0,mn(t,h,p-h.id.clock));h.delete(t)}}else break}else cn(n,i,f,p-f)}}if(n.clients.size>0){let s=new Ne;return w(s.restEncoder,0),kt(s,n),s.toUint8Array()}return null};var Tc=zo;class ke extends fo{constructor({guid:e=Oi(),collectionid:t=null,gc:r=!0,gcFilter:n=()=>!0,meta:o=null,autoLoad:s=!1,shouldLoad:i=!0}={}){super();this.gc=r,this.gcFilter=n,this.clientID=Tc(),this.guid=e,this.collectionid=t,this.share=new Map,this.store=new us,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=i,this.autoLoad=s,this.meta=o,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=Io((a)=>{this.on(\"load\",()=>{this.isLoaded=!0,a(this)})});let c=()=>Io((a)=>{let l=(u)=>{if(u===void 0||u===!0)this.off(\"sync\",l),a()};this.on(\"sync\",l)});this.on(\"sync\",(a)=>{if(a===!1&&this.isSynced)this.whenSynced=c();if(this.isSynced=a===void 0||a===!0,this.isSynced&&!this.isLoaded)this.emit(\"load\",[this])}),this.whenSynced=c()}load(){let e=this._item;if(e!==null&&!this.shouldLoad)v(e.parent.doc,(t)=>{t.subdocsLoaded.add(this)},null,!0);this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(ge(this.subdocs).map((e)=>e.guid))}transact(e,t=null){return v(this,e,t)}get(e,t=R){let r=me(this.share,e,()=>{let o=new t;return o._integrate(this,null),o}),n=r.constructor;if(t!==R&&n!==t)if(n===R){let o=new t;o._map=r._map,r._map.forEach((s)=>{for(;s!==null;s=s.left)s.parent=o}),o._start=r._start;for(let s=o._start;s!==null;s=s.right)s.parent=o;return o._length=r._length,this.share.set(e,o),o._integrate(this,null),o}else throw Error(`Type with the name ${e} has already been defined with a different constructor`);return r}getArray(e=\"\"){return this.get(e,re)}getText(e=\"\"){return this.get(e,ae)}getMap(e=\"\"){return this.get(e,q)}getXmlElement(e=\"\"){return this.get(e,wt)}getXmlFragment(e=\"\"){return this.get(e,Xe)}toJSON(){let e={};return this.share.forEach((t,r)=>{e[r]=t.toJSON()}),e}destroy(){this.isDestroyed=!0,ge(this.subdocs).forEach((t)=>t.destroy());let e=this._item;if(e!==null){this._item=null;let t=e.content;t.doc=new ke({guid:this.guid,...t.opts,shouldLoad:!1}),t.doc._item=e,v(e.parent.doc,(r)=>{let n=t.doc;if(!e.deleted)r.subdocsAdded.add(n);r.subdocsRemoved.add(this)},null,!0)}this.emit(\"destroyed\",[!0]),this.emit(\"destroy\",[this]),super.destroy()}}class os{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return _(this.restDecoder)}readDsLen(){return _(this.restDecoder)}}class ss extends os{readLeftID(){return b(_(this.restDecoder),_(this.restDecoder))}readRightID(){return b(_(this.restDecoder),_(this.restDecoder))}readClient(){return _(this.restDecoder)}readInfo(){return Je(this.restDecoder)}readString(){return Ke(this.restDecoder)}readParentInfo(){return _(this.restDecoder)===1}readTypeRef(){return _(this.restDecoder)}readLen(){return _(this.restDecoder)}readAny(){return ft(this.restDecoder)}readBuf(){return Fi(Y(this.restDecoder))}readJSON(){return JSON.parse(Ke(this.restDecoder))}readKey(){return Ke(this.restDecoder)}}class Pc{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=_(this.restDecoder),this.dsCurrVal}readDsLen(){let e=_(this.restDecoder)+1;return this.dsCurrVal+=e,e}}class Ye extends Pc{constructor(e){super(e);this.keys=[],_(e),this.keyClockDecoder=new Jt(Y(e)),this.clientDecoder=new pt(Y(e)),this.leftClockDecoder=new Jt(Y(e)),this.rightClockDecoder=new Jt(Y(e)),this.infoDecoder=new Br(Y(e),Je),this.stringDecoder=new $o(Y(e)),this.parentInfoDecoder=new Br(Y(e),Je),this.typeRefDecoder=new pt(Y(e)),this.lenDecoder=new pt(Y(e))}readLeftID(){return new He(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new He(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return ft(this.restDecoder)}readBuf(){return Y(this.restDecoder)}readJSON(){return ft(this.restDecoder)}readKey(){let e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];else{let t=this.stringDecoder.read();return this.keys.push(t),t}}}class is{constructor(){this.restEncoder=Bt()}toUint8Array(){return ce(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){w(this.restEncoder,e)}writeDsLen(e){w(this.restEncoder,e)}}class vt extends is{writeLeftID(e){w(this.restEncoder,e.client),w(this.restEncoder,e.clock)}writeRightID(e){w(this.restEncoder,e.client),w(this.restEncoder,e.clock)}writeClient(e){w(this.restEncoder,e)}writeInfo(e){Ur(this.restEncoder,e)}writeString(e){Fe(this.restEncoder,e)}writeParentInfo(e){w(this.restEncoder,e?1:0)}writeTypeRef(e){w(this.restEncoder,e)}writeLen(e){w(this.restEncoder,e)}writeAny(e){at(this.restEncoder,e)}writeBuf(e){W(this.restEncoder,e)}writeJSON(e){Fe(this.restEncoder,JSON.stringify(e))}writeKey(e){Fe(this.restEncoder,e)}}class cs{constructor(){this.restEncoder=Bt(),this.dsCurrVal=0}toUint8Array(){return ce(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){let t=e-this.dsCurrVal;this.dsCurrVal=e,w(this.restEncoder,t)}writeDsLen(e){if(e===0)H();w(this.restEncoder,e-1),this.dsCurrVal+=e}}class Ne extends cs{constructor(){super();this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new Vt,this.clientEncoder=new lt,this.leftClockEncoder=new Vt,this.rightClockEncoder=new Vt,this.infoEncoder=new jr(Ur),this.stringEncoder=new ko,this.parentInfoEncoder=new jr(Ur),this.typeRefEncoder=new lt,this.lenEncoder=new lt}toUint8Array(){let e=Bt();return w(e,0),W(e,this.keyClockEncoder.toUint8Array()),W(e,this.clientEncoder.toUint8Array()),W(e,this.leftClockEncoder.toUint8Array()),W(e,this.rightClockEncoder.toUint8Array()),W(e,ce(this.infoEncoder)),W(e,this.stringEncoder.toUint8Array()),W(e,ce(this.parentInfoEncoder)),W(e,this.typeRefEncoder.toUint8Array()),W(e,this.lenEncoder.toUint8Array()),Mt(e,ce(this.restEncoder)),ce(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(e?1:0)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){at(this.restEncoder,e)}writeBuf(e){W(this.restEncoder,e)}writeJSON(e){at(this.restEncoder,e)}writeKey(e){let t=this.keyMap.get(e);if(t===void 0)this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e);else this.keyClockEncoder.write(t)}}var gh=(e,t,r,n)=>{n=Ee(n,t[0].id.clock);let o=we(t,n);w(e.restEncoder,t.length-o),e.writeClient(r),w(e.restEncoder,n);let s=t[o];s.write(e,n-s.id.clock);for(let i=o+1;i<t.length;i++)t[i].write(e,0)},as=(e,t,r)=>{let n=new Map;r.forEach((o,s)=>{if(U(t,s)>o)n.set(s,o)}),yn(t).forEach((o,s)=>{if(!r.has(s))n.set(s,0)}),w(e.restEncoder,n.size),ge(n.entries()).sort((o,s)=>s[0]-o[0]).forEach(([o,s])=>{gh(e,t.clients.get(o),o,s)})},yh=(e,t)=>{let r=J(),n=_(e.restDecoder);for(let o=0;o<n;o++){let s=_(e.restDecoder),i=Array(s),c=e.readClient(),a=_(e.restDecoder);r.set(c,{i:0,refs:i});for(let l=0;l<s;l++){let u=e.readInfo();switch(jt&u){case 0:{let f=e.readLen();i[l]=new ee(b(c,a),f),a+=f;break}case 10:{let f=_(e.restDecoder);i[l]=new te(b(c,a),f),a+=f;break}default:{let f=(u&(ie|M))===0,p=new C(b(c,a),null,(u&M)===M?e.readLeftID():null,null,(u&ie)===ie?e.readRightID():null,f?e.readParentInfo()?t.get(e.readString()):e.readLeftID():null,f&&(u&ot)===ot?e.readString():null,pa(e,u));i[l]=p,a+=p.length}}}}return r},xh=(e,t,r)=>{let n=[],o=ge(r.keys()).sort((d,h)=>d-h);if(o.length===0)return null;let s=()=>{if(o.length===0)return null;let d=r.get(o[o.length-1]);while(d.refs.length===d.i)if(o.pop(),o.length>0)d=r.get(o[o.length-1]);else return null;return d},i=s();if(i===null)return null;let c=new us,a=new Map,l=(d,h)=>{let g=a.get(d);if(g==null||g>h)a.set(d,h)},u=i.refs[i.i++],f=new Map,p=()=>{for(let d of n){let h=d.id.client,g=r.get(h);if(g)g.i--,c.clients.set(h,g.refs.slice(g.i)),r.delete(h),g.i=0,g.refs=[];else c.clients.set(h,[d]);o=o.filter((x)=>x!==h)}n.length=0};while(!0){if(u.constructor!==te){let h=me(f,u.id.client,()=>U(t,u.id.client))-u.id.clock;if(h<0)n.push(u),l(u.id.client,u.id.clock-1),p();else{let g=u.getMissing(e,t);if(g!==null){n.push(u);let x=r.get(g)||{refs:[],i:0};if(x.refs.length===x.i)l(g,U(t,g)),p();else{u=x.refs[x.i++];continue}}else if(h===0||h<u.length)u.integrate(e,h),f.set(u.id.client,u.id.clock+u.length)}}if(n.length>0)u=n.pop();else if(i!==null&&i.i<i.refs.length)u=i.refs[i.i++];else if(i=s(),i===null)break;else u=i.refs[i.i++]}if(c.clients.size>0){let d=new Ne;return as(d,c,new Map),w(d.restEncoder,0),{missing:a,update:d.toUint8Array()}}return null},_h=(e,t)=>as(e,t.doc.store,t.beforeState),wh=(e,t,r,n=new Ye(e))=>v(t,(o)=>{o.local=!1;let s=!1,i=o.doc,c=i.store,a=yh(n,i),l=xh(o,c,a),u=c.pendingStructs;if(u){for(let[p,d]of u.missing)if(d<U(c,p)){s=!0;break}if(l){for(let[p,d]of l.missing){let h=u.missing.get(p);if(h==null||h>d)u.missing.set(p,d)}u.update=an([u.update,l.update])}}else c.pendingStructs=l;let f=yc(n,o,c);if(c.pendingDs){let p=new Ye(qe(c.pendingDs));_(p.restDecoder);let d=yc(p,o,c);if(f&&d)c.pendingDs=an([f,d]);else c.pendingDs=f||d}else c.pendingDs=f;if(s){let p=c.pendingStructs.update;c.pendingStructs=null,Zc(o.doc,p)}},r,!1);var Zc=(e,t,r,n=Ye)=>{let o=qe(t);wh(o,e,r,new n(o))},gn=(e,t,r)=>Zc(e,t,r,ss),bh=(e,t,r=new Map)=>{as(e,t.store,r),kt(e,mh(t.store))},kh=(e,t=new Uint8Array([0]),r=new Ne)=>{let n=Cc(t);bh(r,e,n);let o=[r.toUint8Array()];if(e.store.pendingDs)o.push(e.store.pendingDs);if(e.store.pendingStructs)o.push(Dh(e.store.pendingStructs.update,t));if(o.length>1){if(r.constructor===vt)return Zh(o.map((s,i)=>i===0?s:Uh(s)));else if(r.constructor===Ne)return an(o)}return o[0]},St=(e,t)=>kh(e,t,new vt),vh=(e)=>{let t=new Map,r=_(e.restDecoder);for(let n=0;n<r;n++){let o=_(e.restDecoder),s=_(e.restDecoder);t.set(o,s)}return t},Cc=(e)=>vh(new os(qe(e))),Dc=(e,t)=>(w(e.restEncoder,t.size),ge(t.entries()).sort((r,n)=>n[0]-r[0]).forEach(([r,n])=>{w(e.restEncoder,r),w(e.restEncoder,n)}),e),Sh=(e,t)=>Dc(e,yn(t.store)),$h=(e,t=new cs)=>{if(e instanceof Map)Dc(t,e);else Sh(t,e);return t.toUint8Array()},Nc=(e)=>$h(e,new is);class Uc{constructor(){this.l=[]}}var xc=()=>new Uc,_c=(e,t)=>e.l.push(t),wc=(e,t)=>{let r=e.l,n=r.length;if(e.l=r.filter((o)=>t!==o),n===e.l.length)console.error(\"[yjs] Tried to remove event handler that doesn't exist.\")},Rc=(e,t,r)=>Wt(e.l,[t,r]);class He{constructor(e,t){this.client=e,this.clock=t}}var tn=(e,t)=>e===t||e!==null&&t!==null&&e.client===t.client&&e.clock===t.clock,b=(e,t)=>new He(e,t);var zh=(e)=>{for(let[t,r]of e.doc.share.entries())if(r===e)return t;throw H()};class jc{constructor(e,t){this.ds=e,this.sv=t}}var Ih=(e,t)=>new jc(e,t),kx=Ih(Oc(),new Map);var _t=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||0)>e.id.clock&&!Ac(t.ds,e.id),es=(e,t)=>{let r=me(e.meta,es,Ie),n=e.doc.store;if(!r.has(t))t.sv.forEach((o,s)=>{if(o<U(n,s))Ue(e,b(s,o))}),Ec(e,t.ds,(o)=>{}),r.add(t)};class us{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}var yn=(e)=>{let t=new Map;return e.clients.forEach((r,n)=>{let o=r[r.length-1];t.set(n,o.id.clock+o.length)}),t},U=(e,t)=>{let r=e.clients.get(t);if(r===void 0)return 0;let n=r[r.length-1];return n.id.clock+n.length},Lc=(e,t)=>{let r=e.clients.get(t.id.client);if(r===void 0)r=[],e.clients.set(t.id.client,r);else{let n=r[r.length-1];if(n.id.clock+n.length!==t.id.clock)throw H()}r.push(t)},we=(e,t)=>{let r=0,n=e.length-1,o=e[n],s=o.id.clock;if(s===t)return n;let i=K(t/(s+o.length-1)*n);while(r<=n){if(o=e[i],s=o.id.clock,s<=t){if(t<s+o.length)return i;r=i+1}else n=i-1;i=K((r+n)/2)}throw H()},Eh=(e,t)=>{let r=e.clients.get(t.client);return r[we(r,t.clock)]},Xo=Eh,ts=(e,t,r)=>{let n=we(t,r),o=t[n];if(o.id.clock<r&&o instanceof C)return t.splice(n+1,0,mn(e,o,r-o.id.clock)),n+1;return n},Ue=(e,t)=>{let r=e.doc.store.clients.get(t.client);return r[ts(e,r,t.clock)]},bc=(e,t,r)=>{let n=t.clients.get(r.client),o=we(n,r.clock),s=n[o];if(r.clock!==s.id.clock+s.length-1&&s.constructor!==ee)n.splice(o+1,0,mn(e,s,r.clock-s.id.clock+1));return s},Ah=(e,t,r)=>{let n=e.clients.get(t.id.client);n[we(n,t.id.clock)]=r},Bc=(e,t,r,n,o)=>{if(n===0)return;let s=r+n,i=ts(e,t,r),c;do{if(c=t[i++],s<c.id.clock+c.length)ts(e,t,s);o(c)}while(i<t.length&&t[i].id.clock<s)};class Mc{constructor(e,t,r){this.doc=e,this.deleteSet=new bt,this.beforeState=yn(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=t,this.meta=new Map,this.local=r,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}var kc=(e,t)=>{if(t.deleteSet.clients.size===0&&!gi(t.afterState,(r,n)=>t.beforeState.get(n)!==r))return!1;return rs(t.deleteSet),_h(e,t),kt(e,t.deleteSet),!0},vc=(e,t,r)=>{let n=t._item;if(n===null||n.id.clock<(e.beforeState.get(n.id.client)||0)&&!n.deleted)me(e.changed,t,Ie).add(r)},on=(e,t)=>{let r=e[t],n=e[t-1],o=t;for(;o>0;r=n,n=e[--o-1]){if(n.deleted===r.deleted&&n.constructor===r.constructor){if(n.mergeWith(r)){if(r instanceof C&&r.parentSub!==null&&r.parent._map.get(r.parentSub)===r)r.parent._map.set(r.parentSub,n);continue}}break}let s=t-o;if(s)e.splice(t+1-s,s);return s},Oh=(e,t,r)=>{for(let[n,o]of e.clients.entries()){let s=t.clients.get(n);for(let i=o.length-1;i>=0;i--){let c=o[i],a=c.clock+c.len;for(let l=we(s,c.clock),u=s[l];l<s.length&&u.id.clock<a;u=s[++l]){let f=s[l];if(c.clock+c.len<=f.id.clock)break;if(f instanceof C&&f.deleted&&!f.keep&&r(f))f.gc(t,!1)}}}},Th=(e,t)=>{e.clients.forEach((r,n)=>{let o=t.clients.get(n);for(let s=r.length-1;s>=0;s--){let i=r[s],c=Pr(o.length-1,1+we(o,i.clock+i.len-1));for(let a=c,l=o[a];a>0&&l.id.clock>=i.clock;l=o[a])a-=1+on(o,a)}})};var Vc=(e,t)=>{if(t<e.length){let r=e[t],n=r.doc,o=n.store,{deleteSet:s,_mergeStructs:i}=r;try{rs(s),r.afterState=yn(r.doc.store),n.emit(\"beforeObserverCalls\",[r,n]);let c=[];r.changed.forEach((a,l)=>c.push(()=>{if(l._item===null||!l._item.deleted)l._callObserver(r,a)})),c.push(()=>{r.changedParentTypes.forEach((a,l)=>{if(l._dEH.l.length>0&&(l._item===null||!l._item.deleted))c.push(()=>{a=a.filter((u)=>u.target._item===null||!u.target._item.deleted),a.forEach((u)=>{u.currentTarget=l,u._path=null}),a.sort((u,f)=>u.path.length-f.path.length),Rc(l._dEH,a,r)})}),c.push(()=>n.emit(\"afterTransaction\",[r,n])),c.push(()=>{if(r._needFormattingCleanup)Gh(r)})}),Wt(c,[])}finally{if(n.gc)Oh(s,o,n.gcFilter);Th(s,o),r.afterState.forEach((u,f)=>{let p=r.beforeState.get(f)||0;if(p!==u){let d=o.clients.get(f),h=Ee(we(d,p),1);for(let g=d.length-1;g>=h;)g-=1+on(d,g)}});for(let u=i.length-1;u>=0;u--){let{client:f,clock:p}=i[u].id,d=o.clients.get(f),h=we(d,p);if(h+1<d.length){if(on(d,h+1)>1)continue}if(h>0)on(d,h)}if(!r.local&&r.afterState.get(n.clientID)!==r.beforeState.get(n.clientID))pc(xt,er,\"[yjs] \",tr,rr,\"Changed the client-id because another client seems to be using it.\"),n.clientID=Tc();if(n.emit(\"afterTransactionCleanup\",[r,n]),n._observers.has(\"update\")){let u=new vt;if(kc(u,r))n.emit(\"update\",[u.toUint8Array(),r.origin,n,r])}if(n._observers.has(\"updateV2\")){let u=new Ne;if(kc(u,r))n.emit(\"updateV2\",[u.toUint8Array(),r.origin,n,r])}let{subdocsAdded:c,subdocsLoaded:a,subdocsRemoved:l}=r;if(c.size>0||l.size>0||a.size>0)c.forEach((u)=>{if(u.clientID=n.clientID,u.collectionid==null)u.collectionid=n.collectionid;n.subdocs.add(u)}),l.forEach((u)=>n.subdocs.delete(u)),n.emit(\"subdocs\",[{loaded:a,added:c,removed:l},n,r]),l.forEach((u)=>u.destroy());if(e.length<=t+1)n._transactionCleanups=[],n.emit(\"afterAllTransactions\",[n,e]);else Vc(e,t+1)}}},v=(e,t,r=null,n=!0)=>{let o=e._transactionCleanups,s=!1,i=null;if(e._transaction===null){if(s=!0,e._transaction=new Mc(e,r,n),o.push(e._transaction),o.length===1)e.emit(\"beforeAllTransactions\",[e]);e.emit(\"beforeTransaction\",[e._transaction,e])}try{i=t(e._transaction)}finally{if(s){let c=e._transaction===o[0];if(e._transaction=null,c)Vc(o,0)}}return i};function*Ph(e){let t=_(e.restDecoder);for(let r=0;r<t;r++){let n=_(e.restDecoder),o=e.readClient(),s=_(e.restDecoder);for(let i=0;i<n;i++){let c=e.readInfo();if(c===10){let a=_(e.restDecoder);yield new te(b(o,s),a),s+=a}else if((jt&c)!==0){let a=(c&(ie|M))===0,l=new C(b(o,s),null,(c&M)===M?e.readLeftID():null,null,(c&ie)===ie?e.readRightID():null,a?e.readParentInfo()?e.readString():e.readLeftID():null,a&&(c&ot)===ot?e.readString():null,pa(e,c));yield l,s+=l.length}else{let a=e.readLen();yield new ee(b(o,s),a),s+=a}}}}class xn{constructor(e,t){this.gen=Ph(e),this.curr=null,this.done=!1,this.filterSkips=t,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===te);return this.curr}}class _n{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}}var Zh=(e)=>an(e,ss,vt);var Ch=(e,t)=>{if(e.constructor===ee){let{client:r,clock:n}=e.id;return new ee(b(r,n+t),e.length-t)}else if(e.constructor===te){let{client:r,clock:n}=e.id;return new te(b(r,n+t),e.length-t)}else{let r=e,{client:n,clock:o}=r.id;return new C(b(n,o+t),null,b(n,o+t-1),null,r.rightOrigin,r.parent,r.parentSub,r.content.splice(t))}},an=(e,t=Ye,r=Ne)=>{if(e.length===1)return e[0];let n=e.map((u)=>new t(qe(u))),o=n.map((u)=>new xn(u,!0)),s=null,i=new r,c=new _n(i);while(!0){if(o=o.filter((p)=>p.curr!==null),o.sort((p,d)=>{if(p.curr.id.client===d.curr.id.client){let h=p.curr.id.clock-d.curr.id.clock;if(h===0)return p.curr.constructor===d.curr.constructor?0:p.curr.constructor===te?1:-1;else return h}else return d.curr.id.client-p.curr.id.client}),o.length===0)break;let u=o[0],f=u.curr.id.client;if(s!==null){let p=u.curr,d=!1;while(p!==null&&p.id.clock+p.length<=s.struct.id.clock+s.struct.length&&p.id.client>=s.struct.id.client)p=u.next(),d=!0;if(p===null||p.id.client!==f||d&&p.id.clock>s.struct.id.clock+s.struct.length)continue;if(f!==s.struct.id.client)Ce(c,s.struct,s.offset),s={struct:p,offset:0},u.next();else if(s.struct.id.clock+s.struct.length<p.id.clock)if(s.struct.constructor===te)s.struct.length=p.id.clock+p.length-s.struct.id.clock;else{Ce(c,s.struct,s.offset);let h=p.id.clock-s.struct.id.clock-s.struct.length;s={struct:new te(b(f,s.struct.id.clock+s.struct.length),h),offset:0}}else{let h=s.struct.id.clock+s.struct.length-p.id.clock;if(h>0)if(s.struct.constructor===te)s.struct.length-=h;else p=Ch(p,h);if(!s.struct.mergeWith(p))Ce(c,s.struct,s.offset),s={struct:p,offset:0},u.next()}}else s={struct:u.curr,offset:0},u.next();for(let p=u.curr;p!==null&&p.id.client===f&&p.id.clock===s.struct.id.clock+s.struct.length&&p.constructor!==te;p=u.next())Ce(c,s.struct,s.offset),s={struct:p,offset:0}}if(s!==null)Ce(c,s.struct,s.offset),s=null;ls(c);let a=n.map((u)=>ns(u)),l=hh(a);return kt(i,l),i.toUint8Array()},Dh=(e,t,r=Ye,n=Ne)=>{let o=Cc(t),s=new n,i=new _n(s),c=new r(qe(e)),a=new xn(c,!1);while(a.curr){let u=a.curr,f=u.id.client,p=o.get(f)||0;if(a.curr.constructor===te){a.next();continue}if(u.id.clock+u.length>p){Ce(i,u,Ee(p-u.id.clock,0)),a.next();while(a.curr&&a.curr.id.client===f)Ce(i,a.curr,0),a.next()}else while(a.curr&&a.curr.id.client===f&&a.curr.id.clock+a.curr.length<=p)a.next()}ls(i);let l=ns(c);return kt(s,l),s.toUint8Array()};var Fc=(e)=>{if(e.written>0)e.clientStructs.push({written:e.written,restEncoder:ce(e.encoder.restEncoder)}),e.encoder.restEncoder=Bt(),e.written=0},Ce=(e,t,r)=>{if(e.written>0&&e.currClient!==t.id.client)Fc(e);if(e.written===0)e.currClient=t.id.client,e.encoder.writeClient(t.id.client),w(e.encoder.restEncoder,t.id.clock+r);t.write(e.encoder,r),e.written++},ls=(e)=>{Fc(e);let t=e.encoder.restEncoder;w(t,e.clientStructs.length);for(let r=0;r<e.clientStructs.length;r++){let n=e.clientStructs[r];w(t,n.written),Mt(t,n.restEncoder)}},Nh=(e,t,r,n)=>{let o=new r(qe(e)),s=new xn(o,!1),i=new n,c=new _n(i);for(let l=s.curr;l!==null;l=s.next())Ce(c,t(l),0);ls(c);let a=ns(o);return kt(i,a),i.toUint8Array()};var Uh=(e)=>Nh(e,ji,Ye,vt),Sc=\"You must not compute changes after the event-handler fired.\";class cr{constructor(e,t){this.target=e,this.currentTarget=e,this.transaction=t,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=Rh(this.currentTarget,this.target))}deletes(e){return Ac(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw X(Sc);let e=new Map,t=this.target;this.transaction.changed.get(t).forEach((n)=>{if(n!==null){let o=t._map.get(n),s,i;if(this.adds(o)){let c=o.left;while(c!==null&&this.adds(c))c=c.left;if(this.deletes(o))if(c!==null&&this.deletes(c))s=\"delete\",i=Ar(c.content.getContent());else return;else if(c!==null&&this.deletes(c))s=\"update\",i=Ar(c.content.getContent());else s=\"add\",i=void 0}else if(this.deletes(o))s=\"delete\",i=Ar(o.content.getContent());else return;e.set(n,{action:s,oldValue:i})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw X(Sc);let t=this.target,r=Ie(),n=Ie(),o=[];if(e={added:r,deleted:n,delta:o,keys:this.keys},this.transaction.changed.get(t).has(null)){let i=null,c=()=>{if(i)o.push(i)};for(let a=t._start;a!==null;a=a.right)if(a.deleted){if(this.deletes(a)&&!this.adds(a)){if(i===null||i.delete===void 0)c(),i={delete:0};i.delete+=a.length,n.add(a)}}else if(this.adds(a)){if(i===null||i.insert===void 0)c(),i={insert:[]};i.insert=i.insert.concat(a.content.getContent()),r.add(a)}else{if(i===null||i.retain===void 0)c(),i={retain:0};i.retain+=a.length}if(i!==null&&i.retain===void 0)c()}this._changes=e}return e}}var Rh=(e,t)=>{let r=[];while(t._item!==null&&t!==e){if(t._item.parentSub!==null)r.unshift(t._item.parentSub);else{let n=0,o=t._item.parent._start;while(o!==t._item&&o!==null){if(!o.deleted&&o.countable)n+=o.length;o=o.right}r.unshift(n)}t=t._item.parent}return r},F=()=>{dc(\"Invalid access: Add Yjs type to a document before reading data.\")},Jc=80,fs=0;class Kc{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=fs++}}var jh=(e)=>{e.timestamp=fs++},qc=(e,t,r)=>{e.p.marker=!1,e.p=t,t.marker=!0,e.index=r,e.timestamp=fs++},Lh=(e,t,r)=>{if(e.length>=Jc){let n=e.reduce((o,s)=>o.timestamp<s.timestamp?o:s);return qc(n,t,r),n}else{let n=new Kc(t,r);return e.push(n),n}},wn=(e,t)=>{if(e._start===null||t===0||e._searchMarker===null)return null;let r=e._searchMarker.length===0?null:e._searchMarker.reduce((s,i)=>Ve(t-s.index)<Ve(t-i.index)?s:i),n=e._start,o=0;if(r!==null)n=r.p,o=r.index,jh(r);while(n.right!==null&&o<t){if(!n.deleted&&n.countable){if(t<o+n.length)break;o+=n.length}n=n.right}while(n.left!==null&&o>t)if(n=n.left,!n.deleted&&n.countable)o-=n.length;while(n.left!==null&&n.left.id.client===n.id.client&&n.left.id.clock+n.left.length===n.id.clock)if(n=n.left,!n.deleted&&n.countable)o-=n.length;if(r!==null&&Ve(r.index-o)<n.parent.length/Jc)return qc(r,n,o),r;else return Lh(e._searchMarker,n,o)},nr=(e,t,r)=>{for(let n=e.length-1;n>=0;n--){let o=e[n];if(r>0){let s=o.p;s.marker=!1;while(s&&(s.deleted||!s.countable))if(s=s.left,s&&!s.deleted&&s.countable)o.index-=s.length;if(s===null||s.marker===!0){e.splice(n,1);continue}o.p=s,s.marker=!0}if(t<o.index||r>0&&t===o.index)o.index=Ee(t,o.index+r)}};var bn=(e,t,r)=>{let n=e,o=t.changedParentTypes;while(!0){if(me(o,e,()=>[]).push(r),e._item===null)break;e=e._item.parent}Rc(n._eH,r,t)};class R{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=xc(),this._dEH=xc(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw Q()}clone(){throw Q()}_write(e){}get _first(){let e=this._start;while(e!==null&&e.deleted)e=e.right;return e}_callObserver(e,t){if(!e.local&&this._searchMarker)this._searchMarker.length=0}observe(e){_c(this._eH,e)}observeDeep(e){_c(this._dEH,e)}unobserve(e){wc(this._eH,e)}unobserveDeep(e){wc(this._dEH,e)}toJSON(){}}var Gc=(e,t,r)=>{if(e.doc??F(),t<0)t=e._length+t;if(r<0)r=e._length+r;let n=r-t,o=[],s=e._start;while(s!==null&&n>0){if(s.countable&&!s.deleted){let i=s.content.getContent();if(i.length<=t)t-=i.length;else{for(let c=t;c<i.length&&n>0;c++)o.push(i[c]),n--;t=0}}s=s.right}return o},Wc=(e)=>{e.doc??F();let t=[],r=e._start;while(r!==null){if(r.countable&&!r.deleted){let n=r.content.getContent();for(let o=0;o<n.length;o++)t.push(n[o])}r=r.right}return t};var or=(e,t)=>{let r=0,n=e._start;e.doc??F();while(n!==null){if(n.countable&&!n.deleted){let o=n.content.getContent();for(let s=0;s<o.length;s++)t(o[s],r++,e)}n=n.right}},Hc=(e,t)=>{let r=[];return or(e,(n,o)=>{r.push(t(n,o,e))}),r},Bh=(e)=>{let t=e._start,r=null,n=0;return{[Symbol.iterator](){return this},next:()=>{if(r===null){while(t!==null&&t.deleted)t=t.right;if(t===null)return{done:!0,value:void 0};r=t.content.getContent(),n=0,t=t.right}let o=r[n++];if(r.length<=n)r=null;return{done:!1,value:o}}}},Yc=(e,t)=>{e.doc??F();let r=wn(e,t),n=e._start;if(r!==null)n=r.p,t-=r.index;for(;n!==null;n=n.right)if(!n.deleted&&n.countable){if(t<n.length)return n.content.getContent()[t];t-=n.length}},un=(e,t,r,n)=>{let o=r,s=e.doc,{clientID:i,store:c}=s,a=r===null?t._start:r.right,l=[],u=()=>{if(l.length>0)o=new C(b(i,U(c,i)),o,o&&o.lastId,a,a&&a.id,t,null,new Qe(l)),o.integrate(e,0),l=[]};n.forEach((f)=>{if(f===null)l.push(f);else switch(f.constructor){case Number:case Object:case Boolean:case Array:case String:l.push(f);break;default:switch(u(),f.constructor){case Uint8Array:case ArrayBuffer:o=new C(b(i,U(c,i)),o,o&&o.lastId,a,a&&a.id,t,null,new ar(new Uint8Array(f))),o.integrate(e,0);break;case ke:o=new C(b(i,U(c,i)),o,o&&o.lastId,a,a&&a.id,t,null,new ur(f)),o.integrate(e,0);break;default:if(f instanceof R)o=new C(b(i,U(c,i)),o,o&&o.lastId,a,a&&a.id,t,null,new Oe(f)),o.integrate(e,0);else throw Error(\"Unexpected content type in insert operation\")}}}),u()},Xc=()=>X(\"Length exceeded!\"),Qc=(e,t,r,n)=>{if(r>t._length)throw Xc();if(r===0){if(t._searchMarker)nr(t._searchMarker,r,n.length);return un(e,t,null,n)}let o=r,s=wn(t,r),i=t._start;if(s!==null){if(i=s.p,r-=s.index,r===0)i=i.prev,r+=i&&i.countable&&!i.deleted?i.length:0}for(;i!==null;i=i.right)if(!i.deleted&&i.countable){if(r<=i.length){if(r<i.length)Ue(e,b(i.id.client,i.id.clock+r));break}r-=i.length}if(t._searchMarker)nr(t._searchMarker,o,n.length);return un(e,t,i,n)},Mh=(e,t,r)=>{let o=(t._searchMarker||[]).reduce((s,i)=>i.index>s.index?i:s,{index:0,p:t._start}).p;if(o)while(o.right)o=o.right;return un(e,t,o,r)},ea=(e,t,r,n)=>{if(n===0)return;let o=r,s=n,i=wn(t,r),c=t._start;if(i!==null)c=i.p,r-=i.index;for(;c!==null&&r>0;c=c.right)if(!c.deleted&&c.countable){if(r<c.length)Ue(e,b(c.id.client,c.id.clock+r));r-=c.length}while(n>0&&c!==null){if(!c.deleted){if(n<c.length)Ue(e,b(c.id.client,c.id.clock+n));c.delete(e),n-=c.length}c=c.right}if(n>0)throw Xc();if(t._searchMarker)nr(t._searchMarker,o,-s+n)},ln=(e,t,r)=>{let n=t._map.get(r);if(n!==void 0)n.delete(e)},ps=(e,t,r,n)=>{let o=t._map.get(r)||null,s=e.doc,i=s.clientID,c;if(n==null)c=new Qe([n]);else switch(n.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:c=new Qe([n]);break;case Uint8Array:c=new ar(n);break;case ke:c=new ur(n);break;default:if(n instanceof R)c=new Oe(n);else throw Error(\"Unexpected content type\")}new C(b(i,U(s.store,i)),o,o&&o.lastId,null,null,t,r,c).integrate(e,0)},ds=(e,t)=>{e.doc??F();let r=e._map.get(t);return r!==void 0&&!r.deleted?r.content.getContent()[r.length-1]:void 0},ta=(e)=>{let t={};return e.doc??F(),e._map.forEach((r,n)=>{if(!r.deleted)t[n]=r.content.getContent()[r.length-1]}),t},ra=(e,t)=>{e.doc??F();let r=e._map.get(t);return r!==void 0&&!r.deleted};var Vh=(e,t)=>{let r={};return e._map.forEach((n,o)=>{let s=n;while(s!==null&&(!t.sv.has(s.id.client)||s.id.clock>=(t.sv.get(s.id.client)||0)))s=s.left;if(s!==null&&_t(s,t))r[o]=s.content.getContent()[s.length-1]}),r},rn=(e)=>(e.doc??F(),gc(e._map.entries(),(t)=>!t[1].deleted));class na extends cr{}class re extends R{constructor(){super();this._prelimContent=[],this._searchMarker=[]}static from(e){let t=new re;return t.push(e),t}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new re}clone(){let e=new re;return e.insert(0,this.toArray().map((t)=>t instanceof R?t.clone():t)),e}get length(){return this.doc??F(),this._length}_callObserver(e,t){super._callObserver(e,t),bn(this,e,new na(this,e))}insert(e,t){if(this.doc!==null)v(this.doc,(r)=>{Qc(r,this,e,t)});else this._prelimContent.splice(e,0,...t)}push(e){if(this.doc!==null)v(this.doc,(t)=>{Mh(t,this,e)});else this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,t=1){if(this.doc!==null)v(this.doc,(r)=>{ea(r,this,e,t)});else this._prelimContent.splice(e,t)}get(e){return Yc(this,e)}toArray(){return Wc(this)}slice(e=0,t=this.length){return Gc(this,e,t)}toJSON(){return this.map((e)=>e instanceof R?e.toJSON():e)}map(e){return Hc(this,e)}forEach(e){or(this,e)}[Symbol.iterator](){return Bh(this)}_write(e){e.writeTypeRef(fm)}}var Fh=(e)=>new re;class oa extends cr{constructor(e,t,r){super(e,t);this.keysChanged=r}}class q extends R{constructor(e){super();if(this._prelimContent=null,e===void 0)this._prelimContent=new Map;else this._prelimContent=new Map(e)}_integrate(e,t){super._integrate(e,t),this._prelimContent.forEach((r,n)=>{this.set(n,r)}),this._prelimContent=null}_copy(){return new q}clone(){let e=new q;return this.forEach((t,r)=>{e.set(r,t instanceof R?t.clone():t)}),e}_callObserver(e,t){bn(this,e,new oa(this,e,t))}toJSON(){this.doc??F();let e={};return this._map.forEach((t,r)=>{if(!t.deleted){let n=t.content.getContent()[t.length-1];e[r]=n instanceof R?n.toJSON():n}}),e}get size(){return[...rn(this)].length}keys(){return en(rn(this),(e)=>e[0])}values(){return en(rn(this),(e)=>e[1].content.getContent()[e[1].length-1])}entries(){return en(rn(this),(e)=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??F(),this._map.forEach((t,r)=>{if(!t.deleted)e(t.content.getContent()[t.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(e){if(this.doc!==null)v(this.doc,(t)=>{ln(t,this,e)});else this._prelimContent.delete(e)}set(e,t){if(this.doc!==null)v(this.doc,(r)=>{ps(r,this,e,t)});else this._prelimContent.set(e,t);return t}get(e){return ds(this,e)}has(e){return ra(this,e)}clear(){if(this.doc!==null)v(this.doc,(e)=>{this.forEach(function(t,r,n){ln(e,n,r)})});else this._prelimContent.clear()}_write(e){e.writeTypeRef(pm)}}var Jh=(e)=>new q,De=(e,t)=>e===t||typeof e===\"object\"&&typeof t===\"object\"&&e&&t&&Oo(e,t);class fn{constructor(e,t,r,n){this.left=e,this.right=t,this.index=r,this.currentAttributes=n}forward(){if(this.right===null)H();switch(this.right.content.constructor){case D:if(!this.right.deleted)$t(this.currentAttributes,this.right.content);break;default:if(!this.right.deleted)this.index+=this.right.length;break}this.left=this.right,this.right=this.right.right}}var $c=(e,t,r)=>{while(t.right!==null&&r>0){switch(t.right.content.constructor){case D:if(!t.right.deleted)$t(t.currentAttributes,t.right.content);break;default:if(!t.right.deleted){if(r<t.right.length)Ue(e,b(t.right.id.client,t.right.id.clock+r));t.index+=t.right.length,r-=t.right.length}break}t.left=t.right,t.right=t.right.right}return t},nn=(e,t,r,n)=>{let o=new Map,s=n?wn(t,r):null;if(s){let i=new fn(s.p.left,s.p,s.index,o);return $c(e,i,r-s.index)}else{let i=new fn(null,t._start,0,o);return $c(e,i,r)}},sa=(e,t,r,n)=>{while(r.right!==null&&(r.right.deleted===!0||r.right.content.constructor===D&&De(n.get(r.right.content.key),r.right.content.value))){if(!r.right.deleted)n.delete(r.right.content.key);r.forward()}let o=e.doc,s=o.clientID;n.forEach((i,c)=>{let{left:a,right:l}=r,u=new C(b(s,U(o.store,s)),a,a&&a.lastId,l,l&&l.id,t,null,new D(c,i));u.integrate(e,0),r.right=u,r.forward()})},$t=(e,t)=>{let{key:r,value:n}=t;if(n===null)e.delete(r);else e.set(r,n)},ia=(e,t)=>{while(!0){if(e.right===null)break;else if(e.right.deleted||e.right.content.constructor===D&&De(t[e.right.content.key]??null,e.right.content.value));else break;e.forward()}},ca=(e,t,r,n)=>{let o=e.doc,s=o.clientID,i=new Map;for(let c in n){let a=n[c],l=r.currentAttributes.get(c)??null;if(!De(l,a)){i.set(c,l);let{left:u,right:f}=r;r.right=new C(b(s,U(o.store,s)),u,u&&u.lastId,f,f&&f.id,t,null,new D(c,a)),r.right.integrate(e,0),r.forward()}}return i},Qo=(e,t,r,n,o)=>{r.currentAttributes.forEach((p,d)=>{if(o[d]===void 0)o[d]=null});let s=e.doc,i=s.clientID;ia(r,o);let c=ca(e,t,r,o),a=n.constructor===String?new be(n):n instanceof R?new Oe(n):new et(n),{left:l,right:u,index:f}=r;if(t._searchMarker)nr(t._searchMarker,r.index,a.getLength());u=new C(b(i,U(s.store,i)),l,l&&l.lastId,u,u&&u.id,t,null,a),u.integrate(e,0),r.right=u,r.index=f,r.forward(),sa(e,t,r,c)},zc=(e,t,r,n,o)=>{let s=e.doc,i=s.clientID;ia(r,o);let c=ca(e,t,r,o);e:while(r.right!==null&&(n>0||c.size>0&&(r.right.deleted||r.right.content.constructor===D))){if(!r.right.deleted)switch(r.right.content.constructor){case D:{let{key:a,value:l}=r.right.content,u=o[a];if(u!==void 0){if(De(u,l))c.delete(a);else{if(n===0)break e;c.set(a,l)}r.right.delete(e)}else r.currentAttributes.set(a,l);break}default:if(n<r.right.length)Ue(e,b(r.right.id.client,r.right.id.clock+n));n-=r.right.length;break}r.forward()}if(n>0){let a=\"\";for(;n>0;n--)a+=`\n`;r.right=new C(b(i,U(s.store,i)),r.left,r.left&&r.left.lastId,r.right,r.right&&r.right.id,t,null,new be(a)),r.right.integrate(e,0),r.forward()}sa(e,t,r,c)},aa=(e,t,r,n,o)=>{let s=t,i=J();while(s&&(!s.countable||s.deleted)){if(!s.deleted&&s.content.constructor===D){let l=s.content;i.set(l.key,l)}s=s.right}let c=0,a=!1;while(t!==s){if(r===t)a=!0;if(!t.deleted){let l=t.content;switch(l.constructor){case D:{let{key:u,value:f}=l,p=n.get(u)??null;if(i.get(u)!==l||p===f){if(t.delete(e),c++,!a&&(o.get(u)??null)===f&&p!==f)if(p===null)o.delete(u);else o.set(u,p)}if(!a&&!t.deleted)$t(o,l);break}}}t=t.right}return c},Kh=(e,t)=>{while(t&&t.right&&(t.right.deleted||!t.right.countable))t=t.right;let r=new Set;while(t&&(t.deleted||!t.countable)){if(!t.deleted&&t.content.constructor===D){let n=t.content.key;if(r.has(n))t.delete(e);else r.add(n)}t=t.left}},qh=(e)=>{let t=0;return v(e.doc,(r)=>{let{_start:n,_start:o}=e,s=J(),i=Er(s);while(o){if(o.deleted===!1)switch(o.content.constructor){case D:$t(i,o.content);break;default:t+=aa(r,n,o,s,i),s=Er(i),n=o;break}o=o.right}}),t},Gh=(e)=>{let t=new Set,r=e.doc;for(let[n,o]of e.afterState.entries()){let s=e.beforeState.get(n)||0;if(o===s)continue;Bc(e,r.store.clients.get(n),s,o,(i)=>{if(!i.deleted&&i.content.constructor===D&&i.constructor!==ee)t.add(i.parent)})}v(r,(n)=>{Ec(e,e.deleteSet,(o)=>{if(o instanceof ee||!o.parent._hasFormatting||t.has(o.parent))return;let s=o.parent;if(o.content.constructor===D)t.add(s);else Kh(n,o)});for(let o of t)qh(o)})},Ic=(e,t,r)=>{let n=r,o=Er(t.currentAttributes),s=t.right;while(r>0&&t.right!==null){if(t.right.deleted===!1)switch(t.right.content.constructor){case Oe:case et:case be:if(r<t.right.length)Ue(e,b(t.right.id.client,t.right.id.clock+r));r-=t.right.length,t.right.delete(e);break}t.forward()}if(s)aa(e,s,t.right,o,t.currentAttributes);let i=(t.left||t.right).parent;if(i._searchMarker)nr(i._searchMarker,t.index,-n+r);return t};class ua extends cr{constructor(e,t,r){super(e,t);this.childListChanged=!1,this.keysChanged=new Set,r.forEach((n)=>{if(n===null)this.childListChanged=!0;else this.keysChanged.add(n)})}get changes(){if(this._changes===null){let e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(this._delta===null){let e=this.target.doc,t=[];v(e,(r)=>{let n=new Map,o=new Map,s=this.target._start,i=null,c={},a=\"\",l=0,u=0,f=()=>{if(i!==null){let p=null;switch(i){case\"delete\":if(u>0)p={delete:u};u=0;break;case\"insert\":if(typeof a===\"object\"||a.length>0){if(p={insert:a},n.size>0)p.attributes={},n.forEach((d,h)=>{if(d!==null)p.attributes[h]=d})}a=\"\";break;case\"retain\":if(l>0){if(p={retain:l},!Ri(c))p.attributes=Ni({},c)}l=0;break}if(p)t.push(p);i=null}};while(s!==null){switch(s.content.constructor){case Oe:case et:if(this.adds(s)){if(!this.deletes(s))f(),i=\"insert\",a=s.content.getContent()[0],f()}else if(this.deletes(s)){if(i!==\"delete\")f(),i=\"delete\";u+=1}else if(!s.deleted){if(i!==\"retain\")f(),i=\"retain\";l+=1}break;case be:if(this.adds(s)){if(!this.deletes(s)){if(i!==\"insert\")f(),i=\"insert\";a+=s.content.str}}else if(this.deletes(s)){if(i!==\"delete\")f(),i=\"delete\";u+=s.length}else if(!s.deleted){if(i!==\"retain\")f(),i=\"retain\";l+=s.length}break;case D:{let{key:p,value:d}=s.content;if(this.adds(s)){if(!this.deletes(s)){let h=n.get(p)??null;if(!De(h,d)){if(i===\"retain\")f();if(De(d,o.get(p)??null))delete c[p];else c[p]=d}else if(d!==null)s.delete(r)}}else if(this.deletes(s)){o.set(p,d);let h=n.get(p)??null;if(!De(h,d)){if(i===\"retain\")f();c[p]=h}}else if(!s.deleted){o.set(p,d);let h=c[p];if(h!==void 0){if(!De(h,d)){if(i===\"retain\")f();if(d===null)delete c[p];else c[p]=d}else if(h!==null)s.delete(r)}}if(!s.deleted){if(i===\"insert\")f();$t(n,s.content)}break}}s=s.right}f();while(t.length>0){let p=t[t.length-1];if(p.retain!==void 0&&p.attributes===void 0)t.pop();else break}}),this._delta=t}return this._delta}}class ae extends R{constructor(e){super();this._pending=e!==void 0?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??F(),this._length}_integrate(e,t){super._integrate(e,t);try{this._pending.forEach((r)=>r())}catch(r){console.error(r)}this._pending=null}_copy(){return new ae}clone(){let e=new ae;return e.applyDelta(this.toDelta()),e}_callObserver(e,t){super._callObserver(e,t);let r=new ua(this,e,t);if(bn(this,e,r),!e.local&&this._hasFormatting)e._needFormattingCleanup=!0}toString(){this.doc??F();let e=\"\",t=this._start;while(t!==null){if(!t.deleted&&t.countable&&t.content.constructor===be)e+=t.content.str;t=t.right}return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:t=!0}={}){if(this.doc!==null)v(this.doc,(r)=>{let n=new fn(null,this._start,0,new Map);for(let o=0;o<e.length;o++){let s=e[o];if(s.insert!==void 0){let i=!t&&typeof s.insert===\"string\"&&o===e.length-1&&n.right===null&&s.insert.slice(-1)===`\n`?s.insert.slice(0,-1):s.insert;if(typeof i!==\"string\"||i.length>0)Qo(r,this,n,i,s.attributes||{})}else if(s.retain!==void 0)zc(r,this,n,s.retain,s.attributes||{});else if(s.delete!==void 0)Ic(r,n,s.delete)}});else this._pending.push(()=>this.applyDelta(e))}toDelta(e,t,r){this.doc??F();let n=[],o=new Map,s=this.doc,i=\"\",c=this._start;function a(){if(i.length>0){let u={},f=!1;o.forEach((d,h)=>{f=!0,u[h]=d});let p={insert:i};if(f)p.attributes=u;n.push(p),i=\"\"}}let l=()=>{while(c!==null){if(_t(c,e)||t!==void 0&&_t(c,t))switch(c.content.constructor){case be:{let u=o.get(\"ychange\");if(e!==void 0&&!_t(c,e)){if(u===void 0||u.user!==c.id.client||u.type!==\"removed\")a(),o.set(\"ychange\",r?r(\"removed\",c.id):{type:\"removed\"})}else if(t!==void 0&&!_t(c,t)){if(u===void 0||u.user!==c.id.client||u.type!==\"added\")a(),o.set(\"ychange\",r?r(\"added\",c.id):{type:\"added\"})}else if(u!==void 0)a(),o.delete(\"ychange\");i+=c.content.str;break}case Oe:case et:{a();let u={insert:c.content.getContent()[0]};if(o.size>0){let f={};u.attributes=f,o.forEach((p,d)=>{f[d]=p})}n.push(u);break}case D:if(_t(c,e))a(),$t(o,c.content);break}c=c.right}a()};if(e||t)v(s,(u)=>{if(e)es(u,e);if(t)es(u,t);l()},\"cleanup\");else l();return n}insert(e,t,r){if(t.length<=0)return;let n=this.doc;if(n!==null)v(n,(o)=>{let s=nn(o,this,e,!r);if(!r)r={},s.currentAttributes.forEach((i,c)=>{r[c]=i});Qo(o,this,s,t,r)});else this._pending.push(()=>this.insert(e,t,r))}insertEmbed(e,t,r){let n=this.doc;if(n!==null)v(n,(o)=>{let s=nn(o,this,e,!r);Qo(o,this,s,t,r||{})});else this._pending.push(()=>this.insertEmbed(e,t,r||{}))}delete(e,t){if(t===0)return;let r=this.doc;if(r!==null)v(r,(n)=>{Ic(n,nn(n,this,e,!0),t)});else this._pending.push(()=>this.delete(e,t))}format(e,t,r){if(t===0)return;let n=this.doc;if(n!==null)v(n,(o)=>{let s=nn(o,this,e,!1);if(s.right===null)return;zc(o,this,s,t,r)});else this._pending.push(()=>this.format(e,t,r))}removeAttribute(e){if(this.doc!==null)v(this.doc,(t)=>{ln(t,this,e)});else this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,t){if(this.doc!==null)v(this.doc,(r)=>{ps(r,this,e,t)});else this._pending.push(()=>this.setAttribute(e,t))}getAttribute(e){return ds(this,e)}getAttributes(){return ta(this)}_write(e){e.writeTypeRef(dm)}}var Wh=(e)=>new ae;class sn{constructor(e,t=()=>!0){this._filter=t,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??F()}[Symbol.iterator](){return this}next(){let e=this._currentNode,t=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(t)))do if(t=e.content.type,!e.deleted&&(t.constructor===wt||t.constructor===Xe)&&t._start!==null)e=t._start;else while(e!==null){let r=e.next;if(r!==null){e=r;break}else if(e.parent===this._root)e=null;else e=e.parent._item}while(e!==null&&(e.deleted||!this._filter(e.content.type)));if(this._firstCall=!1,e===null)return{value:void 0,done:!0};return this._currentNode=e,{value:e.content.type,done:!1}}}class Xe extends R{constructor(){super();this._prelimContent=[]}get firstChild(){let e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Xe}clone(){let e=new Xe;return e.insert(0,this.toArray().map((t)=>t instanceof R?t.clone():t)),e}get length(){return this.doc??F(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new sn(this,e)}querySelector(e){e=e.toUpperCase();let r=new sn(this,(n)=>n.nodeName&&n.nodeName.toUpperCase()===e).next();if(r.done)return null;else return r.value}querySelectorAll(e){return e=e.toUpperCase(),ge(new sn(this,(t)=>t.nodeName&&t.nodeName.toUpperCase()===e))}_callObserver(e,t){bn(this,e,new la(this,t,e))}toString(){return Hc(this,(e)=>e.toString()).join(\"\")}toJSON(){return this.toString()}toDOM(e=document,t={},r){let n=e.createDocumentFragment();if(r!==void 0)r._createAssociation(n,this);return or(this,(o)=>{n.insertBefore(o.toDOM(e,t,r),null)}),n}insert(e,t){if(this.doc!==null)v(this.doc,(r)=>{Qc(r,this,e,t)});else this._prelimContent.splice(e,0,...t)}insertAfter(e,t){if(this.doc!==null)v(this.doc,(r)=>{let n=e&&e instanceof R?e._item:e;un(r,this,n,t)});else{let r=this._prelimContent,n=e===null?0:r.findIndex((o)=>o===e)+1;if(n===0&&e!==null)throw X(\"Reference item not found\");r.splice(n,0,...t)}}delete(e,t=1){if(this.doc!==null)v(this.doc,(r)=>{ea(r,this,e,t)});else this._prelimContent.splice(e,t)}toArray(){return Wc(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return Yc(this,e)}slice(e=0,t=this.length){return Gc(this,e,t)}forEach(e){or(this,e)}_write(e){e.writeTypeRef(mm)}}var Hh=(e)=>new Xe;class wt extends Xe{constructor(e=\"UNDEFINED\"){super();this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){let e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){let e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,t){super._integrate(e,t),this._prelimAttrs.forEach((r,n)=>{this.setAttribute(n,r)}),this._prelimAttrs=null}_copy(){return new wt(this.nodeName)}clone(){let e=new wt(this.nodeName),t=this.getAttributes();return Ui(t,(r,n)=>{e.setAttribute(n,r)}),e.insert(0,this.toArray().map((r)=>r instanceof R?r.clone():r)),e}toString(){let e=this.getAttributes(),t=[],r=[];for(let i in e)r.push(i);r.sort();let n=r.length;for(let i=0;i<n;i++){let c=r[i];t.push(c+'=\"'+e[c]+'\"')}let o=this.nodeName.toLocaleLowerCase(),s=t.length>0?\" \"+t.join(\" \"):\"\";return`<${o}${s}>${super.toString()}</${o}>`}removeAttribute(e){if(this.doc!==null)v(this.doc,(t)=>{ln(t,this,e)});else this._prelimAttrs.delete(e)}setAttribute(e,t){if(this.doc!==null)v(this.doc,(r)=>{ps(r,this,e,t)});else this._prelimAttrs.set(e,t)}getAttribute(e){return ds(this,e)}hasAttribute(e){return ra(this,e)}getAttributes(e){return e?Vh(this,e):ta(this)}toDOM(e=document,t={},r){let n=e.createElement(this.nodeName),o=this.getAttributes();for(let s in o){let i=o[s];if(typeof i===\"string\")n.setAttribute(s,i)}if(or(this,(s)=>{n.appendChild(s.toDOM(e,t,r))}),r!==void 0)r._createAssociation(n,this);return n}_write(e){e.writeTypeRef(hm),e.writeKey(this.nodeName)}}var Yh=(e)=>new wt(e.readKey());class la extends cr{constructor(e,t,r){super(e,r);this.childListChanged=!1,this.attributesChanged=new Set,t.forEach((n)=>{if(n===null)this.childListChanged=!0;else this.attributesChanged.add(n)})}}class pn extends q{constructor(e){super();this.hookName=e}_copy(){return new pn(this.hookName)}clone(){let e=new pn(this.hookName);return this.forEach((t,r)=>{e.set(r,t)}),e}toDOM(e=document,t={},r){let n=t[this.hookName],o;if(n!==void 0)o=n.createDom(this);else o=document.createElement(this.hookName);if(o.setAttribute(\"data-yjs-hook\",this.hookName),r!==void 0)r._createAssociation(o,this);return o}_write(e){e.writeTypeRef(gm),e.writeKey(this.hookName)}}var Xh=(e)=>new pn(e.readKey());class dn extends ae{get nextSibling(){let e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){let e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new dn}clone(){let e=new dn;return e.applyDelta(this.toDelta()),e}toDOM(e=document,t,r){let n=e.createTextNode(this.toString());if(r!==void 0)r._createAssociation(n,this);return n}toString(){return this.toDelta().map((e)=>{let t=[];for(let n in e.attributes){let o=[];for(let s in e.attributes[n])o.push({key:s,value:e.attributes[n][s]});o.sort((s,i)=>s.key<i.key?-1:1),t.push({nodeName:n,attrs:o})}t.sort((n,o)=>n.nodeName<o.nodeName?-1:1);let r=\"\";for(let n=0;n<t.length;n++){let o=t[n];r+=`<${o.nodeName}`;for(let s=0;s<o.attrs.length;s++){let i=o.attrs[s];r+=` ${i.key}=\"${i.value}\"`}r+=\">\"}r+=e.insert;for(let n=t.length-1;n>=0;n--)r+=`</${t[n].nodeName}>`;return r}).join(\"\")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(ym)}}var Qh=(e)=>new dn;class kn{constructor(e,t){this.id=e,this.length=t}get deleted(){throw Q()}mergeWith(e){return!1}write(e,t,r){throw Q()}integrate(e,t){throw Q()}}var em=0;class ee extends kn{get deleted(){return!0}delete(){}mergeWith(e){if(this.constructor!==e.constructor)return!1;return this.length+=e.length,!0}integrate(e,t){if(t>0)this.id.clock+=t,this.length-=t;Lc(e.doc.store,this)}write(e,t){e.writeInfo(em),e.writeLen(this.length-t)}getMissing(e,t){return null}}class ar{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new ar(this.content)}splice(e){throw Q()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeBuf(this.content)}getRef(){return 3}}var tm=(e)=>new ar(e.readBuf());class sr{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new sr(this.len)}splice(e){let t=new sr(this.len-e);return this.len=e,t}mergeWith(e){return this.len+=e.len,!0}integrate(e,t){cn(e.deleteSet,t.id.client,t.id.clock,this.len),t.markDeleted()}delete(e){}gc(e){}write(e,t){e.writeLen(this.len-t)}getRef(){return 1}}var rm=(e)=>new sr(e.readLen()),fa=(e,t)=>new ke({guid:e,...t,shouldLoad:t.shouldLoad||t.autoLoad||!1});class ur{constructor(e){if(e._item)console.error(\"This document was already integrated as a sub-document. You should create a second instance instead with the same guid.\");this.doc=e;let t={};if(this.opts=t,!e.gc)t.gc=!1;if(e.autoLoad)t.autoLoad=!0;if(e.meta!==null)t.meta=e.meta}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new ur(fa(this.doc.guid,this.opts))}splice(e){throw Q()}mergeWith(e){return!1}integrate(e,t){if(this.doc._item=t,e.subdocsAdded.add(this.doc),this.doc.shouldLoad)e.subdocsLoaded.add(this.doc)}delete(e){if(e.subdocsAdded.has(this.doc))e.subdocsAdded.delete(this.doc);else e.subdocsRemoved.add(this.doc)}gc(e){}write(e,t){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}}var nm=(e)=>new ur(fa(e.readString(),e.readAny()));class et{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new et(this.embed)}splice(e){throw Q()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeJSON(this.embed)}getRef(){return 5}}var om=(e)=>new et(e.readJSON());class D{constructor(e,t){this.key=e,this.value=t}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new D(this.key,this.value)}splice(e){throw Q()}mergeWith(e){return!1}integrate(e,t){let r=t.parent;r._searchMarker=null,r._hasFormatting=!0}delete(e){}gc(e){}write(e,t){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}}var sm=(e)=>new D(e.readKey(),e.readJSON());class hn{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new hn(this.arr)}splice(e){let t=new hn(this.arr.slice(e));return this.arr=this.arr.slice(0,e),t}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){let r=this.arr.length;e.writeLen(r-t);for(let n=t;n<r;n++){let o=this.arr[n];e.writeString(o===void 0?\"undefined\":JSON.stringify(o))}}getRef(){return 2}}var im=(e)=>{let t=e.readLen(),r=[];for(let n=0;n<t;n++){let o=e.readString();if(o===\"undefined\")r.push(void 0);else r.push(JSON.parse(o))}return new hn(r)},cm=Yt(\"node_env\")===\"development\";class Qe{constructor(e){this.arr=e,cm&&To(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Qe(this.arr)}splice(e){let t=new Qe(this.arr.slice(e));return this.arr=this.arr.slice(0,e),t}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){let r=this.arr.length;e.writeLen(r-t);for(let n=t;n<r;n++){let o=this.arr[n];e.writeAny(o)}}getRef(){return 8}}var am=(e)=>{let t=e.readLen(),r=[];for(let n=0;n<t;n++)r.push(e.readAny());return new Qe(r)};class be{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split(\"\")}isCountable(){return!0}copy(){return new be(this.str)}splice(e){let t=new be(this.str.slice(e));this.str=this.str.slice(0,e);let r=this.str.charCodeAt(e-1);if(r>=55296&&r<=56319)this.str=this.str.slice(0,e-1)+\"�\",t.str=\"�\"+t.str.slice(1);return t}mergeWith(e){return this.str+=e.str,!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeString(t===0?this.str:this.str.slice(t))}getRef(){return 4}}var um=(e)=>new be(e.readString()),lm=[Fh,Jh,Wh,Yh,Hh,Xh,Qh],fm=0,pm=1,dm=2,hm=3,mm=4,gm=5,ym=6;class Oe{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new Oe(this.type._copy())}splice(e){throw Q()}mergeWith(e){return!1}integrate(e,t){this.type._integrate(e.doc,t)}delete(e){let t=this.type._start;while(t!==null){if(!t.deleted)t.delete(e);else if(t.id.clock<(e.beforeState.get(t.id.client)||0))e._mergeStructs.push(t);t=t.right}this.type._map.forEach((r)=>{if(!r.deleted)r.delete(e);else if(r.id.clock<(e.beforeState.get(r.id.client)||0))e._mergeStructs.push(r)}),e.changed.delete(this.type)}gc(e){let t=this.type._start;while(t!==null)t.gc(e,!0),t=t.right;this.type._start=null,this.type._map.forEach((r)=>{while(r!==null)r.gc(e,!0),r=r.left}),this.type._map=new Map}write(e,t){this.type._write(e)}getRef(){return 7}}var xm=(e)=>new Oe(lm[e.readTypeRef()](e));var mn=(e,t,r)=>{let{client:n,clock:o}=t.id,s=new C(b(n,o+r),t,b(n,o+r-1),t.right,t.rightOrigin,t.parent,t.parentSub,t.content.splice(r));if(t.deleted)s.markDeleted();if(t.keep)s.keep=!0;if(t.redone!==null)s.redone=b(t.redone.client,t.redone.clock+r);if(t.right=s,s.right!==null)s.right.left=s;if(e._mergeStructs.push(s),s.parentSub!==null&&s.right===null)s.parent._map.set(s.parentSub,s);return t.length=r,s};class C extends kn{constructor(e,t,r,n,o,s,i,c){super(e,c.getLength());this.origin=r,this.left=t,this.right=n,this.rightOrigin=o,this.parent=s,this.parentSub=i,this.redone=null,this.content=c,this.info=this.content.isCountable()?ho:0}set marker(e){if((this.info&Dr)>0!==e)this.info^=Dr}get marker(){return(this.info&Dr)>0}get keep(){return(this.info&po)>0}set keep(e){if(this.keep!==e)this.info^=po}get countable(){return(this.info&ho)>0}get deleted(){return(this.info&Cr)>0}set deleted(e){if(this.deleted!==e)this.info^=Cr}markDeleted(){this.info|=Cr}getMissing(e,t){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=U(t,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=U(t,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===He&&this.id.client!==this.parent.client&&this.parent.clock>=U(t,this.parent.client))return this.parent.client;if(this.origin)this.left=bc(e,t,this.origin),this.origin=this.left.lastId;if(this.rightOrigin)this.right=Ue(e,this.rightOrigin),this.rightOrigin=this.right.id;if(this.left&&this.left.constructor===ee||this.right&&this.right.constructor===ee)this.parent=null;else if(!this.parent){if(this.left&&this.left.constructor===C)this.parent=this.left.parent,this.parentSub=this.left.parentSub;else if(this.right&&this.right.constructor===C)this.parent=this.right.parent,this.parentSub=this.right.parentSub}else if(this.parent.constructor===He){let r=Xo(t,this.parent);if(r.constructor===ee)this.parent=null;else this.parent=r.content.type}return null}integrate(e,t){if(t>0)this.id.clock+=t,this.left=bc(e,e.doc.store,b(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(t),this.length-=t;if(this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let r=this.left,n;if(r!==null)n=r.right;else if(this.parentSub!==null){n=this.parent._map.get(this.parentSub)||null;while(n!==null&&n.left!==null)n=n.left}else n=this.parent._start;let o=new Set,s=new Set;while(n!==null&&n!==this.right){if(s.add(n),o.add(n),tn(this.origin,n.origin)){if(n.id.client<this.id.client)r=n,o.clear();else if(tn(this.rightOrigin,n.rightOrigin))break}else if(n.origin!==null&&s.has(Xo(e.doc.store,n.origin))){if(!o.has(Xo(e.doc.store,n.origin)))r=n,o.clear()}else break;n=n.right}this.left=r}if(this.left!==null){let r=this.left.right;this.right=r,this.left.right=this}else{let r;if(this.parentSub!==null){r=this.parent._map.get(this.parentSub)||null;while(r!==null&&r.left!==null)r=r.left}else r=this.parent._start,this.parent._start=this;this.right=r}if(this.right!==null)this.right.left=this;else if(this.parentSub!==null){if(this.parent._map.set(this.parentSub,this),this.left!==null)this.left.delete(e)}if(this.parentSub===null&&this.countable&&!this.deleted)this.parent._length+=this.length;if(Lc(e.doc.store,this),this.content.integrate(e,this),vc(e,this.parent,this.parentSub),this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)this.delete(e)}else new ee(this.id,this.length).integrate(e,0)}get next(){let e=this.right;while(e!==null&&e.deleted)e=e.right;return e}get prev(){let e=this.left;while(e!==null&&e.deleted)e=e.left;return e}get lastId(){return this.length===1?this.id:b(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&tn(e.origin,this.lastId)&&this.right===e&&tn(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){let t=this.parent._searchMarker;if(t)t.forEach((r)=>{if(r.p===e){if(r.p=this,!this.deleted&&this.countable)r.index-=this.length}});if(e.keep)this.keep=!0;if(this.right=e.right,this.right!==null)this.right.left=this;return this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){let t=this.parent;if(this.countable&&this.parentSub===null)t._length-=this.length;this.markDeleted(),cn(e.deleteSet,this.id.client,this.id.clock,this.length),vc(e,t,this.parentSub),this.content.delete(e)}}gc(e,t){if(!this.deleted)throw H();if(this.content.gc(e),t)Ah(e,this,new ee(this.id,this.length));else this.content=new sr(this.length)}write(e,t){let r=t>0?b(this.id.client,this.id.clock+t-1):this.origin,n=this.rightOrigin,o=this.parentSub,s=this.content.getRef()&jt|(r===null?0:M)|(n===null?0:ie)|(o===null?0:ot);if(e.writeInfo(s),r!==null)e.writeLeftID(r);if(n!==null)e.writeRightID(n);if(r===null&&n===null){let i=this.parent;if(i._item!==void 0){let c=i._item;if(c===null){let a=zh(i);e.writeParentInfo(!0),e.writeString(a)}else e.writeParentInfo(!1),e.writeLeftID(c.id)}else if(i.constructor===String)e.writeParentInfo(!0),e.writeString(i);else if(i.constructor===He)e.writeParentInfo(!1),e.writeLeftID(i);else H();if(o!==null)e.writeString(o)}this.content.write(e,t)}}var pa=(e,t)=>_m[t&jt](e),_m=[()=>{H()},rm,im,tm,um,om,sm,xm,am,nm,()=>{H()}],wm=10;class te extends kn{get deleted(){return!0}delete(){}mergeWith(e){if(this.constructor!==e.constructor)return!1;return this.length+=e.length,!0}integrate(e,t){H()}write(e,t){e.writeInfo(wm),w(e.restEncoder,this.length-t)}getMissing(e,t){return null}}var da=typeof globalThis<\"u\"?globalThis:typeof window<\"u\"?window:typeof global<\"u\"?global:{},ha=\"__ $YJS$ __\";if(da[ha]===!0)console.error(\"Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438\");da[ha]=!0;function fr(e){let t=Object.values(e).filter((n)=>typeof n===\"number\");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function ms(e,t=\"|\"){return e.map((r)=>xs(r)).join(t)}function pr(e,t){if(typeof t===\"bigint\")return t.toString();return t}class ga{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function dr(e){return new ga(e)}function ya(e){return e===null||e===void 0}function vn(e){let t=e.startsWith(\"^\")?1:0,r=e.endsWith(\"$\")?e.length-1:e.length;return e.slice(t,r)}function xa(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-n)<o)return 0;return r-n}function ue(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function hr(e){let t=Object.getOwnPropertyDescriptor(e,\"shape\");return t?.get?t.get.raw:t?.value}function Te(e){return hr(e._zod.def)??e._zod.def.shape}function _a(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return ue(this,t,n),n},enumerable:!0,configurable:!0})}function wa(e,t,r){if(t in e)ue(e,t,r);else e[t]=r}function tt(e,t,r,n){let o=Te(t);for(let s of r){let i=Object.getOwnPropertyDescriptor(o,s);if(!i.enumerable)continue;if(i.get)_a(e,s,()=>{let c=t._zod.def.shape[s];return n?n(c,s):c});else wa(e,s,n?n(i.value,s):i.value)}}function bm(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);if(!n.enumerable)continue;if(n.get)_a(e,r,()=>t[r]);else wa(e,r,n.value)}}function ne(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function ba(e){return JSON.stringify(e)}function ka(e){return e.toLowerCase().trim().replace(/[^\\w\\s-]/g,\"\").replace(/[\\s_-]+/g,\"-\").replace(/^-+|-+$/g,\"\")}var gs=\"captureStackTrace\"in Error?Error.captureStackTrace:(...e)=>{};function zt(e){return typeof e===\"object\"&&e!==null&&!Array.isArray(e)}var va=dr(()=>{if(oe.jitless)return!1;if(typeof navigator<\"u\"&&navigator?.userAgent?.includes(\"Cloudflare\"))return!1;try{return new Function(\"\"),!0}catch(e){return!1}});function It(e){if(zt(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!==\"function\")return!0;let r=t.prototype;if(zt(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,\"isPrototypeOf\")===!1)return!1;return!0}function ys(e){if(It(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var Sa=new Set([\"string\",\"number\",\"symbol\"]);function je(e){return e.replace(/[.*+?^${}()|[\\]\\\\]/g,\"\\\\$&\")}function ve(e,t,r){let n=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)n._zod.parent=e;return n}function y(e){let t=e;if(!t)return{};if(typeof t===\"string\")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error(\"Cannot specify both `message` and `error` params\");t.error=t.message}if(delete t.message,typeof t.error===\"string\")return{...t,error:()=>t.error};return t}function xs(e){if(typeof e===\"bigint\")return e.toString()+\"n\";if(typeof e===\"string\")return`\"${e}\"`;return`${e}`}function $a(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===\"optional\")}var Sn=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),_s={int64:[BigInt(\"-9223372036854775808\"),BigInt(\"9223372036854775807\")],uint64:[BigInt(0),BigInt(\"18446744073709551615\")]};function km(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(\".pick() cannot be used on object schemas containing refinements\");let s={};return tt(s,e,$n(e,t)),ve(e,ne(r,{shape:s,checks:[]}))}function $n(e,t){let r=Te(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw Error(`Unrecognized key: \"${String(o)}\"`);if(t[o])n.push(o)}return n}function vm(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(\".omit() cannot be used on object schemas containing refinements\");let s=new Set($n(e,t)),i={};return tt(i,e,Reflect.ownKeys(Te(e)).filter((c)=>!s.has(c))),ve(e,ne(r,{shape:i,checks:[]}))}function Sm(e,t){if(!It(t))throw Error(\"Invalid input to extend: expected a plain object\");let r=e._zod.def.checks;if(r&&r.length>0){let o=Te(e);for(let s of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,s)!==void 0)throw Error(\"Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.\")}return ve(e,ne(e._zod.def,{shape:za(e,t)}))}function za(e,t){let r={};return tt(r,e,Reflect.ownKeys(Te(e))),bm(r,t),r}function $m(e,t){if(!It(t))throw Error(\"Invalid input to safeExtend: expected a plain object\");return ve(e,ne(e._zod.def,{shape:za(e,t)}))}function zm(e,t){if(!t?._zod?.def)throw Error(\"Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.\");if(e._zod.def.checks?.length)throw Error(\".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.\");let r={};tt(r,e,Reflect.ownKeys(Te(e))),tt(r,t,Reflect.ownKeys(Te(t)));let n=ne(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return ve(e,n)}function Ia(e,t,r,n=\"partial\"){let s=t._zod.def.checks;if(s&&s.length>0)throw Error(`.${n}() cannot be used on object schemas containing refinements`);let c=r?new Set($n(t,r)):void 0,a={};return tt(a,t,Reflect.ownKeys(Te(t)),e&&((l,u)=>c&&!c.has(u)?l:new e({type:\"optional\",innerType:l}))),ve(t,ne(t._zod.def,{shape:a,checks:[]}))}function Im(e,t,r){let n=r?new Set($n(t,r)):void 0,o={};return tt(o,t,Reflect.ownKeys(Te(t)),(s,i)=>n&&!n.has(i)?s:new e({type:\"nonoptional\",innerType:s})),ve(t,ne(t._zod.def,{shape:o}))}function Se(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Ea(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function zn(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function lr(e){return typeof e===\"string\"?e:e?.message}function ws(e){let t=[];for(let r of e??[]){let n=r._zod.def;if(!/_(length|size)$|_equals$/.test(n.check))break;let o=n.maximum??n.length??n.size;if(o>=0)t.push([o,r])}return t}function In(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function Le(e,t,r){var n;let o=e.inst?._zod?.traits;if(o?.has(\"$ZodType\"))if(o.has(\"$ZodCheck\"))(n=e).schema??(n.schema=e.inst);else e.schema=e.inst;let s=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,i=e.message?e.message:lr(e.inst?._zod.def?.error?.(e))??lr(s?.(e))??lr(t?.error?.(e))??lr(r.customError?.(e))??lr(r.localeError?.(e))??\"Invalid input\",c={};for(let a of Object.keys(e)){if(a===\"inst\"||a===\"schema\"||a===\"continue\"||a===\"input\"||a===\"__proto__\")continue;c[a]=e[a]}if(c.path??(c.path=[]),c.message=i,t?.reportInput)c.input=e.input;return c}var Em=/[\\uD800-\\uDBFF]/;function En(e){let t=e.length;if(!Em.test(e))return t;let r=t;for(let n=0;n<t-1;n++)if((e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320)r--,n++;return r}function An(e){if(Array.isArray(e))return\"array\";if(typeof e===\"string\")return\"string\";return\"unknown\"}function Aa(e){let t=typeof e;switch(t){case\"number\":return Number.isNaN(e)?\"nan\":\"number\";case\"object\":{if(e===null)return\"null\";if(Array.isArray(e))return\"array\";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&\"constructor\"in r&&r.constructor)return r.constructor.name}}return t}function rt(...e){let[t,r,n]=e;if(typeof t===\"string\")return{message:t,code:\"custom\",input:r,inst:n};return{...t}}function Oa(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);if(n.get)Object.defineProperty(e,r,{...n,enumerable:!1});else Am(e,r,n.value)}}function Pe(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function On(e,t,r){return Pe(e,t,r,!1)}function Ta(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return Pe(this,r,n(this))},set(o){Pe(this,r,o)}})}return t}function Am(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:Pe(this,t,r.bind(this))},set(n){Pe(this,t,n)}})}function Om(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var hs,Re=!1,Tm={configurable:!0,get(){Re=!0;return}};function k(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&hs!==e._zod){hs=void 0;return}hs=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,Tm);let o=Re;Re=!1;try{let s=r(this);if(Re)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:s});return Re=Re||o,s}catch(s){throw delete this[t],Re=Re||o,s}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function Pm(e,t,r,n){let o=Om(e,t);if(!o)return;Object.defineProperty(o,t,{configurable:!0,get(){let s={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,s),s.value=r(this),Object.defineProperty(this,t,s),s.value},set(s){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:s})}})}var Zm=\"~constantCatch\";function Pa(e){let t=()=>e;return t[Zm]=!0,t}var Za;var bs={value:void 0,enumerable:!1},Ca=\"captureStackTrace\"in Error?Error:null;function Cm(e){let t=Ca;if(t){let r=t.stackTraceLimit;if(typeof r===\"number\"){try{t.stackTraceLimit=0}catch{return Ca=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function m(e,t,r,n){let o={};function s(p){this.def=p,this.constr=f,this.traits=new Set}s.prototype=o;let i=r,c=i&&new WeakSet;function a(p,d){if(!p._zod){bs.value=new s(d);try{Object.defineProperty(p,\"_zod\",bs)}finally{bs.value=void 0}}else if(p._zod.traits.has(e))return;if(p._zod.traits.add(e),t(p,d),c){let g=Object.getPrototypeOf(p),x=p._zod.constr.prototype,S=g;while(S&&S!==x)S=Object.getPrototypeOf(S);let de=S??g;if(!c.has(de))c.add(de),Oa(de,i)}let h=f.prototype;for(let g in h){if(!Object.prototype.hasOwnProperty.call(h,g))continue;if(!(g in p))p[g]=h[g].bind(p)}}let l=n?.Parent??Object;class u extends l{}Object.defineProperty(u,\"name\",{value:e});function f(p){let d=n?.Parent?Cm(u):this;a(d,p);let h=d._zod.deferred;if(h){for(let x of h)x();d._zod.deferred=void 0}let g=globalThis.__zod_globalConfig?.postProcessor;if(g)g(d);return d}return Object.defineProperty(f,\"init\",{value:a}),Object.defineProperty(f,Symbol.hasInstance,{value:(p)=>{if(n?.Parent&&p instanceof n.Parent)return!0;return p?._zod?.traits?.has(e)}}),Object.defineProperty(f,\"name\",{value:e}),f}class $e extends Error{constructor(){super(\"Encountered Promise during synchronous parse. Use .parseAsync() instead.\")}}class mr extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name=\"ZodEncodeError\"}}(Za=globalThis).__zod_globalConfig??(Za.__zod_globalConfig={});var oe=globalThis.__zod_globalConfig;function fe(e){if(e)Object.assign(oe,e);return oe}function Dm(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,pr,2)),e.message}function Nm(e){this._zod.message=e}var Um={get:Dm,set:Nm,enumerable:!0,configurable:!0},vs={value:void 0,enumerable:!1},Da=new WeakSet([Object.prototype,Error.prototype]),Na=(e,t)=>{e.name=\"$ZodError\",vs.value=t,Object.defineProperty(e,\"issues\",vs),vs.value=void 0,Object.defineProperty(e,\"message\",Um);let r=Object.getPrototypeOf(e);if(!Da.has(r))Da.add(r),Object.defineProperty(r,\"toString\",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,\"toString\",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,\"toString\",{value:n,configurable:!0,writable:!0})}})},Ua=m(\"$ZodError\",Na),zx=m(\"$ZodError\",Na,void 0,{Parent:Error});function Rm(e,t,r){if(!Object.prototype.hasOwnProperty.call(e,t))if(t===\"__proto__\")Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0});else e[t]=r();return e[t]}function Ra(e,t=(r)=>r.message){let r={},n=[];for(let o of e.issues)if(o.path.length>0)Rm(r,o.path[0],()=>[]).push(t(o));else n.push(t(o));return{formErrors:n,fieldErrors:r}}function ja(e,t=(r)=>r.message){let r={_errors:[]},n=(o,s=[])=>{for(let i of o.issues)if(i.code===\"invalid_union\"&&i.errors.length)i.errors.map((c)=>n({issues:c},[...s,...i.path]));else if(i.code===\"invalid_key\")n({issues:i.issues},[...s,...i.path]);else if(i.code===\"invalid_element\")n({issues:i.issues},[...s,...i.path]);else{let c=[...s,...i.path];if(c.length===0)r._errors.push(t(i));else{let a=r,l=0;while(l<c.length){let u=c[l],f=l===c.length-1;if(u===\"_errors\"){if(f)a._errors.push(t(i));l++;continue}if(!Object.prototype.hasOwnProperty.call(a,u))Object.defineProperty(a,u,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let p=a[u];if(f)p._errors.push(t(i));a=p,l++}}}};return n(e),r}function Tn(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Pn=(e)=>{let t=(r,n,o,s)=>{let i=o?{...o,async:!1}:{async:!1},c=r._zod.run({value:n,issues:[]},i);if(c instanceof Promise)throw new $e;if(c.issues.length){let a=new(s?.Err??e)(c.issues.map((l)=>Le(l,i,fe())));throw gs(a,s?.callee??t),a}return c.value};return t};var Zn=(e)=>{let t=async(r,n,o,s)=>{let i=o?{...o,async:!0}:{async:!0},c=r._zod.run({value:n,issues:[]},i);if(c instanceof Promise)c=await c;if(c.issues.length){let a=new(s?.Err??e)(c.issues.map((l)=>Le(l,i,fe())));throw gs(a,s?.callee??t),a}return c.value};return t};var Cn=(e)=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new $e;return s.issues.length?La(e,s.issues,o):{success:!0,data:s.value}};function La(e,t,r){let n;return{success:!1,get error(){if(!n)n=new e(t.map((o)=>Le(o,r,fe()))),t=void 0,r=void 0;return n},set error(o){n=o,t=void 0,r=void 0}}}var Dn=(e)=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)s=await s;return s.issues.length?La(e,s.issues,o):{success:!0,data:s.value}};var jm=Symbol.for(\"zod.compile.invalid\"),Lm=Symbol.for(\"zod.compile.fallback\"),Ss=(e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==jm)return!0;if(n.definite===!0&&r===void 0)return!1}return Bm(e,t,r)};function Bm(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,s;if(o)n[Lm]=!0,s=o({value:t,issues:[]},n);else s=e._zod.run({value:t,issues:[]},n);if(s instanceof Promise)throw new $e;return s.issues.length===0}var $s=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);if(o instanceof Promise)o=await o;return o.issues.length===0},Ba=(e)=>{let t=Pn(e),r=(n,o,s,i)=>{let c=s?{...s,direction:\"backward\"}:{direction:\"backward\"};return t(n,o,c,Tn(r,i))};return r};var Ma=(e)=>{let t=Pn(e),r=(n,o,s,i)=>t(n,o,s,Tn(r,i));return r};var Va=(e)=>{let t=Zn(e),r=async(n,o,s,i)=>{let c=s?{...s,direction:\"backward\"}:{direction:\"backward\"};return await t(n,o,c,Tn(r,i))};return r};var Fa=(e)=>{let t=Zn(e),r=async(n,o,s,i)=>await t(n,o,s,Tn(r,i));return r};var Ja=(e)=>(t,r,n)=>{let o=n?{...n,direction:\"backward\"}:{direction:\"backward\"};return Cn(e)(t,r,o)};var Ka=(e)=>(t,r,n)=>Cn(e)(t,r,n);var qa=(e)=>async(t,r,n)=>{let o=n?{...n,direction:\"backward\"}:{direction:\"backward\"};return Dn(e)(t,r,o)};var Ga=(e)=>async(t,r,n)=>Dn(e)(t,r,n);var Wa=/^[cC][0-9a-z]{6,}$/,Ha=/^[0-9a-z]+$/,Ya=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Xa=/^[0-9a-vA-V]{20}$/,Qa=/^[A-Za-z0-9]{27}$/,eu=/^[a-zA-Z0-9_-]{21}$/;function tu(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var ru=/^P(?:(\\d+W)|(?!.*W)(?=\\d|T\\d)(\\d+Y)?(\\d+M)?(\\d+D)?(T(?=\\d)(\\d+H)?(\\d+M)?(\\d+([.,]\\d+)?S)?)?)$/;var nu=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Is=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var ou=/^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$/;var Mm=\"^(?=[\\\\s\\\\S]*[\\\\p{Extended_Pictographic}\\\\p{Regional_Indicator}\\\\u20E3])[\\\\p{Extended_Pictographic}\\\\p{Emoji_Component}]+$\";function su(){return new RegExp(Mm,\"u\")}var iu=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,cu=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var au=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/([0-9]|[1-2][0-9]|3[0-2])$/,uu=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,lu=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,fu=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var pu=/^https?$/,du=/^\\+[1-9]\\d{6,14}$/;var hu=\"(?:(?:\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\\\d|30)|(?:02)-(?:0[1-9]|1\\\\d|2[0-8])))\";function Vm(e){return new RegExp(`^${e}$`)}var mu=Vm(hu);function zs(e){return typeof e.precision===\"number\"?e.precision===-1?\"(?:[01]\\\\d|2[0-3]):[0-5]\\\\d\":e.precision===0?\"(?:[01]\\\\d|2[0-3]):[0-5]\\\\d:[0-5]\\\\d\":`(?:[01]\\\\d|2[0-3]):[0-5]\\\\d:[0-5]\\\\d\\\\.\\\\d{${e.precision}}`:e.seconds?\"(?:[01]\\\\d|2[0-3]):[0-5]\\\\d:[0-5]\\\\d(?:\\\\.\\\\d+)?\":\"(?:[01]\\\\d|2[0-3]):[0-5]\\\\d(?::[0-5]\\\\d(?:\\\\.\\\\d+)?)?\"}function gu(e){return new RegExp(`^${zs(e)}$`)}function yu(e){let t=[\"Z\"];if(e.offset)t.push(\"([+-](?:[01]\\\\d|2[0-3]):[0-5]\\\\d)\");let r=`${zs({precision:e.precision,seconds:!0})}(?:${t.join(\"|\")})`,n=e.local?`${r}|${zs({precision:e.precision})}`:r;return new RegExp(`^${hu}T(?:${n})$`)}var xu=/^[\\s\\S]{0,}$/;var Es=/^-?\\d+(?:\\.\\d+)?$/;var _u=/^[^A-Z]*$/,wu=/^[^a-z]*$/;var L=m(\"$ZodCheck\",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var As=(e)=>{let t=e.value;return!ya(t)&&t.length!==void 0},Nn={number:\"number\",bigint:\"bigint\",object:\"date\"},Os=m(\"$ZodCheckLessThan\",(e,t)=>{L.init(e,t);let r=Nn[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value<=t.value:n.value<t.value)return;n.issues.push({origin:Nn[typeof n.value]??r,code:\"too_big\",maximum:typeof t.value===\"object\"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ts=m(\"$ZodCheckGreaterThan\",(e,t)=>{L.init(e,t);let r=Nn[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value>=t.value:n.value>t.value)return;n.issues.push({origin:Nn[typeof n.value]??r,code:\"too_small\",minimum:typeof t.value===\"object\"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),bu=m(\"$ZodCheckMultipleOf\",(e,t)=>{L.init(e,t),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error(\"Cannot mix number and bigint in multiple_of check.\");if(typeof r.value===\"bigint\"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):xa(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:\"not_multiple_of\",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),ku=m(\"$ZodCheckNumberFormat\",(e,t)=>{L.init(e,t),t.format=t.format||\"float64\";let r=t.format?.includes(\"int\"),n=r?\"int\":\"number\",[o,s]=Sn[t.format];e._zod.check=(i)=>{let c=i.value;if(r){if(!Number.isInteger(c)){i.issues.push({expected:n,format:t.format,code:\"invalid_type\",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){if(c>0)i.issues.push({input:c,code:\"too_big\",maximum:Number.MAX_SAFE_INTEGER,note:\"Integers must be within the safe integer range.\",inst:e,origin:n,inclusive:!0,continue:!t.abort});else i.issues.push({input:c,code:\"too_small\",minimum:Number.MIN_SAFE_INTEGER,note:\"Integers must be within the safe integer range.\",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}if(c<o)i.issues.push({origin:\"number\",input:c,code:\"too_small\",minimum:o,inclusive:!0,inst:e,continue:!t.abort});if(c>s)i.issues.push({origin:\"number\",input:c,code:\"too_big\",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var vu=m(\"$ZodCheckMaxLength\",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=As),e._zod.check=(n)=>{let o=n.value,s=o.length;if((typeof o===\"string\"&&s>t.maximum?En(o):s)<=t.maximum)return;let c=An(o);n.issues.push({origin:c,code:\"too_big\",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Su=m(\"$ZodCheckMinLength\",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=As),e._zod.check=(n)=>{let o=n.value,s=o.length;if((typeof o===\"string\"&&s>=t.minimum&&s<t.minimum*2?En(o):s)>=t.minimum)return;let c=An(o);n.issues.push({origin:c,code:\"too_small\",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),$u=m(\"$ZodCheckLengthEquals\",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=As),e._zod.check=(n)=>{let o=n.value,s=o.length,i=typeof o===\"string\"&&s>=t.length&&s<=t.length*2?En(o):s;if(i===t.length)return;let c=An(o),a=i>t.length;n.issues.push({origin:c,...a?{code:\"too_big\",maximum:t.length}:{code:\"too_small\",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),yr=m(\"$ZodCheckStringFormat\",(e,t)=>{var r,n;if(L.init(e,t),t.pattern)(r=e._zod).check??(r.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;o.issues.push({origin:\"string\",code:\"invalid_format\",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(n=e._zod).check??(n.check=()=>{})}),zu=m(\"$ZodCheckRegex\",(e,t)=>{yr.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:\"string\",code:\"invalid_format\",format:\"regex\",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Iu=m(\"$ZodCheckLowerCase\",(e,t)=>{t.pattern??(t.pattern=_u),yr.init(e,t)}),Eu=m(\"$ZodCheckUpperCase\",(e,t)=>{t.pattern??(t.pattern=wu),yr.init(e,t)}),Au=m(\"$ZodCheckIncludes\",(e,t)=>{L.init(e,t);let r=je(t.includes),n=new RegExp(typeof t.position===\"number\"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=(o)=>{if(o.value.includes(t.includes,t.position))return;o.issues.push({origin:\"string\",code:\"invalid_format\",format:\"includes\",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Ou=m(\"$ZodCheckStartsWith\",(e,t)=>{L.init(e,t);let r=new RegExp(`^${je(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.startsWith(t.prefix))return;n.issues.push({origin:\"string\",code:\"invalid_format\",format:\"starts_with\",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Tu=m(\"$ZodCheckEndsWith\",(e,t)=>{L.init(e,t);let r=new RegExp(`.*${je(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.endsWith(t.suffix))return;n.issues.push({origin:\"string\",code:\"invalid_format\",format:\"ends_with\",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var Pu=m(\"$ZodCheckOverwrite\",(e,t)=>{L.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class Ps{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e===\"function\"){e(this,{execution:\"sync\"}),e(this,{execution:\"async\"});return}let r=e.split(`\n`).filter((s)=>s),n=Math.min(...r.map((s)=>s.length-s.trimStart().length)),o=r.map((s)=>s.slice(n)).map((s)=>\" \".repeat(this.indent*2)+s);for(let s of o)this.content.push(s)}compile(){let e=Function,t=this?.content??[\"\"];return new e(...Object.keys(this.closed),`return function (${this.args.join(\", \")}) {\n${t.join(`\n`)}\n};`)(...Object.values(this.closed))}}var Cu={major:4,minor:6,patch:7};var A=m(\"$ZodType\",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Cu;let n=e._zod.def.checks,o=e._zod.traits.has(\"$ZodCheck\")?[e,...n??[]]:n?.length?[...n]:[];for(let s of o)for(let i of s._zod.onattach)i(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let s=(c,a,l)=>{if(c.memo)return c;let u=Se(c),f;for(let p of a){if(p._zod.def.when){if(Ea(c))continue;if(!p._zod.def.when(c))continue}else if(u)continue;let d=c.issues.length,h=p._zod.check(c);if(h instanceof Promise&&l?.async===!1)throw new $e;if(f||h instanceof Promise)f=(f??Promise.resolve()).then(async()=>{if(await h,c.issues.length===d)return;if(In(c.issues,d,e),!u)u=Se(c,d)});else{if(c.issues.length===d)continue;if(In(c.issues,d,e),!u)u=Se(c,d)}}if(f)return f.then(()=>c);return c},i=(c,a,l)=>{if(Se(c))return c.aborted=!0,c;let u=s(a,o,l);if(u instanceof Promise){if(l.async===!1)throw new $e;return u.then((f)=>e._zod.parse(f,l))}return e._zod.parse(u,l)};e._zod.run=(c,a)=>{if(a.skipChecks)return e._zod.parse(c,a);if(a.direction===\"backward\"){let u=e._zod.parse({value:c.value,issues:[]},{...a,skipChecks:!0});if(u instanceof Promise)return u.then((f)=>i(f,c,a));return i(u,c,a)}let l=e._zod.parse(c,a);if(l instanceof Promise){if(a.async===!1)throw new $e;return l.then((u)=>s(u,o,a))}return s(l,o,a)}}},{get \"~standard\"(){return On(this,\"~standard\",Cs(this))},set \"~standard\"(e){Pe(this,\"~standard\",e)}}),Ju=(e,t)=>e.issues.length?{issues:e.issues.map((r)=>Le(r,t,fe()))}:{value:e.value};async function Jm(e,t){let r={async:!0};return Ju(await e._zod.run({value:t,issues:[]},r),r)}function Cs(e){return{validate:(t)=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return Ju(n,r)}catch(n){}return Jm(e,t)},vendor:\"zod\",version:1}}var Ln=m(\"$ZodString\",(e,t)=>{A.init(e,t),e._zod.pattern=t.pattern??xu,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(o){}if(typeof r.value===\"string\")return r;return r.issues.push({expected:\"string\",code:\"invalid_type\",input:r.value,inst:e}),r}}),I=m(\"$ZodStringFormat\",(e,t)=>{yr.init(e,t),Ln.init(e,t)}),Ku=m(\"$ZodGUID\",(e,t)=>{t.pattern??(t.pattern=nu),I.init(e,t)}),qu=m(\"$ZodUUID\",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw Error(`Invalid UUID version: \"${t.version}\"`);t.pattern??(t.pattern=Is(n))}else t.pattern??(t.pattern=Is());I.init(e,t)}),Gu=m(\"$ZodEmail\",(e,t)=>{t.pattern??(t.pattern=ou),I.init(e,t)}),Wu=1,Rn=2;function Hu(e){try{if(typeof URL<\"u\"&&typeof URL.canParse===\"function\")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function Km(e,t){if(!(\"normalize\"in t)&&!(\"hostname\"in t)&&!(\"protocol\"in t))return Hu(e)||Rn;return qm(e,t)}function qm(e,t){if(!t.normalize&&t.protocol?.source===pu.source&&!/^https?:\\/\\//i.test(e))return Wu;try{if(typeof URL<\"u\"){let r=URL;if(typeof r.parse===\"function\")return r.parse(e)??Rn}return new URL(e)}catch{return Rn}}var Gm=/[\\t\\n\\r]/g;function Du(e){return e.replace(Gm,\"\")}function Wm(e,t){return t.lastIndex=0,t.test(e.hostname)}function Hm(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(\":\")?e.protocol.slice(0,-1):e.protocol)}var Yu=m(\"$ZodURL\",(e,t)=>{I.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim(),o=Km(n,t);if(o===Wu){r.issues.push({code:\"invalid_format\",format:\"url\",note:\"Invalid URL format\",input:r.value,inst:e,continue:!t.abort});return}if(o===Rn){r.issues.push({code:\"invalid_format\",format:\"url\",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=Du(n);return}if(t.hostname&&!Wm(o,t.hostname))r.issues.push({code:\"invalid_format\",format:\"url\",note:\"Invalid hostname\",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort});if(t.protocol&&!Hm(o,t.protocol))r.issues.push({code:\"invalid_format\",format:\"url\",note:\"Invalid protocol\",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort});r.value=t.normalize?o.href:Du(n);return}catch(n){r.issues.push({code:\"invalid_format\",format:\"url\",input:r.value,inst:e,continue:!t.abort})}}}),Xu=m(\"$ZodEmoji\",(e,t)=>{t.pattern??(t.pattern=su()),I.init(e,t)}),Qu=m(\"$ZodNanoID\",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?eu:tu(t.length)),I.init(e,t)}),el=m(\"$ZodCUID\",(e,t)=>{t.pattern??(t.pattern=Wa),I.init(e,t)}),tl=m(\"$ZodCUID2\",(e,t)=>{t.pattern??(t.pattern=Ha),I.init(e,t)}),rl=m(\"$ZodULID\",(e,t)=>{t.pattern??(t.pattern=Ya),I.init(e,t)}),nl=m(\"$ZodXID\",(e,t)=>{t.pattern??(t.pattern=Xa),I.init(e,t)}),ol=m(\"$ZodKSUID\",(e,t)=>{t.pattern??(t.pattern=Qa),I.init(e,t)}),sl=m(\"$ZodISODateTime\",(e,t)=>{t.pattern??(t.pattern=yu(t)),I.init(e,t)}),il=m(\"$ZodISODate\",(e,t)=>{t.pattern??(t.pattern=mu),I.init(e,t)}),cl=m(\"$ZodISOTime\",(e,t)=>{t.pattern??(t.pattern=gu(t)),I.init(e,t)}),al=m(\"$ZodISODuration\",(e,t)=>{t.pattern??(t.pattern=ru),I.init(e,t)}),ul=m(\"$ZodIPv4\",(e,t)=>{t.pattern??(t.pattern=iu),I.init(e,t)}),Ym=/^[0-9a-fA-F:.]+$/;function ll(e){if(!Ym.test(e))return!1;return Hu(`http://[${e}]`)}var fl=m(\"$ZodIPv6\",(e,t)=>{t.pattern??(t.pattern=cu),I.init(e,t),e._zod.check=(r)=>{if(!ll(r.value))r.issues.push({code:\"invalid_format\",format:\"ipv6\",input:r.value,inst:e,continue:!t.abort})}});var pl=m(\"$ZodCIDRv4\",(e,t)=>{t.pattern??(t.pattern=au),I.init(e,t)});function Xm(e){let t=e.split(\"/\");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);if(`${o}`!==n)return!1;if(o<0||o>128)return!1;return ll(r)}var dl=m(\"$ZodCIDRv6\",(e,t)=>{t.pattern??(t.pattern=uu),I.init(e,t),e._zod.check=(r)=>{if(!Xm(r.value))r.issues.push({code:\"invalid_format\",format:\"cidrv6\",input:r.value,inst:e,continue:!t.abort})}});function hl(e){if(e===\"\")return!0;if(/\\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Ds=/^[0-9a-zA-Z+/]*={0,2}$/,ml=m(\"$ZodBase64\",(e,t)=>{t.pattern??(t.pattern=Ds),I.init(e,t),e._zod.check=(r)=>{if(hl(r.value))return;r.issues.push({code:\"invalid_format\",format:\"base64\",input:r.value,inst:e,continue:!t.abort})}}),Bn=/^[A-Za-z0-9_-]*$/;function Qm(e){if(!Bn.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n===\"-\"?\"+\":\"/\"),r=t.padEnd(Math.ceil(t.length/4)*4,\"=\");return hl(r)}var gl=m(\"$ZodBase64URL\",(e,t)=>{t.pattern??(t.pattern=Bn),I.init(e,t),e._zod.check=(r)=>{if(Qm(r.value))return;r.issues.push({code:\"invalid_format\",format:\"base64url\",input:r.value,inst:e,continue:!t.abort})}}),yl=m(\"$ZodE164\",(e,t)=>{t.pattern??(t.pattern=du),I.init(e,t)});function eg(e,t=null){try{let r=e.split(\".\");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));if(\"typ\"in o&&o?.typ!==\"JWT\")return!1;if(!o.alg)return!1;if(t&&(!(\"alg\"in o)||o.alg!==t))return!1;return!0}catch{return!1}}var xl=m(\"$ZodJWT\",(e,t)=>{I.init(e,t),e._zod.check=(r)=>{if(eg(r.value,t.alg))return;r.issues.push({code:\"invalid_format\",format:\"jwt\",input:r.value,inst:e,continue:!t.abort})}});var Ns=m(\"$ZodNumber\",(e,t)=>{A.init(e,t),e._zod.pattern=Es,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(i){}let o=r.value;if(typeof o===\"number\"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let s=typeof o===\"number\"?Number.isNaN(o)?\"NaN\":!Number.isFinite(o)?String(o):void 0:void 0;return r.issues.push({expected:\"number\",code:\"invalid_type\",input:o,inst:e,...s?{received:s}:{}}),r}}),_l=m(\"$ZodNumberFormat\",(e,t)=>{ku.init(e,t),Ns.init(e,t)});var wl=m(\"$ZodUnknown\",(e,t)=>{A.init(e,t),e._zod.parse=(r)=>r}),bl=m(\"$ZodNever\",(e,t)=>{A.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:\"never\",code:\"invalid_type\",input:r.value,inst:e}),r)});function tg(e,t){let r=ws(e._zod.def.checks);if(!r.length)return;let n=Math.min(...r.map((s)=>s[0])),o=e._zod.parse;e._zod.parse=(s,i)=>{let c=t(s.value);if(c>n&&!i?.skipChecks&&i?.direction!==\"backward\"){for(let[a,l]of ws(e._zod.def.checks))if(c>a&&l._zod.def.when(s)){let u=s.issues.length;return l._zod.check(s),s.issues[u].continue=!1,In(s.issues,u,e),s}}return o(s,i)}}var rg=(e)=>Array.isArray(e)?e.length:-1;function Nu(e,t,r){if(e.issues.length)t.issues.push(...zn(r,e.issues));t.value[r]=e.value}var kl=m(\"$ZodArray\",(e,t)=>{A.init(e,t);let r=oe.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let s=n.value;if(!Array.isArray(s))return n.issues.push({expected:\"array\",code:\"invalid_type\",input:s,inst:e}),n;n.value=r?r.alloc(e,n,Array(s.length),o):Array(s.length);let i=[],c=o?.abortEarly;for(let a=0;a<s.length;a++){let l=s[a],u=t.element._zod.run({value:l,issues:[]},o);if(u instanceof Promise)i.push(u.then((f)=>Nu(f,n,a)));else if(Nu(u,n,a),c&&u.issues.length!==0&&Se(u))break}if(i.length)return Promise.all(i).then(()=>n);return n},tg(e,rg)});function jn(e,t,r,n,o,s){let i=r in n,c=s===\"optional\";if(!i&&c&&o===\"optional\")return;if(e.issues.length){if(o!==void 0&&c&&!i)return;t.issues.push(...zn(r,e.issues))}if(!i&&o===void 0){if(!e.issues.length)t.issues.push({code:\"invalid_type\",expected:\"nonoptional\",input:void 0,path:[r]});return}if(e.value===void 0){if(i||o===\"defaulted\"&&!c)t.value[r]=void 0}else t.value[r]=e.value}var ng=[];function vl(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:ng,o=n.length?[...t,...n]:t;for(let i of o)if(!e.shape?.[i]?._zod?.traits?.has(\"$ZodType\"))throw Error(`Invalid element at key \"${String(i)}\": expected a Zod schema`);let s=$a(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function Sl(e,t,r,n,o,s,i){let c=[],a=o.keySet,l=o.catchall._zod,u=l.def.type,{optin:f,optout:p}=l,d=0;for(let h in t){if(i&&r.issues.length!==d){if(Se(r,d))break;d=r.issues.length}if(a.has(h))continue;if(h===\"__proto__\"){if(u===\"never\")c.push(h);continue}if(u===\"never\"){c.push(h);continue}let g=l.run({value:t[h],issues:[]},n);if(g instanceof Promise)e.push(g.then((x)=>jn(x,r,h,t,f,p)));else jn(g,r,h,t,f,p)}if(c.length)r.issues.push({code:\"unrecognized_keys\",keys:c,input:t,inst:s,continue:!0});if(!e.length)return r;return Promise.all(e).then(()=>r)}var og=m(\"$ZodObject\",(e,t)=>{A.init(e,t);let r=Object.getOwnPropertyDescriptor(t,\"shape\"),n=r?.get?r.get.raw:t.shape??{};if(n){let l=()=>{let u={...n};return Object.defineProperty(t,\"shape\",{value:u}),l.raw=u,u};l.raw=n,Object.defineProperty(t,\"shape\",{get:l})}let o=dr(()=>vl(t));k(e,\"propValues\",(l)=>{let u=l.def.shape,f={};for(let p in u){let d=u[p]._zod;if(d.values){if(!Object.prototype.hasOwnProperty.call(f,p))ue(f,p,new Set);for(let h of d.values)f[p].add(h);if(d.optin!==void 0)f[p].add(void 0)}}return f});let s=zt,i=t.catchall,c,a=oe.memoizer;a?.attach(e),e._zod.parse=(l,u)=>{c??(c=o.value);let f=l.value;if(!s(f))return l.issues.push({expected:\"object\",code:\"invalid_type\",input:f,inst:e}),l;l.value=a?a.alloc(e,l,{},u):{};let p=[],d=c.shape,h=u?.abortEarly,g=l.issues.length;for(let x of c.allKeys){if(h&&l.issues.length!==g){if(Se(l,g))break;g=l.issues.length}if(x===\"__proto__\")continue;let S=d[x],de=S._zod.optin,Ct=S._zod.optout,Dt=S._zod.run({value:f[x],issues:[]},u);if(Dt instanceof Promise)p.push(Dt.then((P)=>jn(P,l,x,f,de,Ct)));else jn(Dt,l,x,f,de,Ct)}if(!i)return p.length?Promise.all(p).then(()=>l):l;return Sl(p,f,l,u,o.value,e,h===!0)}}),$l=m(\"$ZodObjectJIT\",(e,t)=>{og.init(e,t);let r=e._zod.parse,n=dr(()=>vl(t)),o=oe.memoizer,s=(d)=>{let h=n.value,g=h.symbolKeys,x=new Ps([\"payload\",\"ctx\"],{shape:d,inst:e,memo:o,syms:g}),S=(P)=>`shape[${P}]._zod.run({ value: input[${P}], issues: [] }, ctx)`,de=(P,z)=>`\n let ${P}_ab = false;\n for (let i = 0; i < ${P}.issues.length; i++) {\n const iss = ${P}.issues[i];\n iss.path = iss.path ? [${z}, ...iss.path] : [${z}];\n payload.issues.push(iss);\n if (iss.continue !== true) ${P}_ab = true;\n }\n if (${P}_ab && ctx && ctx.abortEarly) {\n payload.value = newResult;\n return payload;\n }`;x.write(\"const input = payload.value;\");let Ct=Object.create(null),Dt=0;for(let P of h.allKeys)Ct[P]=`key_${Dt++}`;x.write(o?\"const newResult = memo.alloc(inst, payload, {}, ctx);\":\"const newResult = {};\");for(let P of h.allKeys){if(P===\"__proto__\")continue;let z=Ct[P],he=typeof P===\"symbol\"?`syms[${g.indexOf(P)}]`:ba(P),ao=`${he} in input`,di=d[P],uo=di?._zod?.optin,hi=uo!==void 0,Fp=di?._zod?.optout===\"optional\";if(x.write(`const ${z} = ${S(he)};`),hi&&Fp){let Jp=uo===\"optional\"?`${z}_present`:`${z}.value !== undefined || ${z}_present`;x.write(`\n const ${z}_present = ${ao};\n if (!${z}.issues.length || ${z}_present) {\n if (${z}.issues.length) {${de(z,he)}\n }\n\n if (${Jp}) {\n newResult[${he}] = ${z}.value;\n }\n }\n\n `)}else if(!hi)x.write(`\n const ${z}_present = ${ao};\n if (${z}.issues.length) {${de(z,he)}\n }\n if (!${z}_present && !${z}.issues.length) {\n payload.issues.push({\n code: \"invalid_type\",\n expected: \"nonoptional\",\n input: undefined,\n path: [${he}]\n });\n if (ctx && ctx.abortEarly) {\n payload.value = newResult;\n return payload;\n }\n }\n\n if (${z}_present) {\n newResult[${he}] = ${z}.value;\n }\n\n `);else if(x.write(`\n if (${z}.issues.length) {${de(z,he)}\n }\n `),uo===\"defaulted\")x.write(`newResult[${he}] = ${z}.value;`);else x.write(`\n if (${z}.value !== undefined || ${ao}) {\n newResult[${he}] = ${z}.value;\n }\n `)}return x.write(\"payload.value = newResult;\"),x.write(\"return payload;\"),x.compile()},i,c=zt,a=!oe.jitless,u=a&&va.value,f=t.catchall,p;e._zod.parse=(d,h)=>{p??(p=n.value);let g=d.value;if(!c(g))return d.issues.push({expected:\"object\",code:\"invalid_type\",input:g,inst:e}),d;if(a&&u&&h?.async===!1&&h.jitless!==!0){if(!i)i=s(t.shape);if(d=i(d,h),!f)return d;return Sl([],g,d,h,p,e,h?.abortEarly===!0)}return r(d,h)}});function Uu(e,t,r,n){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let o=e.filter((s)=>!Se(s));if(o.length===1)return t.value=o[0].value,o[0];return t.issues.push({code:\"invalid_union\",input:t.value,inst:r,errors:e.map((s)=>s.issues.map((i)=>Le(i,n,fe())))}),t}var Us=m(\"$ZodUnion\",(e,t)=>{A.init(e,t),k(e,\"optin\",(n)=>n.def.options.some((o)=>o._zod.optin===\"defaulted\")?\"defaulted\":n.def.options.some((o)=>o._zod.optin!==void 0)?\"optional\":void 0),k(e,\"optout\",(n)=>n.def.options.some((o)=>o._zod.optout===\"optional\")?\"optional\":void 0),k(e,\"values\",(n)=>{if(n.def.options.every((o)=>o._zod.values))return new Set(n.def.options.flatMap((o)=>Array.from(o._zod.values)));return}),k(e,\"pattern\",(n)=>{if(n.def.options.every((o)=>o._zod.pattern)){let o=n.def.options.map((s)=>s._zod.pattern);return new RegExp(`^(${o.map((s)=>vn(s.source)).join(\"|\")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let s=!1,i=[];for(let c of t.options){let a=c._zod.run({value:n.value,issues:[]},o);if(a instanceof Promise)i.push(a),s=!0;else{if(a.issues.length===0)return a;i.push(a)}}if(!s)return Uu(i,n,e,o);return Promise.all(i).then((c)=>Uu(c,n,e,o))}});function sg(e){let t=new Map;for(let r of e.options){let n=r._zod.propValues?.[e.discriminator];if(!n||n.size===0)throw Error(`Invalid discriminated union option at index \"${e.options.indexOf(r)}\"`);for(let o of n)if(t.has(o)){if(o!==void 0)throw Error(`Duplicate discriminator value \"${String(o)}\"`);t.set(o,null)}else t.set(o,r)}return t}var zl=m(\"$ZodDiscriminatedUnion\",(e,t)=>{t.inclusive=!1,Us.init(e,t);let r=e._zod.parse;k(e,\"propValues\",(o)=>{let s={},i=0;for(let c of o.def.options){let a=c._zod.propValues;if(!a||Object.keys(a).length===0)throw Error(`Invalid discriminated union option at index \"${o.def.options.indexOf(c)}\"`);if(a[o.def.discriminator]?.has(void 0))i++;for(let[l,u]of Object.entries(a)){if(!Object.prototype.hasOwnProperty.call(s,l))ue(s,l,new Set);for(let f of u)s[l].add(f)}}if(!o.def.unionFallback&&i>1)s[o.def.discriminator]?.delete(void 0);return s}),t.options.forEach((o,s)=>{let i=hr(o._zod.def);if(i&&!Object.prototype.hasOwnProperty.call(i,t.discriminator))throw Error(`Invalid discriminated union option at index \"${s}\"`)});let n=dr(()=>sg(t));e._zod.parse=(o,s)=>{let i=o.value;if(!zt(i))return o.issues.push({code:\"invalid_type\",expected:\"object\",input:i,inst:e}),o;let c=i?.[t.discriminator],a=n.value.get(c);if(a&&(c!==void 0||s.direction!==\"backward\"))return a._zod.run(o,s);if(t.unionFallback||s.direction===\"backward\")return r(o,s);return o.issues.push({code:\"invalid_union\",errors:[],note:\"No matching discriminator\",discriminator:t.discriminator,options:Array.from(n.value.keys()).filter((l)=>n.value.get(l)!==null),input:i,path:[t.discriminator],inst:e}),o}}),Il=m(\"$ZodIntersection\",(e,t)=>{A.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,s=t.left._zod.run({value:o,issues:[]},n),i=t.right._zod.run({value:o,issues:[]},n);if(s instanceof Promise||i instanceof Promise)return Promise.all([s,i]).then(([a,l])=>Ru(r,a,l));return Ru(r,s,i)}});function Zs(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(It(e)&&It(t)){let r=Object.keys(t),n=Object.keys(e).filter((s)=>r.indexOf(s)!==-1),o={...e,...t};if(Object.prototype.hasOwnProperty.call(o,\"__proto__\"))delete o.__proto__;for(let s of n){if(s===\"__proto__\")continue;let i=Zs(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],s=t[n],i=Zs(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Ru(e,t,r){let n=new Map,o,s=new Map,i=(l,u)=>{let f;if(l.code===\"unrecognized_keys\"&&!l.path?.length)o??(o=l),f=l.keys;else if(l.code===\"invalid_key\"&&l.origin===\"record\"&&l.path?.length===1){let p=String(l.path[0]);if(!s.has(p))s.set(p,l);f=[p]}else return!1;for(let p of f){if(!n.has(p))n.set(p,{});n.get(p)[u]=!0}return!0};for(let l of t.issues)if(!i(l,\"l\"))e.issues.push(l);for(let l of r.issues)if(!i(l,\"r\"))e.issues.push(l);let c=[...n].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(c.length){let l=o?c.filter((u)=>o.keys.includes(u)):[];if(l.length)e.issues.push({...o,keys:l});for(let u of c)if(!l.includes(u)&&s.has(u))e.issues.push(s.get(u))}let a=Zs(t.value,r.value);if(!a.valid){if(Se(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`)}return e.value=a.data,e}var El=m(\"$ZodEnum\",(e,t)=>{A.init(e,t);let r=fr(t.entries),n=new Set(r);e._zod.values=n,k(e,\"pattern\",(o)=>{let s=fr(o.def.entries).filter((i)=>Sa.has(typeof i));return new RegExp(s.length?`^(${s.map((i)=>je(i.toString())).join(\"|\")})$`:\"^[^\\\\s\\\\S]$\")}),e._zod.parse=(o,s)=>{let i=o.value;if(n.has(i))return o;return o.issues.push({code:\"invalid_value\",values:r,input:i,inst:e}),o}}),Al=m(\"$ZodLiteral\",(e,t)=>{A.init(e,t);let r=new Set(t.values);e._zod.values=r,k(e,\"pattern\",(n)=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map((s)=>typeof s===\"string\"?je(s):s?je(s.toString()):String(s)).join(\"|\")})$`:\"^[^\\\\s\\\\S]$\")}),e._zod.parse=(n,o)=>{let s=n.value;if(r.has(s))return n;return n.issues.push({code:\"invalid_value\",values:t.values,input:s,inst:e}),n}});var Ol=m(\"$ZodTransform\",(e,t)=>{A.init(e,t),e._zod.optin=\"optional\",oe.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction===\"backward\")throw new mr(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then((i)=>(r.value=i,r));if(o instanceof Promise)throw new $e;return r.value=o,r}});function ju(e,t){return e.value=t.issues.length?void 0:t.value,e}var Rs=m(\"$ZodOptional\",(e,t)=>{A.init(e,t),k(e,\"optin\",(r)=>r.def.innerType._zod.optin===\"defaulted\"?\"defaulted\":\"optional\"),e._zod.optout=\"optional\",k(e,\"values\",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),k(e,\"pattern\",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${vn(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!==\"defaulted\")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)return o.then((s)=>ju(r,s));return ju(r,o)}return t.innerType._zod.run(r,n)}}),Tl=m(\"$ZodExactOptional\",(e,t)=>{Rs.init(e,t),k(e,\"values\",(r)=>r.def.innerType._zod.values),k(e,\"pattern\",(r)=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Pl=m(\"$ZodNullable\",(e,t)=>{A.init(e,t),k(e,\"optin\",(r)=>r.def.innerType._zod.optin),k(e,\"optout\",(r)=>r.def.innerType._zod.optout),k(e,\"pattern\",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${vn(n.source)}|null)$`):void 0}),k(e,\"values\",(r)=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>{if(r.value===null)return r;return t.innerType._zod.run(r,n)}}),Zl=m(\"$ZodDefault\",(e,t)=>{A.init(e,t),e._zod.optin=\"defaulted\",k(e,\"values\",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction===\"backward\")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>Lu(s,t));return Lu(o,t)}});function Lu(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var Cl=m(\"$ZodPrefault\",(e,t)=>{A.init(e,t),e._zod.optin=\"defaulted\",k(e,\"values\",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction===\"backward\")return t.innerType._zod.run(r,n);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,n)}}),Dl=m(\"$ZodNonOptional\",(e,t)=>{A.init(e,t),k(e,\"values\",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>Bu(s,e));return Bu(o,e)}});function Bu(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:\"invalid_type\",expected:\"nonoptional\",input:e.value,inst:t});return e}function Mu(e,t,r,n){if(!t.issues.length){if(e.value=t.value,t.memo)e.memo=!0;return e}return e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map((o)=>Le(o,n,fe()))},input:e.value}),e}var Nl=m(\"$ZodCatch\",(e,t)=>{A.init(e,t),k(e,\"optin\",(r)=>r.def.innerType._zod.optin===\"defaulted\"?\"defaulted\":\"optional\"),k(e,\"optout\",(r)=>r.def.innerType._zod.optout),k(e,\"values\",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction===\"backward\")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)return o.then((s)=>Mu(r,s,t,n));return Mu(r,o,t,n)}});var Ul=m(\"$ZodPipe\",(e,t)=>{A.init(e,t),k(e,\"values\",(r)=>r.def.in._zod.values),k(e,\"optin\",(r)=>r.def.in._zod.optin),k(e,\"optout\",(r)=>r.def.out._zod.optout),k(e,\"propValues\",(r)=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction===\"backward\"){let s=t.out._zod.run(r,n);if(s instanceof Promise)return s.then((i)=>Un(i,t.in,n));return Un(s,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>Un(s,t.out,n));return Un(o,t.out,n)}});function Un(e,t,r){if(e.issues.some((n)=>n.code!==\"unrecognized_keys\"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},r)}var Rl=m(\"$ZodReadonly\",(e,t)=>{A.init(e,t),k(e,\"propValues\",(r)=>r.def.innerType._zod.propValues),k(e,\"values\",(r)=>r.def.innerType._zod.values),k(e,\"optin\",(r)=>r.def.innerType?._zod?.optin),k(e,\"optout\",(r)=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction===\"backward\")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then(Vu);return Vu(o)}});function Vu(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var jl=m(\"$ZodCustom\",(e,t)=>{L.init(e,t),A.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=(r)=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then((s)=>Fu(s,r,n,e));Fu(o,r,n,e);return}});function Fu(e,t,r,n){if(!e){let o={code:\"custom\",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};if(n._zod.def.params)o.params=n._zod.def.params;t.issues.push(rt(o))}}class Bl extends Error{constructor(){super(\"Cannot parse a reference cycle that closes through a transform\");this.name=\"ZodCyclicError\"}}var Ls=\"~memo\",Ll=[];function Ml(e){return e!==null&&typeof e===\"object\"}function js(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var Vl=new WeakMap,xr=0,Fn=1,_r=2;function Jn(e,t,r){let n=Vl.get(e);if(n!==void 0)return n?_r:xr;if(t.has(e))return _r;t.add(e);let o=xr,s=(u)=>{if(o!==_r&&u?._zod){let f=Jn(u,t,r);if(f>o)o=f}},i=(u,f)=>{let p=xr;for(let d of Reflect.ownKeys(u)){let h=Object.getOwnPropertyDescriptor(u,d);if(f&&!h.enumerable)continue;let g=h.get?Fn:h.value?._zod?Jn(h.value,t,r):xr;if(g>p)p=g}return p},c=(u)=>{if(u>o)o=u},a=e._zod.def,l=a.type;switch(l){case\"object\":{let u=hr(a);c(u?i(u,!0):Fn),s(a.catchall);break}case\"array\":s(a.element);break;case\"tuple\":for(let u of a.items)s(u);s(a.rest);break;case\"record\":case\"map\":s(a.keyType),s(a.valueType);break;case\"set\":s(a.valueType);break;case\"union\":for(let u of a.options)s(u);break;case\"intersection\":s(a.left),s(a.right);break;case\"optional\":case\"nullable\":case\"default\":case\"prefault\":case\"catch\":case\"readonly\":case\"nonoptional\":case\"promise\":case\"success\":s(a.innerType);break;case\"pipe\":s(a.in),s(a.out);break;case\"function\":s(a.input),s(a.output);break;case\"lazy\":{let u=a._cachedInner??(r?e._zod.innerType:void 0);c(u?Jn(u,t,!1):Fn);break}case\"template_literal\":case\"string\":case\"number\":case\"int\":case\"boolean\":case\"bigint\":case\"symbol\":case\"undefined\":case\"null\":case\"void\":case\"never\":case\"any\":case\"unknown\":case\"date\":case\"nan\":case\"enum\":case\"literal\":case\"file\":case\"transform\":case\"custom\":break;default:for(let u in a){let f=Object.getOwnPropertyDescriptor(a,u);if(!f||f.get)continue;let p=f.value;if(!p||typeof p!==\"object\")continue;if(p._zod)s(p);else if(Array.isArray(p))for(let d of p)s(d)}}return t.delete(e),ig(e,o)}function ig(e,t){if(t!==Fn)Vl.set(e,t===_r);return t}function cg(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}var Mn,Vn=[],ag={alloc(e,t,r){let n=Mn;if(!n)return r;Mn=void 0;let o={value:r,issues:null};return n.set(t.value,o),Vn.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=(o,s)=>{if(s.direction!==\"backward\"&&ug(s,o.value))throw new Bl;return r(o,s)};if(e._zod.parse=n,e._zod.run===r)e._zod.run=n})},attach(e){var t;let r,n=!1,o,s;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let i=e._zod.parse,c=(a,l)=>{if(r===void 0){let S=Jn(e,new Set,!1);if(S===xr){if(e._zod.parse=i,e._zod.run===c)e._zod.run=i;return i(a,l)}if(S===_r||n)r=!0;else n=!0}let u=a.value;if(!Ml(u))return i(a,l);let f=l[Ls];if(!f)f={buckets:new WeakMap,backEdges:void 0},l[Ls]=f;let p;if(o===l)p=s;else p=cg(f,e),o=l,s=p;let d=p.get(u);if(d){if(a.value=d.value,d.issues){if(d.issues.length)a.issues.push(...js(d.issues))}else a.memo=!0,f.backEdges??(f.backEdges=new WeakSet),f.backEdges.add(d.value);return a}Mn=p;let h=Vn.length,g=i(a,l);Mn=void 0;let x=Vn.length>h?Vn.pop():void 0;if(g instanceof Promise)return g.then((S)=>{if(x)x.issues=S.issues.length?js(S.issues):Ll;return S});if(x)x.issues=g.issues.length?js(g.issues):Ll;return g};if(e._zod.parse=c,e._zod.run===i)e._zod.run=c})}};function Fl(){return ag}function ug(e,t){let r=e[Ls]?.backEdges;return r!==void 0&&Ml(t)&&r.has(t)}var lg=()=>{let e={string:{unit:\"characters\",verb:\"to have\"},file:{unit:\"bytes\",verb:\"to have\"},array:{unit:\"items\",verb:\"to have\"},set:{unit:\"items\",verb:\"to have\"},map:{unit:\"entries\",verb:\"to have\"}};function t(s){return e[s]??null}let r={regex:\"input\",email:\"email address\",url:\"URL\",emoji:\"emoji\",uuid:\"UUID\",uuidv4:\"UUIDv4\",uuidv6:\"UUIDv6\",nanoid:\"nanoid\",guid:\"GUID\",cuid:\"cuid\",cuid2:\"cuid2\",ulid:\"ULID\",xid:\"XID\",ksuid:\"KSUID\",datetime:\"ISO datetime\",date:\"ISO date\",time:\"ISO time\",duration:\"ISO duration\",ipv4:\"IPv4 address\",ipv6:\"IPv6 address\",mac:\"MAC address\",cidrv4:\"IPv4 range\",cidrv6:\"IPv6 range\",base64:\"base64-encoded string\",base64url:\"base64url-encoded string\",json_string:\"JSON string\",e164:\"E.164 number\",currency_code:\"currency code\",credit_card:\"credit card number\",iban:\"IBAN\",jwt:\"JWT\",template_literal:\"input\"},n={nan:\"NaN\"};function o(s,i){if(s===\"number\"&&typeof i===\"number\"&&!Number.isFinite(i))return String(i);return n[s]??s}return(s)=>{switch(s.code){case\"invalid_type\":{let i=o(s.expected),c=Aa(s.input),a=o(c,s.input);return`Invalid input: expected ${i}, received ${a}`}case\"invalid_value\":if(s.values.length===1)return`Invalid input: expected ${xs(s.values[0])}`;return`Invalid option: expected one of ${ms(s.values,\"|\")}`;case\"too_big\":{let i=s.exact?\"exactly \":s.inclusive?\"<=\":\"<\",c=t(s.origin);if(c)return`Too big: expected ${s.origin??\"value\"} to have ${i}${s.maximum.toString()} ${c.unit??\"elements\"}`;return`Too big: expected ${s.origin??\"value\"} to be ${i}${s.maximum.toString()}`}case\"too_small\":{let i=s.exact?\"exactly \":s.inclusive?\">=\":\">\",c=t(s.origin);if(c)return`Too small: expected ${s.origin} to have ${i}${s.minimum.toString()} ${c.unit}`;return`Too small: expected ${s.origin} to be ${i}${s.minimum.toString()}`}case\"invalid_format\":{let i=s;if(i.format===\"starts_with\")return`Invalid string: must start with \"${i.prefix}\"`;if(i.format===\"ends_with\")return`Invalid string: must end with \"${i.suffix}\"`;if(i.format===\"includes\")return`Invalid string: must include \"${i.includes}\"`;if(i.format===\"regex\")return`Invalid string: must match pattern ${i.pattern}`;return`Invalid ${r[i.format]??s.format}`}case\"not_multiple_of\":return`Invalid number: must be a multiple of ${s.divisor}`;case\"unrecognized_keys\":return`Unrecognized key${s.keys.length>1?\"s\":\"\"}: ${ms(s.keys,\", \")}`;case\"invalid_key\":return`Invalid key in ${s.origin}`;case\"invalid_union\":if(s.options&&Array.isArray(s.options)&&s.options.length>0)return`Invalid discriminator value. Expected ${s.options.map((c)=>`'${c}'`).join(\" | \")}`;if(s.inclusive===!1)return\"Invalid input: more than one option matched\";return\"Invalid input\";case\"invalid_element\":return`Invalid value in ${s.origin}`;default:return\"Invalid input\"}}};function Bs(){return{localeError:lg()}}var Jl;class Kl{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r===\"object\"&&\"id\"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t===\"object\"&&\"id\"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function fg(){return new Kl}(Jl=globalThis).__zod_globalRegistry??(Jl.__zod_globalRegistry=fg());var nt=globalThis.__zod_globalRegistry;function ql(e){if(e.checks)e.checks=[...e.checks];return e}function Gl(e,t){return new e(ql({type:\"string\",...y(t)}))}function Wl(e,t){return new e({type:\"string\",format:\"email\",check:\"string_format\",abort:!1,...y(t)})}function Hl(e,t){return new e({type:\"string\",format:\"guid\",check:\"string_format\",abort:!1,...y(t)})}function Yl(e,t){return new e({type:\"string\",format:\"uuid\",check:\"string_format\",abort:!1,...y(t)})}function Xl(e,t){return new e({type:\"string\",format:\"uuid\",check:\"string_format\",abort:!1,version:\"v4\",...y(t)})}function Ql(e,t){return new e({type:\"string\",format:\"uuid\",check:\"string_format\",abort:!1,version:\"v6\",...y(t)})}function ef(e,t){return new e({type:\"string\",format:\"uuid\",check:\"string_format\",abort:!1,version:\"v7\",...y(t)})}function tf(e,t){return new e({type:\"string\",format:\"url\",check:\"string_format\",abort:!1,...y(t)})}function rf(e,t){return new e({type:\"string\",format:\"emoji\",check:\"string_format\",abort:!1,...y(t)})}function nf(e,t){return new e({type:\"string\",format:\"nanoid\",check:\"string_format\",abort:!1,...y(t)})}function of(e,t){return new e({type:\"string\",format:\"cuid\",check:\"string_format\",abort:!1,...y(t)})}function sf(e,t){return new e({type:\"string\",format:\"cuid2\",check:\"string_format\",abort:!1,...y(t)})}function cf(e,t){return new e({type:\"string\",format:\"ulid\",check:\"string_format\",abort:!1,...y(t)})}function af(e,t){return new e({type:\"string\",format:\"xid\",check:\"string_format\",abort:!1,...y(t)})}function uf(e,t){return new e({type:\"string\",format:\"ksuid\",check:\"string_format\",abort:!1,...y(t)})}function lf(e,t){return new e({type:\"string\",format:\"ipv4\",check:\"string_format\",abort:!1,...y(t)})}function ff(e,t){return new e({type:\"string\",format:\"ipv6\",check:\"string_format\",abort:!1,...y(t)})}function pf(e,t){return new e({type:\"string\",format:\"cidrv4\",check:\"string_format\",abort:!1,...y(t)})}function df(e,t){return new e({type:\"string\",format:\"cidrv6\",check:\"string_format\",abort:!1,...y(t)})}function hf(e,t){return new e({type:\"string\",format:\"base64\",check:\"string_format\",abort:!1,...y(t)})}function mf(e,t){return new e({type:\"string\",format:\"base64url\",check:\"string_format\",abort:!1,...y(t)})}function gf(e,t){return new e({type:\"string\",format:\"e164\",check:\"string_format\",abort:!1,...y(t)})}function yf(e,t){return new e({type:\"string\",format:\"jwt\",check:\"string_format\",abort:!1,...y(t)})}function xf(e,t){return new e({type:\"string\",format:\"datetime\",check:\"string_format\",offset:!1,local:!1,precision:null,...y(t)})}function _f(e,t){return new e({type:\"string\",format:\"date\",check:\"string_format\",...y(t)})}function wf(e,t){return new e({type:\"string\",format:\"time\",check:\"string_format\",precision:null,...y(t)})}function bf(e,t){return new e({type:\"string\",format:\"duration\",check:\"string_format\",...y(t)})}function kf(e,t){return new e(ql({type:\"number\",checks:[],...y(t)}))}function vf(e,t){return new e({type:\"number\",check:\"number_format\",abort:!1,format:\"safeint\",...y(t)})}function Sf(e){return new e({type:\"unknown\"})}function $f(e,t){return new e({type:\"never\",...y(t)})}function Kn(e,t){return new Os({check:\"less_than\",...y(t),value:e,inclusive:!1})}function wr(e,t){return new Os({check:\"less_than\",...y(t),value:e,inclusive:!0})}function qn(e,t){return new Ts({check:\"greater_than\",...y(t),value:e,inclusive:!1})}function br(e,t){return new Ts({check:\"greater_than\",...y(t),value:e,inclusive:!0})}function Gn(e,t){return new bu({check:\"multiple_of\",...y(t),value:e})}function Wn(e,t){return new vu({check:\"max_length\",...y(t),maximum:e})}function Et(e,t){return new Su({check:\"min_length\",...y(t),minimum:e})}function Hn(e,t){return new $u({check:\"length_equals\",...y(t),length:e})}function Ms(e,t){return new zu({check:\"string_format\",format:\"regex\",...y(t),pattern:e})}function Vs(e){return new Iu({check:\"string_format\",format:\"lowercase\",...y(e)})}function Fs(e){return new Eu({check:\"string_format\",format:\"uppercase\",...y(e)})}function Js(e,t){return new Au({check:\"string_format\",format:\"includes\",...y(t),includes:e})}function Ks(e,t){return new Ou({check:\"string_format\",format:\"starts_with\",...y(t),prefix:e})}function qs(e,t){return new Tu({check:\"string_format\",format:\"ends_with\",...y(t),suffix:e})}function Be(e){return new Pu({check:\"overwrite\",tx:e})}function Gs(e){return Be((t)=>t.normalize(e))}function Ws(){return Be((e)=>e.trim())}function Hs(){return Be((e)=>e.toLowerCase())}function Ys(){return Be((e)=>e.toUpperCase())}function Xs(){return Be((e)=>ka(e))}function zf(e,t,r){return new e({type:\"array\",element:t,...y(r)})}function If(e,t,r){return new e({type:\"custom\",check:\"custom\",fn:t,...y(r)})}function Ef(e,t){let r=pg((n)=>(n.addIssue=(o)=>{if(typeof o===\"string\")n.issues.push(rt(o,n.value,r._zod.def));else{let s=o;if(s.fatal)s.continue=!1;if(s.code??(s.code=\"custom\"),!(\"input\"in s))s.input=n.value;s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),n.issues.push(rt(s))}},e(n.value,n)),t);return r}function pg(e,t){let r=new L({check:\"custom\",...y(t)});return r._zod.check=e,r}function kr(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))if(Object.prototype.propertyIsEnumerable.call(r,n))ue(e,n,r[n]);return e}function ei(e){let t=e?.target??\"draft-2020-12\";if(t===\"draft-4\")t=\"draft-04\";if(t===\"draft-7\")t=\"draft-07\";return{processors:e.processors??{},metadataRegistry:e?.metadata??nt,target:t,unrepresentable:e?.unrepresentable??\"throw\",override:e?.override??(()=>{}),io:e?.io??\"output\",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??\"ref\",reused:e?.reused??\"inline\",intersections:[],deferred:[],external:e?.external??void 0}}function Ze(e,t,r,n,o){let s=typeof t.unrepresentable===\"function\"?t.unrepresentable({zodSchema:e,path:n.path,message:o}):t.unrepresentable;if(s===\"any\")return!1;if(s===void 0||s===\"throw\")throw Error(o);return Object.assign(r,s),!0}function j(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,s=t.seen.get(e);if(s){if(s.count++,r.schemaPath.includes(e))s.cycle=r.path;return s.schema}let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let c=e._zod.toJSONSchema?.();if(c)i.schema=c;else{let u={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,u);else{let p=i.schema,d=t.processors[o.type];if(!d)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);d(e,t,p,u)}let f=e._zod.parent;if(f){if(!i.ref)i.ref=f;j(f,t,u),t.seen.get(f).isParent=!0}}let a=t.metadataRegistry.get(e);if(a)kr(i.schema,a);if(t.io===\"input\"&&G(e))delete i.schema.examples,delete i.schema.default;if(t.io===\"input\"&&\"_prefault\"in i.schema)(n=i.schema).default??(n.default=i.schema._prefault);return delete i.schema._prefault,t.seen.get(e).schema}function Af(e){return e.replace(/~/g,\"~0\").replace(/\\//g,\"~1\")}function ti(e,t){let r=e.seen.get(t);if(!r)throw Error(\"Unprocessed schema. This is a bug in Zod.\");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let i of e.seen.entries()){let c=e.metadataRegistry.get(i[0])?.id;if(c){let a=n.get(c);if(a&&a!==i[0])throw Error(`Duplicate schema id \"${c}\" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(c,i[0])}}let o=(i)=>{let c=e.target===\"draft-2020-12\"?\"$defs\":\"definitions\";if(e.external){let f=e.external.registry.get(i[0])?.id,p=e.external.uri??((h)=>h);if(f)return{ref:p(f)};let d=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=d,{defId:d,ref:`${p(\"__shared\")}#/${c}/${Af(d)}`}}let a=\"#\",l=`${a}/${c}/`;if(i[1]===r&&!i[1].schema.id)return{ref:a};let u=i[1].schema.id??`__schema${e.counter++}`;return{defId:u,ref:l+Af(u)}},s=(i)=>{if(i[1].schema.$ref)return;let c=i[1],{ref:a,defId:l}=o(i);if(c.def={...c.schema},l)c.defId=l;let u=c.schema;for(let f in u)delete u[f];u.$ref=a};if(e.cycles===\"throw\")for(let i of e.seen.entries()){let c=i[1];if(c.cycle)throw Error(`Cycle detected: #/${c.cycle?.join(\"/\")}/<root>\n\nSet the \\`cycles\\` parameter to \\`\"ref\"\\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let c=i[1];if(t===i[0]){s(i);continue}if(e.external){let l=e.external.registry.get(i[0])?.id;if(t!==i[0]&&l){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(c.cycle){s(i);continue}if(c.count>1){if(e.reused===\"ref\")s(i)}}if(e.external)e.sharedDefsExtractedFor=e.external}function Pf(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!==\"object\")return;Pf(n);let o=Object.keys(n);if(o.length!==1||o[0]!==\"type\")return;let s=n.type;for(let i of Array.isArray(s)?s:[s]){if(typeof i!==\"string\")return;if(!r.includes(i))r.push(i)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var Zf=new Set([\"type\",\"properties\",\"required\",\"additionalProperties\"]),Of=[\"oneOf\",\"anyOf\"];function Tf(e){let t=e.additionalProperties;if(t===void 0||t===!1||typeof t!==\"object\"||t===null)return null;return Object.keys(t).length?t:null}function Qs(e){let t=[];for(let s of e){if(typeof s!==\"object\"||s.type!==\"object\")return null;for(let i in s)if(!Zf.has(i))return null;t.push(s)}let r={},n=new Set;for(let s of t){for(let i in s.properties){if(Object.prototype.hasOwnProperty.call(r,i))continue;let c=[];for(let l of t){let u=l.properties?.[i]??Tf(l);if(u===null||u===void 0)continue;if(!c.some((f)=>JSON.stringify(f)===JSON.stringify(u)))c.push(u)}let a=c.length===1?c[0]:Qs(c)??{allOf:c};ue(r,i,a)}for(let i of s.required??[])n.add(i)}let o={type:\"object\",properties:r};if(n.size)o.required=[...n];if(t.every((s)=>s.additionalProperties===!1))o.additionalProperties=!1;else{let s=[];for(let i of t){let c=Tf(i);if(c&&!s.some((a)=>JSON.stringify(a)===JSON.stringify(c)))s.push(c)}if(s.length===1)o.additionalProperties=s[0];else if(s.length>1)o.additionalProperties={allOf:s}}return o}function dg(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of Zf)if(o in e)return;let r=t.filter((o)=>Of.some((s)=>Array.isArray(o[s]))),n=null;if(!r.length)n=Qs(t);else{let o=r[0],s=Of.find((a)=>Array.isArray(o[a]));if(Object.keys(o).length!==1)return;let i=t.filter((a)=>a!==o),c=o[s].map((a)=>Qs([...i,a]));if(c.some((a)=>!a))return;n={[s]:c}}if(!n)return;delete e.allOf,kr(e,n)}function ri(e,t){let r=e.seen.get(t);if(!r)throw Error(\"Unprocessed schema. This is a bug in Zod.\");let n=(c)=>{let a=e.seen.get(c);if(a.ref===null)return;let l=a.def??a.schema,u={...l},f=a.ref;if(a.ref=null,f){n(f);let d=e.seen.get(f),h=d.schema;if(h.$ref&&(e.target===\"draft-07\"||e.target===\"draft-04\"||e.target===\"openapi-3.0\"))l.allOf=l.allOf??[],l.allOf.push(h);else kr(l,h);if(kr(l,u),c._zod.parent===f)for(let x in l){if(x===\"$ref\"||x===\"allOf\")continue;if(!(x in u))delete l[x]}if(h.$ref&&d.def)for(let x in l){if(x===\"$ref\"||x===\"allOf\")continue;if(x in d.def&&JSON.stringify(l[x])===JSON.stringify(d.def[x]))delete l[x]}}let p=c._zod.parent;if(p&&p!==f){n(p);let d=e.seen.get(p);if(d?.schema.$ref){if(l.$ref=d.schema.$ref,d.def)for(let h in l){if(h===\"$ref\"||h===\"allOf\")continue;if(h in d.def&&JSON.stringify(l[h])===JSON.stringify(d.def[h]))delete l[h]}}}e.override({zodSchema:c,jsonSchema:l,path:a.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())n(c[0]);if(e.target!==\"openapi-3.0\")for(let c of e.seen.entries())Pf(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let a of e.seen.values())for(let l of[a.schema,a.def]){let u=l?.allOf;if(!Array.isArray(u))continue;let f=c.get(u);if(f)f.push(l);else c.set(u,[l])}for(let a of e.intersections)for(let l of c.get(a)??[])dg(l)}}let o={};if(e.target===\"draft-2020-12\")o.$schema=\"https://json-schema.org/draft/2020-12/schema\";else if(e.target===\"draft-07\")o.$schema=\"http://json-schema.org/draft-07/schema#\";else if(e.target===\"draft-04\")o.$schema=\"http://json-schema.org/draft-04/schema#\";else if(e.target===\"openapi-3.0\");if(e.external?.uri){let c=e.external.registry.get(t)?.id;if(!c)throw Error(\"Schema is missing an `id` property\");o.$id=e.external.uri(c)}kr(o,r.defId?r.schema:r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;if(s!==void 0&&o.id===s)delete o.id;let i=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let c of e.seen.entries()){let a=c[1];if(a.def&&a.defId){if(a.def.id===a.defId)delete a.def.id;ue(i,a.defId,a.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(i).length>0)if(e.target===\"draft-2020-12\")o.$defs=i;else o.definitions=i;try{let c=JSON.parse(JSON.stringify(o));return Object.defineProperty(c,\"~standard\",{value:{...t[\"~standard\"],jsonSchema:{input:vr(t,\"input\",e.processors),output:vr(t,\"output\",e.processors)}},enumerable:!1,writable:!1}),c}catch(c){throw Error(\"Error converting schema to JSON.\")}}function G(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type===\"transform\")return!0;if(n.type===\"array\")return G(n.element,r);if(n.type===\"set\")return G(n.valueType,r);if(n.type===\"lazy\")return G(n.getter(),r);if(n.type===\"promise\"||n.type===\"optional\"||n.type===\"nonoptional\"||n.type===\"nullable\"||n.type===\"readonly\"||n.type===\"default\"||n.type===\"prefault\"||n.type===\"catch\")return G(n.innerType,r);if(n.type===\"intersection\")return G(n.left,r)||G(n.right,r);if(n.type===\"record\"||n.type===\"map\")return G(n.keyType,r)||G(n.valueType,r);if(n.type===\"pipe\"){if(e._zod.traits.has(\"$ZodCodec\"))return!0;return G(n.in,r)||G(n.out,r)}if(n.type===\"object\"){for(let o in n.shape)if(G(n.shape[o],r))return!0;return!1}if(n.type===\"union\"){for(let o of n.options)if(G(o,r))return!0;return!1}if(n.type===\"tuple\"){for(let o of n.items)if(G(o,r))return!0;if(n.rest&&G(n.rest,r))return!0;return!1}return!1}var Cf=(e,t={})=>(r)=>{let n=ei({...r,processors:t});return j(e,n),ti(n,e),ri(n,e)},vr=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:s}=n??{},i=ei({...o??{},target:s,io:t,processors:r});return j(e,i),ti(i,e),ri(i,e)};var At=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},Ot=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},Df=(e,t)=>{At(e,\"minimum\",t),Ot(e,\"maximum\",t)},jf=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},Lf=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Bf=(e,t)=>{e.mime=e.mime?e.mime.filter((r)=>t.includes(r)):[...t]},Mf=(e,t)=>{if(e.format=t,t.includes(\"int\"))e.isInt=!0},Nf=(e,t)=>At(e,\"minimum\",t.minimum),Uf=(e,t)=>Ot(e,\"maximum\",t.maximum),Rf=(e)=>(t,r)=>{Mf(t,r.format);let[n,o]=e[r.format];At(t,\"minimum\",n),Ot(t,\"maximum\",o)},hg={greater_than:(e,t)=>At(e,t.inclusive?\"minimum\":\"exclusiveMinimum\",t.value),less_than:(e,t)=>Ot(e,t.inclusive?\"maximum\":\"exclusiveMaximum\",t.value),multiple_of:(e,t)=>jf(e,t.value),number_format:Rf(Sn),bigint_format:Rf(_s),min_length:Nf,max_length:Uf,length_equals:(e,t)=>Df(e,t.length),min_size:Nf,max_size:Uf,size_equals:(e,t)=>Df(e,t.size),string_format:(e,t)=>{if(Mf(e,t.format),t.pattern)Lf(e,t.pattern);if(t.format===\"base64\"||t.format===\"base64url\")e.contentEncoding=t.format;if(t.local||t.precision===-1)e.laxFormat=!0},mime_type:(e,t)=>Bf(e,t.mime)};function pe(e){let t={},r=e._zod.def,n=e._zod.traits.has(\"$ZodCheck\")?[e,...r.checks??[]]:r.checks??[];for(let s of n)hg[s._zod.def.check]?.(t,s._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)At(t,\"minimum\",o.minimum);if(o.exclusiveMinimum!==void 0)At(t,\"exclusiveMinimum\",o.exclusiveMinimum);if(o.maximum!==void 0)Ot(t,\"maximum\",o.maximum);if(o.exclusiveMaximum!==void 0)Ot(t,\"exclusiveMaximum\",o.exclusiveMaximum);if(o.multipleOf!==void 0)jf(t,o.multipleOf);if(o.format!==void 0){if(t.format??(t.format=o.format),o.format.includes(\"int\"))t.isInt=!0}if(o.mime)Bf(t,o.mime);for(let s of o.patterns??[])Lf(t,s);return t}var mg={guid:\"uuid\",url:\"uri\",datetime:\"date-time\",json_string:\"json-string\",regex:\"\"},gg=new Map([[Ds,lu],[Bn,fu]]),yg=(e)=>gg.get(e)??e,Vf=(e,t,r,n)=>{let o=r;o.type=\"string\";let{minimum:s,maximum:i,format:c,patterns:a,contentEncoding:l,laxFormat:u}=pe(e);if(typeof s===\"number\")o.minLength=s;if(typeof i===\"number\")o.maxLength=i;if(c){if(o.format=mg[c]??c,o.format===\"\")delete o.format;if(c===\"time\"||u)delete o.format}if(l)o.contentEncoding=l;if(a&&a.size>0){let f=[...a].map(yg);if(f.length===1)o.pattern=f[0].source;else if(f.length>1)o.allOf=[...f.map((p)=>({...t.target===\"draft-07\"||t.target===\"draft-04\"||t.target===\"openapi-3.0\"?{type:\"string\"}:{},pattern:p.source}))]}},Ff=(e,t,r,n)=>{let o=r,{minimum:s,maximum:i,multipleOf:c,exclusiveMaximum:a,exclusiveMinimum:l,isInt:u}=pe(e);o.type=u?\"integer\":\"number\";let f=typeof l===\"number\"&&l>=(s??Number.NEGATIVE_INFINITY),p=typeof a===\"number\"&&a<=(i??Number.POSITIVE_INFINITY),d=t.target===\"draft-04\"||t.target===\"openapi-3.0\";if(f)if(d)o.minimum=l,o.exclusiveMinimum=!0;else o.exclusiveMinimum=l;else if(typeof s===\"number\")o.minimum=s;if(p)if(d)o.maximum=a,o.exclusiveMaximum=!0;else o.exclusiveMaximum=a;else if(typeof i===\"number\")o.maximum=i;if(c){let h=new Set;for(let S of c)if(Number.isFinite(S)&&S!==0)h.add(Math.abs(S));else Ze(e,t,o,n,`A multipleOf divisor of ${S} cannot be represented in JSON Schema`);let[g,...x]=h;if(g!==void 0)o.multipleOf=g;if(x.length)o.allOf=[...o.allOf??[],...x.map((S)=>({multipleOf:S}))]}};var Jf=(e,t,r,n)=>{r.not={}};var Kf=(e,t,r,n)=>{};var qf=(e,t,r,n)=>{let o=e._zod.def,s=fr(o.entries);if(s.length===0){r.not={};return}if(s.every((i)=>typeof i===\"number\"))r.type=\"number\";if(s.every((i)=>typeof i===\"string\"))r.type=\"string\";r.enum=s},Gf=(e,t,r,n)=>{let o=e._zod.def;if(o.values.length===0){r.not={};return}let s=[];for(let i of o.values)if(i===void 0){if(Ze(e,t,r,n,\"Literal `undefined` cannot be represented in JSON Schema\"))return}else if(typeof i===\"bigint\"){if(Ze(e,t,r,n,\"BigInt literals cannot be represented in JSON Schema\"))return;s.push(Number(i))}else s.push(i);if(s.length===0);else if(s.length===1){let i=s[0];if(r.type=i===null?\"null\":typeof i,t.target===\"draft-04\"||t.target===\"openapi-3.0\")r.enum=[i];else r.const=i}else{if(s.every((i)=>typeof i===\"number\"))r.type=\"number\";if(s.every((i)=>typeof i===\"string\"))r.type=\"string\";if(s.every((i)=>typeof i===\"boolean\"))r.type=\"boolean\";if(s.every((i)=>i===null))r.type=\"null\";r.enum=s}};var Wf=(e,t,r,n)=>{Ze(e,t,r,n,\"Custom types cannot be represented in JSON Schema\")};var Hf=(e,t,r,n)=>{Ze(e,t,r,n,\"Transforms cannot be represented in JSON Schema\")};var Yf=(e,t,r,n)=>{let o=r,s=e._zod.def,{minimum:i,maximum:c}=pe(e);if(typeof i===\"number\")o.minItems=i;if(typeof c===\"number\")o.maxItems=c;o.type=\"array\",o.items=j(s.element,t,{...n,path:[...n.path,\"items\"]})};function ni(e){let t=e._zod.def;if(t.type===\"pipe\"&&t.in._zod.traits.has(\"$ZodTransform\"))return ni(t.out);if(t.type===\"catch\")return ni(t.innerType);return e._zod.optin}var Xf=(e,t,r,n)=>{let o=r,s=e._zod.def,i=s.shape;if(Object.getOwnPropertySymbols(i).length&&Ze(e,t,o,n,\"Symbol keys cannot be represented in JSON Schema\"))return;o.type=\"object\",o.properties={};for(let l in i)ue(o.properties,l,j(i[l],t,{...n,path:[...n.path,\"properties\",l]}));let a=[];for(let l of Object.keys(i)){let u=s.shape[l];if(t.io===\"input\"?ni(u)===void 0:u._zod.optout===void 0)a.push(l)}if(a.length>0)o.required=a;if(s.catchall?._zod.def.type===\"never\")o.additionalProperties=!1;else if(!s.catchall){if(t.io===\"output\")o.additionalProperties=!1}else if(s.catchall)o.additionalProperties=j(s.catchall,t,{...n,path:[...n.path,\"additionalProperties\"]})},Qf=(e,t,r,n)=>{let o=e._zod.def,s=o.inclusive===!1,i=o.options.map((c,a)=>j(c,t,{...n,path:[...n.path,s?\"oneOf\":\"anyOf\",a]}));if(s)r.oneOf=i;else r.anyOf=i},ep=(e,t,r,n)=>{let o=e._zod.def,s=j(o.left,t,{...n,path:[...n.path,\"allOf\",0]}),i=j(o.right,t,{...n,path:[...n.path,\"allOf\",1]}),c=(l)=>(\"allOf\"in l)&&Object.keys(l).length===1,a=[...c(s)?s.allOf:[s],...c(i)?i.allOf:[i]];r.allOf=a,t.intersections.push(a)};var tp=(e,t,r,n)=>{let o=e._zod.def,s=j(o.innerType,t,n),i=t.seen.get(e);if(t.target===\"openapi-3.0\")i.ref=o.innerType,r.nullable=!0;else r.anyOf=[s,{type:\"null\"}]},rp=(e,t,r,n)=>{let o=e._zod.def;j(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},oi=Symbol();function np(e,t,r,n,o){let s=!1,i=JSON.stringify(e,(c,a)=>{if(typeof a!==\"bigint\")return a;return s=!0,null});if(!s)return JSON.parse(i);return Ze(t,r,n,o,\"BigInt defaults cannot be represented in JSON Schema\"),oi}var op=(e,t,r,n)=>{let o=e._zod.def;j(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let i=np(o.defaultValue,e,t,r,n);if(i!==oi)r.default=i},sp=(e,t,r,n)=>{let o=e._zod.def;j(o.innerType,t,n);let s=t.seen.get(e);if(s.ref=o.innerType,t.io!==\"input\")return;let i=np(o.defaultValue,e,t,r,n);if(i!==oi)r._prefault=i},ip=(e,t,r,n)=>{let o=e._zod.def;j(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{Ze(e,t,r,n,\"Dynamic catch values are not supported in JSON Schema\");return}r.default=i},cp=(e,t,r,n)=>{let o=e._zod.def,s=o.in._zod.traits.has(\"$ZodTransform\"),i=t.io===\"input\"?s?o.out:o.in:o.out;j(i,t,n);let c=t.seen.get(e);c.ref=i},ap=(e,t,r,n)=>{let o=e._zod.def;j(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,r.readOnly=!0};var si=(e,t,r,n)=>{let o=e._zod.def;j(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType};var up=new WeakSet([Object.prototype,Error.prototype]);function Yn(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var $g=(e,t)=>{Ua.init(e,t),e.name=\"ZodError\";let r=Object.getPrototypeOf(e);if(up.has(r))return;up.add(r),Yn(r,\"format\",(n)=>(o)=>ja(n,o)),Yn(r,\"flatten\",(n)=>(o)=>Ra(n,o)),Yn(r,\"addIssue\",(n)=>(o)=>{n.issues.push(o),n.message=JSON.stringify(n.issues,pr,2)}),Yn(r,\"addIssues\",(n)=>(o)=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,pr,2)}),Object.defineProperty(r,\"isEmpty\",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var se=m(\"ZodError\",$g,void 0,{Parent:Error});var lp=Pn(se),fp=Zn(se),pp=Cn(se),dp=Dn(se),hp=Ba(se),mp=Ma(se),gp=Va(se),yp=Fa(se),xp=Ja(se),_p=Ka(se),wp=qa(se),bp=Ga(se);function Ig(){if(!oe.localeError)fe(Bs())}function ai(){if(!oe.memoizer)fe({memoizer:Fl()})}var O=m(\"ZodType\",(e,t)=>(Ig(),A.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(ne(t,{checks:[...t.checks??[],...e.map((r)=>typeof r===\"function\"?{_zod:{check:r,def:{check:\"custom\"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return ve(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(vy(e,t))},superRefine(e,t){return this.check(Sy(e,t))},overwrite(e){return this.check(Be(e))},optional(){return vp(this)},exactOptional(){return ly(this)},nullable(){return Sp(this)},nullish(){return vp(Sp(this))},nonoptional(e){return gy(this,e)},array(){return Sr(this)},or(e){return li([this,e])},and(e){return sy(this,e)},transform(e){return $p(this,uy(e))},default(e){return dy(this,e)},prefault(e){return my(this,e)},catch(e){return xy(this,e)},pipe(e){return $p(this,e)},readonly(){return by(this)},describe(e){let t=this.clone();return nt.add(t,{description:e}),t},meta(...e){if(e.length===0)return nt.get(this);let t=this.clone();return nt.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get \"~standard\"(){return On(this,\"~standard\",{...Cs(this),jsonSchema:{input:vr(this,\"input\"),output:vr(this,\"output\")}})},set \"~standard\"(e){Pe(this,\"~standard\",e)},parse:function e(t,r){return lp(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await fp(this,t,r,{callee:e})},safeParse(e,t){return pp(this,e,t)},async safeParseAsync(e,t){return dp(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Pe(this,\"spa\",e)},validate(e,t){return Ss(this,e,t)},validateAsync(e,t){return $s(this,e,t)},encode:function e(t,r){return hp(this,t,r,{callee:e})},decode:function e(t,r){return mp(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await gp(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await yp(this,t,r,{callee:e})},safeEncode(e,t){return xp(this,e,t)},safeDecode(e,t){return _p(this,e,t)},async safeEncodeAsync(e,t){return wp(this,e,t)},async safeDecodeAsync(e,t){return bp(this,e,t)},toJSONSchema(e){return Cf(this,{})(e)},get description(){return nt.get(this)?.description},get _def(){return this._zod.def}}),zp=m(\"_ZodString\",(e,t)=>{Ln.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vf(e,r,n,o)},Ta({format:(e)=>pe(e).format??null,minLength:(e)=>pe(e).minimum??null,maxLength:(e)=>pe(e).maximum??null},{regex(...e){return this.check(Ms(...e))},includes(...e){return this.check(Js(...e))},startsWith(...e){return this.check(Ks(...e))},endsWith(...e){return this.check(qs(...e))},min(...e){return this.check(Et(...e))},max(...e){return this.check(Wn(...e))},length(...e){return this.check(Hn(...e))},nonempty(...e){return this.check(Et(1,...e))},lowercase(e){return this.check(Vs(e))},uppercase(e){return this.check(Fs(e))},trim(){return this.check(Ws())},normalize(...e){return this.check(Gs(...e))},toLowerCase(){return this.check(Hs())},toUpperCase(){return this.check(Ys())},slugify(){return this.check(Xs())}})),Eg=m(\"ZodString\",(e,t)=>{Ln.init(e,t),zp.init(e,t)},{email(e){return this.check(Wl(Zg,e))},url(e){return this.check(tf(Dg,e))},jwt(e){return this.check(yf(Hg,e))},emoji(e){return this.check(rf(Ng,e))},guid(e){return this.check(Hl(Cg,e))},uuid(e){return this.check(Yl(Xn,e))},uuidv4(e){return this.check(Xl(Xn,e))},uuidv6(e){return this.check(Ql(Xn,e))},uuidv7(e){return this.check(ef(Xn,e))},nanoid(e){return this.check(nf(Ug,e))},cuid(e){return this.check(of(Rg,e))},cuid2(e){return this.check(sf(jg,e))},ulid(e){return this.check(cf(Lg,e))},base64(e){return this.check(hf(qg,e))},base64url(e){return this.check(mf(Gg,e))},xid(e){return this.check(af(Bg,e))},ksuid(e){return this.check(uf(Mg,e))},ipv4(e){return this.check(lf(Vg,e))},ipv6(e){return this.check(ff(Fg,e))},cidrv4(e){return this.check(pf(Jg,e))},cidrv6(e){return this.check(df(Kg,e))},e164(e){return this.check(gf(Wg,e))},datetime(e){return this.check(xf(Ag,e))},date(e){return this.check(_f(Og,e))},time(e){return this.check(wf(Tg,e))},duration(e){return this.check(bf(Pg,e))}});function ui(e){return Gl(Eg,e)}var E=m(\"ZodStringFormat\",(e,t)=>{I.init(e,t),zp.init(e,t)}),Ag=m(\"ZodISODateTime\",(e,t)=>{sl.init(e,t),E.init(e,t)}),Og=m(\"ZodISODate\",(e,t)=>{il.init(e,t),E.init(e,t)}),Tg=m(\"ZodISOTime\",(e,t)=>{cl.init(e,t),E.init(e,t)}),Pg=m(\"ZodISODuration\",(e,t)=>{al.init(e,t),E.init(e,t)}),Zg=m(\"ZodEmail\",(e,t)=>{Gu.init(e,t),E.init(e,t)});var Cg=m(\"ZodGUID\",(e,t)=>{Ku.init(e,t),E.init(e,t)});var Xn=m(\"ZodUUID\",(e,t)=>{qu.init(e,t),E.init(e,t)});var Dg=m(\"ZodURL\",(e,t)=>{Yu.init(e,t),E.init(e,t)});var Ng=m(\"ZodEmoji\",(e,t)=>{Xu.init(e,t),E.init(e,t)});var Ug=m(\"ZodNanoID\",(e,t)=>{Qu.init(e,t),E.init(e,t)});var Rg=m(\"ZodCUID\",(e,t)=>{el.init(e,t),E.init(e,t)});var jg=m(\"ZodCUID2\",(e,t)=>{tl.init(e,t),E.init(e,t)});var Lg=m(\"ZodULID\",(e,t)=>{rl.init(e,t),E.init(e,t)});var Bg=m(\"ZodXID\",(e,t)=>{nl.init(e,t),E.init(e,t)});var Mg=m(\"ZodKSUID\",(e,t)=>{ol.init(e,t),E.init(e,t)});var Vg=m(\"ZodIPv4\",(e,t)=>{ul.init(e,t),E.init(e,t)});var Fg=m(\"ZodIPv6\",(e,t)=>{fl.init(e,t),E.init(e,t)});var Jg=m(\"ZodCIDRv4\",(e,t)=>{pl.init(e,t),E.init(e,t)});var Kg=m(\"ZodCIDRv6\",(e,t)=>{dl.init(e,t),E.init(e,t)});var qg=m(\"ZodBase64\",(e,t)=>{ml.init(e,t),E.init(e,t)});var Gg=m(\"ZodBase64URL\",(e,t)=>{gl.init(e,t),E.init(e,t)});var Wg=m(\"ZodE164\",(e,t)=>{yl.init(e,t),E.init(e,t)});var Hg=m(\"ZodJWT\",(e,t)=>{xl.init(e,t),E.init(e,t)});var Ip=m(\"ZodNumber\",(e,t)=>{Ns.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ff(e,r,n,o),e.isFinite=!0},Ta({minValue:(e)=>{let{minimum:t,exclusiveMinimum:r}=pe(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:r}=pe(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:r}=pe(e);return!!t||!!r?.some(Number.isSafeInteger)},format:(e)=>pe(e).format??null},{gt(e,t){return this.check(qn(e,t))},gte(e,t){return this.check(br(e,t))},min(e,t){return this.check(br(e,t))},lt(e,t){return this.check(Kn(e,t))},lte(e,t){return this.check(wr(e,t))},max(e,t){return this.check(wr(e,t))},int(e){return this.check(kp(e))},safe(e){return this.check(kp(e))},positive(e){return this.check(qn(0,e))},nonnegative(e){return this.check(br(0,e))},negative(e){return this.check(Kn(0,e))},nonpositive(e){return this.check(wr(0,e))},multipleOf(e,t){return this.check(Gn(e,t))},step(e,t){return this.check(Gn(e,t))},finite(){return this}}));function Tt(e){return kf(Ip,e)}var Yg=m(\"ZodNumberFormat\",(e,t)=>{_l.init(e,t),Ip.init(e,t)});function kp(e){return vf(Yg,e)}var Xg=m(\"ZodUnknown\",(e,t)=>{wl.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Kf(e,r,n,o)});function Qn(){return Sf(Xg)}var Qg=m(\"ZodNever\",(e,t)=>{bl.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jf(e,r,n,o)});function ey(e){return $f(Qg,e)}var ty=m(\"ZodArray\",(e,t)=>{ai(),kl.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Yf(e,r,n,o),e.element=t.element},{min(e,t){return this.check(Et(e,t))},nonempty(e){return this.check(Et(1,e))},max(e,t){return this.check(Wn(e,t))},length(e,t){return this.check(Hn(e,t))},unwrap(){return this.element}});function Sr(e,t){return zf(ty,e,t)}var ry=m(\"ZodObject\",(e,t)=>{ai(),$l.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xf(e,r,n,o),Pm(e,\"shape\",(r)=>r._zod.def.shape,!1)},{keyof(){return iy(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(ne(this._zod.def,{catchall:e}))},passthrough(){return this.clone(ne(this._zod.def,{catchall:Qn()}))},loose(){return this.clone(ne(this._zod.def,{catchall:Qn()}))},strict(){return this.clone(ne(this._zod.def,{catchall:ey()}))},strip(){return this.clone(ne(this._zod.def,{catchall:void 0}))},extend(e){return Sm(this,e)},safeExtend(e){return $m(this,e)},merge(e){return zm(this,e)},pick(e){return km(this,e)},omit(e){return vm(this,e)},partial(...e){return Ia(Op,this,e[0])},exactPartial(...e){return Ia(Tp,this,e[0],\"exactPartial\")},required(...e){return Im(Pp,this,e[0])}});function Pt(e,t){let r={type:\"object\",shape:e??{},...y(t)};return new ry(r)}var Ep=m(\"ZodUnion\",(e,t)=>{Us.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qf(e,r,n,o),e.options=t.options});function li(e,t){return new Ep({type:\"union\",options:e,...y(t)})}var ny=m(\"ZodDiscriminatedUnion\",(e,t)=>{Ep.init(e,t),zl.init(e,t)});function Ap(e,t,r){return new ny({type:\"union\",options:t,discriminator:e,...y(r)})}var oy=m(\"ZodIntersection\",(e,t)=>{Il.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ep(e,r,n,o)});function sy(e,t){return new oy({type:\"intersection\",left:e,right:t})}var ci=m(\"ZodEnum\",(e,t)=>{El.init(e,t),O.init(e,t),e._zod.processJSONSchema=(n,o,s)=>qf(e,n,o,s),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let s={};for(let i of n)if(r.has(i))s[i]=t.entries[i];else throw Error(`Key ${i} not found in enum`);return new ci({...t,checks:[],...y(o),entries:s})},e.exclude=(n,o)=>{let s={...t.entries};for(let i of n)if(r.has(i))delete s[i];else throw Error(`Key ${i} not found in enum`);return new ci({...t,checks:[],...y(o),entries:s})}});function iy(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new ci({type:\"enum\",entries:r,...y(t)})}var cy=m(\"ZodLiteral\",(e,t)=>{Al.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gf(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,\"value\",{get(){if(t.values.length>1)throw Error(\"This schema contains multiple valid literal values. Use `.values` instead.\");return t.values[0]}})});function Zt(e,t){return new cy({type:\"literal\",values:Array.isArray(e)?e:[e],...y(t)})}var ay=m(\"ZodTransform\",(e,t)=>{ai(),Ol.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hf(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction===\"backward\")throw new mr(e.constructor.name);r.addIssue=(s)=>{if(typeof s===\"string\")r.issues.push(rt(s,r.value,t));else{let i=s;if(i.fatal)i.continue=!1;if(i.code??(i.code=\"custom\"),!(\"input\"in i))i.input=r.value;i.inst??(i.inst=e),r.issues.push(rt(i))}};let o=t.transform(r.value,r);if(o instanceof Promise)return o.then((s)=>(r.value=s,r));return r.value=o,r}});function uy(e){return new ay({type:\"transform\",transform:e})}var Op=m(\"ZodOptional\",(e,t)=>{Rs.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>si(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function vp(e){return new Op({type:\"optional\",innerType:e})}var Tp=m(\"ZodExactOptional\",(e,t)=>{Tl.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>si(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ly(e){return new Tp({type:\"optional\",innerType:e})}var fy=m(\"ZodNullable\",(e,t)=>{Pl.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>tp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Sp(e){return new fy({type:\"nullable\",innerType:e})}var py=m(\"ZodDefault\",(e,t)=>{Zl.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>op(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function dy(e,t){return new py({type:\"default\",innerType:e,get defaultValue(){return typeof t===\"function\"?t():ys(t)}})}var hy=m(\"ZodPrefault\",(e,t)=>{Cl.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function my(e,t){return new hy({type:\"prefault\",innerType:e,get defaultValue(){return typeof t===\"function\"?t():ys(t)}})}var Pp=m(\"ZodNonOptional\",(e,t)=>{Dl.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>rp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function gy(e,t){return new Pp({type:\"nonoptional\",innerType:e,...y(t)})}var yy=m(\"ZodCatch\",(e,t)=>{Nl.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ip(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function xy(e,t){return new yy({type:\"catch\",innerType:e,catchValue:typeof t===\"function\"?t:Pa(t)})}var _y=m(\"ZodPipe\",(e,t)=>{Ul.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>cp(e,r,n,o),e.in=t.in,e.out=t.out});function $p(e,t){return new _y({type:\"pipe\",in:e,out:t})}var wy=m(\"ZodReadonly\",(e,t)=>{Rl.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ap(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function by(e){return new wy({type:\"readonly\",innerType:e})}var ky=m(\"ZodCustom\",(e,t)=>{jl.init(e,t),O.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wf(e,r,n,o)});function vy(e,t={}){return If(ky,e,t)}function Sy(e,t){return Ef(e,t)}var zr=32,oo=new Set([\"__proto__\",\"constructor\",\"prototype\"]),$y=li([ui().min(1).max(512).refine((e)=>!oo.has(e),\"unsafe path key\"),Tt().int().nonnegative()]),$r=Sr($y).min(1).max(zr);function Ir(e,t=0){if(t>zr)return!1;if(e===null||typeof e===\"boolean\"||typeof e===\"string\")return!0;if(typeof e===\"number\")return Number.isFinite(e);if(Array.isArray(e))return e.every((n)=>Ir(n,t+1));if(typeof e!==\"object\")return!1;let r=Object.getPrototypeOf(e);if(r!==Object.prototype&&r!==null)return!1;return Object.entries(e).every(([n,o])=>!oo.has(n)&&Ir(o,t+1))}var Zp=Qn().refine(Ir,\"value must be safe JSON\"),zy=Ap(\"type\",[Pt({type:Zt(\"set\"),path:$r,value:Zp}),Pt({type:Zt(\"delete\"),path:$r}),Pt({type:Zt(\"insert\"),path:$r,index:Tt().int().nonnegative(),values:Sr(Zp).min(1)}),Pt({type:Zt(\"increment\"),path:$r,by:Tt().finite()}),Pt({type:Zt(\"text\"),path:$r,index:Tt().int().nonnegative(),deleteCount:Tt().int().nonnegative().optional(),insert:ui().optional()})]).superRefine((e,t)=>{if(e.type===\"text\"&&(e.deleteCount??0)===0&&(e.insert??\"\").length===0)t.addIssue({code:\"custom\",message:\"text operation must insert or delete content\"})});function ro(e){if(Array.isArray(e)){let t=new re;return t.insert(0,e.map(ro)),t}if(e!==null&&typeof e===\"object\"){let t=new q;for(let[r,n]of Object.entries(e))t.set(r,ro(n));return t}return e}function fi(e,t=0){if(t>zr)throw Error(\"room document exceeds the maximum nesting depth\");if(e instanceof q){let r=Object.create(null);for(let[n,o]of e.entries()){if(oo.has(n))throw Error(`room document contains unsafe key \"${n}\"`);r[n]=fi(o,t+1)}return r}if(e instanceof re)return e.toArray().map((r)=>fi(r,t+1));if(e instanceof ae)return e.toString();if(!Ir(e))throw Error(\"room document contains a non-JSON value\");return e}function so(e){return fi(e.getMap(\"root\"))}function B(e){return e.map(String).join(\".\")}function Up(e){if(e.length===0||e.length>zr)throw Error(`room path must contain 1 to ${zr} segments`);for(let t of e)if(typeof t===\"string\"){if(t.length===0||t.length>512||oo.has(t))throw Error(`invalid room path segment \"${t}\"`)}else if(!Number.isInteger(t)||t<0)throw Error(`invalid room array index ${String(t)}`)}function Rp(e,t,r){if(e instanceof q){if(typeof t!==\"string\")throw Error(`expected an object key at \"${B(r)}\"`);if(!e.has(t))throw Error(`room path does not exist: \"${B(r)}\"`);return e.get(t)}if(typeof t!==\"number\"||t>=e.length)throw Error(`invalid array index at \"${B(r)}\"`);return e.get(t)}function io(e,t){Up(t);let r=e.getMap(\"root\");for(let n=0;n<t.length-1;n+=1){if(!(r instanceof q)&&!(r instanceof re))throw Error(`room path crosses a scalar at \"${B(t.slice(0,n+1))}\"`);r=Rp(r,t[n],t.slice(0,n+1))}if(!(r instanceof q)&&!(r instanceof re))throw Error(`room path parent is not a container: \"${B(t)}\"`);return{parent:r,key:t[t.length-1]}}function eo(e,t){let{parent:r,key:n}=io(e,t);return Rp(r,n,t)}function Cp(e,t,r){let{parent:n,key:o}=io(e,t),s=ro(r);if(n instanceof q){if(typeof o!==\"string\")throw Error(`expected an object key at \"${B(t)}\"`);n.set(o,s);return}if(typeof o!==\"number\"||o>=n.length)throw Error(`invalid array index at \"${B(t)}\"`);n.delete(o,1),n.insert(o,[s])}function Iy(e,t){let{parent:r,key:n}=io(e,t);if(r instanceof q){if(typeof n!==\"string\")throw Error(`expected an object key at \"${B(t)}\"`);if(!r.has(n))throw Error(`room path does not exist: \"${B(t)}\"`);r.delete(n);return}if(typeof n!==\"number\"||n>=r.length)throw Error(`invalid array index at \"${B(t)}\"`);r.delete(n,1)}function Dp(e,t){e.transact(()=>{for(let r of t)switch(r.type){case\"set\":Cp(e,r.path,r.value);break;case\"delete\":Iy(e,r.path);break;case\"insert\":{Up(r.path);let n=eo(e,r.path);if(!(n instanceof re))throw Error(`insert target is not an array: \"${B(r.path)}\"`);if(r.index>n.length)throw Error(`insert index is outside the array: \"${B(r.path)}\"`);n.insert(r.index,r.values.map(ro));break}case\"increment\":{let n=eo(e,r.path);if(typeof n!==\"number\"||!Number.isFinite(n))throw Error(`increment target is not a finite number: \"${B(r.path)}\"`);let o=n+r.by;if(!Number.isFinite(o))throw Error(`increment result is not finite: \"${B(r.path)}\"`);Cp(e,r.path,o);break}case\"text\":{let n=eo(e,r.path),o;if(n instanceof ae)o=n;else if(typeof n===\"string\"){o=new ae(n);let{parent:i,key:c}=io(e,r.path);if(i instanceof q&&typeof c===\"string\")i.set(c,o);else if(i instanceof re&&typeof c===\"number\"&&c<i.length)i.delete(c,1),i.insert(c,[o]);else throw Error(`invalid text path: \"${B(r.path)}\"`)}else throw Error(`text target is not a string: \"${B(r.path)}\"`);let s=r.deleteCount??0;if(r.index>o.length||r.index+s>o.length)throw Error(`text range is outside the string: \"${B(r.path)}\"`);if(s>0)o.delete(r.index,s);if(r.insert)o.insert(r.index,r.insert);break}}})}function Ey(e,t){let r=Sr(zy).min(1).parse(t),n=new ke({gc:!0});try{gn(n,St(e)),Dp(n,r),so(n)}finally{n.destroy()}let o=Nc(e);return Dp(e,r),St(e,o)}function no(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)||Array.isArray(t))return Array.isArray(e)&&Array.isArray(t)&&e.length===t.length&&e.every((o,s)=>no(o,t[s]));if(e===null||t===null||typeof e!==\"object\"||typeof t!==\"object\")return!1;let r=Object.keys(e),n=Object.keys(t);return r.length===n.length&&r.every((o)=>Object.hasOwn(t,o)&&no(e[o],t[o]))}function Ay(e,t){if(no(e,t))return!0;if(e!==null&&t!==null&&!Array.isArray(e)&&!Array.isArray(t)&&typeof e===\"object\"&&typeof t===\"object\"&&Object.hasOwn(e,\"id\")&&Object.hasOwn(t,\"id\")){let r=e.id;return(typeof r===\"string\"||typeof r===\"number\")&&Object.is(r,t.id)}return!1}function pi(e){if(e!==null&&!Array.isArray(e)&&typeof e===\"object\"&&(typeof e.id===\"string\"||typeof e.id===\"number\"))return`id:${typeof e.id}:${String(e.id)}`;return`value:${JSON.stringify(e)}`}function Np(e){let t=[],r=new Set;for(let n of e){if(n===null||Array.isArray(n)||typeof n!==\"object\"||typeof n.id!==\"string\"&&typeof n.id!==\"number\")return null;let o=pi(n);if(r.has(o))return null;r.add(o),t.push(o)}return t}function Oy(e,t){let r=new Map;for(let s=0;s<t.length;s+=1){let i=pi(t[s]),c=r.get(i);if(c)c.push(s);else r.set(i,[s])}let n=[],o=-1;for(let s=0;s<e.length;s+=1){let i=r.get(pi(e[s]));while(i?.length&&i[0]<=o)i.shift();let c=i?.shift();if(c===void 0)continue;if(!Ay(e[s],t[c]))continue;n.push([s,c]),o=c}return n}function Ty(e,t){try{return eo(e,t)}catch{return}}function to(e,t,r,n,o){if(no(t,r))return;if(t!==null&&r!==null&&!Array.isArray(t)&&!Array.isArray(r)&&typeof t===\"object\"&&typeof r===\"object\"){for(let s of Object.keys(t))if(!Object.hasOwn(r,s))o.push({type:\"delete\",path:[...n,s]});for(let[s,i]of Object.entries(r))if(!Object.hasOwn(t,s))o.push({type:\"set\",path:[...n,s],value:i});else to(e,t[s],i,[...n,s],o);return}if(Array.isArray(t)&&Array.isArray(r)){let s=Np(t),i=Np(r),c=s!==null&&i!==null&&(s.length!==i.length||s.some((f,p)=>f!==i[p]));if(t.length===r.length&&!c){for(let f=0;f<r.length;f+=1)to(e,t[f],r[f],[...n,f],o);return}let a=0,l=0,u=0;for(let[f,p]of[...Oy(t,r),[t.length,r.length]]){let d=f-a;for(let g=0;g<d;g+=1)o.push({type:\"delete\",path:[...n,u]});let h=r.slice(l,p);if(h.length>0)o.push({type:\"insert\",path:n,index:u,values:h}),u+=h.length;if(f<t.length&&p<r.length)to(e,t[f],r[p],[...n,u],o),u+=1;a=f+1,l=p+1}return}if(typeof t===\"string\"&&typeof r===\"string\"&&Ty(e,n)instanceof ae){let s=0;while(s<t.length&&s<r.length&&t[s]===r[s])s+=1;let i=0;while(i<t.length-s&&i<r.length-s&&t[t.length-1-i]===r[r.length-1-i])i+=1;o.push({type:\"text\",path:n,index:s,deleteCount:t.length-s-i,insert:r.slice(s,r.length-i)});return}o.push({type:\"set\",path:n,value:r})}function jp(e,t){let r=so(e),n=structuredClone(r),o=t(n);if(o!==null&&(typeof o===\"object\"||typeof o===\"function\")&&typeof o.then===\"function\")throw Error(\"room change callback must be synchronous\");if(!Ir(n)||Array.isArray(n))throw Error(\"room state must be a safe JSON object\");let s=[];if(to(e,r,n,[],s),s.length>0)Ey(e,s);return s}function Lp(e){let t=\"\";for(let r=0;r<e.length;r+=8192)t+=String.fromCharCode(...e.subarray(r,r+8192));return btoa(t)}function Py(e){return Uint8Array.from(atob(e),(t)=>t.charCodeAt(0))}class co{handlers=new Map;on(e,t){let r=this.handlers.get(e)??new Set;return r.add(t),this.handlers.set(e,r),()=>r.delete(t)}emit(e,t){for(let r of this.handlers.get(e)??[])r(t)}}class Bp extends co{socket;rooms=new Map;channels=new Map;pending=new Map;nextId=0;opening;retry;stopped=!1;me;async open(){if(this.socket?.readyState===WebSocket.OPEN)return;if(this.opening)return this.opening;let e=location.pathname.match(/^\\/p\\/([^/.]+)/);if(!e)throw Error(\"Realtime rooms require a Swarm page\");let t=new URL(\"/@swarm/realtime\",location.href);return t.protocol=location.protocol===\"https:\"?\"wss:\":\"ws:\",t.searchParams.set(\"pageId\",decodeURIComponent(e[1])),this.opening=new Promise((r,n)=>{let o=new WebSocket(t);this.socket=o,o.onopen=()=>{this.opening=void 0,r()},o.onerror=()=>n(Error(\"Realtime connection failed\")),o.onmessage=(s)=>{let i=JSON.parse(s.data),c=i;if(c.seq)o.send(JSON.stringify({ack:c.seq}));if(c.type===\"hello\")this.me=c.me;if(c.type===\"room\")this.rooms.get(c.name??\"\")?.receive(i);if(c.type===\"presence\")this.rooms.get(c.name??\"\")?.receivePresence(c.peers);if(c.type===\"channel\")this.channels.get(c.name??\"\")?.emit(\"message\",c.data);if(c.type===\"deleted\")this.rooms.get(c.name??\"\")?.deleted();if(c.id!==void 0){let a=this.pending.get(c.id);if(a)if(clearTimeout(a.timer),this.pending.delete(c.id),c.type===\"error\")a.reject(Error(c.error));else a.resolve(c)}},o.onclose=()=>{this.opening=void 0,n(Error(\"Realtime connection closed\"));for(let s of this.pending.values())clearTimeout(s.timer),s.reject(Error(\"Realtime connection closed\"));if(this.pending.clear(),!this.stopped)this.retry=setTimeout(()=>{this.reconnect()},1000)}}),this.opening}async reconnect(){try{await this.open();for(let e of this.rooms.values())await e.join(!0);for(let e of this.channels.keys())await this.request({op:\"subscribe\",name:e})}catch(e){for(let t of this.rooms.values())t.emit(\"error\",e)}}async request(e){await this.open();let t=++this.nextId;return new Promise((r,n)=>{let o=setTimeout(()=>{this.pending.delete(t),n(Error(\"Realtime request timed out\"))},15000);this.pending.set(t,{resolve:r,reject:n,timer:o}),this.socket.send(JSON.stringify({...e,id:t}))})}close(){this.stopped=!0,clearTimeout(this.retry),this.socket?.close()}}class Mp extends co{connection;name;ydoc=new ke({gc:!0});generation=\"\";stale=!1;bytes=0;me;ready;writes=Promise.resolve();lastWrite=Promise.resolve();peers=[];presenceData={};presenceTimer;closed=!1;schemaVersion;presence;constructor(e,t,r){super();this.connection=e;this.name=t;this.schemaVersion=r.schemaVersion??1;let n=this;this.presence={set(o){if(n.presenceData=structuredClone(o),!n.presenceTimer)n.presenceTimer=setTimeout(()=>{n.presenceTimer=void 0,e.request({op:\"presence\",name:t,data:n.presenceData}).catch((s)=>n.emit(\"error\",s))},50)},get peers(){return n.peers}},this.observe()}get state(){return so(this.ydoc)}observe(){this.ydoc.on(\"update\",(e,t)=>{if(this.emit(\"change\",this.state),t===\"remote\"||!this.generation||this.closed)return;if(this.connection.socket?.readyState!==WebSocket.OPEN)return;let r=Lp(St(this.ydoc)),n=this.generation,o=this.writes.then(async()=>{try{let s=await this.connection.request({op:\"update\",name:this.name,generation:n,schemaVersion:this.schemaVersion,snapshot:r});if(s.room)this.receive(s.room)}catch(s){if(this.connection.socket?.readyState===WebSocket.OPEN){let i=await this.connection.request({op:\"join\",name:this.name,schemaVersion:this.schemaVersion});this.receive(i.room,!0)}throw this.emit(\"error\",s),s}});this.lastWrite=o,this.writes=o.catch(()=>{})})}async join(e=!1){if(this.ready&&!e)return this.ready;return this.ready=(async()=>{let t=this.generation,r=await this.connection.request({op:\"join\",name:this.name,schemaVersion:this.schemaVersion});if(this.me=r.me,this.receive(r.room),this.receivePresence(r.peers),e&&t===this.generation&&!this.stale){let n=await this.connection.request({op:\"update\",name:this.name,schemaVersion:this.schemaVersion,generation:t,snapshot:Lp(St(this.ydoc))});this.receive(n.room)}if(e)this.presence.set(this.presenceData)})(),this.ready}receive(e,t=!1){if(this.closed||!e)return;let r=t||this.generation!==\"\"&&e.generation!==this.generation;if(this.generation=e.generation,this.stale=e.schemaVersion!==this.schemaVersion,this.bytes=e.bytes,r)this.ydoc.destroy(),this.ydoc=new ke({gc:!0}),this.observe();if(gn(this.ydoc,Py(e.snapshot),\"remote\"),r)this.emit(\"reset\",this.state)}receivePresence(e=[]){this.peers=e,this.emit(\"presence\",e)}deleted(){this.closed=!0,this.emit(\"error\",Error(\"Room owner was deleted\")),this.ydoc.destroy()}async change(e){if(this.closed)throw Error(\"Room is closed\");if(this.stale)throw Error(\"Room schema is stale. Read the state and reset explicitly.\");if(jp(this.ydoc,e).length>0)await this.lastWrite}async apply(e){if(this.closed||this.stale)throw Error(\"Room is closed or stale\");await this.writes;let t=await this.connection.request({op:\"change\",name:this.name,generation:this.generation,schemaVersion:this.schemaVersion,operations:e});this.receive(t.room)}async reset(e={}){if(this.closed)throw Error(\"Room is closed\");await this.writes;let t=await this.connection.request({op:\"reset\",name:this.name,schemaVersion:this.schemaVersion,state:e});this.receive(t.room)}async close(){this.closed=!0,clearTimeout(this.presenceTimer),this.connection.rooms.delete(this.name);try{await this.connection.request({op:\"leave\",name:this.name})}finally{this.ydoc.destroy()}}}class Vp extends co{connection;name;constructor(e,t){super();this.connection=e;this.name=t}async publish(e){await this.connection.request({op:\"publish\",name:this.name,data:e})}async close(){this.connection.channels.delete(this.name),await this.connection.request({op:\"unsubscribe\",name:this.name})}}var ze=new Bp;window.addEventListener(\"pagehide\",()=>ze.close());async function rb(e=\"default\",t={}){if(!/^[a-zA-Z0-9_-]{1,64}$/.test(e))throw Error(\"Invalid room name\");let r=ze.rooms.get(e);if(r&&r.schemaVersion!==(t.schemaVersion??1))throw Error(\"Room already opened with a different schema version\");if(!r)r=new Mp(ze,e,t),ze.rooms.set(e,r);try{await r.join()}catch(n){throw ze.rooms.delete(e),n}return r}async function nb(e){if(!/^[a-zA-Z0-9_-]{1,64}$/.test(e))throw Error(\"Invalid channel name\");let t=ze.channels.get(e);if(t)return t;let r=new Vp(ze,e);ze.channels.set(e,r);try{await ze.request({op:\"subscribe\",name:e})}catch(n){throw ze.channels.delete(e),n}return r}export{nb as channel,rb as room};\n\n";
|
|
35909
35930
|
|
|
35910
35931
|
// src/http/realtime.ts
|
|
35911
35932
|
init_favorite_owner();
|
|
@@ -36065,7 +36086,7 @@ var updateRepo = route({
|
|
|
36065
36086
|
404: { description: "Repo not found", schema: object2({ error: string2() }) },
|
|
36066
36087
|
409: { description: "Duplicate repo", schema: object2({ error: string2() }) }
|
|
36067
36088
|
},
|
|
36068
|
-
rbac: { permission: "repo.merge-policy.write" }
|
|
36089
|
+
rbac: { permission: "repo.merge-policy.write", alsoAdmits: ["repo.exec-config.write"] }
|
|
36069
36090
|
});
|
|
36070
36091
|
var deleteRepo = route({
|
|
36071
36092
|
method: "delete",
|
|
@@ -39734,6 +39755,7 @@ var scheduleUpdateBodySchema = object2({
|
|
|
39734
39755
|
model: string2().nullable().optional(),
|
|
39735
39756
|
modelTier: ModelTierSchema.nullable().optional(),
|
|
39736
39757
|
profile: string2().nullable().optional(),
|
|
39758
|
+
modelGroup: string2().nullable().optional(),
|
|
39737
39759
|
allowCustomModel: boolean().optional(),
|
|
39738
39760
|
nextRunAt: string2().nullable().optional(),
|
|
39739
39761
|
targetType: ScheduledTaskTargetTypeSchema.optional(),
|
|
@@ -39776,6 +39798,7 @@ var createSchedule = route({
|
|
|
39776
39798
|
model: string2().optional(),
|
|
39777
39799
|
modelTier: ModelTierSchema.optional(),
|
|
39778
39800
|
profile: string2().optional(),
|
|
39801
|
+
modelGroup: string2().optional(),
|
|
39779
39802
|
allowCustomModel: boolean().optional(),
|
|
39780
39803
|
scheduleType: _enum2(["recurring", "one_time"]).optional(),
|
|
39781
39804
|
targetType: ScheduledTaskTargetTypeSchema.optional(),
|
|
@@ -40033,6 +40056,7 @@ async function handleSchedules(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
40033
40056
|
profile: body.profile,
|
|
40034
40057
|
model: body.model,
|
|
40035
40058
|
modelTier: body.modelTier,
|
|
40059
|
+
modelGroup: body.modelGroup,
|
|
40036
40060
|
agentId: body.targetAgentId
|
|
40037
40061
|
});
|
|
40038
40062
|
if (profileError) {
|
|
@@ -40082,6 +40106,7 @@ async function handleSchedules(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
40082
40106
|
timezone: body.timezone,
|
|
40083
40107
|
...splitLegacyModelAlias({ model: body.model, modelTier: body.modelTier }),
|
|
40084
40108
|
profile: body.profile?.trim() || undefined,
|
|
40109
|
+
modelGroup: body.modelGroup?.trim() || undefined,
|
|
40085
40110
|
scheduleType: body.scheduleType,
|
|
40086
40111
|
targetType: body.targetType,
|
|
40087
40112
|
workflowId: body.workflowId,
|
|
@@ -40095,6 +40120,10 @@ async function handleSchedules(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
40095
40120
|
});
|
|
40096
40121
|
createSchedule.respond(res, 201, schedule);
|
|
40097
40122
|
} catch (error) {
|
|
40123
|
+
if (modelGroupRefError(error)) {
|
|
40124
|
+
jsonError(res, `Unknown model group "${body.modelGroup}".`, 400);
|
|
40125
|
+
return true;
|
|
40126
|
+
}
|
|
40098
40127
|
if (modelProfileRefError(error) === "missing") {
|
|
40099
40128
|
jsonError(res, `Unknown model profile "${body.profile}".`, 400);
|
|
40100
40129
|
return true;
|
|
@@ -40240,7 +40269,7 @@ async function handleSchedules(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
40240
40269
|
if (parsed.body.modelTier !== undefined || normalizedModel.modelTier) {
|
|
40241
40270
|
body.modelTier = normalizedModel.modelTier ?? null;
|
|
40242
40271
|
}
|
|
40243
|
-
} else if (agentChanged && existing.model && !profileUpdate.fields.profile) {
|
|
40272
|
+
} else if (agentChanged && existing.model && !profileUpdate.fields.profile && !profileUpdate.fields.modelGroup) {
|
|
40244
40273
|
const modelError = await explicitModelErrorForAgent({
|
|
40245
40274
|
model: existing.model,
|
|
40246
40275
|
allowCustomModel: true,
|
|
@@ -40355,6 +40384,10 @@ async function handleSchedules(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
40355
40384
|
try {
|
|
40356
40385
|
schedule = await updateScheduledTask2(parsed.params.id, body);
|
|
40357
40386
|
} catch (error) {
|
|
40387
|
+
if (modelGroupRefError(error)) {
|
|
40388
|
+
jsonError(res, `Unknown model group "${body.modelGroup}".`, 400);
|
|
40389
|
+
return true;
|
|
40390
|
+
}
|
|
40358
40391
|
if (modelProfileRefError(error) !== "missing")
|
|
40359
40392
|
throw error;
|
|
40360
40393
|
jsonError(res, `Unknown model profile "${body.profile}".`, 400);
|
|
@@ -52931,7 +52964,7 @@ var httpServer = createHttpServer(async (req, res) => {
|
|
|
52931
52964
|
});
|
|
52932
52965
|
});
|
|
52933
52966
|
var detachRealtime = attachRealtimeTransport(httpServer);
|
|
52934
|
-
var { attachControllerTransport } = await import("./controllers-connect-
|
|
52967
|
+
var { attachControllerTransport } = await import("./controllers-connect-j4kdmhfj.js");
|
|
52935
52968
|
var detachControllers = attachControllerTransport(httpServer);
|
|
52936
52969
|
var stopWorkerNudges = startWorkerNudgeListener();
|
|
52937
52970
|
var taskAutoTitles = startTaskAutoTitleListener();
|
|
@@ -52962,7 +52995,7 @@ async function shutdown() {
|
|
|
52962
52995
|
sessionsProcessed: getServerSessionsProcessed()
|
|
52963
52996
|
});
|
|
52964
52997
|
if (hasCapability("scheduling")) {
|
|
52965
|
-
const { stopScheduler } = await import("./index-
|
|
52998
|
+
const { stopScheduler } = await import("./index-7dwh9kxh.js");
|
|
52966
52999
|
stopScheduler();
|
|
52967
53000
|
}
|
|
52968
53001
|
stopHeartbeat2();
|
|
@@ -52974,7 +53007,7 @@ async function shutdown() {
|
|
|
52974
53007
|
await stopSlackApp2();
|
|
52975
53008
|
await stopChatSdk();
|
|
52976
53009
|
if (!isEnvFlagEnabled("OAUTH_KEEPALIVE_DISABLE", false)) {
|
|
52977
|
-
const { stopOAuthKeepalive } = await import("./keepalive-
|
|
53010
|
+
const { stopOAuthKeepalive } = await import("./keepalive-7eyb8y4t.js");
|
|
52978
53011
|
await stopOAuthKeepalive();
|
|
52979
53012
|
}
|
|
52980
53013
|
stopOAuthPendingGc();
|
|
@@ -53065,21 +53098,21 @@ try {
|
|
|
53065
53098
|
console.warn("[startup] CAPABILITIES upgrade seed failed (non-fatal):", err);
|
|
53066
53099
|
}
|
|
53067
53100
|
try {
|
|
53068
|
-
const { ensurePricingSeeded } = await import("./boot-seeds-
|
|
53101
|
+
const { ensurePricingSeeded } = await import("./boot-seeds-xkxqa8zc.js");
|
|
53069
53102
|
ensurePricingSeeded();
|
|
53070
|
-
const { startPricingRefreshLoop } = await import("./pricing-refresh-
|
|
53103
|
+
const { startPricingRefreshLoop } = await import("./pricing-refresh-041zpyhf.js");
|
|
53071
53104
|
startPricingRefreshLoop();
|
|
53072
53105
|
} catch (err) {
|
|
53073
53106
|
console.error("[startup] Failed to seed pricing rows:", err);
|
|
53074
53107
|
}
|
|
53075
53108
|
try {
|
|
53076
|
-
const { ensureModelProfilesSeeded } = await import("./boot-seeds-
|
|
53109
|
+
const { ensureModelProfilesSeeded } = await import("./boot-seeds-xkxqa8zc.js");
|
|
53077
53110
|
await ensureModelProfilesSeeded();
|
|
53078
53111
|
} catch (err) {
|
|
53079
53112
|
console.error("[startup] Failed to seed model profiles:", err);
|
|
53080
53113
|
}
|
|
53081
53114
|
try {
|
|
53082
|
-
const { ensureRbacSeeded } = await import("./boot-seeds-
|
|
53115
|
+
const { ensureRbacSeeded } = await import("./boot-seeds-xkxqa8zc.js");
|
|
53083
53116
|
ensureRbacSeeded();
|
|
53084
53117
|
} catch (err) {
|
|
53085
53118
|
console.error("[startup] Failed to sync RBAC seed rows:", err);
|
|
@@ -53087,13 +53120,13 @@ try {
|
|
|
53087
53120
|
throw err;
|
|
53088
53121
|
}
|
|
53089
53122
|
try {
|
|
53090
|
-
const { runAllSeeders } = await import("./index-
|
|
53123
|
+
const { runAllSeeders } = await import("./index-h9xnzfhx.js");
|
|
53091
53124
|
await runAllSeeders({ scriptEmbeddingMode: "skip" });
|
|
53092
53125
|
} catch (err) {
|
|
53093
53126
|
console.error("[startup] Failed to seed built-in entities:", err);
|
|
53094
53127
|
}
|
|
53095
53128
|
try {
|
|
53096
|
-
const { runImports } = await import("./index-
|
|
53129
|
+
const { runImports } = await import("./index-dm7c6hw5.js");
|
|
53097
53130
|
await runImports();
|
|
53098
53131
|
} catch (err) {
|
|
53099
53132
|
console.error("[startup] File import failed:", scrubSecrets(err instanceof Error ? err.message : String(err)));
|
|
@@ -53145,10 +53178,10 @@ httpServer.listen(port, async () => {
|
|
|
53145
53178
|
startChatSdk().catch((err) => {
|
|
53146
53179
|
console.error("[chat-sdk] Failed to start, continuing without Chat SDK:", scrubSecrets(err instanceof Error ? err.message : String(err)));
|
|
53147
53180
|
});
|
|
53148
|
-
import("./agent-fs-provision-
|
|
53181
|
+
import("./agent-fs-provision-zpbxa9jc.js").then(({ syncAgentFsOrgSwarmUrl }) => syncAgentFsOrgSwarmUrl(getConfiguredAppUrls()[0])).catch((err) => {
|
|
53149
53182
|
console.warn("[agent-fs] Failed to set the org swarm URL:", scrubSecrets(err instanceof Error ? err.message : String(err)));
|
|
53150
53183
|
});
|
|
53151
|
-
import("./object-webhooks-
|
|
53184
|
+
import("./object-webhooks-p190rdxp.js").then(({ ensureObjectWebhooksForKnownDrives }) => ensureObjectWebhooksForKnownDrives()).catch((err) => {
|
|
53152
53185
|
console.warn("[objects] agent-fs webhook boot check failed:", scrubSecrets(err instanceof Error ? err.message : String(err)));
|
|
53153
53186
|
});
|
|
53154
53187
|
startQueueStallAlarm();
|
|
@@ -53164,22 +53197,22 @@ httpServer.listen(port, async () => {
|
|
|
53164
53197
|
await initWorkflows2();
|
|
53165
53198
|
await startScriptRunSupervisor(getScriptApiBaseUrl());
|
|
53166
53199
|
if (hasCapability("scheduling")) {
|
|
53167
|
-
const { parseSchedulerIntervalMs, startScheduler } = await import("./index-
|
|
53168
|
-
const { getExecutorRegistry } = await import("./index-
|
|
53200
|
+
const { parseSchedulerIntervalMs, startScheduler } = await import("./index-7dwh9kxh.js");
|
|
53201
|
+
const { getExecutorRegistry } = await import("./index-wp9tarbt.js");
|
|
53169
53202
|
startScheduler(getExecutorRegistry(), parseSchedulerIntervalMs(process.env.SCHEDULER_INTERVAL_MS), { runId: globalState.__runId });
|
|
53170
53203
|
}
|
|
53171
53204
|
if (!isEnvFlagEnabled("HEARTBEAT_DISABLE", false)) {
|
|
53172
|
-
const { parseHeartbeatIntervalMs, startHeartbeat } = await import("./index-
|
|
53205
|
+
const { parseHeartbeatIntervalMs, startHeartbeat } = await import("./index-z6np2405.js");
|
|
53173
53206
|
startHeartbeat(parseHeartbeatIntervalMs(process.env.HEARTBEAT_INTERVAL_MS));
|
|
53174
53207
|
}
|
|
53175
53208
|
startPoolRouting();
|
|
53176
53209
|
startRuntimeSupervisor();
|
|
53177
53210
|
if (!isEnvFlagEnabled("OAUTH_KEEPALIVE_DISABLE", false)) {
|
|
53178
|
-
const { startOAuthKeepalive } = await import("./keepalive-
|
|
53211
|
+
const { startOAuthKeepalive } = await import("./keepalive-7eyb8y4t.js");
|
|
53179
53212
|
startOAuthKeepalive();
|
|
53180
53213
|
}
|
|
53181
53214
|
if (!isEnvFlagEnabled("OAUTH_REFRESH_SWEEP_DISABLE", false)) {
|
|
53182
|
-
const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-
|
|
53215
|
+
const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-f4c7g37h.js");
|
|
53183
53216
|
startOAuthRefreshSweep();
|
|
53184
53217
|
}
|
|
53185
53218
|
startOAuthPendingGc();
|
|
@@ -53189,19 +53222,19 @@ httpServer.listen(port, async () => {
|
|
|
53189
53222
|
startSavingsRollup(savingsRollupSql);
|
|
53190
53223
|
startHumanFreeDrain();
|
|
53191
53224
|
startTaskSearchBackfill();
|
|
53192
|
-
import("./embedding-space-
|
|
53225
|
+
import("./embedding-space-0p921zt3.js").then(({ runEmbeddingMaintenance }) => runEmbeddingMaintenance({ backfill: true })).catch((err) => {
|
|
53193
53226
|
console.error("[embedding-space] startup maintenance failed (non-fatal):", err);
|
|
53194
53227
|
});
|
|
53195
|
-
import("./boot-args-schema-
|
|
53228
|
+
import("./boot-args-schema-zs435mfx.js").then(({ runBootArgsSchemaBackfill }) => runBootArgsSchemaBackfill()).catch((err) => {
|
|
53196
53229
|
console.error("[boot-args-schema] startup backfill failed (non-fatal):", err);
|
|
53197
53230
|
});
|
|
53198
|
-
import("./boot-scrub-sweep-
|
|
53231
|
+
import("./boot-scrub-sweep-3h5xscw6.js").then(({ runBootScrubSweep }) => runBootScrubSweep()).catch((err) => {
|
|
53199
53232
|
console.error("[boot-scrub-sweep] startup scrub failed (non-fatal):", err);
|
|
53200
53233
|
});
|
|
53201
|
-
import("./user-merge-jobs-
|
|
53234
|
+
import("./user-merge-jobs-vjsps179.js").then(({ resumeUserMergeJobs }) => resumeUserMergeJobs()).catch((err) => {
|
|
53202
53235
|
console.error("[user-merge] startup resume failed (non-fatal):", err);
|
|
53203
53236
|
});
|
|
53204
|
-
import("./session-source-backfill-
|
|
53237
|
+
import("./session-source-backfill-6fe3hcgb.js").then(({ runSessionSourceBackfill }) => runSessionSourceBackfill()).catch((err) => {
|
|
53205
53238
|
console.error("[session-source-backfill] startup run failed (non-fatal):", err);
|
|
53206
53239
|
});
|
|
53207
53240
|
}).on("error", (err) => {
|