pi-roundtable-web 0.29.0 → 0.29.2
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/CHANGELOG.md +39 -0
- package/dist/chunk-account-dq0nhfvj.js +1 -0
- package/dist/{chunk-action-menu-q5y7xpry.js → chunk-action-menu-37zgbhje.js} +1 -1
- package/dist/chunk-agent-yqe6reej.js +1 -0
- package/dist/chunk-arranged-rooms-sx6xg9df.js +1 -0
- package/dist/chunk-attachments-3vbj05g5.js +102 -0
- package/dist/chunk-bulk-actions-6pehrsgb.js +1 -0
- package/dist/chunk-character-creator-bg3tdc8p.js +225 -0
- package/dist/chunk-codeeditor-102wa9bj.js +2 -0
- package/dist/chunk-confirm-ghxga720.js +1 -0
- package/dist/chunk-connectors-0jzzren3.js +37 -0
- package/dist/chunk-conversations-3276jq4q.js +1 -0
- package/dist/chunk-council-sheet-7m884s44.js +2 -0
- package/dist/chunk-council-view-rkzcxeg8.js +1 -0
- package/dist/{chunk-drag-7873fvzw.js → chunk-drag-sw692nr3.js} +1 -1
- package/dist/chunk-entry-mb6jd983.js +1 -0
- package/dist/chunk-folder-list-g7st6p1e.js +1 -0
- package/dist/chunk-folds-rb1b069h.js +1 -0
- package/dist/chunk-gate-3rxxyfev.js +1 -0
- package/dist/chunk-host-icons-cyj62pwp.js +1 -0
- package/dist/chunk-host-picture-9wnhqckv.js +1 -0
- package/dist/chunk-host-state-b858k3p8.js +1 -0
- package/dist/chunk-host-ui-j6wvj0pe.js +1 -0
- package/dist/{chunk-index-gj3n4dh5.js → chunk-index-0qzqzp6t.js} +2 -2
- package/dist/{chunk-index-7k5895sn.js → chunk-index-0t68az7d.js} +3 -3
- package/dist/chunk-index-0xdptr30.js +2 -0
- package/dist/{chunk-index-bjeg3e2j.js → chunk-index-1tkzdy4s.js} +2 -2
- package/dist/chunk-index-2s48qyrs.js +2 -0
- package/dist/chunk-index-33cqx9v2.js +2 -0
- package/dist/chunk-index-36m3knsk.js +2 -0
- package/dist/{chunk-index-r0hk9kyd.js → chunk-index-50syrmaq.js} +2 -2
- package/dist/{chunk-index-4krm48hm.js → chunk-index-50w6yq2d.js} +1 -1
- package/dist/{chunk-index-4jnn2g09.js → chunk-index-5fyqxh0r.js} +2 -2
- package/dist/chunk-index-5x3h176v.js +2 -0
- package/dist/{chunk-index-y6p8j3zv.js → chunk-index-6cs1wvhy.js} +1 -1
- package/dist/{chunk-index-aycxt14t.js → chunk-index-6m25qpa7.js} +2 -2
- package/dist/{chunk-index-35zqk1zr.js → chunk-index-6nja2vd8.js} +2 -2
- package/dist/{chunk-index-teyx2hz7.js → chunk-index-6q3dx093.js} +2 -2
- package/dist/{chunk-index-7c9fn21n.js → chunk-index-6ycrvwzs.js} +2 -2
- package/dist/{chunk-index-5ssncptg.js → chunk-index-6yfcfcc8.js} +2 -2
- package/dist/{chunk-index-rr73h4kc.js → chunk-index-7gk2sdf4.js} +3 -3
- package/dist/{chunk-index-h2a42p6s.js → chunk-index-7p31pda8.js} +19 -3
- package/dist/chunk-index-91wnf1k9.js +1 -0
- package/dist/chunk-index-9ehqccfe.js +2 -0
- package/dist/chunk-index-ar1x9fhw.js +2 -0
- package/dist/chunk-index-axw4wkqq.js +2 -0
- package/dist/chunk-index-b5patef1.js +2 -0
- package/dist/chunk-index-d941ae7c.js +2 -0
- package/dist/chunk-index-dagc92hw.js +2 -0
- package/dist/chunk-index-ddssgba9.js +2 -0
- package/dist/chunk-index-dpgn7kzp.js +2 -0
- package/dist/{chunk-index-zdzzf3fp.js → chunk-index-e8535c4h.js} +2 -2
- package/dist/{chunk-index-e46652wf.js → chunk-index-edjyj761.js} +1 -1
- package/dist/chunk-index-eez0kbk4.js +2 -0
- package/dist/chunk-index-ekp5mmvp.js +2 -0
- package/dist/{chunk-index-pcbkp62w.js → chunk-index-eyythjdx.js} +2 -2
- package/dist/chunk-index-fdg2qd3f.js +2 -0
- package/dist/chunk-index-g0sdxjxr.js +2 -0
- package/dist/{chunk-index-cttrqfm8.js → chunk-index-gmbk3sra.js} +1 -1
- package/dist/chunk-index-hsc9yz2x.js +2 -0
- package/dist/{chunk-index-a8c0ap8g.js → chunk-index-jrj09r5c.js} +2 -2
- package/dist/chunk-index-kvztbfqj.js +2 -0
- package/dist/{chunk-index-f4gqzfkv.js → chunk-index-m7wzrmcd.js} +2 -2
- package/dist/chunk-index-m8bv51r9.js +2 -0
- package/dist/{chunk-index-amspdq2j.js → chunk-index-mey1p7h8.js} +3 -3
- package/dist/{chunk-index-4re5prfp.js → chunk-index-mzw7nmkc.js} +2 -2
- package/dist/{chunk-index-en5dm1zv.js → chunk-index-n2v2bz8d.js} +2 -2
- package/dist/chunk-index-nncy9wxw.js +2 -0
- package/dist/chunk-index-p2e7rwac.js +2 -0
- package/dist/chunk-index-p98tt12y.js +2 -0
- package/dist/chunk-index-qdtmetsy.js +120 -0
- package/dist/{chunk-index-pfs6rm6w.js → chunk-index-qedt9szy.js} +2 -2
- package/dist/{chunk-index-evhaaqzk.js → chunk-index-qk7rp7fk.js} +11 -11
- package/dist/{chunk-index-hef4gwtb.js → chunk-index-qq86fxda.js} +2 -2
- package/dist/{chunk-index-v6h43553.js → chunk-index-qw9a7ken.js} +2 -2
- package/dist/chunk-index-s356ybxk.js +50 -0
- package/dist/{chunk-index-rtz4936v.js → chunk-index-sk8cvb4e.js} +3 -3
- package/dist/{chunk-index-3tjmyd1h.js → chunk-index-syxwqhry.js} +2 -2
- package/dist/{chunk-index-1652v386.css → chunk-index-t7csmbpy.css} +1 -1
- package/dist/{chunk-index-haac6nbt.js → chunk-index-tasbd41t.js} +2 -2
- package/dist/chunk-index-vxqzavgz.js +2 -0
- package/dist/chunk-index-x5xq9g9a.js +3 -0
- package/dist/chunk-index-xx0kecz9.js +2 -0
- package/dist/{chunk-index-q33ppq0j.js → chunk-index-y1xv3dxs.js} +100 -4
- package/dist/{chunk-index-ntt3em2k.js → chunk-index-yn1vvxj2.js} +1 -1
- package/dist/chunk-lang-css-rwkzd784.js +1 -0
- package/dist/{chunk-lang-dockerfile-2p7e3ssz.js → chunk-lang-dockerfile-e87ssppx.js} +1 -1
- package/dist/{chunk-lang-go-zxp9k517.js → chunk-lang-go-kbcbn346.js} +2 -2
- package/dist/chunk-lang-html-zhngbs9v.js +1 -0
- package/dist/chunk-lang-javascript-bk2s6a56.js +1 -0
- package/dist/{chunk-lang-json-zmym50rg.js → chunk-lang-json-4pe1fv7e.js} +1 -1
- package/dist/{chunk-lang-markdown-ww2kcs85.js → chunk-lang-markdown-67cm3tjx.js} +5 -5
- package/dist/{chunk-lang-python-ng1zdtd4.js → chunk-lang-python-mnfhcvww.js} +2 -2
- package/dist/{chunk-lang-rust-6ynhxjdd.js → chunk-lang-rust-e4a9s76x.js} +1 -1
- package/dist/{chunk-lang-shell-39t9bz2s.js → chunk-lang-shell-43nea8tq.js} +1 -1
- package/dist/{chunk-lang-sql-w875ejpg.js → chunk-lang-sql-28364npv.js} +2 -2
- package/dist/{chunk-lang-toml-b8ckgkg5.js → chunk-lang-toml-a83hr7bw.js} +1 -1
- package/dist/chunk-lang-typescript-r5npc6zf.js +1 -0
- package/dist/{chunk-lang-xml-bz91cjp1.js → chunk-lang-xml-2hv5xc8n.js} +1 -1
- package/dist/{chunk-lang-yaml-g9zy0tdv.js → chunk-lang-yaml-vw22drt8.js} +1 -1
- package/dist/chunk-layout-actions-rw5myg2t.js +1 -0
- package/dist/chunk-menu-items-q0hy5kzd.js +1 -0
- package/dist/chunk-mode-toggle-yk2t0tcy.js +1 -0
- package/dist/{chunk-note-row-314py1pp.js → chunk-note-row-c0trzayj.js} +33 -4
- package/dist/chunk-notes-0xcmm938.js +1 -0
- package/dist/chunk-notice-bell-f9nhxg71.js +1 -0
- package/dist/{chunk-notices-mtn7pg1z.js → chunk-notices-gkaqncqz.js} +1 -1
- package/dist/chunk-onboarding-fkq9ptcw.js +1 -0
- package/dist/chunk-overview-yssxbg0d.js +1 -0
- package/dist/chunk-palette-w6qbr7zp.js +1 -0
- package/dist/chunk-placement-items-wcwy91mp.js +1 -0
- package/dist/chunk-profile-9sjgayrx.js +1 -0
- package/dist/chunk-prompt-history-kn42sf8y.js +1 -0
- package/dist/chunk-prompts-824fwgvh.js +1 -0
- package/dist/chunk-room-confirms-hvs9tra4.js +1 -0
- package/dist/{chunk-room-menu-1m2c2ekt.js → chunk-room-menu-pkd0487m.js} +1 -1
- package/dist/chunk-rooms-menu-button-w5hfhsfv.js +1 -0
- package/dist/chunk-schedules-m9mn68gt.js +1 -0
- package/dist/{chunk-seat-menu-m2n9nvv0.js → chunk-seat-menu-3tdcr44t.js} +1 -1
- package/dist/chunk-section-fold-g0tx68cj.js +1 -0
- package/dist/chunk-settings-18qmhcyr.js +1 -0
- package/dist/chunk-sheet-hosts-tsppnmvv.js +29 -0
- package/dist/chunk-shortcut-help-wnm0cm8n.js +26 -0
- package/dist/chunk-shortcuts-qee393s5.js +1 -0
- package/dist/chunk-skill-editor-pryntvpr.js +8 -0
- package/dist/chunk-skills-sap3rysr.js +1 -0
- package/dist/chunk-start-over-line-azexcxj1.js +16 -0
- package/dist/chunk-switcher-list-6hacxjfe.js +1 -0
- package/dist/{chunk-tab-dot-gkpe06q8.js → chunk-tab-dot-h0eskhrt.js} +1 -1
- package/dist/{chunk-table-av3kh3tt.js → chunk-table-jtn49c2m.js} +1 -1
- package/dist/chunk-table2d-vy4w4r5k.js +1 -0
- package/dist/{chunk-table3d-rsvajx7r.js → chunk-table3d-0a62jerb.js} +22 -22
- package/dist/chunk-thread-actions-31scmndt.js +1 -0
- package/dist/{chunk-thread-cards-grzszfha.js → chunk-thread-cards-mwxzy02t.js} +1 -1
- package/dist/chunk-thread-list-52mx2m9p.js +227 -0
- package/dist/chunk-transcript-p5q2m795.js +1 -0
- package/dist/chunk-waiting-chip-wvkbsnw5.js +32 -0
- package/dist/chunk-waiting-s7nm3q0p.js +1 -0
- package/dist/chunk-where-j99f8pb8.js +1 -0
- package/dist/chunk-workspace-ne2nkf4h.js +586 -0
- package/dist/chunk-zh-tw-vm5d0w6j.js +1 -0
- package/dist/index.html +1 -1
- package/dist/sw.js +1 -1
- package/package.json +2 -2
- package/src/api-types.ts +12 -0
- package/src/app/app.ts +7 -0
- package/src/app/card-log.ts +10 -2
- package/src/app/protocol.ts +18 -0
- package/src/app/queued-delivery.ts +107 -0
- package/src/app/queued-frames.ts +115 -0
- package/src/app/room-log.ts +39 -7
- package/src/app/routes.ts +97 -5
- package/src/app/socket.ts +12 -2
- package/src/app/surface.ts +37 -6
- package/src/app/zip.ts +124 -0
- package/src/auth/sessions.ts +9 -1
- package/src/host/cards.ts +10 -3
- package/src/host/stored-json.ts +23 -0
- package/src/i18n/zh-tw.ts +14 -0
- package/src/notices/mount.ts +1 -0
- package/src/notices/store.ts +9 -1
- package/src/web-plugin.ts +4 -1
- package/dist/chunk-account-9616x405.js +0 -1
- package/dist/chunk-agent-x74xezyt.js +0 -1
- package/dist/chunk-arranged-rooms-9prq46vh.js +0 -1
- package/dist/chunk-bulk-actions-5dc4m9ad.js +0 -1
- package/dist/chunk-character-creator-wf02eg0h.js +0 -1
- package/dist/chunk-codeeditor-239ss6a2.js +0 -2
- package/dist/chunk-confirm-bhrx9195.js +0 -1
- package/dist/chunk-connectors-k77pd9by.js +0 -37
- package/dist/chunk-conversations-ftcpaqw1.js +0 -1
- package/dist/chunk-council-sheet-a5e6tspr.js +0 -2
- package/dist/chunk-council-view-6593rqbr.js +0 -1
- package/dist/chunk-entry-5zmjxadx.js +0 -1
- package/dist/chunk-folder-list-h9hmbm8e.js +0 -1
- package/dist/chunk-folds-vxq86t1s.js +0 -1
- package/dist/chunk-gate-fa6za28z.js +0 -1
- package/dist/chunk-host-icons-y6frbzqt.js +0 -1
- package/dist/chunk-host-picture-fqg55rbr.js +0 -1
- package/dist/chunk-host-state-65tdhkyq.js +0 -1
- package/dist/chunk-host-ui-233kz7qp.js +0 -1
- package/dist/chunk-index-2c00zf3z.js +0 -2
- package/dist/chunk-index-2dhrqvba.js +0 -2
- package/dist/chunk-index-2s4bkrz3.js +0 -2
- package/dist/chunk-index-2ypaqwjy.js +0 -2
- package/dist/chunk-index-39qq37j5.js +0 -2
- package/dist/chunk-index-4eag6s50.js +0 -2
- package/dist/chunk-index-57teqgct.js +0 -2
- package/dist/chunk-index-93f3e06v.js +0 -2
- package/dist/chunk-index-9m9v1p7s.js +0 -2
- package/dist/chunk-index-a8nqn3y0.js +0 -3
- package/dist/chunk-index-am7ghh75.js +0 -120
- package/dist/chunk-index-amxa2bn3.js +0 -2
- package/dist/chunk-index-dajanzxc.js +0 -1
- package/dist/chunk-index-e2eeckhh.js +0 -2
- package/dist/chunk-index-ek98d2rn.js +0 -2
- package/dist/chunk-index-gp4chnp3.js +0 -2
- package/dist/chunk-index-mg96sqpk.js +0 -2
- package/dist/chunk-index-nsya88fn.js +0 -1
- package/dist/chunk-index-pgxgq61x.js +0 -2
- package/dist/chunk-index-smz90j6p.js +0 -2
- package/dist/chunk-index-vzqwn3wp.js +0 -2
- package/dist/chunk-index-wt2asefx.js +0 -50
- package/dist/chunk-index-x4tq9btg.js +0 -2
- package/dist/chunk-index-yvcdg5hh.js +0 -2
- package/dist/chunk-index-zeqfnkty.js +0 -2
- package/dist/chunk-index-zpwb8mkk.js +0 -2
- package/dist/chunk-lang-css-avzhvm72.js +0 -1
- package/dist/chunk-lang-html-red02gep.js +0 -1
- package/dist/chunk-lang-javascript-n33kmjcx.js +0 -1
- package/dist/chunk-lang-typescript-qf8acbb2.js +0 -1
- package/dist/chunk-layout-actions-fyzzzeyp.js +0 -1
- package/dist/chunk-menu-items-yvnk3vds.js +0 -1
- package/dist/chunk-mode-toggle-ccv271hm.js +0 -1
- package/dist/chunk-notes-4rnrddzw.js +0 -1
- package/dist/chunk-notice-bell-z9wgamnz.js +0 -1
- package/dist/chunk-onboarding-f3hhxgg4.js +0 -1
- package/dist/chunk-overview-qmepntrr.js +0 -1
- package/dist/chunk-palette-edkn1ypq.js +0 -1
- package/dist/chunk-placement-items-trsa5t23.js +0 -1
- package/dist/chunk-profile-pwfq0wns.js +0 -1
- package/dist/chunk-prompt-history-xp9hmeqt.js +0 -1
- package/dist/chunk-prompts-a56qvytg.js +0 -1
- package/dist/chunk-room-confirms-gqpkz4h0.js +0 -1
- package/dist/chunk-rooms-menu-button-tcvda1gq.js +0 -1
- package/dist/chunk-schedules-kwnw7p8v.js +0 -1
- package/dist/chunk-sheet-hosts-pr8xktyq.js +0 -29
- package/dist/chunk-shortcut-help-sbvrds1m.js +0 -26
- package/dist/chunk-shortcuts-8705p7q3.js +0 -1
- package/dist/chunk-skill-editor-7xy09sq1.js +0 -8
- package/dist/chunk-skills-cnc25x7q.js +0 -1
- package/dist/chunk-start-over-line-97zdd9pb.js +0 -16
- package/dist/chunk-switcher-list-ehsn2wsk.js +0 -1
- package/dist/chunk-table2d-5x3jptp9.js +0 -1
- package/dist/chunk-thread-actions-7xtkegwm.js +0 -1
- package/dist/chunk-thread-list-9bjjac3j.js +0 -217
- package/dist/chunk-transcript-t5szb8r0.js +0 -1
- package/dist/chunk-waiting-chip-d8b6a0p8.js +0 -28
- package/dist/chunk-waiting-ts3kxjvv.js +0 -1
- package/dist/chunk-where-3d3ncsa5.js +0 -1
- package/dist/chunk-workspace-ct6hvn0z.js +0 -578
- package/dist/chunk-zh-tw-v9v1eerm.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,45 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [0.29.2] - 2026-10-31
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- The groups you pick a room from fold like Discord's categories: the owners' folders, and the headings Pinned, Ungrouped, Knights and Groups in the room list, and the same headings and folders in a phone's room drawer. Tap the heading (a chevron, `aria-expanded`) to fold it; a folded group shows how many rooms it holds. The fold is kept per device in `localStorage`, shared by the list and the drawer for the same folder, Pinned and Ungrouped. Home and the drawer's "Waiting for you" never fold.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- A tap or Enter on a podium in the council's chat-mode strip mentions that knight in the council's message box instead of opening the knight's room: `@<name> ` goes in at the caret when the box is the one being typed in, and after the text when it is not, and the box takes the focus. The strip's podiums now have the knight's menu too (a long press, a right click or the Menu key), where "Private chat" opens the knight's own room. The animated scene is as it was: a tap turns the camera.
|
|
17
|
+
- A folded group keeps its open room under the heading, plus any room with a card waiting for an answer or messages unread, as a Discord category keeps the selected and the unread channels. A folded folder used to open in full while it held the open room; now only that room stays and the others fold away behind the folder's picture stack. Alt+↑/↓ step over the rooms a fold hides. A search (the drawer's field, the room palette) still finds rooms in a folded group.
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- In the council's chat-mode strip the room header no longer cuts the figures off at the chin. The figures were drawn larger than the 120 px strip, so only mouths and bodies showed; the podiums now size to the strip (a podium at most 67 px wide, 46 px at the narrowest) and every head stands whole under the header, from two members to eight, at desktop and 390 px width. The strip is as high as before.
|
|
22
|
+
|
|
23
|
+
## [0.29.1] - 2026-10-31
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
|
|
27
|
+
- A message's files are one attachment block: a heading "Attachments (N)" in a bordered box unlike inline code, each file a full-width chip with its icon, name and size, on phones and desktops. Agent rooms, host rooms, notes and the round table's dialogue box all show it; a host room still says how many files were removed.
|
|
28
|
+
- "Download all" in the heading of a message with two or more files downloads them as one zip, from `GET api/files/zip?room=<room>&message=<id>`. The route answers the room and each file as the single file route does, so someone who may not read the room gets the same refusal. It packs only the files still kept, each under its own name (a repeated name becomes `name-2`, `name-3`), in `attachments-<YYYYMMDD-HHMM>.zip` (the message's UTC time), stored without compression, and refuses past 200 MB with a message to download the files one by one. The zip is named after when the message was sent on the host's clock (`attachments-20261031-2028.zip`); `OwnerAppOptions.timeZone` and `AppApiOptions.timeZone` carry the host's zone, UTC when absent.
|
|
29
|
+
- A bubble with files that is taller than about one screen opens with a paperclip line "N attachments", which scrolls to the block, smoothly unless the person asked for less motion.
|
|
30
|
+
|
|
31
|
+
### Changed
|
|
32
|
+
|
|
33
|
+
- A swipe right opens the room drawer from anywhere in the left half of the screen, the left edge included, over the header and empty space as well as over the messages. It was the messages only, and not within 32 px of either edge. The right edge stays the system's Back, and the drawer closes by a swipe left from anywhere but there.
|
|
34
|
+
- Host rooms have the drawer too: the swipe, and a tap on the room's picture in the header. The waiting-cards strip of a host room moved to its own file.
|
|
35
|
+
- A message of yours sent while a turn runs shows where it stands under it, live and after a reload: "Added to this turn" when the running turn took it, "Queued" while it waits for its own turn (the line goes when the turn starts), and "Cancelled" for one you cancelled, which stays in the room dimmed and never runs. A queued message's long-press or right-click menu offers its author Edit (a sheet with the text; the turn runs on the new text and the message shows as edited) and Cancel. Once the turn has started a notice says it is too late. `RoomMessage.delivery` carries the state (`steered` and `cancelled` are stored, in a new `delivery` column; `queued` is read from the host's queue and so does not outlive a restart); client frames `edit_queued` and `cancel_queued` (`room`, `message` id, `text`) answer with the changed message as an `edited` frame or a `refused` frame (`not_queued` when the turn has started, `forbidden` for another person's message). With a core that has no `ConversationPort.cancelQueued` and `editQueued`, both answer `not_queued`.
|
|
36
|
+
- Pressing ↑ in an empty message box opens Edit on your latest message in the room that still waits for its turn (not while an input method composes; Alt+↑ / Alt+↓ still switch rooms), and the `?` shortcut list names it.
|
|
37
|
+
- The round table's camera turns to a member by the same rule as the spotlight: only when their words show. A member who only thinks or works no longer takes it when the previous speaker's words finish; the camera stays on whoever spoke last until the next member's words start.
|
|
38
|
+
|
|
39
|
+
### Fixed
|
|
40
|
+
|
|
41
|
+
- jsonb columns are stored as JSON values: a room message's `files`, `picture` and `intercom`, an ended card's `frame` and `answer`, a host card, a notice's `open` and a session's actor were stored as JSON strings. Migrations (`web-room-messages-json-values`, `web-room-cards-json-values`, `web-host-cards-json-values`, `web-notices-json-values`, `web-sessions-json-values`) convert the rows stored that way; reads still take either.
|
|
42
|
+
- Buttons with a quiet look of their own no longer turn into unreadable text on the accent fill when hovered or, on a phone, after a tap: the "N earlier tools" chip, the character creator's tiles, the files pane's folder twist and image toggle, the host room's cards toggle and seen faces, and a knight's temp knights header now say what hover does to them. A test fails for any new button that sets its own fill or text colour without a hover rule.
|
|
43
|
+
- The character creator's styles load with the creator instead of with the page, which leaves room in what the page loads first.
|
|
44
|
+
- The room drawer opens on a phone. A swipe right in a room never reached the page in Chrome: the room had the default `touch-action`, so Chrome took a sideways drag for itself a few pixels in and cancelled the touch before the swipe was 24 px long. The room, its message list, the composer and the drawer's own list now allow only up-down panning and pinch zoom, which leaves sideways drags to the page. A swipe that starts in a sideways-scrolling code block or table, a field, a card's option row, a sheet over the page, or a scene that takes every touch is still not the room's.
|
|
45
|
+
- Two edits of a waiting message from two sockets reach the room's log in the order the host took them, so the room shows the text the turn runs.
|
|
46
|
+
|
|
8
47
|
## [0.29.0] - 2026-10-31
|
|
9
48
|
|
|
10
49
|
### Added
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p,T,v,e,x}from"./chunk-index-s356ybxk.js";var a={profile:v(()=>(p("9sjgayrx"),import("./chunk-profile-9sjgayrx.js")).then((o)=>({default:o.ProfilePage}))),notices:v(()=>(p("gkaqncqz"),import("./chunk-notices-gkaqncqz.js")).then((o)=>({default:o.NoticesPage}))),onboarding:v(()=>(p("fkq9ptcw"),import("./chunk-onboarding-fkq9ptcw.js")).then((o)=>({default:o.OnboardingPage})))};function n({pane:o}){let t=a[o];return t?e(T,{fallback:e(x,{}),children:e(t,{})}):null}export{n as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{s,Pe,a,r,g,e,n,o,kt,xs}from"./chunk-index-s356ybxk.js";import{C}from"./chunk-index-e8535c4h.js";var L=()=>typeof matchMedia==="function"&&matchMedia("(max-width: 719px)").matches,k={rtMenu:!0},x=()=>Boolean(window.history.state?.rtMenu),w=8,E=(t)=>t?.isConnected?t:null;function M(t){return t.items.map((i)=>n("button",{type:"button",role:i.checked===void 0?"menuitem":"menuitemcheckbox",...i.checked===void 0?{}:{"aria-checked":i.checked},className:"menu-item menu-link","data-tone":i.tone,onClick:()=>t.onChoose(i),children:[i.icon?e("span",{className:"menu-icon","data-tone":i.tone,children:e(o,{name:i.icon,size:18})}):null,e("span",{className:"menu-text",children:e("strong",{children:i.label})}),i.checked?e(o,{name:"check",size:18,className:"menu-check"}):null]},i.id))}function H({menu:t}){let i=a(void 0);if(t)i.current=t;let l=i.current,m=a(!1),h=a(void 0),p=t?.serial;return s(()=>{if(p===void 0)return;return window.history.pushState(k,"",window.location.href),m.current=!0,()=>{if(m.current)m.current=!1,window.history.back()}},[p]),s(()=>{let f=()=>{if(!m.current||x())return;m.current=!1,kt();let y=h.current;h.current=void 0,y?.()};return window.addEventListener("popstate",f),()=>window.removeEventListener("popstate",f)},[]),e(C,{open:t!==void 0,title:l?.title??"",onClose:kt,restoreFocus:()=>E(l?.source??null),children:l?e("div",{className:"menu action-items",role:"menu","aria-label":l.title,children:e(M,{items:l.items,onChoose:(f)=>{if(!m.current){kt(),f.run();return}h.current=f.run,window.history.back()}})}):null})}function T({menu:t}){let i=a(null),[l,m]=r(t.at),{source:h}=t,p=(u)=>{E(h)?.focus(),kt(),u?.()},f=a(p);f.current=p,Pe(()=>{let u=i.current;if(!u)return;let d={left:u.style.left,top:u.style.top};u.style.left="0px",u.style.top="0px";let c={width:u.offsetWidth,height:u.offsetHeight};u.style.left=d.left,u.style.top=d.top,m({x:Math.max(w,Math.min(t.at.x,window.innerWidth-c.width-w)),y:Math.max(w,Math.min(t.at.y,window.innerHeight-c.height-w))}),u.querySelector('[role^="menuitem"]')?.focus()},[t.serial]),s(()=>{let u=(c)=>{if(c.target instanceof Node&&i.current?.contains(c.target))return;kt()},d=()=>kt();return document.addEventListener("pointerdown",u,!0),document.addEventListener("wheel",u,{capture:!0,passive:!0}),document.addEventListener("touchmove",u,{capture:!0,passive:!0}),window.addEventListener("resize",d),()=>{document.removeEventListener("pointerdown",u,!0),document.removeEventListener("wheel",u,!0),document.removeEventListener("touchmove",u,!0),window.removeEventListener("resize",d)}},[]);let y=(u)=>{let d=[...i.current?.querySelectorAll('[role^="menuitem"]')??[]],c=d.indexOf(document.activeElement),v=(b)=>{u.preventDefault(),d[(b+d.length)%d.length]?.focus()};switch(u.key){case"Escape":u.preventDefault(),u.stopPropagation(),f.current();return;case"ArrowDown":return v(c+1);case"ArrowUp":return v(c<0?-1:c-1);case"Tab":return v(u.shiftKey?c<0?-1:c-1:c+1);case"Home":return v(0);case"End":return v(-1)}};return e("div",{ref:i,className:"action-popover",role:"menu","aria-label":t.title,tabIndex:-1,style:{left:`${l.x}px`,top:`${l.y}px`},onKeyDown:y,children:e(M,{items:t.items,onChoose:(u)=>p(u.run)})})}function O(){let t=xs(),i=a(void 0);if(t&&i.current?.serial!==t.serial)i.current={serial:t.serial,sheet:L()};let l=Boolean(t&&i.current?.sheet);return n(g,{children:[e(H,{menu:l?t:void 0}),t&&!l?e(T,{menu:t},t.serial):null]})}export{O as ActionMenuHost};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s,e,X,u,x,Ke}from"./chunk-index-s356ybxk.js";function c({name:o}){let i=u((t)=>t.listed),r=u((t)=>Object.values(t.rooms).find((m)=>m.view?.kind==="agent"&&m.view.name===o)?.view?.key,o);return s(()=>{if(r)X("room",r,{replace:!0}),Ke(o);else if(i)X("rooms",void 0,{replace:!0})},[r,i,o]),e("div",{className:"page",children:e(x,{})})}export{c as AgentPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p,T,v,ee,R,a,t,g,e,n,o,Le,u,k,_,Oe,Jt,_n,te,Ae,Pr,Ni,ao,It,Li,lo}from"./chunk-index-s356ybxk.js";import"./chunk-index-50w6yq2d.js";import"./chunk-index-qq86fxda.js";import{mn,rr}from"./chunk-index-y1xv3dxs.js";import{De}from"./chunk-index-axw4wkqq.js";import{_i}from"./chunk-index-p98tt12y.js";import{mi}from"./chunk-index-33cqx9v2.js";import{wi}from"./chunk-index-dpgn7kzp.js";import{Yt}from"./chunk-index-ddssgba9.js";import"./chunk-index-xx0kecz9.js";import"./chunk-index-6m25qpa7.js";import{lt}from"./chunk-index-6ycrvwzs.js";mn();var O=v(()=>(p("g7st6p1e"),import("./chunk-folder-list-g7st6p1e.js")).then((i)=>({default:i.FolderList}))),Z=ee(function(m){let{view:r}=m,h=Yt(()=>Jt(r.key),r.home?void 0:wi(r.key));return e(ao,{...m,press:h,item:{...r.home?{}:{"data-drop-item":"","data-key":r.key},...m.arranging?{"data-arranging":""}:{}},after:m.arranging?e("button",{type:"button",className:"icon-button row-more","aria-haspopup":"menu","aria-label":t("Room menu"),onClick:(s)=>{let c=s.currentTarget;Jt(r.key).then((l)=>{if(!l)return;let N=c.getBoundingClientRect();Oe({...l,at:{x:N.left,y:N.bottom},via:"key",source:c})},()=>{return})},children:e(o,{name:"more",size:18})}):null})});function L(i){let{now:m}=te(),{timeZone:r}=_(),h=It(i.rooms);return e("ul",{className:"room-list",children:h.map(({key:s,...c})=>{let l=i.threads[s];return e(Z,{...c,active:s===i.active,now:m,timeZone:r,arranging:i.arranging,...l?{threads:e(Li,{open:l.open,closed:l.closed,active:i.active,parent:s})}:{}},s)})})}function y(i){let r=It(i.rooms).length===0;if(r&&i.zone?.kind!=="pinned")return null;let h=i.zone?{"data-drop-zone":i.zone.kind,"data-zone-id":i.zone.id}:{},s=(c)=>e(L,{rooms:c,threads:i.threads,active:i.active,arranging:i.arranging});if(i.fold&&!r)return e(rr,{id:i.fold,title:i.title,rooms:i.rooms,active:i.active,attrs:h,children:s});return n("section",{className:"stack",...r?{"data-empty":""}:{},...h,children:[e("h2",{className:"section-title",children:i.title}),r?null:s(i.rooms)]})}function le(i){let m=Boolean(_().kinds?.length),r=u((d)=>JSON.stringify({listed:d.listed,...lt(d,(M)=>Le(d,M))})),h=_i(),s=a(r);if(!h)s.current=r;let c=s.current,{listed:l,...N}=R(()=>JSON.parse(c),[c]),{home:S,pinned:A,folders:w,restAgents:P,restGroups:D,rest:C,threads:F,orphans:f}=N,z=Pr(),K=S.length+A.length+C.length===0&&w.every((d)=>d.rooms.length===0)&&f.open.length+f.closed.length===0,b={threads:F,active:i.active,arranging:z};return n("div",{className:"page","data-column":i.active?"":void 0,"data-drop-root":"",children:[n("header",{className:"page-head",children:[e("h1",{children:t("Rooms")}),n("div",{className:"actions",children:[n("button",{type:"button",className:"header-button search-button",onClick:i.onSearch,children:[e(o,{name:"search",size:16}),e("span",{children:t("Find a room")}),e("kbd",{children:"⌘K"})]}),l?e("button",{type:"button",className:"header-button icon-button","aria-haspopup":"menu","aria-label":t("Folders and order"),onClick:(d)=>mi(d.currentTarget),children:e(o,{name:"more",size:18})}):null,e("button",{type:"button",className:"header-button icon-button","aria-label":t("Add"),"aria-haspopup":"menu",onClick:(d)=>_n(d.currentTarget),children:e(o,{name:"plus"})})]})]}),z?n("div",{className:"arrange-bar",children:[n("button",{type:"button",className:"secondary",onClick:()=>De({kind:"new"}),children:[e(o,{name:"plus",size:16}),e("span",{children:t("Add a folder")})]}),e("button",{type:"button",onClick:()=>Ni(!1),children:t("Done")})]}):null,l&&K&&!m?e(k,{children:t("No rooms yet. Rooms appear when the team has a knight.")}):null,!l?n("div",{className:"stack","aria-busy":"true",children:[e("div",{className:"skeleton"}),e("div",{className:"skeleton"}),e("div",{className:"skeleton"})]}):null,e(y,{title:t("Home"),rooms:S,...b}),e(y,{title:t("Pinned"),rooms:A,zone:{kind:"pinned",id:"pinned"},fold:Ae("pinned"),...b}),w.length>0?e("div",{className:"stack folder-list","data-folder-list":"",children:e(T,{fallback:e("div",{className:"skeleton","aria-busy":"true"}),children:e(O,{folders:w,active:i.active,listed:l,rooms:(d)=>e(L,{rooms:d,threads:F,active:i.active,arranging:z})})})}):null,w.length>0?e(y,{title:t("Ungrouped"),rooms:C,zone:{kind:"rest",id:"rest"},fold:Ae("rest"),...b}):n(g,{children:[e(y,{title:t("Knights"),rooms:P,zone:{kind:"rest",id:"rest-agents"},fold:Ae("agents"),...b}),e(y,{title:t("Groups"),rooms:D,zone:{kind:"rest",id:"rest-groups"},fold:Ae("groups"),...b})]}),f.open.length+f.closed.length>0?n("section",{className:"stack",children:[e("h2",{className:"section-title",children:t("Dispatch threads")}),e(Li,{open:f.open,closed:f.closed,active:i.active})]}):null,e(lo,{active:i.active})]})}export{le as ArrangedRoomsPage};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import{Pe,a,r,t,B,e,n,o,we,Ht,gs,Me,Nt,Ps}from"./chunk-index-s356ybxk.js";import{Y}from"./chunk-index-d941ae7c.js";var u=`
|
|
2
|
+
.attachments {
|
|
3
|
+
margin-top: var(--space-3);
|
|
4
|
+
padding: var(--space-2);
|
|
5
|
+
border: 1px solid var(--border-strong);
|
|
6
|
+
border-radius: var(--radius);
|
|
7
|
+
background: var(--bg);
|
|
8
|
+
color: var(--text);
|
|
9
|
+
min-width: 0;
|
|
10
|
+
scroll-margin-top: var(--space-6);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.bubble > .attachments:first-child {
|
|
14
|
+
margin-top: 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.attachments-head {
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
gap: var(--space-2);
|
|
21
|
+
min-height: 2rem;
|
|
22
|
+
padding: 0 var(--space-1);
|
|
23
|
+
font-size: var(--text-sm);
|
|
24
|
+
font-weight: 600;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.attachments-head > span {
|
|
28
|
+
flex: 1;
|
|
29
|
+
min-width: 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.attachments .link-button {
|
|
33
|
+
display: inline-flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
gap: var(--space-1);
|
|
36
|
+
border: 1px solid transparent;
|
|
37
|
+
border-radius: var(--radius);
|
|
38
|
+
font-size: var(--text-sm);
|
|
39
|
+
font-weight: 500;
|
|
40
|
+
text-decoration: none;
|
|
41
|
+
white-space: nowrap;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.attachments .files {
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
flex-wrap: nowrap;
|
|
47
|
+
margin-top: var(--space-1);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.attachments .file-chip {
|
|
51
|
+
display: flex;
|
|
52
|
+
width: 100%;
|
|
53
|
+
box-sizing: border-box;
|
|
54
|
+
min-height: 2.75rem;
|
|
55
|
+
border: 1px solid var(--border);
|
|
56
|
+
border-radius: var(--radius);
|
|
57
|
+
background: var(--surface);
|
|
58
|
+
font-family: inherit;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.attachments .file-chip > svg {
|
|
62
|
+
flex: none;
|
|
63
|
+
color: var(--accent);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.attachments .file-name {
|
|
67
|
+
flex: 1;
|
|
68
|
+
min-width: 0;
|
|
69
|
+
overflow: hidden;
|
|
70
|
+
text-overflow: ellipsis;
|
|
71
|
+
white-space: nowrap;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.attachments .file-size {
|
|
75
|
+
flex: none;
|
|
76
|
+
color: var(--muted);
|
|
77
|
+
font-size: var(--text-xs);
|
|
78
|
+
font-variant-numeric: tabular-nums;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.message[data-mine] .attachments .file-chip {
|
|
82
|
+
background: var(--surface);
|
|
83
|
+
color: var(--text);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.attachments-jump {
|
|
87
|
+
display: inline-flex;
|
|
88
|
+
align-items: center;
|
|
89
|
+
gap: var(--space-1);
|
|
90
|
+
margin: 0 0 var(--space-2);
|
|
91
|
+
font-size: var(--text-sm);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.attachments-jump[hidden] {
|
|
95
|
+
display: none;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.message[data-mine] .attachments-jump {
|
|
99
|
+
color: inherit;
|
|
100
|
+
text-decoration: underline;
|
|
101
|
+
}
|
|
102
|
+
`;function h({file:s}){let i=Nt(()=>Ps(s));return s.type.startsWith("image/")?e("li",{children:e("a",{...i,href:Ht(s),target:"_blank",rel:"noreferrer noopener",children:e("img",{src:Ht(s),alt:s.name,loading:"lazy",decoding:"async",className:"file-image"})})}):e("li",{children:n("a",{...i,className:"file-chip",href:Ht(s),download:s.name,title:s.name,children:[e(o,{name:"file",size:16}),e("span",{className:"file-name",children:s.name}),e("span",{className:"file-size",children:Me(s.size)})]})})}function f(s){Y("attachments",u);let{files:i,message:m}=s;return n("section",{className:"attachments","aria-label":t("Attachments ({count})",{count:i.length}),children:[n("div",{className:"attachments-head",children:[e(o,{name:"attach",size:16}),e("span",{children:t("Attachments ({count})",{count:i.length})}),m&&i.length>=2?n("a",{className:"link-button",href:gs(m),download:!0,children:[e(o,{name:"download",size:16}),t("Download all")]}):null]}),e("ul",{className:"files",children:i.map((c)=>e(h,{file:c},c.id))})]})}var g=0.9;function A({count:s}){Y("attachments",u);let i=a(null),[m,c]=r(!1);return Pe(()=>{let l=i.current?.closest(".bubble");if(!l)return;let d=()=>c(l.getBoundingClientRect().height>window.innerHeight*g);d(),window.addEventListener("resize",d);let p=typeof ResizeObserver==="function"?new ResizeObserver(d):void 0;return p?.observe(l),()=>{window.removeEventListener("resize",d),p?.disconnect()}},[]),n("button",{ref:i,type:"button",className:"link-button attachments-jump",hidden:!m,onClick:(l)=>{l.stopPropagation(),i.current?.closest(".bubble")?.querySelector(".attachments")?.scrollIntoView({behavior:we()?"auto":"smooth",block:"start"})},children:[e(o,{name:"attach",size:14}),B(s,"{count} attachment","{count} attachments")]})}export{A as AttachmentsJump,f as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t,B,O,l,f}from"./chunk-index-s356ybxk.js";import{ln}from"./chunk-index-qq86fxda.js";import"./chunk-index-50w6yq2d.js";import{En,mo}from"./chunk-index-qedt9szy.js";import{Ro}from"./chunk-index-xx0kecz9.js";import{re}from"./chunk-index-6q3dx093.js";import"./chunk-index-6m25qpa7.js";var s=500,c=(n)=>{let r=[];for(let e=0;e<n.length;e+=s)r.push(n.slice(e,e+s));return r},i=()=>O.dispatch({type:"changed"});async function w(n){let r=Ro(n),e=Object.keys(r);if(e.length===0)return;let a=[];try{for(let o of c(e))a.push(...(await En.readAll(o)).moved)}catch(o){f(l(o),"danger"),i();return}ln(Object.fromEntries(e.map((o)=>[o,0]))),f(B(e.length,"Marked {count} room as read","Marked {count} rooms as read"),"info",a.length?{label:t("Undo"),run:()=>void m(a,r)}:void 0)}async function m(n,r){try{for(let e of c(n)){let{restored:a}=await En.unreadAll(e);ln(Object.fromEntries(a.map((o)=>[o,r[o]??0])))}}catch(e){f(l(e),"danger")}i()}var P=(n)=>mo(n);async function d(n){try{await En.restoreHelpers(n)}catch(r){f(l(r),"danger")}i()}async function R(n){let r;try{r=(await En.archiveFinishedHelpers(n)).archived.flatMap((a)=>a.names)}catch(e){f(l(e),"danger"),i();return}if(i(),r.length===0)return;f(B(r.length,"Archived {count} temp knight","Archived {count} temp knights"),"info",{label:t("Undo"),run:()=>void d(r)})}async function T(n,r){try{await re.archiveAgent(n)}catch(e){f(l(e),"danger"),i();return}i(),f(t("Archived {name}",{name:r}),"info",{label:t("Undo"),run:()=>void d([n])})}export{T as archiveHelper,P as clearAllFinished,R as clearFinishedHelpers,w as markAllRead,d as putBackHelpers};
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import{Je,tn,W,Xi,Cn}from"./chunk-index-50syrmaq.js";import{ee,Hr,s,A,R,a,r,t,c,g,e,n,Qi,fe,y,l,f,Re,Tn,he,et}from"./chunk-index-s356ybxk.js";import{D}from"./chunk-index-6cs1wvhy.js";import{C}from"./chunk-index-e8535c4h.js";import{Y}from"./chunk-index-d941ae7c.js";var ue={"hat.none":"No hat","hat.goggcap":"Leather cap","hat.tallcap":"Burgundian felt cap","hat.softcap":"Soft cap","hat.hardhat":"Iron skullcap","hat.fcap":"Hunter's cap","hat.winghelm":"Winged helm","hat.helm":"Helm","hat.mortar":"Biretta","hat.beret":"Chaperon","hat.goggles":"Pointed cap","hat.tricorn":"Pilgrim hat","hat.sailor":"Straw hat","hat.kettle":"Kettle hat","hat.cavalier":"Feathered hat","hat.toque":"Linen cook's cap","hair.none":"No hair","beard.none":"No beard","accessory.none":"No accessory","prop.beads":"Prayer beads","prop.marotte":"Marotte","prop.map":"Chart","prop.flask":"Alchemist's phial","prop.telescope":"Astrolabe","prop.wrench":"Dividers","outfit.surplice":"Surplice","outfit.overalls":"Work jerkin","outfit.armor":"Mail hauberk","outfit.apron":"Smith's apron","outfit.chef":"Cook's tunic","outfit.coat":"Doublet","outfit.vest":"Pourpoint","outfit.sailor":"Mariner's tunic","hair.bob":"Bob","hair.bun":"Bun","hair.ponytail":"Ponytail"},X=(i)=>i.charAt(0).toUpperCase()+i.slice(1);function x(i,d){let h=`character.${i}.${d}`,p=t(h);if(p!==h)return p;if(i==="class")return W.classes[d]?.label??X(d);return ue[`${i}.${d}`]??X(d)}function Z(i){let d=`character.jobs.${i}`,h=t(d);return h!==d?h:W.classes[i]?.jobs??""}var ae=`
|
|
2
|
+
.creator {
|
|
3
|
+
display: grid;
|
|
4
|
+
gap: var(--space-5);
|
|
5
|
+
align-items: start;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
@media (min-width: 720px) {
|
|
9
|
+
.creator {
|
|
10
|
+
grid-template-columns: 13rem minmax(0, 1fr);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.creator-preview {
|
|
14
|
+
position: sticky;
|
|
15
|
+
top: var(--space-4);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.creator-preview {
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
align-items: center;
|
|
23
|
+
gap: var(--space-3);
|
|
24
|
+
padding: var(--space-4);
|
|
25
|
+
border: 1px solid var(--border);
|
|
26
|
+
border-radius: var(--radius-lg);
|
|
27
|
+
background: color-mix(
|
|
28
|
+
in srgb,
|
|
29
|
+
var(--agent-accent, var(--accent)) 8%,
|
|
30
|
+
var(--surface)
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.creator-body {
|
|
35
|
+
display: flex;
|
|
36
|
+
flex-direction: column;
|
|
37
|
+
gap: var(--space-4);
|
|
38
|
+
min-width: 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.creator-field {
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
gap: var(--space-2);
|
|
45
|
+
min-width: 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.creator-field h3 {
|
|
49
|
+
font-size: var(--text-sm);
|
|
50
|
+
color: var(--muted);
|
|
51
|
+
font-weight: var(--weight-medium);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* In the phone's sheet the sheet's own title says what the group is. */
|
|
55
|
+
dialog.sheet dialog.sheet .creator-field > h3 {
|
|
56
|
+
display: none;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.creator-grid {
|
|
60
|
+
display: grid;
|
|
61
|
+
grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr));
|
|
62
|
+
gap: var(--space-2);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.creator-strip {
|
|
66
|
+
display: flex;
|
|
67
|
+
gap: var(--space-2);
|
|
68
|
+
/* Room for the chosen tile's ring, which the scrolling strip would otherwise clip. */
|
|
69
|
+
padding: 3px 3px var(--space-1);
|
|
70
|
+
overflow-x: auto;
|
|
71
|
+
scroll-snap-type: x proximity;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* The row fades toward the side where more of it lies, so a cut-off tile reads as "scroll" and not as the end. */
|
|
75
|
+
.creator-strip[data-more="end"] {
|
|
76
|
+
-webkit-mask-image: linear-gradient(
|
|
77
|
+
to right,
|
|
78
|
+
#000 calc(100% - 2.5rem),
|
|
79
|
+
transparent
|
|
80
|
+
);
|
|
81
|
+
mask-image: linear-gradient(to right, #000 calc(100% - 2.5rem), transparent);
|
|
82
|
+
}
|
|
83
|
+
.creator-strip[data-more="start"] {
|
|
84
|
+
-webkit-mask-image: linear-gradient(
|
|
85
|
+
to left,
|
|
86
|
+
#000 calc(100% - 2.5rem),
|
|
87
|
+
transparent
|
|
88
|
+
);
|
|
89
|
+
mask-image: linear-gradient(to left, #000 calc(100% - 2.5rem), transparent);
|
|
90
|
+
}
|
|
91
|
+
.creator-strip[data-more="both"] {
|
|
92
|
+
-webkit-mask-image: linear-gradient(
|
|
93
|
+
to right,
|
|
94
|
+
transparent,
|
|
95
|
+
#000 2.5rem,
|
|
96
|
+
#000 calc(100% - 2.5rem),
|
|
97
|
+
transparent
|
|
98
|
+
);
|
|
99
|
+
mask-image: linear-gradient(
|
|
100
|
+
to right,
|
|
101
|
+
transparent,
|
|
102
|
+
#000 2.5rem,
|
|
103
|
+
#000 calc(100% - 2.5rem),
|
|
104
|
+
transparent
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.creator-tile {
|
|
109
|
+
display: flex;
|
|
110
|
+
flex: none;
|
|
111
|
+
flex-direction: column;
|
|
112
|
+
align-items: center;
|
|
113
|
+
gap: 2px;
|
|
114
|
+
min-width: 4.25rem;
|
|
115
|
+
padding: var(--space-2) var(--space-1);
|
|
116
|
+
border: 1px solid var(--border);
|
|
117
|
+
border-radius: var(--radius);
|
|
118
|
+
background: var(--surface);
|
|
119
|
+
color: var(--text);
|
|
120
|
+
font-size: var(--text-xs);
|
|
121
|
+
scroll-snap-align: start;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.creator-grid .creator-tile {
|
|
125
|
+
min-width: 0;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.creator-tile span {
|
|
129
|
+
max-width: 100%;
|
|
130
|
+
overflow: hidden;
|
|
131
|
+
text-overflow: ellipsis;
|
|
132
|
+
white-space: nowrap;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.creator-tile:hover:not(:disabled) {
|
|
136
|
+
border-color: var(--control-border);
|
|
137
|
+
background: var(--surface-2);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.creator-tile[aria-pressed="true"],
|
|
141
|
+
.creator-tile[aria-pressed="true"]:hover:not(:disabled),
|
|
142
|
+
.creator-swatch[aria-pressed="true"],
|
|
143
|
+
.creator-swatch[aria-pressed="true"]:hover:not(:disabled) {
|
|
144
|
+
border-color: var(--agent-accent, var(--accent));
|
|
145
|
+
background: color-mix(
|
|
146
|
+
in srgb,
|
|
147
|
+
var(--agent-accent, var(--accent)) 14%,
|
|
148
|
+
var(--surface)
|
|
149
|
+
);
|
|
150
|
+
box-shadow: 0 0 0 2px var(--agent-accent, var(--accent));
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.creator-swatches {
|
|
154
|
+
display: flex;
|
|
155
|
+
flex-wrap: wrap;
|
|
156
|
+
align-items: center;
|
|
157
|
+
gap: var(--space-2);
|
|
158
|
+
margin: 0;
|
|
159
|
+
padding: 0;
|
|
160
|
+
border: 0;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.creator-swatch {
|
|
164
|
+
width: 2.25rem;
|
|
165
|
+
height: 2.25rem;
|
|
166
|
+
min-height: 0;
|
|
167
|
+
padding: 0;
|
|
168
|
+
border: 2px solid var(--surface);
|
|
169
|
+
border-radius: var(--radius-full);
|
|
170
|
+
box-shadow: 0 0 0 1px var(--control-border);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.creator-custom {
|
|
174
|
+
display: flex;
|
|
175
|
+
flex-wrap: wrap;
|
|
176
|
+
gap: var(--space-4);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.creator-custom label {
|
|
180
|
+
display: flex;
|
|
181
|
+
flex-direction: column;
|
|
182
|
+
align-items: flex-start;
|
|
183
|
+
gap: var(--space-1);
|
|
184
|
+
font-size: var(--text-sm);
|
|
185
|
+
color: var(--muted);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.creator-custom input[type="color"],
|
|
189
|
+
.creator-swatches input[type="color"] {
|
|
190
|
+
width: 2.25rem;
|
|
191
|
+
height: 2.25rem;
|
|
192
|
+
padding: 0;
|
|
193
|
+
border: 1px solid var(--control-border);
|
|
194
|
+
border-radius: var(--radius-sm);
|
|
195
|
+
background: transparent;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.field-error {
|
|
199
|
+
margin: 0;
|
|
200
|
+
color: var(--danger);
|
|
201
|
+
font-size: var(--text-sm);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.creator-sections {
|
|
205
|
+
display: flex;
|
|
206
|
+
flex-direction: column;
|
|
207
|
+
gap: var(--space-2);
|
|
208
|
+
margin: 0;
|
|
209
|
+
padding: 0;
|
|
210
|
+
list-style: none;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.creator-section {
|
|
214
|
+
display: flex;
|
|
215
|
+
width: 100%;
|
|
216
|
+
align-items: center;
|
|
217
|
+
justify-content: space-between;
|
|
218
|
+
gap: var(--space-3);
|
|
219
|
+
text-align: left;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.creator-actions {
|
|
223
|
+
flex-wrap: wrap;
|
|
224
|
+
}
|
|
225
|
+
`;var K=[{field:"hat",title:c("Hat"),ids:W.hats},{field:"outfit",title:c("Outfit"),ids:W.outfits},{field:"prop",title:c("Prop"),ids:W.props},{field:"hair",title:c("Hair"),ids:W.hair},{field:"beard",title:c("Beard"),ids:["none",...W.beards]},{field:"accessory",title:c("Accessory"),ids:["none",...W.accessories]}],pe=new Set(["class","colors","palette","build","skin","hairColor",...K.map((i)=>i.field)]),oe=Object.keys(W.palettes),te={idle:c("Idle"),thinking:c("Thinking"),working:c("Working"),waiting:c("Waiting for you"),done:c("Done"),error:c("Error"),sleepy:c("Sleepy")},ge={slim:c("Slim"),regular:c("Regular"),stout:c("Stout")};function M(i){return{class:i.class,outfit:i.outfit,hat:i.hat,prop:i.prop,hair:i.hair,beard:i.beard,accessory:i.accessory,build:i.build,skin:i.skin,hairColor:i.hairColor,colors:{...i.colors}}}var re=(i)=>JSON.stringify(M(i)),k=(i)=>i[Math.floor(Math.random()*i.length)];function be(){return{class:k(Je),outfit:k(W.outfits),hat:k(W.hats),prop:k(W.props),hair:k(W.hair),beard:k(["none",...W.beards]),accessory:k(["none",...W.accessories]),build:k(["slim","regular","stout"]),skin:k([0,1,2,3,4,5]),hairColor:k(W.hairColors),palette:k(oe)}}var ne=ee(function(d){return n("button",{type:"button",className:"creator-tile","aria-pressed":d.pressed,title:d.hint?`${d.label} — ${d.hint}`:d.label,onClick:d.onPick,...d.data,children:[e(he,{spec:d.spec,size:d.size,live:!1}),e("span",{children:d.label})]})});function ve(i,d,h){let p=JSON.stringify({...i,[d]:0});return R(()=>h.map((m)=>({...i,[d]:m})),[p,d,h])}function ye(){let i=a(null),[d,h]=r();return s(()=>{let p=i.current;if(!p)return;let m=()=>{let S=p.scrollLeft>1,P=p.scrollLeft+p.clientWidth<p.scrollWidth-1;h(S&&P?"both":P?"end":S?"start":void 0)};m(),p.addEventListener("scroll",m,{passive:!0});let b=typeof ResizeObserver>"u"?void 0:new ResizeObserver(m);return b?.observe(p),()=>{p.removeEventListener("scroll",m),b?.disconnect()}},[]),[i,d]}function ke(i){let{part:d}=i,h=ve(i.shown,d.field,d.ids),[p,m]=ye();return e("div",{className:"creator-strip",ref:p,"data-more":m,children:d.ids.map((b,S)=>e(ne,{data:{[`data-${d.field}`]:b},spec:h[S],size:44,label:x(d.field,b),pressed:i.draft[d.field]===b,onPick:()=>i.onPick(b)},b))})}function H(i){return e("button",{type:"button",className:"creator-swatch","aria-pressed":i.pressed,"aria-label":i.label,title:i.label,style:{background:i.background},onClick:i.onPick,...i.data})}function N(i){return n("div",{className:"creator-field","data-field":i.field,children:[i.title?e("h3",{children:i.title}):null,i.children,i.error?e("p",{className:"field-error",role:"alert",children:i.error}):null]})}function _e(i){Y("creator",ae);let[d,h]=r(i.character),p=Hr(d),[m,b]=r({}),[S,P]=r(!1),[I,se]=r("idle"),[_,T]=r(),[z,j]=r(),U=Re("(max-width: 719px)"),G=a(null),F=A(),le=et(d),ce=Tn(),L=re(d)!==re(i.character);s(()=>h(i.character),[i.character]),s(()=>{if(!L||i.onPick)return;let o=(v)=>v.preventDefault(),u=(v)=>{if(v.button!==0||v.metaKey||v.ctrlKey||v.shiftKey||v.altKey)return;let E=v.target instanceof Element?v.target.closest("a"):null;if(!E||E.target||E.hasAttribute("download"))return;if(G.current?.contains(E))return;v.preventDefault(),v.stopPropagation(),T({kind:"link",anchor:E})},B=Qi((v)=>T({kind:"navigate",proceed:v}));return window.addEventListener("beforeunload",o),document.addEventListener("click",u,!0),()=>{B(),window.removeEventListener("beforeunload",o),document.removeEventListener("click",u,!0)}},[L,i.onPick]);let w=(o)=>{b({}),h((u)=>Xi(o,u))},de=async()=>{if(i.onPick){i.onPick(M(d),d);return}P(!0),b({});try{let o=await y.setCharacter(i.name,M(d));i.onSaved?.(o),f(t("Saved."))}catch(o){let u=o instanceof fe&&o.field?o.field.split(".")[0]:void 0,B=u&&pe.has(u)?u:"*";b({[B]:l(o)})}finally{P(!1)}},me=async()=>{let o=_;if(h(i.character),b({}),o?.kind==="link")setTimeout(()=>o.anchor.click(),0);else if(o?.kind==="navigate")o.proceed()},J=e(N,{field:"class",title:t("Class"),error:m.class,children:e("div",{className:"creator-grid",children:Je.map((o)=>e(Ce,{id:o,base:p,pressed:d.class===o,onPick:()=>w({class:o,colors:d.colors})},o))})}),V=n(N,{field:"colors",title:t("Colors"),error:m.colors??m.palette,children:[n("fieldset",{className:"creator-swatches",children:[e("legend",{className:"visually-hidden",children:t("Palette")}),oe.map((o)=>{let u=W.palettes[o];return e(H,{data:{"data-palette":o},label:x("palette",o),pressed:d.palette===o,background:`linear-gradient(135deg, ${u.primary} 52%, ${u.trim} 52%)`,onPick:()=>w({palette:o})},o)})]}),e("div",{className:"creator-custom",children:["primary","secondary","trim"].map((o)=>n("label",{children:[e("span",{children:o==="primary"?t("Primary (the accent)"):o==="secondary"?t("Secondary"):t("Trim")}),e("input",{type:"color",value:d.colors[o],onChange:(u)=>w({colors:{[o]:u.target.value}})})]},o))})]}),q=K.map((o)=>e(N,{field:o.field,title:t(o.title),error:m[o.field],children:e(ke,{part:o,draft:d,shown:p,onPick:(u)=>w({[o.field]:u})})},o.field)),Q=n(g,{children:[e(N,{field:"build",title:t("Build"),error:m.build,children:n("fieldset",{className:"segmented",children:[e("legend",{className:"visually-hidden",children:t("Build")}),["slim","regular","stout"].map((o)=>n("label",{"data-checked":d.build===o,children:[e("input",{type:"radio",name:`${F}-build`,checked:d.build===o,onChange:()=>w({build:o})}),ie(o)]},o))]})}),e(N,{field:"skin",title:t("Skin tone"),error:m.skin,children:n("fieldset",{className:"creator-swatches",children:[e("legend",{className:"visually-hidden",children:t("Skin tone")}),(ce??W.skins).map((o,u)=>e(H,{data:{"data-skin":String(u)},label:t("Skin tone {n}",{n:u+1}),pressed:d.skin===u,background:o,onPick:()=>w({skin:u})},u))]})}),e(N,{field:"hairColor",title:t("Hair color"),error:m.hairColor,children:n("fieldset",{className:"creator-swatches",children:[e("legend",{className:"visually-hidden",children:t("Hair color")}),W.hairColors.map((o,u)=>e(H,{data:{"data-hair-color":o},label:t("Hair color {n}",{n:u+1}),pressed:d.hairColor===o,background:o,onPick:()=>w({hairColor:o})},o)),e("input",{type:"color","aria-label":t("Hair color"),value:d.hairColor,onChange:(o)=>w({hairColor:o.target.value})})]})})]}),O=[{id:"class",title:t("Class"),summary:x("class",d.class),error:m.class,node:J},{id:"colors",title:t("Colors"),summary:d.palette?x("palette",d.palette):d.colors.primary,error:m.colors??m.palette,node:V},...K.map((o,u)=>({id:o.field,title:t(o.title),summary:x(o.field,d[o.field]),error:m[o.field],node:q[u]})),{id:"body",title:t("Body"),summary:ie(d.build),error:m.build??m.skin??m.hairColor,node:Q}];return n("form",{ref:G,className:"creator",style:le,"aria-labelledby":F,onSubmit:(o)=>{if(o.preventDefault(),(L||i.onPick)&&!S)de()},children:[e("h2",{id:F,className:"visually-hidden",children:t("Character of {name}",{name:i.displayName})}),n("div",{className:"creator-preview",children:[e(he,{spec:d,name:i.name,state:I,size:176,label:t("{name}, {state}",{name:i.displayName,state:t(te[I])})}),e("button",{type:"button",className:"secondary","data-action":"cycle",onClick:()=>se((o)=>tn[(tn.indexOf(o)+1)%tn.length]??"idle"),children:t("Preview states")}),e("span",{className:"meta","aria-live":"polite",children:t(te[I])})]}),n("div",{className:"creator-body",children:[m["*"]?e("p",{className:"field-error",role:"alert","data-field":"*",children:m["*"]}):null,U?e("ul",{className:"creator-sections",children:O.map((o)=>e("li",{children:n("button",{type:"button",className:"creator-section secondary",onClick:()=>j(o.id),children:[e("strong",{children:o.title}),e("span",{className:"meta",children:o.summary}),o.error?e("span",{className:"field-error",role:"alert",children:o.error}):null]})},o.id))}):n(g,{children:[J,V,q,Q]}),n("div",{className:"actions creator-actions",children:[e("button",{type:"button",className:"secondary","data-action":"suggest",onClick:()=>{b({}),h(Cn({name:i.name,displayName:i.displayName,prompt:i.prompt}))},children:t("Suggest from role")}),e("button",{type:"button",className:"secondary","data-action":"randomize",onClick:()=>w(be()),children:t("Randomize")}),e("button",{type:"button",className:"secondary","data-action":"cancel",onClick:()=>{if(i.onCancel)i.onCancel();else if(L)T({kind:"cancel"})},children:t("Cancel")}),e("button",{type:"submit","data-action":"save",disabled:!L&&!i.onPick||S,children:S?t("Saving…"):i.onPick?t("Use this look"):t("Save")})]})]}),e(C,{open:U&&z!==void 0,title:O.find((o)=>o.id===z)?.title??"",onClose:()=>j(void 0),children:e("div",{className:"stack",children:O.find((o)=>o.id===z)?.node})}),e(D,{open:_!==void 0,title:t("Discard your changes?"),confirmLabel:t("Discard"),cancelLabel:t("Keep editing"),tone:"danger",onClose:()=>T(void 0),onConfirm:me,children:e("p",{children:t("The new look for {name} has not been saved.",{name:i.displayName})})})]})}var ie=(i)=>t(ge[i]);function Ce(i){let d=i.base.colors,h=R(()=>Xi({class:i.id,colors:d}),[i.id,d]);return e(ne,{data:{"data-class":i.id},spec:h,size:56,label:x("class",i.id),hint:Z(i.id),pressed:i.pressed,onPick:i.onPick})}export{_e as CharacterCreator};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{F,ye,Gi,Uo,Zi,mt,be,d,w,Ne,Fe,qt,Ge,Z,le,ce,q,vt,xt,Ze,ve,z,se,Ie,b,Tt,Vo,qo,Bo,Wi,ci,Fo,Go,Zo,Wo,Q,i,I,it,Gt,fi,Lr,Ln,Xn,jo,Ko,Ot}from"./chunk-index-qk7rp7fk.js";import{p}from"./chunk-index-s356ybxk.js";var nn=(e)=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=Ce(e.state,n.from);return r.line?rn(e):r.block?ln(e):!1};function ke(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let o=e(t,n);if(!o)return!1;return r(n.update(o)),!0}}var rn=ke(an,0);var on=ke(je,0);var ln=ke((e,t)=>je(e,t,cn(t)),0);function Ce(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}var N=50;function sn(e,{open:t,close:n},r,o){let l=e.sliceDoc(r-N,r),s=e.sliceDoc(o,o+N),c=/\s*$/.exec(l)[0].length,a=/^\s*/.exec(s)[0].length,h=l.length-c;if(l.slice(h-t.length,h)==t&&s.slice(a,a+n.length)==n)return{open:{pos:r-c,margin:c&&1},close:{pos:o+a,margin:a&&1}};let u,f;if(o-r<=2*N)u=f=e.sliceDoc(r,o);else u=e.sliceDoc(r,r+N),f=e.sliceDoc(o-N,o);let m=/^\s*/.exec(u)[0].length,L=/\s*$/.exec(f)[0].length,v=f.length-L-n.length;if(u.slice(m,m+t.length)==t&&f.slice(v,v+n.length)==n)return{open:{pos:r+m+t.length,margin:/\s/.test(u.charAt(m+t.length))?1:0},close:{pos:o-L-n.length,margin:/\s/.test(f.charAt(v-1))?1:0}};return null}function cn(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),o=n.to<=r.to?r:e.doc.lineAt(n.to);if(o.from>r.from&&o.from==n.to)o=n.to==r.to+1?r:e.doc.lineAt(n.to-1);let l=t.length-1;if(l>=0&&t[l].to>r.from)t[l].to=o.to;else t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:o.to})}return t}function je(e,t,n=t.selection.ranges){let r=n.map((l)=>Ce(t,l.from).block);if(!r.every((l)=>l))return null;let o=n.map((l,s)=>sn(t,r[s],l.from,l.to));if(e!=2&&!o.every((l)=>l))return{changes:t.changes(n.map((l,s)=>{if(o[s])return[];return[{from:l.from,insert:r[s].open+" "},{from:l.to,insert:" "+r[s].close}]}))};else if(e!=1&&o.some((l)=>l)){let l=[];for(let s=0,c;s<o.length;s++)if(c=o[s]){let a=r[s],{open:h,close:u}=c;l.push({from:h.pos-a.open.length,to:h.pos+h.margin},{from:u.pos-u.margin,to:u.pos+a.close.length})}return{changes:l}}return null}function an(e,t,n=t.selection.ranges){let r=[],o=-1;e:for(let{from:l,to:s}of n){let c=r.length,a=1e9,h;for(let u=l;u<=s;){let f=t.doc.lineAt(u);if(h==null){if(h=Ce(t,f.from).line,!h)continue e}if(f.from>o&&(l==s||s>f.from)){o=f.from;let m=/^\s*/.exec(f.text)[0].length,L=m==f.length,v=f.text.slice(m,m+h.length)==h?m:-1;if(m<f.text.length&&m<a)a=m;r.push({line:f,comment:v,token:h,indent:m,empty:L,single:!1})}u=f.to+1}if(a<1e9){for(let u=c;u<r.length;u++)if(r[u].indent<r[u].line.text.length)r[u].indent=a}if(r.length==c+1)r[c].single=!0}if(e!=2&&r.some((l)=>l.comment<0&&(!l.empty||l.single))){let l=[];for(let{line:c,token:a,indent:h,empty:u,single:f}of r)if(f||!u)l.push({from:c.from+h,insert:a+" "});let s=t.changes(l);return{changes:s,selection:t.selection.map(s,1)}}else if(e!=1&&r.some((l)=>l.comment>=0)){let l=[];for(let{line:s,comment:c,token:a}of r)if(c>=0){let h=s.from+c,u=h+a.length;if(s.text[u-s.from]==" ")u++;l.push({from:h,to:u})}return{changes:l}}return null}var ge=Ge.define(),un=Ge.define(),hn=w.define(),Xe=w.define({combine(e){return vt(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,n)=>(r,o)=>t(r,o)||n(r,o)})}}),Ye=Ne.define({create(){return A.empty},update(e,t){let n=t.state.facet(Xe),r=t.annotation(ge);if(r){let a=y.fromTransaction(t,r.selection),h=r.side,u=h==0?e.undone:e.done;if(a)u=K(u,u.length,n.minDepth,a);else u=nt(u,t.startState.selection);return new A(h==0?r.rest:u,h==0?u:r.rest)}let o=t.annotation(un);if(o=="full"||o=="before")e=e.isolate();if(t.annotation(le.addToHistory)===!1)return!t.changes.empty?e.addMapping(t.changes.desc):e;let l=y.fromTransaction(t),s=t.annotation(le.time),c=t.annotation(le.userEvent);if(l)e=e.addChanges(l,s,c,n,t);else if(t.selection)e=e.addSelection(t.startState.selection,s,c,n.newGroupDelay);if(o=="full"||o=="after")e=e.isolate();return e},toJSON(e){return{done:e.done.map((t)=>t.toJSON()),undone:e.undone.map((t)=>t.toJSON())}},fromJSON(e){return new A(e.done.map(y.fromJSON),e.undone.map(y.fromJSON))}});function et(e={}){return[Ye,Xe.of(e),b.domEventHandlers({beforeinput(t,n){let r=t.inputType=="historyUndo"?j:t.inputType=="historyRedo"?V:null;if(!r)return!1;return t.preventDefault(),r(n)}})]}function H(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let o=n.field(Ye,!1);if(!o)return!1;let l=o.pop(e,n,t);if(!l)return!1;return r(l),!0}}var j=H(0,!1),V=H(1,!1),fn=H(0,!0),dn=H(1,!0);class y{constructor(e,t,n,r,o){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=o}setSelAfter(e){return new y(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map((r)=>r.toJSON())}}static fromJSON(e){return new y(e.changes&&be.fromJSON(e.changes),[],e.mapped&&mt.fromJSON(e.mapped),e.startSelection&&d.fromJSON(e.startSelection),e.selectionsAfter.map(d.fromJSON))}static fromTransaction(e,t){let n=S;for(let r of e.startState.facet(hn)){let o=r(e);if(o.length)n=n.concat(o)}if(!n.length&&e.changes.empty)return null;return new y(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,S)}static selection(e){return new y(void 0,S,void 0,void 0,e)}}function K(e,t,n,r){let o=t+1>n+20?t-n-1:0,l=e.slice(o,t);return l.push(r),l}function mn(e,t){let n=[],r=!1;return e.iterChangedRanges((o,l)=>n.push(o,l)),t.iterChangedRanges((o,l,s,c)=>{for(let a=0;a<n.length;){let h=n[a++],u=n[a++];if(c>=h&&s<=u)r=!0}}),r}function pn(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,r)=>n.empty!=t.ranges[r].empty).length===0}function tt(e,t){return!e.length?t:!t.length?e:e.concat(t)}var S=[],gn=200;function nt(e,t){if(!e.length)return[y.selection([t])];else{let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-gn));if(r.length&&r[r.length-1].eq(t))return e;return r.push(t),K(e,e.length-1,1e9,n.setSelAfter(r))}}function yn(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function pe(e,t){if(!e.length)return e;let n=e.length,r=S;while(n){let o=xn(e[n-1],t,r);if(o.changes&&!o.changes.empty||o.effects.length){let l=e.slice(0,n);return l[n-1]=o,l}else t=o.mapped,n--,r=o.selectionsAfter}return r.length?[y.selection(r)]:S}function xn(e,t,n){let r=tt(e.selectionsAfter.length?e.selectionsAfter.map((c)=>c.map(t)):S,n);if(!e.changes)return y.selection(r);let o=e.changes.map(t),l=t.mapDesc(e.changes,!0),s=e.mapped?e.mapped.composeDesc(l):l;return new y(o,Z.mapEffects(e.effects,t),s,e.startSelection.map(l),r)}var Sn=/^(input\.type|delete)($|\.)/;class A{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new A(this.done,this.undone):this}addChanges(e,t,n,r,o){let l=this.done,s=l[l.length-1];if(s&&s.changes&&!s.changes.empty&&e.changes&&(!n||Sn.test(n))&&(!s.selectionsAfter.length&&t-this.prevTime<r.newGroupDelay&&r.joinToEvent(o,mn(s.changes,e.changes))||n=="input.type.compose"))l=K(l,l.length-1,r.minDepth,new y(e.changes.compose(s.changes),tt(Z.mapEffects(e.effects,s.changes),s.effects),s.mapped,s.startSelection,S));else l=K(l,l.length,r.minDepth,e);return new A(l,S,t,n)}addSelection(e,t,n,r){let o=this.done.length?this.done[this.done.length-1].selectionsAfter:S;if(o.length>0&&t-this.prevTime<r&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&pn(o[o.length-1],e))return this;return new A(nt(this.done,e),this.undone,t,n)}addMapping(e){return new A(pe(this.done,e),pe(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let o=r[r.length-1],l=o.selectionsAfter[0]||(o.startSelection?o.startSelection.map(o.changes.invertedDesc,1):t.selection);if(n&&o.selectionsAfter.length)return t.update({selection:o.selectionsAfter[o.selectionsAfter.length-1],annotations:ge.of({side:e,rest:yn(r),selection:l}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});else if(!o.changes)return null;else{let s=r.length==1?S:r.slice(0,r.length-1);if(o.mapped)s=pe(s,o.mapped);return t.update({changes:o.changes,selection:o.startSelection,effects:o.effects,annotations:ge.of({side:e,rest:s,selection:l}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}}}A.empty=new A(S,S);var rt=[{key:"Mod-z",run:j,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:V,preventDefault:!0},{linux:"Ctrl-Shift-z",run:V,preventDefault:!0},{key:"Mod-u",run:fn,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:dn,preventDefault:!0}];function W(e,t){return d.create(e.ranges.map(t),e.mainIndex)}function C(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function M({state:e,dispatch:t},n){let r=W(e.selection,n);if(r.eq(e.selection,!0))return!1;return t(C(e,r)),!0}function X(e,t){return d.cursor(t?e.to:e.from)}function ot(e,t){return M(e,(n)=>n.empty?e.moveByChar(n,t):X(n,t))}function g(e){return e.textDirectionAt(e.state.selection.main.head)==se.LTR}var lt=(e)=>ot(e,!g(e)),st=(e)=>ot(e,g(e));function ct(e,t){return M(e,(n)=>n.empty?e.moveByGroup(n,t):X(n,t))}var kn=(e)=>ct(e,!g(e)),vn=(e)=>ct(e,g(e));var Jr=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function bn(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function Y(e,t,n){let r=I(e).resolveInner(t.head),o=n?Q.closedBy:Q.openedBy;for(let a=t.head;;){let h=n?r.childAfter(a):r.childBefore(a);if(!h)break;if(bn(e,h,o))r=h;else a=n?h.to:h.from}let l=r.type.prop(o),s,c;if(l&&(s=n?Ot(e,r.from,1):Ot(e,r.to,-1))&&s.matched)c=n?s.end.to:s.end.from;else c=n?r.to:r.from;return d.cursor(c,n?-1:1)}var Cn=(e)=>M(e,(t)=>Y(e.state,t,!g(e))),Mn=(e)=>M(e,(t)=>Y(e.state,t,g(e)));function at(e,t){return M(e,(n)=>{if(!n.empty)return X(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}var ut=(e)=>at(e,!1),ht=(e)=>at(e,!0);function ft(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,o;if(t){for(let l of e.state.facet(b.scrollMargins)){let s=l(e);if(s===null||s===void 0?void 0:s.top)n=Math.max(s===null||s===void 0?void 0:s.top,n);if(s===null||s===void 0?void 0:s.bottom)r=Math.max(s===null||s===void 0?void 0:s.bottom,r)}o=e.scrollDOM.clientHeight-n-r}else o=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,o-5)}}function dt(e,t){let n=ft(e),{state:r}=e,o=W(r.selection,(s)=>s.empty?e.moveVertically(s,t,n.height):X(s,t));if(o.eq(r.selection))return!1;let l;if(n.selfScroll){let s=e.coordsAtPos(r.selection.main.head),c=e.scrollDOM.getBoundingClientRect(),a=c.top+n.marginTop,h=c.bottom-n.marginBottom;if(s&&s.top>a&&s.bottom<h)l=b.scrollIntoView(o.main.head,{y:"start",yMargin:s.top-a})}return e.dispatch(C(r,o),{effects:l}),!0}var Ue=(e)=>dt(e,!1),xe=(e)=>dt(e,!0);function B(e,t,n){let r=e.lineBlockAt(t.head),o=e.moveToLineBoundary(t,n);if(o.head==t.head&&o.head!=(n?r.to:r.from))o=e.moveToLineBoundary(t,n,!1);if(!n&&o.head==r.from&&r.length){let l=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;if(l&&t.head!=r.from+l)o=d.cursor(r.from+l)}return o}var An=(e)=>M(e,(t)=>B(e,t,!0)),Bn=(e)=>M(e,(t)=>B(e,t,!1)),Dn=(e)=>M(e,(t)=>B(e,t,!g(e))),En=(e)=>M(e,(t)=>B(e,t,g(e))),Tn=(e)=>M(e,(t)=>e.moveToLineBoundary(t,!1,!1)),wn=(e)=>M(e,(t)=>e.moveToLineBoundary(t,!0,!1));function Wn(e,t,n){let r=!1,o=W(e.selection,(l)=>{let s=Ot(e,l.head,-1)||Ot(e,l.head,1)||l.head>0&&Ot(e,l.head-1,1)||l.head<e.doc.length&&Ot(e,l.head+1,-1);if(!s||!s.end)return l;r=!0;let c=s.start.from==l.head?s.end.to:s.end.from;return n?d.range(l.anchor,c):d.cursor(c)});if(!r)return!1;return t(C(e,o)),!0}var Rn=({state:e,dispatch:t})=>Wn(e,t,!1);function k(e,t,n){let r=W(e.state.selection,(o)=>{if(o.undirectional&&o.head>=o.anchor!=t)o=d.range(o.head,o.anchor);let l=n(o);return d.range(o.anchor,l.head,l.goalColumn,l.bidiLevel||void 0,l.assoc)});if(r.eq(e.state.selection))return!1;return e.dispatch(C(e.state,r)),!0}function pt(e,t){return k(e,t,(n)=>e.moveByChar(n,t))}var gt=(e)=>pt(e,!g(e)),yt=(e)=>pt(e,g(e));function St(e,t){return k(e,t,(n)=>e.moveByGroup(n,t))}var On=(e)=>St(e,!g(e)),Fn=(e)=>St(e,g(e));var In=(e)=>{let t=!g(e);return k(e,t,(n)=>Y(e.state,n,t))},Pn=(e)=>{let t=g(e);return k(e,t,(n)=>Y(e.state,n,t))};function kt(e,t){return k(e,t,(n)=>e.moveVertically(n,t))}var bt=(e)=>kt(e,!1),Ct=(e)=>kt(e,!0);function Mt(e,t){return k(e,t,(n)=>e.moveVertically(n,t,ft(e).height))}var ze=(e)=>Mt(e,!1),_e=(e)=>Mt(e,!0),Nn=(e)=>k(e,!0,(t)=>B(e,t,!0)),qn=(e)=>k(e,!1,(t)=>B(e,t,!1)),Vn=(e)=>{let t=!g(e);return k(e,t,(n)=>B(e,n,t))},Gn=(e)=>{let t=g(e);return k(e,t,(n)=>B(e,n,t))},Un=(e)=>k(e,!1,(t)=>d.cursor(e.lineBlockAt(t.head).from)),zn=(e)=>k(e,!0,(t)=>d.cursor(e.lineBlockAt(t.head).to)),Je=({state:e,dispatch:t})=>(t(C(e,{anchor:0})),!0),$e=({state:e,dispatch:t})=>(t(C(e,{anchor:e.doc.length})),!0),Ke=({state:e,dispatch:t})=>(t(C(e,{anchor:e.selection.main.anchor,head:0})),!0),He=({state:e,dispatch:t})=>(t(C(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),_n=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),Jn=({state:e,dispatch:t})=>{let n=ee(e).map(({from:r,to:o})=>d.undirectionalRange(r,Math.min(o+1,e.doc.length)));return t(e.update({selection:d.create(n),userEvent:"select"})),!0},$n=({state:e,dispatch:t})=>{let n=W(e.selection,(r)=>{let o=I(e),l=o.resolveStack(r.from,1);if(r.empty){let s=o.resolveStack(r.from,-1);if(s.node.from>=l.node.from&&s.node.to<=l.node.to)l=s}for(let s=l;s;s=s.next){let{node:c}=s;if((c.from<r.from&&c.to>=r.to||c.to>r.to&&c.from<=r.from)&&s.next)return d.undirectionalRange(c.from,c.to)}return r});if(n.eq(e.selection))return!1;return t(C(e,n)),!0};function At(e,t){let{state:n}=e,r=n.selection,o=n.selection.ranges.slice();for(let l of n.selection.ranges){let s=n.doc.lineAt(l.head);if(t?s.to<e.state.doc.length:s.from>0)for(let c=l;;){let a=e.moveVertically(c,t);if(a.head<s.from||a.head>s.to){if(!o.some((h)=>h.head==a.head))o.push(a);break}else if(a.head==c.head)break;else c=a}}if(o.length==r.ranges.length)return!1;return e.dispatch(C(n,d.create(o,o.length-1))),!0}var Kn=(e)=>At(e,!1),Hn=(e)=>At(e,!0),Qn=({state:e,dispatch:t})=>{let n=e.selection,r=null;if(n.ranges.length>1)r=d.create([n.main]);else if(!n.main.empty)r=d.create([d.cursor(n.main.head)]);if(!r)return!1;return t(C(e,r)),!0};function G(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,o=r.changeByRange((l)=>{let{from:s,to:c}=l;if(s==c){let a=t(l);if(a<s)n="delete.backward",a=J(e,a,!1);else if(a>s)n="delete.forward",a=J(e,a,!0);s=Math.min(s,a),c=Math.max(c,a)}else s=J(e,s,!1),c=J(e,c,!0);return s==c?{range:l}:{changes:{from:s,to:c},range:d.cursor(s,s<l.head?-1:1)}});if(o.changes.empty)return!1;return e.dispatch(r.update(o,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?b.announce.of(r.phrase("Selection deleted")):void 0})),!0}function J(e,t,n){if(e instanceof b)for(let r of e.state.facet(b.atomicRanges).map((o)=>o(e)))r.between(t,t,(o,l)=>{if(o<t&&l>t)t=n?l:o});return t}var Lt=(e,t,n)=>G(e,(r)=>{let o=r.from,{state:l}=e,s=l.doc.lineAt(o),c,a;if(n&&!t&&o>s.from&&o<s.from+200&&!/[^ \t]/.test(c=s.text.slice(0,o-s.from))){if(c[c.length-1]=="\t")return o-1;let h=Ze(c,l.tabSize),u=h%Gt(l)||Gt(l);for(let f=0;f<u&&c[c.length-1-f]==" ";f++)o--;a=o}else if(a=ye(s.text,o-s.from,t,t)+s.from,a==o&&s.number!=(t?l.doc.lines:1))a+=t?1:-1;else if(!t&&/[\ufe00-\ufe0f]/.test(s.text.slice(a-s.from,o-s.from)))a=ye(s.text,a-s.from,!1,!1)+s.from;return a}),Se=(e)=>Lt(e,!1,!0);var Bt=(e)=>Lt(e,!0,!1),Dt=(e,t)=>G(e,(n)=>{let r=n.head,{state:o}=e,l=o.doc.lineAt(r),s=o.charCategorizer(r);for(let c=null;;){if(r==(t?l.to:l.from)){if(r==n.head&&l.number!=(t?o.doc.lines:1))r+=t?1:-1;break}let a=ye(l.text,r-l.from,t)+l.from,h=l.text.slice(Math.min(r,a)-l.from,Math.max(r,a)-l.from),u=s(h);if(c!=null&&u!=c)break;if(h!=" "||r!=n.head)c=u;r=a}return r}),Et=(e)=>Dt(e,!1),jn=(e)=>Dt(e,!0);var Yn=(e)=>G(e,(t)=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)});var Zn=(e)=>G(e,(t)=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),er=(e)=>G(e,(t)=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)});var tr=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((r)=>({changes:{from:r.from,to:r.to,insert:F.of(["",""])},range:d.cursor(r.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},nr=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((r)=>{if(!r.empty||r.from==0||r.from==e.doc.length)return{range:r};let o=r.from,l=e.doc.lineAt(o),s=o==l.from?o-1:ye(l.text,o-l.from,!1)+l.from,c=o==l.to?o+1:ye(l.text,o-l.from,!0)+l.from;return{changes:{from:s,to:c,insert:e.doc.slice(o,c).append(e.doc.slice(s,o))},range:d.cursor(c)}});if(n.changes.empty)return!1;return t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0};function ee(e){let t=[],n=-1;for(let r of e.selection.ranges){let o=e.doc.lineAt(r.from),l=e.doc.lineAt(r.to);if(!r.empty&&r.to==l.from)l=e.doc.lineAt(r.to-1);if(n>=o.number){let s=t[t.length-1];s.to=l.to,s.ranges.push(r)}else t.push({from:o.from,to:l.to,ranges:[r]});n=l.number+1}return t}function wt(e,t,n){if(e.readOnly)return!1;let r=[],o=[];for(let l of ee(e)){if(n?l.to==e.doc.length:l.from==0)continue;let s=e.doc.lineAt(n?l.to+1:l.from-1),c=s.length+1;if(n){r.push({from:l.to,to:s.to},{from:l.from,insert:s.text+e.lineBreak});for(let a of l.ranges)o.push(d.range(Math.min(e.doc.length,a.anchor+c),Math.min(e.doc.length,a.head+c)))}else{r.push({from:s.from,to:l.from},{from:l.to,insert:e.lineBreak+s.text});for(let a of l.ranges)o.push(d.range(a.anchor-c,a.head-c))}}if(!r.length)return!1;return t(e.update({changes:r,scrollIntoView:!0,selection:d.create(o,e.selection.mainIndex),userEvent:"move.line"})),!0}var rr=({state:e,dispatch:t})=>wt(e,t,!1),or=({state:e,dispatch:t})=>wt(e,t,!0);function Wt(e,t,n){if(e.readOnly)return!1;let r=[];for(let l of ee(e))if(n)r.push({from:l.from,insert:e.doc.slice(l.from,l.to)+e.lineBreak});else r.push({from:l.to,insert:e.lineBreak+e.doc.slice(l.from,l.to)});let o=e.changes(r);return t(e.update({changes:o,selection:e.selection.map(o,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}var lr=({state:e,dispatch:t})=>Wt(e,t,!1),ir=({state:e,dispatch:t})=>Wt(e,t,!0),sr=(e)=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(ee(t).map(({from:o,to:l})=>{if(o>0)o--;else if(l<t.doc.length)l++;return{from:o,to:l}})),r=W(t.selection,(o)=>{let l=void 0;if(e.lineWrapping){let s=e.lineBlockAt(o.head),c=e.coordsAtPos(o.head,o.assoc||1);if(c)l=s.bottom+e.documentTop-c.bottom+e.defaultLineHeight/2}return e.moveVertically(o,!0,l)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function cr(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=I(e).resolveInner(t),r=n.childBefore(t),o=n.childAfter(t),l;if(r&&o&&r.to<=t&&o.from>=t&&(l=r.type.prop(Q.closedBy))&&l.indexOf(o.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(o.from).from&&!/\S/.test(e.sliceDoc(r.to,o.from)))return{from:r.to,to:o.from};return null}var Qe=Rt(!1),ar=Rt(!0);function Rt(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange((o)=>{let{from:l,to:s}=o,c=t.doc.lineAt(l),a=!e&&l==s&&cr(t,l);if(e)l=s=(s<=c.to?c:t.doc.lineAt(s)).to;let h=new Ln(t,{simulateBreak:l,simulateDoubleBreak:!!a}),u=Lr(h,l);if(u==null)u=Ze(/^\s*/.exec(t.doc.lineAt(l).text)[0],t.tabSize);while(s<c.to&&/\s/.test(c.text[s-c.from]))s++;if(a)({from:l,to:s}=a);else if(l>c.from&&l<c.from+100&&!/\S/.test(c.text.slice(0,l)))l=c.from;let f=["",fi(t,u)];if(a)f.push(fi(t,h.lineIndent(c.from,-1)));return{changes:{from:l,to:s,insert:F.of(f)},range:d.cursor(l+1+f[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function Me(e,t){let n=-1;return e.changeByRange((r)=>{let o=[];for(let s=r.from;s<=r.to;){let c=e.doc.lineAt(s);if(c.number>n&&(r.empty||r.to>c.from))t(c,o,r),n=c.number;s=c.to+1}let l=e.changes(o);return{changes:o,range:d.range(l.mapPos(r.anchor,1),l.mapPos(r.head,1))}})}var ur=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new Ln(e,{overrideIndentation:(l)=>{let s=n[l];return s==null?-1:s}}),o=Me(e,(l,s,c)=>{let a=Lr(r,l.from);if(a==null)return;if(!/\S/.test(l.text))a=0;let h=/^\s*/.exec(l.text)[0],u=fi(e,a);if(h!=u||c.from<l.from+h.length)n[l.from]=a,s.push({from:l.from,to:l.from+h.length,insert:u})});if(!o.changes.empty)t(e.update(o,{userEvent:"indent"}));return!0},te=({state:e,dispatch:t})=>{if(e.readOnly)return!1;return t(e.update(Me(e,(n,r)=>{r.push({from:n.from,insert:e.facet(it)})}),{userEvent:"input.indent"})),!0},Ft=({state:e,dispatch:t})=>{if(e.readOnly)return!1;return t(e.update(Me(e,(n,r)=>{let o=/^\s*/.exec(n.text)[0];if(!o)return;let l=Ze(o,e.tabSize),s=0,c=fi(e,Math.max(0,l-Gt(e)));while(s<o.length&&s<c.length&&o.charCodeAt(s)==c.charCodeAt(s))s++;r.push({from:n.from+s,to:n.from+o.length,insert:c.slice(s)})}),{userEvent:"delete.dedent"})),!0},hr=(e)=>(e.setTabFocusMode(),!0);var fr=[{key:"Ctrl-b",run:lt,shift:gt,preventDefault:!0},{key:"Ctrl-f",run:st,shift:yt},{key:"Ctrl-p",run:ut,shift:bt},{key:"Ctrl-n",run:ht,shift:Ct},{key:"Ctrl-a",run:Tn,shift:Un},{key:"Ctrl-e",run:wn,shift:zn},{key:"Ctrl-d",run:Bt},{key:"Ctrl-h",run:Se},{key:"Ctrl-k",run:Yn},{key:"Ctrl-Alt-h",run:Et},{key:"Ctrl-o",run:tr},{key:"Ctrl-t",run:nr},{key:"Ctrl-v",run:xe}],dr=[{key:"ArrowLeft",run:lt,shift:gt,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:kn,shift:On,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Dn,shift:Vn,preventDefault:!0},{key:"ArrowRight",run:st,shift:yt,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:vn,shift:Fn,preventDefault:!0},{mac:"Cmd-ArrowRight",run:En,shift:Gn,preventDefault:!0},{key:"ArrowUp",run:ut,shift:bt,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Je,shift:Ke},{mac:"Ctrl-ArrowUp",run:Ue,shift:ze},{key:"ArrowDown",run:ht,shift:Ct,preventDefault:!0},{mac:"Cmd-ArrowDown",run:$e,shift:He},{mac:"Ctrl-ArrowDown",run:xe,shift:_e},{key:"PageUp",run:Ue,shift:ze},{key:"PageDown",run:xe,shift:_e},{key:"Home",run:Bn,shift:qn,preventDefault:!0},{key:"Mod-Home",run:Je,shift:Ke},{key:"End",run:An,shift:Nn,preventDefault:!0},{key:"Mod-End",run:$e,shift:He},{key:"Enter",run:Qe,shift:Qe},{key:"Mod-a",run:_n},{key:"Backspace",run:Se,shift:Se,preventDefault:!0},{key:"Delete",run:Bt,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Et,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:jn,preventDefault:!0},{mac:"Mod-Backspace",run:Zn,preventDefault:!0},{mac:"Mod-Delete",run:er,preventDefault:!0}].concat(fr.map((e)=>({mac:e.key,run:e.run,shift:e.shift}))),It=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Cn,shift:In},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Mn,shift:Pn},{key:"Alt-ArrowUp",run:rr},{key:"Shift-Alt-ArrowUp",run:lr},{key:"Alt-ArrowDown",run:or},{key:"Shift-Alt-ArrowDown",run:ir},{key:"Mod-Alt-ArrowUp",run:Kn},{key:"Mod-Alt-ArrowDown",run:Hn},{key:"Escape",run:Qn},{key:"Mod-Enter",run:ar},{key:"Alt-l",mac:"Ctrl-l",run:Jn},{key:"Mod-i",run:$n,preventDefault:!0},{key:"Mod-[",run:Ft},{key:"Mod-]",run:te},{key:"Mod-Alt-\\",run:ur},{key:"Shift-Mod-k",run:sr},{key:"Shift-Mod-\\",run:Rn},{key:"Mod-/",run:nn},{key:"Alt-A",mac:"Ctrl-A",run:on},{key:"Ctrl-m",mac:"Shift-Alt-m",run:hr}].concat(dr),Pt={key:"Tab",run:te,shift:Ft};var Nt=typeof String.prototype.normalize=="function"?(e)=>e.normalize("NFKD"):(e)=>e;class E{constructor(e,t,n=0,r=e.length,o,l){this.test=l,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=o?(s)=>o(Nt(s)):Nt,this.query=this.normalize(t)}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 Gi(this.buffer,this.bufferPos)}next(){while(this.matches.length)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=Uo(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=Zi(e);let r=this.normalize(t);if(r.length)for(let o=0,l=n,s=!0;;o++){let c=r.charCodeAt(o),a=this.match(c,l,s,this.bufferPos+this.bufferStart,o==r.length-1);if(a)return this.value=a,this;if(o==r.length-1)break;if(s&&o<t.length&&t.charCodeAt(o)==c)l++;else s=!1}}}match(e,t,n,r,o){let l=null;for(let s=0;s<this.matches.length;){let c=this.matches[s],a=!1;if(this.query.charCodeAt(c.index)==e)if(c.index==this.query.length-1)l={from:c.from,to:r,precise:o&&c.precise};else c.index++,a=!0;if(a)s++;else this.matches.splice(s,1)}if(this.query.charCodeAt(0)==e)if(this.query.length==1)l={from:t,to:r,precise:n&&o};else this.matches.push({from:t,index:1,precise:n});if(l&&this.test&&!this.test(l.from,l.to,this.buffer,this.bufferStart))l=null;return l}}if(typeof Symbol<"u")E.prototype[Symbol.iterator]=function(){return this};var zt={from:-1,to:-1,match:/.*/.exec(""),precise:!0},De="gm"+(/x/.unicode==null?"":"u");class Ee{constructor(e,t,n,r=0,o=e.length){if(this.text=e,this.to=o,this.curLine="",this.done=!1,this.value=zt,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new Te(e,t,n,r,o);this.re=new RegExp(t,De+((n===null||n===void 0?void 0:n.ignoreCase)?"i":"")),this.test=n===null||n===void 0?void 0:n.test,this.iter=e.iter();let l=e.lineAt(r);this.curLineStart=l.from,this.matchPos=ie(e,r),this.getLine(this.curLineStart)}getLine(e){if(this.iter.next(e),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 e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=ie(this.text,r+(n==r?1:0)),n==this.curLineStart+this.curLine.length)this.nextLine();if((n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}var Ae=new WeakMap;class P{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,n){let r=Ae.get(e);if(!r||r.from>=n||r.to<=t){let s=new P(t,e.sliceString(t,n));return Ae.set(e,s),s}if(r.from==t&&r.to==n)return r;let{text:o,from:l}=r;if(l>t)o=e.sliceString(t,l)+o,l=t;if(r.to<n)o+=e.sliceString(r.to,n);return Ae.set(e,new P(l,o)),new P(t,o.slice(t-l,n-l))}}class Te{constructor(e,t,n,r,o){this.text=e,this.to=o,this.done=!1,this.value=zt,this.matchPos=ie(e,r),this.re=new RegExp(t,De+((n===null||n===void 0?void 0:n.ignoreCase)?"i":"")),this.test=n===null||n===void 0?void 0:n.test,this.flat=P.get(e,r,this.chunkEnd(r+5000))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e)this.re.lastIndex=e+1,t=this.re.exec(this.flat.text);if(t){let n=this.flat.from+t.index,r=n+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this.matchPos=ie(this.text,r+(n==r?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=P.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}if(typeof Symbol<"u")Ee.prototype[Symbol.iterator]=Te.prototype[Symbol.iterator]=function(){return this};function mr(e){try{return new RegExp(e,De),!0}catch(t){return!1}}function ie(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;while(t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344)t++;return t}var pr=(e)=>{let t=Go(e,"cm-goto-line");if(t){let s=t.dom.querySelector("input[type=text]");if(s)s.select();return!0}let{state:n}=e,r=String(n.doc.lineAt(e.state.selection.main.head).number),{close:o,result:l}=Fo(e,{class:"cm-goto-line",label:n.phrase("Go to line"),input:{type:"text",name:"line",value:r},focus:!0,submitLabel:n.phrase("go")});return l.then((s)=>{let c=s&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(s.elements.line.value);if(!c){e.dispatch({effects:o});return}let a=n.doc.lineAt(n.selection.main.head),[,h,u,f,m]=c,L=f?+f.slice(1):0,v=u?+u:a.number;if(u&&m){let me=v/100;if(h)me=me*(h=="-"?-1:1)+a.number/n.doc.lines;v=Math.round(n.doc.lines*me)}else if(u&&h)v=v*(h=="-"?-1:1)+a.number;let qe=n.doc.line(Math.max(1,Math.min(n.doc.lines,v))),Ve=d.cursor(qe.from+Math.max(0,Math.min(L,qe.length)));e.dispatch({effects:[o,b.scrollIntoView(Ve.from,{y:"center"})],selection:Ve})}),!0},gr={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},_t=w.define({combine(e){return vt(e,gr,{highlightWordAroundCursor:(t,n)=>t||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function Jt(e){let t=[vr,kr];if(e)t.push(_t.of(e));return t}var yr=z.mark({class:"cm-selectionMatch"}),xr=z.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Vt(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=ce.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=ce.Word)}function Sr(e,t,n,r){return e(t.sliceDoc(n,n+1))==ce.Word&&e(t.sliceDoc(r-1,r))==ce.Word}var kr=Ie.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){if(e.selectionSet||e.docChanged||e.viewportChanged)this.decorations=this.getDeco(e.view)}getDeco(e){let t=e.state.facet(_t),{state:n}=e,r=n.selection;if(r.ranges.length>1)return z.none;let o=r.main,l,s=null;if(o.empty){if(!t.highlightWordAroundCursor)return z.none;let a=n.wordAt(o.head);if(!a)return z.none;s=n.charCategorizer(o.head),l=n.sliceDoc(a.from,a.to)}else{let a=o.to-o.from;if(a<t.minSelectionLength||a>200)return z.none;if(t.wholeWords){if(l=n.sliceDoc(o.from,o.to),s=n.charCategorizer(o.head),!(Vt(s,n,o.from,o.to)&&Sr(s,n,o.from,o.to)))return z.none}else if(l=n.sliceDoc(o.from,o.to),!l)return z.none}let c=[];for(let a of e.visibleRanges){let h=new E(n.doc,l,a.from,a.to);while(!h.next().done){let{from:u,to:f}=h.value;if(!s||Vt(s,n,u,f)){if(o.empty&&u<=o.from&&f>=o.to)c.push(xr.range(u,f));else if(u>=o.to||f<=o.from)c.push(yr.range(u,f));if(c.length>t.maxMatches)return z.none}}}return z.set(c)}},{decorations:(e)=>e.decorations}),vr=b.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),br=({state:e,dispatch:t})=>{let{selection:n}=e,r=d.create(n.ranges.map((o)=>e.wordAt(o.head)||d.cursor(o.head)),n.mainIndex);if(r.eq(n))return!1;return t(e.update({selection:r})),!0};function Cr(e,t){let{main:n,ranges:r}=e.selection,o=e.wordAt(n.head),l=o&&o.from==n.from&&o.to==n.to;for(let s=!1,c=new E(e.doc,t,r[r.length-1].to);;)if(c.next(),c.done){if(s)return null;c=new E(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),s=!0}else{if(s&&r.some((a)=>a.from==c.value.from))continue;if(l){let a=e.wordAt(c.value.from);if(!a||a.from!=c.value.from||a.to!=c.value.to)continue}return c.value}}var Mr=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some((l)=>l.from===l.to))return br({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some((l)=>e.sliceDoc(l.from,l.to)!=r))return!1;let o=Cr(e,r);if(!o)return!1;return t(e.update({selection:e.selection.addRange(d.range(o.from,o.to),!1),effects:b.scrollIntoView(o.to)})),!0},T=w.define({combine(e){return vt(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:(t)=>new Zt(t),scrollToMatch:(t)=>b.scrollIntoView(t)})}});function $t(e){return e?[T.of(e),Be]:Be}class we{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||mr(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,n)=>n=="n"?`
|
|
2
|
+
`:n=="r"?"\r":n=="t"?"\t":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new Ht(this):new Kt(this)}getCursor(e,t=0,n){let r=e.doc?e:q.create({doc:e});if(n==null)n=r.doc.length;return this.regexp?O(this,r,t,n):R(this,r,t,n)}}class We{constructor(e){this.spec=e}}function Ar(e,t,n){return(r,o,l,s)=>{if(n&&!n(r,o,l,s))return!1;let c=r>=s&&o<=s+l.length?l.slice(r-s,o-s):t.doc.sliceString(r,o);return e(c,t,r,o)}}function R(e,t,n,r){let o;if(e.wholeWord)o=Br(t.doc,t.charCategorizer(t.selection.main.head));if(e.test)o=Ar(e.test,t,o);return new E(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:(l)=>l.toLowerCase(),o)}function Br(e,t){return(n,r,o,l)=>{if(l>n||l+o.length<r)l=Math.max(0,n-2),o=e.sliceString(l,Math.min(e.length,r+2));return(t(ae(o,n-l))!=ce.Word||t(ue(o,n-l))!=ce.Word)&&(t(ue(o,r-l))!=ce.Word||t(ae(o,r-l))!=ce.Word)}}class Kt extends We{constructor(e){super(e)}nextMatch(e,t,n){let r=R(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let o=Math.min(e.doc.length,t+this.spec.unquoted.length);r=R(this.spec,e,0,o).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let o=Math.max(t,r-1e4-this.spec.unquoted.length),l=R(this.spec,e,o,r),s=null;while(!l.nextOverlapping().done)s=l.value;if(s)return s;if(o==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);if(!r)r=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length);return r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=R(this.spec,e,0,e.doc.length),r=[];while(!n.next().done){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let o=R(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));while(!o.next().done)r(o.value.from,o.value.to)}}function Dr(e,t,n){return(r,o,l)=>(!n||n(r,o,l))&&e(l[0],t,r,o)}function O(e,t,n,r){let o;if(e.wholeWord)o=Er(t.charCategorizer(t.selection.main.head));if(e.test)o=Dr(e.test,t,o);return new Ee(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:o},n,r)}function ae(e,t){return e.slice(ye(e,t,!1),t)}function ue(e,t){return e.slice(t,ye(e,t))}function Er(e){return(t,n,r)=>!r[0].length||(e(ae(r.input,r.index))!=ce.Word||e(ue(r.input,r.index))!=ce.Word)&&(e(ue(r.input,r.index+r[0].length))!=ce.Word||e(ae(r.input,r.index+r[0].length))!=ce.Word)}class Ht extends We{nextMatch(e,t,n){let r=O(this.spec,e,n,e.doc.length).next();if(r.done)r=O(this.spec,e,0,t).next();return r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let o=Math.max(t,n-r*1e4),l=O(this.spec,e,o,n),s=null;while(!l.next().done)s=l.value;if(s&&(o==t||s.from>o+10))return s;if(o==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n=="&")return e.match[0];if(n=="$")return"$";for(let r=n.length;r>0;r--){let o=+n.slice(0,r);if(o>0&&o<e.match.length)return e.match[o]+n.slice(r)}return t})}matchAll(e,t){let n=O(this.spec,e,0,e.doc.length),r=[];while(!n.next().done){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let o=O(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));while(!o.next().done)r(o.value.from,o.value.to)}}var U=Z.define(),Re=Z.define(),D=Ne.define({create(e){return new oe(Le(e).create(),null)},update(e,t){for(let n of t.effects)if(n.is(U))e=new oe(n.value.create(),e.panel);else if(n.is(Re))e=new oe(e.query,n.value?Oe:null);return e},provide:(e)=>ci.from(e,(t)=>t.panel)});class oe{constructor(e,t){this.query=e,this.panel=t}}var Tr=z.mark({class:"cm-searchMatch"}),wr=z.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Wr=Ie.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(D))}update(e){let t=e.state.field(D);if(t!=e.startState.field(D)||e.docChanged||e.selectionSet||e.viewportChanged)this.decorations=this.highlight(t)}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return z.none;let{view:n}=this,r=new xt;for(let o=0,l=n.visibleRanges,s=l.length;o<s;o++){let{from:c,to:a}=l[o];while(o<s-1&&a>l[o+1].from-500)a=l[++o].to;e.highlight(n.state,c,a,(h,u)=>{let f=n.state.selection.ranges.some((m)=>m.from==h&&m.to==u);r.add(h,u,f?wr:Tr)})}return r.finish()}},{decorations:(e)=>e.decorations});function _(e){return(t)=>{let n=t.state.field(D,!1);return n&&n.query.spec.valid?e(t,n):de(t)}}var he=_((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let o=d.single(r.from,r.to),l=e.state.facet(T);return e.dispatch({selection:o,effects:[Pe(e,r),l.scrollToMatch(o.main,e)],userEvent:"select.search"}),jt(e),!0}),fe=_((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,o=t.prevMatch(n,r,r);if(!o)return!1;let l=d.single(o.from,o.to),s=e.state.facet(T);return e.dispatch({selection:l,effects:[Pe(e,o),s.scrollToMatch(l.main,e)],userEvent:"select.search"}),jt(e),!0}),Rr=_((e,{query:t})=>{let n=t.matchAll(e.state,1000);if(!n||!n.length)return!1;return e.dispatch({selection:d.create(n.map((r)=>d.range(r.from,r.to))),userEvent:"select.search.matches"}),!0}),Or=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:o}=n.main,l=[],s=0;for(let c=new E(e.doc,e.sliceDoc(r,o));!c.next().done;){if(l.length>1000)return!1;if(c.value.from==r)s=l.length;l.push(d.range(c.value.from,c.value.to))}return t(e.update({selection:d.create(l,s),userEvent:"select.search.matches"})),!0},Ut=_((e,{query:t})=>{let{state:n}=e,{from:r,to:o}=n.selection.main;if(n.readOnly)return!1;let l=t.nextMatch(n,r,r);if(!l)return!1;let s=l,c=[],a,h,u=[];if(!s.precise)s=t.nextMatch(n,s.from,s.to);else if(s.from==r&&s.to==o)h=n.toText(t.getReplacement(s)),c.push({from:s.from,to:s.to,insert:h}),s=t.nextMatch(n,s.from,s.to),u.push(b.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+"."));let f=e.state.changes(c);if(s)a=d.single(s.from,s.to).map(f),u.push(Pe(e,s)),u.push(n.facet(T).scrollToMatch(a.main,e));return e.dispatch({changes:f,selection:a,effects:u,userEvent:"input.replace"}),!0}),Fr=_((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let o of t.matchAll(e.state,1e9)){let{from:l,to:s,precise:c}=o;if(c)n.push({from:l,to:s,insert:t.getReplacement(o)})}if(!n.length)return!1;let r=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:b.announce.of(r),userEvent:"input.replace.all"}),!0});function Oe(e){return e.state.facet(T).createPanel(e)}function Le(e,t){var n,r,o,l,s;let c=e.selection.main,a=c.empty||c.to>c.from+100?"":e.sliceDoc(c.from,c.to);if(t&&!a)return t;let h=e.facet(T);return new we({search:((n=t===null||t===void 0?void 0:t.literal)!==null&&n!==void 0?n:h.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:(r=t===null||t===void 0?void 0:t.caseSensitive)!==null&&r!==void 0?r:h.caseSensitive,literal:(o=t===null||t===void 0?void 0:t.literal)!==null&&o!==void 0?o:h.literal,regexp:(l=t===null||t===void 0?void 0:t.regexp)!==null&&l!==void 0?l:h.regexp,wholeWord:(s=t===null||t===void 0?void 0:t.wholeWord)!==null&&s!==void 0?s:h.wholeWord})}function Qt(e){let t=Wi(e,Oe);return t&&t.dom.querySelector("[main-field]")}function jt(e){let t=Qt(e);if(t&&t==e.root.activeElement)t.select()}var de=(e)=>{let t=e.state.field(D,!1);if(t&&t.panel){let n=Qt(e);if(n&&n!=e.root.activeElement){let r=Le(e.state,t.query.spec);if(r.valid)e.dispatch({effects:U.of(r)});n.focus(),n.select()}}else e.dispatch({effects:[Re.of(!0),t?U.of(Le(e.state,t.query.spec)):Z.appendConfig.of(Be)]});return!0},Xt=(e)=>{let t=e.state.field(D,!1);if(!t||!t.panel)return!1;let n=Wi(e,Oe);if(n&&n.dom.contains(e.root.activeElement))e.focus();return e.dispatch({effects:Re.of(!1)}),!0},Yt=[{key:"Mod-f",run:de,scope:"editor search-panel"},{key:"F3",run:he,shift:fe,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:he,shift:fe,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Xt,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Or},{key:"Mod-Alt-g",run:pr},{key:"Mod-d",run:Mr,preventDefault:!0}];class Zt{constructor(e){this.view=e;let t=this.query=e.state.field(D).query.spec;this.commit=this.commit.bind(this),this.searchField=ve("input",{value:t.search,placeholder:x(e,"Find"),"aria-label":x(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=ve("input",{value:t.replace,placeholder:x(e,"Replace"),"aria-label":x(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=ve("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=ve("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=ve("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function n(r,o,l){return ve("button",{class:"cm-button",name:r,onclick:o,type:"button"},l)}this.dom=ve("div",{onkeydown:(r)=>this.keydown(r),class:"cm-search"},[this.searchField,n("next",()=>he(e),[x(e,"next")]),n("prev",()=>fe(e),[x(e,"previous")]),n("select",()=>Rr(e),[x(e,"all")]),ve("label",null,[this.caseField,x(e,"match case")]),ve("label",null,[this.reField,x(e,"regexp")]),ve("label",null,[this.wordField,x(e,"by word")]),...e.state.readOnly?[]:[ve("br"),this.replaceField,n("replace",()=>Ut(e),[x(e,"replace")]),n("replaceAll",()=>Fr(e),[x(e,"replace all")])],ve("button",{name:"close",onclick:()=>Xt(e),"aria-label":x(e,"close"),type:"button"},["×"])])}commit(){let e=new we({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});if(!e.eq(this.query))this.query=e,this.view.dispatch({effects:U.of(e)})}keydown(e){if(Vo(this.view,e,"search-panel"))e.preventDefault();else if(e.keyCode==13&&e.target==this.searchField)e.preventDefault(),(e.shiftKey?fe:he)(this.view);else if(e.keyCode==13&&e.target==this.replaceField)e.preventDefault(),Ut(this.view)}update(e){for(let t of e.transactions)for(let n of t.effects)if(n.is(U)&&!n.value.eq(this.query))this.setQuery(n.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(T).top}}function x(e,t){return e.state.phrase(t)}var ne=30,re=/[\s\.,:;?!]/;function Pe(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),o=e.state.doc.lineAt(n).to,l=Math.max(r.from,t-ne),s=Math.min(o,n+ne),c=e.state.sliceDoc(l,s);if(l!=r.from){for(let a=0;a<ne;a++)if(!re.test(c[a+1])&&re.test(c[a])){c=c.slice(a);break}}if(s!=o){for(let a=c.length-1;a>c.length-ne;a--)if(!re.test(c[a-1])&&re.test(c[a])){c=c.slice(0,a);break}}return b.announce.of(`${e.state.phrase("current match")}. ${c} ${e.state.phrase("on line")} ${r.number}.`)}var Ir=b.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),Be=[D,Fe.low(Wr),Ir];var Pr=b.theme({"&":{color:"var(--code-fg)",backgroundColor:"var(--code-bg)",height:"100%",fontSize:"var(--code-size, 13px)"},"&.cm-focused":{outline:"none"},".cm-scroller":{fontFamily:"var(--font-mono)",lineHeight:"1.55",overflow:"auto"},".cm-content":{caretColor:"var(--code-fg)",padding:"0.5rem 0"},".cm-line":{padding:"0 0.75rem"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"var(--code-fg)"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"var(--code-selection)"},".cm-activeLine":{backgroundColor:"var(--code-active-line)"},".cm-gutters":{backgroundColor:"var(--code-gutter-bg)",color:"var(--code-gutter)",border:"none",borderRight:"1px solid var(--border)"},".cm-activeLineGutter":{backgroundColor:"var(--code-active-line)",color:"var(--code-fg)"},".cm-lineNumbers .cm-gutterElement":{padding:"0 0.5rem 0 0.5rem",minWidth:"2.25rem"},".cm-matchingBracket, .cm-nonmatchingBracket":{backgroundColor:"var(--code-selection)",outline:"1px solid var(--border-strong)"},".cm-searchMatch":{backgroundColor:"var(--warn-soft)",outline:"1px solid var(--warn)"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"var(--accent-soft)",outline:"1px solid var(--accent)"},".cm-panels":{backgroundColor:"var(--surface-2)",color:"var(--text)",borderColor:"var(--border)",fontFamily:"var(--font)"},".cm-panels-top":{borderBottom:"1px solid var(--border)"},".cm-panel.cm-search":{padding:"0.5rem 2rem 0.5rem 0.5rem"},".cm-panel.cm-search input, .cm-panel.cm-search button, .cm-panel.cm-search label":{fontSize:"0.875rem"},".cm-panel.cm-search input[type=text]":{backgroundColor:"var(--surface)",color:"var(--text)",border:"1px solid var(--control-border)",borderRadius:"var(--radius-sm)",padding:"0.25rem 0.5rem"},".cm-panel.cm-search button":{backgroundColor:"var(--surface-3)",color:"var(--text)",border:"1px solid var(--border-strong)",borderRadius:"var(--radius-sm)",backgroundImage:"none",padding:"0.25rem 0.625rem"},".cm-panel.cm-search [name=close]":{color:"var(--muted)"}}),Nr=Xn.define([{tag:[i.keyword,i.modifier,i.operatorKeyword,i.controlKeyword],color:"var(--code-keyword)"},{tag:[i.string,i.regexp,i.special(i.string),i.inserted],color:"var(--code-string)"},{tag:[i.number,i.bool,i.null,i.atom,i.literal],color:"var(--code-number)"},{tag:[i.comment,i.lineComment,i.blockComment,i.docComment],color:"var(--code-comment)",fontStyle:"italic"},{tag:[i.typeName,i.className,i.namespace,i.tagName,i.standard(i.tagName)],color:"var(--code-type)"},{tag:[i.function(i.variableName),i.function(i.propertyName),i.definition(i.variableName),i.labelName],color:"var(--code-function)"},{tag:[i.meta,i.processingInstruction,i.annotation,i.attributeName,i.propertyName,i.heading],color:"var(--code-meta)"},{tag:i.heading,fontWeight:"bold"},{tag:i.strong,fontWeight:"bold"},{tag:i.emphasis,fontStyle:"italic"},{tag:i.strikethrough,textDecoration:"line-through"},{tag:i.link,color:"var(--code-function)",textDecoration:"underline"},{tag:i.url,color:"var(--code-function)"},{tag:i.invalid,color:"var(--danger)"},{tag:i.deleted,color:"var(--danger)"}]),en=[Pr,jo(Nr)];var qr={typescript:()=>(p("r5npc6zf"),import("./chunk-lang-typescript-r5npc6zf.js")),javascript:()=>(p("bk2s6a56"),import("./chunk-lang-javascript-bk2s6a56.js")),json:()=>(p("4pe1fv7e"),import("./chunk-lang-json-4pe1fv7e.js")),markdown:()=>(p("67cm3tjx"),import("./chunk-lang-markdown-67cm3tjx.js")),css:()=>(p("rwkzd784"),import("./chunk-lang-css-rwkzd784.js")),html:()=>(p("zhngbs9v"),import("./chunk-lang-html-zhngbs9v.js")),python:()=>(p("mnfhcvww"),import("./chunk-lang-python-mnfhcvww.js")),yaml:()=>(p("vw22drt8"),import("./chunk-lang-yaml-vw22drt8.js")),go:()=>(p("kbcbn346"),import("./chunk-lang-go-kbcbn346.js")),rust:()=>(p("e4a9s76x"),import("./chunk-lang-rust-e4a9s76x.js")),sql:()=>(p("28364npv"),import("./chunk-lang-sql-28364npv.js")),xml:()=>(p("2hv5xc8n"),import("./chunk-lang-xml-2hv5xc8n.js")),shell:()=>(p("43nea8tq"),import("./chunk-lang-shell-43nea8tq.js")),toml:()=>(p("a83hr7bw"),import("./chunk-lang-toml-a83hr7bw.js")),dockerfile:()=>(p("e87ssppx"),import("./chunk-lang-dockerfile-e87ssppx.js"))};async function tn(e){if(e==="plain")return;try{return(await qr[e]()).language()}catch(t){console.warn("a language for the editor failed to load",t);return}}function Vr(e){if(typeof e.attachShadow!=="function"||typeof CSSStyleSheet>"u"||!("adoptedStyleSheets"in Document.prototype))return{parent:e,root:void 0};let t=e.shadowRoot??e.attachShadow({mode:"open"}),n=new CSSStyleSheet;return n.replaceSync(":host{display:flex;flex-direction:column;min-height:0}.cm-editor{flex:1;min-height:0}"),t.adoptedStyleSheets=[...t.adoptedStyleSheets,n],{parent:t,root:t}}async function ao(e){let t=new qt,n=new qt,r=new qt,o=await tn(e.language),l=(f)=>[q.readOnly.of(!f),b.editable.of(f)],s={editable:e.editable,wrap:e.wrap,language:o??[]},c,a=(f)=>[Zo(),Bo(),Wo(),et(),qo(),Ko(),Jt(),$t({top:!0}),it.of(" "),q.phrases.of(e.phrases),en,Tt.of([{key:"Mod-s",preventDefault:!0,run:()=>(e.onSave(),!0)},{key:"Escape",run:()=>(e.onEscape(),!0)},Pt,...Yt,...rt,...It]),q.lineSeparator.of(f),t.of(l(s.editable)),n.of(s.wrap?b.lineWrapping:[]),r.of(s.language),b.updateListener.of((m)=>{if(m.docChanged)e.onChange()})],h=Vr(e.parent),u=new b({parent:h.parent,root:h.root,state:q.create({doc:e.text,extensions:a(e.eol)})});return c=u.state.doc,{text:()=>u.state.doc.sliceString(0,void 0,u.state.lineBreak),dirty:()=>c===void 0||!u.state.doc.eq(c),snapshot:()=>u.state.doc,markSaved:(f)=>{c=f??u.state.doc},replace:(f,m)=>{let L=u.scrollDOM.scrollTop;u.setState(q.create({doc:f,extensions:a(m)})),c=u.state.doc,u.scrollDOM.scrollTop=L},setEditable:(f)=>{s.editable=f,u.dispatch({effects:t.reconfigure(l(f))})},setWrap:(f)=>{s.wrap=f,u.dispatch({effects:n.reconfigure(f?b.lineWrapping:[])})},setLanguage:async(f)=>{s.language=await tn(f)??[],u.dispatch({effects:r.reconfigure(s.language)})},undo:()=>{j(u)},redo:()=>{V(u)},find:()=>{de(u)},tab:()=>{te(u)},focus:()=>u.focus(),scrollTop:()=>u.scrollDOM.scrollTop,scrollTo:(f)=>{u.scrollDOM.scrollTop=f},destroy:()=>u.destroy()}}export{ao as createEditor};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{D}from"./chunk-index-6cs1wvhy.js";import"./chunk-index-e8535c4h.js";export{D as Confirm};
|