@kabmo-labs/kabmo 0.32.1 → 0.33.0
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/client/index.html +1 -1
- package/dist/client/index.js +542 -535
- package/dist/client/static/js/{CsvGrid-4gx0jevc.js → CsvGrid-fncjbg6j.js} +2 -2
- package/dist/client/static/js/{DocxView-0667nr8h.js → DocxView-c9v2vr3r.js} +2 -2
- package/dist/client/static/js/{DrawioView-522v0d0r.js → DrawioView-vxjksm12.js} +2 -2
- package/dist/client/static/js/{ImageView-t8xp60hm.js → ImageView-a3g5k226.js} +1 -1
- package/dist/client/static/js/LayoutWrapper-hnjfwsjh.js +2 -0
- package/dist/client/static/js/Modal-qtftcp2t.js +38 -0
- package/dist/client/static/js/{PdfView-3fx172xh.js → PdfView-ksaes53y.js} +1 -1
- package/dist/client/static/js/{SessionsView-n3agmf5t.js → SessionsView-30vcr95v.js} +1 -1
- package/dist/client/static/js/{SheetView-nmrdb1b8.js → SheetView-vc484scg.js} +6 -6
- package/dist/client/static/js/{SvgPreview-0xsc6xam.js → SvgPreview-tph89jet.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-jj31rs62.js → abnfDiagram-O67JEVCF-xbar278c.js} +1 -1
- package/dist/client/static/js/architecture-7GRP2DOG-tavtgb8a.js +1 -0
- package/dist/client/static/js/{architectureDiagram-NJMV4G6O-ay3yr7pf.js → architectureDiagram-NJMV4G6O-s171n2z6.js} +3 -3
- package/dist/client/static/js/{astro-qgx1r159.js → astro-80bs6hvg.js} +1 -1
- package/dist/client/static/js/bash-b3rwyg5p.js +1 -0
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-4x33e16k.js → blockDiagram-BEXU5L5S-gzx6rv9n.js} +2 -2
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-dtb81cgz.js → c4Diagram-YGBWAQC7-7f00skch.js} +2 -2
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-vk5a2n9w.js → classDiagram-v2-NBCMYWYE-j79v95nc.js} +4 -4
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-6rbjbe19.js → cose-bilkent-JH36ORCC-5fkn7ee5.js} +1 -1
- package/dist/client/static/js/css-6vj0d308.js +1 -0
- package/dist/client/static/js/cynefin-OW5HDTMX-cdh3n2z2.js +1 -0
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-vyjksedr.js → cynefinDiagram-VND7K2PF-cfs1yvrd.js} +2 -2
- package/dist/client/static/js/{dagre-6A5THRUB-7hey38z5.js → dagre-6A5THRUB-44bgc48p.js} +2 -2
- package/dist/client/static/js/{diagram-22UHCM2B-aes06jde.js → diagram-22UHCM2B-a4g4x83k.js} +14 -14
- package/dist/client/static/js/{diagram-3UASUU5V-3cfkgm3x.js → diagram-3UASUU5V-gm4rg5na.js} +1 -1
- package/dist/client/static/js/{diagram-ATOU4E4O-z8mfhwpy.js → diagram-ATOU4E4O-a95y41vk.js} +3 -3
- package/dist/client/static/js/{diagram-CDSNMT55-t4821ctz.js → diagram-CDSNMT55-t3j93mmc.js} +5 -5
- package/dist/client/static/js/{diagram-MLGK6HIB-23yxbfrx.js → diagram-MLGK6HIB-c2wdez02.js} +1 -1
- package/dist/client/static/js/{diagram-MPIPVDR6-chhtf7v0.js → diagram-MPIPVDR6-gya9jhs5.js} +2 -2
- package/dist/client/static/js/{dockerfile-5b87ghm7.js → dockerfile-a7q6174s.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-9jejcvfr.js → ebnfDiagram-ZINNZB2B-jjhkza6t.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-xhhtkf58.js → elk-276RUBZZ-f7re45mw.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-mt2apjjb.js → erDiagram-OPXOYQCR-tpm9g5te.js} +6 -6
- package/dist/client/static/js/{erlang-6m6tpt72.js → erlang-qt876zrq.js} +1 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-as97tpyp.js +1 -0
- package/dist/client/static/js/flowDiagram-KWPJA3E3-ggm06d12.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-8cm7a29w.js → ganttDiagram-FUAMR5RP-fz43n12d.js} +3 -3
- package/dist/client/static/js/gitGraph-4MIJSDKK-eqz7p9ng.js +1 -0
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-5s0gbnx2.js → gitGraphDiagram-X574FWY7-f61hgbn6.js} +9 -9
- package/dist/client/static/js/graphql-n43pd5fs.js +1 -0
- package/dist/client/static/js/{index-z5s27s26.js → index-03h3bkcf.js} +1 -1
- package/dist/client/static/js/{index-360d7j0d.js → index-0e40xskg.js} +1 -1
- package/dist/client/static/js/{index-z4v1xmh1.js → index-0n5wwe60.js} +2 -2
- package/dist/client/static/js/{index-pf7syd7t.js → index-0tf0arsp.js} +3 -3
- package/dist/client/static/js/{index-fdbfzshx.js → index-14vndmcr.js} +2 -2
- package/dist/client/static/js/{index-7n68yx6m.js → index-1a0zkj8h.js} +2 -2
- package/dist/client/static/js/{index-p7btwjvj.js → index-1xqs14fr.js} +3 -3
- package/dist/client/static/js/{index-brj8qwa6.js → index-1y9r4frb.js} +2 -2
- package/dist/client/static/js/{index-6q80csr0.js → index-2svnq5gg.js} +1 -1
- package/dist/client/static/js/{index-9sd0vjmh.js → index-2x5f66t6.js} +2 -2
- package/dist/client/static/js/{index-dt7e1328.js → index-354mqqra.js} +2 -2
- package/dist/client/static/js/{index-5x95n3hx.js → index-3rcjx70v.js} +1 -1
- package/dist/client/static/js/{index-532btjmp.js → index-3zc1b0dv.js} +2 -2
- package/dist/client/static/js/{index-wzma5n54.js → index-5tgq7aqx.js} +1 -1
- package/dist/client/static/js/{index-xya34x4v.js → index-76zb4m0n.js} +2 -2
- package/dist/client/static/js/{index-2xj14800.js → index-7y6rpsrp.js} +2 -2
- package/dist/client/static/js/{index-h06bcfds.js → index-8239j2v1.js} +1 -1
- package/dist/client/static/js/{index-dq1kdt03.js → index-9fjt5anh.js} +1 -1
- package/dist/client/static/js/{index-ehcpzk5b.js → index-9y3gjdj7.js} +1 -1
- package/dist/client/static/js/{index-sa9cp6km.js → index-ahv9y42z.js} +2 -2
- package/dist/client/static/js/{index-vd0e25p0.js → index-ajs3jj6j.js} +1 -1
- package/dist/client/static/js/{index-qnwqaczk.js → index-apvkd37e.js} +3 -3
- package/dist/client/static/js/index-at6bhjyf.js +1 -0
- package/dist/client/static/js/index-bkye8mz4.js +2 -0
- package/dist/client/static/js/{index-dnp07j57.js → index-d495kfm0.js} +1 -1
- package/dist/client/static/js/{index-gbfg0anm.js → index-dbe6afkf.js} +2 -2
- package/dist/client/static/js/{index-g33knza2.js → index-djmg1d7h.js} +1 -1
- package/dist/client/static/js/{index-629kfbcb.js → index-e4p4cd3r.js} +2 -2
- package/dist/client/static/js/{index-5y7c62sm.js → index-eyzeya95.js} +5 -5
- package/dist/client/static/js/{index-3vhznzgr.js → index-gcs49f3p.js} +1 -1
- package/dist/client/static/js/{index-59jb53v3.js → index-gs6f0qwa.js} +2 -2
- package/dist/client/static/js/{index-7fdp9c7m.js → index-hf52f59k.js} +2 -2
- package/dist/client/static/js/{index-qkscve6n.js → index-j0r5hj0j.js} +2 -2
- package/dist/client/static/js/{index-ay34b398.js → index-js7t1vb1.js} +17 -17
- package/dist/client/static/js/{index-a0bdavdr.js → index-km2zb6wk.js} +2 -2
- package/dist/client/static/js/{index-ye3sr7db.js → index-m73za75e.js} +2 -2
- package/dist/client/static/js/{index-kpspnztv.js → index-pbe4yed4.js} +2 -2
- package/dist/client/static/js/{index-a6k2hqke.js → index-pxv2nw9w.js} +1 -1
- package/dist/client/static/js/{index-jz9fpznk.js → index-q2w6s8n7.js} +5 -5
- package/dist/client/static/js/{index-h7pn9qw6.js → index-qckv9nte.js} +2 -2
- package/dist/client/static/js/{index-a733k69t.js → index-qsm2z36d.js} +2 -2
- package/dist/client/static/js/{index-pf5sbesf.js → index-rytaa8ca.js} +2 -2
- package/dist/client/static/js/{index-c0x6s6f7.js → index-sdtye3jy.js} +2 -2
- package/dist/client/static/js/index-sffjtm5w.js +12 -0
- package/dist/client/static/js/{index-ejgd8w3s.js → index-trm9x02n.js} +28 -28
- package/dist/client/static/js/{index-c93sp4yh.js → index-vw4brsdx.js} +1 -1
- package/dist/client/static/js/{index-hc2jmzpx.js → index-vw5k8csz.js} +46 -46
- package/dist/client/static/js/{index-2gfc25tq.js → index-w0fwb80e.js} +1 -1
- package/dist/client/static/js/{index-bbggh3f8.js → index-ypx3qmhq.js} +2 -2
- package/dist/client/static/js/{index-4s8ttfxj.js → index-zt75xpq0.js} +193 -193
- package/dist/client/static/js/{index-jppt5mgc.js → index-zvfvqvn9.js} +2 -2
- package/dist/client/static/js/info-A6RAGUB7-4pkzh1qx.js +1 -0
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-3w1yz32c.js → infoDiagram-VRGFBTTK-1qj804sn.js} +1 -1
- package/dist/client/static/js/ini-j5dyq6gm.js +1 -0
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-ckt471dy.js → ishikawaDiagram-OU5B5YK6-4j4qsnzw.js} +3 -3
- package/dist/client/static/js/java-g4dgwbfd.js +1 -0
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-kfvn4w7e.js → journeyDiagram-ZHPQQLJL-j0brnfft.js} +4 -4
- package/dist/client/static/js/jsx-7t5ecz9s.js +1 -0
- package/dist/client/static/js/{julia-0j0gsjvc.js → julia-4ghmfy3e.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-0q36cm83.js → kanban-definition-PNTS6WVX-qqc22br0.js} +2 -2
- package/dist/client/static/js/lua-1g6w30de.js +1 -0
- package/dist/client/static/js/markdown-afx21x8c.js +1 -0
- package/dist/client/static/js/{mermaid.core-b1ssa824.js → mermaid.core-vv3wbe65.js} +6 -6
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-e2ym5en8.js → mindmap-definition-NLK3R4M7-y5b2z8zp.js} +2 -2
- package/dist/client/static/js/one-dark-pro-hm3f56n1.js +1 -0
- package/dist/client/static/js/one-light-xrz49rct.js +1 -0
- package/dist/client/static/js/packet-AYTQ26CC-yg71sp88.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-t8bbdyhe.js → pegDiagram-GJSIUBJH-0be07mqs.js} +1 -1
- package/dist/client/static/js/{perl-7n7e9ncg.js → perl-sd00t4b4.js} +1 -1
- package/dist/client/static/js/{php-32vy69vd.js → php-2zfyqa61.js} +1 -1
- package/dist/client/static/js/pie-WAS4IAKB-89wd6np0.js +1 -0
- package/dist/client/static/js/{pieDiagram-5QR66LMP-envv4brj.js → pieDiagram-5QR66LMP-544w86jk.js} +2 -2
- package/dist/client/static/js/properties-thd83wey.js +1 -0
- package/dist/client/static/js/python-264ns4xw.js +1 -0
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-72rk137a.js → quadrantDiagram-O4NWA36T-p09e7z5s.js} +4 -4
- package/dist/client/static/js/r-qw82kkv9.js +1 -0
- package/dist/client/static/js/radar-RG4KPBEZ-avn0b8r9.js +1 -0
- package/dist/client/static/js/railroad-74A4TZTK-de27xv5w.js +1 -0
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-rg4zzj7x.js +1 -0
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-d84fhj8v.js +1 -0
- package/dist/client/static/js/railroad-peg-WCYAUIDC-dvf8xrmc.js +1 -0
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-1ej0f5hr.js → railroadDiagram-XR7U4H2S-de830ed2.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-rvdaknpd.js → requirementDiagram-PLB6GJNP-b47d74p1.js} +4 -4
- package/dist/client/static/js/{ruby-5ty7fys7.js → ruby-v9qaqhby.js} +1 -1
- package/dist/client/static/js/{rust-2geezrcs.js → rust-fkt0qyrs.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-nxvhtdaw.js → sankeyDiagram-IPEJSGJF-6ezc2fpj.js} +5 -5
- package/dist/client/static/js/{sass-mey5150f.js → sass-9bxped7y.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-n5cn5qrt.js → sequenceDiagram-PO4LG4MO-by5zqj6w.js} +18 -18
- package/dist/client/static/js/{sizeCapture-INFHLROL-r074kj7s.js → sizeCapture-INFHLROL-q85r06j6.js} +1 -1
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-vxghxdb0.js → stateDiagram-v2-GCMORJYK-ep5pyexs.js} +3 -3
- package/dist/client/static/js/{svelte-3ewx0hzx.js → svelte-mwtx07d9.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-qkkv894p.js → swimlanes-2SLR337P-95fcqkh8.js} +1 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-xs2en5dv.js +8 -0
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-5tbq4ex2.js → timeline-definition-EJHVYXUP-461e615g.js} +2 -2
- package/dist/client/static/js/treeView-Q6P3EWNA-mham0bh6.js +1 -0
- package/dist/client/static/js/treemap-WGGIJYW6-mxrxax86.js +1 -0
- package/dist/client/static/js/tsx-nm94hed6.js +1 -0
- package/dist/client/static/js/typescript-0s2t05jj.js +1 -0
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-6p8hf0b7.js → usecaseDiagram-POWQR4AR-ftqfnvhg.js} +37 -37
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-7k5jsxf9.js → vennDiagram-UO4OBE2U-7t96h6ez.js} +7 -7
- package/dist/client/static/js/{vue-06rdf4wh.js → vue-j8vb9d7r.js} +1 -1
- package/dist/client/static/js/wardley-WFR3VGLG-8vrvh9p3.js +1 -0
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-km2x4er8.js → wardleyDiagram-VNRHLVJA-0de8w8c6.js} +4 -4
- package/dist/client/static/js/xml-dz51p1m3.js +1 -0
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-kr3sgr4m.js → xychartDiagram-PMCCYNJV-dez9phkf.js} +5 -5
- package/dist/client/static/js/yaml-2cfkd30t.js +1 -0
- package/package.json +1 -1
- package/src/client/components/common/context-usage-button/McpSection.test.tsx +98 -0
- package/src/client/components/common/context-usage-button/McpSection.tsx +12 -5
- package/src/client/components/common/context-usage-button/SessionStats.tsx +80 -0
- package/src/client/components/common/context-usage-button/index.test.tsx +26 -0
- package/src/client/components/common/context-usage-button/index.tsx +36 -28
- package/src/client/components/common/harness-glyph/brands.ts +8 -0
- package/src/client/components/mobile/LayoutWrapper.tsx +12 -3
- package/src/client/components/mobile/mobile-right-sidebar/FullDiff.tsx +9 -2
- package/src/client/components/settings/apply-side-effects.test.ts +11 -0
- package/src/client/components/settings/apply-side-effects.ts +7 -0
- package/src/client/components/settings/categories/ChatSettings.test.tsx +1 -1
- package/src/client/components/settings/categories/ChatSettings.tsx +2 -0
- package/src/client/components/settings/categories/NotificationSettings.tsx +1 -1
- package/src/client/components/settings/categories/chat-settings/ChangedFilesSection.tsx +79 -0
- package/src/client/components/settings/categories/chat-settings/groups.ts +4 -3
- package/src/client/components/workspace/chat-timeline/ChangedFilesSummary.tsx +101 -0
- package/src/client/components/workspace/chat-timeline/MessageList.tsx +33 -1
- package/src/client/components/workspace/chat-timeline/RunFooter.tsx +21 -1
- package/src/client/components/workspace/chat-timeline/TimelineBody.tsx +13 -0
- package/src/client/components/workspace/chat-timeline/index.tsx +1 -1
- package/src/client/components/workspace/diff-panel/Toolbar.tsx +17 -51
- package/src/client/components/workspace/diff-panel/index.tsx +23 -4
- package/src/client/components/workspace/diff-panel/toolbar-git-actions.tsx +94 -0
- package/src/client/components/workspace/editor/Body.tsx +2 -0
- package/src/client/data/settings/omp-schema.json +73 -3
- package/src/client/hooks/chat/timeline/changed-files-setting.test.ts +31 -0
- package/src/client/hooks/chat/timeline/changed-files-setting.ts +60 -0
- package/src/client/hooks/chat/timeline/session-changes.ts +51 -0
- package/src/client/hooks/ui/notification-events.test.ts +3 -0
- package/src/client/hooks/ui/notification-events.ts +3 -1
- package/src/client/hooks/ui/notification-sound.ts +13 -6
- package/src/client/hooks/ui/ui-sounds.test.ts +15 -0
- package/src/client/hooks/workspace/diff-file.ts +11 -4
- package/src/client/hooks/workspace/file-tabs.ts +13 -4
- package/src/client/hooks/workspace/journal-diff.ts +97 -0
- package/src/client/lib/notifications/native-banner-sound.test.ts +93 -0
- package/src/client/lib/notifications/native-banner-sound.ts +46 -0
- package/src/client/lib/notifications/os.test.ts +14 -5
- package/src/client/lib/notifications/os.ts +8 -0
- package/src/server/lib/harness/launch-table.ts +10 -0
- package/src/server/lib/omp/session/changes.test.ts +138 -0
- package/src/server/lib/omp/session/changes.ts +220 -0
- package/src/server/lib/omp/session/session-discovery.test.ts +4 -4
- package/src/server/lib/omp/session/sidebar-activity.server.test.ts +6 -2
- package/src/server/lib/omp/session/subagent-presence-scan.ts +54 -0
- package/src/server/lib/omp/session/subagent-presence-store.test.ts +1 -1
- package/src/server/lib/omp/session/subagent-presence.test.ts +115 -0
- package/src/server/lib/omp/session/subagent-presence.ts +12 -3
- package/src/server/lib/omp/session/telemetry/compute.ts +68 -0
- package/src/server/lib/omp/session/telemetry.test.ts +81 -0
- package/src/server/routes/sessions/changes.test.ts +90 -0
- package/src/server/routes/sessions/changes.ts +55 -0
- package/src/server/routes/sessions/index.ts +6 -0
- package/src/shared/lib/chat/duration.ts +34 -0
- package/src/shared/lib/chat/timeline/changed-files.test.ts +121 -0
- package/src/shared/lib/chat/timeline/changed-files.ts +71 -0
- package/src/shared/lib/chat/timeline/fork-anchor.test.ts +3 -0
- package/src/shared/lib/format/duration.test.ts +31 -0
- package/src/shared/lib/format/duration.ts +27 -0
- package/src/shared/lib/fs/unified-diff.test.ts +53 -0
- package/src/shared/lib/fs/unified-diff.ts +127 -0
- package/src/shared/lib/harness/brand-color.ts +3 -0
- package/src/shared/lib/harness/catalog.test.ts +13 -0
- package/src/shared/lib/harness/catalog.ts +8 -1
- package/src/shared/lib/harness/fork.ts +4 -2
- package/src/shared/lib/harness/mcp-facts.ts +3 -0
- package/src/shared/lib/harness/provider-facts.ts +14 -0
- package/src/shared/lib/harness/updates.ts +5 -0
- package/src/shared/lib/icons/tint-hues.generated.ts +27 -27
- package/src/shared/lib/omp/config/schema.test.ts +4 -2
- package/src/shared/lib/settings/defaults.ts +1 -0
- package/src/shared/lib/workspace/file-tab-id.ts +9 -0
- package/src/shared/types/context.ts +18 -0
- package/src/shared/types/fs.ts +21 -0
- package/src/shared/types/index.ts +1 -0
- package/src/shared/types/omp/session.ts +6 -0
- package/src/shared/types/session-changes.ts +58 -0
- package/src/shared/types/settings/state.ts +8 -0
- package/dist/client/static/js/LayoutWrapper-xjnveecv.js +0 -2
- package/dist/client/static/js/Modal-k2jr9hc4.js +0 -38
- package/dist/client/static/js/architecture-7GRP2DOG-1y9zvsyt.js +0 -1
- package/dist/client/static/js/bash-m0qjsyy0.js +0 -1
- package/dist/client/static/js/css-t4ngafan.js +0 -1
- package/dist/client/static/js/cynefin-OW5HDTMX-k2188qcq.js +0 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-pdr0qn0n.js +0 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-zvz0mxne.js +0 -1
- package/dist/client/static/js/gitGraph-4MIJSDKK-wmqf046s.js +0 -1
- package/dist/client/static/js/graphql-692h0n2x.js +0 -1
- package/dist/client/static/js/index-61tm0v57.js +0 -1
- package/dist/client/static/js/index-kg86e3sy.js +0 -12
- package/dist/client/static/js/index-nmmxb4va.js +0 -2
- package/dist/client/static/js/info-A6RAGUB7-zg3twte6.js +0 -1
- package/dist/client/static/js/ini-cg0a5wm3.js +0 -1
- package/dist/client/static/js/java-vcck089n.js +0 -1
- package/dist/client/static/js/jsx-ht9zyzwa.js +0 -1
- package/dist/client/static/js/lua-ke895s2q.js +0 -1
- package/dist/client/static/js/markdown-gwmsh53r.js +0 -1
- package/dist/client/static/js/one-dark-pro-4geyzhjj.js +0 -1
- package/dist/client/static/js/one-light-tqssjm9t.js +0 -1
- package/dist/client/static/js/packet-AYTQ26CC-3pav51g0.js +0 -1
- package/dist/client/static/js/pie-WAS4IAKB-wqfh7zdk.js +0 -1
- package/dist/client/static/js/properties-mzvvbqg5.js +0 -1
- package/dist/client/static/js/python-3w64wsyd.js +0 -1
- package/dist/client/static/js/r-32re2zwb.js +0 -1
- package/dist/client/static/js/radar-RG4KPBEZ-w7qjdr2g.js +0 -1
- package/dist/client/static/js/railroad-74A4TZTK-rhr99kkj.js +0 -1
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-c4jeea3m.js +0 -1
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-x2ee66ex.js +0 -1
- package/dist/client/static/js/railroad-peg-WCYAUIDC-yw8wjfwg.js +0 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-y81h9n27.js +0 -8
- package/dist/client/static/js/treeView-Q6P3EWNA-ekz05ccs.js +0 -1
- package/dist/client/static/js/treemap-WGGIJYW6-aq6qymjr.js +0 -1
- package/dist/client/static/js/tsx-0p183w2f.js +0 -1
- package/dist/client/static/js/typescript-t9a5jyvv.js +0 -1
- package/dist/client/static/js/wardley-WFR3VGLG-z34tj4y3.js +0 -1
- package/dist/client/static/js/xml-81hxjjt4.js +0 -1
- package/dist/client/static/js/yaml-yssayv8a.js +0 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{d,n,i,V,o,si,u,a,He,Ts,We,Re,e,gr,Gn,S,Su,La,s,I,jn,En,Pa,m,ui,Kt,D,Or,No,Ro,f,B,et,oe,sn,Jt,Y,C,Mo,Po,Oo,Dn,tn,zo,y,Ke,dr,to,Ls,Ms,hi,zA,rt,jA,qA,jo,HA,WA,qo,KA,VA,dt,YA,JA,Nu,ZA,XA,Ct,xa,ee,yi,wi,ht,Xl,_m,ke,cn,Rn,Gu,Jr,Fn,qa,It,k,M,Qe,wr,un,Zr,re,Gt,rn,ce,Jn,Ha,me,it,Wa,Cr,jt,T,Me,bn,ye,_,oo,$g,zg,Ug,Gg,jg,qg,Hg,Wg,bc,Kg,Hf,ju,Ln,Ys,Sm,Vg,xe,Mn,Tm,es,so,Js,qu,Zs,Wf,Dm,Qm,Nm,Rm,Xs,Wu,Ku,Er,el,Fm,Lm,Mm,Pm,Om,Xg,eh,tl,Um,lo,jm,vc,qm,Vf,Hm}from"./index-zt75xpq0.js";import{uo}from"./index-bkye8mz4.js";import{fo}from"./index-9fjt5anh.js";var Pl={name:"square-dashed-text",size:24,node:[["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 14v1",key:"169vum"}],["path",{d:"M21 19a2 2 0 0 1-2 2",key:"1j7049"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M3 14v1",key:"vnatye"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M7 16h6",key:"1vyc9m"}],["path",{d:"M7 8h8",key:"1jbsf9"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M9 3h1",key:"1yesri"}]],aliases:["text-selection","text-select"]},_r=s(Pl);var Nl={name:"text-align-justify",size:24,node:[["path",{d:"M3 5h18",key:"1u36vt"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 19h18",key:"awlh7x"}]],aliases:["align-justify"]},Ot=s(Nl);var Vl={name:"diff",size:24,node:[["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 10h14",key:"elsbfy"}],["path",{d:"M5 21h14",key:"11awu3"}]]},Bt=s(Vl);var Ul={name:"file-x",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m14.5 12.5-5 5",key:"b62r18"}],["path",{d:"m9.5 12.5 5 5",key:"1rk7el"}]]},Cc=s(Ul);var Wl={name:"message-square-off",size:24,node:[["path",{d:"M19 19H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.7.7 0 0 1 2 21.286V5a2 2 0 0 1 1.184-1.826",key:"1wyg69"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.656 3H20a2 2 0 0 1 2 2v11.344",key:"mhl4k6"}]]},Kr=s(Wl);var $l={name:"space",size:24,node:[["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]]},Bn=s($l);function Hr({filePath:t,status:r,isStaged:l,repo:c,root:p,enabled:h=!0}){let[g,b]=n(""),[x,w]=n(""),[v,E]=n(""),[R,O]=n(r),[F,P]=n(l),[U,A]=n(!0),[L,N]=n(null),W=o(l),H=o(r),G=o(0),z=a(async(j={})=>{if(!h||!t)return;let Z=++G.current;A(!0),N(null);try{let Q=j.staged??W.current,se=j.status??H.current,ne=new URLSearchParams({fileDiff:"1",file:t,staged:Q?"1":"0",repo:c||"."});if(se)ne.set("status",se);if(p)ne.set("root",p);let fe=await fetch(`/api/fs/git?${ne.toString()}`),le=await fe.json().catch(()=>null);if(Z!==G.current)return;if(le?.success){if(b(le.diff||""),w(le.oldContent??""),E(le.newContent??""),le.status)H.current=le.status,O(le.status);if(typeof le.staged==="boolean")W.current=le.staged,P(le.staged)}else N(le?.error||`Failed to load file diff (HTTP ${fe.status})`)}catch(Q){if(Z!==G.current)return;N(Q instanceof Error?Q.message:"Error fetching diff")}finally{if(Z===G.current)A(!1)}},[t,c,p,h]);i(()=>{if(!h)return;W.current=l,H.current=r,O(r),P(l),z()},[z,l,r,h]);let K=a((j)=>{if(typeof j.staged==="boolean")W.current=j.staged,P(j.staged);if(j.status)H.current=j.status,O(j.status)},[]);return{rawDiff:g,oldContent:x,newContent:v,currentStatus:R,currentStaged:F,isLoading:U,errorMessage:L,fetchDiff:z,adoptState:K}}function _l(t){if(t==="added")return"A";if(t==="deleted")return"D";return"M"}function qr(t){let[r,l]=n(""),[c,p]=n(""),[h,g]=n(""),[b,x]=n("M"),[w,v]=n(Boolean(t)),[E,R]=n(null),O=o(0),F=t?.sessionId,P=t?.path,U=t?.from,A=t?.to,L=a(async()=>{if(!F||!P||U===void 0||A===void 0)return;let W=++O.current;v(!0),R(null);try{let H=new URLSearchParams({path:P,from:String(U),to:String(A)}),G=await fetch(`/api/sessions/${encodeURIComponent(F)}/changes/diff?${H.toString()}`),z=await G.json().catch(()=>null);if(W!==O.current)return;if(z?.success){if(p(z.oldContent??""),g(z.newContent??""),l(z.diff??""),x(_l(z.status)),z.unavailable)R("The journal did not store this file’s content (over 8 MB), so the two sides are unknown.")}else R(z?.error||`Failed to load the journal diff (HTTP ${G.status})`)}catch(H){if(W!==O.current)return;R(H instanceof Error?H.message:"Error fetching the journal diff")}finally{if(W===O.current)v(!1)}},[F,P,U,A]);i(()=>{L()},[L]);let N=a(()=>{},[]);return{rawDiff:r,oldContent:c,newContent:h,currentStatus:b,currentStaged:!1,isLoading:w,errorMessage:E,fetchDiff:L,adoptState:N}}function zr(t){let{filePath:r,repo:l,root:c,staged:p,conflicted:h,adoptState:g,fetchDiff:b,onFileSaved:x}=t,[w,v]=n(!1),[E,R]=n(null),[O,F]=n({}),P=a(async(A)=>{let L=new FormData;for(let[N,W]of Object.entries(A))L.set(N,W);if(L.set("repo",l||"."),c)L.set("root",c);try{let N=await fetch("/api/fs/git",{method:"POST",body:L}),W=await N.json().catch(()=>null);if(!N.ok||!W?.success)return R(W?.error||`Request failed (HTTP ${N.status})`),!1;return R(null),!0}catch(N){return R(N instanceof Error?N.message:"Request failed"),!1}},[l,c]),U=a(async(A,L)=>{v(!0);try{if(!await P(A))return;await L()}finally{v(!1)}},[P]);return i(()=>{if(!h){F({});return}let A=!1,L=new URLSearchParams({conflictMarkers:"1",file:r,repo:l||"."});if(c)L.set("root",c);return fetch(`/api/fs/git?${L.toString()}`).then((N)=>N.json()).then((N)=>{if(!A)F(N.markers??{})}).catch(()=>{if(!A)F({})}),()=>{A=!0}},[h,r,l,c]),{isBusy:w,error:E,markers:O,dismissError:()=>R(null),stageUnstage:()=>U({actionType:p?"unstage":"stage",file:r},async()=>{g({staged:!p}),x?.(),await b({staged:!p})}),resolve:(A)=>U({actionType:"resolve_conflict",file:r,...A?{side:A}:{}},async()=>{x?.(),await b()}),revert:()=>U({actionType:"revert",file:r},async()=>{x?.(),await b()})}}var jr=[{target:"compact",label:"Compact view",hint:"Editor takes the chat width: chat hidden, sidebar and right panel kept",Icon:Kr},{target:"full",label:"Full view",hint:"Editor takes the chat and sidebar width: chat and sidebar hidden, right panel kept",Icon:ui}];function Gr(){let[t,r]=La(jm,vc);return{mode:qm(t)?t:vc,setMode:r}}function ed(){let{mode:t,setMode:r}=Gr();return jr.map(({target:l,label:c,Icon:p})=>({label:c,icon:p,active:t===l,onSelect:()=>r(Vf(t,l))}))}function td({size:t=14}){let{mode:r,setMode:l}=Gr();return e(d,{children:jr.map(({target:c,label:p,hint:h,Icon:g})=>{let b=r===c;return e("button",{type:"button",onClick:()=>l(Vf(r,c)),className:`flex items-center justify-center p-1.5 rounded transition-colors cursor-pointer flex-shrink-0 ${b?"bg-ink/10 text-ink":"text-ink/50 hover:text-ink hover:bg-ink/5"}`,title:h,"aria-label":p,"aria-pressed":b,children:e(g,{size:t})},c)})})}var Ft="px-2 py-0.5 rounded text-[11px] font-medium flex items-center space-x-1 transition-colors cursor-pointer flex-shrink-0",Xr="flex items-center bg-canvas rounded border border-ink/15 p-0.5 mr-0.5 @[440px]:mr-1";function Yr({viewMode:t,onSetViewMode:r}){return e("div",{className:Xr,children:[e("button",{type:"button",onClick:()=>r("split"),className:`${Ft} ${t==="split"?"bg-paper text-ink shadow-xs":"text-ink/60 hover:text-ink"}`,title:"Split (side-by-side) diff","aria-label":"Split (side-by-side) diff","aria-pressed":t==="split",children:[e(En,{size:12}),e("span",{className:"hidden @[420px]:inline",children:"Split"})]}),e("button",{type:"button",onClick:()=>r("unified"),className:`${Ft} ${t==="unified"?"bg-paper text-ink shadow-xs":"text-ink/60 hover:text-ink"}`,title:"Unified diff","aria-label":"Unified diff","aria-pressed":t==="unified",children:[e(Ot,{size:12}),e("span",{className:"hidden @[420px]:inline",children:"Unified"})]})]})}function Qr({contentMode:t,onSetContentMode:r}){return e("div",{className:Xr,children:[e("button",{type:"button",onClick:()=>r("full"),className:`${Ft} ${t==="full"?"bg-paper text-ink shadow-xs":"text-ink/60 hover:text-ink"}`,title:"Full code (whole file, changes marked)","aria-label":"Full code (whole file, changes marked)","aria-pressed":t==="full",children:[e(sn,{size:12}),e("span",{className:"hidden @[420px]:inline",children:"Full Code"})]}),e("button",{type:"button",onClick:()=>r("diff"),className:`${Ft} ${t==="diff"?"bg-paper text-ink shadow-xs":"text-ink/60 hover:text-ink"}`,title:"Diff only (changed hunks)","aria-label":"Diff only (changed hunks)","aria-pressed":t==="diff",children:[e(Bt,{size:12}),e("span",{className:"hidden @[420px]:inline",children:"Diff Only"})]})]})}var eo="flex items-center justify-center p-1.5 rounded transition-colors cursor-pointer disabled:cursor-default disabled:opacity-40 disabled:hover:bg-transparent disabled:hover:text-ink/50";function no({index:t,count:r,locked:l,onStep:c}){let p=t>=0?t+1:"–";return e("div",{className:"flex items-center gap-0.5",children:[e("button",{type:"button",onClick:()=>c(-1),disabled:l,className:`${eo} text-ink/50 hover:text-ink hover:bg-ink/5`,title:"Previous change","aria-label":"Previous change",children:e(et,{size:13})}),e("span",{className:"text-[10px] font-mono tabular-nums text-ink/50 px-0.5 min-w-[3.5ch] text-center",title:`Changed hunk ${p} of ${r}`,"aria-live":"polite",children:[p,"/",r]}),e("button",{type:"button",onClick:()=>c(1),disabled:l,className:`${eo} text-ink/50 hover:text-ink hover:bg-ink/5`,title:"Next change","aria-label":"Next change",children:e(B,{size:13})})]})}var Pt="flex items-center justify-center p-1.5 rounded transition-colors cursor-pointer disabled:cursor-default disabled:opacity-40 disabled:hover:bg-transparent disabled:hover:text-ink/50";function ro({isStaged:t,locked:r,readOnly:l,stageLabel:c,onStageUnstage:p,onDiscard:h}){if(l)return[];let g=[];if(!t)g.push({id:"discard",actions:[{label:"Discard changes in this file",icon:tn,onSelect:h,disabled:r}],children:e("button",{type:"button",onClick:h,className:`${Pt} text-ink/50 hover:text-error hover:bg-error/10`,title:"Discard changes in this file","aria-label":"Discard changes in this file",disabled:r,children:e(tn,{size:13})})});return g.push({id:"stage",pinned:!0,actions:[{label:c,icon:t?Jt:Y,onSelect:p,disabled:r}],children:e("button",{type:"button",onClick:p,className:"px-2 py-1 text-[11px] font-medium rounded border border-ink/15 hover:bg-ink/5 flex items-center space-x-1 transition-colors text-ink cursor-pointer disabled:cursor-default disabled:opacity-40 disabled:hover:bg-transparent",title:c,"aria-label":c,disabled:r,children:t?e(d,{children:[e(Jt,{size:12}),e("span",{className:"hidden @[360px]:inline",children:"Unstage"})]}):e(d,{children:[e(Y,{size:12}),e("span",{className:"hidden @[360px]:inline",children:"Stage"})]})})}),g}function io({filePath:t,status:r,isStaged:l,viewMode:c,contentMode:p,wordWrap:h,ignoreWhitespace:g,additions:b,deletions:x,chunkIndex:w=-1,chunkCount:v=0,onStepChunk:E,isLoading:R,isCopied:O,isBusy:F=!1,viewModeButtons:P=!0,readOnly:U=!1,onSetViewMode:A,onSetContentMode:L,onToggleWordWrap:N,onToggleWhitespace:W,onStageUnstage:H,onDiscard:G,onOpenInEditor:z,onRefresh:K,onCopyDiff:j}){let Z=ed(),Q=t.split("/").pop()||t,se=Gn(r,l),ne=R||F,fe=l?"Unstage file":"Stage file",le=h?"Word wrap on":"Word wrap off",te=g?"Whitespace changes hidden":"Hide whitespace changes",Se=O?"Copied":"Copy diff text",ae=[];if(b>0||x>0)ae.push({id:"counts",pinned:!0,actions:[],children:e("div",{className:"flex items-center space-x-1.5 text-[11px] font-mono pr-1.5 mr-0.5 @[440px]:mr-1 border-r border-ink/10",children:[b>0&&e("span",{className:"text-success font-semibold",children:["+",b]}),x>0&&e("span",{className:"text-error font-semibold",children:["-",x]})]})});if(ae.push({id:"view-mode",actions:[{label:"Split (side-by-side) diff",icon:En,onSelect:()=>A("split"),active:c==="split"},{label:"Unified diff",icon:Ot,onSelect:()=>A("unified"),active:c==="unified"}],children:e(Yr,{viewMode:c,onSetViewMode:A})}),ae.push({id:"content-mode",actions:[{label:"Full code (whole file, changes marked)",icon:sn,onSelect:()=>L("full"),active:p==="full"},{label:"Diff only (changed hunks)",icon:Bt,onSelect:()=>L("diff"),active:p==="diff"}],children:e(Qr,{contentMode:p,onSetContentMode:L})}),E&&v>0)ae.push({id:"hunks",actions:[{label:"Previous change",icon:et,onSelect:()=>E(-1),disabled:ne},{label:"Next change",icon:B,onSelect:()=>E(1),disabled:ne}],children:e(no,{index:w,count:v,locked:ne,onStep:E})});if(ae.push({id:"wrap",actions:[{label:le,icon:Kt,onSelect:N,active:h}],children:e("button",{type:"button",onClick:N,className:`p-1.5 rounded transition-colors cursor-pointer flex-shrink-0 ${h?"bg-ink/10 text-ink":"text-ink/50 hover:text-ink hover:bg-ink/5"}`,title:le,"aria-label":le,"aria-pressed":h,children:e(Kt,{size:13})})}),ae.push({id:"whitespace",actions:[{label:te,icon:Bn,onSelect:W,active:g}],children:e("button",{type:"button",onClick:W,className:`p-1.5 rounded transition-colors cursor-pointer flex-shrink-0 ${g?"bg-ink/10 text-ink":"text-ink/50 hover:text-ink hover:bg-ink/5"}`,title:te,"aria-label":te,"aria-pressed":g,children:e(Bn,{size:13})})}),P)ae.push({id:"view-modes",pinned:!0,actions:Z,children:e(td,{size:13})});if(ae.push({id:"refresh",actions:[{label:"Reload this diff",icon:C,onSelect:K,disabled:ne}],children:e("button",{type:"button",onClick:K,className:`${Pt} text-ink/50 hover:text-ink hover:bg-ink/5`,title:"Reload this diff","aria-label":"Reload this diff",disabled:ne,children:e(C,{size:13,className:R?"animate-spin":""})})}),ae.push({id:"copy",actions:[{label:Se,icon:oe,onSelect:j}],children:e("button",{type:"button",onClick:j,className:`${Pt} text-ink/50 hover:text-ink hover:bg-ink/5`,title:Se,"aria-label":Se,children:O?e(f,{size:13,className:"text-success"}):e(oe,{size:13})})}),ae.push(...ro({isStaged:l,locked:ne,readOnly:U,stageLabel:fe,onStageUnstage:H,onDiscard:G})),z)ae.push({id:"edit-file",pinned:!0,actions:[{label:"Open in code editor",icon:jn,onSelect:z}],children:e("button",{type:"button",onClick:z,className:"px-2 py-1 text-[11px] font-medium rounded bg-ink text-canvas hover:bg-ink/90 flex items-center space-x-1 transition-colors shadow-xs ml-1 cursor-pointer",title:"Open in code editor","aria-label":"Open in code editor",children:[e(jn,{size:12}),e("span",{className:"hidden @[360px]:inline",children:"Edit File"})]})});return e("div",{className:"@container flex items-center justify-between px-3 py-1.5 bg-paper border-b border-ink/10 text-xs font-sans select-none flex-shrink-0 gap-2 min-w-0",children:[e("div",{className:"hidden @[560px]:flex items-center space-x-2 min-w-0 pr-2",children:[e(rt,{name:Q,size:14,className:"flex-shrink-0"}),e("span",{className:"font-mono text-ink font-medium truncate",title:t,children:Q}),e("span",{className:`px-1.5 py-0.5 text-[10px] font-mono font-semibold rounded border ${se.badgeBgClass} flex-shrink-0`,children:[se.charStatus," ",se.label]})]}),e(fo,{clusters:ae,className:"text-ink/70 ml-auto"})]})}function ao({markers:t,isBusy:r,error:l,onResolve:c,onDismissError:p}){let h=t.ours||"ours",g=t.theirs||"theirs";return e("div",{className:"flex-shrink-0 border-b border-warning/30 bg-warning/5",children:[e("div",{className:"flex items-center gap-2 px-3 py-1.5 flex-wrap",children:[e(D,{size:13,className:"text-warning flex-shrink-0"}),e("span",{className:"text-[11px] font-medium text-warning",children:"Conflicted file"}),e("div",{className:"flex items-center gap-1.5 ml-auto flex-wrap",children:[e("button",{type:"button",onClick:()=>c("ours"),disabled:r,title:`Take ${h} — \`git checkout --ours\` then stage`,className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer disabled:opacity-40 max-w-[40%] truncate",children:["take ",h]}),e("button",{type:"button",onClick:()=>c("theirs"),disabled:r,title:`Take ${g} — \`git checkout --theirs\` then stage`,className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer disabled:opacity-40 max-w-[40%] truncate",children:["take ",g]}),e("button",{type:"button",onClick:()=>c(""),disabled:r,title:"Mark resolved: the file was edited by hand, this stages it",className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer disabled:opacity-40",children:"mark resolved"})]})]}),l&&e("div",{className:"flex items-center gap-2 px-3 py-1 border-t border-error/25 bg-error/10 text-[10px] text-error",children:[e("span",{className:"min-w-0 flex-1 truncate",title:l,children:l}),e("button",{type:"button",onClick:p,className:"px-1 rounded hover:bg-error/15 cursor-pointer",title:"Dismiss","aria-label":"Dismiss",children:"✕"})]})]})}function co(t){let r=uo();return e(Om,{...t,themeVars:r.vars,themes:r.themes})}function mo(t){let r=t.split("/").pop()??"",l=r.lastIndexOf(".");return l>0&&l<r.length-1?r.slice(l).toLowerCase():""}function tA(t){let r=Ct("fileOpener"),l=Ct("sourceCodeRenderer"),c=xa(),p=t.extension??mo(t.path),h=r.find((b)=>b.registration.matches({path:t.path,extension:p}));if(h)return{kind:"opener",pluginId:h.pluginId,Component:h.registration.component,props:{...c,path:t.path,extension:p}};let g=l.find((b)=>b.registration.extensions.includes(p));if(g)return{kind:"source",pluginId:g.pluginId,Component:g.registration.component,props:{...c,path:t.path,content:t.content,language:t.language}};return null}function po(t){let r=Ct("diffRenderer"),l=xa(),c=mo(t.path),p=r.find((h)=>{let g=h.registration.extensions;return g===void 0||g.includes(c)});if(!p)return null;return{pluginId:p.pluginId,Component:p.registration.component,props:{...l,path:t.path,diff:t.diff}}}function nA({view:t}){if(t.kind==="opener"){let l=t.Component;return e(Ke,{pluginId:t.pluginId,children:e(l,{...t.props})})}let r=t.Component;return e(Ke,{pluginId:t.pluginId,children:e(r,{...t.props})})}function Ec({filePath:t,status:r="M",isStaged:l=!1,root:c,repo:p=".",onOpenInEditor:h,onFileSaved:g,className:b="",tabKey:x=null,viewModeButtons:w=!0,journalDiff:v,readOnly:E=!1}){let[R,O]=Su("diff.viewMode","unified"),[F,P]=Su("diff.contentMode","diff"),[U,A]=Su("diff.wordWrap",!0),[L,N]=Su("diff.ignoreWhitespace",!1),[W,H]=n(null),[G,z]=n(!1),[K,j]=n(!1),[Z,Q]=n({additions:0,deletions:0}),[se,ne]=n({index:-1,count:0}),fe=o(null),le=a((Ne)=>{fe.current?.(Ne)},[]),te=a((Ne)=>{fe.current=Ne},[]),Se=wi(),ae=Hr({filePath:t,status:r,isStaged:l,repo:p,root:c,enabled:!v}),be=qr(v),{rawDiff:Le,oldContent:Xe,newContent:Pe,currentStatus:Ce,currentStaged:Ee,isLoading:Ye,errorMessage:X,fetchDiff:ie,adoptState:ue}=v?be:ae,q=!v&&gr(Ce),J=E||Boolean(v),de=dt(t),ve=po({path:t,diff:Le}),Oe=(Ne)=>{O(Ne)},kt=(Ne)=>{P(Ne)},je=()=>{A(!U)},At=()=>{N(!L)},An=()=>{if(!Le)return;navigator.clipboard.writeText(Le).then(()=>{z(!0),setTimeout(()=>z(!1),2000)},()=>H("Clipboard write was refused by the browser"))},Ge=zr({filePath:t,repo:p,root:c,status:Ce,staged:Ee,conflicted:q,adoptState:ue,fetchDiff:ie,onFileSaved:g}),{isBusy:Lt,markers:On}=Ge,at=W??Ge.error;return e("div",{className:`flex flex-col min-h-0 bg-paper select-text relative font-sans ${b}`,children:[e(io,{filePath:t,status:Ce,isStaged:Ee,viewMode:R,contentMode:F,wordWrap:U,ignoreWhitespace:L,additions:Z.additions,deletions:Z.deletions,chunkIndex:se.index,chunkCount:se.count,onStepChunk:le,isLoading:Ye,isCopied:G,isBusy:Lt,viewModeButtons:w,readOnly:J,onSetViewMode:Oe,onSetContentMode:kt,onToggleWordWrap:je,onToggleWhitespace:At,onStageUnstage:()=>{if(!J)Ge.stageUnstage()},onDiscard:()=>{if(!J)j(!0)},onOpenInEditor:h,onRefresh:()=>void ie(),onCopyDiff:An}),q&&e(ao,{markers:On,isBusy:Lt,error:at,onResolve:(Ne)=>void Ge.resolve(Ne),onDismissError:()=>{Ge.dismissError(),H(null)}}),at&&!q&&e("div",{className:"flex items-center gap-2 border-b border-error/25 bg-error/10 px-3 py-1.5 text-[11px] text-error flex-shrink-0",children:[e(I,{size:13,className:"flex-shrink-0"}),e("span",{className:"min-w-0 flex-1 truncate",title:at,children:at}),e("button",{type:"button",onClick:()=>{Ge.dismissError(),H(null)},className:"px-1.5 rounded hover:bg-error/15 cursor-pointer",title:"Dismiss","aria-label":"Dismiss",children:"✕"})]}),e("div",{className:"flex-1 overflow-hidden relative flex flex-col bg-paper",children:Ye?e("div",{className:"flex-1 flex items-center justify-center space-x-2 text-ink/50 text-xs font-mono",children:[e(C,{size:14,className:"animate-spin"}),e("span",{children:"Loading file diff..."})]}):X?e("div",{className:"flex-1 flex flex-col items-center justify-center p-6 text-center space-y-2",children:[e(I,{size:20,className:"text-error"}),e("p",{className:"text-xs text-error font-medium",children:X}),e("button",{onClick:()=>void ie(),className:"px-3 py-1 text-xs bg-ink/10 hover:bg-ink/15 text-ink rounded font-sans transition-colors cursor-pointer",children:"Retry"})]}):ve?e(Ke,{pluginId:ve.pluginId,children:e(ve.Component,{...ve.props})}):e(co,{original:Xe,next:Pe,language:de,viewMode:R,contentMode:F,wordWrap:U,ignoreWhitespace:L,tabKey:x,onCounts:Q,onChunkPosition:ne,onStepChunk:te,empty:!Le||!Le.trim(),fontFamily:Se,fontSize:yi})}),K&&e("div",{className:"fixed inset-0 modal-scrim z-50 flex items-center justify-center p-4 backdrop-blur-xs",children:e("div",{className:"glass-overlay bg-paper rounded-lg shadow-xl p-4 w-full max-w-sm border border-ink/15",children:[e("h3",{className:"font-semibold text-ink mb-1.5 text-sm",children:"Discard Changes?"}),e("p",{className:"text-xs text-ink/70 mb-4",children:["Are you sure you want to discard all unstaged changes in ",e("span",{className:"font-mono font-medium text-ink",children:t}),"? This cannot be undone."]}),e("div",{className:"flex justify-end space-x-2",children:[e("button",{type:"button",onClick:()=>j(!1),className:"px-3 py-1.5 text-xs text-ink hover:bg-ink/5 rounded transition-colors cursor-pointer",children:"Cancel"}),e("button",{type:"button",onClick:()=>{j(!1),Ge.revert()},className:"px-3 py-1.5 text-xs bg-error text-white rounded hover:bg-error/90 font-medium transition-colors cursor-pointer",children:"Discard Changes"})]})]})})]})}var Zn="flex items-center justify-center p-1.5 rounded transition-colors cursor-pointer disabled:cursor-default disabled:opacity-50";function ts({label:t,pressed:r,title:l,onClick:c,children:p}){return e("button",{type:"button",onClick:c,className:`flex items-center justify-center p-1.5 rounded transition-colors cursor-pointer disabled:cursor-default disabled:opacity-50 hover:bg-ink/5 ${r?"text-ink":"hover:text-ink"}`,title:l??t,"aria-label":t,"aria-pressed":r,children:p})}function ho(t){return t.lineStart===t.lineEnd?`L${t.lineStart}`:`L${t.lineStart}-${t.lineEnd}`}function go({block:t,verdict:r,note:l,anchor:c,onSave:p,onRemove:h,onClose:g}){let b=o(null),x=o(null);i(()=>{x.current?.focus()},[]),i(()=>{let v=(E)=>{if(E.key!=="Escape")return;E.stopPropagation(),g()};return window.addEventListener("keydown",v,!0),()=>window.removeEventListener("keydown",v,!0)},[g]);let w=(v)=>p(v,x.current?.value??l);return e("div",{ref:b,role:"dialog","aria-label":`Review block ${ho(t)}`,style:{top:`${c.top}px`,left:`${c.left}px`},className:"glass-popover fixed z-[65] w-[min(24rem,calc(100vw-2rem))] rounded-md border border-ink/15 bg-paper shadow-lg p-2 font-sans text-[11.5px] text-ink",onClick:(v)=>v.stopPropagation(),children:[e("div",{className:"flex items-center gap-1.5 text-[10.5px] font-mono text-ink/50",children:[e("span",{children:ho(t)}),e("span",{className:"truncate",children:["«",t.quote,"»"]}),e("button",{type:"button",onClick:g,className:"ml-auto cursor-pointer text-ink/50 hover:text-ink","aria-label":"Close review",children:e(y,{size:12})})]}),e("div",{className:"mt-1.5 flex items-center gap-1.5",children:[e("button",{type:"button","aria-pressed":r==="good",title:"This block is good, so leave it alone",onClick:()=>w("good"),className:`${Zn} border px-2 text-[11px] ${r==="good"?"border-ink bg-ink/10 text-ink":"border-ink/15 text-ink/70 hover:border-ink/40"}`,children:[e(f,{size:11})," Good"]}),e("button",{type:"button","aria-pressed":r==="needs-work",title:"This block needs work",onClick:()=>w("needs-work"),className:`${Zn} border px-2 text-[11px] ${r==="needs-work"?"border-error bg-error/10 text-error":"border-ink/15 text-ink/70 hover:border-ink/40"}`,children:[e(y,{size:11})," Needs work"]}),r&&e("button",{type:"button",onClick:h,className:`${Zn} ml-auto border border-ink/15 px-2 text-[11px] text-ink/60 hover:text-error`,children:"Remove"})]}),e("textarea",{ref:x,defaultValue:l,rows:3,placeholder:"What is wrong (or right) with this block…",onKeyDown:(v)=>{if(v.key==="Enter"&&(v.metaKey||v.ctrlKey)&&r)v.preventDefault(),w(r)},className:"mt-1.5 w-full resize-y rounded border border-ink/15 bg-canvas/40 px-2 py-1 text-[11px] font-sans outline-none focus:border-ink"}),e("div",{className:"mt-1 flex items-center gap-1.5 text-[10.5px] text-ink/45",children:e("span",{children:"Click an answer to save · ⌘↵ keeps the note with it"})})]})}function bo(t){return t.lineStart===t.lineEnd?`L${t.lineStart}`:`L${t.lineStart}-${t.lineEnd}`}function yo({counts:t,outdated:r,error:l,sent:c,onSend:p,onRemoveOutdated:h,onExit:g}){let b=t.good+t.needsWork;return e("div",{className:"sticky bottom-0 z-40 mt-2 border-t border-ink/10 bg-paper/95 px-1 py-2 backdrop-blur",children:[r.length>0&&e("div",{className:"mb-1.5 space-y-1",children:[e("div",{className:"text-[10px] uppercase font-mono text-ink/40",children:[r.length," outdated — the block was edited or is no longer rendered"]}),r.map((x)=>e("div",{className:"flex items-start gap-1.5 text-[11px] text-ink/60",children:[e("span",{className:"font-mono text-[10.5px] text-ink/40",children:bo(x)}),e("span",{className:"min-w-0 flex-1",children:[e("span",{className:"block truncate text-ink/45",children:x.quote||"(block text unavailable)"}),x.note.trim()&&e("span",{className:"block truncate text-ink/70",children:x.note})]}),e("button",{type:"button",onClick:()=>h(x.id),className:"cursor-pointer text-ink/40 hover:text-error","aria-label":`Remove outdated annotation at ${bo(x)}`,children:e(y,{size:11})})]},x.id))]}),l&&e("div",{role:"alert",className:"mb-1.5 text-[11px] text-error",children:l}),e("div",{className:"flex items-center gap-2 font-sans text-[11px]",children:[e("span",{className:"text-ink/70",children:[e("span",{className:"text-ink",children:t.good})," good ·"," ",e("span",{className:"text-error",children:t.needsWork})," needs work"]}),c&&e("span",{className:"text-ink/50",children:"Added to the chat box"}),e("button",{type:"button",onClick:g,className:"ml-auto cursor-pointer p-1 text-ink/50 hover:text-ink",title:"Exit review mode","aria-label":"Exit review mode",children:e(y,{size:13})}),e("button",{type:"button",disabled:b===0,onClick:p,title:"Put this review into the chat box; you still choose to send it",className:"flex items-center gap-1 rounded border border-ink bg-ink px-2 py-1 text-canvas transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",children:[e(Dn,{size:11})," Send to chat"]})]})]})}function Kl(t){let r=new URLSearchParams({path:t.path});if(t.root)r.set("root",t.root);if(t.repo&&t.repo!==".")r.set("repo",t.repo);return r}async function In(t){let r=await t.json().catch(()=>null);return typeof r?.error==="string"?r.error:`Request failed (${t.status})`}async function xo(t,r){let l=await fetch(`/api/review?${Kl(t).toString()}`,{signal:r});if(!l.ok)throw Error(await In(l));let c=await l.json();return Array.isArray(c.annotations)?c.annotations:[]}async function vo(t,r){let l={...r,path:t.path,root:t.root,repo:t.repo},c=await fetch("/api/review",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!c.ok)throw Error(await In(c));let p=await c.json();if(!p.annotation)throw Error("The server answered without the saved annotation");return p.annotation}async function ko(t){let r=await fetch(`/api/review?id=${encodeURIComponent(t)}`,{method:"DELETE"});if(!r.ok)throw Error(await In(r))}function wo(t,r){let[l,c]=n([]),[p,h]=n(!1),[g,b]=n(null),[x,w]=n(0),v=t?.path??null,E=t?.root??null,R=t?.repo??null;i(()=>{if(!r||!v){c([]),b(null),h(!1);return}let U=new AbortController;return h(!0),b(null),xo({path:v,root:E,repo:R},U.signal).then((A)=>{if(U.signal.aborted)return;c(A)}).catch((A)=>{if(U.signal.aborted)return;b(A instanceof Error?A.message:"Could not read annotations")}).finally(()=>{if(!U.signal.aborted)h(!1)}),()=>U.abort()},[r,v,E,R,x]);let O=o(l);O.current=l;let F=a(async(U)=>{if(!v)return;let A=O.current,L={id:`pending:${U.blockKey}`,scope:"",path:v,blockKey:U.blockKey,lineStart:U.lineStart,lineEnd:U.lineEnd,verdict:U.verdict,note:U.note,quote:U.quote,createdAt:Date.now(),updatedAt:Date.now()};c([...A.filter((N)=>N.blockKey!==U.blockKey),L]),b(null);try{let N=await vo({path:v,root:E,repo:R},U);c((W)=>W.map((H)=>H.blockKey===U.blockKey?N:H))}catch(N){c(A),b(N instanceof Error?N.message:"Could not save the annotation")}},[v,E,R]),P=a(async(U)=>{let A=O.current;c(A.filter((L)=>L.id!==U)),b(null);try{await ko(U)}catch(L){c(A),b(L instanceof Error?L.message:"Could not remove the annotation")}},[]);return{annotations:l,loading:p,error:g,save:F,remove:P,reload:()=>w((U)=>U+1)}}function So(t,r){let l=new Map(t.map((h)=>[h.key,h])),c=new Map,p=[];for(let h of r)if(l.has(h.blockKey))c.set(h.blockKey,h);else p.push(h);return p.sort((h,g)=>g.updatedAt-h.updatedAt),{attached:c,outdated:p}}function Co(t){let r=0,l=0;for(let c of t.values())if(c.verdict==="good")r+=1;else l+=1;return{good:r,needsWork:l}}function Eo({file:t,active:r}){let[l,c]=n([]),[p,h]=n(null),[g,b]=n(null),x=u(()=>({path:t.path,root:t.root??null,repo:t.repo??null}),[t.path,t.root,t.repo]),{annotations:w,loading:v,error:E,save:R,remove:O}=wo(x,r),{attached:F,outdated:P}=u(()=>So(l,w),[l,w]),U=u(()=>new Map([...F.values()].map((K)=>[K.blockKey,K.verdict])),[F]),A=u(()=>Co(F),[F]),L=u(()=>p?l.find((K)=>K.key===p)??null:null,[l,p]),N=a((K)=>{c((j)=>Hl(j,K)?j:K)},[]),W=a((K,j)=>{h(K.key),b({top:j.bottom+6,left:Math.max(8,j.left)})},[]),H=a(()=>{h(null),b(null)},[]),G=a(({block:K,verdict:j,note:Z})=>{R({blockKey:K.key,lineStart:K.lineStart,lineEnd:K.lineEnd,verdict:j,note:Z,quote:K.quote})},[R]),z=a(()=>{let K=Xg({path:t.path,annotations:[...F.values()]});if(!K)return!1;return eh(K),!0},[F,t.path]);return{marks:U,selected:p,selectedBlock:L,selectedAnnotation:L?F.get(L.key)??null:null,anchor:g,outdated:P,counts:A,loading:v,error:E,setBlocks:N,pick:W,close:H,save:G,remove:(K)=>void O(K),send:z}}function Hl(t,r){if(t.length!==r.length)return!1;return t.every((l,c)=>l.key===r[c]?.key)}function Bc({content:t,file:r,active:l,onExit:c}){let p=Eo({file:r,active:l}),[h,g]=n(!1);i(()=>{if(!p.selected)return;let v=()=>p.close();return window.addEventListener("scroll",v,!0),()=>window.removeEventListener("scroll",v,!0)},[p.selected]),i(()=>{if(!l)p.close()},[l]);let b=p.counts.good+p.counts.needsWork;i(()=>{g(!1)},[b]);let{selectedBlock:x,selectedAnnotation:w}=p;return e("div",{className:l?"md-review-active":void 0,children:[e(ee,{content:t,document:!0,scope:{path:r.path,root:r.root??void 0,repo:r.repo??void 0},onBlocks:p.setBlocks,review:l?{active:!0,marks:p.marks,selected:p.selected,onPick:p.pick}:void 0}),l&&x&&p.anchor&&e(go,{block:x,verdict:p.marks.get(x.key)??null,note:w?.note??"",anchor:p.anchor,onSave:(v,E)=>{p.save({block:x,verdict:v,note:E}),p.close()},onRemove:()=>{if(w)p.remove(w.id);p.close()},onClose:p.close},x.key),l&&e(yo,{counts:p.counts,outdated:p.outdated,error:p.error,sent:h,onSend:()=>g(p.send()),onRemoveOutdated:p.remove,onExit:()=>{p.close(),c()}})]})}var Do=typeof String.prototype.normalize=="function"?(t)=>t.normalize("NFKD"):(t)=>t;class ft{constructor(t,r,l=0,c=t.length,p,h){this.test=h,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(l,c),this.bufferStart=l,this.normalize=p?(g)=>p(Do(g)):Do,this.query=this.normalize(r)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Rn(this.buffer,this.bufferPos)}next(){while(this.matches.length)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let r=Gu(t),l=this.bufferStart+this.bufferPos;this.bufferPos+=Jr(t);let c=this.normalize(r);if(c.length)for(let p=0,h=l,g=!0;;p++){let b=c.charCodeAt(p),x=this.match(b,h,g,this.bufferPos+this.bufferStart,p==c.length-1);if(x)return this.value=x,this;if(p==c.length-1)break;if(g&&p<r.length&&r.charCodeAt(p)==b)h++;else g=!1}}}match(t,r,l,c,p){let h=null;for(let g=0;g<this.matches.length;){let b=this.matches[g],x=!1;if(this.query.charCodeAt(b.index)==t)if(b.index==this.query.length-1)h={from:b.from,to:c,precise:p&&b.precise};else b.index++,x=!0;if(x)g++;else this.matches.splice(g,1)}if(this.query.charCodeAt(0)==t)if(this.query.length==1)h={from:r,to:c,precise:l&&p};else this.matches.push({from:r,index:1,precise:l});if(h&&this.test&&!this.test(h.from,h.to,this.buffer,this.bufferStart))h=null;return h}}if(typeof Symbol<"u")ft.prototype[Symbol.iterator]=function(){return this};var Ao={from:-1,to:-1,match:/.*/.exec(""),precise:!0},Lo="gm"+(/x/.unicode==null?"":"u");class Vt{constructor(t,r,l,c=0,p=t.length){if(this.text=t,this.to=p,this.curLine="",this.done=!1,this.value=Ao,/\\[sWDnr]|\n|\r|\[\^/.test(r))return new Nn(t,r,l,c,p);this.re=new RegExp(r,Lo+((l===null||l===void 0?void 0:l.ignoreCase)?"i":"")),this.test=l===null||l===void 0?void 0:l.test,this.iter=t.iter();let h=t.lineAt(c);this.curLineStart=h.from,this.matchPos=Nt(t,c),this.getLine(this.curLineStart)}getLine(t){if(this.iter.next(t),this.iter.lineBreak)this.curLine="";else{if(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to)this.curLine=this.curLine.slice(0,this.to-this.curLineStart);this.iter.next()}}nextLine(){if(this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to)this.curLine="";else this.getLine(0)}next(){for(let t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let r=this.matchPos<=this.to&&this.re.exec(this.curLine);if(r){let l=this.curLineStart+r.index,c=l+r[0].length;if(this.matchPos=Nt(this.text,c+(l==c?1:0)),l==this.curLineStart+this.curLine.length)this.nextLine();if((l<c||l>this.value.to)&&(!this.test||this.test(l,c,r)))return this.value={from:l,to:c,precise:!0,match:r},this;t=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),t=0;else return this.done=!0,this}}}var Pn=new WeakMap;class ut{constructor(t,r){this.from=t,this.text=r}get to(){return this.from+this.text.length}static get(t,r,l){let c=Pn.get(t);if(!c||c.from>=l||c.to<=r){let g=new ut(r,t.sliceString(r,l));return Pn.set(t,g),g}if(c.from==r&&c.to==l)return c;let{text:p,from:h}=c;if(h>r)p=t.sliceString(r,h)+p,h=r;if(c.to<l)p+=t.sliceString(c.to,l);return Pn.set(t,new ut(h,p)),new ut(r,p.slice(r-h,l-h))}}class Nn{constructor(t,r,l,c,p){this.text=t,this.to=p,this.done=!1,this.value=Ao,this.matchPos=Nt(t,c),this.re=new RegExp(r,Lo+((l===null||l===void 0?void 0:l.ignoreCase)?"i":"")),this.test=l===null||l===void 0?void 0:l.test,this.flat=ut.get(t,c,this.chunkEnd(c+5000))}chunkEnd(t){return t>=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,r=this.re.exec(this.flat.text);if(r&&!r[0]&&r.index==t)this.re.lastIndex=t+1,r=this.re.exec(this.flat.text);if(r){let l=this.flat.from+r.index,c=l+r[0].length;if((this.flat.to>=this.to||r.index+r[0].length<=this.flat.text.length-10)&&(!this.test||this.test(l,c,r)))return this.value={from:l,to:c,precise:!0,match:r},this.matchPos=Nt(this.text,c+(l==c?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=ut.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}if(typeof Symbol<"u")Vt.prototype[Symbol.iterator]=Nn.prototype[Symbol.iterator]=function(){return this};function Nt(t,r){if(r>=t.length)return r;let l=t.lineAt(r),c;while(r<l.to&&(c=l.text.charCodeAt(r-l.from))>=56320&&c<57344)r++;return r}var zl={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Bo=M.define({combine(t){return Jn(t,zl,{highlightWordAroundCursor:(r,l)=>r||l,minSelectionLength:Math.min,maxMatches:Math.min})}});function Io(t){let r=[Ql,Yl];if(t)r.push(Bo.of(t));return r}var jl=T.mark({class:"cm-selectionMatch"}),Gl=T.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function To(t,r,l,c){return(l==0||t(r.sliceDoc(l-1,l))!=rn.Word)&&(c==r.doc.length||t(r.sliceDoc(c,c+1))!=rn.Word)}function Jl(t,r,l,c){return t(r.sliceDoc(l,l+1))==rn.Word&&t(r.sliceDoc(c-1,c))==rn.Word}var Yl=ye.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){if(t.selectionSet||t.docChanged||t.viewportChanged)this.decorations=this.getDeco(t.view)}getDeco(t){let r=t.state.facet(Bo),{state:l}=t,c=l.selection;if(c.ranges.length>1)return T.none;let p=c.main,h,g=null;if(p.empty){if(!r.highlightWordAroundCursor)return T.none;let x=l.wordAt(p.head);if(!x)return T.none;g=l.charCategorizer(p.head),h=l.sliceDoc(x.from,x.to)}else{let x=p.to-p.from;if(x<r.minSelectionLength||x>200)return T.none;if(r.wholeWords){if(h=l.sliceDoc(p.from,p.to),g=l.charCategorizer(p.head),!(To(g,l,p.from,p.to)&&Jl(g,l,p.from,p.to)))return T.none}else if(h=l.sliceDoc(p.from,p.to),!h)return T.none}let b=[];for(let x of t.visibleRanges){let w=new ft(l.doc,h,x.from,x.to);while(!w.next().done){let{from:v,to:E}=w.value;if(!g||To(g,l,v,E)){if(p.empty&&v<=p.from&&E>=p.to)b.push(Gl.range(v,E));else if(v>=p.to||E<=p.from)b.push(jl.range(v,E));if(b.length>r.maxMatches)return T.none}}}return T.set(b)}},{decorations:(t)=>t.decorations}),Ql=_.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Zl=({state:t,dispatch:r})=>{let{selection:l}=t,c=k.create(l.ranges.map((p)=>t.wordAt(p.head)||k.cursor(p.head)),l.mainIndex);if(c.eq(l))return!1;return r(t.update({selection:c})),!0};function ea(t,r){let{main:l,ranges:c}=t.selection,p=t.wordAt(l.head),h=p&&p.from==l.from&&p.to==l.to;for(let g=!1,b=new ft(t.doc,r,c[c.length-1].to);;)if(b.next(),b.done){if(g)return null;b=new ft(t.doc,r,0,Math.max(0,c[c.length-1].from-1)),g=!0}else{if(g&&c.some((x)=>x.from==b.value.from))continue;if(h){let x=t.wordAt(b.value.from);if(!x||x.from!=b.value.from||x.to!=b.value.to)continue}return b.value}}var Fo=({state:t,dispatch:r})=>{let{ranges:l}=t.selection;if(l.some((h)=>h.from===h.to))return Zl({state:t,dispatch:r});let c=t.sliceDoc(l[0].from,l[0].to);if(t.selection.ranges.some((h)=>t.sliceDoc(h.from,h.to)!=c))return!1;let p=ea(t,c);if(!p)return!1;return r(t.update({selection:t.selection.addRange(k.range(p.from,p.to),!1),effects:_.scrollIntoView(p.to)})),!0};var Vo=({state:t,dispatch:r})=>{let l=t.selection;if(l.ranges.length>1||l.main.empty)return!1;let{from:c,to:p}=l.main,h=[],g=0;for(let b=new ft(t.doc,t.sliceDoc(c,p));!b.next().done;){if(h.length>1000)return!1;if(b.value.from==c)g=h.length;h.push(k.range(b.value.from,b.value.to))}return r(t.update({selection:k.create(h,g),userEvent:"select.search.matches"})),!0};var _n=(t)=>{let{state:r}=t,l=r.doc.lineAt(r.selection.main.from),c=qn(t.state,l.from);return c.line?ta(t):c.block?na(t):!1};function Kn(t,r){return({state:l,dispatch:c})=>{if(l.readOnly)return!1;let p=t(r,l);if(!p)return!1;return c(l.update(p)),!0}}var ta=Kn(ia,0);var Hn=Kn(Ko,0);var na=Kn((t,r)=>Ko(t,r,oa(r)),0);function qn(t,r){let l=t.languageDataAt("commentTokens",r,1);return l.length?l[0]:{}}var St=50;function ra(t,{open:r,close:l},c,p){let h=t.sliceDoc(c-St,c),g=t.sliceDoc(p,p+St),b=/\s*$/.exec(h)[0].length,x=/^\s*/.exec(g)[0].length,w=h.length-b;if(h.slice(w-r.length,w)==r&&g.slice(x,x+l.length)==l)return{open:{pos:c-b,margin:b&&1},close:{pos:p+x,margin:x&&1}};let v,E;if(p-c<=2*St)v=E=t.sliceDoc(c,p);else v=t.sliceDoc(c,c+St),E=t.sliceDoc(p-St,p);let R=/^\s*/.exec(v)[0].length,O=/\s*$/.exec(E)[0].length,F=E.length-O-l.length;if(v.slice(R,R+r.length)==r&&E.slice(F,F+l.length)==l)return{open:{pos:c+R+r.length,margin:/\s/.test(v.charAt(R+r.length))?1:0},close:{pos:p-O-l.length,margin:/\s/.test(E.charAt(F-1))?1:0}};return null}function oa(t){let r=[];for(let l of t.selection.ranges){let c=t.doc.lineAt(l.from),p=l.to<=c.to?c:t.doc.lineAt(l.to);if(p.from>c.from&&p.from==l.to)p=l.to==c.to+1?c:t.doc.lineAt(l.to-1);let h=r.length-1;if(h>=0&&r[h].to>c.from)r[h].to=p.to;else r.push({from:c.from+/^\s*/.exec(c.text)[0].length,to:p.to})}return r}function Ko(t,r,l=r.selection.ranges){let c=l.map((h)=>qn(r,h.from).block);if(!c.every((h)=>h))return null;let p=l.map((h,g)=>ra(r,c[g],h.from,h.to));if(t!=2&&!p.every((h)=>h))return{changes:r.changes(l.map((h,g)=>{if(p[g])return[];return[{from:h.from,insert:c[g].open+" "},{from:h.to,insert:" "+c[g].close}]}))};else if(t!=1&&p.some((h)=>h)){let h=[];for(let g=0,b;g<p.length;g++)if(b=p[g]){let x=c[g],{open:w,close:v}=b;h.push({from:w.pos-x.open.length,to:w.pos+w.margin},{from:v.pos-v.margin,to:v.pos+x.close.length})}return{changes:h}}return null}function ia(t,r,l=r.selection.ranges){let c=[],p=-1;e:for(let{from:h,to:g}of l){let b=c.length,x=1e9,w;for(let v=h;v<=g;){let E=r.doc.lineAt(v);if(w==null){if(w=qn(r,E.from).line,!w)continue e}if(E.from>p&&(h==g||g>E.from)){p=E.from;let R=/^\s*/.exec(E.text)[0].length,O=R==E.length,F=E.text.slice(R,R+w.length)==w?R:-1;if(R<E.text.length&&R<x)x=R;c.push({line:E,comment:F,token:w,indent:R,empty:O,single:!1})}v=E.to+1}if(x<1e9){for(let v=b;v<c.length;v++)if(c[v].indent<c[v].line.text.length)c[v].indent=x}if(c.length==b+1)c[b].single=!0}if(t!=2&&c.some((h)=>h.comment<0&&(!h.empty||h.single))){let h=[];for(let{line:b,token:x,indent:w,empty:v,single:E}of c)if(E||!v)h.push({from:b.from+w,insert:x+" "});let g=r.changes(h);return{changes:g,selection:r.selection.map(g,1)}}else if(t!=1&&c.some((h)=>h.comment>=0)){let h=[];for(let{line:g,comment:b,token:x}of c)if(b>=0){let w=g.from+b,v=w+x.length;if(g.text[v-g.from]==" ")v++;h.push({from:w,to:v})}return{changes:h}}return null}var Un=Zr.define(),sa=Zr.define(),la=M.define(),Ho=M.define({combine(t){return Jn(t,{minDepth:100,newGroupDelay:500,joinToEvent:(r,l)=>l},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(r,l)=>(c,p)=>r(c,p)||l(c,p)})}}),Go=Qe.define({create(){return qe.empty},update(t,r){let l=r.state.facet(Ho),c=r.annotation(Un);if(c){let x=De.fromTransaction(r,c.selection),w=c.side,v=w==0?t.undone:t.done;if(x)v=Wt(v,v.length,l.minDepth,x);else v=Qo(v,r.startState.selection);return new qe(w==0?c.rest:v,w==0?v:c.rest)}let p=r.annotation(sa);if(p=="full"||p=="before")t=t.isolate();if(r.annotation(Gt.addToHistory)===!1)return!r.changes.empty?t.addMapping(r.changes.desc):t;let h=De.fromTransaction(r),g=r.annotation(Gt.time),b=r.annotation(Gt.userEvent);if(h)t=t.addChanges(h,g,b,l,r);else if(r.selection)t=t.addSelection(r.startState.selection,g,b,l.newGroupDelay);if(p=="full"||p=="after")t=t.isolate();return t},toJSON(t){return{done:t.done.map((r)=>r.toJSON()),undone:t.undone.map((r)=>r.toJSON())}},fromJSON(t){return new qe(t.done.map(De.fromJSON),t.undone.map(De.fromJSON))}});function Jo(t={}){return[Go,Ho.of(t),_.domEventHandlers({beforeinput(r,l){let c=r.inputType=="historyUndo"?zn:r.inputType=="historyRedo"?Xn:null;if(!c)return!1;return r.preventDefault(),c(l)}})]}function Xo(t,r){return function({state:l,dispatch:c}){if(!r&&l.readOnly)return!1;let p=l.field(Go,!1);if(!p)return!1;let h=p.pop(t,l,r);if(!h)return!1;return c(h),!0}}var zn=Xo(0,!1),Xn=Xo(1,!1);class De{constructor(t,r,l,c,p){this.changes=t,this.effects=r,this.mapped=l,this.startSelection=c,this.selectionsAfter=p}setSelAfter(t){return new De(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,r,l;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(r=this.mapped)===null||r===void 0?void 0:r.toJSON(),startSelection:(l=this.startSelection)===null||l===void 0?void 0:l.toJSON(),selectionsAfter:this.selectionsAfter.map((c)=>c.toJSON())}}static fromJSON(t){return new De(t.changes&&It.fromJSON(t.changes),[],t.mapped&&qa.fromJSON(t.mapped),t.startSelection&&k.fromJSON(t.startSelection),t.selectionsAfter.map(k.fromJSON))}static fromTransaction(t,r){let l=Be;for(let c of t.startState.facet(la)){let p=c(t);if(p.length)l=l.concat(p)}if(!l.length&&t.changes.empty)return null;return new De(t.changes.invert(t.startState.doc),l,void 0,r||t.startState.selection,Be)}static selection(t){return new De(void 0,Be,void 0,void 0,t)}}function Wt(t,r,l,c){let p=r+1>l+20?r-l-1:0,h=t.slice(p,r);return h.push(c),h}function aa(t,r){let l=[],c=!1;return t.iterChangedRanges((p,h)=>l.push(p,h)),r.iterChangedRanges((p,h,g,b)=>{for(let x=0;x<l.length;){let w=l[x++],v=l[x++];if(b>=w&&g<=v)c=!0}}),c}function ca(t,r){return t.ranges.length==r.ranges.length&&t.ranges.filter((l,c)=>l.empty!=r.ranges[c].empty).length===0}function Yo(t,r){return!t.length?r:!r.length?t:t.concat(r)}var Be=[],ua=200;function Qo(t,r){if(!t.length)return[De.selection([r])];else{let l=t[t.length-1],c=l.selectionsAfter.slice(Math.max(0,l.selectionsAfter.length-ua));if(c.length&&c[c.length-1].eq(r))return t;return c.push(r),Wt(t,t.length-1,1e9,l.setSelAfter(c))}}function da(t){let r=t[t.length-1],l=t.slice();return l[t.length-1]=r.setSelAfter(r.selectionsAfter.slice(0,r.selectionsAfter.length-1)),l}function Vn(t,r){if(!t.length)return t;let l=t.length,c=Be;while(l){let p=fa(t[l-1],r,c);if(p.changes&&!p.changes.empty||p.effects.length){let h=t.slice(0,l);return h[l-1]=p,h}else r=p.mapped,l--,c=p.selectionsAfter}return c.length?[De.selection(c)]:Be}function fa(t,r,l){let c=Yo(t.selectionsAfter.length?t.selectionsAfter.map((b)=>b.map(r)):Be,l);if(!t.changes)return De.selection(c);let p=t.changes.map(r),h=r.mapDesc(t.changes,!0),g=t.mapped?t.mapped.composeDesc(h):h;return new De(p,re.mapEffects(t.effects,r),g,t.startSelection.map(h),c)}var ma=/^(input\.type|delete)($|\.)/;class qe{constructor(t,r,l=0,c=void 0){this.done=t,this.undone=r,this.prevTime=l,this.prevUserEvent=c}isolate(){return this.prevTime?new qe(this.done,this.undone):this}addChanges(t,r,l,c,p){let h=this.done,g=h[h.length-1];if(g&&g.changes&&!g.changes.empty&&t.changes&&(!l||ma.test(l))&&(!g.selectionsAfter.length&&r-this.prevTime<c.newGroupDelay&&c.joinToEvent(p,aa(g.changes,t.changes))||l=="input.type.compose"))h=Wt(h,h.length-1,c.minDepth,new De(t.changes.compose(g.changes),Yo(re.mapEffects(t.effects,g.changes),g.effects),g.mapped,g.startSelection,Be));else h=Wt(h,h.length,c.minDepth,t);return new qe(h,Be,r,l)}addSelection(t,r,l,c){let p=this.done.length?this.done[this.done.length-1].selectionsAfter:Be;if(p.length>0&&r-this.prevTime<c&&l==this.prevUserEvent&&l&&/^select($|\.)/.test(l)&&ca(p[p.length-1],t))return this;return new qe(Qo(this.done,t),this.undone,r,l)}addMapping(t){return new qe(Vn(this.done,t),Vn(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,r,l){let c=t==0?this.done:this.undone;if(c.length==0)return null;let p=c[c.length-1],h=p.selectionsAfter[0]||(p.startSelection?p.startSelection.map(p.changes.invertedDesc,1):r.selection);if(l&&p.selectionsAfter.length)return r.update({selection:p.selectionsAfter[p.selectionsAfter.length-1],annotations:Un.of({side:t,rest:da(c),selection:h}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});else if(!p.changes)return null;else{let g=c.length==1?Be:c.slice(0,c.length-1);if(p.mapped)g=Vn(g,p.mapped);return r.update({changes:p.changes,selection:p.startSelection,effects:p.effects,annotations:Un.of({side:t,rest:g,selection:h}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}}}qe.empty=new qe(Be,Be);function mt(t,r){return k.create(t.ranges.map(r),t.mainIndex)}function Ve(t,r){return t.update({selection:r,scrollIntoView:!0,userEvent:"select"})}function Ue({state:t,dispatch:r},l){let c=mt(t.selection,l);if(c.eq(t.selection,!0))return!1;return r(Ve(t,c)),!0}function zt(t,r){return k.cursor(r?t.to:t.from)}function Zo(t,r){return Ue(t,(l)=>l.empty?t.moveByChar(l,r):zt(l,r))}function we(t){return t.textDirectionAt(t.state.selection.main.head)==Me.LTR}var ei=(t)=>Zo(t,!we(t)),ti=(t)=>Zo(t,we(t));function ni(t,r){return Ue(t,(l)=>l.empty?t.moveByGroup(l,r):zt(l,r))}var pa=(t)=>ni(t,!we(t)),ha=(t)=>ni(t,we(t));var ep=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function ga(t,r,l){if(r.type.prop(l))return!0;let c=r.to-r.from;return c&&(c>2||/[^\s,.;:]/.test(t.sliceDoc(r.from,r.to)))||r.firstChild}function Xt(t,r,l){let c=Mn(t).resolveInner(r.head),p=l?xe.closedBy:xe.openedBy;for(let x=r.head;;){let w=l?c.childAfter(x):c.childBefore(x);if(!w)break;if(ga(t,w,p))c=w;else x=l?w.to:w.from}let h=c.type.prop(p),g,b;if(h&&(g=l?Er(t,c.from,1):Er(t,c.to,-1))&&g.matched)b=l?g.end.to:g.end.from;else b=l?c.to:c.from;return k.cursor(b,l?-1:1)}var ba=(t)=>Ue(t,(r)=>Xt(t.state,r,!we(t))),ya=(t)=>Ue(t,(r)=>Xt(t.state,r,we(t)));function ri(t,r){return Ue(t,(l)=>{if(!l.empty)return zt(l,r);let c=t.moveVertically(l,r);return c.head!=l.head?c:t.moveToLineBoundary(l,r)})}var oi=(t)=>ri(t,!1),ii=(t)=>ri(t,!0);function li(t){let r=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,l=0,c=0,p;if(r){for(let h of t.state.facet(_.scrollMargins)){let g=h(t);if(g===null||g===void 0?void 0:g.top)l=Math.max(g===null||g===void 0?void 0:g.top,l);if(g===null||g===void 0?void 0:g.bottom)c=Math.max(g===null||g===void 0?void 0:g.bottom,c)}p=t.scrollDOM.clientHeight-l-c}else p=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:l,marginBottom:c,selfScroll:r,height:Math.max(t.defaultLineHeight,p-5)}}function ai(t,r){let l=li(t),{state:c}=t,p=mt(c.selection,(g)=>g.empty?t.moveVertically(g,r,l.height):zt(g,r));if(p.eq(c.selection))return!1;let h;if(l.selfScroll){let g=t.coordsAtPos(c.selection.main.head),b=t.scrollDOM.getBoundingClientRect(),x=b.top+l.marginTop,w=b.bottom-l.marginBottom;if(g&&g.top>x&&g.bottom<w)h=_.scrollIntoView(p.main.head,{y:"start",yMargin:g.top-x})}return t.dispatch(Ve(c,p),{effects:h}),!0}var Uo=(t)=>ai(t,!1),Wn=(t)=>ai(t,!0);function Ze(t,r,l){let c=t.lineBlockAt(r.head),p=t.moveToLineBoundary(r,l);if(p.head==r.head&&p.head!=(l?c.to:c.from))p=t.moveToLineBoundary(r,l,!1);if(!l&&p.head==c.from&&c.length){let h=/^\s*/.exec(t.state.sliceDoc(c.from,Math.min(c.from+100,c.to)))[0].length;if(h&&r.head!=c.from+h)p=k.cursor(c.from+h)}return p}var va=(t)=>Ue(t,(r)=>Ze(t,r,!0)),ka=(t)=>Ue(t,(r)=>Ze(t,r,!1)),wa=(t)=>Ue(t,(r)=>Ze(t,r,!we(t))),Sa=(t)=>Ue(t,(r)=>Ze(t,r,we(t))),Yn=(t)=>Ue(t,(r)=>t.moveToLineBoundary(r,!1,!1)),Qn=(t)=>Ue(t,(r)=>t.moveToLineBoundary(r,!0,!1));function Ca(t,r,l){let c=!1,p=mt(t.selection,(h)=>{let g=Er(t,h.head,-1)||Er(t,h.head,1)||h.head>0&&Er(t,h.head-1,1)||h.head<t.doc.length&&Er(t,h.head+1,-1);if(!g||!g.end)return h;c=!0;let b=g.start.from==h.head?g.end.to:g.end.from;return l?k.range(h.anchor,b):k.cursor(b)});if(!c)return!1;return r(Ve(t,p)),!0}var Ea=({state:t,dispatch:r})=>Ca(t,r,!1);function Ie(t,r,l){let c=mt(t.state.selection,(p)=>{if(p.undirectional&&p.head>=p.anchor!=r)p=k.range(p.head,p.anchor);let h=l(p);return k.range(p.anchor,h.head,h.goalColumn,h.bidiLevel||void 0,h.assoc)});if(c.eq(t.state.selection))return!1;return t.dispatch(Ve(t.state,c)),!0}function ci(t,r){return Ie(t,r,(l)=>t.moveByChar(l,r))}var di=(t)=>ci(t,!we(t)),fi=(t)=>ci(t,we(t));function mi(t,r){return Ie(t,r,(l)=>t.moveByGroup(l,r))}var Ma=(t)=>mi(t,!we(t)),Ra=(t)=>mi(t,we(t));var Da=(t)=>{let r=!we(t);return Ie(t,r,(l)=>Xt(t.state,l,r))},Ta=(t)=>{let r=we(t);return Ie(t,r,(l)=>Xt(t.state,l,r))};function pi(t,r){return Ie(t,r,(l)=>t.moveVertically(l,r))}var gi=(t)=>pi(t,!1),bi=(t)=>pi(t,!0);function xi(t,r){return Ie(t,r,(l)=>t.moveVertically(l,r,li(t).height))}var Wo=(t)=>xi(t,!1),$o=(t)=>xi(t,!0),Aa=(t)=>Ie(t,!0,(r)=>Ze(t,r,!0)),Oa=(t)=>Ie(t,!1,(r)=>Ze(t,r,!1)),Ba=(t)=>{let r=!we(t);return Ie(t,r,(l)=>Ze(t,l,r))},Ia=(t)=>{let r=we(t);return Ie(t,r,(l)=>Ze(t,l,r))},er=(t)=>Ie(t,!1,(r)=>k.cursor(t.lineBlockAt(r.head).from)),tr=(t)=>Ie(t,!0,(r)=>k.cursor(t.lineBlockAt(r.head).to)),$t=({state:t,dispatch:r})=>(r(Ve(t,{anchor:0})),!0),_t=({state:t,dispatch:r})=>(r(Ve(t,{anchor:t.doc.length})),!0),Ht=({state:t,dispatch:r})=>(r(Ve(t,{anchor:t.selection.main.anchor,head:0})),!0),qt=({state:t,dispatch:r})=>(r(Ve(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),Fa=({state:t,dispatch:r})=>(r(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),nr=({state:t,dispatch:r})=>{let l=Yt(t).map(({from:c,to:p})=>k.undirectionalRange(c,Math.min(p+1,t.doc.length)));return r(t.update({selection:k.create(l),userEvent:"select"})),!0},Na=({state:t,dispatch:r})=>{let l=mt(t.selection,(c)=>{let p=Mn(t),h=p.resolveStack(c.from,1);if(c.empty){let g=p.resolveStack(c.from,-1);if(g.node.from>=h.node.from&&g.node.to<=h.node.to)h=g}for(let g=h;g;g=g.next){let{node:b}=g;if((b.from<c.from&&b.to>=c.to||b.to>c.to&&b.from<=c.from)&&g.next)return k.undirectionalRange(b.from,b.to)}return c});if(l.eq(t.selection))return!1;return r(Ve(t,l)),!0};function vi(t,r){let{state:l}=t,c=l.selection,p=l.selection.ranges.slice();for(let h of l.selection.ranges){let g=l.doc.lineAt(h.head);if(r?g.to<t.state.doc.length:g.from>0)for(let b=h;;){let x=t.moveVertically(b,r);if(x.head<g.from||x.head>g.to){if(!p.some((w)=>w.head==x.head))p.push(x);break}else if(x.head==b.head)break;else b=x}}if(p.length==c.ranges.length)return!1;return t.dispatch(Ve(l,k.create(p,p.length-1))),!0}var rr=(t)=>vi(t,!1),or=(t)=>vi(t,!0),ir=({state:t,dispatch:r})=>{let l=t.selection,c=null;if(l.ranges.length>1)c=k.create([l.main]);else if(!l.main.empty)c=k.create([k.cursor(l.main.head)]);if(!c)return!1;return r(Ve(t,c)),!0};function Et(t,r){if(t.state.readOnly)return!1;let l="delete.selection",{state:c}=t,p=c.changeByRange((h)=>{let{from:g,to:b}=h;if(g==b){let x=r(h);if(x<g)l="delete.backward",x=Ut(t,x,!1);else if(x>g)l="delete.forward",x=Ut(t,x,!0);g=Math.min(g,x),b=Math.max(b,x)}else g=Ut(t,g,!1),b=Ut(t,b,!0);return g==b?{range:h}:{changes:{from:g,to:b},range:k.cursor(g,g<h.head?-1:1)}});if(p.changes.empty)return!1;return t.dispatch(c.update(p,{scrollIntoView:!0,userEvent:l,effects:l=="delete.selection"?_.announce.of(c.phrase("Selection deleted")):void 0})),!0}function Ut(t,r,l){if(t instanceof _)for(let c of t.state.facet(_.atomicRanges).map((p)=>p(t)))c.between(r,r,(p,h)=>{if(p<r&&h>r)r=l?h:p});return r}var ki=(t,r,l)=>Et(t,(c)=>{let p=c.from,{state:h}=t,g=h.doc.lineAt(p),b,x;if(l&&!r&&p>g.from&&p<g.from+200&&!/[^ \t]/.test(b=g.text.slice(0,p-g.from))){if(b[b.length-1]=="\t")return p-1;let w=Wa(b,h.tabSize),v=w%so(h)||so(h);for(let E=0;E<v&&b[b.length-1-E]==" ";E++)p--;x=p}else if(x=cn(g.text,p-g.from,r,r)+g.from,x==p&&g.number!=(r?h.doc.lines:1))x+=r?1:-1;else if(!r&&/[\ufe00-\ufe0f]/.test(g.text.slice(x-g.from,p-g.from)))x=cn(g.text,x-g.from,!1,!1)+g.from;return x}),$n=(t)=>ki(t,!1,!0);var Si=(t)=>ki(t,!0,!1),Ci=(t,r)=>Et(t,(l)=>{let c=l.head,{state:p}=t,h=p.doc.lineAt(c),g=p.charCategorizer(c);for(let b=null;;){if(c==(r?h.to:h.from)){if(c==l.head&&h.number!=(r?p.doc.lines:1))c+=r?1:-1;break}let x=cn(h.text,c-h.from,r)+h.from,w=h.text.slice(Math.min(c,x)-h.from,Math.max(c,x)-h.from),v=g(w);if(b!=null&&v!=b)break;if(w!=" "||c!=l.head)b=v;c=x}return c}),Ei=(t)=>Ci(t,!1),Va=(t)=>Ci(t,!0);var Ua=(t)=>Et(t,(r)=>{let l=t.lineBlockAt(r.head).to;return r.head<l?l:Math.min(t.state.doc.length,r.head+1)});var $a=(t)=>Et(t,(r)=>{let l=t.moveToLineBoundary(r,!1).head;return r.head>l?l:Math.max(0,r.head-1)}),_a=(t)=>Et(t,(r)=>{let l=t.moveToLineBoundary(r,!0).head;return r.head<l?l:Math.min(t.state.doc.length,r.head+1)});var Ka=({state:t,dispatch:r})=>{if(t.readOnly)return!1;let l=t.changeByRange((c)=>({changes:{from:c.from,to:c.to,insert:ke.of(["",""])},range:k.cursor(c.from)}));return r(t.update(l,{scrollIntoView:!0,userEvent:"input"})),!0},za=({state:t,dispatch:r})=>{if(t.readOnly)return!1;let l=t.changeByRange((c)=>{if(!c.empty||c.from==0||c.from==t.doc.length)return{range:c};let p=c.from,h=t.doc.lineAt(p),g=p==h.from?p-1:cn(h.text,p-h.from,!1)+h.from,b=p==h.to?p+1:cn(h.text,p-h.from,!0)+h.from;return{changes:{from:g,to:b,insert:t.doc.slice(p,b).append(t.doc.slice(g,p))},range:k.cursor(b)}});if(l.changes.empty)return!1;return r(t.update(l,{scrollIntoView:!0,userEvent:"move.character"})),!0};function Yt(t){let r=[],l=-1;for(let c of t.selection.ranges){let p=t.doc.lineAt(c.from),h=t.doc.lineAt(c.to);if(!c.empty&&c.to==h.from)h=t.doc.lineAt(c.to-1);if(l>=p.number){let g=r[r.length-1];g.to=h.to,g.ranges.push(c)}else r.push({from:p.from,to:h.to,ranges:[c]});l=h.number+1}return r}function Mi(t,r,l){if(t.readOnly)return!1;let c=[],p=[];for(let h of Yt(t)){if(l?h.to==t.doc.length:h.from==0)continue;let g=t.doc.lineAt(l?h.to+1:h.from-1),b=g.length+1;if(l){c.push({from:h.to,to:g.to},{from:h.from,insert:g.text+t.lineBreak});for(let x of h.ranges)p.push(k.range(Math.min(t.doc.length,x.anchor+b),Math.min(t.doc.length,x.head+b)))}else{c.push({from:g.from,to:h.from},{from:h.to,insert:t.lineBreak+g.text});for(let x of h.ranges)p.push(k.range(x.anchor-b,x.head-b))}}if(!c.length)return!1;return r(t.update({changes:c,scrollIntoView:!0,selection:k.create(p,t.selection.mainIndex),userEvent:"move.line"})),!0}var sr=({state:t,dispatch:r})=>Mi(t,r,!1),lr=({state:t,dispatch:r})=>Mi(t,r,!0);function Ri(t,r,l){if(t.readOnly)return!1;let c=[];for(let h of Yt(t))if(l)c.push({from:h.from,insert:t.doc.slice(h.from,h.to)+t.lineBreak});else c.push({from:h.to,insert:t.lineBreak+t.doc.slice(h.from,h.to)});let p=t.changes(c);return r(t.update({changes:p,selection:t.selection.map(p,l?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}var ar=({state:t,dispatch:r})=>Ri(t,r,!1),cr=({state:t,dispatch:r})=>Ri(t,r,!0),ur=(t)=>{if(t.state.readOnly)return!1;let{state:r}=t,l=r.changes(Yt(r).map(({from:p,to:h})=>{if(p>0)p--;else if(h<r.doc.length)h++;return{from:p,to:h}})),c=mt(r.selection,(p)=>{let h=void 0;if(t.lineWrapping){let g=t.lineBlockAt(p.head),b=t.coordsAtPos(p.head,p.assoc||1);if(b)h=g.bottom+t.documentTop-b.bottom+t.defaultLineHeight/2}return t.moveVertically(p,!0,h)}).map(l);return t.dispatch({changes:l,selection:c,scrollIntoView:!0,userEvent:"delete.line"}),!0};function ja(t,r){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(r-1,r+1)))return{from:r,to:r};let l=Mn(t).resolveInner(r),c=l.childBefore(r),p=l.childAfter(r),h;if(c&&p&&c.to<=r&&p.from>=r&&(h=c.type.prop(xe.closedBy))&&h.indexOf(p.name)>-1&&t.doc.lineAt(c.to).from==t.doc.lineAt(p.from).from&&!/\S/.test(t.sliceDoc(c.to,p.from)))return{from:c.to,to:p.from};return null}var _o=Di(!1),fr=Di(!0);function Di(t){return({state:r,dispatch:l})=>{if(r.readOnly)return!1;let c=r.changeByRange((p)=>{let{from:h,to:g}=p,b=r.doc.lineAt(h),x=!t&&h==g&&ja(r,h);if(t)h=g=(g<=b.to?b:r.doc.lineAt(g)).to;let w=new Zs(r,{simulateBreak:h,simulateDoubleBreak:!!x}),v=qu(w,h);if(v==null)v=Wa(/^\s*/.exec(r.doc.lineAt(h).text)[0],r.tabSize);while(g<b.to&&/\s/.test(b.text[g-b.from]))g++;if(x)({from:h,to:g}=x);else if(h>b.from&&h<b.from+100&&!/\S/.test(b.text.slice(0,h)))h=b.from;let E=["",Js(r,v)];if(x)E.push(Js(r,w.lineIndent(b.from,-1)));return{changes:{from:h,to:g,insert:ke.of(E)},range:k.cursor(h+1+E[1].length)}});return l(r.update(c,{scrollIntoView:!0,userEvent:"input"})),!0}}function mr(t,r){let l=-1;return t.changeByRange((c)=>{let p=[];for(let g=c.from;g<=c.to;){let b=t.doc.lineAt(g);if(b.number>l&&(c.empty||c.to>b.from))r(b,p,c),l=b.number;g=b.to+1}let h=t.changes(p);return{changes:p,range:k.range(h.mapPos(c.anchor,1),h.mapPos(c.head,1))}})}var Ga=({state:t,dispatch:r})=>{if(t.readOnly)return!1;let l=Object.create(null),c=new Zs(t,{overrideIndentation:(h)=>{let g=l[h];return g==null?-1:g}}),p=mr(t,(h,g,b)=>{let x=qu(c,h.from);if(x==null)return;if(!/\S/.test(h.text))x=0;let w=/^\s*/.exec(h.text)[0],v=Js(t,x);if(w!=v||b.from<h.from+w.length)l[h.from]=x,g.push({from:h.from,to:h.from+w.length,insert:v})});if(!p.changes.empty)r(t.update(p,{userEvent:"indent"}));return!0},Qt=({state:t,dispatch:r})=>{if(t.readOnly)return!1;return r(t.update(mr(t,(l,c)=>{c.push({from:l.from,insert:t.facet(es)})}),{userEvent:"input.indent"})),!0},Zt=({state:t,dispatch:r})=>{if(t.readOnly)return!1;return r(t.update(mr(t,(l,c)=>{let p=/^\s*/.exec(l.text)[0];if(!p)return;let h=Wa(p,t.tabSize),g=0,b=Js(t,Math.max(0,h-so(t)));while(g<p.length&&g<b.length&&p.charCodeAt(g)==b.charCodeAt(g))g++;c.push({from:l.from+g,to:l.from+p.length,insert:b.slice(g)})}),{userEvent:"delete.dedent"})),!0},Ja=(t)=>(t.setTabFocusMode(),!0);var Xa=[{key:"Ctrl-b",run:ei,shift:di,preventDefault:!0},{key:"Ctrl-f",run:ti,shift:fi},{key:"Ctrl-p",run:oi,shift:gi},{key:"Ctrl-n",run:ii,shift:bi},{key:"Ctrl-a",run:Yn,shift:er},{key:"Ctrl-e",run:Qn,shift:tr},{key:"Ctrl-d",run:Si},{key:"Ctrl-h",run:$n},{key:"Ctrl-k",run:Ua},{key:"Ctrl-Alt-h",run:Ei},{key:"Ctrl-o",run:Ka},{key:"Ctrl-t",run:za},{key:"Ctrl-v",run:Wn}],Ya=[{key:"ArrowLeft",run:ei,shift:di,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:pa,shift:Ma,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:wa,shift:Ba,preventDefault:!0},{key:"ArrowRight",run:ti,shift:fi,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:ha,shift:Ra,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Sa,shift:Ia,preventDefault:!0},{key:"ArrowUp",run:oi,shift:gi,preventDefault:!0},{mac:"Cmd-ArrowUp",run:$t,shift:Ht},{mac:"Ctrl-ArrowUp",run:Uo,shift:Wo},{key:"ArrowDown",run:ii,shift:bi,preventDefault:!0},{mac:"Cmd-ArrowDown",run:_t,shift:qt},{mac:"Ctrl-ArrowDown",run:Wn,shift:$o},{key:"PageUp",run:Uo,shift:Wo},{key:"PageDown",run:Wn,shift:$o},{key:"Home",run:ka,shift:Oa,preventDefault:!0},{key:"Mod-Home",run:$t,shift:Ht},{key:"End",run:va,shift:Aa,preventDefault:!0},{key:"Mod-End",run:_t,shift:qt},{key:"Enter",run:_o,shift:_o},{key:"Mod-a",run:Fa},{key:"Backspace",run:$n,shift:$n,preventDefault:!0},{key:"Delete",run:Si,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Ei,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Va,preventDefault:!0},{mac:"Mod-Backspace",run:$a,preventDefault:!0},{mac:"Mod-Delete",run:_a,preventDefault:!0}].concat(Xa.map((t)=>({mac:t.key,run:t.run,shift:t.shift}))),Ti=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:ba,shift:Da},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:ya,shift:Ta},{key:"Alt-ArrowUp",run:sr},{key:"Shift-Alt-ArrowUp",run:ar},{key:"Alt-ArrowDown",run:lr},{key:"Shift-Alt-ArrowDown",run:cr},{key:"Mod-Alt-ArrowUp",run:rr},{key:"Mod-Alt-ArrowDown",run:or},{key:"Escape",run:ir},{key:"Mod-Enter",run:fr},{key:"Alt-l",mac:"Ctrl-l",run:nr},{key:"Mod-i",run:Na,preventDefault:!0},{key:"Mod-[",run:Zt},{key:"Mod-]",run:Qt},{key:"Mod-Alt-\\",run:Ga},{key:"Shift-Mod-k",run:ur},{key:"Shift-Mod-\\",run:Ea},{key:"Mod-/",run:_n},{key:"Alt-A",mac:"Ctrl-A",run:Hn},{key:"Ctrl-m",mac:"Shift-Alt-m",run:Ja}].concat(Ya);var Qa={python:{line:"#"},bash:{line:"#"},yaml:{line:"#"},toml:{line:"#"},ruby:{line:"#"},perl:{line:"#"},r:{line:"#"},makefile:{line:"#"},dockerfile:{line:"#"},ini:{line:"#"},properties:{line:"#"},elixir:{line:"#"},graphql:{line:"#"},nix:{line:"#"},sql:{line:"--"},lua:{line:"--"},haskell:{line:"--"},css:{block:["/*","*/"]},scss:{block:["/*","*/"]},less:{block:["/*","*/"]},sass:{block:["/*","*/"]},stylus:{block:["/*","*/"]},html:{block:["<!--","-->"]},xml:{block:["<!--","-->"]},markdown:{block:["<!--","-->"]}};function Ai(t){return Qa[t]??{line:"//"}}function Li(t){return/^[ \t]*/.exec(t)?.[0].length??0}var Te=(t)=>/[{[(\[]$/.test(t.trimEnd()),ge=/^[ \t]*[}\])]$/,en={yaml:{opens:(t)=>/:\s*$/.test(t.trimEnd())&&!/^[ \t]*#/.test(t)},toml:{opens:Te,closes:ge},ini:{opens:Te,closes:ge},hcl:{opens:Te,closes:ge},protobuf:{opens:Te,closes:ge},graphql:{opens:Te,closes:ge},nix:{opens:Te,closes:ge},svelte:{opens:Te,closes:ge},astro:{opens:Te,closes:ge},vue:{opens:Te,closes:ge},zig:{opens:Te,closes:ge},solidity:{opens:Te,closes:ge},php:{opens:Te,closes:ge},powershell:{opens:Te,closes:ge},perl:{opens:Te,closes:ge},bash:{opens:(t)=>/\b(then|do|else)\s*$/.test(t.trimEnd()),closes:/^[ \t]*(fi|done|esac|\})$/},haskell:{opens:(t)=>/(=|\bwhere|\bdo|\bof|\bthen|\belse)\s*$/.test(t.trimEnd())},ocaml:{opens:(t)=>/(=|\bdo|\bthen|\belse|\bin|\bwith)\s*$/.test(t.trimEnd())},dockerfile:{opens:(t)=>/\\$/.test(t.trimEnd())},html:{opens:(t)=>{let r=t.trimEnd();return/<[a-zA-Z][^<>]*>$/.test(r)&&!/\/>$/.test(r)},closes:/^[ \t]*<\//},sql:{opens:()=>!1},makefile:{opens:()=>!1},properties:{opens:()=>!1},markdown:{opens:()=>!1},diff:{opens:()=>!1},text:{opens:()=>!1},go:{closes:ge},tsx:{closes:ge},jsx:{closes:ge}};function Oi(t){let r=en[t];return r!==void 0&&(r.opens!==void 0||r.closes!==void 0)}function Bi(t,r,l=2){let c=en[t]?.opens;if(!c)return null;let p=Li(r);return c(r)?p+l:p}function Ii(t,r,l=2){if(!en[t]?.closes?.test(r))return null;return Math.max(0,Li(r)-l)}function Pi(t){return en[t]?.closes??null}var Za=200;function ec(t){return(r,l)=>{if(!Oi(t))return;let c=r.lineAt(l,-1);for(let h=0;h<Za&&!c.text.trim()&&c.from>0;h++)c=r.lineAt(Math.max(0,c.from-1),-1);if(!c.text.trim())return;let p=Ii(t,c.text,r.unit);if(p!==null)return p;return Bi(t,c.text,r.unit)??void 0}}function tc(t){let r=Pi(t);return r?[{indentOnInput:r}]:[]}function Ni(t){return[Wf(),Tm.of(ec(t))]}function Vi(t){return ce.languageData.of(()=>tc(t))}class xr{constructor(t,r,l,c){this.state=t,this.pos=r,this.explicit=l,this.view=c,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(t){let r=Mn(this.state).resolveInner(this.pos,-1);while(r&&t.indexOf(r.name)<0)r=r.parent;return r?{from:r.from,to:this.pos,text:this.state.sliceDoc(r.from,this.pos),type:r.type}:null}matchBefore(t){let r=this.state.doc.lineAt(this.pos),l=Math.max(r.from,this.pos-250),c=r.text.slice(l-r.from,this.pos-r.from),p=c.search(zi(t,!1));return p<0?null:{from:l+p,to:this.pos,text:c.slice(p)}}get aborted(){return this.abortListeners==null}addEventListener(t,r,l){if(t=="abort"&&this.abortListeners){if(this.abortListeners.push(r),l&&l.onDocChange)this.abortOnDocChange=!0}}}function Ui(t){let r=Object.keys(t).join(""),l=/\w/.test(r);if(l)r=r.replace(/\w/g,"");return`[${l?"\\w":""}${r.replace(/[^\w\s]/g,"\\$&")}]`}function nc(t){let r=Object.create(null),l=Object.create(null);for(let{label:p}of t){r[p[0]]=!0;for(let h=1;h<p.length;h++)l[p[h]]=!0}let c=Ui(r)+Ui(l)+"*$";return[new RegExp("^"+c),new RegExp(c)]}function rc(t){let r=t.map((p)=>typeof p=="string"?{label:p}:p),[l,c]=r.every((p)=>/^\w+$/.test(p.label))?[/\w*$/,/\w+$/]:nc(r);return(p)=>{let h=p.matchBefore(c);return h||p.explicit?{from:h?h.from:p.pos,options:r,validFor:l}:null}}class yr{constructor(t,r,l,c){this.completion=t,this.source=r,this.match=l,this.score=c}}function nt(t){return t.selection.main.from}function zi(t,r){var l;let{source:c}=t,p=r&&c[0]!="^",h=c[c.length-1]!="$";if(!p&&!h)return t;return new RegExp(`${p?"^":""}(?:${c})${h?"$":""}`,(l=t.flags)!==null&&l!==void 0?l:t.ignoreCase?"i":"")}var ji=Zr.define();function oc(t,r,l,c){let{main:p}=t.selection,h=l-p.from,g=c-p.from;return{...t.changeByRange((b)=>{if(b!=p&&l!=c&&t.sliceDoc(b.from+h,b.from+g)!=t.sliceDoc(l,c))return{range:b};let x=t.toText(r);return{changes:{from:b.from+h,to:c==p.from?b.to:b.from+g,insert:x},range:k.cursor(b.from+h+x.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}var Wi=new WeakMap;function ic(t){if(!Array.isArray(t))return t;let r=Wi.get(t);if(!r)Wi.set(t,r=rc(t));return r}var on=re.define(),Mt=re.define();class Gi{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let r=0;r<t.length;){let l=Rn(t,r),c=Jr(l);this.chars.push(l);let p=t.slice(r,r+c),h=p.toUpperCase();this.folded.push(Rn(h==p?p.toLowerCase():h,0)),r+=c}this.astral=t.length!=this.chars.length}ret(t,r){return this.score=t,this.matched=r,this}match(t){if(this.pattern.length==0)return this.ret(-100,[]);if(t.length<this.pattern.length)return null;let{chars:r,folded:l,any:c,precise:p,byWord:h}=this;if(r.length==1){let A=Rn(t,0),L=Jr(A),N=L==t.length?0:-100;if(A==r[0]);else if(A==l[0])N+=-200;else return null;return this.ret(N,[0,L])}let g=t.indexOf(this.pattern);if(g==0)return this.ret(t.length==this.pattern.length?0:-100,[0,this.pattern.length]);let b=r.length,x=0;if(g<0){for(let A=0,L=Math.min(t.length,200);A<L&&x<b;){let N=Rn(t,A);if(N==r[x]||N==l[x])c[x++]=A;A+=Jr(N)}if(x<b)return null}let w=0,v=0,E=!1,R=0,O=-1,F=-1,P=/[a-z]/.test(t),U=!0;for(let A=0,L=Math.min(t.length,200),N=0;A<L&&v<b;){let W=Rn(t,A);if(g<0){if(w<b&&W==r[w])p[w++]=A;if(R<b)if(W==r[R]||W==l[R]){if(R==0)O=A;F=A+1,R++}else R=0}let H,G=W<255?W>=48&&W<=57||W>=97&&W<=122?2:W>=65&&W<=90?1:0:(H=Gu(W))!=H.toLowerCase()?1:H!=H.toUpperCase()?2:0;if(!A||G==1&&P||N==0&&G!=0){if(r[v]==W||l[v]==W&&(E=!0))h[v++]=A;else if(h.length)U=!1}N=G,A+=Jr(W)}if(v==b&&h[0]==0&&U)return this.result(-100+(E?-200:0),h,t);if(R==b&&O==0)return this.ret(-200-t.length+(F==t.length?0:-100),[0,F]);if(g>-1)return this.ret(-700-t.length,[g,g+this.pattern.length]);if(R==b)return this.ret(-900-t.length,[O,F]);if(v==b)return this.result(-100+(E?-200:0)+-700+(U?0:-1100),h,t);return r.length==2?null:this.result((c[0]?-700:0)+-200+-1100,c,t)}result(t,r,l){let c=[],p=0;for(let h of r){let g=h+(this.astral?Jr(Rn(l,h)):1);if(p&&c[p-1]==h)c[p-1]=g;else c[p++]=h,c[p++]=g}return this.ret(t-l.length,c)}}class Ji{constructor(t){this.pattern=t,this.matched=[],this.score=0,this.folded=t.toLowerCase()}match(t){if(t.length<this.pattern.length)return null;let r=t.slice(0,this.pattern.length),l=r==this.pattern?0:r.toLowerCase()==this.folded?-200:null;if(l==null)return null;return this.matched=[0,r.length],this.score=l+(t.length==this.pattern.length?0:-100),this}}var he=M.define({combine(t){return Jn(t,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:sc,filterStrict:!1,compareCompletions:(r,l)=>(r.sortText||r.label).localeCompare(l.sortText||l.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(r,l)=>r&&l,closeOnBlur:(r,l)=>r&&l,icons:(r,l)=>r&&l,tooltipClass:(r,l)=>(c)=>$i(r(c),l(c)),optionClass:(r,l)=>(c)=>$i(r(c),l(c)),addToOptions:(r,l)=>r.concat(l),filterStrict:(r,l)=>r||l})}});function $i(t,r){return t?r?t+" "+r:t:r}function sc(t,r,l,c,p,h){let g=t.textDirection==Me.RTL,b=g,x=!1,w="top",v,E,R=r.left-p.left,O=p.right-r.right,F=c.right-c.left,P=c.bottom-c.top;if(b&&R<Math.min(F,O))b=!1;else if(!b&&O<Math.min(F,R))b=!0;if(F<=(b?R:O))v=Math.max(p.top,Math.min(l.top,p.bottom-P))-r.top,E=Math.min(400,b?R:O);else{x=!0,E=Math.min(400,(g?r.right:p.right-r.left)-30);let L=p.bottom-r.bottom;if(L>=P||L>r.top)v=l.bottom-r.top;else w="bottom",v=r.bottom-l.top}let U=(r.bottom-r.top)/h.offsetHeight,A=(r.right-r.left)/h.offsetWidth;return{style:`${w}: ${v/U}px; max-width: ${E/A}px`,class:"cm-completionInfo-"+(x?g?"left-narrow":"right-narrow":b?"left":"right")}}var vr=re.define();function lc(t){let r=t.addToOptions.slice();if(t.icons)r.push({render(l){let c=document.createElement("div");if(c.classList.add("cm-completionIcon"),l.type)c.classList.add(...l.type.split(/\s+/g).map((p)=>"cm-completionIcon-"+p));return c.setAttribute("aria-hidden","true"),c},position:20});return r.push({render(l,c,p,h){let g=document.createElement("span");g.className="cm-completionLabel";let b=l.displayLabel||l.label,x=0;for(let w=0;w<h.length;){let v=h[w++],E=h[w++];if(v>x)g.appendChild(document.createTextNode(b.slice(x,v)));let R=g.appendChild(document.createElement("span"));R.appendChild(document.createTextNode(b.slice(v,E))),R.className="cm-completionMatchedText",x=E}if(x<b.length)g.appendChild(document.createTextNode(b.slice(x)));return g},position:50},{render(l){if(!l.detail)return null;let c=document.createElement("span");return c.className="cm-completionDetail",c.textContent=l.detail,c},position:80}),r.sort((l,c)=>l.position-c.position).map((l)=>l.render)}function pr(t,r,l){if(t<=l)return{from:0,to:t};if(r<0)r=0;if(r<=t>>1){let p=Math.floor(r/l);return{from:p*l,to:(p+1)*l}}let c=Math.ceil((t-r)/l);return{from:t-c*l,to:t-(c-1)*l}}class Xi{constructor(t,r,l){this.view=t,this.stateField=r,this.applyCompletion=l,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:(b)=>this.placeInfo(b),key:this},this.space=null,this.currentClass="";let c=t.state.field(r),{options:p,selected:h}=c.open,g=t.state.facet(he);this.optionContent=lc(g),this.optionClass=g.optionClass,this.tooltipClass=g.tooltipClass,this.range=pr(p.length,h,g.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",(b)=>{let{options:x}=t.state.field(r).open;for(let w=b.target,v;w&&w!=this.dom;w=w.parentNode)if(w.nodeName=="LI"&&(v=/-(\d+)$/.exec(w.id))&&+v[1]<x.length){this.applyCompletion(t,x[+v[1]]),b.preventDefault();return}if(b.target==this.list){let w=this.list.classList.contains("cm-completionListIncompleteTop")&&b.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&b.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;if(w!=null)t.dispatch({effects:vr.of(w)}),b.preventDefault()}}),this.dom.addEventListener("focusout",(b)=>{let x=t.state.field(this.stateField,!1);if(x&&x.tooltip&&t.state.facet(he).closeOnBlur&&b.relatedTarget!=t.contentDOM)t.dispatch({effects:Mt.of(null)})}),this.showOptions(p,c.id)}mount(){this.updateSel()}showOptions(t,r){if(this.list)this.list.remove();this.list=this.dom.appendChild(this.createListBox(t,r,this.range)),this.list.addEventListener("scroll",()=>{if(this.info)this.view.requestMeasure(this.placeInfoReq)})}update(t){var r;let l=t.state.field(this.stateField),c=t.startState.field(this.stateField);if(this.updateTooltipClass(t.state),l!=c){let{options:p,selected:h,disabled:g}=l.open;if(!c.open||c.open.options!=p)this.range=pr(p.length,h,t.state.facet(he).maxRenderedOptions),this.showOptions(p,l.id);if(this.updateSel(),g!=((r=c.open)===null||r===void 0?void 0:r.disabled))this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!g)}}updateTooltipClass(t){let r=this.tooltipClass(t);if(r!=this.currentClass){for(let l of this.currentClass.split(" "))if(l)this.dom.classList.remove(l);for(let l of r.split(" "))if(l)this.dom.classList.add(l);this.currentClass=r}}positioned(t){if(this.space=t,this.info)this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),r=t.open;if(r.selected>-1&&r.selected<this.range.from||r.selected>=this.range.to)this.range=pr(r.options.length,r.selected,this.view.state.facet(he).maxRenderedOptions),this.showOptions(r.options,t.id);let l=this.updateSelectedOption(r.selected);if(l){this.destroyInfo();let{completion:c}=r.options[r.selected],{info:p}=c;if(!p)return;let h=typeof p==="string"?document.createTextNode(p):p(c);if(!h)return;if("then"in h)h.then((g)=>{if(g&&this.view.state.field(this.stateField,!1)==t)this.addInfoPane(g,c)}).catch((g)=>bn(this.view.state,g,"completion info"));else this.addInfoPane(h,c),l.setAttribute("aria-describedby",this.info.id)}}addInfoPane(t,r){this.destroyInfo();let l=this.info=document.createElement("div");if(l.className="cm-tooltip cm-completionInfo",l.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),t.nodeType!=null)l.appendChild(t),this.infoDestroy=null;else{let{dom:c,destroy:p}=t;l.appendChild(c),this.infoDestroy=p||null}this.dom.appendChild(l),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let r=null;for(let l=this.list.firstChild,c=this.range.from;l;l=l.nextSibling,c++)if(l.nodeName!="LI"||!l.id)c--;else if(c==t){if(!l.hasAttribute("aria-selected"))l.setAttribute("aria-selected","true"),r=l}else if(l.hasAttribute("aria-selected"))l.removeAttribute("aria-selected"),l.removeAttribute("aria-describedby");if(r)cc(this.list,r);return r}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let r=this.dom.getBoundingClientRect(),l=this.info.getBoundingClientRect(),c=t.getBoundingClientRect(),p=this.space;if(!p){let h=this.dom.ownerDocument.documentElement;p={left:0,top:0,right:h.clientWidth,bottom:h.clientHeight}}if(c.top>Math.min(p.bottom,r.bottom)-10||c.bottom<Math.max(p.top,r.top)+10)return null;return this.view.state.facet(he).positionInfo(this.view,r,c,l,p,this.dom)}placeInfo(t){if(this.info)if(t){if(t.style)this.info.style.cssText=t.style;this.info.className="cm-tooltip cm-completionInfo "+(t.class||"")}else this.info.style.cssText="top: -1e6px"}createListBox(t,r,l){let c=document.createElement("ul");c.id=r,c.setAttribute("role","listbox"),c.setAttribute("aria-expanded","true"),c.setAttribute("aria-label",this.view.state.phrase("Completions")),c.addEventListener("mousedown",(h)=>{if(h.target==c)h.preventDefault()});let p=null;for(let h=l.from;h<l.to;h++){let{completion:g,match:b}=t[h],{section:x}=g;if(x){let E=typeof x=="string"?x:x.name;if(E!=p&&(h>l.from||l.from==0))if(p=E,typeof x!="string"&&x.header)c.appendChild(x.header(x));else{let R=c.appendChild(document.createElement("completion-section"));R.textContent=E}}let w=c.appendChild(document.createElement("li"));w.id=r+"-"+h,w.setAttribute("role","option");let v=this.optionClass(g);if(v)w.className=v;for(let E of this.optionContent){let R=E(g,this.view.state,this.view,b);if(R)w.appendChild(R)}}if(l.from)c.classList.add("cm-completionListIncompleteTop");if(l.to<t.length)c.classList.add("cm-completionListIncompleteBottom");return c}destroyInfo(){if(this.info){if(this.infoDestroy)this.infoDestroy();this.info.remove(),this.info=null}}destroy(){this.destroyInfo()}}function ac(t,r){return(l)=>new Xi(l,t,r)}function cc(t,r){let l=t.getBoundingClientRect(),c=r.getBoundingClientRect(),p=l.height/t.offsetHeight;if(c.top<l.top)t.scrollTop-=(l.top-c.top)/p;else if(c.bottom>l.bottom)t.scrollTop+=(c.bottom-l.bottom)/p}function _i(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function uc(t,r){let l=[],c=null,p=null,h=(v)=>{l.push(v);let{section:E}=v.completion;if(E){if(!c)c=[];let R=typeof E=="string"?E:E.name;if(!c.some((O)=>O.name==R))c.push(typeof E=="string"?{name:R}:E)}},g=r.facet(he);for(let v of t)if(v.hasResult()){let E=v.result.getMatch;if(v.result.filter===!1)for(let R of v.result.options)h(new yr(R,v.source,E?E(R):[],1e9-l.length));else{let R=r.sliceDoc(v.from,v.to),O,F=g.filterStrict?new Ji(R):new Gi(R);for(let P of v.result.options)if(O=F.match(P.label)){let U=!P.displayLabel?O.matched:E?E(P,O.matched):[],A=O.score+(P.boost||0);if(h(new yr(P,v.source,U,A)),typeof P.section=="object"&&P.section.rank==="dynamic"){let{name:L}=P.section;if(!p)p=Object.create(null);p[L]=Math.max(A,p[L]||-1e9)}}}}if(c){let v=Object.create(null),E=0,R=(O,F)=>(O.rank==="dynamic"&&F.rank==="dynamic"?p[F.name]-p[O.name]:0)||(typeof O.rank=="number"?O.rank:1e9)-(typeof F.rank=="number"?F.rank:1e9)||(O.name<F.name?-1:1);for(let O of c.sort(R))E-=1e5,v[O.name]=E;for(let O of l){let{section:F}=O.completion;if(F)O.score+=v[typeof F=="string"?F:F.name]}}let b=[],x=null,w=g.compareCompletions;for(let v of l.sort((E,R)=>R.score-E.score||w(E.completion,R.completion))){let E=v.completion;if(!x||x.label!=E.label||x.detail!=E.detail||x.type!=null&&E.type!=null&&x.type!=E.type||x.apply!=E.apply||x.boost!=E.boost)b.push(v);else if(_i(v.completion)>_i(x))b[b.length-1]=v;x=v.completion}return b}class pt{constructor(t,r,l,c,p,h){this.options=t,this.attrs=r,this.tooltip=l,this.timestamp=c,this.selected=p,this.disabled=h}setSelected(t,r){return t==this.selected||t>=this.options.length?this:new pt(this.options,Ki(r,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,r,l,c,p,h){if(c&&!h&&t.some((x)=>x.isPending))return c.setDisabled();let g=uc(t,r);if(!g.length)return c&&t.some((x)=>x.isPending)?c.setDisabled():null;let b=r.facet(he).selectOnOpen?0:-1;if(c&&c.selected!=b&&c.selected!=-1){let x=c.options[c.selected].completion;for(let w=0;w<g.length;w++)if(g[w].completion==x){b=w;break}}return new pt(g,Ki(l,b),{pos:t.reduce((x,w)=>w.hasResult()?Math.min(x,w.from):x,1e8),create:gc,above:p.aboveCursor},c?c.timestamp:Date.now(),b,!1)}map(t){return new pt(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new pt(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class ln{constructor(t,r,l){this.active=t,this.id=r,this.open=l}static start(){return new ln(pc,"cm-ac-"+Math.floor(Math.random()*2000000).toString(36),null)}update(t){let{state:r}=t,l=r.facet(he),p=(l.override||r.languageDataAt("autocomplete",nt(r)).map(ic)).map((b)=>(this.active.find((w)=>w.source==b)||new Fe(b,this.active.some((w)=>w.state!=0)?1:0)).update(t,l));if(p.length==this.active.length&&p.every((b,x)=>b==this.active[x]))p=this.active;let h=this.open,g=t.effects.some((b)=>b.is(kr));if(h&&t.docChanged)h=h.map(t.changes);if(t.selection||p.some((b)=>b.hasResult()&&t.changes.touchesRange(b.from,b.to))||!dc(p,this.active)||g)h=pt.build(p,r,this.id,h,l,g);else if(h&&h.disabled&&!p.some((b)=>b.isPending))h=null;if(!h&&p.every((b)=>!b.isPending)&&p.some((b)=>b.hasResult()))p=p.map((b)=>b.hasResult()?new Fe(b.source,0):b);for(let b of t.effects)if(b.is(vr))h=h&&h.setSelected(b.value,this.id);return p==this.active&&h==this.open?this:new ln(p,this.id,h)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?fc:mc}}function dc(t,r){if(t==r)return!0;for(let l=0,c=0;;){while(l<t.length&&!t[l].hasResult())l++;while(c<r.length&&!r[c].hasResult())c++;let p=l==t.length,h=c==r.length;if(p||h)return p==h;if(t[l++].result!=r[c++].result)return!1}}var fc={"aria-autocomplete":"list"},mc={};function Ki(t,r){let l={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};if(r>-1)l["aria-activedescendant"]=t+"-"+r;return l}var pc=[];function Yi(t,r){if(t.isUserEvent("input.complete")){let c=t.annotation(ji);if(c&&r.activateOnCompletion(c))return 12}let l=t.isUserEvent("input.type");return l&&r.activateOnTyping?5:l?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class Fe{constructor(t,r,l=!1){this.source=t,this.state=r,this.explicit=l}hasResult(){return!1}get isPending(){return this.state==1}update(t,r){let l=Yi(t,r),c=this;if(l&8||l&16&&this.touches(t))c=new Fe(c.source,0);if(l&4&&c.state==0)c=new Fe(this.source,1);c=c.updateFor(t,l);for(let p of t.effects)if(p.is(on))c=new Fe(c.source,1,p.value);else if(p.is(Mt))c=new Fe(c.source,0);else if(p.is(kr)){for(let h of p.value)if(h.source==c.source)c=h}return c}updateFor(t,r){return this.map(t.changes)}map(t){return this}touches(t){return t.changes.touchesRange(nt(t.state))}}class gt extends Fe{constructor(t,r,l,c,p,h){super(t,3,r);this.limit=l,this.result=c,this.from=p,this.to=h}hasResult(){return!0}updateFor(t,r){var l;if(!(r&3))return this.map(t.changes);let c=this.result;if(c.map&&!t.changes.empty)c=c.map(c,t.changes);let p=t.changes.mapPos(this.from),h=t.changes.mapPos(this.to,1),g=nt(t.state);if(g>h||!c||r&2&&(nt(t.startState)==this.from||g<this.limit))return new Fe(this.source,r&4?1:0);let b=t.changes.mapPos(this.limit);if(hc(c.validFor,t.state,p,h))return new gt(this.source,this.explicit,b,c,p,h);if(c.update&&(c=c.update(c,p,h,new xr(t.state,g,!1))))return new gt(this.source,this.explicit,b,c,c.from,(l=c.to)!==null&&l!==void 0?l:nt(t.state));return new Fe(this.source,1,this.explicit)}map(t){if(t.empty)return this;let r=this.result.map?this.result.map(this.result,t):this.result;if(!r)return new Fe(this.source,0);return new gt(this.source,this.explicit,t.mapPos(this.limit),r,t.mapPos(this.from),t.mapPos(this.to,1))}touches(t){return t.changes.touchesRange(this.from,this.to)}}function hc(t,r,l,c){if(!t)return!1;let p=r.sliceDoc(l,c);return typeof t=="function"?t(p,l,c,r):zi(t,!0).test(p)}var kr=re.define({map(t,r){return t.map((l)=>l.map(r))}}),Ae=Qe.define({create(){return ln.start()},update(t,r){return t.update(r)},provide:(t)=>[bc.from(t,(r)=>r.tooltip),_.contentAttributes.from(t,(r)=>r.attrs)]});function Sr(t,r){let l=r.completion.apply||r.completion.label,c=t.state.field(Ae).active.find((p)=>p.source==r.source);if(!(c instanceof gt))return!1;if(typeof l=="string")t.dispatch({...oc(t.state,l,c.from,c.to),annotations:ji.of(r.completion)});else l(t,r.completion,c.from,c.to);return!0}var gc=ac(Ae,Sr);function nn(t,r="option"){return(l)=>{let c=l.state.field(Ae,!1);if(!c||!c.open||c.open.disabled||Date.now()-c.open.timestamp<l.state.facet(he).interactionDelay)return!1;let p=1,h;if(r=="page"&&(h=Hf(l,c.open.tooltip)))p=Math.max(2,Math.floor(h.dom.offsetHeight/h.dom.querySelector("li").offsetHeight)-1);let{length:g}=c.open.options,b=c.open.selected>-1?c.open.selected+p*(t?1:-1):t?0:g-1;if(b<0)b=r=="page"?0:g-1;else if(b>=g)b=r=="page"?g-1:0;return l.dispatch({effects:vr.of(b)}),!0}}var yc=(t)=>{let r=t.state.field(Ae,!1);if(t.state.readOnly||!r||!r.open||r.open.selected<0||r.open.disabled||Date.now()-r.open.timestamp<t.state.facet(he).interactionDelay)return!1;return Sr(t,r.open.options[r.open.selected])},hr=(t)=>{if(!t.state.field(Ae,!1))return!1;return t.dispatch({effects:on.of(!0)}),!0},xc=(t)=>{let r=t.state.field(Ae,!1);if(!r||!r.active.some((l)=>l.state!=0))return!1;return t.dispatch({effects:Mt.of(null)}),!0};class Qi{constructor(t,r){this.active=t,this.context=r,this.time=Date.now(),this.updates=[],this.done=void 0}}var kc=50,wc=1000,Ac=ye.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let r of t.state.field(Ae).active)if(r.isPending)this.startQuery(r)}update(t){let r=t.state.field(Ae),l=t.state.facet(he);if(!t.selectionSet&&!t.docChanged&&t.startState.field(Ae)==r)return;let c=t.transactions.some((h)=>{let g=Yi(h,l);return g&8||(h.selection||h.docChanged)&&!(g&3)});for(let h=0;h<this.running.length;h++){let g=this.running[h];if(c||g.context.abortOnDocChange&&t.docChanged||g.updates.length+t.transactions.length>kc&&Date.now()-g.time>wc){for(let b of g.context.abortListeners)try{b()}catch(x){bn(this.view.state,x)}g.context.abortListeners=null,this.running.splice(h--,1)}else g.updates.push(...t.transactions)}if(this.debounceUpdate>-1)clearTimeout(this.debounceUpdate);if(t.transactions.some((h)=>h.effects.some((g)=>g.is(on))))this.pendingStart=!0;let p=this.pendingStart?50:l.activateOnTypingDelay;if(this.debounceUpdate=r.active.some((h)=>h.isPending&&!this.running.some((g)=>g.active.source==h.source))?setTimeout(()=>this.startUpdate(),p):-1,this.composing!=0){for(let h of t.transactions)if(h.isUserEvent("input.type"))this.composing=2;else if(this.composing==2&&h.selection)this.composing=3}}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,r=t.field(Ae);for(let l of r.active)if(l.isPending&&!this.running.some((c)=>c.active.source==l.source))this.startQuery(l);if(this.running.length&&r.open&&r.open.disabled)this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(he).updateSyncTime)}startQuery(t){let{state:r}=this.view,l=nt(r),c=new xr(r,l,t.explicit,this.view),p=new Qi(t,c);this.running.push(p),Promise.resolve(t.source(c)).then((h)=>{if(!p.context.aborted)p.done=h||null,this.scheduleAccept()},(h)=>{this.view.dispatch({effects:Mt.of(null)}),bn(this.view.state,h)})}scheduleAccept(){if(this.running.every((t)=>t.done!==void 0))this.accept();else if(this.debounceAccept<0)this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(he).updateSyncTime)}accept(){var t;if(this.debounceAccept>-1)clearTimeout(this.debounceAccept);this.debounceAccept=-1;let r=[],l=this.view.state.facet(he),c=this.view.state.field(Ae);for(let p=0;p<this.running.length;p++){let h=this.running[p];if(h.done===void 0)continue;if(this.running.splice(p--,1),h.done){let b=nt(h.updates.length?h.updates[0].startState:this.view.state),x=Math.min(b,h.done.from+(h.active.explicit?0:1)),w=new gt(h.active.source,h.active.explicit,x,h.done,h.done.from,(t=h.done.to)!==null&&t!==void 0?t:b);for(let v of h.updates)w=w.update(v,l);if(w.hasResult()){r.push(w);continue}}let g=c.active.find((b)=>b.source==h.active.source);if(g&&g.isPending)if(h.done==null){let b=new Fe(h.active.source,0);for(let x of h.updates)b=b.update(x,l);if(!b.isPending)r.push(b)}else this.startQuery(g)}if(r.length||c.open&&c.open.disabled)this.view.dispatch({effects:kr.of(r)})}},{eventHandlers:{blur(t){let r=this.view.state.field(Ae,!1);if(r&&r.tooltip&&this.view.state.facet(he).closeOnBlur){let l=r.open&&Hf(this.view,r.open.tooltip);if(!l||!l.dom.contains(t.relatedTarget))setTimeout(()=>this.view.dispatch({effects:Mt.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){if(this.composing==3)setTimeout(()=>this.view.dispatch({effects:on.of(!1)}),20);this.composing=0}}}),Vc=typeof navigator=="object"&&/Win/.test(navigator.platform),Uc=wr.highest(_.domEventHandlers({keydown(t,r){let l=r.state.field(Ae,!1);if(!l||!l.open||l.open.disabled||l.open.selected<0||!t.key||t.key.length>1||t.ctrlKey&&!(Vc&&t.altKey)||t.metaKey)return!1;let c=l.open.options[l.open.selected],p=l.active.find((g)=>g.source==c.source),h=c.completion.commitCharacters||p.result.commitCharacters;if(h&&h.indexOf(t.key)>-1)Sr(r,c);return!1}})),Wc=_.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:0.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:0.5,display:"block",textAlign:"center",cursor:"pointer"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'\uD835\uDC65'"}},".cm-completionIcon-constant":{"&:after":{content:"'\uD835\uDC36'"}},".cm-completionIcon-type":{"&:after":{content:"'\uD835\uDC61'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\uD83D\uDD11︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});var Rt={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},tt=re.define({map(t,r){let l=r.mapPos(t,-1,Fn.TrackAfter);return l==null?void 0:l}}),Mr=new class extends Ha{};Mr.startSide=1;Mr.endSide=-1;var Zi=Qe.define({create(){return me.empty},update(t,r){if(t=t.map(r.changes),r.selection){let l=r.state.doc.lineAt(r.selection.main.head);t=t.update({filter:(c)=>c>=l.from&&c<=l.to})}for(let l of r.effects)if(l.is(tt))t=t.update({add:[Mr.range(l.value,l.value+1)]});return t}});function os(){return[Hc,Zi]}var br="()[]{}<>«»»«[]{}";function is(t){for(let r=0;r<br.length;r+=2)if(br.charCodeAt(r)==t)return br.charAt(r+1);return Gu(t<128?t:t+1)}function ss(t,r){return t.languageDataAt("closeBrackets",r)[0]||Rt}var Kc=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Hc=_.inputHandler.of((t,r,l,c)=>{if((Kc?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let p=t.state.selection.main;if(c.length>2||c.length==2&&Jr(Rn(c,0))==1||r!=p.from||l!=p.to)return!1;let h=jc(t.state,c);if(!h)return!1;return t.dispatch(h),!0}),qc=({state:t,dispatch:r})=>{if(t.readOnly)return!1;let c=ss(t,t.selection.main.head).brackets||Rt.brackets,p=null,h=t.changeByRange((g)=>{if(g.empty){let b=Gc(t.doc,g.head);for(let x of c)if(x==b&&an(t.doc,g.head)==is(Rn(x,0)))return{changes:{from:g.head-x.length,to:g.head+x.length},range:k.cursor(g.head-x.length)}}return{range:p=g}});if(!p)r(t.update(h,{scrollIntoView:!0,userEvent:"delete.backward"}));return!p},ls=[{key:"Backspace",run:qc}];function jc(t,r){let l=ss(t,t.selection.main.head),c=l.brackets||Rt.brackets;for(let p of c){let h=is(Rn(p,0));if(r==p)return h==p?Yc(t,p,c.indexOf(p+p+p)>-1,l):Jc(t,p,h,l.before||Rt.before);if(r==h&&as(t,t.selection.main.from))return Xc(t,p,h)}return null}function as(t,r){let l=!1;return t.field(Zi).between(0,t.doc.length,(c)=>{if(c==r)l=!0}),l}function an(t,r){let l=t.sliceString(r,r+2);return l.slice(0,Jr(Rn(l,0)))}function Gc(t,r){let l=t.sliceString(r-2,r);return Jr(Rn(l,0))==l.length?l:l.slice(1)}function Jc(t,r,l,c){let p=null,h=t.changeByRange((g)=>{if(!g.empty)return{changes:[{insert:r,from:g.from},{insert:l,from:g.to}],effects:tt.of(g.to+r.length),range:k.range(g.anchor+r.length,g.head+r.length)};let b=an(t.doc,g.head);if(!b||/\s/.test(b)||c.indexOf(b)>-1)return{changes:{insert:r+l,from:g.head},effects:tt.of(g.head+r.length),range:k.cursor(g.head+r.length)};return{range:p=g}});return p?null:t.update(h,{scrollIntoView:!0,userEvent:"input.type"})}function Xc(t,r,l){let c=null,p=t.changeByRange((h)=>{if(h.empty&&an(t.doc,h.head)==l)return{changes:{from:h.head,to:h.head+l.length,insert:l},range:k.cursor(h.head+l.length)};return c={range:h}});return c?null:t.update(p,{scrollIntoView:!0,userEvent:"input.type"})}function Yc(t,r,l,c){let p=c.stringPrefixes||Rt.stringPrefixes,h=null,g=t.changeByRange((b)=>{if(!b.empty)return{changes:[{insert:r,from:b.from},{insert:r,from:b.to}],effects:tt.of(b.to+r.length),range:k.range(b.anchor+r.length,b.head+r.length)};let x=b.head,w=an(t.doc,x),v;if(w==r){if(Hi(t,x))return{changes:{insert:r+r,from:x},effects:tt.of(x+r.length),range:k.cursor(x+r.length)};else if(as(t,x)){let R=l&&t.sliceDoc(x,x+r.length*3)==r+r+r?r+r+r:r;return{changes:{from:x,to:x+R.length,insert:R},range:k.cursor(x+R.length)}}}else if(l&&t.sliceDoc(x-2*r.length,x)==r+r&&(v=qi(t,x-2*r.length,p))>-1&&Hi(t,v))return{changes:{insert:r+r+r+r,from:x},effects:tt.of(x+r.length),range:k.cursor(x+r.length)};else if(t.charCategorizer(x)(w)!=rn.Word){if(qi(t,x,p)>-1&&!Zc(t,x,r,p))return{changes:{insert:r+r,from:x},effects:tt.of(x+r.length),range:k.cursor(x+r.length)}}return{range:h=b}});return h?null:t.update(g,{scrollIntoView:!0,userEvent:"input.type"})}function Hi(t,r){let l=Mn(t).resolveInner(r+1);return l.parent&&l.from==r}function Zc(t,r,l,c){let p=Mn(t).resolveInner(r,-1),h=c.reduce((g,b)=>Math.max(g,b.length),0);for(let g=0;g<5;g++){let b=t.sliceDoc(p.from,Math.min(p.to,p.from+l.length+h)),x=b.indexOf(l);if(!x||x>-1&&c.indexOf(b.slice(0,x))>-1){let v=p.firstChild;while(v&&v.from==p.from&&v.to-v.from>l.length+x){if(t.sliceDoc(v.to-l.length,v.to)==l)return!1;v=v.firstChild}return!0}let w=p.to==r&&p.parent;if(!w)break;p=w}return!1}function qi(t,r,l){let c=t.charCategorizer(r);if(c(t.sliceDoc(r-1,r))!=rn.Word)return r;for(let p of l){let h=r-p.length;if(t.sliceDoc(h,r)==p&&c(t.sliceDoc(h-1,h))!=rn.Word)return h}return-1}function cs(t={}){return[Uc,Ae,he.of(t),Ac,tu,Wc]}var eu=[{key:"Ctrl-Space",run:hr},{mac:"Alt-`",run:hr},{mac:"Alt-i",run:hr},{key:"Escape",run:xc},{key:"ArrowDown",run:nn(!0)},{key:"ArrowUp",run:nn(!1)},{key:"PageDown",run:nn(!0,"page")},{key:"PageUp",run:nn(!1,"page")},{key:"Enter",run:yc}],tu=wr.highest(oo.computeN([he],(t)=>t.facet(he).defaultKeymap?[eu]:[]));var us=500,nu=3,ds=50,fs=/[\w$]{3,}/g;function ru(t){let r=new Set;for(let l of t.matchAll(fs))if(r.add(l[0]),r.size>=ds*4)break;return[...r]}function ou(t){let r=t.matchBefore(fs);if(!r&&!t.explicit)return null;if(r&&r.from===r.to&&!t.explicit)return null;let l=t.state.doc.lineAt(t.pos).number,c=Math.max(1,l-us),p=Math.min(t.state.doc.lines,l+us),h=t.state.sliceDoc(t.state.doc.line(c).from,t.state.doc.line(p).to),g=ru(h).filter((b)=>b.length>=nu).slice(0,ds).map((b)=>({label:b}));if(g.length===0)return null;return{from:r?r.from:t.pos,options:g}}var ms={autoCloseBrackets:!0,autocomplete:!0};function dn({autoCloseBrackets:t,autocomplete:r}){let l=[];if(t)l.push(os(),oo.of(ls));if(r)l.push(cs({override:[ou],activateOnTyping:!0}));return l}var iu={" ":T.mark({class:"cm-whitespace-space"}),"\t":T.mark({class:"cm-whitespace-tab"})};function su(t,r,l,c){let p=t.doc.lineAt(r);for(;;){let h=Math.max(r,p.from),g=Math.min(l,p.to);for(let b=h;b<g;b++){let x=p.text[b-p.from];if(x===" "||x==="\t")c.add(b,b+1,iu[x])}if(p.to>=l||p.to>=t.doc.length)break;p=t.doc.lineAt(p.to+1)}}function lu(t,r,l,c,p){let h=Math.max(r.from,l),g=Math.min(r.to,c);if(h>=g)return;su(t,h,g,p)}var ps=ye.fromClass(class{constructor(t){this.decorations=this.build(t)}update(t){if(t.docChanged||t.selectionSet||t.viewportChanged)this.decorations=this.build(t.view)}build(t){let r=new it;for(let{from:l,to:c}of t.visibleRanges)for(let p of t.state.selection.ranges)if(!p.empty)lu(t.state,p,l,c,r);return r.finish()}},{decorations:(t)=>t.decorations});var fn=re.define(),au=T.mark({class:"find-match"}),cu=T.mark({class:"find-match",attributes:{"data-find-current":""}});function uu(t,r){if(t.marks.length===0)return T.none;let l=new it;for(let c=0;c<t.marks.length;c++){let p=t.marks[c],h=Math.max(0,Math.min(p.start,r.length)),g=Math.max(h,Math.min(p.end,r.length));if(g===h)continue;l.add(h,g,c===t.current?cu:au)}return l.finish()}var hs=Qe.define({create:()=>T.none,update(t,r){for(let l of r.effects)if(l.is(fn))return uu(l.value,r.state.doc);if(r.docChanged)return t.map(r.changes);return t},provide:(t)=>_.decorations.from(t)});var du=new Set([".",",",")","]","}",";",":"]);function gs(t){let r=t.selection.main,l=t.doc.lineAt(r.from).number,c=t.doc.lineAt(r.to),p=r.to>r.from&&c.from===r.to?c.number-1:c.number;return{first:l,last:Math.max(l,p)}}var bs=({state:t,dispatch:r})=>{let l=t.selection.main,c=l.from===l.to,{first:p,last:h}=gs(t),g=c?p+1:h;if(g<=p||g>t.doc.lines)return!1;let b=g,x=[];for(let w=p;w<b;w++){let v=t.doc.line(w),E=t.doc.line(w+1),R=E.text.replace(/^[ \t]+/,""),O=R===""||du.has(R[0])?"":" ";x.push({from:v.to,to:E.from+(E.text.length-R.length),insert:O})}return r(t.update({changes:x,scrollIntoView:!0,userEvent:"input.join"})),!0},ys=({state:t,dispatch:r})=>{let{first:l,last:c}=gs(t),p=[];for(let h=l;h<=c;h++){let g=t.doc.line(h),b=g.text.replace(/[ \t]+$/,"");if(b!==g.text)p.push({from:g.from+b.length,to:g.to,insert:""})}if(p.length===0)return!1;return r(t.update({changes:p,userEvent:"input.trim"})),!0};var fu=(t)=>{let{state:r}=t,l=r.selection.main,c=r.doc.lineAt(l.from),p=/^[ \t]*/.exec(c.text)?.[0]??"";return t.dispatch({changes:{from:c.from,insert:`${p}
|
|
2
|
+
`},selection:{anchor:c.from+p.length}}),!0},mu=(t)=>{if(t.state.selection.ranges.length<=1)return!1;return ir(t)},pu={undo:zn,redo:Xn,selectNextOccurrence:Fo,selectAllOccurrences:Vo,insertCursorBelow:or,insertCursorAbove:rr,moveLineUp:sr,moveLineDown:lr,copyLineUp:ar,copyLineDown:cr,deleteLine:ur,toggleComment:_n,toggleBlockComment:Hn,joinLines:bs,trimTrailingWhitespace:ys,insertLineBelow:fr,insertLineAbove:fu,indent:Qt,outdent:Zt,fold:Dm,unfold:Qm,foldAll:Nm,unfoldAll:Rm,lineStart:Yn,lineEnd:Qn,documentStart:$t,documentEnd:_t,selectToLineStart:er,selectToLineEnd:tr,selectToDocumentStart:Ht,selectToDocumentEnd:qt,selectLine:nr,escape:mu};function Dr(t,r,l){let c=pu[t];if(c)return c(r);return l?.(t),!0}var hu={Enter:"Enter",Escape:"Escape",Backspace:"Backspace",Delete:"Delete",Tab:"Tab",Space:"Space",ArrowUp:"ArrowUp",ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowRight:"ArrowRight",Home:"Home",End:"End",PageUp:"PageUp",PageDown:"PageDown"},gu={Slash:"/",Backslash:"\\",Comma:",",Period:".",Semicolon:";",Quote:"'",Backquote:"`",Minus:"-",Equal:"=",BracketLeft:"[",BracketRight:"]"};function bu(t){if(/^Key[A-Z]$/.test(t))return t.slice(3).toLowerCase();if(/^Digit\d$/.test(t))return t.slice(5);if(/^F\d{1,2}$/.test(t))return t;return hu[t]??gu[t]??null}function Rr(t){let r=bu(t.code);if(!r)return null;let l=r;if(t.alt)l=`Alt-${l}`;if(t.ctrl)l=`Ctrl-${l}`;if(t.meta)l=`Meta-${l}`;if(t.shift)l=`Shift-${l}`;return l}function yu(t){let r=[];for(let l of lo){let c=Rr(l.other),p=Rr(l.mac),h=l.windows?Rr(l.windows):null;if(!c&&!p)continue;let g=l.command;r.push({key:c??void 0,mac:p??void 0,win:h??void 0,run:(b)=>Dr(g,b,t)})}return r}var xu=[{key:"Tab",run:Qt,shift:Zt}];function xs(t,r=!1){let l=r?[]:xu;return oo.of([...yu(t),...l,...Ti])}var bt="<<<<<<<",vu="|||||||",ku=">>>>>>>",wu=/^(?:<{7}|\|{7}|>{7})(?: .*)?$/,Cu=T.line({class:"cm-conflict-ours"}),Eu=T.line({class:"cm-conflict-base"}),Mu=T.line({class:"cm-conflict-theirs"});function Ru(t){if(!wu.test(t))return null;if(t.startsWith(vu))return Eu;if(t.startsWith(ku))return Mu;return Cu}function vs(t){let r=[];for(let{from:l,to:c}of t.visibleRanges){let p=l;while(p<=c){let h=t.state.doc.lineAt(p),g=Ru(h.text);if(g)r.push(g.range(h.from));if(h.to===p&&h.to===t.state.doc.length)break;p=h.to+1}}return T.set(r,!0)}function ks(){return ye.fromClass(class{constructor(t){this.decorations=vs(t)}update(t){if(t.docChanged||t.viewportChanged)this.decorations=vs(t.view)}},{decorations:(t)=>t.decorations})}function ws(t){let r=t.indexOf(bt);while(r!==-1){if(r===0||t.charCodeAt(r-1)===10)return!0;r=t.indexOf(bt,r+bt.length)}return!1}function Ic(t){let r=0,l=t.indexOf(bt);while(l!==-1){if(l===0||t.charCodeAt(l-1)===10)r++;l=t.indexOf(bt,l+bt.length)}return r}class Tr{constructor(t,r,l){this.from=t,this.to=r,this.diagnostic=l}}class ot{constructor(t,r,l){this.diagnostics=t,this.panel=r,this.selected=l}static init(t,r,l){let c=l.facet(ze).markerFilter;if(c)t=c(t,l);let p=t.slice().sort((R,O)=>R.from-O.from||R.to-O.to),h=new it,g=[],b=0,x=l.doc.iter(),w=0,v=l.doc.length;for(let R=0;;){let O=R==p.length?null:p[R];if(!O&&!g.length)break;let F,P;if(g.length)F=b,P=g.reduce((L,N)=>Math.min(L,N.to),O&&O.from>F?O.from:1e8);else{if(F=O.from,F>v)break;P=O.to,g.push(O),R++}while(R<p.length){let L=p[R];if(L.from==F&&(L.to>L.from||L.to==F))g.push(L),R++,P=Math.min(L.to,P);else{P=Math.min(L.from,P);break}}P=Math.min(P,v);let U=!1;if(g.some((L)=>L.from==F&&(L.to==P||P==v))){if(U=F==P,!U&&P-F<10){let L=F-(w+x.value.length);if(L>0)x.next(L),w=F;for(let N=F;;){if(N>=P){U=!0;break}if(!x.lineBreak&&w+x.value.length>N)break;N=w+x.value.length,w+=x.value.length,x.next()}}}let A=Ps(g);if(U)h.add(F,F,T.widget({widget:new Fs(A),diagnostics:g.slice()}));else{let L=g.reduce((N,W)=>W.markClass?N+" "+W.markClass:N,"");h.add(F,P,T.mark({class:"cm-lintRange cm-lintRange-"+A+L,diagnostics:g.slice(),inclusiveEnd:g.some((N)=>N.to>P)}))}if(b=P,b==v)break;for(let L=0;L<g.length;L++)if(g[L].to<=b)g.splice(L--,1)}let E=h.finish();return new ot(E,r,yt(E))}}function yt(t,r=null,l=0){let c=null;return t.between(l,1e9,(p,h,{spec:g})=>{if(r&&g.diagnostics.indexOf(r)<0)return;if(!c)c=new Tr(p,h,r||g.diagnostics[0]);else if(g.diagnostics.indexOf(c.diagnostic)<0)return!1;else c=new Tr(c.from,h,c.diagnostic)}),c}function Es(t,r){let l=r.pos,c=r.end||l,p=t.state.facet(ze).hideOn(t,l,c);if(p!=null)return p;let h=t.startState.doc.lineAt(r.pos);return!!(t.effects.some((g)=>g.is(gn))||t.changes.touchesRange(h.from,Math.max(h.to,c)))}function Du(t,r){return t.field($e,!1)?r:r.concat(re.appendConfig.of(Vs))}function Tu(t,r){return{effects:Du(t,[gn.of(r)])}}var gn=re.define(),Rs=re.define(),Ds=re.define(),$e=Qe.define({create(){return new ot(T.none,null,null)},update(t,r){if(r.docChanged&&t.diagnostics.size){let l=t.diagnostics.map(r.changes),c=null,p=t.panel;if(t.selected){let h=r.changes.mapPos(t.selected.from,1);c=yt(l,t.selected.diagnostic,h)||yt(l,null,h)}if(!l.size&&p&&r.state.facet(ze).autoPanel)p=null;t=new ot(l,p,c)}for(let l of r.effects)if(l.is(gn)){let c=!r.state.facet(ze).autoPanel?t.panel:l.value.length?hn.open:null;t=ot.init(l.value,c,r.state)}else if(l.is(Rs))t=new ot(t.diagnostics,l.value?hn.open:null,t.selected);else if(l.is(Ds))t=new ot(t.diagnostics,t.panel,l.value);return t},provide:(t)=>[ju.from(t,(r)=>r.panel),_.decorations.from(t,(r)=>r.diagnostics)]});var Au=T.mark({class:"cm-lintRange cm-lintRange-active"});function Lu(t,r,l){let{diagnostics:c}=t.state.field($e),p,h=-1,g=-1;c.between(r-(l<0?1:0),r+(l>0?1:0),(x,w,{spec:v})=>{if(r>=x&&r<=w&&(x==w||(r>x||l>0)&&(r<w||l<0)))return p=v.diagnostics,h=x,g=w,!1});let b=t.state.facet(ze).tooltipFilter;if(p&&b)p=b(p,t.state);if(!p)return null;return{pos:h,end:g,above:!0,create(){return{dom:As(t,p)}}}}function As(t,r){return Cr("ul",{class:"cm-tooltip-lint"},r.map((l)=>Is(t,l,!1)))}var Ss=(t)=>{let r=t.state.field($e,!1);if(!r||!r.panel)return!1;return t.dispatch({effects:Rs.of(!1)}),!0};var Ou=ye.fromClass(class{constructor(t){this.view=t,this.timeout=-1,this.set=!0;let{delay:r}=t.state.facet(ze);this.lintTime=Date.now()+r,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,r)}run(){clearTimeout(this.timeout);let t=Date.now();if(t<this.lintTime-10)this.timeout=setTimeout(this.run,this.lintTime-t);else{this.set=!1;let{state:r}=this.view,{sources:l}=r.facet(ze);if(l.length)Bu(l.map((c)=>Promise.resolve(c(this.view))),(c)=>{if(this.view.state.doc==r.doc)this.view.dispatch(Tu(this.view.state,c.reduce((p,h)=>p.concat(h))))},(c)=>{bn(this.view.state,c)})}}update(t){let r=t.state.facet(ze);if(t.docChanged||r!=t.startState.facet(ze)||r.needsRefresh&&r.needsRefresh(t)){if(this.lintTime=Date.now()+r.delay,!this.set)this.set=!0,this.timeout=setTimeout(this.run,r.delay)}}force(){if(this.set)this.lintTime=Date.now(),this.run()}destroy(){clearTimeout(this.timeout)}});function Bu(t,r,l){let c=[],p=-1;for(let h of t)h.then((g)=>{if(c.push(g),clearTimeout(p),c.length==t.length)r(c);else p=setTimeout(()=>r(c),200)},l)}var ze=M.define({combine(t){return{sources:t.map((r)=>r.source).filter((r)=>r!=null),...Jn(t.map((r)=>r.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Cs,tooltipFilter:Cs,needsRefresh:(r,l)=>!r?l:!l?r:(c)=>r(c)||l(c),hideOn:(r,l)=>!r?l:!l?r:(c,p,h)=>r(c,p,h)||l(c,p,h),autoPanel:(r,l)=>r||l})}}});function Cs(t,r){return!t?r:!r?t:(l,c)=>r(t(l,c),c)}function Os(t,r={}){return[ze.of({source:t,config:r}),Ou,Vs]}function Bs(t){let r=[];if(t)e:for(let{name:l}of t){for(let c=0;c<l.length;c++){let p=l[c];if(/[a-zA-Z]/.test(p)&&!r.some((h)=>h.toLowerCase()==p.toLowerCase())){r.push(p);continue e}}r.push("")}return r}function Is(t,r,l){var c;let p=l?Bs(r.actions):[];return Cr("li",{class:"cm-diagnostic cm-diagnostic-"+r.severity},Cr("span",{class:"cm-diagnosticText"},r.renderMessage?r.renderMessage(t):r.message),(c=r.actions)===null||c===void 0?void 0:c.map((h,g)=>{let b=!1,x=(O)=>{if(O.preventDefault(),b)return;b=!0;let F=yt(t.state.field($e).diagnostics,r);if(F)h.apply(t,F.from,F.to)},{name:w}=h,v=p[g]?w.indexOf(p[g]):-1,E=v<0?w:[w.slice(0,v),Cr("u",w.slice(v,v+1)),w.slice(v+1)],R=h.markClass?" "+h.markClass:"";return Cr("button",{type:"button",class:"cm-diagnosticAction"+R,onclick:x,onmousedown:x,"aria-label":` Action: ${w}${v<0?"":` (access key "${p[g]})"`}.`},E)}),r.source&&Cr("div",{class:"cm-diagnosticSource"},r.source))}class Fs extends jt{constructor(t){super();this.sev=t}eq(t){return t.sev==this.sev}toDOM(){return Cr("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class Ar{constructor(t,r){this.diagnostic=r,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Is(t,r,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class hn{constructor(t){this.view=t,this.items=[];let r=(c)=>{if(c.ctrlKey||c.altKey||c.metaKey)return;if(c.keyCode==27)Ss(this.view),this.view.focus();else if(c.keyCode==38||c.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(c.keyCode==40||c.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(c.keyCode==36)this.moveSelection(0);else if(c.keyCode==35)this.moveSelection(this.items.length-1);else if(c.keyCode==13)this.view.focus();else if(c.keyCode>=65&&c.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:p}=this.items[this.selectedIndex],h=Bs(p.actions);for(let g=0;g<h.length;g++)if(h[g].toUpperCase().charCodeAt(0)==c.keyCode){let b=yt(this.view.state.field($e).diagnostics,p);if(b)p.actions[g].apply(t,b.from,b.to)}}else return;c.preventDefault()},l=(c)=>{for(let p=0;p<this.items.length;p++)if(this.items[p].dom.contains(c.target))this.moveSelection(p)};this.list=Cr("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:r,onclick:l}),this.dom=Cr("div",{class:"cm-panel-lint"},this.list,Cr("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Ss(this.view)},"×")),this.update()}get selectedIndex(){let t=this.view.state.field($e).selected;if(!t)return-1;for(let r=0;r<this.items.length;r++)if(this.items[r].diagnostic==t.diagnostic)return r;return-1}update(){let{diagnostics:t,selected:r}=this.view.state.field($e),l=0,c=!1,p=null,h=new Set;t.between(0,this.view.state.doc.length,(g,b,{spec:x})=>{for(let w of x.diagnostics){if(h.has(w))continue;h.add(w);let v=-1,E;for(let R=l;R<this.items.length;R++)if(this.items[R].diagnostic==w){v=R;break}if(v<0)E=new Ar(this.view,w),this.items.splice(l,0,E),c=!0;else if(E=this.items[v],v>l)this.items.splice(l,v-l),c=!0;if(r&&E.diagnostic==r.diagnostic){if(!E.dom.hasAttribute("aria-selected"))E.dom.setAttribute("aria-selected","true"),p=E}else if(E.dom.hasAttribute("aria-selected"))E.dom.removeAttribute("aria-selected");l++}});while(l<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0))c=!0,this.items.pop();if(this.items.length==0)this.items.push(new Ar(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),c=!0;if(p)this.list.setAttribute("aria-activedescendant",p.id),this.view.requestMeasure({key:this,read:()=>({sel:p.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:g,panel:b})=>{let x=b.height/this.list.offsetHeight;if(g.top<b.top)this.list.scrollTop-=(b.top-g.top)/x;else if(g.bottom>b.bottom)this.list.scrollTop+=(g.bottom-b.bottom)/x}});else if(this.selectedIndex<0)this.list.removeAttribute("aria-activedescendant");if(c)this.sync()}sync(){let t=this.list.firstChild;function r(){let l=t;t=l.nextSibling,l.remove()}for(let l of this.items)if(l.dom.parentNode==this.list){while(t!=l.dom)r();t=l.dom.nextSibling}else this.list.insertBefore(l.dom,t);while(t)r()}moveSelection(t){if(this.selectedIndex<0)return;let r=this.view.state.field($e),l=yt(r.diagnostics,this.items[t].diagnostic);if(!l)return;this.view.dispatch({selection:{anchor:l.from,head:l.to},scrollIntoView:!0,effects:Ds.of(l)})}static open(t){return new hn(t)}}function pn(t,r='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${r}>${encodeURIComponent(t)}</svg>')`}function mn(t){return pn(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${t}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}var Iu=_.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:0.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:mn("#f11")},".cm-lintRange-warning":{backgroundImage:mn("orange")},".cm-lintRange-info":{backgroundImage:mn("#999")},".cm-lintRange-hint":{backgroundImage:mn("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function Fu(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function Ps(t){let r="hint",l=1;for(let c of t){let p=Fu(c.severity);if(p>l)l=p,r=c.severity}return r}class Br extends Ln{constructor(t){super();this.diagnostics=t,this.severity=Ps(t)}toDOM(t){let r=document.createElement("div");r.className="cm-lint-marker cm-lint-marker-"+this.severity;let l=this.diagnostics,c=t.state.facet(yn).tooltipFilter;if(c)l=c(l,t.state);if(l.length)r.onmouseover=()=>Vu(t,r,l);return r}}function Pu(t,r){let l=(c)=>{let p=r.getBoundingClientRect();if(c.clientX>p.left-10&&c.clientX<p.right+10&&c.clientY>p.top-10&&c.clientY<p.bottom+10)return;for(let h=c.target;h;h=h.parentNode)if(h.nodeType==1&&h.classList.contains("cm-tooltip-lint"))return;if(window.removeEventListener("mousemove",l),t.state.field(Ns))t.dispatch({effects:Ir.of(null)})};window.addEventListener("mousemove",l)}function Vu(t,r,l){function c(){let g=t.elementAtHeight(r.getBoundingClientRect().top+5-t.documentTop);if(t.coordsAtPos(g.from))t.dispatch({effects:Ir.of({pos:g.from,above:!1,clip:!1,create(){return{dom:As(t,l),getCoords:()=>r.getBoundingClientRect()}}})});r.onmouseout=r.onmousemove=null,Pu(t,r)}let{hoverTime:p}=t.state.facet(yn),h=setTimeout(c,p);r.onmouseout=()=>{clearTimeout(h),r.onmouseout=r.onmousemove=null},r.onmousemove=()=>{clearTimeout(h),h=setTimeout(c,p)}}function Uu(t,r){let l=Object.create(null);for(let p of r){let h=t.lineAt(p.from);(l[h.from]||(l[h.from]=[])).push(p)}let c=[];for(let p in l)c.push(new Br(l[p]).range(+p));return me.of(c,!0)}var $u=Ys({class:"cm-gutter-lint",markers:(t)=>t.state.field(Lr),widgetMarker:(t,r,l)=>{let c=[];return t.state.field(Lr).between(l.from,l.to,(p,h,g)=>{if(p>l.from&&p<l.to)c.push(...g.diagnostics)}),c.length?new Br(c):null}}),Lr=Qe.define({create(){return me.empty},update(t,r){t=t.map(r.changes);let l=r.state.facet(yn).markerFilter;for(let c of r.effects)if(c.is(gn)){let p=c.value;if(l)p=l(p||[],r.state);t=Uu(r.state.doc,p.slice(0))}return t}}),Ir=re.define(),Ns=Qe.define({create(){return null},update(t,r){if(t&&r.docChanged)t=Es(r,t)?null:{...t,pos:r.changes.mapPos(t.pos)};return r.effects.reduce((l,c)=>c.is(Ir)?c.value:l,t)},provide:(t)=>bc.from(t)}),_u=_.baseTheme({".cm-gutter-lint":{width:"1.4em","& .cm-gutterElement":{padding:".2em"}},".cm-lint-marker":{width:"1em",height:"1em"},".cm-lint-marker-info":{content:pn('<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>')},".cm-lint-marker-warning":{content:pn('<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>')},".cm-lint-marker-error":{content:pn('<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>')}}),Hu=Kg(Lu,{hideOn:Es}),Vs=[$e,_.decorations.compute([$e],(t)=>{let{selected:r,panel:l}=t.field($e);return!r||!l||r.from==r.to?T.none:T.set([Au.range(r.from,r.to)])}),Hu,Iu],yn=M.define({combine(t){return Jn(t,{hoverTime:300,markerFilter:null,tooltipFilter:null})}});function Us(t={}){return[yn.of(t),Lr,$u,_u,Ns]}function Fr(t){if(t==="json")return"json";if(t==="yaml")return"yaml";if(t==="toml")return"toml";return null}async function zu(t){let{parse:r,printParseErrorCode:l}=await import("./main-rx9grv92.js"),c=[];r(t,c,{disallowComments:!0,allowTrailingComma:!1,allowEmptyContent:!0});let p=new Set,h=[];for(let g of c){if(p.has(g.offset))continue;p.add(g.offset),h.push({from:g.offset,to:g.offset+Math.max(g.length,1),message:l(g.error),severity:"error"})}return h}async function Ju(t){let{parseDocument:r}=await import("./index-h6jxmkxk.js"),l=r(t,{prettyErrors:!1}),c=l.errors.map((p)=>({from:p.pos[0],to:Math.max(p.pos[1],p.pos[0]+1),message:p.message,severity:"error"}));for(let p of l.warnings)c.push({from:p.pos[0],to:Math.max(p.pos[1],p.pos[0]+1),message:p.message,severity:"warning"});return c}async function Xu(t){let{parse:r,TomlError:l}=await import("./index-vnvrzwht.js");try{return r(t),[]}catch(c){if(!(c instanceof l))throw c;let p=dr(t,c.line-1)+Math.max(c.column-1,0);return[{from:p,to:p+1,message:c.message.split(`
|
|
3
|
+
`)[0],severity:"error"}]}}var Yu={json:zu,yaml:Ju,toml:Xu};async function Ws(t,r){return Yu[t](r)}var Qu=2097152,Zu=600;async function rd(t,r){let l=Fr(t);if(!l||r.length>Qu)return[];if(ws(r))return[];return(await Ws(l,r)).map((p)=>({from:Math.max(0,Math.min(p.from,r.length)),to:Math.max(0,Math.min(p.to,r.length)),severity:p.severity,message:p.message}))}function $s(t){if(!Fr(t))return[];return[Os((l)=>rd(t,l.state.doc.toString()),{delay:Zu}),Us()]}function xn(t){return[es.of(t),ce.tabSize.of(t==="\t"?1:t.length)]}function vn(t){return t?_.lineWrapping:[]}function kn(t){return t?[ce.readOnly.of(!0),_.editable.of(!1)]:[]}function od(t){let r=Ai(t);if("line"in r)return{line:r.line};return{block:{open:r.block[0],close:r.block[1]}}}function _s({language:t,wordWrapCompartment:r,readOnlyCompartment:l,themeCompartment:c,languageCompartment:p,indentCompartment:h,typingCompartment:g,wordWrap:b,readOnly:x,themes:w,typing:v,indentUnitText:E,blame:R,blameCompartment:O,onCommand:F,onDocChange:P,onState:U,onCaret:A,placeholder:L}){return[Sm(),jg(),Vg(),Io(),Gg(),Ug(),ps,Jo(),$g(),zg(),Hg(),Wg(),ce.allowMultipleSelections.of(!0),h.of(xn(E)),p.of([]),ce.languageData.of(()=>[{commentTokens:od(t)}]),...Ni(t),Vi(t),g.of(dn(v)),...$s(t),ks(),hs,Ku(),Lm,Pm,Wu(),Xs({placeholderDOM:Mm}),c.of(el(t,w)),Fm(),O.of(R??[]),r.of(vn(b)),l.of(kn(x)),_.contentAttributes.of({spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no"}),_.updateListener.of((N)=>{if(N.docChanged||N.selectionSet)U(N.state);if(N.docChanged)P(N.state.doc.toString());if(N.docChanged||N.selectionSet){let W=N.state.selection.main,H=N.state.doc.lineAt(W.from),G=N.view.contentDOM.dataset;G.selection=`${W.from},${W.to}`,G.line=String(H.number),A?.({line:H.number,column:W.from-H.from+1})}}),xs(F,x),L?qg(L):[],_.exceptionSink.of((N)=>JA(N))]}function Ks(t,r,l){let c=[],p=t.length,h=0;for(let g of t)h+=r(g);for(let g of t){if(p<=1)break;if(p<=12&&h<=8388608)break;if(g===l)continue;c.push(g),p-=1,h-=r(g)}return c}function id(t,r){return t!==void 0&&t.light===r.light&&t.dark===r.dark}function Hs(t){let r=new Map,l={wordWrap:t.wordWrap,readOnly:t.readOnly,blame:t.blame??null,themes:t.themes,indentUnitText:t.indentUnitText,typing:t.typing,placeholder:t.placeholder},c=new un,p=new un,h=new un,g=new un,b=new un,x=new un,w=new un,v=new Map,E=new Map,R=new Map,O=new Map,F=(A)=>_s({language:A,wordWrapCompartment:c,readOnlyCompartment:h,themeCompartment:x,languageCompartment:w,indentCompartment:g,typingCompartment:b,blameCompartment:p,blame:l.blame??null,onCommand:t.onCommand,onDocChange:t.onDocChange,onState:t.onState,onCaret:t.onCaret,...l}),P=(A,L)=>{r.delete(A),r.set(A,L)},U=(A)=>{let L=Ks([...r.keys()],(N)=>r.get(N)?.doc.length??0,A);for(let N of L)r.delete(N)};return{stateFor(A,L,N){let W=r.get(A);if(W)return P(A,W),W;let H=ce.create({doc:N,extensions:F(L)});return r.set(A,H),v.set(A,L),E.set(A,l.themes),R.set(A,l.indentUnitText),O.set(A,l.blame??null),U(A),H},remember(A,L){P(A,L)},drop(A){r.delete(A),v.delete(A),E.delete(A),R.delete(A),O.delete(A)},optionsEffects(A,L){let N=A.wordWrap!==l.wordWrap,W=A.readOnly!==l.readOnly,H=A.blame??null,G=H!==l.blame,z=A.indentUnitText!==l.indentUnitText,K=A.typing.autoCloseBrackets!==l.typing.autoCloseBrackets||A.typing.autocomplete!==l.typing.autocomplete,j=A.themes.light!==l.themes.light||A.themes.dark!==l.themes.dark;l.wordWrap=A.wordWrap,l.readOnly=A.readOnly,l.blame=H,l.themes=A.themes,l.indentUnitText=A.indentUnitText,l.typing=A.typing;let Z=[];if(N)Z.push(c.reconfigure(vn(l.wordWrap)));if(G){if(Z.push(p.reconfigure(l.blame??[])),L)O.set(L,l.blame??null)}if(W)Z.push(h.reconfigure(kn(l.readOnly)));if(z){if(Z.push(g.reconfigure(xn(l.indentUnitText))),L)R.set(L,l.indentUnitText)}if(K)Z.push(b.reconfigure(dn(l.typing)));let Q=L?v.get(L):void 0;if(j&&Q){if(Z.push(x.reconfigure(el(Q,l.themes))),L)E.set(L,l.themes)}return Z},currentEffects(A){let L=[c.reconfigure(vn(l.wordWrap)),h.reconfigure(kn(l.readOnly))],N=l.blame??null;if(A&&O.get(A)!==N)L.push(p.reconfigure(N??[])),O.set(A,N);let W=A?v.get(A):void 0;if(A&&R.get(A)!==l.indentUnitText)L.push(g.reconfigure(xn(l.indentUnitText))),R.set(A,l.indentUnitText);if(A&&W&&!id(E.get(A),l.themes))L.push(x.reconfigure(el(W,l.themes))),E.set(A,l.themes);return L},languageEffects(A,L){if(!r.has(A))return[];return[w.reconfigure(L)]}}}function qs({view:t,onCommand:r}){return{getSelection:()=>{let l=t.current;if(!l)return null;let c=l.state.selection.main;return{start:c.from,end:c.to}},select:(l,c,p=!0)=>{let h=t.current;if(!h)return;if(h.dispatch({selection:{anchor:l,head:c},scrollIntoView:!1}),p)h.focus()},applyDocument:(l,c,p)=>{let h=t.current;if(!h)return;h.dispatch({changes:{from:0,to:h.state.doc.length,insert:l},selection:{anchor:c,head:p}})},runCommand:(l)=>{let c=t.current;if(!c)return;Dr(l,c,r.current)},revealOffset:(l)=>{let c=t.current;if(!c)return;let p=Math.max(0,Math.min(l,c.state.doc.length));_m(c.scrollDOM),c.dispatch({effects:_.scrollIntoView(p,{y:"nearest",yMargin:24})})}}}function Pr(t,r,l,c){if(r===c.current)return;if(r===t.state.doc.toString()){c.current=r;return}l.current=!0;try{t.dispatch({changes:{from:0,to:t.state.doc.length,insert:r}}),c.current=r}finally{l.current=!1}}var sd={typescript:()=>import("./javascript-18thb3jp.js"),tsx:()=>import("./javascript-18thb3jp.js"),javascript:()=>import("./javascript-18thb3jp.js"),jsx:()=>import("./javascript-18thb3jp.js"),json5:()=>import("./javascript-18thb3jp.js"),json:()=>import("./javascript-18thb3jp.js"),yaml:()=>import("./yaml-qwwswzvs.js"),toml:()=>import("./toml-prjdc335.js"),ini:()=>import("./properties-qq2pcfyk.js"),properties:()=>import("./properties-qq2pcfyk.js"),hcl:()=>import("./properties-qq2pcfyk.js"),css:()=>import("./css-6vj0d308.js"),less:()=>import("./css-6vj0d308.js"),scss:()=>import("./css-6vj0d308.js"),sass:()=>import("./sass-9bxped7y.js"),stylus:()=>import("./stylus-xh0f7m9m.js"),xml:()=>import("./xml-f6syr877.js"),bash:()=>import("./shell-5rhwzbr3.js"),python:()=>import("./python-wbdfs2gc.js"),ruby:()=>import("./ruby-nq98w40a.js"),perl:()=>import("./perl-3t5fm1te.js"),lua:()=>import("./lua-6at2ddf6.js"),powershell:()=>import("./powershell-rrzhqtmb.js"),go:()=>import("./go-nfrqbjpq.js"),rust:()=>import("./rust-fkt0qyrs.js"),c:()=>import("./clike-h8p24dc6.js"),cpp:()=>import("./clike-h8p24dc6.js"),csharp:()=>import("./clike-h8p24dc6.js"),java:()=>import("./clike-h8p24dc6.js"),kotlin:()=>import("./clike-h8p24dc6.js"),scala:()=>import("./clike-h8p24dc6.js"),dart:()=>import("./clike-h8p24dc6.js"),"objective-c":()=>import("./clike-h8p24dc6.js"),swift:()=>import("./swift-rr9wc5y7.js"),haskell:()=>import("./haskell-phxh4hcg.js"),elixir:()=>import("./erlang-1ch2hjv9.js"),erlang:()=>import("./erlang-1ch2hjv9.js"),clojure:()=>import("./clojure-w19rx1x5.js"),scheme:()=>import("./scheme-jvs3e9c8.js"),racket:()=>import("./scheme-jvs3e9c8.js"),ocaml:()=>import("./mllike-cnahv8ak.js"),r:()=>import("./r-z4m38eb1.js"),julia:()=>import("./julia-ft9kd90a.js"),sql:()=>import("./sql-wsvbkyd1.js"),dockerfile:()=>import("./dockerfile-a7q6174s.js"),protobuf:()=>import("./protobuf-ggczeare.js"),makefile:()=>import("./cmake-qpejsvqg.js"),groovy:()=>import("./groovy-63s5pygd.js")},zs={typescript:"typescript",tsx:"typescript",javascript:"javascript",jsx:"javascript",json5:"json",json:"json",yaml:"yaml",toml:"toml",ini:"properties",properties:"properties",hcl:"properties",css:"css",less:"less",scss:"sCSS",sass:"sass",stylus:"stylus",xml:"xml",bash:"shell",python:"python",ruby:"ruby",perl:"perl",lua:"lua",powershell:"powerShell",go:"go",rust:"rust",c:"c",cpp:"cpp",csharp:"csharp",java:"java",kotlin:"kotlin",scala:"scala",dart:"dart","objective-c":"objectiveC",swift:"swift",haskell:"haskell",elixir:"erlang",erlang:"erlang",clojure:"clojure",scheme:"scheme",racket:"scheme",ocaml:"oCaml",r:"r",julia:"julia",sql:"standardSQL",dockerfile:"dockerFile",protobuf:"protobuf",makefile:"cmake",groovy:"groovy"};function js(t){return sd[t]??null}var Vr=new Map,Nr=new Map,ld=new Set;function ad(t){for(let r of[...ld])try{r(t)}catch{}}function Gs(t){return Vr.get(t)??null}function Qs(t){let r=Vr.get(t);if(r)return Promise.resolve(r);let l=Nr.get(t);if(l)return l;let c=js(t),p=zs[t];if(!c||!p)return Promise.resolve(null);let h=(async()=>{try{let[g,b]=await Promise.all([c(),import("./index-at6bhjyf.js")]),x=g[p];if(!x)return null;let w=b.StreamLanguage.define(x);return Vr.set(t,w),ad(t),w}catch{return null}finally{Nr.delete(t)}})();return Nr.set(t,h),h}var _c=Ts(function({value:r,onValueChange:l,language:c,wordWrap:p,documentKey:h,marks:g,currentMark:b,onCommand:x,readOnly:w=!1,themeVars:v,themes:E,indentUnitText:R=" ",typing:O=ms,blame:F=null,style:P,padding:U=16,onCaret:A,placeholder:L,scrollTestId:N,onScroller:W,className:H},G){let z=o(null),K=o(null),j=o(""),Z=o(""),Q=o(!1),se=o(r),ne=o(l);ne.current=l;let fe=o(x);fe.current=x;let le=o(W);le.current=W;let te=o(A);te.current=A;let Se=o(g??[]),ae=o(b??-1);Se.current=g??[],ae.current=b??-1;let be=E??to,Le=o(be);Le.current=be;let Xe=o(R);Xe.current=R;let Pe=o(O);Pe.current=O;let Ce=o(F);Ce.current=F;let Ee=o(null);if(!Ee.current)Ee.current=Hs({wordWrap:p,readOnly:w,themes:Le.current,indentUnitText:Xe.current,typing:Pe.current,blame:Ce.current,placeholder:L,onDocChange:(X)=>{if(se.current=X,Q.current)return;ne.current(X)},onState:(X)=>{let ie=j.current;if(ie)Ee.current?.remember(ie,X)},onCommand:(X)=>fe.current?.(X),onCaret:(X)=>te.current?.(X)});V(()=>{let X=z.current,ie=Ee.current;if(!X||!ie)return;j.current=h;let ue=new _({state:ie.stateFor(h,c,r),parent:X});if(K.current=ue,se.current=r,N)ue.scrollDOM.dataset.testid=N;le.current?.(ue.scrollDOM);let q=ue.state.doc.lineAt(ue.state.selection.main.head);return te.current?.({line:q.number,column:ue.state.selection.main.head-q.from+1}),()=>{le.current?.(null),ue.destroy(),K.current=null}},[]),V(()=>{let X=K.current,ie=Ee.current;if(!X||!ie)return;if(j.current===h)return;ie.remember(j.current,X.state),j.current=h,X.setState(ie.stateFor(h,c,r)),X.dispatch({effects:ie.currentEffects(h)}),Pr(X,r,Q,se);let ue=X.state.doc.lineAt(X.state.selection.main.head);te.current?.({line:ue.number,column:X.state.selection.main.head-ue.from+1}),Z.current="",X.dispatch({effects:fn.of({marks:Se.current,current:ae.current})})},[h]),V(()=>{let X=K.current;if(!X||j.current!==h)return;Pr(X,r,Q,se)},[r,h]),V(()=>{let X=K.current,ie=Ee.current;if(!X||!ie)return;let ue=ie.optionsEffects({wordWrap:p,readOnly:w,themes:be,indentUnitText:R,typing:O,blame:F},j.current);if(ue.length>0)X.dispatch({effects:ue})},[p,w,be.light,be.dark,R,O,F]),V(()=>{let X=K.current,ie=Ee.current;if(!X||!ie)return;let ue=!1,q=(de)=>{if(ue||!de)return;let ve=K.current;if(!ve)return;let Oe=ie.languageEffects(j.current,de);if(Oe.length>0)ve.dispatch({effects:Oe})},J=Gs(c);if(J)return q(J),()=>{ue=!0};return Qs(c).then(q),()=>{ue=!0}},[c,h]),V(()=>{let X=K.current;if(!X)return;let ie=g??[],ue=`${b??-1}:${ie.map((q)=>`${q.start}-${q.end}`).join(",")}`;if(ue===Z.current)return;Z.current=ue,X.dispatch({effects:fn.of({marks:ie,current:b??-1})})},[g,b]),si(G,()=>qs({view:K,onCommand:fe}),[]);let Ye={...v,...P,"--surface-pad":`${U}px`};return e("div",{ref:z,className:H,style:Ye,"data-code-surface":""})});var st="flex items-center justify-center p-1 rounded transition-colors cursor-pointer disabled:cursor-default disabled:opacity-40";function nl({active:t,title:r,onToggle:l,children:c}){return e("button",{type:"button",onClick:l,className:`${st} ${t?"bg-ink/10 text-ink":"text-ink/50 hover:text-ink hover:bg-ink/5"}`,title:r,"aria-label":r,"aria-pressed":t,children:c})}function Sc({find:t}){let r=o(null),l=ht();i(()=>{r.current?.focus(),r.current?.select()},[t.focusRequest]);let c=t.matches.length,p=t.invalid?"Invalid pattern":c===0?t.query?"No results":"":`${t.currentIndex+1} of ${c}${t.truncated?"+":""}`,h=(x)=>{if(x.key==="Enter"&&!x.metaKey&&!x.ctrlKey&&!x.altKey)x.preventDefault(),t.step(x.shiftKey?-1:1)},g=(x,w)=>{let v=lo.find((E)=>E.command===x);return v?`${w} (${Xl(v,l)})`:w},b=(x,w,v,E)=>e(nl,{active:t.options[x],title:g(v,w),onToggle:()=>t.toggleOption(x),children:E});return e("div",{className:"absolute top-2 right-2 z-30 flex w-[330px] max-w-[calc(100%-1rem)] min-w-0 flex-col gap-1 bg-paper border border-ink/15 rounded-md shadow-lg p-1.5 text-xs text-ink font-sans",children:[e("div",{className:"flex items-center gap-1",children:[e("button",{type:"button",onClick:t.toggleReplace,className:`${st} ${t.replaceOpen?"text-ink":"text-ink/50 hover:text-ink hover:bg-ink/5"}`,title:t.replaceOpen?"Hide replace":"Show replace","aria-label":t.replaceOpen?"Hide replace":"Show replace","aria-pressed":t.replaceOpen,children:t.replaceOpen?e(et,{size:13}):e(B,{size:13})}),e("input",{ref:r,type:"text",value:t.query,onInput:(x)=>t.setQuery(x.currentTarget.value),onKeyDown:h,placeholder:"Find","aria-label":"Find",className:`flex-1 min-w-0 bg-canvas border rounded px-2 py-1 font-mono text-xs focus:outline-none ${t.invalid?"border-error text-error":"border-ink/20 focus:border-ink text-ink"}`}),b("matchCase","Match case","toggleCaseSensitive",e(Ro,{size:13})),b("wholeWord","Match whole word","toggleWholeWord",e(zo,{size:13})),b("isRegex","Use regular expression","toggleRegex",e(Mo,{size:13})),e(nl,{active:t.options.inSelection,title:t.options.inSelection?"Searching the selection only":"Search the selection only",onToggle:()=>t.toggleOption("inSelection"),children:e(_r,{size:13})}),e("span",{className:`font-mono text-[10px] whitespace-nowrap min-w-[52px] text-right ${t.invalid?"text-error":"text-ink/50"}`,"aria-live":"polite",children:p}),e("button",{type:"button",onClick:()=>t.step(-1),disabled:c===0,className:`${st} text-ink/50 hover:text-ink hover:bg-ink/5`,title:g("previousMatch","Previous match"),"aria-label":"Previous match",children:e(No,{size:13})}),e("button",{type:"button",onClick:()=>t.step(1),disabled:c===0,className:`${st} text-ink/50 hover:text-ink hover:bg-ink/5`,title:g("nextMatch","Next match"),"aria-label":"Next match",children:e(Or,{size:13})}),e("button",{type:"button",onClick:t.close,className:`${st} text-ink/50 hover:text-ink hover:bg-ink/5`,title:"Close find (Escape)","aria-label":"Close find",children:e(y,{size:13})})]}),t.history.length>0&&e("div",{className:"flex items-center gap-1 overflow-x-auto no-scrollbar",children:[e("span",{className:"text-[10px] uppercase tracking-wide text-ink/40 flex-shrink-0",children:"Recent"}),t.history.slice(0,6).map((x)=>e("button",{type:"button",onClick:()=>t.useHistoryEntry(x),title:`Find ${x}`,className:"px-1.5 py-0.5 rounded border border-ink/15 font-mono text-[10px] text-ink/70 hover:bg-ink/5 hover:text-ink transition-colors cursor-pointer whitespace-nowrap flex-shrink-0",children:x},x))]}),t.replaceOpen&&e("div",{className:"flex items-center gap-1",children:[e("span",{className:"w-[22px]","aria-hidden":"true"}),e("input",{type:"text",value:t.replacement,onInput:(x)=>t.setReplacement(x.currentTarget.value),onKeyDown:h,placeholder:"Replace","aria-label":"Replace",className:"flex-1 min-w-0 bg-canvas border border-ink/20 rounded px-2 py-1 font-mono text-xs text-ink focus:outline-none focus:border-ink"}),e("button",{type:"button",onClick:t.replaceCurrent,disabled:c===0,className:`${st} text-ink/50 hover:text-ink hover:bg-ink/5`,title:g("replaceOne","Replace"),"aria-label":"Replace",children:e(Oo,{size:13})}),e("button",{type:"button",onClick:t.replaceAll,disabled:c===0,className:`${st} text-ink/50 hover:text-ink hover:bg-ink/5`,title:g("replaceAll","Replace all"),"aria-label":"Replace all",children:e(Po,{size:13})})]})]})}var cd=12;function Tc({path:t,scroller:r,preview:l}){let c=He(VA,KA);i(()=>{if(!c||!t||c.path!==t)return;if(!l||!r)return;let p=[...r.querySelectorAll("h1, h2, h3, h4, h5, h6")],h=YA(p.map((x)=>x.textContent??""),c),g=p[h];if(!g)return;_m(r);let b=g.getBoundingClientRect().top-r.getBoundingClientRect().top;r.scrollTop+=b-cd,qo(null)})}var ud={docx:!0},dd={xls:!0,xlsx:!0,xlsm:!0},fd={csv:!0,tsv:!0},md={md:!0,markdown:!0,mdx:!0},pd={drawio:!0,dio:!0},nd={image:!0,pdf:!0,docx:!0,spreadsheet:!0,code:void 0,markdown:void 0,svg:void 0,csv:void 0,drawio:void 0},ns={markdown:!0,svg:!0,csv:!0,drawio:!0,code:void 0,image:void 0,pdf:void 0,docx:void 0,spreadsheet:void 0},Fi={code:"Text",markdown:"Markdown",svg:"SVG",csv:"CSV",image:"Image",pdf:"PDF",docx:"Document",spreadsheet:"Spreadsheet",drawio:"Diagram"};function rs(t){let r=Ms(t);if(!r)return"code";if(r==="svg")return"svg";if(pd[r])return"drawio";if(md[r])return"markdown";if(hi(t))return"image";if(r==="pdf")return"pdf";if(ud[r])return"docx";if(dd[r])return"spreadsheet";if(fd[r])return"csv";return"code"}var hd=Re(()=>import("./PdfView-ksaes53y.js").then((t)=>({default:t.PdfView}))),gd=Re(()=>import("./DocxView-c9v2vr3r.js").then((t)=>({default:t.DocxView}))),bd=Re(()=>import("./SheetView-vc484scg.js").then((t)=>({default:t.SheetView}))),yd=Re(()=>import("./CsvGrid-fncjbg6j.js").then((t)=>({default:t.CsvGrid}))),xd=Re(()=>import("./SvgPreview-tph89jet.js").then((t)=>({default:t.SvgPreview}))),vd=Re(()=>import("./ImageView-a3g5k226.js").then((t)=>({default:t.ImageView}))),kd=Re(()=>import("./DrawioView-vxjksm12.js").then((t)=>({default:t.DrawioView})));function Qc(t){return t==="image"||t==="pdf"||t==="docx"||t==="spreadsheet"||t==="csv"||t==="svg"||t==="drawio"}function lt(){return e("div",{className:"flex flex-1 items-center justify-center gap-2 text-xs text-ink/40",children:[e(m,{size:14,className:"animate-spin"}),e("span",{children:"Loading…"})]})}function rl({kind:t,path:r,name:l,source:c,content:p,revision:h,onContentChange:g,onSaveBytes:b,onDirtyChange:x}){if(t==="image")return e(We,{fallback:e(lt,{}),children:e(vd,{source:c,name:l,revision:h})});if(t==="pdf")return e(We,{fallback:e(lt,{}),children:e(hd,{source:c,name:l,revision:h})});if(t==="docx")return e(We,{fallback:e(lt,{}),children:e(gd,{source:c,name:l,revision:h})});if(t==="spreadsheet")return e(We,{fallback:e(lt,{}),children:e(bd,{source:c,name:l,path:r,revision:h,onSaveBytes:b,onDirtyChange:x})});if(t==="csv")return e(We,{fallback:e(lt,{}),children:e(yd,{content:p,path:r,onChange:g})});if(t==="svg")return e(We,{fallback:e(lt,{}),children:e(xd,{content:p,name:l})});if(t==="drawio")return e(We,{fallback:e(lt,{}),children:e(kd,{content:p,name:l})});return null}function al(t){if(!t.path)return!1;if(t.content!==void 0)return!1;if(t.handleId||t.deviceFile)return!1;return!t.isDiff}function Ur(t){return`${t.root??""}\x00${t.repo??"."}\x00${t.path??""}`}async function wd(t){let r=new URLSearchParams({path:t.path??""});if(t.root)r.set("root",t.root);if(t.repo&&t.repo!==".")r.set("repo",t.repo);try{let l=await fetch(`/api/fs/exists?${r.toString()}`),c=await l.json().catch(()=>null);if(!l.ok||!c||typeof c.exists!=="boolean")return!0;return c.exists}catch{return!0}}function Nc(t,r){let[l,c]=n(()=>new Set),[p,h]=n(0),g=t.map((w)=>`${w.id}\x01${Ur(w)}`).join(`
|
|
4
|
+
`),b=o(t);b.current=t;let x=o(new Set);return i(()=>{let w=!1;return(async()=>{let v=new Map;for(let P of b.current)if(al(P))v.set(Ur(P),P);let E=await Promise.all([...v.entries()].map(async([P,U])=>({key:P,exists:await wd(U)})));if(w)return;let R=new Set;for(let{key:P,exists:U}of E)if(!U)R.add(P);let O=new Set;for(let P of b.current)if(al(P)&&R.has(Ur(P)))O.add(P.id);let F=x.current;if(F.size===O.size&&[...O].every((P)=>F.has(P)))return;x.current=O,c(O)})(),()=>{w=!0}},[g,r,p]),i(()=>{let w=()=>h((v)=>v+1);return window.addEventListener("focus",w),document.addEventListener("visibilitychange",w),()=>{window.removeEventListener("focus",w),document.removeEventListener("visibilitychange",w)}},[]),l}async function Rc(t,r,l){if(t.handleId){let p=await Um(t.handleId,r,{interactive:l.interactive});if(p==="written")return{status:"written",mtimeMs:null};if(p==="needs-permission")return{status:"needs-permission"};return{status:"failed",error:"The browser refused the write."}}if(!t.path)return{status:"failed",error:"This file has no path to write to."};let c=new FormData;if(c.append("actionType","saveBytes"),c.append("path",t.path),c.append("bytes",new Blob([r])),t.root)c.append("root",t.root);if(t.repo&&t.repo!==".")c.append("repo",t.repo);if(typeof l.baseMtimeMs==="number")c.append("baseMtime",String(l.baseMtimeMs));try{let p=await fetch("/api/fs/action",{method:"POST",body:c}),h=await p.json().catch(()=>null);if(p.status===409)return{status:"conflict",diskMtimeMs:typeof h?.mtimeMs==="number"?h.mtimeMs:null};if(p.ok&&h?.success)return{status:"written",mtimeMs:typeof h.mtimeMs==="number"?h.mtimeMs:null};return{status:"failed",error:typeof h?.error==="string"?h.error:null}}catch{return{status:"failed",error:null}}}var Sd={id:"",url:null,loadBytes:null,mimeType:null};async function Wr(t){let r=await t.json().catch(()=>null);return typeof r?.error==="string"&&r.error?r.error:`Could not read the file (HTTP ${t.status}).`}function ol(t){let r=zA(t.path);if(t.rawUrl){let p=t.rawUrl;return{id:p,url:p,mimeType:r,loadBytes:async()=>{let h=await fetch(p);if(!h.ok)throw Error(await Wr(h));return h.arrayBuffer()}}}let l=Hm(t.handleId);if(l){let{bytes:p}=l;return{id:t.handleId,url:null,mimeType:l.mimeType??r,loadBytes:async()=>p.slice().buffer}}let c=tl(t.handleId);if(c)return{id:t.handleId,url:null,mimeType:r,loadBytes:async()=>(await c.getFile()).arrayBuffer()};return Sd}function il(t,r){let l=t?rs(t.path??""):"code",c=nd[l]===!0,p=Boolean(t?.path)&&!t?.handleId,h=p&&t?.content===void 0&&hi(t?.path)?t.path:null,g=h!==null,b=t&&!g&&c&&p&&t.content===void 0?Ls({path:t.path,root:t.root,repo:t.repo}):null,x=ol({path:t?.path,handleId:t?.handleId,rawUrl:h?`${Ls({path:h,root:t?.root,repo:t?.repo})}&v=${r}`:b});return{viewerKind:l,isBinaryViewer:c,isImage:g,imageUrl:g?x.url:null,byteSource:x}}function sl(t){let r=t.indexOf(`
|
|
5
|
+
`);return r>0&&t[r-1]==="\r"?"crlf":"lf"}function Dt(t){return t.includes("\r")?t.replace(/\r\n?/g,`
|
|
6
|
+
`):t}function ll(t,r){let l=Dt(t);return r==="crlf"?l.replace(/\n/g,`\r
|
|
7
|
+
`):l}function cl(t){return String(t.id??t.path??t.name)}function ul({target:t,key:r,isBinaryViewer:l,revision:c,loadedRef:p,contentsRef:h,baselinesRef:g,pendingRef:b,readingRef:x,remember:w}){let[v,E]=n(!1),[R,O]=n(!1),[F,P]=n(null),[U,A]=n(null);return i(()=>{if(O(!1),!t)return;let L=cl(t);if(p.current.has(L))return;if(p.current.add(L),l){P(null),A(null),E(!1);return}if(t.content!==void 0){w(L,t.content,null,null),P(null),A(null);return}if(!t.path){P("No file path supplied for this attachment."),A(null);return}let N=h.current[L]===void 0,W=!1;if(N)E(!0);P(null),A(null);let H=new URLSearchParams({path:t.path});if(t.root)H.set("root",t.root);if(t.repo&&t.repo!==".")H.set("repo",t.repo);return x.current+=1,O(!0),fetch(`/api/fs/read?${H.toString()}`).then(async(G)=>{let z=await G.json().catch(()=>null);if(!G.ok||!z||typeof z.content!=="string"){let K=Error(z?.error||`HTTP ${G.status}`);if(z?.kind)K.kind=z.kind;else if(G.status===415)K.kind="binary";throw K}return{text:z.content,mtimeMs:typeof z.mtimeMs==="number"?z.mtimeMs:null,hash:typeof z.hash==="string"?z.hash:null}}).then(({text:G,mtimeMs:z,hash:K})=>{if(W)return;let j=h.current[L];if(j!==void 0&&j!==g.current[L])return;let Z=b.current;if(Z&&cl(Z.file)===L)return;w(L,G,z,K)}).catch((G)=>{if(W)return;if(!N)return;w(L,"",null,null);let z=G instanceof Error?G.message:"Failed to read file",K=G?.kind;A(K?z:null),P(z)}).finally(()=>{if(x.current-=1,!W)E(!1),O(!1)}),()=>{W=!0}},[r,t,w,c,l,p,h,g,b,x]),{isLoading:v,isReading:R&&!v,loadError:F,unsupported:U}}function wn(t,r){let l=URL.createObjectURL(t),c=document.createElement("a");c.href=l,c.download=r,c.click(),URL.revokeObjectURL(l)}async function dl(t,r){let l=await fetch(t);if(!l.ok)throw Error(`HTTP ${l.status}`);wn(await l.blob(),r)}async function fl(t){let r=await fetch(t);if(!r.ok)throw Error(`HTTP ${r.status}`);let l=await r.blob();if(typeof ClipboardItem>"u"||!navigator.clipboard?.write)throw Error("Image clipboard unavailable");await navigator.clipboard.write([new ClipboardItem({[l.type]:l})])}function ml({target:t,content:r,downloadContent:l,imageUrl:c,downloadMimeType:p,byteSource:h,byteViewer:g=!1}){let[b,x]=n(!1),w=a(()=>{x(!0),window.setTimeout(()=>x(!1),1500)},[]),v=a(()=>{if(!t)return;if(c){fl(c).then(w).catch(()=>{});return}if(g)return;if(!navigator.clipboard)return;navigator.clipboard.writeText(r).then(w).catch(()=>{})},[t,r,c,g,w]),E=a(()=>{if(!t)return;if(c){dl(c,t.name).catch(()=>{});return}if(g){let R=h?.loadBytes;if(!R)return;let O=h?.mimeType;R().then((F)=>wn(O?new Blob([F],{type:O}):new Blob([F]),t.name)).catch(()=>{});return}wn(new Blob([l],{type:p}),t.name)},[t,l,p,c,g,h]);return{copied:b,copy:v,download:E}}async function pl(t){let r=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(t));return Array.from(new Uint8Array(r),(l)=>l.toString(16).padStart(2,"0")).join("")}async function hl(t,r,l,c){if(t.handleId){let h=l==="crlf"?r.replace(/\n/g,`\r
|
|
8
|
+
`):r,g=await Um(t.handleId,h,{interactive:c.interactive});if(g==="written")return{status:"written",written:{mtimeMs:null,hash:await pl(h)}};if(g==="needs-permission")return{status:"needs-permission"};return{status:"failed"}}if(!t.path)return{status:"failed"};let p=new FormData;if(p.append("actionType","save"),p.append("path",t.path),p.append("content",r),p.append("eol",l),t.root)p.append("root",t.root);if(t.repo&&t.repo!==".")p.append("repo",t.repo);if(typeof c.baseMtimeMs==="number")p.append("baseMtime",String(c.baseMtimeMs));try{let h=await fetch("/api/fs/action",{method:"POST",body:p}),g=await h.json().catch(()=>null);if(h.status===409)return{status:"conflict",diskMtimeMs:typeof g?.mtimeMs==="number"?g.mtimeMs:null};if(h.ok&&g?.success)return{status:"written",written:{mtimeMs:typeof g.mtimeMs==="number"?g.mtimeMs:null,hash:typeof g.hash==="string"?g.hash:null}};return{status:"failed"}}catch{return{status:"failed"}}}function xt(t,r){let l={},c=!1;for(let[p,h]of Object.entries(t))if(r.has(p))l[p]=h;else c=!0;return c?l:t}function Sn(t){return String(t.id??t.path??t.name)}function gl({target:t,isBinaryViewer:r,loadError:l,missing:c,contentsRef:p,lineEndingsRef:h,mtimesRef:g,pendingRef:b,flushOnUnmount:x,onSaveStart:w,onSaved:v,onSaveFailed:E,onNeedsPermission:R,onConflict:O}){let[F,P]=n(!1),U=o(c);U.current=c;let A=t?Sn(t):"",L=a(async(K,j,Z={})=>{if(!K.path&&!K.handleId)return;if(K.handleId&&!tl(K.handleId))return;if(U.current&&!Z.allowMissing)return;w();let Q=Sn(K),se=Z.allowMissing?null:g.current[Q]??null,ne=await hl(K,j,h.current[Q]??"lf",{interactive:Z.interactive===!0,baseMtimeMs:se});if(ne.status==="written")v(Q,j,ne.written);else if(ne.status==="needs-permission")R();else if(ne.status==="conflict")O(Q,ne.diskMtimeMs);else E()},[h,g,O,R,E,w,v]),N=o(L);N.current=L;let W=a((K)=>{if(!t||r)return;if(!t.path)return;if(U.current)return;if(b.current)window.clearTimeout(b.current.timer);let j=window.setTimeout(()=>{b.current=null,N.current(t,K)},800);b.current={timer:j,file:t,content:K}},[t,r,b]),H=a(()=>{if(!t||r)return;if(l)return;if(t.handleId&&!tl(t.handleId))return;let K=p.current[Sn(t)];if(K===void 0)return;if(b.current)window.clearTimeout(b.current.timer),b.current=null;if(U.current){P(!0);return}N.current(t,K,{interactive:!0})},[t,p,r,l,b]),G=a(()=>{if(P(!1),!t||r||l)return;let K=p.current[Sn(t)];if(K===void 0)return;N.current(t,K,{allowMissing:!0,interactive:!0})},[t,p,r,l]),z=a(()=>P(!1),[]);return i(()=>{if(!x)return;return()=>{let K=b.current;if(!K)return;if(window.clearTimeout(K.timer),b.current=null,U.current)return;N.current(K.file,K.content)}},[x,b]),i(()=>{if(!c)P(!1)},[c,A]),{onChange:W,saveNow:H,saveMissingConfirm:F,confirmSaveMissing:G,cancelSaveMissing:z}}function bl({key:t,saveNow:r,mtimesRef:l,setMtimes:c,contentsRef:p,setContents:h,setBaselines:g,loadedRef:b,bumpRevision:x}){let[w,v]=n({}),E=a((A)=>{v((L)=>{if(L[A]===void 0)return L;let N={...L};return delete N[A],N})},[]),R=a((A,L)=>{v((N)=>({...N,[A]:{diskMtimeMs:L}}))},[]),O=a((A,L)=>{l.current={...l.current,[A]:L},c(l.current)},[l,c]),F=a((A)=>{if(!t)return;O(t,A),E(t)},[t,O,E]),P=a(()=>{if(!t)return;E(t),g((A)=>{let L={...A};return delete L[t],L}),h((A)=>{let L={...A};return delete L[t],L}),b.current.delete(t),x()},[t,E,g,h,b,x]),U=a(()=>{if(!t)return;let A=p.current[t],L=w[t]?.diskMtimeMs??null;if(E(t),A===void 0)return;if(L!==null)O(t,L);r()},[t,w,E,O,p,r]);return{conflict:w[t]??null,report:R,reload:P,keepMine:U,adopt:F,clear:E}}var Cd=3000;async function Ed(t,r,l){let c=new URLSearchParams({path:t});if(r)c.set("root",r);if(l&&l!==".")c.set("repo",l);try{let p=await fetch(`/api/fs/digest?${c.toString()}`),h=await p.json().catch(()=>null);if(!p.ok||!h||typeof h.exists!=="boolean")return"unknown";if(h.exists===!1)return"gone";if(typeof h.hash!=="string"||typeof h.mtimeMs!=="number")return"unknown";return{hash:h.hash,mtimeMs:h.mtimeMs}}catch{return"unknown"}}function yl({path:t,root:r=null,repo:l=null,baseHash:c,revision:p,onUnchanged:h,onChanged:g}){let b=o(h);b.current=h;let x=o(g);x.current=g,i(()=>{if(!t||c===null)return;let w=!1,v=!1,E=null,R=async()=>{if(w||v||document.hidden)return;v=!0;try{let U=await Ed(t,r,l);if(w||U==="unknown"||U==="gone")return;if(U.hash===c){b.current(U.mtimeMs);return}if(E===U.hash)return;E=U.hash,x.current(U)}finally{v=!1}},O=window.setInterval(()=>void R(),Cd);R();let F=()=>void R(),P=()=>{if(!document.hidden)R()};return window.addEventListener("focus",F),document.addEventListener("visibilitychange",P),()=>{w=!0,window.clearInterval(O),window.removeEventListener("focus",F),document.removeEventListener("visibilitychange",P)}},[t,r,l,c,p])}function _e(t){return String(t.id??t.path??t.name)}function xl({key:t,target:r,baseHash:l,revision:c,hashesRef:p,mtimesRef:h,contentsRef:g,baselinesRef:b,pendingRef:x,readingRef:w,loadedRef:v,bumpRevision:E,adoptDiskMtime:R,clearConflict:O,reloadDiscardingEdits:F,discardPendingWrite:P}){let[U,A]=n(null),L=o(null);i(()=>{A(null),L.current=null},[t]);let N=a((z)=>{if(!t)return;if(h.current[t]!==z)R(z);A(null),L.current=null},[t,h,R]),W=a((z)=>{if(!t)return;if(p.current[t]===z.hash){A(null);return}if(L.current===z.hash)return;if(U?.hash===z.hash)return;let K=g.current[t],j=x.current;if(K!==void 0&&K!==b.current[t]||j!==null&&_e(j.file)===t){A(z);return}if(w.current>0)return;v.current.delete(t),E()},[t,p,g,b,x,w,v,E,U]);yl({path:r&&al({...r,id:t})?r.path??null:null,root:r?.root??null,repo:r?.repo??null,baseHash:l,revision:c,onUnchanged:N,onChanged:W});let H=a(()=>{if(!r)return;let z=_e(r),K=g.current[z];if(K!==void 0&&K!==b.current[z]){P(z),F();return}O(z),v.current.delete(z),E()},[r,g,b,P,F,O,v,E]),G=a(()=>{if(!U)return;L.current=U.hash,R(U.mtimeMs),A(null)},[U,R]);return{diskChange:U,reloadFromDisk:H,keepMineAgainstDisk:G}}function vl({target:t,loadedRef:r,bumpRevision:l,setContents:c,setBaselines:p,setLineEndings:h,setMtimes:g,setHashes:b}){let x=a((R,O,F,P)=>{let U=sl(O),A=Dt(O);c((L)=>({...L,[R]:A})),p((L)=>({...L,[R]:A})),h((L)=>({...L,[R]:U})),g((L)=>({...L,[R]:F})),b((L)=>({...L,[R]:P}))},[c,p,h,g,b]),w=a(()=>{r.current.clear(),l()},[r,l]),v=a((R)=>{let O=new Set(R.map(String));for(let F of Array.from(r.current))if(!O.has(F))r.current.delete(F);c((F)=>xt(F,O)),p((F)=>xt(F,O)),h((F)=>xt(F,O)),g((F)=>xt(F,O)),b((F)=>xt(F,O))},[r,c,h,g,b]),E=a((R)=>{if(!t)return;h((O)=>({...O,[_e(t)]:R}))},[t,h]);return{remember:x,reset:w,retain:v,setEol:E}}function kl({target:t,key:r,textDirty:l,contents:c,baselines:p,retain:h}){let[g,b]=n(()=>new Set),x=l||g.has(r),w=u(()=>{let R=new Set(g);for(let[O,F]of Object.entries(c)){let P=p[O];if(P!==void 0&&F!==P)R.add(O)}return R},[c,p,g]),v=a((R)=>{if(!t)return;let O=_e(t);b((F)=>{if(F.has(O)===R)return F;let P=new Set(F);if(R)P.add(O);else P.delete(O);return P})},[t]),E=a((R)=>{h(R);let O=new Set(R.map(String));b((F)=>{let P=!1,U=new Set;for(let A of F)if(O.has(A))U.add(A);else P=!0;return P?U:F})},[h]);return{isDirty:x,dirtyKeys:w,setBinaryDirty:v,retain:E}}function Fc(t,r={}){let{flushOnUnmount:l=!1,reportSaveError:c=!1,downloadMimeType:p="text/plain",onFileSaved:h,missing:g=!1}=r,[b,x]=n({}),[w,v]=n({}),[E,R]=n({}),[O,F]=n({}),[P,U]=n({}),[A,L]=n("idle"),[N,W]=n(0),H=t?_e(t):"",G=t?b[H]??(t.content!==void 0?Dt(t.content):""):"",z=G!==(w[H]??G),{viewerKind:K,isBinaryViewer:j,isImage:Z,imageUrl:Q,byteSource:se}=il(t,N),ne=o(new Set),fe=o(null),le=o(0),te=o(b);te.current=b;let Se=o(w);Se.current=w;let ae=o(E);ae.current=E;let be=o(O);be.current=O;let Le=o(P);Le.current=P;let{remember:Xe,reset:Pe,retain:Ce,setEol:Ee}=vl({target:t,loadedRef:ne,bumpRevision:()=>W((pe)=>pe+1),setContents:x,setBaselines:v,setLineEndings:R,setMtimes:F,setHashes:U}),{isDirty:Ye,dirtyKeys:X,setBinaryDirty:ie,retain:ue}=kl({target:t,key:H,textDirty:z,contents:b,baselines:w,retain:Ce}),{isLoading:q,isReading:J,loadError:de,unsupported:ve}=ul({target:t,key:H,isBinaryViewer:j,revision:N,loadedRef:ne,contentsRef:te,baselinesRef:Se,pendingRef:fe,readingRef:le,remember:Xe}),Oe=gl({target:t,isBinaryViewer:j,loadError:de,missing:g,contentsRef:te,lineEndingsRef:ae,mtimesRef:be,pendingRef:fe,flushOnUnmount:l,onSaveStart:()=>L("saving"),onSaved:(pe,Je,ct)=>{if(L("saved"),v((wt)=>({...wt,[pe]:Je})),ct.mtimeMs!==null)F((wt)=>({...wt,[pe]:ct.mtimeMs}));if(ct.hash!==null)U((wt)=>({...wt,[pe]:ct.hash}));h?.()},onSaveFailed:()=>L(c?"error":"idle"),onNeedsPermission:()=>L("needs-permission"),onConflict:(pe,Je)=>{L("idle"),je.report(pe,Je)}}),kt=o(Oe);kt.current=Oe;let je=bl({key:H,saveNow:()=>kt.current.saveNow(),mtimesRef:be,setMtimes:F,contentsRef:te,setContents:x,setBaselines:v,loadedRef:ne,bumpRevision:()=>W((pe)=>pe+1)}),At=a((pe)=>{let Je=fe.current;if(!Je||_e(Je.file)!==pe)return;window.clearTimeout(Je.timer),fe.current=null},[]),{diskChange:An,reloadFromDisk:Ge,keepMineAgainstDisk:Lt}=xl({key:H,target:t,baseHash:P[H]??null,revision:N,hashesRef:Le,mtimesRef:be,contentsRef:te,baselinesRef:Se,pendingRef:fe,readingRef:le,loadedRef:ne,bumpRevision:()=>W((pe)=>pe+1),adoptDiskMtime:je.adopt,clearConflict:je.clear,reloadDiscardingEdits:je.reload,discardPendingWrite:At});i(()=>{if(A!=="saved")return;let pe=window.setTimeout(()=>L("idle"),1500);return()=>window.clearTimeout(pe)},[A]),i(()=>{L("idle")},[H]);let On=a((pe)=>{if(!t||j)return;let Je=_e(t);x((ct)=>({...ct,[Je]:pe})),kt.current.onChange(pe)},[t,j]),{copied:at,copy:Ne,download:Fl}=ml({target:t,content:G,downloadContent:t?ll(G,E[H]??"lf"):G,imageUrl:Q,downloadMimeType:p,byteSource:se,byteViewer:j});return{content:G,onChange:On,isLoading:q,isReading:J,loaded:t?j||t.content!==void 0||b[H]!==void 0:!1,loadError:de,unsupported:ve,saveStatus:A,copied:at,isDirty:Ye,setBinaryDirty:ie,eol:E[H]??"lf",setEol:Ee,baseMtimeMs:O[H]??null,dirtyKeys:X,language:t?dt(t.name):"javascript",isImage:Z,imageUrl:Q,viewerKind:K,byteSource:se,isBinaryViewer:j,revision:N,handleMissing:Boolean(t?.handleId)&&!t?.deviceFile&&tl(t?.handleId)===null,deviceBacked:Boolean(t?.deviceFile),deviceMissing:Boolean(t?.deviceFile)&&Hm(t?.handleId)===null,saveNow:Oe.saveNow,copy:Ne,download:Fl,reset:Pe,retain:ue,saveMissingConfirm:Oe.saveMissingConfirm,confirmSaveMissing:Oe.confirmSaveMissing,cancelSaveMissing:Oe.cancelSaveMissing,conflict:je.conflict,resolveConflictByReload:()=>{if(H)At(H);je.reload()},resolveConflictByKeepingMine:je.keepMine,reloadFromDisk:Ge,diskChange:An,keepMineAgainstDisk:Lt}}var Md=20;function wl(){let[t,r]=S("editor.findHistory",[]),l=a((c)=>{let p=c.trim();if(!p)return;r((h)=>[p,...h.filter((g)=>g!==p)].slice(0,Md))},[r]);return{entries:t,remember:l}}function Sl(){let[t,r]=n(null),l=a((p)=>{let h=p();if(!h||h.start===h.end)return r(null),!1;return r(h),!0},[]),c=a(()=>r(null),[]);return{range:t,arm:l,disarm:c}}var Cl=5000,$r={matchCase:!1,wholeWord:!1,isRegex:!1,inSelection:!1},El="gm"+("unicode"in RegExp.prototype?"u":"");function Tn(t,r){if(!t)return null;let l=r.isRegex?t:t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=r.wholeWord?`\\b(?:${l})\\b`:l;try{return new RegExp(c,r.matchCase?El:`${El}i`)}catch{return null}}var Ml=null,Cn=null;function Rd(t){if(Ml===t&&Cn)return Cn;return Cn=ke.of(t.split(`
|
|
9
|
+
`)),Ml=t,Cn}function Tt(t,r,l,c){if(!r)return{matches:[],truncated:!1,invalid:!1};let p=Tn(r,l);if(!p)return{matches:[],truncated:!1,invalid:!0};let h=[],g;try{g=new Vt(Rd(t),p.source,{ignoreCase:!l.matchCase})}catch{return{matches:[],truncated:!1,invalid:!0}}let b=l.inSelection&&c?c:null;while(h.length<Cl&&!g.next().done){let{from:x,to:w}=g.value;if(x===w)continue;if(b&&(x<b.start||w>b.end))continue;h.push({start:x,end:w})}return{matches:h,truncated:h.length>=Cl,invalid:!1}}function vt(t,r){if(t.length===0)return-1;for(let l=0;l<t.length;l++)if(t[l].end>r)return l;return 0}function Rl(t,r,l){if(r<=0)return-1;if(t<0)return l===1?0:r-1;return(t+l+r)%r}function Dd(t){return{full:t[0],numbered:[void 0,...t.slice(1)],named:t.groups}}var Td=/\$(\$|&|\d{1,2}|<[^>]*>)/g;function Dl(t,r){if(!t.includes("$"))return t;return t.replace(Td,(l,c)=>{if(c==="$")return"$";if(c==="&")return r.full;if(c.startsWith("<"))return r.named?.[c.slice(1,-1)]??"";if(c.length===2){let p=r.numbered[Number(c)];if(p!==void 0)return p;let h=r.numbered[Number(c[0])];return h===void 0?"":h+c[1]}return r.numbered[Number(c)]??""})}function Ad(t,r,l,c,p){let h=Tn(l,p);if(!h)return null;h.lastIndex=r.start;let g=h.exec(t);if(!g||g.index!==r.start)return null;let b=p.isRegex?Dl(c,Dd(g)):c;return{found:g[0],inserted:b,start:g.index,end:g.index+g[0].length}}function Tl(t,r,l,c,p){let h=Ad(t,r,l,c,p);if(!h)return null;return{text:t.slice(0,h.start)+h.inserted+t.slice(h.end),caret:h.start+h.inserted.length}}function Al(t,r,l,c){let p=Tn(r,c);if(!p)return null;if(!c.isRegex)return t.replace(p,()=>l);return t.replace(p,(...h)=>{if(String(h[0]).length===0)return"";let g=h[h.length-1],b=typeof g==="object"&&g!==null,x=h.slice(1,h.length-(b?3:2));return Dl(l,{full:String(h[0]),numbered:[void 0,...x],named:b?g:void 0})})}function Ld(t,r){if(!r||r.start===r.end)return null;let l=t.slice(r.start,r.end);if(!l||l.includes(`
|
|
10
|
+
`)||l.length>200)return null;return l}function Lc({text:t,documentKey:r,readSelection:l,select:c,reveal:p,applyDocument:h,toggleWordWrap:g}){let[b,x]=S("editor.findQuery",""),[w,v]=S("editor.findReplace",""),[E,R]=S("editor.findOptions",$r),O=u(()=>({...$r,...E}),[E]),F=Sl(),P=wl(),[U,A]=n(!1),[L,N]=n(!1),[W,H]=n(-1),[G,z]=n(0),[K,j]=n(0),Z=o(!1);Z.current=U;let Q=u(()=>Tt(t,b,O,O.inSelection?F.range:null),[t,b,O,F.range]),se=o(0),ne=o(!0),fe=o(p);fe.current=p;let le=o(c);le.current=c;let te=a((q)=>{se.current=q,ne.current=!0},[]);i(()=>{te(0),j((q)=>q+1)},[r,te]),i(()=>{let q=Q.matches;if(ne.current){ne.current=!1;let J=vt(q,se.current);if(H(J),J>=0)le.current(q[J].start,q[J].end,!1),fe.current(q[J].start);return}H((J)=>{if(q.length===0)return-1;if(J<0)return vt(q,se.current);return Math.min(J,q.length-1)})},[Q,K]);let Se=a((q)=>{x(q),te(se.current)},[x,te]),ae=a(()=>{if(z((de)=>de+1),Z.current)return;let q=l(),J=Ld(t,q);if(J)x(J);te(q?q.start:0),A(!0),j((de)=>de+1)},[t,l,te,x]),be=a(()=>{N(!0),ae()},[ae]),Le=a(()=>N((q)=>!q),[]),Xe=a(()=>{P.remember(b),A(!1),N(!1);let q=Q.matches[W];if(q)c(q.start,q.end,!0)},[Q.matches,W,c]),Pe=a((q)=>{let J=Q.matches;if(J.length===0)return;let de=Rl(W,J.length,q);H(de),se.current=J[de].end,c(J[de].start,J[de].end,!1),p(J[de].start)},[Q.matches,W,c,p]),Ce=a((q)=>{let J={...O,[q]:!O[q]};if(q==="inSelection"&&!F.arm(l)){R({...O,inSelection:!1});return}if(q==="inSelection"&&!J.inSelection)F.disarm();R(J),te(se.current)},[O,R,te,l,F]),Ee=a((q)=>{x(q),P.remember(q),te(se.current),j((J)=>J+1)},[P,te]),Ye=a((q)=>{let J=dr(t,Math.max(0,q.line-1)),{matches:de}=Tt(t,q.query,q.options),ve=vt(de,J);if(x(q.query),R(q.options),te(ve>=0?de[ve].start:J),j((Oe)=>Oe+1),ve>=0)le.current(de[ve].start,de[ve].end,!0),fe.current(de[ve].start)},[t,x,R,te]),X=a(()=>{let q=Q.matches[W];if(!q)return;let J=Tl(t,q,b,w,O);if(!J)return;h(J.text,J.caret,J.caret),te(J.caret)},[Q.matches,W,t,b,w,O,h,te]),ie=a(()=>{let q=Al(t,b,w,O);if(q===null||q===t)return;let J=Math.min(se.current,q.length);h(q,J,J),te(J)},[t,b,w,O,h,te]),ue=a((q)=>{switch(q){case"find":ae();return;case"replace":be();return;case"nextMatch":Pe(1);return;case"previousMatch":Pe(-1);return;case"replaceOne":X();return;case"replaceAll":ie();return;case"toggleCaseSensitive":Ce("matchCase");return;case"toggleWholeWord":Ce("wholeWord");return;case"toggleRegex":Ce("isRegex");return;case"toggleWordWrap":g?.();return;default:return}},[ae,be,Pe,X,ie,Ce,g]);return{open:U,replaceOpen:L,query:b,replacement:w,options:O,matches:Q.matches,truncated:Q.truncated,invalid:Q.invalid,currentIndex:W,setQuery:Se,setReplacement:v,openFind:ae,openReplace:be,toggleReplace:Le,focusRequest:G,close:Xe,runCommand:ue,revealMatch:Ye,toggleOption:Ce,selectionRange:O.inSelection?F.range:null,history:P.entries,useHistoryEntry:Ee,step:Pe,replaceCurrent:X,replaceAll:ie}}function Mc(t,r,l){let c=He(XA,ZA),[p,h]=n(null);return i(()=>{if(!c||!t||c.path!==t||!l)return;h({request:c,path:t}),Nu(null)},[c,t,l]),u(()=>{if(!p||p.path!==t)return null;let{matches:g}=Tt(r,p.request.query,p.request.options),b=dr(r,Math.max(0,p.request.line-1));return{request:p.request,matches:g,currentIndex:vt(g,b)}},[p,t,r])}function Ll(t){let r=o({});i(()=>{if(!t)return;jA(r.current,Od(t))}),i(()=>{let l=r.current;return()=>qA(l)},[])}function Od(t){let{file:r}=t;if(!r)return{path:null,name:null,content:"",language:"text",state:"idle",note:null,preview:!1};let l={path:r.path,name:r.name,content:t.content,language:t.language,preview:t.preview&&t.viewerKind==="markdown"};if(r.isDiff)return{...l,content:"",state:"diff",note:null,preview:!1};if(t.loadError)return{...l,state:"error",note:t.loadError,preview:!1};if(t.isBinaryViewer)return{...l,content:"",state:"not-a-document",note:`${Fi[t.viewerKind]} files have no text outline.`,preview:!1};if(t.isLoading||!t.loaded)return{...l,state:"loading",note:null,preview:!1};return{...l,state:"ready",note:null}}function Ol(t,r,l){let c=He(WA,HA);return u(()=>{if(!c||!t||c.path!==t||!l)return null;let p=dr(r,Math.max(0,c.line-1)),h=r.indexOf(`
|
|
11
|
+
`,p),g=(h===-1?r.length:h)-p,b=Math.min(g,Math.max(0,(c.column??1)-1)),x=c.length===void 0?b:Math.min(g,b+c.length);return{path:t,offset:p,selectionStart:p+b,selectionEnd:p+x,request:c}},[c,t,l,r])}function Il({path:t,content:r,ready:l,surfaceRef:c,isPreview:p,exitPreview:h}){let g=Ol(t,r,l),b=o(null),x=o(null);i(()=>{if(x.current!==null){let v=c.current;if(p||!v)return;let E=x.current;x.current=null,Bl(v,E);return}if(!g||b.current===g.request)return;if(p){b.current=g.request,x.current={start:g.selectionStart,end:g.selectionEnd,offset:g.offset},h();return}let w=c.current;if(!w)return;b.current=g.request,Bl(w,{start:g.selectionStart,end:g.selectionEnd,offset:g.offset})})}function Bl(t,r){t.select(r.start,r.end,!0),t.revealOffset(r.offset),jo(null)}function Pc({file:t,editor:r,surfaceRef:l,isPreview:c,exitPreview:p,publish:h=!0}){Ll(h?{file:t,content:r.content,language:r.language,loaded:r.loaded,isLoading:r.isLoading,loadError:r.loadError,viewerKind:r.viewerKind,isBinaryViewer:r.isBinaryViewer,preview:c}:null),Il({path:t?.path??null,content:r.content,ready:r.loaded&&!r.loadError,surfaceRef:l,isPreview:c,exitPreview:p})}function Oc({fileName:t,onReload:r,onKeepMine:l}){return e("div",{className:"flex items-start gap-2 px-3 py-2 border-b border-info/30 bg-info/10 text-[11px] text-ink flex-shrink-0",role:"status","data-external-change-strip":"",children:[e(C,{size:13,className:"text-info flex-shrink-0 mt-0.5"}),e("div",{className:"min-w-0 flex-1",children:[e("div",{className:"font-medium",children:[e("span",{className:"font-mono",children:t})," changed on disk."]}),e("div",{className:"text-ink/60 mt-0.5",children:"Reload takes the disk copy and discards your edits. Keep mine writes yours over it."})]}),e("div",{className:"flex items-center gap-1 flex-shrink-0",children:[e("button",{type:"button",onClick:r,className:"px-2 py-1 rounded border border-ink/20 hover:bg-ink/5 transition-colors cursor-pointer",title:"Take the file from disk",children:"Reload"}),e("button",{type:"button",onClick:l,className:"px-2 py-1 rounded border border-info/50 text-info hover:bg-info/10 transition-colors cursor-pointer",title:"Keep my buffer; the next save writes it",children:"Keep mine"})]})]})}function $c({fileName:t,filePath:r,onClose:l,onConfirm:c}){return i(()=>{let p=(h)=>{if(h.key!=="Escape")return;h.preventDefault(),l()};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[l]),e("div",{className:"fixed inset-0 z-50 flex items-center justify-center modal-scrim animate-in fade-in duration-200 p-4",onClick:l,role:"dialog","aria-modal":"true","aria-label":"Save deleted file",children:e("div",{className:"glass-overlay bg-paper border border-ink/20 rounded-xl shadow-xl w-[min(94vw,440px)] overflow-hidden",onClick:(p)=>p.stopPropagation(),children:[e("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-ink/10",children:[e(Pa,{size:16,className:"text-error shrink-0"}),e("h2",{className:"text-[13px] font-semibold text-ink",children:"This file was deleted"})]}),e("div",{className:"px-4 py-4 space-y-3",children:[e("div",{className:"rounded-lg border border-ink/10 bg-canvas/50 px-3 py-2",children:[e("div",{className:"text-[12px] font-mono text-error line-through truncate",children:t}),e("div",{className:"text-[11px] font-mono text-ink/50 break-all mt-0.5",children:r})]}),e("p",{className:"text-[11.5px] leading-relaxed text-ink/60",children:"It was removed from disk while this tab was open. Saving recreates it with the buffer's current contents — anything written to that path since the deletion is lost."})]}),e("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:l,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/70 hover:bg-ink/5 hover:text-ink transition-colors cursor-pointer text-xs",children:"Cancel"}),e("button",{type:"button",autoFocus:!0,onClick:c,className:"px-3 py-1.5 rounded bg-error text-canvas hover:bg-error/90 transition-colors cursor-pointer text-xs font-medium",children:"Save anyway"})]})]})})}function zc(t){let[r,l]=S("editor.reviewMode",{});return{active:r[t]===!0,toggle:()=>l((c)=>({...c,[t]:c[t]!==!0}))}}function Dc(t,r=0){let l=Boolean(t.url)&&!t.url?.startsWith("blob:"),[c,p]=n({url:l?null:t.url,loading:l||!t.url,error:null}),h=o(t);return h.current=t,i(()=>{let g=h.current;if(g.url){let v=g.url;if(v.startsWith("blob:")){p({url:v,loading:!1,error:null});return}let E=!1;return p({url:null,loading:!0,error:null}),fetch(v,{headers:{Range:"bytes=0-0"}}).then(async(R)=>{if(E)return;if(R.ok){p({url:v,loading:!1,error:null});return}p({url:null,loading:!1,error:await Wr(R)})}).catch(()=>{if(!E)p({url:v,loading:!1,error:null})}),()=>{E=!0}}let b=g.loadBytes;if(!b){p({url:null,loading:!1,error:"This file cannot be read from here."});return}let x=!1,w=null;return p({url:null,loading:!0,error:null}),b().then((v)=>{if(x)return;w=URL.createObjectURL(g.mimeType?new Blob([v],{type:g.mimeType}):new Blob([v])),p({url:w,loading:!1,error:null})}).catch((v)=>{if(x)return;p({url:null,loading:!1,error:v instanceof Error?v.message:"Could not read this file."})}),()=>{if(x=!0,w)URL.revokeObjectURL(w)}},[t.id,r]),c}
|
|
12
|
+
export{Cc,ed,td,tA,nA,Ec,Zn,ts,Bc,Ic,_c,Sc,Tc,nd,ns,Fi,rs,Dc,Qc,rl,al,Nc,Rc,Fc,Lc,Mc,Pc,Oc,$c,zc};
|