chirkle 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -196
- package/bin/release/darwin-amd64/chirkle-server +2 -2
- package/bin/release/darwin-arm64/chirkle-server +0 -0
- package/bin/release/linux-amd64/chirkle-server +0 -0
- package/bin/release/linux-arm64/chirkle-server +0 -0
- package/package.json +18 -5
- package/pb_hooks/lib/account.js +541 -6
- package/pb_hooks/lib/collections.js +9 -7
- package/pb_hooks/lib/dms.js +1 -1
- package/pb_hooks/lib/handles.js +24 -2
- package/pb_hooks/lib/http.js +2 -2
- package/pb_hooks/lib/inbox.js +7 -6
- package/pb_hooks/lib/invites.js +266 -0
- package/pb_hooks/lib/media.js +2 -2
- package/pb_hooks/lib/messages.js +11 -2
- package/pb_hooks/lib/moderation.js +1 -1
- package/pb_hooks/lib/retention.js +3 -0
- package/pb_hooks/lib/site.js +1 -1
- package/pb_hooks/lib/users.js +70 -11
- package/pb_hooks/main.pb.js +27 -1
- package/pb_hooks/telegram/api.js +64 -12
- package/pb_hooks/telegram/inbound.js +111 -15
- package/pb_hooks/telegram/links.js +12 -1
- package/pb_hooks/telegram/outbound.js +119 -39
- package/pb_hooks/telegram/worker.js +61 -16
- package/pb_migrations/1760000052_deleted_accounts.js +19 -0
- package/pb_migrations/1760000053_account_jobs.js +45 -0
- package/pb_migrations/1760000054_room_invites.js +39 -0
- package/pb_migrations/1760000055_invite_barred.js +16 -0
- package/pb_migrations/1760000056_telegram_fetch.js +21 -0
- package/pb_migrations/1760000057_reactions_seen.js +17 -0
- package/pb_migrations/1760000058_users_kind_public.js +20 -0
- package/pb_public/assets/access-KVSI7EFH.js +2 -0
- package/pb_public/assets/access-KVSI7EFH.js.br +0 -0
- package/pb_public/assets/access-KVSI7EFH.js.gz +0 -0
- package/pb_public/assets/access-KVSI7EFH.js.map +7 -0
- package/pb_public/assets/access-XGNXIUR5.css +2 -0
- package/pb_public/assets/access-XGNXIUR5.css.br +0 -0
- package/pb_public/assets/access-XGNXIUR5.css.gz +0 -0
- package/pb_public/assets/access-XGNXIUR5.css.map +7 -0
- package/pb_public/assets/account-EBCPOLWT.css +2 -0
- package/pb_public/assets/account-EBCPOLWT.css.br +0 -0
- package/pb_public/assets/account-EBCPOLWT.css.gz +0 -0
- package/pb_public/assets/account-EBCPOLWT.css.map +7 -0
- package/pb_public/assets/account-api-J6A6IYVX.js +2 -0
- package/pb_public/assets/account-api-J6A6IYVX.js.br +0 -0
- package/pb_public/assets/account-api-J6A6IYVX.js.gz +0 -0
- package/pb_public/assets/account-api-J6A6IYVX.js.map +7 -0
- package/pb_public/assets/app-5JOOV6JX.js +3 -0
- package/pb_public/assets/app-5JOOV6JX.js.br +0 -0
- package/pb_public/assets/app-5JOOV6JX.js.gz +0 -0
- package/pb_public/assets/app-5JOOV6JX.js.map +7 -0
- package/pb_public/assets/app-7OMYYLCI.css +2 -0
- package/pb_public/assets/app-7OMYYLCI.css.br +0 -0
- package/pb_public/assets/app-7OMYYLCI.css.gz +0 -0
- package/pb_public/assets/app-7OMYYLCI.css.map +7 -0
- package/pb_public/assets/chunk-5PKDEWJS.js +2 -0
- package/pb_public/assets/chunk-5PKDEWJS.js.br +0 -0
- package/pb_public/assets/chunk-5PKDEWJS.js.gz +0 -0
- package/pb_public/assets/chunk-5PKDEWJS.js.map +7 -0
- package/pb_public/assets/chunk-AG73QNUN.js +2 -0
- package/pb_public/assets/chunk-AG73QNUN.js.br +0 -0
- package/pb_public/assets/chunk-AG73QNUN.js.gz +0 -0
- package/pb_public/assets/chunk-AG73QNUN.js.map +7 -0
- package/pb_public/assets/chunk-DCLJRQ53.js +2 -0
- package/pb_public/assets/chunk-DCLJRQ53.js.br +0 -0
- package/pb_public/assets/chunk-DCLJRQ53.js.gz +0 -0
- package/pb_public/assets/chunk-DCLJRQ53.js.map +7 -0
- package/pb_public/assets/chunk-EO3AMXJN.js +2 -0
- package/pb_public/assets/chunk-EO3AMXJN.js.br +0 -0
- package/pb_public/assets/chunk-EO3AMXJN.js.gz +0 -0
- package/pb_public/assets/chunk-EO3AMXJN.js.map +7 -0
- package/pb_public/assets/chunk-LDZPNZ2E.js +2 -0
- package/pb_public/assets/chunk-LDZPNZ2E.js.br +0 -0
- package/pb_public/assets/chunk-LDZPNZ2E.js.gz +0 -0
- package/pb_public/assets/chunk-LDZPNZ2E.js.map +7 -0
- package/pb_public/assets/chunk-RPCBA7VF.js.br +0 -0
- package/pb_public/assets/chunk-RPCBA7VF.js.gz +0 -0
- package/pb_public/assets/chunk-RYZHXNLF.js +2 -0
- package/pb_public/assets/chunk-RYZHXNLF.js.br +0 -0
- package/pb_public/assets/chunk-RYZHXNLF.js.gz +0 -0
- package/pb_public/assets/chunk-RYZHXNLF.js.map +7 -0
- package/pb_public/assets/chunk-UZDXAORM.js +2 -0
- package/pb_public/assets/chunk-UZDXAORM.js.br +0 -0
- package/pb_public/assets/chunk-UZDXAORM.js.gz +0 -0
- package/pb_public/assets/chunk-UZDXAORM.js.map +7 -0
- package/pb_public/assets/chunk-VSHXXDW4.js +2 -0
- package/pb_public/assets/chunk-VSHXXDW4.js.br +0 -0
- package/pb_public/assets/chunk-VSHXXDW4.js.gz +0 -0
- package/pb_public/assets/chunk-VSHXXDW4.js.map +7 -0
- package/pb_public/assets/chunk-VTOUI25E.js.br +0 -0
- package/pb_public/assets/chunk-VTOUI25E.js.gz +0 -0
- package/pb_public/assets/{chunk-DZC4SY4M.js → chunk-Y5MCBN66.js} +2 -2
- package/pb_public/assets/chunk-Y5MCBN66.js.br +0 -0
- package/pb_public/assets/chunk-Y5MCBN66.js.gz +0 -0
- package/pb_public/assets/{chunk-DZC4SY4M.js.map → chunk-Y5MCBN66.js.map} +3 -3
- package/pb_public/assets/collections-FZB6G4W4.css +2 -0
- package/pb_public/assets/collections-FZB6G4W4.css.br +0 -0
- package/pb_public/assets/collections-FZB6G4W4.css.gz +0 -0
- package/pb_public/assets/collections-FZB6G4W4.css.map +7 -0
- package/pb_public/assets/emoji-IHRUMGCY.css +2 -0
- package/pb_public/assets/emoji-IHRUMGCY.css.br +0 -0
- package/pb_public/assets/emoji-IHRUMGCY.css.gz +0 -0
- package/pb_public/assets/emoji-IHRUMGCY.css.map +7 -0
- package/pb_public/assets/{emoji-picker-K6JTK2GV.js → emoji-picker-W27IJER2.js} +2 -2
- package/pb_public/assets/emoji-picker-W27IJER2.js.br +0 -0
- package/pb_public/assets/emoji-picker-W27IJER2.js.gz +0 -0
- package/pb_public/assets/{forward-267HRNPY.js → forward-5TJEYGEV.js} +2 -2
- package/pb_public/assets/forward-5TJEYGEV.js.br +0 -0
- package/pb_public/assets/forward-5TJEYGEV.js.gz +0 -0
- package/pb_public/assets/inbox-2AXY3INA.css +2 -0
- package/pb_public/assets/inbox-2AXY3INA.css.br +0 -0
- package/pb_public/assets/inbox-2AXY3INA.css.gz +0 -0
- package/pb_public/assets/inbox-2AXY3INA.css.map +7 -0
- package/pb_public/assets/{inbox-CLMYESNI.js → inbox-A46J7ZU2.js} +2 -2
- package/pb_public/assets/inbox-A46J7ZU2.js.br +0 -0
- package/pb_public/assets/inbox-A46J7ZU2.js.gz +0 -0
- package/pb_public/assets/{inbox-CLMYESNI.js.map → inbox-A46J7ZU2.js.map} +2 -2
- package/pb_public/assets/invite-6BCBF4KV.js +2 -0
- package/pb_public/assets/invite-6BCBF4KV.js.br +0 -0
- package/pb_public/assets/invite-6BCBF4KV.js.gz +0 -0
- package/pb_public/assets/invite-6BCBF4KV.js.map +7 -0
- package/pb_public/assets/invite-api-7G7XPXQW.js +2 -0
- package/pb_public/assets/invite-api-7G7XPXQW.js.br +0 -0
- package/pb_public/assets/invite-api-7G7XPXQW.js.gz +0 -0
- package/pb_public/assets/lazy-OVEJT5CP.js +2 -0
- package/pb_public/assets/lazy-OVEJT5CP.js.br +0 -0
- package/pb_public/assets/lazy-OVEJT5CP.js.gz +0 -0
- package/pb_public/assets/lazy-OVEJT5CP.js.map +7 -0
- package/pb_public/assets/login-FZY6GOMF.js +2 -0
- package/pb_public/assets/login-FZY6GOMF.js.br +0 -0
- package/pb_public/assets/login-FZY6GOMF.js.gz +0 -0
- package/pb_public/assets/{login-ECFBJP6Q.js.map → login-FZY6GOMF.js.map} +1 -1
- package/pb_public/assets/media-BCKZQR2R.css +2 -0
- package/pb_public/assets/media-BCKZQR2R.css.br +0 -0
- package/pb_public/assets/media-BCKZQR2R.css.gz +0 -0
- package/pb_public/assets/media-BCKZQR2R.css.map +7 -0
- package/pb_public/assets/{media-WZ4653L5.js → media-VCJWBQJZ.js} +2 -2
- package/pb_public/assets/media-VCJWBQJZ.js.br +0 -0
- package/pb_public/assets/media-VCJWBQJZ.js.gz +0 -0
- package/pb_public/assets/{mention-suggest-ODJD2IC5.js → mention-suggest-K3UUHR4D.js} +2 -2
- package/pb_public/assets/mention-suggest-K3UUHR4D.js.br +0 -0
- package/pb_public/assets/mention-suggest-K3UUHR4D.js.gz +0 -0
- package/pb_public/assets/notify-EPDM772N.js.br +0 -0
- package/pb_public/assets/notify-EPDM772N.js.gz +0 -0
- package/pb_public/assets/profile-7KMXLX5U.js +2 -0
- package/pb_public/assets/profile-7KMXLX5U.js.br +0 -0
- package/pb_public/assets/profile-7KMXLX5U.js.gz +0 -0
- package/pb_public/assets/profile-7KMXLX5U.js.map +7 -0
- package/pb_public/assets/rooms-forms-IADHTHBZ.js +2 -0
- package/pb_public/assets/rooms-forms-IADHTHBZ.js.br +0 -0
- package/pb_public/assets/rooms-forms-IADHTHBZ.js.gz +0 -0
- package/pb_public/assets/rooms-forms-IADHTHBZ.js.map +7 -0
- package/pb_public/assets/search-HOPAWIMQ.js +2 -0
- package/pb_public/assets/search-HOPAWIMQ.js.br +0 -0
- package/pb_public/assets/search-HOPAWIMQ.js.gz +0 -0
- package/pb_public/assets/search-HOPAWIMQ.js.map +7 -0
- package/pb_public/assets/sidebar-forms-ETSRVSPY.css +2 -0
- package/pb_public/assets/sidebar-forms-ETSRVSPY.css.br +0 -0
- package/pb_public/assets/sidebar-forms-ETSRVSPY.css.gz +0 -0
- package/pb_public/assets/sidebar-forms-ETSRVSPY.css.map +7 -0
- package/pb_public/assets/stats-5GSWDHZI.css +2 -0
- package/pb_public/assets/stats-5GSWDHZI.css.br +0 -0
- package/pb_public/assets/stats-5GSWDHZI.css.gz +0 -0
- package/pb_public/assets/stats-5GSWDHZI.css.map +7 -0
- package/pb_public/assets/stats-Y3LIXAZR.js +2 -0
- package/pb_public/assets/stats-Y3LIXAZR.js.br +0 -0
- package/pb_public/assets/stats-Y3LIXAZR.js.gz +0 -0
- package/pb_public/assets/stats-Y3LIXAZR.js.map +7 -0
- package/pb_public/assets/switcher-TFSO45KV.js.br +0 -0
- package/pb_public/assets/switcher-TFSO45KV.js.gz +0 -0
- package/pb_public/assets/user-search-GUNMIBSB.js +2 -0
- package/pb_public/assets/user-search-GUNMIBSB.js.br +0 -0
- package/pb_public/assets/user-search-GUNMIBSB.js.gz +0 -0
- package/pb_public/assets/user-search-GUNMIBSB.js.map +7 -0
- package/pb_public/assets/{viewer-2Y5FJBW4.js → viewer-BHKVAADP.js} +2 -2
- package/pb_public/assets/viewer-BHKVAADP.js.br +0 -0
- package/pb_public/assets/viewer-BHKVAADP.js.gz +0 -0
- package/pb_public/assets/viewer-JBZU46HP.css +2 -0
- package/pb_public/assets/viewer-JBZU46HP.css.br +0 -0
- package/pb_public/assets/viewer-JBZU46HP.css.gz +0 -0
- package/pb_public/assets/{viewer-P7GYCBYM.css.map → viewer-JBZU46HP.css.map} +2 -2
- package/pb_public/index.html +11 -8
- package/pb_public/stats.html +3 -3
- package/scripts/service.mjs +201 -0
- package/scripts/start.mjs +9 -2
- package/pb_public/assets/access-LHPD2EHG.js +0 -2
- package/pb_public/assets/access-LHPD2EHG.js.map +0 -7
- package/pb_public/assets/access-PB77EH4F.css +0 -2
- package/pb_public/assets/access-PB77EH4F.css.map +0 -7
- package/pb_public/assets/app-6ETOTHXQ.js +0 -3
- package/pb_public/assets/app-6ETOTHXQ.js.map +0 -7
- package/pb_public/assets/app-ZGHECF33.css +0 -2
- package/pb_public/assets/app-ZGHECF33.css.map +0 -7
- package/pb_public/assets/chunk-56ACD3V5.js +0 -2
- package/pb_public/assets/chunk-56ACD3V5.js.map +0 -7
- package/pb_public/assets/chunk-GXMWOXBX.js +0 -2
- package/pb_public/assets/chunk-GXMWOXBX.js.map +0 -7
- package/pb_public/assets/chunk-IFQGGTSP.js +0 -2
- package/pb_public/assets/chunk-IFQGGTSP.js.map +0 -7
- package/pb_public/assets/chunk-PWNJABVI.js +0 -2
- package/pb_public/assets/chunk-PWNJABVI.js.map +0 -7
- package/pb_public/assets/collections-DHJEOLHW.css +0 -2
- package/pb_public/assets/collections-DHJEOLHW.css.map +0 -7
- package/pb_public/assets/emoji-WWNPWCF3.css +0 -2
- package/pb_public/assets/emoji-WWNPWCF3.css.map +0 -7
- package/pb_public/assets/inbox-3FSOPY2T.css +0 -2
- package/pb_public/assets/inbox-3FSOPY2T.css.map +0 -7
- package/pb_public/assets/lazy-H3KIJVB5.js +0 -2
- package/pb_public/assets/lazy-H3KIJVB5.js.map +0 -7
- package/pb_public/assets/login-ECFBJP6Q.js +0 -2
- package/pb_public/assets/media-7TCBG7WM.css +0 -2
- package/pb_public/assets/media-7TCBG7WM.css.map +0 -7
- package/pb_public/assets/profile-NQQLAEDT.js +0 -2
- package/pb_public/assets/profile-NQQLAEDT.js.map +0 -7
- package/pb_public/assets/search-WCHOGAJQ.js +0 -2
- package/pb_public/assets/search-WCHOGAJQ.js.map +0 -7
- package/pb_public/assets/stats-A2TBRUI6.css +0 -2
- package/pb_public/assets/stats-A2TBRUI6.css.map +0 -7
- package/pb_public/assets/stats-ARDU576A.js +0 -2
- package/pb_public/assets/stats-ARDU576A.js.map +0 -7
- package/pb_public/assets/user-search-3HQOCQWL.js +0 -2
- package/pb_public/assets/viewer-P7GYCBYM.css +0 -2
- /package/pb_public/assets/{emoji-picker-K6JTK2GV.js.map → emoji-picker-W27IJER2.js.map} +0 -0
- /package/pb_public/assets/{forward-267HRNPY.js.map → forward-5TJEYGEV.js.map} +0 -0
- /package/pb_public/assets/{user-search-3HQOCQWL.js.map → invite-api-7G7XPXQW.js.map} +0 -0
- /package/pb_public/assets/{media-WZ4653L5.js.map → media-VCJWBQJZ.js.map} +0 -0
- /package/pb_public/assets/{mention-suggest-ODJD2IC5.js.map → mention-suggest-K3UUHR4D.js.map} +0 -0
- /package/pb_public/assets/{viewer-2Y5FJBW4.js.map → viewer-BHKVAADP.js.map} +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../web/src/views/rooms-forms.ts"],
|
|
4
|
+
"sourcesContent": ["// The sidebar's new-room and new-collection forms (\u00A723.1, \u00A731; the \"sidebar improvements\" board's Room creation and\n// Collection creation): a small card in place under the section's heading, not a dialog. A lazy chunk: views/rooms.ts\n// import()s it on the first \"+\", as it does the people search. It links the stylesheet of the cards (New message's too).\n\nimport { ApiError, errorMessage } from \"../api.ts\";\nimport type { Ctx } from \"../context.ts\";\nimport { type Child, h, uniqueId } from \"../dom.ts\";\nimport { LIMITS, textLength } from \"../lib/limits.ts\";\nimport { nameKey, VISIBILITY } from \"../lib/rooms.ts\";\nimport type { Visibility } from \"../lib/types.ts\";\nimport type { Scope } from \"../scope.ts\";\nimport * as S from \"../strings/rooms-forms.ts\";\nimport { chunkContext, collectionChunk } from \"./collection.ts\";\n\n/** The stylesheet's URL, set by the build (scripts/lib/build-utils.mjs). */\ndeclare const FORMS_CSS: string;\n\nlet sheet: Promise<void> | null = null;\n/** Links the cards' stylesheet; resolves once it is in (or failed: the cards then show unstyled rather than not at all). */\nexport function loadStylesheet(): Promise<void> {\n sheet ??= new Promise((resolve) => {\n const failed = () => {\n link.remove();\n sheet = null;\n resolve();\n };\n const link = h(\"link\", { rel: \"stylesheet\", href: FORMS_CSS, on: { load: () => resolve(), error: failed } });\n document.head.append(link);\n });\n return sheet;\n}\n\nexport type FormKind = \"room\" | \"coll\";\n\n/** A form's parts: shown while open, emptied when closed. */\nexport interface FormParts {\n form: HTMLFormElement;\n input: HTMLInputElement;\n reset: () => void;\n}\n\nconst isNotUnique = (err: unknown) => err instanceof ApiError && err.codes.name === \"validation_not_unique\";\n/** Why a name was refused: the server's word on the field, else what went wrong. */\nconst fieldReason = (err: unknown) => (err instanceof ApiError && err.fields.name) || errorMessage(err);\n\n/** What the forms use of the room list. */\nexport interface FormDeps extends Pick<Ctx, \"api\" | \"store\" | \"actions\" | \"navigate\" | \"collections\"> {\n id: string;\n scope: Scope;\n /** Closes (after a create, Cancel or Escape) the form. */\n toggleForm: (which: FormKind, show: boolean) => void;\n}\n\n/** Builds the form for `which`, once per mount of the room list. */\nexport function createForm(which: FormKind, { id, scope, store, actions, navigate, api, collections, toggleForm }: FormDeps): FormParts {\n /**\n * The inline \"new room\" / \"new collection\" form (sidebar improvements: Room creation, Collection creation): in place\n * under its section's heading, not a dialog. A name field whose leading icon is the chosen type, a tile per type with\n * a line saying what it means, and Cancel / Create. A name already taken (of those listed, compared as the server\n * compares them) is said as you type and keeps Create disabled until it changes.\n */\n function inlineForm<V extends string>(spec: {\n className: string;\n inputLabel: string;\n placeholder: string;\n legend: string;\n /** The radios' name, what the choice is. */\n choice: string;\n choices: { value: V; label: string; icon: string; hint: string }[];\n submitLabel: string;\n tooLong?: (name: string) => string;\n /** Why the name can't be used, when one listed has it. */\n taken: (name: string) => Child[] | null;\n create: (name: string, chosen: V) => Promise<void>;\n errorOf: (e: unknown, name: string) => Child[];\n close: () => void;\n }): FormParts {\n const inputId = uniqueId(`${id}-name`);\n const errId = `${inputId}-error`;\n const err = h(\"p\", { id: errId, class: \"field-error\", role: \"alert\" });\n const input = h(\"input\", {\n id: inputId,\n name: \"name\",\n required: true,\n // No `maxlength`: it counts UTF-16 units (an emoji is 2), the server counts characters. Checked on submit.\n autocomplete: \"off\",\n placeholder: spec.placeholder,\n \"aria-describedby\": errId,\n });\n const lead = h(\"span\", { \"aria-hidden\": \"true\" });\n const submit = h(\"button\", { type: \"submit\", class: \"primary\" }, spec.submitLabel);\n const hint = h(\"p\", { class: \"hint\" });\n const radios = spec.choices.map((c) => h(\"input\", { type: \"radio\", name: spec.choice, value: c.value, class: \"visually-hidden\" }));\n const chosen = () =>\n spec.choices[\n Math.max(\n 0,\n radios.findIndex((r) => r.checked),\n )\n ]!;\n const showChoice = () => {\n const c = chosen();\n hint.textContent = c.hint;\n lead.className = `type-icon ic ${c.icon}`;\n };\n const choose = (v: V) => {\n for (const r of radios) r.checked = r.value === v;\n showChoice();\n };\n const tiles = h(\"fieldset\", { class: `tiles n${spec.choices.length}`, on: { change: showChoice }, signal: scope.signal }, [\n h(\"legend\", { class: \"visually-hidden\" }, spec.legend),\n ...spec.choices.map((c, i) => h(\"label\", { class: `ic ${c.icon}` }, [radios[i]!, c.label])),\n ]);\n let busy = false;\n let blocked = false;\n const sync = () => {\n submit.disabled = busy || blocked;\n submit.setAttribute(\"aria-disabled\", String(submit.disabled));\n };\n const setError = (msg: Child[] | null) => {\n if (!msg) {\n err.replaceChildren();\n input.removeAttribute(\"aria-invalid\");\n return;\n }\n err.replaceChildren(h(\"span\", { class: \"ic i-alert\", \"aria-hidden\": \"true\" }), h(\"span\", {}, msg));\n input.setAttribute(\"aria-invalid\", \"true\");\n };\n /** The name as typed, checked against those listed. */\n const check = () => {\n const why = input.value.trim() ? spec.taken(input.value) : null;\n blocked = !!why;\n setError(why);\n sync();\n return why;\n };\n const form = h(\n \"form\",\n {\n class: `inline-form ${spec.className}`,\n on: {\n input: (e) => {\n if (e.target === input) check();\n },\n keydown: (e) => {\n if (e.key === \"Escape\") spec.close();\n },\n submit: async (e) => {\n e.preventDefault();\n if (busy || check()) return;\n const name = input.value;\n const long = spec.tooLong?.(name.trim());\n if (long) {\n setError([long]);\n return;\n }\n busy = true;\n sync();\n try {\n await spec.create(name, chosen().value);\n } catch (e) {\n if (scope.active) setError(spec.errorOf(e, name.trim()));\n } finally {\n busy = false;\n sync();\n }\n },\n },\n signal: scope.signal,\n },\n [\n h(\"label\", { class: \"name-field\" }, [lead, h(\"span\", { class: \"visually-hidden\" }, spec.inputLabel), input]),\n err,\n tiles,\n hint,\n h(\"div\", { class: \"form-buttons\" }, [\n h(\"button\", { type: \"button\", class: \"cancel\", on: { click: spec.close }, signal: scope.signal }, \"Cancel\"),\n submit,\n ]),\n ],\n );\n const reset = () => {\n input.value = \"\";\n choose(spec.choices[0]!.value);\n blocked = false;\n setError(null);\n sync();\n };\n reset();\n return { form, input, reset };\n }\n\n /** The new-room form (\u00A723.1): public unless chosen otherwise; members of a private room are added from the room. */\n function newRoomForm(): FormParts {\n const icons: Record<Visibility, string> = { public: \"i-hash\", private: \"i-lock\", open: \"i-globe\" };\n const takenMsg = (name: string): Child[] => [h(\"b\", {}, `#${name.replace(/^[#\\s]+/, \"\")}`), \" already exists. Pick another name.\"];\n return inlineForm<Visibility>({\n className: \"new-room\",\n inputLabel: \"Room name\",\n placeholder: \"room-name\",\n legend: \"Who can see it\",\n choice: \"visibility\",\n choices: ([\"public\", \"private\", \"open\"] as const).map((v) => ({ value: v, ...VISIBILITY[v], icon: icons[v] })),\n submitLabel: \"Create room\",\n tooLong: (name) => (textLength(name) > LIMITS.roomName ? `Must be no more than ${LIMITS.roomName} characters.` : \"\"),\n taken: (name) => {\n const key = nameKey(name, true);\n if (!key) return null;\n for (const r of store.get().rooms.values()) if (r.kind !== \"dm\" && nameKey(r.name, true) === key) return takenMsg(r.name);\n return null;\n },\n create: async (name, visibility) => {\n const room = await actions.create(name, visibility);\n if (!scope.active) return;\n toggleForm(\"room\", false);\n navigate(`/r/${room.id}`);\n },\n errorOf: (e, name) => (isNotUnique(e) ? takenMsg(name) : [fieldReason(e)]),\n close: () => toggleForm(\"room\", false),\n });\n }\n\n /** The new-collection form (\u00A731): public unless chosen otherwise (then only you can see it). */\n function newCollForm(): FormParts {\n const takenMsg = (name: string): Child[] => [\"A collection called \", h(\"b\", {}, name), \" already exists.\"];\n return inlineForm<\"public\" | \"private\">({\n className: \"new-coll\",\n inputLabel: \"Collection name\",\n placeholder: \"Collection name\",\n legend: \"Privacy\",\n choice: \"privacy\",\n choices: [\n { value: \"public\", label: \"Public\", icon: \"i-eye\", hint: \"Anyone can see it and subscribe.\" },\n { value: \"private\", label: \"Private\", icon: \"i-lock\", hint: \"Only you can see it.\" },\n ],\n submitLabel: \"Create collection\",\n taken: (name) => {\n const key = nameKey(name);\n const hit = key && store.get().collections?.mine.find((c) => nameKey(c.name) === key);\n return hit ? takenMsg(hit.name) : null;\n },\n create: async (name, privacy) => {\n const c = await collectionChunk().catch(() => {\n throw new ApiError(\"Couldn't open collections. Check your connection.\", 400);\n });\n const cid = await c.createCollection(chunkContext({ api, store, collections }), name, privacy === \"public\");\n if (!scope.active) return;\n toggleForm(\"coll\", false);\n navigate(`/c/${cid}`);\n },\n errorOf: (e, name) => (isNotUnique(e) ? takenMsg(name) : [fieldReason(e)]),\n close: () => toggleForm(\"coll\", false),\n });\n }\n\n return which === \"room\" ? newRoomForm() : newCollForm();\n}\n"],
|
|
5
|
+
"mappings": "uQAiBA,IAAIA,EAA8B,KAE3B,SAASC,IAAgC,CAC9C,OAAAD,IAAU,IAAI,QAASE,GAAY,CAMjC,IAAMC,EAAOC,EAAE,OAAQ,CAAE,IAAK,aAAc,KAAM,qCAAW,GAAI,CAAE,KAAM,IAAMF,EAAQ,EAAG,MAL3E,IAAM,CACnBC,EAAK,OAAO,EACZH,EAAQ,KACRE,EAAQ,CACV,CACwG,CAAE,CAAC,EAC3G,SAAS,KAAK,OAAOC,CAAI,CAC3B,CAAC,EACMH,CACT,CAWA,IAAMK,EAAeC,GAAiBA,aAAeC,GAAYD,EAAI,MAAM,OAAS,wBAE9EE,EAAeF,GAAkBA,aAAeC,GAAYD,EAAI,OAAO,MAASG,EAAaH,CAAG,EAW/F,SAASI,GAAWC,EAAiB,CAAE,GAAAC,EAAI,MAAAC,EAAO,MAAAC,EAAO,QAAAC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,CAC5C,MAAM,IAAIzD,EAAS,oDAAqD,GAAG,CAC7E,CAAC,GACmB,iBAAiB0D,EAAa,CAAE,IAAAhD,EAAK,MAAAH,EAAO,YAAAI,CAAY,CAAC,EAAG6B,EAAMe,IAAY,QAAQ,EACrGjD,EAAM,SACXM,EAAW,OAAQ,EAAK,EACxBH,EAAS,MAAM+C,CAAG,EAAE,EACtB,EACA,QAAS,CAACjB,EAAGC,IAAU1C,EAAYyC,CAAC,EAAIM,EAASL,CAAI,EAAI,CAACvC,EAAYsC,CAAC,CAAC,EACxE,MAAO,IAAM3B,EAAW,OAAQ,EAAK,CACvC,CAAC,CACH,CAEA,OAAOR,IAAU,OAASuC,EAAY,EAAIU,EAAY,CACxD",
|
|
6
|
+
"names": ["sheet", "loadStylesheet", "resolve", "link", "h", "isNotUnique", "err", "ApiError", "fieldReason", "errorMessage", "createForm", "which", "id", "scope", "store", "actions", "navigate", "api", "collections", "toggleForm", "inlineForm", "spec", "inputId", "uniqueId", "errId", "input", "lead", "submit", "hint", "radios", "c", "chosen", "r", "showChoice", "choose", "v", "tiles", "i", "busy", "blocked", "sync", "setError", "msg", "check", "why", "form", "e", "name", "long", "reset", "newRoomForm", "icons", "takenMsg", "VISIBILITY", "textLength", "LIMITS", "key", "nameKey", "visibility", "room", "newCollForm", "hit", "privacy", "cid", "collectionChunk", "chunkContext"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as n}from"./chunk-VTOUI25E.js";var k=(t,a)=>`${t}${a?"+":""} ${t===1?"message":"messages"} found.`;var M=300,R=5,b=40;function L(t){return t.replace(/[----]/g,"").normalize("NFKC").toUpperCase().toLowerCase().replace(/i\u0307/g,"i")}function N(t){return[...new Set(L(t).split(/\s+/).filter(Boolean))].slice(0,R)}function H(t,a,r){let s=a.join(" ");return r?{room:t,kind:"older",args:{created:r.created,id:r.id},q:s}:{room:t,kind:"latest",args:{},q:s}}function U(t,a){let r=t.replace(/\s+/g," ").trim(),s=a.length?new RegExp(a.map(p=>p.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),"giu"):null,h=s?r.search(s):-1,c=h>b?r.lastIndexOf(" ",h-b/2)+1||h-b/2:0,o=(c?"\u2026":"")+r.slice(c);return s?o.split(new RegExp(`(${s.source})`,"giu")):[o]}function $(t){let a=new AbortController,{signal:r}=a;t.signal.addEventListener("abort",()=>a.abort(),{signal:r}),r.addEventListener("abort",()=>{clearTimeout(m),i?.abort()});let s=n("input",{type:"text",role:"searchbox","aria-label":"Search messages",placeholder:`Search ${t.label}`,enterkeyhint:"search",autocomplete:"off",on:{input:()=>v(),keydown:e=>A(e),focus:()=>o.hidden=!o.childElementCount},signal:r}),h=n("button",{type:"button",class:"icon-button ic i-x","aria-label":"Close search",on:{click:()=>E()},signal:r}),c=n("p",{class:"search-status",role:"status"}),o=n("ul",{class:"search-results","aria-label":"Search results",hidden:!0}),p=n("li",{},n("button",{type:"button",class:"link",on:{click:()=>{S(!0)}},signal:r},"Show older results")),y=n("div",{class:"room-search ic i-search",role:"search",on:{keydown:e=>e.key==="Escape"&&E(e)},signal:r},[n("div",{class:"search-bar"},[s,h]),c,o]),m=0,f=[],l=[],i=null;function v(){clearTimeout(m),m=window.setTimeout(()=>{S(!1)},M)}function A(e){e.key!=="Enter"||e.isComposing||e.keyCode===229||(e.preventDefault(),clearTimeout(m),S(!1))}async function S(e){let d=e?f:N(s.value);if(!e&&d.join(" ")===f.join(" ")&&(l.length||i)){o.hidden=!l.length;return}if(i?.abort(),!d.length){f=[],l=[],i=null,c.textContent="",o.replaceChildren(),o.hidden=!0;return}let u=new AbortController;i=u,e||(f=d),c.textContent="Searching\u2026";let C=p.contains(document.activeElement);p.remove();try{let g=await t.page(H(t.room,d,e?l.at(-1):void 0),u.signal);if(u!==i)return;e||(l=[],o.replaceChildren()),l.push(...g);let x=g.map(O);o.append(...x),C&&x[0]?.querySelector("button")?.focus(),g.length>=t.pageSize&&o.append(p),o.hidden=!l.length;let w=l.length;c.textContent=w?k(w,g.length>=t.pageSize):"No messages found."}catch(g){if(u!==i)return;c.textContent=g?.status===429?"Too many attempts. Wait a few seconds and try again.":"Couldn't search. Check your connection.",e&&o.append(p)}finally{u===i&&(i=null)}}function O(e){let d=U(e.text,f).map((u,C)=>C%2?n("mark",{},u):u);return n("li",{},[n("button",{type:"button",class:"search-result",on:{click:()=>_(e.id)},signal:r},[e.expand?.author?t.avatar(e.expand.author):null,n("span",{class:"meta"},[e.expand?.author?n("b",{class:"author"},e.expand.author.name):null,n("time",{},t.when(e))]),n("span",{class:"body"},d)])])}function _(e){o.hidden=!0,t.onPick(e)}function E(e){e?.preventDefault(),a.abort(),y.remove(),t.onClose()}return{el:y,focus:()=>s.focus()}}export{$ as createSearch,L as foldKey,U as highlight,H as searchQuery,N as searchWords};
|
|
2
|
+
//# sourceMappingURL=search-HOPAWIMQ.js.map
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../web/src/strings/room-search.ts", "../../web/src/views/room/search.ts"],
|
|
4
|
+
"sourcesContent": ["// The user-facing text of views/room/search.ts (docs/REFACTOR.md item 56): one module per source file, so a lazy\n// screen's text stays in its own chunk. Copy changes here; a translation would replace these.\n\nexport const SEARCH_MESSAGES = \"Search messages\";\nexport const search = (label: string | number) => `Search ${label}`;\nexport const CLOSE_SEARCH = \"Close search\";\nexport const SEARCH_RESULTS = \"Search results\";\nexport const SHOW_OLDER_RESULTS = \"Show older results\";\nexport const SEARCHING = \"Searching\u2026\";\nexport const NO_MESSAGES_FOUND = \"No messages found.\";\nexport const COULDNT_SEARCH_CHECK_YOUR_CONNECTION = \"Couldn't search. Check your connection.\";\nexport const TOO_MANY_SEARCHES = \"Too many attempts. Wait a few seconds and try again.\";\nexport const found = (n: number, more: boolean) => `${n}${more ? \"+\" : \"\"} ${n === 1 ? \"message\" : \"messages\"} found.`;\n", "// Message search (\u00A729): a bar under the room header that finds the room's (or DM's) messages containing every word\n// typed, newest first, a page at a time. Picking one goes to it in the room, as a reply's quote does (\u00A719). Matched\n// on `text_key`, the text case folded on the server like names are (\u00A722.1): \"\u043F\u0440\u0438\u0432\u0435\u0442\" finds \"\u041F\u0440\u0438\u0432\u0435\u0442\".\n//\n// A lazy chunk, like the viewer (\u00A717.7): the room view import()s it when search is first opened.\n\nimport { h } from \"../../dom.ts\";\nimport type { PageQuery } from \"../../lib/cursor.ts\";\nimport type { Message, User } from \"../../lib/types.ts\";\nimport * as S from \"../../strings/room-search.ts\";\n\nexport interface SearchOptions {\n room: string;\n /** What is searched, for the field's placeholder: \"#general\", \"Bob\". */\n label: string;\n /** A page of results (`api.page`): PAGE_SIZE of them, or fewer when there are no more. */\n page: (q: PageQuery, signal: AbortSignal) => Promise<Message[]>;\n pageSize: number;\n /** When a message was sent, short. */\n when: (m: Message) => string;\n /** The author's face, next to a result. */\n avatar: (u: User) => HTMLElement;\n /** Go to message `id` in the room. */\n onPick: (id: string) => void;\n /** Closed from the bar itself (Close, Escape). */\n onClose: () => void;\n /** Ends it (the room view unmounts). */\n signal: AbortSignal;\n}\n\nexport interface Search {\n readonly el: HTMLElement;\n focus(): void;\n}\n\n/** Wait this long (ms) after the last key before searching. */\nconst DEBOUNCE_MS = 300;\n/** At most this many words count; the rest are ignored. */\nconst MAX_WORDS = 5;\n/** Text shown before the first match in a result, at most (characters). */\nconst LEAD = 40;\n\n/**\n * Same as searchKey() in pb_hooks/lib/text.js: what the server stores in `text_key`. \"\u0130\" lowercases to \"i\" and a\n * combining dot, which \"istanbul\" as typed wouldn't find (QA BUG-113): the dot goes.\n */\nexport function foldKey(s: string): string {\n return s\n .replace(/[\u00AD\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u2069\uFEFF]/g, \"\")\n .normalize(\"NFKC\")\n .toUpperCase()\n .toLowerCase()\n .replace(/i\\u0307/g, \"i\");\n}\n\n/** The words of a search, folded, each once. */\nexport function searchWords(q: string): string[] {\n return [...new Set(foldKey(q).split(/\\s+/).filter(Boolean))].slice(0, MAX_WORDS);\n}\n\n/**\n * The newest messages of `room` with every word in `words`, before `before` when given (newest-first): a page of the\n * room with `q` (server/lists.go matches the words, escaping `%` and `\\` as QA BUG-34 and BUG-112 found).\n */\nexport function searchQuery(room: string, words: readonly string[], before?: { created: string; id: string }): PageQuery {\n const q = words.join(\" \");\n return before ? { room, kind: \"older\", args: { created: before.created, id: before.id }, q } : { room, kind: \"latest\", args: {}, q };\n}\n\n/**\n * `text` as runs of plain and matched (odd indexes) text, starting shortly before the first match. Matched\n * case-insensitively as typed: a match only folding finds (\"strasse\" in \"Stra\u00DFe\") just isn't marked.\n */\nexport function highlight(text: string, words: readonly string[]): string[] {\n const one = text.replace(/\\s+/g, \" \").trim();\n const re = words.length ? new RegExp(words.map((w) => w.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")).join(\"|\"), \"giu\") : null;\n const first = re ? one.search(re) : -1;\n const from = first > LEAD ? one.lastIndexOf(\" \", first - LEAD / 2) + 1 || first - LEAD / 2 : 0;\n const shown = (from ? \"\u2026\" : \"\") + one.slice(from);\n return re ? shown.split(new RegExp(`(${re.source})`, \"giu\")) : [shown];\n}\n\nexport function createSearch(o: SearchOptions): Search {\n const scope = new AbortController();\n const { signal } = scope;\n o.signal.addEventListener(\"abort\", () => scope.abort(), { signal });\n signal.addEventListener(\"abort\", () => {\n clearTimeout(timer);\n fetching?.abort();\n });\n\n const input = h(\"input\", {\n // Not type=search: browsers add a clear \"\u00D7\" of their own next to Close (QA BUG-114).\n type: \"text\",\n role: \"searchbox\",\n \"aria-label\": \"Search messages\",\n placeholder: `Search ${o.label}`,\n enterkeyhint: \"search\",\n autocomplete: \"off\",\n on: { input: () => schedule(), keydown: (e) => keydown(e), focus: () => (results.hidden = !results.childElementCount) },\n signal,\n });\n const close = h(\"button\", {\n type: \"button\",\n class: \"icon-button ic i-x\",\n \"aria-label\": \"Close search\",\n on: { click: () => end() },\n signal,\n });\n const status = h(\"p\", { class: \"search-status\", role: \"status\" });\n const results = h(\"ul\", { class: \"search-results\", \"aria-label\": \"Search results\", hidden: true });\n const more = h(\n \"li\",\n {},\n h(\"button\", { type: \"button\", class: \"link\", on: { click: () => void run(true) }, signal }, \"Show older results\"),\n );\n const el = h(\"div\", { class: \"room-search ic i-search\", role: \"search\", on: { keydown: (e) => e.key === \"Escape\" && end(e) }, signal }, [\n h(\"div\", { class: \"search-bar\" }, [input, close]),\n status,\n results,\n ]);\n\n let timer = 0;\n /** The search shown: its words, how many are found, the last one (where more begin). */\n let words: string[] = [];\n let found: Message[] = [];\n let fetching: AbortController | null = null;\n\n function schedule() {\n clearTimeout(timer);\n timer = window.setTimeout(() => void run(false), DEBOUNCE_MS);\n }\n\n function keydown(e: KeyboardEvent) {\n // Not the Enter confirming an IME word (as composer.ts `composing`, QA BUG-179): what it confirms is searched as typed.\n if (e.key !== \"Enter\" || e.isComposing || e.keyCode === 229) return;\n e.preventDefault();\n clearTimeout(timer);\n void run(false);\n }\n\n /** Search for what is typed, or (`next`) the page after the results shown. */\n async function run(next: boolean) {\n const w = next ? words : searchWords(input.value);\n if (!next && w.join(\" \") === words.join(\" \") && (found.length || fetching)) {\n results.hidden = !found.length;\n return;\n }\n fetching?.abort();\n if (!w.length) {\n words = [];\n found = [];\n fetching = null;\n status.textContent = \"\";\n results.replaceChildren();\n results.hidden = true;\n return;\n }\n const f = new AbortController();\n fetching = f;\n if (!next) words = w;\n status.textContent = \"Searching\u2026\";\n // \"Show older results\" hands focus to the first of them.\n const refocus = more.contains(document.activeElement);\n more.remove();\n try {\n const page = await o.page(searchQuery(o.room, w, next ? found.at(-1) : undefined), f.signal);\n if (f !== fetching) return;\n if (!next) {\n found = [];\n results.replaceChildren();\n }\n found.push(...page);\n const rows = page.map(row);\n results.append(...rows);\n if (refocus) rows[0]?.querySelector(\"button\")?.focus();\n if (page.length >= o.pageSize) results.append(more);\n results.hidden = !found.length;\n const n = found.length;\n status.textContent = n ? S.found(n, page.length >= o.pageSize) : \"No messages found.\";\n } catch (err) {\n if (f !== fetching) return;\n // Too many searches (the server's search limit, QA SEC-4) says so, not \"check your connection\".\n status.textContent = (err as { status?: unknown })?.status === 429 ? \"Too many attempts. Wait a few seconds and try again.\" : \"Couldn't search. Check your connection.\";\n if (next) results.append(more); // to try again\n } finally {\n if (f === fetching) fetching = null;\n }\n }\n\n function row(m: Message): HTMLElement {\n const parts = highlight(m.text, words).map((s, i) => (i % 2 ? h(\"mark\", {}, s) : s));\n return h(\"li\", {}, [\n h(\"button\", { type: \"button\", class: \"search-result\", on: { click: () => pick(m.id) }, signal }, [\n m.expand?.author ? o.avatar(m.expand.author) : null,\n h(\"span\", { class: \"meta\" }, [\n m.expand?.author ? h(\"b\", { class: \"author\" }, m.expand.author.name) : null,\n h(\"time\", {}, o.when(m)),\n ]),\n h(\"span\", { class: \"body\" }, parts),\n ]),\n ]);\n }\n\n /** Go to it; the results make way for the room (focusing the field shows them again). */\n function pick(id: string) {\n results.hidden = true;\n o.onPick(id);\n }\n\n function end(e?: Event) {\n e?.preventDefault();\n scope.abort();\n el.remove();\n o.onClose();\n }\n\n return { el, focus: () => input.focus() };\n}\n"],
|
|
5
|
+
"mappings": "wCAYO,IAAMA,EAAQ,CAACC,EAAWC,IAAkB,GAAGD,CAAC,GAAGC,EAAO,IAAM,EAAE,IAAID,IAAM,EAAI,UAAY,UAAU,UCwB7G,IAAME,EAAc,IAEdC,EAAY,EAEZC,EAAO,GAMN,SAASC,EAAQC,EAAmB,CACzC,OAAOA,EACJ,QAAQ,qBAAsB,EAAE,EAChC,UAAU,MAAM,EAChB,YAAY,EACZ,YAAY,EACZ,QAAQ,WAAY,GAAG,CAC5B,CAGO,SAASC,EAAYC,EAAqB,CAC/C,MAAO,CAAC,GAAG,IAAI,IAAIH,EAAQG,CAAC,EAAE,MAAM,KAAK,EAAE,OAAO,OAAO,CAAC,CAAC,EAAE,MAAM,EAAGL,CAAS,CACjF,CAM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,EAAE,KAAMpC,CAAK,EAAE,IAAI,CAACL,EAAG2C,IAAOA,EAAI,EAAIrB,EAAE,OAAQ,CAAC,EAAGtB,CAAC,EAAIA,CAAE,EACnF,OAAOsB,EAAE,KAAM,CAAC,EAAG,CACjBA,EAAE,SAAU,CAAE,KAAM,SAAU,MAAO,gBAAiB,GAAI,CAAE,MAAO,IAAMsB,EAAKH,EAAE,EAAE,CAAE,EAAG,OAAAvB,CAAO,EAAG,CAC/FuB,EAAE,QAAQ,OAASzB,EAAE,OAAOyB,EAAE,OAAO,MAAM,EAAI,KAC/CnB,EAAE,OAAQ,CAAE,MAAO,MAAO,EAAG,CAC3BmB,EAAE,QAAQ,OAASnB,EAAE,IAAK,CAAE,MAAO,QAAS,EAAGmB,EAAE,OAAO,OAAO,IAAI,EAAI,KACvEnB,EAAE,OAAQ,CAAC,EAAGN,EAAE,KAAKyB,CAAC,CAAC,CACzB,CAAC,EACDnB,EAAE,OAAQ,CAAE,MAAO,MAAO,EAAGoB,CAAK,CACpC,CAAC,CACH,CAAC,CACH,CAGA,SAASE,EAAKC,EAAY,CACxBpB,EAAQ,OAAS,GACjBT,EAAE,OAAO6B,CAAE,CACb,CAEA,SAASlB,EAAI,EAAW,CACtB,GAAG,eAAe,EAClBV,EAAM,MAAM,EACZc,EAAG,OAAO,EACVf,EAAE,QAAQ,CACZ,CAEA,MAAO,CAAE,GAAAe,EAAI,MAAO,IAAMV,EAAM,MAAM,CAAE,CAC1C",
|
|
6
|
+
"names": ["found", "n", "more", "DEBOUNCE_MS", "MAX_WORDS", "LEAD", "foldKey", "s", "searchWords", "q", "searchQuery", "room", "words", "before", "highlight", "text", "one", "re", "w", "first", "from", "shown", "createSearch", "o", "scope", "signal", "timer", "fetching", "input", "h", "schedule", "keydown", "results", "close", "end", "status", "more", "run", "el", "found", "next", "f", "refocus", "page", "rows", "row", "n", "err", "m", "parts", "i", "pick", "id"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
.inline-form,.user-search.card{display:flex;flex-direction:column;gap:.5625rem;margin:.25rem 0 .375rem;padding:.625rem;border:1px solid var(--line);border-radius:.75rem;background:var(--raised);overflow:hidden;animation:slide-open .15s ease-out}@keyframes slide-open{0%{max-height:0;padding-block:0;opacity:0}to{max-height:20rem}}.name-field,.search-field{display:flex;gap:.5rem;align-items:center;height:2.25rem;padding:0 .625rem;border:1px solid var(--border);border-radius:.5625rem;background:var(--surface);color:var(--dim)}.name-field:focus-within,.search-field:focus-within{border-color:var(--accent);box-shadow:0 0 0 3px var(--tint)}.name-field .type-icon,.name-field .type-icon:before{width:.875rem;height:.875rem}.name-field .type-icon{display:flex;color:var(--accent)}.search-field .ic:before{width:.875rem;height:.875rem}.name-field:has([aria-invalid=true]){border-color:var(--danger);box-shadow:0 0 0 3px color-mix(in srgb,var(--danger) 18%,transparent)}.name-field:has([aria-invalid=true]) .type-icon{color:var(--danger)}.name-field input,.search-field input{flex:1;min-width:0;height:100%;padding:0;border:0;background:none;outline:none;box-shadow:none;color:var(--fg)}.inline-form .field-error{display:flex;gap:.375rem;align-items:flex-start;margin:-.1875rem 0 0;font-size:.75rem;line-height:1rem}.inline-form .field-error .ic:before{width:.8125rem;height:.8125rem;margin-top:.09rem}.inline-form .field-error b{font-weight:600}.tiles{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.375rem;margin:0;padding:0;border:0}.tiles.n2{grid-template-columns:repeat(2,minmax(0,1fr))}.tiles label{display:flex;flex-direction:column;gap:.3125rem;align-items:center;justify-content:center;height:3.625rem;border:1px solid var(--line);border-radius:.5625rem;background:var(--surface);color:var(--muted);font-size:.75rem;font-weight:600;cursor:pointer}.tiles label:before{width:1.0625rem;height:1.0625rem;color:var(--dim)}@media(hover:hover){.tiles label:hover{background:var(--hover)}}.tiles label:has(:checked){border-color:var(--accent);background:var(--tint);color:var(--fg)}.tiles label:has(:checked):before{color:var(--accent)}.tiles label:has(:focus-visible){outline:2px solid var(--accent);outline-offset:2px}.inline-form .hint{margin:0;color:var(--muted);font-size:.75rem;line-height:1rem}.form-buttons{display:flex;gap:.25rem;justify-content:flex-end}.form-buttons button{height:2rem;padding:0 .75rem;font-size:.8125rem}.form-buttons .cancel{border-color:transparent;background:none;font-weight:500}.form-buttons .primary:disabled{opacity:.4;cursor:not-allowed}.user-search.card{gap:.375rem}.user-search.card .search-results:empty{display:none}.user-search.card .person{height:2.5rem;padding:0 .5rem;gap:.5625rem;font-weight:400}.user-search.card .person[aria-selected=true]{background:var(--tint)}.user-search.card .person .avatar{width:1.625rem;height:1.625rem;font-size:.5625rem}.user-search.card .who{display:flex;flex:1;flex-direction:column;min-width:0}.user-search.card .who>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.user-search.card .name{color:var(--muted);font-size:.84375rem;line-height:1.0625rem}.user-search.card .handle{color:var(--dim);font-size:.71875rem;line-height:.875rem}.user-search.card .who b{color:var(--fg);font-weight:700}.user-search.card kbd{flex:none;padding:0 .25rem;border:1px solid color-mix(in srgb,var(--accent) 45%,transparent);border-radius:.25rem;color:var(--accent);font:inherit;font-size:.65625rem;line-height:.9375rem}.user-search.card .search-status:not(.visually-hidden){margin:0;padding:0 .5rem;color:var(--danger);font-size:.75rem}.search-none{display:flex;flex-direction:column;gap:.375rem;align-items:center;padding:.875rem .5rem .625rem;text-align:center}.search-none[hidden]{display:none}.search-none>.none-ic{display:flex;align-items:center;justify-content:center;width:2rem;height:2rem;border-radius:50%;background:var(--hover);color:var(--dim)}.search-none>.none-ic:before{width:.9375rem;height:.9375rem}.search-none strong{color:var(--muted);font-size:.78125rem;font-weight:600}.search-none>.none-tip{color:var(--dim);font-size:.71875rem;line-height:1rem}.search-hint{margin:.125rem 0 0;padding:0 .5rem;color:var(--dim);font-size:.6875rem;line-height:.9375rem}.search-hint[hidden]{display:none}
|
|
2
|
+
/*# sourceMappingURL=sidebar-forms-ETSRVSPY.css.map */
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../web/styles/sidebar-forms.css"],
|
|
4
|
+
"sourcesContent": ["/* ---- The sidebar's creation cards: the new-room and new-collection forms and New message's search (the \"sidebar\n improvements\" board). Linked by views/rooms-forms.ts, a lazy chunk, before the first card shows; the people search's\n own rules (also the access dialog's) are in app/room-list.css. ---- */\n\n/* The new-room and new-collection forms and the New message search (sidebar improvements): a small card in place\n under the section's heading, in the list's flow (the rows move down; nothing covers them), sliding open. */\n.inline-form,\n.user-search.card {\n display: flex;\n flex-direction: column;\n gap: 0.5625rem;\n margin: 0.25rem 0 0.375rem;\n padding: 0.625rem;\n border: 1px solid var(--line);\n border-radius: 0.75rem;\n background: var(--raised);\n overflow: hidden;\n animation: slide-open 0.15s ease-out;\n}\n\n@keyframes slide-open {\n from {\n max-height: 0;\n padding-block: 0;\n opacity: 0;\n }\n\n to {\n max-height: 20rem;\n }\n}\n\n/* The name field: the chosen type's icon, then the name. Accent while typing in it, red when the name is taken. */\n.name-field,\n.search-field {\n display: flex;\n gap: 0.5rem;\n align-items: center;\n height: 2.25rem;\n padding: 0 0.625rem;\n border: 1px solid var(--border);\n border-radius: 0.5625rem;\n background: var(--surface);\n color: var(--dim);\n}\n\n.name-field:focus-within,\n.search-field:focus-within {\n border-color: var(--accent);\n box-shadow: 0 0 0 3px var(--tint);\n}\n\n.name-field .type-icon,\n.name-field .type-icon::before {\n width: 0.875rem;\n height: 0.875rem;\n}\n\n.name-field .type-icon {\n display: flex;\n color: var(--accent);\n}\n\n.search-field .ic::before {\n width: 0.875rem;\n height: 0.875rem;\n}\n\n.name-field:has([aria-invalid=\"true\"]) {\n border-color: var(--danger);\n box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 18%, transparent);\n}\n\n.name-field:has([aria-invalid=\"true\"]) .type-icon {\n color: var(--danger);\n}\n\n.name-field input,\n.search-field input {\n flex: 1;\n min-width: 0;\n height: 100%;\n padding: 0;\n border: 0;\n background: none;\n outline: none;\n box-shadow: none;\n color: var(--fg);\n}\n\n/* Why the name can't be used, under the field. */\n.inline-form .field-error {\n display: flex;\n gap: 0.375rem;\n align-items: flex-start;\n margin: -0.1875rem 0 0;\n font-size: 0.75rem;\n line-height: 1rem;\n}\n\n.inline-form .field-error .ic::before {\n width: 0.8125rem;\n height: 0.8125rem;\n margin-top: 0.09rem;\n}\n\n.inline-form .field-error b {\n font-weight: 600;\n}\n\n/* The types, as tiles: a large icon over the name. */\n.tiles {\n display: grid;\n grid-template-columns: repeat(3, minmax(0, 1fr));\n gap: 0.375rem;\n margin: 0;\n padding: 0;\n border: 0;\n}\n\n.tiles.n2 {\n grid-template-columns: repeat(2, minmax(0, 1fr));\n}\n\n.tiles label {\n display: flex;\n flex-direction: column;\n gap: 0.3125rem;\n align-items: center;\n justify-content: center;\n height: 3.625rem;\n border: 1px solid var(--line);\n border-radius: 0.5625rem;\n background: var(--surface);\n color: var(--muted);\n font-size: 0.75rem;\n font-weight: 600;\n cursor: pointer;\n}\n\n.tiles label::before {\n width: 1.0625rem;\n height: 1.0625rem;\n color: var(--dim);\n}\n\n@media (hover: hover) {\n .tiles label:hover {\n background: var(--hover);\n }\n}\n\n.tiles label:has(:checked) {\n border-color: var(--accent);\n background: var(--tint);\n color: var(--fg);\n}\n\n.tiles label:has(:checked)::before {\n color: var(--accent);\n}\n\n.tiles label:has(:focus-visible) {\n outline: 2px solid var(--accent);\n outline-offset: 2px;\n}\n\n.inline-form .hint {\n margin: 0;\n color: var(--muted);\n font-size: 0.75rem;\n line-height: 1rem;\n}\n\n.form-buttons {\n display: flex;\n gap: 0.25rem;\n justify-content: flex-end;\n}\n\n.form-buttons button {\n height: 2rem;\n padding: 0 0.75rem;\n font-size: 0.8125rem;\n}\n\n.form-buttons .cancel {\n border-color: transparent;\n background: none;\n font-weight: 500;\n}\n\n.form-buttons .primary:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n}\n\n/* New message's card: the results in it, the highlighted one tinted, with \"Enter\" on it. */\n.user-search.card {\n gap: 0.375rem;\n}\n\n.user-search.card .search-results:empty {\n display: none;\n}\n\n.user-search.card .person {\n height: 2.5rem;\n padding: 0 0.5rem;\n gap: 0.5625rem;\n font-weight: 400;\n}\n\n.user-search.card .person[aria-selected=\"true\"] {\n background: var(--tint);\n}\n\n.user-search.card .person .avatar {\n width: 1.625rem;\n height: 1.625rem;\n font-size: 0.5625rem;\n}\n\n.user-search.card .who {\n display: flex;\n flex: 1;\n flex-direction: column;\n min-width: 0;\n}\n\n.user-search.card .who > span {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.user-search.card .name {\n color: var(--muted);\n font-size: 0.84375rem;\n line-height: 1.0625rem;\n}\n\n.user-search.card .handle {\n color: var(--dim);\n font-size: 0.71875rem;\n line-height: 0.875rem;\n}\n\n.user-search.card .who b {\n color: var(--fg);\n font-weight: 700;\n}\n\n.user-search.card kbd {\n flex: none;\n padding: 0 0.25rem;\n border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);\n border-radius: 0.25rem;\n color: var(--accent);\n font: inherit;\n font-size: 0.65625rem;\n line-height: 0.9375rem;\n}\n\n.user-search.card .search-status:not(.visually-hidden) {\n margin: 0;\n padding: 0 0.5rem;\n color: var(--danger);\n font-size: 0.75rem;\n}\n\n.search-none {\n display: flex;\n flex-direction: column;\n gap: 0.375rem;\n align-items: center;\n padding: 0.875rem 0.5rem 0.625rem;\n text-align: center;\n}\n\n.search-none[hidden] {\n display: none;\n}\n\n.search-none > .none-ic {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 2rem;\n height: 2rem;\n border-radius: 50%;\n background: var(--hover);\n color: var(--dim);\n}\n\n.search-none > .none-ic::before {\n width: 0.9375rem;\n height: 0.9375rem;\n}\n\n.search-none strong {\n color: var(--muted);\n font-size: 0.78125rem;\n font-weight: 600;\n}\n\n.search-none > .none-tip {\n color: var(--dim);\n font-size: 0.71875rem;\n line-height: 1rem;\n}\n\n.search-hint {\n margin: 0.125rem 0 0;\n padding: 0 0.5rem;\n color: var(--dim);\n font-size: 0.6875rem;\n line-height: 0.9375rem;\n}\n\n.search-hint[hidden] {\n display: none;\n}\n"],
|
|
5
|
+
"mappings": "AAMA,CAAC,YACD,CAAC,WAAW,CAAC,KACX,QAAS,KACT,eAAgB,OAChB,IAAK,SAVP,OAWU,OAAQ,EAAE,QAXpB,QAYW,QACT,OAAQ,IAAI,MAAM,IAAI,QAbxB,cAciB,OACf,WAAY,IAAI,UAChB,SAAU,OACV,UAAW,WAAW,KAAM,QAC9B,CAEA,WAHa,WAIX,GACE,WAAY,EACZ,cAAe,EACf,QAAS,CACX,CAEA,GACE,WAAY,KACd,CACF,CAGA,CAAC,WACD,CAAC,aACC,QAAS,KACT,IAAK,MACL,YAAa,OACb,OAAQ,QAtCV,QAuCW,EAAE,QACX,OAAQ,IAAI,MAAM,IAAI,UAxCxB,cAyCiB,SACf,WAAY,IAAI,WAChB,MAAO,IAAI,MACb,CAEA,CAbC,UAaU,cACX,CAbC,YAaY,cACX,aAAc,IAAI,UAClB,WAAY,EAAE,EAAE,EAAE,IAAI,IAAI,OAC5B,CAEA,CAnBC,WAmBW,CAAC,UACb,CApBC,WAoBW,CADC,SACS,QACpB,MAAO,QACP,OAAQ,OACV,CAEA,CAzBC,WAyBW,CANC,UAOX,QAAS,KACT,MAAO,IAAI,SACb,CAEA,CA7BC,aA6Ba,CAAC,EAAE,QACf,MAAO,QACP,OAAQ,OACV,CAEA,CAnCC,UAmCU,KAAK,CAAC,oBACf,aAAc,IAAI,UAClB,WAAY,EAAE,EAAE,EAAE,IAAI,UAAU,GAAG,IAAI,CAAE,IAAI,UAAU,GAAG,CAAE,YAC9D,CAEA,CAxCC,UAwCU,KAAK,CAAC,oBAAsB,CArB1B,UAsBX,MAAO,IAAI,SACb,CAEA,CA5CC,WA4CW,MACZ,CA5CC,aA4Ca,MACZ,KAAM,EACN,UAAW,EACX,OAAQ,KAjFV,QAkFW,EACT,OAAQ,EACR,WAAY,KACZ,Q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,KAiQK,CAAC,aAAa,KAAK,CAAC,iBAxQtC,OAyQU,EAzQV,QA0QW,EAAE,MACX,MAAO,IAAI,UACX,UAAW,MACb,CAEA,CAAC,YACC,QAAS,KACT,eAAgB,OAChB,IAAK,QACL,YAAa,OAnRf,QAoRW,QAAS,MAAO,QACzB,WAAY,MACd,CAEA,CATC,WASW,CAAC,QACX,QAAS,IACX,CAEA,CAbC,WAaY,CAAE,CAAC,QACd,QAAS,KACT,YAAa,OACb,gBAAiB,OACjB,MAAO,KACP,OAAQ,KAjSV,cAkSiB,IACf,WAAY,IAAI,SAChB,MAAO,IAAI,MACb,CAEA,CAxBC,WAwBY,CAAE,CAXC,OAWO,QACrB,MAAO,SACP,OAAQ,QACV,CAEA,CA7BC,YA6BY,OACX,MAAO,IAAI,SACX,UAAW,UACX,YAAa,GACf,CAEA,CAnCC,WAmCY,CAAE,CAAC,SACd,MAAO,IAAI,OACX,UAAW,UACX,YAAa,IACf,CAEA,CAAC,YAxTD,OAyTU,QAAS,EAAE,EAzTrB,QA0TW,EAAE,MACX,MAAO,IAAI,OACX,UAAW,SACX,YAAa,QACf,CAEA,CARC,WAQW,CAAC,QACX,QAAS,IACX",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
@font-face{font-family:Inter;font-style:normal;font-weight:100 900;font-display:swap;src:url("./inter-cyrillic-ext-IYF56FF6.woff2") format("woff2");unicode-range:U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Inter;font-style:normal;font-weight:100 900;font-display:swap;src:url("./inter-cyrillic-JEOLYBOO.woff2") format("woff2");unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:Inter;font-style:normal;font-weight:100 900;font-display:swap;src:url("./inter-greek-IRE366VL.woff2") format("woff2");unicode-range:U+0370-0377,U+037A-037F,U+0384-038A,U+038C,U+038E-03A1,U+03A3-03FF}@font-face{font-family:Inter;font-style:normal;font-weight:100 900;font-display:swap;src:url("./inter-latin-ext-HA22NDSG.woff2") format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Inter;font-style:normal;font-weight:100 900;font-display:swap;src:url("./inter-latin-NRMW37G5.woff2") format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}:root{color-scheme:light dark;--bg: #fff;--surface: #fff;--raised: #fff;--fg: #0b0b10;--text: #0b0b10;--muted: #3f3f48;--dim: #62626e;--border: #e7e7ec;--line: #e7e7ec;--hover: #f1f1f4;--accent: #5536d0;--fill: #5536d0;--on-fill: #fff;--accent-2: #c42a7c;--grad: linear-gradient(135deg, #6a4bff, #c42a7c);--tint: color-mix(in srgb, var(--accent) 14%, transparent);--side-bg: var(--surface);--row-hover: var(--hover);--row-on: var(--fill);--row-on-fg: var(--on-fill);--row-on-icon: var(--on-fill);--row-on-badge: var(--on-fill);--row-on-badge-fg: var(--fill);--quote-hover: color-mix(in srgb, var(--fg) 10%, var(--bg));--quote-mine: var(--fill);--quote-mine-hover: color-mix(in srgb, var(--fill) 88%, #000);--quote-mine-author: var(--on-fill);--quote-mine-text: #e2dbff;--glass: color-mix(in srgb, var(--bg) 72%, transparent);--glass-blur: blur(10px);--field: color-mix(in srgb, var(--hover) 60%, transparent);--field-ring: inset 0 0 0 1px color-mix(in srgb, var(--fg) 6%, transparent);--danger: #c41d36;--new: #b0175f;--highlight: #fff1b8;--shadow: 0 .375rem 1.5rem rgb(11 11 16 / 12%);--radius: .625rem;--pill: 62.4375rem;--ease: cubic-bezier(.34, 1.56, .64, 1);font:1rem/1.5 Inter,system-ui,-apple-system,Segoe UI,Roboto,sans-serif;font-feature-settings:"calt" 0}@media(prefers-color-scheme:dark){:root:not([data-theme=light]){--bg: #1a1b1e;--surface: #111214;--raised: #232428;--fg: #ecece8;--text: #e0e0db;--muted: #b0b4ba;--dim: #9ea2a9;--border: #3a3d42;--line: #2a2c30;--hover: #2a2c30;--accent: #baa7ff;--fill: #6e56cf;--on-fill: #fff;--danger: #ff7a8f;--new: #f9a8d4;--highlight: #3d3314;--shadow: 0 .75rem 2rem rgb(0 0 0 / 45%);--side-bg: var(--bg);--row-hover: rgb(0 0 0 / 25%);--row-on: rgb(0 0 0 / 45%);--row-on-fg: var(--fg);--row-on-icon: var(--accent);--row-on-badge: var(--fill);--row-on-badge-fg: var(--on-fill);--quote-hover: rgb(0 0 0 / 40%);--quote-mine: color-mix(in srgb, var(--fill) 18%, var(--bg));--quote-mine-hover: color-mix(in srgb, var(--fill) 26%, var(--bg));--quote-mine-author: color-mix(in srgb, var(--accent) 70%, var(--fg));--quote-mine-text: var(--text)}}:root[data-theme=light]{color-scheme:light}:root[data-theme=dark]{color-scheme:dark;--bg: #1a1b1e;--surface: #111214;--raised: #232428;--fg: #ecece8;--text: #e0e0db;--muted: #b0b4ba;--dim: #9ea2a9;--border: #3a3d42;--line: #2a2c30;--hover: #2a2c30;--accent: #baa7ff;--fill: #6e56cf;--on-fill: #fff;--danger: #ff7a8f;--new: #f9a8d4;--highlight: #3d3314;--shadow: 0 .75rem 2rem rgb(0 0 0 / 45%);--side-bg: var(--bg);--row-hover: rgb(0 0 0 / 25%);--row-on: rgb(0 0 0 / 45%);--row-on-fg: var(--fg);--row-on-icon: var(--accent);--row-on-badge: var(--fill);--row-on-badge-fg: var(--on-fill);--quote-hover: rgb(0 0 0 / 40%);--quote-mine: color-mix(in srgb, var(--fill) 18%, var(--bg));--quote-mine-hover: color-mix(in srgb, var(--fill) 26%, var(--bg));--quote-mine-author: color-mix(in srgb, var(--accent) 70%, var(--fg));--quote-mine-text: var(--text)}*,*:before,*:after{box-sizing:border-box}[hidden]{display:none!important}body{margin:0;background:var(--bg);color:var(--fg);font-size:.875rem}@media(max-width:720px){body{font-size:.9375rem}body input,body textarea,body select{font-size:1rem}}::selection{background:color-mix(in srgb,var(--accent) 35%,transparent)}*{scrollbar-width:thin;scrollbar-color:var(--border) transparent}a{color:var(--accent)}h1,h2{margin:0;line-height:1.2;font-weight:700;letter-spacing:-.01em}button,input,textarea{margin:0;font:inherit;color:inherit}button,label.button{padding:.45rem .9rem;border:1px solid var(--border);border-radius:var(--radius);background:var(--raised);font-weight:600;cursor:pointer;transition:transform .15s var(--ease),background-color .15s}@media(hover:hover){button:hover:not(:disabled){background:var(--hover)}}button:active:not(:disabled){transform:scale(.95)}button:disabled{opacity:.5;cursor:default}button.primary,.auth-form button[type=submit]{border-color:transparent;background:var(--fill);color:var(--on-fill)}@media(hover:hover){button.primary:hover:not(:disabled),.auth-form button[type=submit]:hover:not(:disabled){background:var(--fill);filter:brightness(1.12)}}button.danger{color:var(--danger);border-color:currentcolor}button.link{border:0;background:none;color:var(--accent);padding:.25rem}input,textarea{width:100%;padding:.55rem .75rem;border:1px solid var(--border);border-radius:var(--radius);background:var(--surface);transition:border-color .15s}input:focus,textarea:focus{border-color:var(--accent)}:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.i,.ic:before{content:"";display:inline-block;flex:none;width:1.125rem;height:1.125rem;background:currentcolor;mask:var(--i) center / contain no-repeat}.icon-button{display:inline-flex;flex:none;align-items:center;justify-content:center;width:2.25rem;height:2.25rem;padding:0;border:0;border-radius:.5rem;background:none;color:var(--muted)}input:focus-visible,textarea:focus-visible{outline:.1875rem solid var(--tint);outline-offset:0}[aria-invalid=true]{border-color:var(--danger)}.field-error,.form-error,.list-error,.room-error,.send-error,.msg-error{color:var(--danger);font-size:.85rem;margin:.25rem 0}.field-error:empty,.form-error:empty,.list-error:empty,.room-error:empty{display:none}.visually-hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}body{min-height:100dvh}.stats-bar{display:flex;flex-wrap:wrap;gap:.25rem 1rem;align-items:center;min-height:60px;padding:.5rem 1rem;border-bottom:1px solid var(--line);background:var(--surface)}.stats-bar .brand{display:flex;gap:.6rem;align-items:center;color:var(--fg);font-size:1rem;font-weight:700;text-decoration:none}.stats-bar .brand:before{content:"";width:30px;height:30px;background:url(/icons/icon.svg) center / contain no-repeat}.stats-bar h1{font-size:1rem;font-weight:600;color:var(--muted)}.stats-updated{margin-left:auto;color:var(--dim);font-size:.8125rem;font-variant-numeric:tabular-nums}.stats{display:flex;flex-direction:column;gap:16px;max-width:960px;margin:0 auto;padding:16px}.stats .card{min-width:0;padding:16px;border:1px solid var(--border);border-radius:14px;background:var(--raised)}.stats h2{font-size:1.125rem}.stats h3{margin:20px 0 8px;font-size:.9375rem}.hint,.loading{margin:4px 0 0;color:var(--muted)}.notice{margin:0;padding:10px 14px;border-radius:var(--radius);background:var(--tint)}.tiles{display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:10px;margin-top:12px}.tile{padding:10px 12px;border-radius:var(--radius);background:var(--surface)}.tile-label{color:var(--muted);font-size:.8125rem}.tile-value{font-size:1.5rem;font-weight:650;font-variant-numeric:tabular-nums;line-height:1.3}.tile.big .tile-value{color:var(--accent)}.tile-note{color:var(--dim);font-size:.75rem}.seg{display:inline-flex;margin-bottom:8px;padding:2px;border-radius:var(--radius);background:var(--surface)}.seg button{padding:.3rem .8rem;border:0;background:none;font-weight:500}.seg button[aria-pressed=true]{background:var(--raised);box-shadow:0 1px 3px #0000001f;font-weight:600}.chart-box{position:relative}.chart{display:block;width:100%;height:auto;touch-action:pan-y}.chart .grid{stroke:var(--line);stroke-width:1}.chart .axis{fill:var(--dim);font-size:11px;font-variant-numeric:tabular-nums}.chart .line{fill:none;stroke:var(--accent);stroke-width:2;stroke-linejoin:round;stroke-linecap:round}.chart .area{fill:var(--accent);opacity:.1}.chart .dot,.chart .bar{fill:var(--accent)}.chart .cross{stroke:var(--muted);stroke-width:1}.chart .mark{fill:var(--accent);stroke:var(--raised);stroke-width:2}.chart .hit{fill:transparent}.chart .hit:hover{fill:var(--tint)}.empty{position:absolute;inset:0;display:grid;place-items:center;margin:0;color:var(--muted)}.tip{position:absolute;top:0;z-index:1;min-width:120px;padding:6px 10px;border:1px solid var(--border);border-radius:8px;background:var(--raised);box-shadow:var(--shadow);font-size:.8125rem;font-variant-numeric:tabular-nums;pointer-events:none;transform:translate(-50%);white-space:nowrap}.tip-title{color:var(--muted)}.chart-table{margin-top:8px;font-size:.8125rem}.chart-table summary{width:max-content;color:var(--accent);cursor:pointer}.chart-table table{margin-top:6px;border-collapse:collapse;font-variant-numeric:tabular-nums}.chart-table caption{text-align:left;color:var(--muted)}.chart-table th,.chart-table td{padding:3px 16px 3px 0;border-bottom:1px solid var(--line);text-align:left;font-weight:400}.chart-table thead th,.missing p{color:var(--muted)}
|
|
2
|
+
/*# sourceMappingURL=stats-5GSWDHZI.css.map */
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../web/styles/app/fonts.css", "../../web/styles/app/tokens.css", "../../web/styles/app/base.css", "../../web/styles/stats.css"],
|
|
4
|
+
"sourcesContent": ["/* ---- Inter (DESIGN.md \u00A77.7): self-hosted, one variable font per script, each fetched only when a page uses its\n characters (unicode-range). From @fontsource-variable/inter 5.3.0, SIL Open Font License (web/fonts/OFL.txt). ---- */\n\n@font-face {\n font-family: Inter;\n font-style: normal;\n font-weight: 100 900;\n font-display: swap;\n src: url(\"../../fonts/inter-cyrillic-ext.woff2\") format(\"woff2\");\n unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;\n}\n\n@font-face {\n font-family: Inter;\n font-style: normal;\n font-weight: 100 900;\n font-display: swap;\n src: url(\"../../fonts/inter-cyrillic.woff2\") format(\"woff2\");\n unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;\n}\n\n@font-face {\n font-family: Inter;\n font-style: normal;\n font-weight: 100 900;\n font-display: swap;\n src: url(\"../../fonts/inter-greek.woff2\") format(\"woff2\");\n unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;\n}\n\n@font-face {\n font-family: Inter;\n font-style: normal;\n font-weight: 100 900;\n font-display: swap;\n src: url(\"../../fonts/inter-latin-ext.woff2\") format(\"woff2\");\n unicode-range:\n U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;\n}\n\n@font-face {\n font-family: Inter;\n font-style: normal;\n font-weight: 100 900;\n font-display: swap;\n src: url(\"../../fonts/inter-latin.woff2\") format(\"woff2\");\n unicode-range:\n U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191,\n U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n}\n", "/* ---- Design tokens: colors, shadows, fonts; dark theme (\u00A77.8). tests/unit/build/contrast.test.ts reads these. ---- */\n\n:root {\n color-scheme: light dark;\n --bg: #fff;\n --surface: #fff;\n --raised: #fff;\n --fg: #0b0b10;\n --text: #0b0b10;\n --muted: #3f3f48;\n --dim: #62626e;\n --border: #e7e7ec;\n --line: #e7e7ec;\n --hover: #f1f1f4;\n --accent: #5536d0;\n /* Solid fills: Send, badges, primary buttons, with --on-fill text on them. */\n --fill: #5536d0;\n --on-fill: #fff;\n --accent-2: #c42a7c;\n --grad: linear-gradient(135deg, #6a4bff, #c42a7c);\n --tint: color-mix(in srgb, var(--accent) 14%, transparent);\n /* The sidebar's rows and the reply pills (room-list.css, replies.css). Light: the hover gray, and selected things\n (the open room, a quote of your own words) in solid accent with white on it. Dark: wells darker than the page. */\n --side-bg: var(--surface);\n --row-hover: var(--hover);\n --row-on: var(--fill);\n --row-on-fg: var(--on-fill);\n --row-on-icon: var(--on-fill);\n --row-on-badge: var(--on-fill);\n --row-on-badge-fg: var(--fill);\n --quote-hover: color-mix(in srgb, var(--fg) 10%, var(--bg));\n --quote-mine: var(--fill);\n --quote-mine-hover: color-mix(in srgb, var(--fill) 88%, #000);\n --quote-mine-author: var(--on-fill);\n --quote-mine-text: #e2dbff; /* 5.6:1 on the fill */\n /* Frosted glass (the room view redesign): the header, the scroll button and the message box, over the messages that\n scroll under them. */\n --glass: color-mix(in srgb, var(--bg) 72%, transparent);\n --glass-blur: blur(10px);\n --field: color-mix(in srgb, var(--hover) 60%, transparent);\n --field-ring: inset 0 0 0 1px color-mix(in srgb, var(--fg) 6%, transparent);\n --danger: #c41d36; /* \u2265 4.5:1 on every light background, hover included (QA BUG-57) */\n --new: #b0175f;\n --highlight: #fff1b8;\n --shadow: 0 0.375rem 1.5rem rgb(11 11 16 / 12%);\n --radius: 0.625rem;\n --pill: 62.4375rem;\n --ease: cubic-bezier(0.34, 1.56, 0.64, 1);\n /* Inter, the app's own (fonts.css, \u00A77.7), the system's font until it arrives. 16px also keeps iOS Safari from zooming\n in on a focused text field (it does under 16px) \u2014 don't size fields below it. */\n font:\n 1rem / 1.5 Inter,\n system-ui,\n -apple-system,\n \"Segoe UI\",\n Roboto,\n sans-serif;\n /* Inter's contextual alternates draw people's text as something else: \"32x1n\" as \"32\u00D71n\", \"->\" as an arrow. Names\n and messages show as typed (QA BUG-191). After `font`, which doesn't reset it. */\n font-feature-settings: \"calt\" 0;\n}\n\n/* The system's theme (auto), unless the profile page's choice (\u00A77.8, web/src/theme.ts) says otherwise. The two dark\n blocks must stay the same (contrast.test.ts checks). */\n@media (prefers-color-scheme: dark) {\n :root:not([data-theme=\"light\"]) {\n --bg: #1a1b1e;\n --surface: #111214;\n --raised: #232428;\n --fg: #ecece8;\n --text: #e0e0db;\n --muted: #b0b4ba;\n --dim: #9ea2a9;\n --border: #3a3d42;\n --line: #2a2c30;\n --hover: #2a2c30;\n --accent: #baa7ff;\n --fill: #6e56cf;\n --on-fill: #fff;\n --danger: #ff7a8f;\n --new: #f9a8d4;\n --highlight: #3d3314;\n --shadow: 0 0.75rem 2rem rgb(0 0 0 / 45%);\n /* The sidebar on the room's own background, so its wells show (light: tokens in :root). */\n --side-bg: var(--bg);\n --row-hover: rgb(0 0 0 / 25%);\n --row-on: rgb(0 0 0 / 45%);\n --row-on-fg: var(--fg);\n --row-on-icon: var(--accent);\n --row-on-badge: var(--fill);\n --row-on-badge-fg: var(--on-fill);\n --quote-hover: rgb(0 0 0 / 40%);\n --quote-mine: color-mix(in srgb, var(--fill) 18%, var(--bg));\n --quote-mine-hover: color-mix(in srgb, var(--fill) 26%, var(--bg));\n --quote-mine-author: color-mix(in srgb, var(--accent) 70%, var(--fg));\n --quote-mine-text: var(--text);\n }\n}\n\n:root[data-theme=\"light\"] {\n color-scheme: light;\n}\n\n:root[data-theme=\"dark\"] {\n color-scheme: dark;\n --bg: #1a1b1e;\n --surface: #111214;\n --raised: #232428;\n --fg: #ecece8;\n --text: #e0e0db;\n --muted: #b0b4ba;\n --dim: #9ea2a9;\n --border: #3a3d42;\n --line: #2a2c30;\n --hover: #2a2c30;\n --accent: #baa7ff;\n --fill: #6e56cf;\n --on-fill: #fff;\n --danger: #ff7a8f;\n --new: #f9a8d4;\n --highlight: #3d3314;\n --shadow: 0 0.75rem 2rem rgb(0 0 0 / 45%);\n /* The sidebar on the room's own background, so its wells show (light: tokens in :root). */\n --side-bg: var(--bg);\n --row-hover: rgb(0 0 0 / 25%);\n --row-on: rgb(0 0 0 / 45%);\n --row-on-fg: var(--fg);\n --row-on-icon: var(--accent);\n --row-on-badge: var(--fill);\n --row-on-badge-fg: var(--on-fill);\n --quote-hover: rgb(0 0 0 / 40%);\n --quote-mine: color-mix(in srgb, var(--fill) 18%, var(--bg));\n --quote-mine-hover: color-mix(in srgb, var(--fill) 26%, var(--bg));\n --quote-mine-author: color-mix(in srgb, var(--accent) 70%, var(--fg));\n --quote-mine-text: var(--text);\n}\n", "/* ---- Base: reset, elements, buttons, fields, focus, errors ---- */\n\n*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\n/* Author display rules (e.g. .app-bar { display: flex }) would otherwise beat the UA [hidden] style. */\n[hidden] {\n /* biome-ignore lint/complexity/noImportantStyles: [hidden] must win over any author display rule (see above) */\n display: none !important;\n}\n\nbody {\n margin: 0;\n background: var(--bg);\n color: var(--fg);\n font-size: 0.875rem;\n}\n\n/* Phones: a size up, and fields at 16px (see tokens.css). */\n@media (max-width: 720px) {\n body {\n font-size: 0.9375rem;\n }\n\n /* After the fields' own `font: inherit` below, whatever the order. */\n body input,\n body textarea,\n body select {\n font-size: 1rem;\n }\n}\n\n::selection {\n background: color-mix(in srgb, var(--accent) 35%, transparent);\n}\n\n* {\n scrollbar-width: thin;\n scrollbar-color: var(--border) transparent;\n}\n\na {\n color: var(--accent);\n}\n\nh1,\nh2 {\n margin: 0;\n line-height: 1.2;\n font-weight: 700;\n letter-spacing: -0.01em;\n}\n\nbutton,\ninput,\ntextarea {\n /* Firefox's default 1px block margin on textareas made the composer a pixel off. */\n margin: 0;\n font: inherit;\n color: inherit;\n}\n\nbutton,\nlabel.button {\n padding: 0.45rem 0.9rem;\n border: 1px solid var(--border);\n border-radius: var(--radius);\n background: var(--raised);\n font-weight: 600;\n cursor: pointer;\n transition:\n transform 0.15s var(--ease),\n background-color 0.15s;\n}\n\n@media (hover: hover) {\n button:hover:not(:disabled) {\n background: var(--hover);\n }\n}\n\nbutton:active:not(:disabled) {\n transform: scale(0.95);\n}\n\nbutton:disabled {\n opacity: 0.5;\n cursor: default;\n}\n\nbutton.primary,\n.auth-form button[type=\"submit\"] {\n border-color: transparent;\n background: var(--fill);\n color: var(--on-fill);\n}\n\n@media (hover: hover) {\n button.primary:hover:not(:disabled),\n .auth-form button[type=\"submit\"]:hover:not(:disabled) {\n background: var(--fill);\n filter: brightness(1.12);\n }\n}\n\nbutton.danger {\n color: var(--danger);\n border-color: currentcolor;\n}\n\nbutton.link {\n border: 0;\n background: none;\n color: var(--accent);\n padding: 0.25rem;\n}\n\ninput,\ntextarea {\n width: 100%;\n padding: 0.55rem 0.75rem;\n border: 1px solid var(--border);\n border-radius: var(--radius);\n background: var(--surface);\n transition: border-color 0.15s;\n}\n\ninput:focus,\ntextarea:focus {\n border-color: var(--accent);\n}\n\n:focus-visible {\n outline: 2px solid var(--accent);\n outline-offset: 2px;\n}\n\n/* Icons (.i-*): a stroke drawing in the text's color, from the mask in icons.css. */\n.i,\n.ic::before {\n content: \"\";\n display: inline-block;\n flex: none;\n width: 1.125rem;\n height: 1.125rem;\n background: currentcolor;\n mask: var(--i) center / contain no-repeat;\n}\n\n/* An icon-only button: square, quiet until hovered. */\n.icon-button {\n display: inline-flex;\n flex: none;\n align-items: center;\n justify-content: center;\n width: 2.25rem;\n height: 2.25rem;\n padding: 0;\n border: 0;\n border-radius: 0.5rem;\n background: none;\n color: var(--muted);\n}\n\ninput:focus-visible,\ntextarea:focus-visible {\n outline: 0.1875rem solid var(--tint);\n outline-offset: 0;\n}\n\n[aria-invalid=\"true\"] {\n border-color: var(--danger);\n}\n\n.field-error,\n.form-error,\n.list-error,\n.room-error,\n.send-error,\n.msg-error {\n color: var(--danger);\n font-size: 0.85rem;\n margin: 0.25rem 0;\n}\n\n.field-error:empty,\n.form-error:empty,\n.list-error:empty,\n.room-error:empty {\n display: none;\n}\n\n.visually-hidden {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n}\n", "/* The usage statistics page (DESIGN.md \u00A740): a page of its own (web/stats.html), with the app's fonts, tokens and\n base styles, and these. */\n\n@import \"./app/fonts.css\";\n@import \"./app/tokens.css\";\n@import \"./app/base.css\";\n\nbody {\n min-height: 100dvh;\n}\n\n.stats-bar {\n display: flex;\n flex-wrap: wrap;\n gap: 0.25rem 1rem;\n align-items: center;\n min-height: 60px;\n padding: 0.5rem 1rem;\n border-bottom: 1px solid var(--line);\n background: var(--surface);\n}\n\n.stats-bar .brand {\n display: flex;\n gap: 0.6rem;\n align-items: center;\n color: var(--fg);\n font-size: 1rem;\n font-weight: 700;\n text-decoration: none;\n}\n\n.stats-bar .brand::before {\n content: \"\";\n width: 30px;\n height: 30px;\n background: url(\"/icons/icon.svg\") center / contain no-repeat;\n}\n\n.stats-bar h1 {\n font-size: 1rem;\n font-weight: 600;\n color: var(--muted);\n}\n\n.stats-updated {\n margin-left: auto;\n color: var(--dim);\n font-size: 0.8125rem;\n font-variant-numeric: tabular-nums;\n}\n\n.stats {\n display: flex;\n flex-direction: column;\n gap: 16px;\n max-width: 960px;\n margin: 0 auto;\n padding: 16px;\n}\n\n.stats .card {\n min-width: 0;\n padding: 16px;\n border: 1px solid var(--border);\n border-radius: 14px;\n background: var(--raised);\n}\n\n.stats h2 {\n font-size: 1.125rem;\n}\n\n.stats h3 {\n margin: 20px 0 8px;\n font-size: 0.9375rem;\n}\n\n.hint,\n.loading {\n margin: 4px 0 0;\n color: var(--muted);\n}\n\n.notice {\n margin: 0;\n padding: 10px 14px;\n border-radius: var(--radius);\n background: var(--tint);\n}\n\n.tiles {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));\n gap: 10px;\n margin-top: 12px;\n}\n\n.tile {\n padding: 10px 12px;\n border-radius: var(--radius);\n background: var(--surface);\n}\n\n.tile-label {\n color: var(--muted);\n font-size: 0.8125rem;\n}\n\n.tile-value {\n font-size: 1.5rem;\n font-weight: 650;\n font-variant-numeric: tabular-nums;\n line-height: 1.3;\n}\n\n.tile.big .tile-value {\n color: var(--accent);\n}\n\n.tile-note {\n color: var(--dim);\n font-size: 0.75rem;\n}\n\n.seg {\n display: inline-flex;\n margin-bottom: 8px;\n padding: 2px;\n border-radius: var(--radius);\n background: var(--surface);\n}\n\n.seg button {\n padding: 0.3rem 0.8rem;\n border: 0;\n background: none;\n font-weight: 500;\n}\n\n.seg button[aria-pressed=\"true\"] {\n background: var(--raised);\n box-shadow: 0 1px 3px rgb(0 0 0 / 12%);\n font-weight: 600;\n}\n\n.chart-box {\n position: relative;\n}\n\n.chart {\n display: block;\n width: 100%;\n height: auto;\n touch-action: pan-y;\n}\n\n.chart .grid {\n stroke: var(--line);\n stroke-width: 1;\n}\n\n.chart .axis {\n fill: var(--dim);\n font-size: 11px;\n font-variant-numeric: tabular-nums;\n}\n\n.chart .line {\n fill: none;\n stroke: var(--accent);\n stroke-width: 2;\n stroke-linejoin: round;\n stroke-linecap: round;\n}\n\n.chart .area {\n fill: var(--accent);\n opacity: 0.1;\n}\n\n.chart .dot,\n.chart .bar {\n fill: var(--accent);\n}\n\n.chart .cross {\n stroke: var(--muted);\n stroke-width: 1;\n}\n\n.chart .mark {\n fill: var(--accent);\n stroke: var(--raised);\n stroke-width: 2;\n}\n\n.chart .hit {\n fill: transparent;\n}\n\n.chart .hit:hover {\n fill: var(--tint);\n}\n\n.empty {\n position: absolute;\n inset: 0;\n display: grid;\n place-items: center;\n margin: 0;\n color: var(--muted);\n}\n\n.tip {\n position: absolute;\n top: 0;\n z-index: 1;\n min-width: 120px;\n padding: 6px 10px;\n border: 1px solid var(--border);\n border-radius: 8px;\n background: var(--raised);\n box-shadow: var(--shadow);\n font-size: 0.8125rem;\n font-variant-numeric: tabular-nums;\n pointer-events: none;\n transform: translateX(-50%);\n white-space: nowrap;\n}\n\n.tip-title {\n color: var(--muted);\n}\n\n.chart-table {\n margin-top: 8px;\n font-size: 0.8125rem;\n}\n\n.chart-table summary {\n width: max-content;\n color: var(--accent);\n cursor: pointer;\n}\n\n.chart-table table {\n margin-top: 6px;\n border-collapse: collapse;\n font-variant-numeric: tabular-nums;\n}\n\n.chart-table caption {\n text-align: left;\n color: var(--muted);\n}\n\n.chart-table th,\n.chart-table td {\n padding: 3px 16px 3px 0;\n border-bottom: 1px solid var(--line);\n text-align: left;\n font-weight: 400;\n}\n\n.chart-table thead th {\n color: var(--muted);\n}\n\n.missing p {\n color: var(--muted);\n}\n"],
|
|
5
|
+
"mappings": "AAGA,WACE,YAAa,MACb,WAAY,OACZ,YAAa,IAAI,IACjB,aAAc,KACd,IAAK,2CAA4C,OAAO,SACxD,cAAe,CAAC,KAAK,KAAK,CAAE,CAAC,UAAU,CAAE,CAAC,KAAK,CAAE,CAAC,UAAU,CAAE,CAAC,CAAC,SAAS,CAAE,CAAC,CAAC,SAC/E,CAEA,WACE,YAAa,MACb,WAAY,OACZ,YAAa,IAAI,IACjB,aAAc,KACd,IAAK,uCAAwC,OAAO,SACpD,cAAe,CAAC,KAAK,CAAE,CAAC,KAAK,KAAK,CAAE,CAAC,KAAK,KAAK,CAAE,CAAC,UAAU,CAAE,CAAC,KACjE,CAEA,WACE,YAAa,MACb,WAAY,OACZ,YAAa,IAAI,IACjB,aAAc,KACd,IAAK,oCAAqC,OAAO,SACjD,cAAe,CAAC,KAAK,KAAK,CAAE,CAAC,UAAU,CAAE,CAAC,KAAK,KAAK,CAAE,CAAC,KAAK,CAAE,CAAC,UAAU,CAAE,CAAC,UAC9E,CAEA,WACE,YAAa,MACb,WAAY,OACZ,YAAa,IAAI,IACjB,aAAc,KACd,IAAK,wCAAyC,OAAO,SACrD,cACE,CAAC,KAAK,KAAK,CAAE,CAAC,UAAU,CAAE,CAAC,UAAU,CAAE,CAAC,UAAU,CAAE,CAAC,UAAU,CAAE,CAAC,KAAK,CAAE,CAAC,KAAK,CAAE,CAAC,KAAK,CAAE,CAAC,UAAU,CAAE,CAAC,KAAK,KAAK,CAAE,CAAC,UAAU,CAAE,CAAC,KAAK,CAAE,CAAC,UAAU,CAAE,CAAC,UAAU,CAAE,CAAC,KAAK,CAAE,CAAC,UAAU,CAAE,CAAC,CAAC,SAC7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AAC,MACN,OAAQ,IAAI,SACZ,aAAc,CAChB,CAEA,CAzCC,MAyCM,CAAC,KACN,KAAM,IAAI,UACV,OAAQ,IAAI,UACZ,aAAc,CAChB,CAEA,CA/CC,MA+CM,CAAC,IACN,KAAM,WACR,CAEA,CAnDC,MAmDM,CAJC,GAIG,OACT,KAAM,IAAI,OACZ,CAEA,CAAC,MACC,SAAU,SA9MZ,MA+MS,EACP,QAAS,KACT,YAAa,OAjNf,OAkNU,EACR,MAAO,IAAI,QACb,CAEA,CAAC,IACC,SAAU,SACV,IAAK,EACL,QAAS,EACT,UAAW,MA1Nb,QA2NW,IAAI,KACb,OAAQ,IAAI,MAAM,IAAI,UA5NxB,cA6NiB,IACf,WAAY,IAAI,UAChB,WAAY,IAAI,UAChB,UAAW,SACX,qBAAsB,aACtB,eAAgB,KAChB,UAAW,UAAW,MACtB,YAAa,MACf,CAEA,CAAC,UACC,MAAO,IAAI,QACb,CAEA,CAAC,YACC,WAAY,IACZ,UAAW,QACb,CAEA,CALC,YAKY,QACX,MAAO,YACP,MAAO,IAAI,UACX,OAAQ,OACV,CAEA,CAXC,YAWY,MACX,WAAY,IACZ,gBAAiB,SACjB,qBAAsB,YACxB,CAEA,CAjBC,YAiBY,QACX,WAAY,KACZ,MAAO,IAAI,QACb,CAEA,CAtBC,YAsBY,GACb,CAvBC,YAuBY,GAlQb,QAmQW,IAAI,KAAK,IAAI,EACtB,cAAe,IAAI,MAAM,IAAI,QAC7B,WAAY,KACZ,YAAa,GACf,CAEA,CA9BC,YA8BY,MAAM,GAInB,CAAC,QAAQ,EAHP,MAAO,IAAI,QACb",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var De=new Set(["value","checked"]);function a(e,t={},n){let o=document.createElement(e),{class:s,dataset:u,on:i,signal:c,...b}=t;s&&(o.className=s),u&&Object.assign(o.dataset,u);for(let[y,p]of Object.entries(b))p==null||p===!1||(De.has(y)?o[y]=p:o.setAttribute(y,p===!0?"":String(p)));if(i)for(let[y,p]of Object.entries(i))o.addEventListener(y,p,c?{signal:c}:void 0);return Re(o,n),o}function Re(e,t){for(let n of Array.isArray(t)?t:[t])n==null||n===!1||e.appendChild(typeof n=="object"?n:document.createTextNode(String(n)))}function U(e){e.replaceChildren()}var ue=e=>`People online over the last ${e?"24 hours":"7 days"}`;var pe=e=>e===1?"message":"messages",de=e=>e===1?"person posted":"people posted";var me=e=>e?" (running)":"";var fe=(e,t)=>`${t} slow ${e===1?"client":"clients"} dropped since the start`;var j=(e,t)=>`${t} ${e===1?"person":"people"} posted`;var $e="chat.theme",Pe={light:"#ffffff",dark:"#111214"};function Ce(){try{return globalThis.localStorage??null}catch{return null}}function he(e=Ce()){try{let t=e?.getItem($e);return t==="light"||t==="dark"?t:"auto"}catch{return"auto"}}function ge(e,t=document){let n=t.documentElement;e==="auto"?delete n.dataset.theme:n.dataset.theme=e;for(let o of t.querySelectorAll('meta[name="theme-color"]')){let s=o.media.includes("dark")?"dark":"light";o.content=Pe[e==="auto"?s:e]}}var be=e=>`${e} min`,q=e=>`${e} h`;var ye=e=>`${e} d`,Ee=e=>`${e} ago`;var D=864e5;function Be(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}function $(e,t=0){let n=new Date(e);return n.setHours(0,0,0,0),n.setDate(n.getDate()-t),n.getTime()}function Q(e,t,n=30){let o=new Map(e.map(u=>[u.day,u])),s=[];for(let u=n-1;u>=0;u--){let i=Be($(t,u)+432e5),c=o.get(i);s.push({day:i,messages:c?.messages??0,people:c?.people??0})}return s}function Z(e,t,n){let o=0;for(let s of e)s[0]>=t&&(o+=s[1]);return o*n/60}function P(e,t){let n=null;for(let o of e)o[0]>=t&&(!n||o[1]>n.online)&&(n={online:o[1],at:o[0]});return n&&!n.online?{online:0,at:0}:n}function _e(e,t,n){let o=[],s=[],u=-1/0;for(let i of e)i[0]<t||(i[0]-u>2*n*6e4&&s.length&&(o.push(s),s=[]),s.push(i),u=i[0]);return s.length&&o.push(s),o}function X(e,t=4){let n=Math.max(e,t),o=10**Math.floor(Math.log10(n));for(let s of[1,2,5,10])if(s*o>=n)return s*o;return 10*o}function Y(e){return e<1?`${Math.round(e*60)} min`:e<10?q((Math.round(e*10)/10).toLocaleString()):`${Math.round(e).toLocaleString()} h`}function C(e,t){return t>0?`${Math.round(e/t*100)}%`:"\u2013"}function H(e){let t=["B","KB","MB","GB","TB"],n=0;for(;e>=1024&&n<t.length-1;)e/=1024,n++;return`${n&&e<10?(Math.round(e*10)/10).toLocaleString():Math.round(e).toLocaleString()} ${t[n]}`}function F(e){return e<60?`${Math.round(e)} s`:e<3600?be(Math.round(e/60)):e<86400?q(String(Math.round(e/3600))):ye(Math.round(e/86400))}function J(e,t,n="not since the start"){let o=Date.parse(e);return e&&!Number.isNaN(o)?Ee(F(Math.max(0,(t-o)/1e3))):n}var We=3e4,Ge=["pocketbase_auth","__pb_superusers__/_"],Ke="http://www.w3.org/2000/svg",w=document.getElementById("stats"),re=document.getElementById("stats-updated"),l=new Intl.NumberFormat,V=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit"}),ve=new Intl.DateTimeFormat(void 0,{weekday:"short",hour:"2-digit",minute:"2-digit"}),ee=new Intl.DateTimeFormat(void 0,{weekday:"short",day:"numeric",month:"short"}),we=new Intl.DateTimeFormat(void 0,{day:"numeric",month:"short"}),A="day",O=null,te=null,ne=!1;function Ae(e=!1){let t=[];for(let n of Ge)try{let o=JSON.parse(localStorage.getItem(n)||"{}"),s=o?.token;if(e&&o?.record?.collectionName!=="_superusers")continue;typeof s=="string"&&s&&t.push(s)}catch{}return t}async function Ue(){let e=-new Date().getTimezoneOffset();for(let t of Ae())try{let n=await fetch(`/api/chat/stats?tz=${e}`,{headers:{Authorization:t}});if(n.ok)return await n.json();if(n.status!==401&&n.status!==403)return null}catch{return null}return"denied"}async function Ye(){for(let e of Ae(!0))try{let t=await fetch("/api/chat/metrics",{headers:{Authorization:e,Accept:"application/json"}});if(t.ok)return await t.json()}catch{return null}return null}function d(e,t,n,o=!1){return a("div",{class:o?"tile big":"tile"},[a("div",{class:"tile-label"},e),a("div",{class:"tile-value"},t),n?a("div",{class:"tile-note"},n):null])}function B(e,t,n){return a("section",{class:"card"},[a("h2",{},e),n?a("p",{class:"hint"},n):null,...t])}function S(e,t={}){let n=document.createElementNS(Ke,e);for(let[o,s]of Object.entries(t))n.setAttribute(o,String(s));return n}function Me(e,t,n){return a("details",{class:"chart-table"},[a("summary",{},"Show as a table"),oe(e,t,n)])}function oe(e,t,n){return a("table",{},[a("caption",{},e),a("thead",{},a("tr",{},t.map(o=>a("th",{scope:"col"},o)))),a("tbody",{},n.map(o=>a("tr",{},o.map((s,u)=>u?a("td",{},typeof s=="number"?l.format(s):s):a("th",{scope:"row"},String(s))))))])}var Fe={telegram:"Telegram",federation:"Linked instances",link_previews:"Link previews",media_thumbs:"Thumbnails to make",media_sizes:"Video shapes to read",media_moves:"Files to move",storage_cleanup:"Storage to clean up",account_jobs:"Exports and deleted accounts",account:"Exports and deleted accounts",previews:"Link previews",media:"Media",retention:"Daily prune"},R=e=>Fe[e]??e;function Ve(e){let t=Date.parse(e.at)||Date.now(),n=(e.db["data.db"]??0)+(e.db["data.db-wal"]??0),o=(e.db["auxiliary.db"]??0)+(e.db["auxiliary.db-wal"]??0),s=Object.entries(e.queues).sort(([i],[c])=>R(i).localeCompare(R(c))),u=Object.entries(e.workers).sort(([i],[c])=>R(i).localeCompare(R(c)));return B("Server",[a("div",{class:"tiles"},[d("Up for",F(e.uptime_seconds),`Chirkle ${e.version}, PocketBase ${e.pocketbase}`),d("Connections",l.format(e.realtime.clients),"realtime, incl. guests"),d("Live events waiting",l.format(e.realtime.queued),fe(e.realtime.dropped,l.format(e.realtime.dropped))),d("Database",H(n),`logs ${H(o)}`),d("Memory",H(e.process.heap_bytes),`${H(e.process.sys_bytes)} from the system`)]),a("h3",{},"Queues"),a("div",{class:"chart-table"},oe("Rows waiting for a worker",["Queue","Rows","Failed once or more","Oldest"],s.map(([i,c])=>[R(i),c.rows,c.failing,c.rows?F(c.oldest_seconds):"\u2013"]))),a("h3",{},"Workers"),a("div",{class:"chart-table"},oe("When each worker last did its work",["Worker","Last pass","Last error"],u.map(([i,c])=>[R(i),`${J(c.last_pass,t)}${me(c.running)}`,c.last_error?`${c.last_error} (${J(c.last_error_at,t)})`:"\u2013"])))],"Only superusers see this. Also at /api/chat/metrics, in Prometheus's format with ?format=prometheus.")}var x=720,L=220,ae=()=>x<520,m={top:12,right:12,bottom:26,left:36};function ke(e,t){for(let n of[0,t/2,t].filter(Number.isInteger)){let o=m.top+(L-m.top-m.bottom)*(1-n/t);e.append(S("line",{x1:m.left,x2:x-m.right,y1:o,y2:o,class:"grid"}));let s=S("text",{x:m.left-6,y:o+4,"text-anchor":"end",class:"axis"});s.textContent=l.format(n),e.append(s)}}function Oe(e,t,n){let o=t>x-m.right-32?"end":t<m.left+32?"start":"middle",s=S("text",{x:o==="end"?Math.min(t+6,x-2):t,y:L-8,"text-anchor":o,class:"axis"});s.textContent=n,e.append(s)}function Le(e){let t=a("div",{class:"tip",role:"status",hidden:!0});return e.append(t),{show(n,o,s){U(t),t.append(a("div",{class:"tip-title"},s));for(let[i,c]of o)t.append(a("div",{},[a("strong",{},i),` ${c}`]));t.hidden=!1;let u=Math.min(Math.max(n*e.clientWidth,t.offsetWidth/2+4),e.clientWidth-t.offsetWidth/2-4);t.style.left=`${u}px`},hide(){t.hidden=!0}}}function ze(e){let t=e.at,n=t-(A==="day"?D:7*D),o=_e(e.samples,n,e.sample_minutes),s=o.flat(),u=X(Math.max(0,...s.map(r=>r[1]))),i=x-m.left-m.right,c=L-m.top-m.bottom,b=r=>m.left+(r-n)/(t-n)*i,y=r=>m.top+c*(1-r/u),p=S("svg",{viewBox:`0 0 ${x} ${L}`,class:"chart",role:"img"});p.setAttribute("aria-label",ue(A==="day"));let h=S("g");p.append(h),ke(h,u);let v=[];if(A==="day"){let r=Math.ceil(n/216e5)*6*36e5;for(let g=r;g<=t;g+=6*36e5)v.push(g)}else for(let r=6;r>=0;r--)(!ae()||r%2===0)&&v.push($(t,r));for(let r of v)r<n||b(r)>x-m.right-28||Oe(h,b(r),A==="day"?V.format(r):we.format(r));let f=y(0);for(let r of o){let g=r.map(T=>`${b(T[0]).toFixed(1)},${y(T[1]).toFixed(1)}`);if(r.length===1){h.append(S("circle",{cx:b(r[0][0]),cy:y(r[0][1]),r:3,class:"dot"}));continue}h.append(S("polygon",{points:`${b(r[0][0])},${f} ${g.join(" ")} ${b(r.at(-1)[0])},${f}`,class:"area"})),h.append(S("polyline",{points:g.join(" "),class:"line"}))}let E=S("line",{y1:m.top,y2:f,class:"cross",visibility:"hidden"}),_=S("circle",{r:4.5,class:"mark",visibility:"hidden"});h.append(E,_);let M=a("div",{class:"chart-box"},[p]);s.length||M.append(a("p",{class:"empty"},e.history?"No samples yet: one is taken every 5 minutes.":"Not recorded."));let I=Le(M),W=r=>{let g=p.getBoundingClientRect(),T=n+((r-g.left)/g.width*x-m.left)/i*(t-n),N=null;for(let le of s)(!N||Math.abs(le[0]-T)<Math.abs(N[0]-T))&&(N=le);return N},k=r=>{if(!r)return;let g=b(r[0]);for(let T of[E,_])T.setAttribute("visibility","visible");E.setAttribute("x1",String(g)),E.setAttribute("x2",String(g)),_.setAttribute("cx",String(g)),_.setAttribute("cy",String(y(r[1]))),I.show(g/x,[[l.format(r[1]),"people online"],[l.format(r[3]),"on the web"],[l.format(r[4]),"on Android"],[l.format(r[2]),"guests"]],(A==="day"?V:ve).format(r[0]))},G=()=>{for(let r of[E,_])r.setAttribute("visibility","hidden");I.hide()};p.addEventListener("pointermove",r=>k(W(r.clientX))),p.addEventListener("pointerleave",G);let K=s.length-1;p.setAttribute("tabindex","0"),p.addEventListener("focus",()=>k(s[K]??null)),p.addEventListener("blur",G),p.addEventListener("keydown",r=>{r.key!=="ArrowLeft"&&r.key!=="ArrowRight"||(r.preventDefault(),K=Math.max(0,Math.min(s.length-1,K+(r.key==="ArrowLeft"?-1:1))),k(s[K]??null))});let z=[];if(A==="day")for(let r=Math.floor(n/36e5)*36e5;r<=t;r+=36e5){let g=P(s.filter(T=>T[0]<r+36e5),r);g&&z.push([V.format(r),g.online])}else for(let r=6;r>=0;r--){let g=$(t,r),T=P(s.filter(N=>N[0]<g+D),g);T&&z.push([ee.format(g),T.online])}let Ne=a("div",{class:"seg",role:"group","aria-label":"Range"},[Se("day","24 hours"),Se("week","7 days")]);return a("div",{},[Ne,M,Me(A==="day"?"Most people online, by hour":"Most people online, by day",[A==="day"?"Hour":"Day","People"],z)])}function Se(e,t){return a("button",{type:"button","aria-pressed":String(A===e),on:{click:()=>{A=e,ne=!0,O&&ie(O)}}},t)}function je(e){let t=Q(e.messages.days,e.at),n=X(Math.max(0,...t.map(h=>h.messages))),o=x-m.left-m.right,s=L-m.top-m.bottom,u=o/t.length,i=Math.min(16,u-2),c=S("svg",{viewBox:`0 0 ${x} ${L}`,class:"chart",role:"img"});c.setAttribute("aria-label","Messages per day, the last 30 days");let b=S("g");c.append(b),ke(b,n);let y=a("div",{class:"chart-box"},[c]),p=Le(y);return t.forEach((h,v)=>{let f=m.left+v*u+(u-i)/2,E=h.messages/n*s,_=m.top+s-E,M=Math.min(4,i/2,E);E>0&&b.append(S("path",{d:`M${f},${_+E}V${_+M}Q${f},${_} ${f+M},${_}H${f+i-M}Q${f+i},${_} ${f+i},${_+M}V${_+E}Z`,class:"bar"}));let I=new Date(`${h.day}T12:00:00`),W=ae()?10:5;(v%W===W-1||v===t.length-1)&&Oe(b,f+i/2,v===t.length-1?"Today":we.format(I));let k=S("rect",{x:m.left+v*u,y:m.top,width:u,height:s,class:"hit"}),G=()=>p.show((f+i/2)/x,[[l.format(h.messages),pe(h.messages)],[l.format(h.people),de(h.people)]],ee.format(I));k.addEventListener("pointerenter",G),k.addEventListener("pointerleave",()=>p.hide()),b.append(k)}),a("div",{},[y,Me("Messages per day",["Day","Messages","People who posted"],t.map(h=>[ee.format(new Date(`${h.day}T12:00:00`)),h.messages,h.people]))])}function ie(e){O=e,x=Math.round(Math.min(928,Math.max(280,w.clientWidth-66))),L=ae()?180:220;let t=e.at,n=$(t),o=Q(e.messages.days,t),s=f=>o.slice(-f).reduce((E,_)=>E+_.messages,0),u=s(30),i=P(e.samples,n),c=P(e.samples,t-7*D),b=Z(e.samples,n,e.sample_minutes),y=Z(e.samples,t-7*D,e.sample_minutes),p=f=>e.history||e.samples.length?f:"\u2013",h=[e.history?null:a("p",{class:"notice",role:"note"},"Recording is off (site settings: no_stats). Live numbers and messages are still shown; what was recorded before is dropped as it ages."),B("Now",[a("div",{class:"tiles"},[d("People online",l.format(e.now.online),void 0,!0),d("On the web",l.format(e.now.web)),d("On Android",l.format(e.now.android)),d("Guests",l.format(e.now.guests),"open tabs, not signed in"),d("Peak today",p(i?l.format(i.online):"\u2013"),i?.at?`at ${V.format(i.at)}`:void 0),d("Peak, 7 days",p(c?l.format(c.online):"\u2013"),c?.at?ve.format(c.at):void 0)])]),B("Usage",[a("div",{class:"tiles"},[d("Active, 24 hours",l.format(e.active.day),`${C(e.active.day,e.accounts.total)} of accounts`),d("Active, 7 days",l.format(e.active.week),`${C(e.active.week,e.accounts.total)} of accounts`),d("Active, 30 days",l.format(e.active.month),`${C(e.active.month,e.accounts.total)} of accounts`),d("Time online today",p(Y(b)),"all people together"),d("Time online, 7 days",p(Y(y)),"all people together"),d("Per active person",p(e.active.week?Y(y/e.active.week):"\u2013"),"a week, on average")]),a("h3",{},"People online"),ze(e)],"Active: online at least once. Time online is counted every 5 minutes."),B("Messages",[a("div",{class:"tiles"},[d("Today",l.format(o.at(-1)?.messages??0)),d("7 days",l.format(s(7)),j(e.messages.people_week,l.format(e.messages.people_week))),d("30 days",l.format(u),j(e.messages.people_month,l.format(e.messages.people_month))),d("In DMs",C(e.messages.dms_month,u),"of the 30 days'"),d("Files sent",l.format(e.messages.files_month),"30 days"),d("Reactions",l.format(e.messages.reactions_month),"on the 30 days' messages")]),a("h3",{},"Messages per day"),je(e)]),B("Accounts",[a("div",{class:"tiles"},[d("Accounts",l.format(e.accounts.total)),d("New, 7 days",l.format(e.accounts.new_week)),d("Moderators",l.format(e.accounts.moderators)),d("Banned",l.format(e.accounts.banned))])]),te?Ve(te):null],v=[...w.querySelectorAll("details")].map(f=>f.open);U(w);for(let f of h)f&&w.append(f);w.querySelectorAll("details").forEach((f,E)=>{f.open=!!v[E]}),ne&&w.querySelector(".seg [aria-pressed='true']")?.focus(),ne=!1,re.textContent=`Updated ${new Date(t).toLocaleTimeString()}`}function qe(){document.title="Page not found",U(w),w.append(a("section",{class:"card missing"},[a("h2",{},"Page not found"),a("p",{},"There is no such page, or you can't see it."),a("a",{href:"/"},"Back to the app")])),re.textContent=""}var se=0;async function ce(){clearTimeout(se);let[e,t]=await Promise.all([Ue(),Ye()]);if(e==="denied")return qe();te=t,e?ie(e):re.textContent=O?`Couldn't refresh: showing ${new Date(O.at).toLocaleTimeString()}`:"Couldn't load. Retrying\u2026",document.hidden||(se=window.setTimeout(ce,We))}ge(he());var xe=w.clientWidth,Te=0;addEventListener("resize",()=>{clearTimeout(Te),Te=window.setTimeout(()=>{!O||Math.abs(w.clientWidth-xe)<8||(xe=w.clientWidth,ie(O))},150)});document.addEventListener("visibilitychange",()=>{document.hidden?clearTimeout(se):ce()});ce();
|
|
2
|
+
//# sourceMappingURL=stats-Y3LIXAZR.js.map
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../web/src/dom.ts", "../../web/src/strings/stats-main.ts", "../../web/src/theme.ts", "../../web/src/strings/stats-data.ts", "../../web/src/stats/data.ts", "../../web/src/stats/main.ts"],
|
|
4
|
+
"sourcesContent": ["// Minimal DOM helpers (\u00A77.3). Strings always become text nodes: there is no HTML parsing anywhere.\n\nexport type Child = Node | string | number | null | undefined | false;\n\ntype Listeners = { [K in keyof HTMLElementEventMap]?: (ev: HTMLElementEventMap[K]) => void };\n\nexport interface Attrs {\n class?: string;\n dataset?: Record<string, string>;\n on?: Listeners;\n /** Removes every `on` listener when aborted. */\n signal?: AbortSignal;\n value?: string;\n checked?: boolean;\n [attr: string]: unknown;\n}\n\nconst PROPS = new Set([\"value\", \"checked\"]);\n\nexport function h<K extends keyof HTMLElementTagNameMap>(tag: K, attrs: Attrs = {}, children?: Child | Child[]): HTMLElementTagNameMap[K] {\n const el = document.createElement(tag);\n const { class: cls, dataset, on: listeners, signal, ...rest } = attrs;\n if (cls) el.className = cls;\n if (dataset) Object.assign(el.dataset, dataset);\n for (const [name, v] of Object.entries(rest)) {\n if (v === undefined || v === null || v === false) continue;\n if (PROPS.has(name)) (el as unknown as Record<string, unknown>)[name] = v;\n else el.setAttribute(name, v === true ? \"\" : String(v));\n }\n if (listeners) {\n for (const [type, fn] of Object.entries(listeners)) {\n el.addEventListener(type, fn as EventListener, signal ? { signal } : undefined);\n }\n }\n append(el, children);\n return el;\n}\n\nexport function append(el: Node, children: Child | Child[]): void {\n for (const c of Array.isArray(children) ? children : [children]) {\n if (c === null || c === undefined || c === false) continue;\n el.appendChild(typeof c === \"object\" ? c : document.createTextNode(String(c)));\n }\n}\n\nlet idSeq = 0;\n\n/** A document-unique id for label/aria wiring, e.g. uniqueId(\"room\") \u2192 \"room-3\". */\nexport function uniqueId(prefix: string): string {\n return `${prefix}-${++idSeq}`;\n}\n\nexport function clear(el: Element): void {\n el.replaceChildren();\n}\n\n/**\n * Make `parent`'s children exactly `nodes`, in order, moving only what differs (\u00A77.5: the message list is\n * never fully re-rendered). Nodes already in place keep their identity, focus and scroll anchoring.\n */\nexport function reconcile(parent: Element, nodes: readonly Node[]): void {\n // Drop what goes first: a replaced node left in place would push every node after it down one, and each of them\n // would then be moved (re-inserted, restyled) instead of left alone.\n const keep = new Set(nodes);\n for (const c of [...parent.childNodes]) if (!keep.has(c)) c.remove();\n nodes.forEach((node, i) => {\n const at = parent.childNodes[i];\n if (at !== node) parent.insertBefore(node, at ?? null);\n });\n}\n\n/**\n * Keep what is typed while a lazy chunk loads (a search field that isn't there yet), for the field once it shows:\n * printable keys and Backspace, not shortcuts, and Enter after some text (as \"\\n\": a name typed and Enter pressed before\n * the field showed went nowhere, QA BUG-272). `take()` stops holding and says what was typed (QA BUG-243, BUG-252).\n */\nexport function holdKeys(signal: AbortSignal): { take(): string } {\n let early = \"\";\n const hold = (e: KeyboardEvent) => {\n if (e.ctrlKey || e.metaKey || e.altKey || e.isComposing) return;\n if (e.key === \"Enter\") {\n if (!early.replace(/\\n/g, \"\")) return;\n early += \"\\n\";\n } else if (e.key.length !== 1 && e.key !== \"Backspace\") return;\n else early = e.key === \"Backspace\" ? early.slice(0, -1) : early + e.key;\n e.preventDefault();\n };\n document.addEventListener(\"keydown\", hold, { capture: true, signal });\n return {\n take() {\n document.removeEventListener(\"keydown\", hold, true);\n return early;\n },\n };\n}\n\n/** Put `text` held by holdKeys() in `input`, as if typed there: its characters, then Enter if one was pressed. */\nexport function typeInto(input: HTMLInputElement | null | undefined, text: string): void {\n if (!text || !input) return;\n const chars = text.replace(/\\n/g, \"\");\n if (chars) {\n input.value += chars;\n input.dispatchEvent(new Event(\"input\", { bubbles: true }));\n }\n if (text.includes(\"\\n\")) input.dispatchEvent(new KeyboardEvent(\"keydown\", { key: \"Enter\", bubbles: true, cancelable: true }));\n}\n\n/**\n * A click on an open modal dialog's backdrop (outside its box) closes it, as Escape does: through a cancelable\n * \"cancel\" event, so a dialog that refuses Escape (busy saving, or closing its people search first) does the same\n * here. Both the press and the release must be outside, so a drag that selects text inside and ends outside doesn't\n * close it. One listener for every dialog, installed once by app.ts: the dialogs are in lazy chunks.\n */\nexport function closeDialogsOnBackdrop(): void {\n const outside = (e: MouseEvent): HTMLDialogElement | null => {\n const d = e.target;\n if (!(d instanceof HTMLDialogElement) || !d.open) return null;\n const r = d.getBoundingClientRect();\n return e.clientX < r.left || e.clientX > r.right || e.clientY < r.top || e.clientY > r.bottom ? d : null;\n };\n let pressed: HTMLDialogElement | null = null;\n document.addEventListener(\"pointerdown\", (e) => (pressed = outside(e)), true);\n document.addEventListener(\n \"click\",\n (e) => {\n const d = outside(e);\n const was = pressed;\n pressed = null;\n if (!d || d !== was) return;\n if (d.dispatchEvent(new Event(\"cancel\", { cancelable: true }))) d.close();\n },\n true,\n );\n}\n", "// The user-facing text of stats/main.ts (docs/REFACTOR.md item 56): one module per source file, so a lazy\n// screen's text stays in its own chunk. Copy changes here; a translation would replace these.\n\nexport const SHOW_AS_A_TABLE = \"Show as a table\";\nexport const TELEGRAM = \"Telegram\";\nexport const LINKED_INSTANCES = \"Linked instances\";\nexport const LINK_PREVIEWS = \"Link previews\";\nexport const THUMBNAILS_TO_MAKE = \"Thumbnails to make\";\nexport const VIDEO_SHAPES_TO_READ = \"Video shapes to read\";\nexport const FILES_TO_MOVE = \"Files to move\";\nexport const STORAGE_TO_CLEAN_UP = \"Storage to clean up\";\nexport const ACCOUNT_JOBS = \"Exports and deleted accounts\";\nexport const MEDIA = \"Media\";\nexport const DAILY_PRUNE = \"Daily prune\";\nexport const SERVER = \"Server\";\nexport const chirklePocketbase = (version: string | number, pocketbase: string | number) => `Chirkle ${version}, PocketBase ${pocketbase}`;\nexport const UP_FOR = \"Up for\";\nexport const CONNECTIONS = \"Connections\";\nexport const LIVE_EVENTS_WAITING = \"Live events waiting\";\nexport const DATABASE = \"Database\";\nexport const MEMORY = \"Memory\";\nexport const QUEUES = \"Queues\";\nexport const ROWS_WAITING_FOR_A_WORKER = \"Rows waiting for a worker\";\nexport const OLDEST = \"Oldest\";\nexport const FAILED_ONCE_OR_MORE = \"Failed once or more\";\nexport const ROWS = \"Rows\";\nexport const QUEUE = \"Queue\";\nexport const WORKERS = \"Workers\";\nexport const WHEN_EACH_WORKER_LAST_DID_ITS = \"When each worker last did its work\";\nexport const LAST_ERROR = \"Last error\";\nexport const LAST_PASS = \"Last pass\";\nexport const WORKER = \"Worker\";\nexport const ONLY_SUPERUSERS_SEE_THIS_ALSO_AT =\n \"Only superusers see this. Also at /api/chat/metrics, in Prometheus's format with ?format=prometheus.\";\nexport const peopleOnlineOverTheLast = (day: boolean) => `People online over the last ${day ? \"24 hours\" : \"7 days\"}`;\nexport const NOT_RECORDED = \"Not recorded.\";\nexport const NO_SAMPLES_YET_ONE_IS_TAKEN = \"No samples yet: one is taken every 5 minutes.\";\nexport const RANGE = \"Range\";\nexport const MOST_PEOPLE_ONLINE_BY_DAY = \"Most people online, by day\";\nexport const MOST_PEOPLE_ONLINE_BY_HOUR = \"Most people online, by hour\";\nexport const PEOPLE = \"People\";\nexport const HOUR = \"Hour\";\nexport const MESSAGES_PER_DAY_THE_LAST_30 = \"Messages per day, the last 30 days\";\nexport const TODAY = \"Today\";\nexport const MESSAGES_PER_DAY = \"Messages per day\";\nexport const PEOPLE_WHO_POSTED = \"People who posted\";\nexport const MESSAGES = \"Messages\";\nexport const RECORDING_IS_OFF_SITE_SETTINGS_NO =\n \"Recording is off (site settings: no_stats). Live numbers and messages are still shown; what was recorded before is dropped as it ages.\";\nexport const PEOPLE_ONLINE = \"People online\";\nexport const ON_THE_WEB = \"On the web\";\nexport const ON_ANDROID = \"On Android\";\nexport const GUESTS = \"Guests\";\nexport const PEAK_TODAY = \"Peak today\";\nexport const PEAK_7_DAYS = \"Peak, 7 days\";\nexport const USAGE = \"Usage\";\nexport const ACTIVE_24_HOURS = \"Active, 24 hours\";\nexport const ACTIVE_7_DAYS = \"Active, 7 days\";\nexport const ACTIVE_30_DAYS = \"Active, 30 days\";\nexport const TIME_ONLINE_TODAY = \"Time online today\";\nexport const TIME_ONLINE_7_DAYS = \"Time online, 7 days\";\nexport const PER_ACTIVE_PERSON = \"Per active person\";\nexport const ACTIVE_ONLINE_AT_LEAST_ONCE_TIME = \"Active: online at least once. Time online is counted every 5 minutes.\";\nexport const IN_DMS = \"In DMs\";\nexport const FILES_SENT = \"Files sent\";\nexport const REACTIONS = \"Reactions\";\nexport const ACCOUNTS = \"Accounts\";\nexport const NEW_7_DAYS = \"New, 7 days\";\nexport const MODERATORS = \"Moderators\";\nexport const BANNED = \"Banned\";\nexport const updated = (time: string | number) => `Updated ${time}`;\nexport const PAGE_NOT_FOUND = \"Page not found\";\nexport const THERE_IS_NO_SUCH_PAGE_OR = \"There is no such page, or you can't see it.\";\nexport const BACK_TO_THE_APP = \"Back to the app\";\nexport const COULDNT_LOAD_RETRYING = \"Couldn't load. Retrying\u2026\";\nexport const couldntRefreshShowing = (time: string | number) => `Couldn't refresh: showing ${time}`;\nexport const TIP_ONLINE = \"people online\";\nexport const TIP_WEB = \"on the web\";\nexport const TIP_ANDROID = \"on Android\";\nexport const TIP_GUESTS = \"guests\";\nexport const tipMessages = (n: number) => (n === 1 ? \"message\" : \"messages\");\nexport const tipPosted = (n: number) => (n === 1 ? \"person posted\" : \"people posted\");\nexport const GUESTS_NOTE = \"open tabs, not signed in\";\nexport const at = (time: string) => `at ${time}`;\nexport const ALL_PEOPLE = \"all people together\";\nexport const WEEK_AVERAGE = \"a week, on average\";\nexport const running = (busy: boolean) => (busy ? \" (running)\" : \"\");\nexport const REALTIME_INCL_GUESTS = \"realtime, incl. guests\";\nexport const slowClientsDroppedSinceTheStart = (n: number, shown: string) =>\n `${shown} slow ${n === 1 ? \"client\" : \"clients\"} dropped since the start`;\nexport const logs = (size: string | number) => `logs ${size}`;\nexport const fromTheSystem = (size: string | number) => `${size} from the system`;\nexport const ofAccounts = (percent: string | number) => `${percent} of accounts`;\nexport const peoplePosted = (n: number, shown: string) => `${shown} ${n === 1 ? \"person\" : \"people\"} posted`;\nexport const HOURS_24 = \"24 hours\";\nexport const DAYS_7 = \"7 days\";\nexport const DAYS_30 = \"30 days\";\nexport const OF_THE_30_DAYS = \"of the 30 days'\";\nexport const ON_THE_30_DAYS_MESSAGES = \"on the 30 days' messages\";\nexport const DAY = \"Day\";\nexport const NOW = \"Now\";\n", "// Light, dark or the system's (auto) theme (\u00A77.8): this device's choice, kept in localStorage. index.html's inline\n// script sets <html data-theme> before the first paint; this keeps it, and the browser's bar color, up to date.\n\nexport const THEMES = [\"auto\", \"light\", \"dark\"] as const;\nexport type Theme = (typeof THEMES)[number];\n\n/** Must match index.html's inline script. */\nexport const THEME_KEY = \"chat.theme\";\n\n/** --surface of each theme (tokens.css), for <meta name=\"theme-color\">. */\nconst BAR = { light: \"#ffffff\", dark: \"#111214\" } as const;\n\nfunction safeLocalStorage(): Storage | null {\n try {\n return globalThis.localStorage ?? null;\n } catch {\n return null;\n }\n}\n\nexport function savedTheme(storage: Storage | null = safeLocalStorage()): Theme {\n try {\n const v = storage?.getItem(THEME_KEY);\n return v === \"light\" || v === \"dark\" ? v : \"auto\";\n } catch {\n return \"auto\";\n }\n}\n\n/** Show `theme` here: the stylesheet goes by <html data-theme>, the browser's bar by the theme-color metas. */\nexport function applyTheme(theme: Theme, doc: Document = document): void {\n const html = doc.documentElement;\n if (theme === \"auto\") delete html.dataset.theme;\n else html.dataset.theme = theme;\n for (const meta of doc.querySelectorAll<HTMLMetaElement>('meta[name=\"theme-color\"]')) {\n // Each meta's own media query says which theme it is for; a chosen theme gives both its color.\n const forTheme = meta.media.includes(\"dark\") ? \"dark\" : \"light\";\n meta.content = BAR[theme === \"auto\" ? forTheme : theme];\n }\n}\n\n/** Save and show `theme`. Storage can throw (private window, quota): the theme still changes for this page. */\nexport function setTheme(theme: Theme, storage: Storage | null = safeLocalStorage()): void {\n try {\n if (theme === \"auto\") storage?.removeItem(THEME_KEY);\n else storage?.setItem(THEME_KEY, theme);\n } catch {}\n applyTheme(theme);\n}\n\n/** Apply the saved theme and text size and follow another tab's changes. Returns a function that stops following. */\nexport function startTheme(storage: Storage | null = safeLocalStorage()): () => void {\n applyTheme(savedTheme(storage));\n applySize(savedSize(storage));\n const ac = new AbortController();\n addEventListener(\n \"storage\",\n (e) => {\n if (e.key === THEME_KEY || e.key === null) applyTheme(savedTheme(storage));\n if (e.key === SIZE_KEY || e.key === null) applySize(savedSize(storage));\n },\n { signal: ac.signal },\n );\n return () => ac.abort();\n}\n\n// Text size (\u00A77.8): Small (the default), Medium or Large, this device's choice like the theme. index.html's inline\n// script sets <html data-size> before the first paint; the stylesheet scales the root font size by it.\n\nexport const SIZES = [\"small\", \"medium\", \"large\"] as const;\nexport type Size = (typeof SIZES)[number];\n\n/** Must match index.html's inline script. */\nexport const SIZE_KEY = \"chat.size\";\n\nexport function savedSize(storage: Storage | null = safeLocalStorage()): Size {\n try {\n const v = storage?.getItem(SIZE_KEY);\n return v === \"medium\" || v === \"large\" ? v : \"small\";\n } catch {\n return \"small\";\n }\n}\n\nexport function applySize(size: Size, doc: Document = document): void {\n const html = doc.documentElement;\n if (size === \"small\") delete html.dataset.size;\n else html.dataset.size = size;\n}\n\n/** Save and show `size`. Storage can throw: the size still changes for this page. */\nexport function setSize(size: Size, storage: Storage | null = safeLocalStorage()): void {\n try {\n if (size === \"small\") storage?.removeItem(SIZE_KEY);\n else storage?.setItem(SIZE_KEY, size);\n } catch {}\n applySize(size);\n}\n", "// The user-facing text of stats/data.ts (docs/REFACTOR.md item 56): one module per source file, so a lazy\n// screen's text stays in its own chunk. Copy changes here; a translation would replace these.\n\nexport const min = (n: number) => `${n} min`;\nexport const hours = (n: string) => `${n} h`;\nexport const sec = (n: number) => `${n} s`;\nexport const days = (n: number) => `${n} d`;\nexport const ago = (span: string) => `${span} ago`;\nexport const NOT_SINCE_START = \"not since the start\";\n", "import * as S from \"../strings/stats-data.ts\";\n// Usage statistics (DESIGN.md \u00A740): what GET /api/chat/stats answers, and the figures the page works out from it.\n// Pure, so tests/unit can check them.\n\n/** A sample: [time (epoch ms), people online, guests, people on the web, people on Android]. */\nexport type Sample = [number, number, number, number, number];\n\nexport interface Stats {\n at: number;\n /** Recording (samples, activity) is on: site.no_stats isn't ticked. */\n history: boolean;\n sample_minutes: number;\n now: { online: number; guests: number; web: number; android: number };\n /** Accounts online in the last 24 hours, 7 days and 30 days. */\n active: { day: number; week: number; month: number };\n accounts: { total: number; new_week: number; moderators: number; banned: number };\n messages: {\n /** The viewer's days (YYYY-MM-DD) with any messages, the last 30. */\n days: { day: string; messages: number; people: number }[];\n people_week: number;\n people_month: number;\n dms_month: number;\n files_month: number;\n reactions_month: number;\n };\n /** The last 7 days', oldest first. */\n samples: Sample[];\n}\n\nexport const DAY_MS = 86_400_000;\n\n/** `t`'s day in this browser's time zone, as YYYY-MM-DD. */\nexport function dayKey(t: number): string {\n const d = new Date(t);\n return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, \"0\")}-${String(d.getDate()).padStart(2, \"0\")}`;\n}\n\n/** Midnight today in this browser's time zone, `back` days before it. */\nexport function midnight(now: number, back = 0): number {\n const d = new Date(now);\n d.setHours(0, 0, 0, 0);\n d.setDate(d.getDate() - back);\n return d.getTime();\n}\n\n/** The last `n` days, oldest first, each with its messages and posters (none for a day without). */\nexport function lastDays(days: Stats[\"messages\"][\"days\"], now: number, n = 30): { day: string; messages: number; people: number }[] {\n const by = new Map(days.map((d) => [d.day, d]));\n const out = [];\n for (let i = n - 1; i >= 0; i--) {\n const day = dayKey(midnight(now, i) + 12 * 3_600_000); // noon: safe across a DST change\n const d = by.get(day);\n out.push({ day, messages: d?.messages ?? 0, people: d?.people ?? 0 });\n }\n return out;\n}\n\n/** Person-hours online since `from`: each sample stands for its interval. */\nexport function personHours(samples: readonly Sample[], from: number, minutes: number): number {\n let sum = 0;\n for (const s of samples) if (s[0] >= from) sum += s[1];\n return (sum * minutes) / 60;\n}\n\n/** The most people online at once since `from`, and when (the first time it was reached); null without samples. */\nexport function peak(samples: readonly Sample[], from: number): { online: number; at: number } | null {\n let best: { online: number; at: number } | null = null;\n for (const s of samples) if (s[0] >= from && (!best || s[1] > best.online)) best = { online: s[1], at: s[0] };\n // Nobody at any time: no time to name (it said \"0 at 02:45 AM\", QA BUG-263).\n return best && !best.online ? { online: 0, at: 0 } : best;\n}\n\n/**\n * The samples since `from` as runs of a line: a gap longer than two intervals (the server was down, or recording was\n * off) ends a run, so the chart doesn't draw a line across it.\n */\nexport function runs(samples: readonly Sample[], from: number, minutes: number): Sample[][] {\n const out: Sample[][] = [];\n let run: Sample[] = [];\n let last = -Infinity;\n for (const s of samples) {\n if (s[0] < from) continue;\n if (s[0] - last > 2 * minutes * 60_000 && run.length) {\n out.push(run);\n run = [];\n }\n run.push(s);\n last = s[0];\n }\n if (run.length) out.push(run);\n return out;\n}\n\n/** A tidy top for an axis from 0: 1, 2 or 5 times a power of ten, at least `max` (and at least `min`). */\nexport function niceMax(max: number, min = 4): number {\n const v = Math.max(max, min);\n const p = 10 ** Math.floor(Math.log10(v));\n for (const m of [1, 2, 5, 10]) if (m * p >= v) return m * p;\n return 10 * p;\n}\n\n/** \"1.5 h\", \"40 min\", \"12 h\": person-time for a tile. */\nexport function formatHours(h: number): string {\n if (h < 1) return `${Math.round(h * 60)} min`;\n if (h < 10) return S.hours((Math.round(h * 10) / 10).toLocaleString());\n return `${Math.round(h).toLocaleString()} h`;\n}\n\n/** `part` of `whole` as a whole percent (\"\u2013\" with nothing to divide). */\nexport function percent(part: number, whole: number): string {\n return whole > 0 ? `${Math.round((part / whole) * 100)}%` : \"\u2013\";\n}\n\n/** What GET /api/chat/metrics answers a superuser (REFACTOR item 51, server/metrics.go). */\nexport interface Metrics {\n at: string;\n version: string;\n pocketbase: string;\n uptime_seconds: number;\n queues: Record<string, { rows: number; failing: number; oldest_seconds: number }>;\n /** last_pass, last_error_at: RFC 3339, \"\" for not since the start. */\n workers: Record<string, { last_pass: string; last_error: string; last_error_at: string; running: boolean }>;\n realtime: { clients: number; senders: number; queued: number; dropped: number };\n db: Record<string, number>;\n process: { goroutines: number; heap_bytes: number; sys_bytes: number; gc_runs: number };\n}\n\n/** \"12 KB\", \"3.4 MB\", \"1.2 GB\". */\nexport function formatBytes(n: number): string {\n const units = [\"B\", \"KB\", \"MB\", \"GB\", \"TB\"];\n let i = 0;\n while (n >= 1024 && i < units.length - 1) {\n n /= 1024;\n i++;\n }\n return `${i && n < 10 ? (Math.round(n * 10) / 10).toLocaleString() : Math.round(n).toLocaleString()} ${units[i]}`;\n}\n\n/** A span of seconds, short: \"40 s\", \"12 min\", \"5 h\", \"3 d\". */\nexport function formatSpan(s: number): string {\n if (s < 60) return `${Math.round(s)} s`;\n if (s < 3600) return S.min(Math.round(s / 60));\n if (s < 86_400) return S.hours(String(Math.round(s / 3600)));\n return S.days(Math.round(s / 86_400));\n}\n\n/** How long before `now` (epoch ms) an RFC 3339 time was, \"12 min ago\"; `never` when there is none. */\nexport function ago(at: string, now: number, never = \"not since the start\"): string {\n const t = Date.parse(at);\n return at && !Number.isNaN(t) ? S.ago(formatSpan(Math.max(0, (now - t) / 1000))) : never;\n}\n", "// The usage statistics page (DESIGN.md \u00A740), /stats: a page of its own (stats.html), not the app's. It asks\n// GET /api/chat/stats with the session this browser has: the app's (a moderator), else the admin UI's (a superuser,\n// signed in at /_/ on this server). Anyone else is told there is no such page. Counts only; refreshed every 30 s\n// while the tab is visible. A superuser also sees the server's state (GET /api/chat/metrics, REFACTOR item 51).\n\nimport { type Child, clear, h } from \"../dom.ts\";\nimport * as S from \"../strings/stats-main.ts\";\nimport { applyTheme, savedTheme } from \"../theme.ts\";\nimport {\n ago,\n DAY_MS,\n formatBytes,\n formatHours,\n formatSpan,\n lastDays,\n type Metrics,\n midnight,\n niceMax,\n peak,\n percent,\n personHours,\n runs,\n type Sample,\n type Stats,\n} from \"./data.ts\";\n\nconst REFRESH_MS = 30_000;\n/** The app's session (web/src/pb.ts), and PocketBase's admin UI's (0.40: \"__pb_superusers__\" + its base path). */\nconst SESSIONS = [\"pocketbase_auth\", \"__pb_superusers__/_\"];\nconst SVG = \"http://www.w3.org/2000/svg\";\n\nconst root = document.getElementById(\"stats\") as HTMLElement;\nconst updated = document.getElementById(\"stats-updated\") as HTMLElement;\nconst num = new Intl.NumberFormat();\nconst time = new Intl.DateTimeFormat(undefined, { hour: \"2-digit\", minute: \"2-digit\" });\nconst dayTime = new Intl.DateTimeFormat(undefined, { weekday: \"short\", hour: \"2-digit\", minute: \"2-digit\" });\nconst dayName = new Intl.DateTimeFormat(undefined, { weekday: \"short\", day: \"numeric\", month: \"short\" });\nconst shortDay = new Intl.DateTimeFormat(undefined, { day: \"numeric\", month: \"short\" });\n\nlet range: \"day\" | \"week\" = \"day\";\nlet last: Stats | null = null;\nlet metrics: Metrics | null = null;\nlet refocus = false;\n\n/** The stored sessions' tokens; `superusers`: only superusers' (QA BUG-275: a moderator was refused the metrics every 30 s). */\nfunction tokens(superusers = false): string[] {\n const out: string[] = [];\n for (const key of SESSIONS) {\n try {\n const session = JSON.parse(localStorage.getItem(key) || \"{}\");\n const token = session?.token;\n if (superusers && session?.record?.collectionName !== \"_superusers\") continue;\n if (typeof token === \"string\" && token) out.push(token);\n } catch {}\n }\n return out;\n}\n\n/** The statistics, with the first session that may see them; \"denied\" when none may; null when it failed. */\nasync function load(): Promise<Stats | \"denied\" | null> {\n const tz = -new Date().getTimezoneOffset();\n for (const token of tokens()) {\n try {\n const res = await fetch(`/api/chat/stats?tz=${tz}`, { headers: { Authorization: token } });\n if (res.ok) return (await res.json()) as Stats;\n if (res.status !== 401 && res.status !== 403) return null;\n } catch {\n return null;\n }\n }\n return \"denied\";\n}\n\n/** The server's metrics, for a superuser's session; null for anyone else, or when they couldn't be had. */\nasync function loadMetrics(): Promise<Metrics | null> {\n for (const token of tokens(true)) {\n try {\n const res = await fetch(\"/api/chat/metrics\", { headers: { Authorization: token, Accept: \"application/json\" } });\n if (res.ok) return (await res.json()) as Metrics;\n } catch {\n return null;\n }\n }\n return null;\n}\n\n// ---- pieces ----\n\nfunction tile(label: string, value: string, note?: string, big = false): HTMLElement {\n return h(\"div\", { class: big ? \"tile big\" : \"tile\" }, [\n h(\"div\", { class: \"tile-label\" }, label),\n h(\"div\", { class: \"tile-value\" }, value),\n note ? h(\"div\", { class: \"tile-note\" }, note) : null,\n ]);\n}\n\nfunction section(title: string, children: Child[], hint?: string): HTMLElement {\n return h(\"section\", { class: \"card\" }, [h(\"h2\", {}, title), hint ? h(\"p\", { class: \"hint\" }, hint) : null, ...children]);\n}\n\nfunction svg<K extends keyof SVGElementTagNameMap>(tag: K, attrs: Record<string, string | number> = {}): SVGElementTagNameMap[K] {\n const el = document.createElementNS(SVG, tag);\n for (const [k, v] of Object.entries(attrs)) el.setAttribute(k, String(v));\n return el;\n}\n\n/** A table of the chart's numbers, folded away: the values without hovering. */\nfunction table(caption: string, head: string[], rows: (string | number)[][]): HTMLElement {\n return h(\"details\", { class: \"chart-table\" }, [h(\"summary\", {}, \"Show as a table\"), grid(caption, head, rows)]);\n}\n\nfunction grid(caption: string, head: string[], rows: (string | number)[][]): HTMLElement {\n return h(\"table\", {}, [\n h(\"caption\", {}, caption),\n h(\n \"thead\",\n {},\n h(\n \"tr\",\n {},\n head.map((c) => h(\"th\", { scope: \"col\" }, c)),\n ),\n ),\n h(\n \"tbody\",\n {},\n rows.map((r) =>\n h(\n \"tr\",\n {},\n r.map((c, i) => (i ? h(\"td\", {}, typeof c === \"number\" ? num.format(c) : c) : h(\"th\", { scope: \"row\" }, String(c)))),\n ),\n ),\n ),\n ]);\n}\n\n/** The queues' and workers' names as people read them. */\nconst LABELS: Record<string, string> = {\n telegram: \"Telegram\",\n federation: \"Linked instances\",\n link_previews: \"Link previews\",\n media_thumbs: \"Thumbnails to make\",\n media_sizes: \"Video shapes to read\",\n media_moves: \"Files to move\",\n storage_cleanup: \"Storage to clean up\",\n account_jobs: \"Exports and deleted accounts\",\n account: \"Exports and deleted accounts\",\n previews: \"Link previews\",\n media: \"Media\",\n retention: \"Daily prune\",\n};\nconst named = (k: string) => LABELS[k] ?? k;\n\n/** The server's state, for a superuser (GET /api/chat/metrics). */\nfunction serverSection(m: Metrics): HTMLElement {\n const now = Date.parse(m.at) || Date.now();\n const db = (m.db[\"data.db\"] ?? 0) + (m.db[\"data.db-wal\"] ?? 0);\n const logs = (m.db[\"auxiliary.db\"] ?? 0) + (m.db[\"auxiliary.db-wal\"] ?? 0);\n const queues = Object.entries(m.queues).sort(([a], [b]) => named(a).localeCompare(named(b)));\n const workers = Object.entries(m.workers).sort(([a], [b]) => named(a).localeCompare(named(b)));\n return section(\n \"Server\",\n [\n h(\"div\", { class: \"tiles\" }, [\n tile(\"Up for\", formatSpan(m.uptime_seconds), `Chirkle ${m.version}, PocketBase ${m.pocketbase}`),\n tile(\"Connections\", num.format(m.realtime.clients), \"realtime, incl. guests\"),\n tile(\n \"Live events waiting\",\n num.format(m.realtime.queued),\n S.slowClientsDroppedSinceTheStart(m.realtime.dropped, num.format(m.realtime.dropped)),\n ),\n tile(\"Database\", formatBytes(db), `logs ${formatBytes(logs)}`),\n tile(\"Memory\", formatBytes(m.process.heap_bytes), `${formatBytes(m.process.sys_bytes)} from the system`),\n ]),\n h(\"h3\", {}, \"Queues\"),\n h(\n \"div\",\n { class: \"chart-table\" },\n grid(\n \"Rows waiting for a worker\",\n [\"Queue\", \"Rows\", \"Failed once or more\", \"Oldest\"],\n queues.map(([k, q]) => [named(k), q.rows, q.failing, q.rows ? formatSpan(q.oldest_seconds) : \"\u2013\"]),\n ),\n ),\n h(\"h3\", {}, \"Workers\"),\n h(\n \"div\",\n { class: \"chart-table\" },\n grid(\n \"When each worker last did its work\",\n [\"Worker\", \"Last pass\", \"Last error\"],\n workers.map(([k, w]) => [\n named(k),\n `${ago(w.last_pass, now)}${S.running(w.running)}`,\n w.last_error ? `${w.last_error} (${ago(w.last_error_at, now)})` : \"\u2013\",\n ]),\n ),\n ),\n ],\n \"Only superusers see this. Also at /api/chat/metrics, in Prometheus's format with ?format=prometheus.\",\n );\n}\n\n// The charts are drawn at their box's own width (set by render), so their text stays its size on a phone.\nlet W = 720;\nlet H = 220;\n/** Narrow: fewer labels along the bottom. */\nconst narrow = () => W < 520;\nconst PAD = { top: 12, right: 12, bottom: 26, left: 36 };\n\n/** Gridlines and y labels at 0, half (when a whole number) and the top. */\nfunction yAxis(g: SVGGElement, top: number) {\n for (const v of [0, top / 2, top].filter(Number.isInteger)) {\n const y = PAD.top + (H - PAD.top - PAD.bottom) * (1 - v / top);\n g.append(svg(\"line\", { x1: PAD.left, x2: W - PAD.right, y1: y, y2: y, class: \"grid\" }));\n const t = svg(\"text\", { x: PAD.left - 6, y: y + 4, \"text-anchor\": \"end\", class: \"axis\" });\n t.textContent = num.format(v);\n g.append(t);\n }\n}\n\n/** A label along the bottom at `x`; near an edge it is anchored inward, so it isn't cut off. */\nfunction xLabel(g: SVGGElement, x: number, text: string) {\n const anchor = x > W - PAD.right - 32 ? \"end\" : x < PAD.left + 32 ? \"start\" : \"middle\";\n const t = svg(\"text\", { x: anchor === \"end\" ? Math.min(x + 6, W - 2) : x, y: H - 8, \"text-anchor\": anchor, class: \"axis\" });\n t.textContent = text;\n g.append(t);\n}\n\n/** The tooltip of a chart, placed over its box at `x` (0..1 of the width). */\nfunction tooltip(box: HTMLElement) {\n const tip = h(\"div\", { class: \"tip\", role: \"status\", hidden: true });\n box.append(tip);\n return {\n show(x: number, lines: [string, string][], title: string) {\n clear(tip);\n tip.append(h(\"div\", { class: \"tip-title\" }, title));\n for (const [value, label] of lines) tip.append(h(\"div\", {}, [h(\"strong\", {}, value), ` ${label}`]));\n tip.hidden = false;\n const left = Math.min(Math.max(x * box.clientWidth, tip.offsetWidth / 2 + 4), box.clientWidth - tip.offsetWidth / 2 - 4);\n tip.style.left = `${left}px`;\n },\n hide() {\n tip.hidden = true;\n },\n };\n}\n\n/** People online over the last 24 hours or 7 days: a line with a light area under it, and a crosshair. */\nfunction onlineChart(s: Stats): HTMLElement {\n const now = s.at;\n const from = now - (range === \"day\" ? DAY_MS : 7 * DAY_MS);\n const parts = runs(s.samples, from, s.sample_minutes);\n const shown = parts.flat();\n const top = niceMax(Math.max(0, ...shown.map((x) => x[1])));\n const plotW = W - PAD.left - PAD.right;\n const plotH = H - PAD.top - PAD.bottom;\n const xOf = (t: number) => PAD.left + ((t - from) / (now - from)) * plotW;\n const yOf = (v: number) => PAD.top + plotH * (1 - v / top);\n\n const chart = svg(\"svg\", { viewBox: `0 0 ${W} ${H}`, class: \"chart\", role: \"img\" });\n chart.setAttribute(\"aria-label\", S.peopleOnlineOverTheLast(range === \"day\"));\n const g = svg(\"g\");\n chart.append(g);\n yAxis(g, top);\n // x labels: every 6 hours, or each day at midnight.\n const ticks: number[] = [];\n if (range === \"day\") {\n const first = Math.ceil(from / (6 * 3_600_000)) * 6 * 3_600_000;\n for (let t = first; t <= now; t += 6 * 3_600_000) ticks.push(t);\n } else {\n for (let i = 6; i >= 0; i--) if (!narrow() || i % 2 === 0) ticks.push(midnight(now, i));\n }\n for (const t of ticks) {\n // A tick at either edge goes unlabeled: its label would run off or into the next.\n if (t < from || xOf(t) > W - PAD.right - 28) continue;\n xLabel(g, xOf(t), range === \"day\" ? time.format(t) : shortDay.format(t));\n }\n const base = yOf(0);\n for (const run of parts) {\n const pts = run.map((x) => `${xOf(x[0]).toFixed(1)},${yOf(x[1]).toFixed(1)}`);\n if (run.length === 1) {\n g.append(svg(\"circle\", { cx: xOf(run[0]![0]), cy: yOf(run[0]![1]), r: 3, class: \"dot\" }));\n continue;\n }\n g.append(svg(\"polygon\", { points: `${xOf(run[0]![0])},${base} ${pts.join(\" \")} ${xOf(run.at(-1)![0])},${base}`, class: \"area\" }));\n g.append(svg(\"polyline\", { points: pts.join(\" \"), class: \"line\" }));\n }\n const cross = svg(\"line\", { y1: PAD.top, y2: base, class: \"cross\", visibility: \"hidden\" });\n const mark = svg(\"circle\", { r: 4.5, class: \"mark\", visibility: \"hidden\" });\n g.append(cross, mark);\n\n const box = h(\"div\", { class: \"chart-box\" }, [chart]);\n if (!shown.length) box.append(h(\"p\", { class: \"empty\" }, s.history ? \"No samples yet: one is taken every 5 minutes.\" : \"Not recorded.\"));\n const tip = tooltip(box);\n const nearest = (clientX: number): Sample | null => {\n const r = chart.getBoundingClientRect();\n const t = from + ((((clientX - r.left) / r.width) * W - PAD.left) / plotW) * (now - from);\n let best: Sample | null = null;\n for (const x of shown) if (!best || Math.abs(x[0] - t) < Math.abs(best[0] - t)) best = x;\n return best;\n };\n const show = (x: Sample | null) => {\n if (!x) return;\n const cx = xOf(x[0]);\n for (const el of [cross, mark]) el.setAttribute(\"visibility\", \"visible\");\n cross.setAttribute(\"x1\", String(cx));\n cross.setAttribute(\"x2\", String(cx));\n mark.setAttribute(\"cx\", String(cx));\n mark.setAttribute(\"cy\", String(yOf(x[1])));\n tip.show(\n cx / W,\n [\n [num.format(x[1]), \"people online\"],\n [num.format(x[3]), \"on the web\"],\n [num.format(x[4]), \"on Android\"],\n [num.format(x[2]), \"guests\"],\n ],\n (range === \"day\" ? time : dayTime).format(x[0]),\n );\n };\n const hide = () => {\n for (const el of [cross, mark]) el.setAttribute(\"visibility\", \"hidden\");\n tip.hide();\n };\n chart.addEventListener(\"pointermove\", (e) => show(nearest(e.clientX)));\n chart.addEventListener(\"pointerleave\", hide);\n // Keys: the chart takes focus, and \u2190 \u2192 step through the samples.\n let at = shown.length - 1;\n chart.setAttribute(\"tabindex\", \"0\");\n chart.addEventListener(\"focus\", () => show(shown[at] ?? null));\n chart.addEventListener(\"blur\", hide);\n chart.addEventListener(\"keydown\", (e) => {\n if (e.key !== \"ArrowLeft\" && e.key !== \"ArrowRight\") return;\n e.preventDefault();\n at = Math.max(0, Math.min(shown.length - 1, at + (e.key === \"ArrowLeft\" ? -1 : 1)));\n show(shown[at] ?? null);\n });\n\n // The table: hourly in the last 24 hours, else daily peaks.\n const rows: (string | number)[][] = [];\n if (range === \"day\") {\n for (let t = Math.floor(from / 3_600_000) * 3_600_000; t <= now; t += 3_600_000) {\n const p = peak(\n shown.filter((x) => x[0] < t + 3_600_000),\n t,\n );\n if (p) rows.push([time.format(t), p.online]);\n }\n } else {\n for (let i = 6; i >= 0; i--) {\n const start = midnight(now, i);\n const p = peak(\n shown.filter((x) => x[0] < start + DAY_MS),\n start,\n );\n if (p) rows.push([dayName.format(start), p.online]);\n }\n }\n\n const picker = h(\"div\", { class: \"seg\", role: \"group\", \"aria-label\": \"Range\" }, [\n rangeButton(\"day\", \"24 hours\"),\n rangeButton(\"week\", \"7 days\"),\n ]);\n return h(\"div\", {}, [\n picker,\n box,\n table(range === \"day\" ? \"Most people online, by hour\" : \"Most people online, by day\", [range === \"day\" ? \"Hour\" : \"Day\", \"People\"], rows),\n ]);\n}\n\nfunction rangeButton(value: typeof range, label: string): HTMLElement {\n return h(\n \"button\",\n {\n type: \"button\",\n \"aria-pressed\": String(range === value),\n on: {\n click: () => {\n range = value;\n refocus = true;\n if (last) render(last);\n },\n },\n },\n label,\n );\n}\n\n/** Messages per day, the last 30 days: columns, each with its tooltip. */\nfunction messagesChart(s: Stats): HTMLElement {\n const days = lastDays(s.messages.days, s.at);\n const top = niceMax(Math.max(0, ...days.map((d) => d.messages)));\n const plotW = W - PAD.left - PAD.right;\n const plotH = H - PAD.top - PAD.bottom;\n const slot = plotW / days.length;\n const bw = Math.min(16, slot - 2);\n const chart = svg(\"svg\", { viewBox: `0 0 ${W} ${H}`, class: \"chart\", role: \"img\" });\n chart.setAttribute(\"aria-label\", \"Messages per day, the last 30 days\");\n const g = svg(\"g\");\n chart.append(g);\n yAxis(g, top);\n const box = h(\"div\", { class: \"chart-box\" }, [chart]);\n const tip = tooltip(box);\n days.forEach((d, i) => {\n const x = PAD.left + i * slot + (slot - bw) / 2;\n const bh = (d.messages / top) * plotH;\n const y = PAD.top + plotH - bh;\n const r = Math.min(4, bw / 2, bh);\n // A column, rounded at the top, square at the baseline.\n if (bh > 0) {\n g.append(\n svg(\"path\", {\n d: `M${x},${y + bh}V${y + r}Q${x},${y} ${x + r},${y}H${x + bw - r}Q${x + bw},${y} ${x + bw},${y + r}V${y + bh}Z`,\n class: \"bar\",\n }),\n );\n }\n const date = new Date(`${d.day}T12:00:00`);\n const every = narrow() ? 10 : 5;\n if (i % every === every - 1 || i === days.length - 1) {\n xLabel(g, x + bw / 2, i === days.length - 1 ? \"Today\" : shortDay.format(date));\n }\n // The hit target: the whole slot, top to bottom.\n const hit = svg(\"rect\", { x: PAD.left + i * slot, y: PAD.top, width: slot, height: plotH, class: \"hit\" });\n const show = () =>\n tip.show(\n (x + bw / 2) / W,\n [\n [num.format(d.messages), S.tipMessages(d.messages)],\n [num.format(d.people), S.tipPosted(d.people)],\n ],\n dayName.format(date),\n );\n hit.addEventListener(\"pointerenter\", show);\n hit.addEventListener(\"pointerleave\", () => tip.hide());\n g.append(hit);\n });\n return h(\"div\", {}, [\n box,\n table(\n \"Messages per day\",\n [\"Day\", \"Messages\", \"People who posted\"],\n days.map((d) => [dayName.format(new Date(`${d.day}T12:00:00`)), d.messages, d.people]),\n ),\n ]);\n}\n\n// ---- the page ----\n\nfunction render(s: Stats) {\n last = s;\n // The card's inner width: the page's, less its padding and the card's.\n W = Math.round(Math.min(928, Math.max(280, root.clientWidth - 66)));\n H = narrow() ? 180 : 220;\n const now = s.at;\n const today = midnight(now);\n const days = lastDays(s.messages.days, now);\n const sum = (n: number) => days.slice(-n).reduce((a, d) => a + d.messages, 0);\n const month = sum(30);\n const peakToday = peak(s.samples, today);\n const peakWeek = peak(s.samples, now - 7 * DAY_MS);\n const hoursToday = personHours(s.samples, today, s.sample_minutes);\n const hoursWeek = personHours(s.samples, now - 7 * DAY_MS, s.sample_minutes);\n const recorded = (v: string) => (s.history || s.samples.length ? v : \"\u2013\");\n\n const sections = [\n !s.history ? h(\"p\", { class: \"notice\", role: \"note\" }, \"Recording is off (site settings: no_stats). Live numbers and messages are still shown; what was recorded before is dropped as it ages.\") : null,\n section(\"Now\", [\n h(\"div\", { class: \"tiles\" }, [\n tile(\"People online\", num.format(s.now.online), undefined, true),\n tile(\"On the web\", num.format(s.now.web)),\n tile(\"On Android\", num.format(s.now.android)),\n tile(\"Guests\", num.format(s.now.guests), \"open tabs, not signed in\"),\n tile(\n \"Peak today\",\n recorded(peakToday ? num.format(peakToday.online) : \"\u2013\"),\n peakToday?.at ? `at ${time.format(peakToday.at)}` : undefined,\n ),\n tile(\"Peak, 7 days\", recorded(peakWeek ? num.format(peakWeek.online) : \"\u2013\"), peakWeek?.at ? dayTime.format(peakWeek.at) : undefined),\n ]),\n ]),\n section(\n \"Usage\",\n [\n h(\"div\", { class: \"tiles\" }, [\n tile(\"Active, 24 hours\", num.format(s.active.day), `${percent(s.active.day, s.accounts.total)} of accounts`),\n tile(\"Active, 7 days\", num.format(s.active.week), `${percent(s.active.week, s.accounts.total)} of accounts`),\n tile(\"Active, 30 days\", num.format(s.active.month), `${percent(s.active.month, s.accounts.total)} of accounts`),\n tile(\"Time online today\", recorded(formatHours(hoursToday)), \"all people together\"),\n tile(\"Time online, 7 days\", recorded(formatHours(hoursWeek)), \"all people together\"),\n tile(\"Per active person\", recorded(s.active.week ? formatHours(hoursWeek / s.active.week) : \"\u2013\"), \"a week, on average\"),\n ]),\n h(\"h3\", {}, \"People online\"),\n onlineChart(s),\n ],\n \"Active: online at least once. Time online is counted every 5 minutes.\",\n ),\n section(\"Messages\", [\n h(\"div\", { class: \"tiles\" }, [\n tile(\"Today\", num.format(days.at(-1)?.messages ?? 0)),\n tile(\"7 days\", num.format(sum(7)), S.peoplePosted(s.messages.people_week, num.format(s.messages.people_week))),\n tile(\"30 days\", num.format(month), S.peoplePosted(s.messages.people_month, num.format(s.messages.people_month))),\n tile(\"In DMs\", percent(s.messages.dms_month, month), \"of the 30 days'\"),\n tile(\"Files sent\", num.format(s.messages.files_month), \"30 days\"),\n tile(\"Reactions\", num.format(s.messages.reactions_month), \"on the 30 days' messages\"),\n ]),\n h(\"h3\", {}, \"Messages per day\"),\n messagesChart(s),\n ]),\n section(\"Accounts\", [\n h(\"div\", { class: \"tiles\" }, [\n tile(\"Accounts\", num.format(s.accounts.total)),\n tile(\"New, 7 days\", num.format(s.accounts.new_week)),\n tile(\"Moderators\", num.format(s.accounts.moderators)),\n tile(\"Banned\", num.format(s.accounts.banned)),\n ]),\n ]),\n metrics ? serverSection(metrics) : null,\n ];\n // Keep the open tables open across a refresh.\n const open = [...root.querySelectorAll(\"details\")].map((d) => d.open);\n clear(root);\n for (const el of sections) if (el) root.append(el);\n root.querySelectorAll(\"details\").forEach((d, i) => {\n d.open = !!open[i];\n });\n // A range button was pressed: it is a new one now, focused as the old one was.\n if (refocus) root.querySelector<HTMLElement>(\".seg [aria-pressed='true']\")?.focus();\n refocus = false;\n updated.textContent = `Updated ${new Date(now).toLocaleTimeString()}`;\n}\n\nfunction denied() {\n document.title = \"Page not found\";\n clear(root);\n root.append(\n h(\"section\", { class: \"card missing\" }, [\n h(\"h2\", {}, \"Page not found\"),\n h(\"p\", {}, \"There is no such page, or you can't see it.\"),\n h(\"a\", { href: \"/\" }, \"Back to the app\"),\n ]),\n );\n updated.textContent = \"\";\n}\n\nlet timer = 0;\nasync function refresh() {\n clearTimeout(timer);\n const [got, m] = await Promise.all([load(), loadMetrics()]);\n if (got === \"denied\") return denied();\n metrics = m;\n if (got) render(got);\n else updated.textContent = last ? `Couldn't refresh: showing ${new Date(last.at).toLocaleTimeString()}` : \"Couldn't load. Retrying\u2026\";\n if (!document.hidden) timer = window.setTimeout(refresh, REFRESH_MS);\n}\n\napplyTheme(savedTheme());\nlet drawnFor = root.clientWidth;\nlet resizing = 0;\naddEventListener(\"resize\", () => {\n clearTimeout(resizing);\n resizing = window.setTimeout(() => {\n if (!last || Math.abs(root.clientWidth - drawnFor) < 8) return;\n drawnFor = root.clientWidth;\n render(last);\n }, 150);\n});\ndocument.addEventListener(\"visibilitychange\", () => {\n if (!document.hidden) void refresh();\n else clearTimeout(timer);\n});\nvoid refresh();\n"],
|
|
5
|
+
"mappings": "AAiBA,IAAMA,GAAQ,IAAI,IAAI,CAAC,QAAS,SAAS,CAAC,EAEnC,SAASC,EAAyCC,EAAQC,EAAe,CAAC,EAAGC,EAAsD,CACxI,IAAMC,EAAK,SAAS,cAAcH,CAAG,EAC/B,CAAE,MAAOI,EAAK,QAAAC,EAAS,GAAIC,EAAW,OAAAC,EAAQ,GAAGC,CAAK,EAAIP,EAC5DG,IAA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CAEA,IAAIiJ,GAAQ,EACZ,eAAeC,IAAU,CACvB,aAAaD,EAAK,EAClB,GAAM,CAACE,EAAKpG,CAAC,EAAI,MAAM,QAAQ,IAAI,CAAC/B,GAAK,EAAGG,GAAY,CAAC,CAAC,EAC1D,GAAIgI,IAAQ,SAAU,OAAOH,GAAO,EACpCxI,GAAUuC,EACNoG,EAAK/B,GAAO+B,CAAG,EACdnJ,GAAQ,YAAcO,EAAO,6BAA6B,IAAI,KAAKA,EAAK,EAAE,EAAE,mBAAmB,CAAC,GAAK,gCACrG,SAAS,SAAQ0I,GAAQ,OAAO,WAAWC,GAAStJ,EAAU,EACrE,CAEAwJ,GAAWC,GAAW,CAAC,EACvB,IAAIC,GAAWvJ,EAAK,YAChBwJ,GAAW,EACf,iBAAiB,SAAU,IAAM,CAC/B,aAAaA,EAAQ,EACrBA,GAAW,OAAO,WAAW,IAAM,CAC7B,CAAChJ,GAAQ,KAAK,IAAIR,EAAK,YAAcuJ,EAAQ,EAAI,IACrDA,GAAWvJ,EAAK,YAChBqH,GAAO7G,CAAI,EACb,EAAG,GAAG,CACR,CAAC,EACD,SAAS,iBAAiB,mBAAoB,IAAM,CAC7C,SAAS,OACT,aAAa0I,EAAK,EADIC,GAAQ,CAErC,CAAC,EACIA,GAAQ",
|
|
6
|
+
"names": ["PROPS", "h", "tag", "attrs", "children", "el", "cls", "dataset", "listeners", "signal", "rest", "name", "v", "type", "fn", "append", "c", "clear", "el", "peopleOnlineOverTheLast", "day", "tipMessages", "n", "tipPosted", "running", "busy", "slowClientsDroppedSinceTheStart", "n", "shown", "peoplePosted", "n", "shown", "THEME_KEY", "BAR", "safeLocalStorage", "savedTheme", "storage", "v", "applyTheme", "theme", "doc", "html", "meta", "forTheme", "min", "n", "hours", "days", "n", "ago", "span", "DAY_MS", "dayKey", "t", "d", "midnight", "now", "back", "lastDays", "days", "by", "out", "i", "day", "personHours", "samples", "from", "minutes", "sum", "peak", "best", "s", "runs", "run", "last", "niceMax", "max", "min", "v", "p", "m", "formatHours", "h", "hours", "percent", "part", "whole", "formatBytes", "n", "units", "formatSpan", "ago", "at", "never", "REFRESH_MS", "SESSIONS", "SVG", "root", "updated", "num", "time", "dayTime", "dayName", "shortDay", "range", "last", "metrics", "refocus", "tokens", "superusers", "out", "key", "session", "token", "load", "tz", "res", "loadMetrics", "tile", "label", "value", "note", "big", "h", "section", "title", "children", "hint", "svg", "tag", "attrs", "el", "k", "v", "table", "caption", "head", "rows", "grid", "c", "r", "i", "LABELS", "named", "serverSection", "m", "now", "db", "logs", "queues", "a", "b", "workers", "formatSpan", "slowClientsDroppedSinceTheStart", "formatBytes", "q", "w", "ago", "running", "W", "H", "narrow", "PAD", "yAxis", "g", "top", "y", "t", "xLabel", "x", "text", "anchor", "tooltip", "box", "tip", "lines", "clear", "left", "onlineChart", "s", "from", "DAY_MS", "parts", "runs", "shown", "niceMax", "plotW", "plotH", "xOf", "yOf", "chart", "peopleOnlineOverTheLast", "ticks", "first", "midnight", "base", "run", "pts", "cross", "mark", "nearest", "clientX", "best", "show", "cx", "hide", "e", "at", "p", "peak", "start", "picker", "rangeButton", "render", "messagesChart", "days", "lastDays", "d", "slot", "bw", "bh", "date", "every", "hit", "tipMessages", "tipPosted", "today", "sum", "n", "month", "peakToday", "peakWeek", "hoursToday", "personHours", "hoursWeek", "recorded", "sections", "percent", "formatHours", "peoplePosted", "open", "denied", "timer", "refresh", "got", "applyTheme", "savedTheme", "drawnFor", "resizing"]
|
|
7
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as s}from"./chunk-VTOUI25E.js";var q=3,ee=50,F=`viewer-${Date.now()}-${Math.random()}`,N=()=>history.state?.viewer===F,U=null,B=null,P=null;function te(){return U??=new Promise(n=>{let x=s("link",{rel:"stylesheet",href:"/assets/viewer-
|
|
2
|
-
//# sourceMappingURL=viewer-
|
|
1
|
+
import{a as s}from"./chunk-VTOUI25E.js";var q=3,ee=50,F=`viewer-${Date.now()}-${Math.random()}`,N=()=>history.state?.viewer===F,U=null,B=null,P=null;function te(){return U??=new Promise(n=>{let x=s("link",{rel:"stylesheet",href:"/assets/viewer-JBZU46HP.css",on:{load:()=>n(),error:()=>{x.remove(),U=null,n()}}});document.head.append(x)}),U}async function se(n){let{images:A}=n;if(P?.(),n.signal.aborted||!A[n.start])return;let x=new AbortController,{signal:l}=x,I=s("h2",{id:"viewer-title"}),H=s("p",{class:"viewer-meta"}),$=s("span",{class:"viewer-count"}),L=(e,t,i,c,d)=>s("button",{type:"button",class:`viewer-button ${e}`,"aria-label":t,title:t,autofocus:d,on:{click:c},signal:l},i),k=s("a",{class:"viewer-button","aria-label":"Download",title:"Download"},"\u2193"),O=L("","Close","\xD7",()=>m(!0),!0),{onJump:W,onSave:Y}=n,z=W&&L("viewer-jump","Show in chat","",()=>{let e=g();m(!0,!1),W(e.message).then(()=>!n.signal.aborted&&X(e)?.focus({preventScroll:!0}))}),V=Y&&L("","Save to collection","",()=>Y(g().message,g().file,V));V?.append(s("span",{class:"ci","aria-hidden":"true"}));let h=L("viewer-prev","Previous image","\u2039",()=>{S(-1)}),w=L("viewer-next","Next image","\u203A",()=>{S(1)}),u=s("img",{alt:"",decoding:"async",draggable:"false",fetchpriority:"high"}),r=s("video",{controls:!0,playsinline:!0,preload:"auto",hidden:!0}),K=s("span"),_=s("p",{class:"viewer-error",hidden:!0},[K,s("button",{type:"button",class:"link",on:{click:()=>G()},signal:l},"Retry")]),f=s("div",{class:"viewer-stage"},[u,r,_,h,w]),p=s("dialog",{class:"viewer","aria-labelledby":I.id},[s("header",{class:"viewer-bar"},[s("div",{class:"viewer-caption","aria-live":"polite"},[I,H]),$,V,z,k,O]),f]),o=[...A],b=[...n.more],T=[null,null],a=n.start,v=!1;function m(e=!1,t=!0){v||(v=!0,x.abort(),p.open&&p.close(),p.remove(),u.removeAttribute("src"),j(),P===m&&(P=null),t&&(n.opener.isConnected?n.opener:X(A[n.start]))?.focus(),e&&N()&&(B=new Promise(i=>window.addEventListener("popstate",i,{once:!0})),history.back()))}P=m,n.signal.addEventListener("abort",()=>m(),{signal:l});let g=()=>o[a],X=({message:e,file:t})=>document.querySelectorAll(`li.msg[data-id="${CSS.escape(e.id)}"] .att-tile`)[n.media(e).findIndex(i=>i.file===t)];function M(e){a=e;let{message:t,file:i}=g(),c=n.name(t,i);I.textContent=c,H.textContent=t.author?`${t.expand?.author?.name??"Unknown"} \xB7 ${n.when(t)}`:n.when(t),k.download=c,k.href=n.fileUrl(t,i),D(),G();for(let d of[o[e-1],o[e+1]])d&&!d.video&&(new Image().src=n.fileUrl(d.message,d.file));e<q&&R(0),e>=o.length-q&&R(1)}function D(){$.textContent=o.length>1&&!b[0]&&!b[1]?`${a+1} / ${o.length}`:"";let e=document.activeElement;h.hidden=a===0&&!b[0],w.hidden=a===o.length-1&&!b[1],e===h&&h.hidden&&(w.hidden?O:w).focus(),e===w&&w.hidden&&(h.hidden?O:h).focus()}function R(e){return b[e]?(T[e]??=(async()=>{let t=(e?o.at(-1):o[0]).message;try{for(;;){let{messages:i,done:c}=await n.page(!e,t);if(v)return;let d=i.flatMap(n.media);if(c&&(b[e]=!1),e?o.push(...d):(o.unshift(...d),a+=d.length),d.length||c)break;t=e?i.at(-1):i[0]}}catch{}finally{T[e]=null}v||D()})(),T[e]):Promise.resolve()}function G(){let{message:e,file:t,video:i}=g();_.hidden=!0,f.classList.add("loading"),u.hidden=!!i,r.hidden=!i,i?(u.removeAttribute("src"),r.setAttribute("aria-label",n.name(e,t)),r.src=n.fileUrl(e,t),r.play().catch(()=>{})):(j(),u.alt=n.name(e,t),u.src=n.fileUrl(e,t))}function j(){r.getAttribute("src")&&(r.pause(),r.removeAttribute("src"),r.load())}function J(){f.classList.remove("loading"),u.hidden=!0,r.hidden=!0,K.textContent=g().video?"Couldn't play video. ":"Couldn't load image. ",_.hidden=!1}n.follow((e,t)=>{if(v)return;let i=new Set(t||e.deleted?[]:n.media(e).map(E=>E.file)),c=E=>E.message.id===e.id&&!i.has(E.file);if(!o.some(c))return;let d=g(),Q=o.slice(0,a).filter(c).length,Z=o.filter(E=>!c(E));if(o.splice(0,o.length,...Z),!o.length)return m(!0);o.includes(d)?(a=o.indexOf(d),D()):M(Math.min(a-Q,o.length-1))});async function S(e){if(!o[a+e]){let t=g();if(await R(e<0?0:1),v||g()!==t)return}o[a+e]&&M(a+e)}u.addEventListener("load",()=>f.classList.remove("loading"),{signal:l}),r.addEventListener("loadeddata",()=>f.classList.remove("loading"),{signal:l}),r.addEventListener("error",()=>r.getAttribute("src")&&J(),{signal:l}),u.addEventListener("error",()=>u.getAttribute("src")&&J(),{signal:l}),p.addEventListener("close",()=>m(!0),{signal:l}),document.addEventListener("keydown",e=>{if(!p.open||e.target===r||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;let i={ArrowLeft:()=>S(-1),ArrowRight:()=>S(1),Home:()=>a&&M(0),End:()=>a<o.length-1&&M(o.length-1)}[e.key];i&&(e.preventDefault(),i())},{signal:l});let y=null,C=!1;f.addEventListener("pointerdown",e=>y=e.isPrimary&&e.target!==r?{x:e.clientX,y:e.clientY}:null,{signal:l}),f.addEventListener("pointercancel",()=>y=null,{signal:l}),f.addEventListener("pointerup",e=>{if(!y||!e.isPrimary)return;let t=e.clientX-y.x,i=e.clientY-y.y;y=null,C=Math.abs(t)>=ee&&Math.abs(t)>2*Math.abs(i),C&&S(t<0?1:-1)},{signal:l}),f.addEventListener("click",e=>{e.target===f&&!C&&m(!0),C=!1},{signal:l}),M(a),await Promise.all([te(),B]),!v&&(N()||history.pushState({viewer:F},""),window.addEventListener("popstate",()=>!N()&&m(),{signal:l}),document.body.append(p),p.showModal())}export{se as openViewer};
|
|
2
|
+
//# sourceMappingURL=viewer-BHKVAADP.js.map
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
dialog.viewer{color-scheme:dark;width:100%;height:100%;max-width:none;max-height:none;margin:0;padding:0;border:0;background:#0b0a10;color:#eceaf4;overscroll-behavior:contain}dialog.viewer[open]{display:grid;grid-template:auto minmax(0,1fr) / minmax(0,1fr);animation:viewer-in .15s ease-out}dialog.viewer::backdrop{background:transparent}.viewer-bar{display:flex;align-items:center;gap:.5rem;padding:max(.5rem,env(safe-area-inset-top)) max(.75rem,env(safe-area-inset-right)) .5rem max(.75rem,env(safe-area-inset-left))}.viewer-caption{flex:1;min-width:0}.viewer-caption>*{margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.viewer-caption h2{font-size:1rem}.viewer-meta,.viewer-count{color:#bdb7d3;font-size:.875rem}.viewer-count{font-variant-numeric:tabular-nums}.viewer-button{display:inline-grid;place-items:center;flex:none;width:2.5rem;height:2.5rem;padding:0;border:0;border-radius:.625rem;background:#ffffff12;color:inherit;font-size:1.5rem;line-height:1;text-decoration:none}.viewer-jump:before{content:"";width:1.375rem;height:1.375rem;background:currentColor;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center / contain no-repeat}.viewer-button:hover{background:#ffffff38}.viewer :focus-visible{outline-color:#fff}.viewer-stage{position:relative;display:grid;grid-template:minmax(0,1fr) / minmax(0,1fr);place-items:center;min-height:0;padding:0 0 env(safe-area-inset-bottom);overflow:hidden;touch-action:pan-y pinch-zoom}.viewer-stage img,.viewer-stage video{max-width:100%;max-height:100%;object-fit:contain;user-select:none;-webkit-user-drag:none;transition:opacity .15s}.viewer-stage.loading img,.viewer-stage.loading video{opacity:0}.viewer-stage.loading:after{content:"";position:absolute;width:2.5rem;height:2.5rem;border:.1875rem solid rgb(255 255 255 / 25%);border-top-color:#fff;border-radius:50%;opacity:0;animation:viewer-show 0s .2s forwards,viewer-spin .8s linear infinite}.viewer-error .link{color:inherit;text-decoration:underline}.viewer-prev,.viewer-next{position:absolute;top:50%;translate:0 -50%;font-size:2rem;background:#0d0b1499}.viewer-prev:hover,.viewer-next:hover{background:#0d0b14cc}.viewer-prev{left:max(.75rem,env(safe-area-inset-left))}.viewer-next{right:max(.75rem,env(safe-area-inset-right))}@keyframes viewer-in{0%{opacity:0}}@keyframes viewer-show{to{opacity:1}}@keyframes viewer-spin{to{rotate:1turn}}
|
|
2
|
+
/*# sourceMappingURL=viewer-JBZU46HP.css.map */
|
|
Binary file
|
|
Binary file
|