@jean-is/render 0.0.0-stage → 0.8.0-ra7be83a699f8
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/LICENSE +21 -0
- package/README.md +2 -2
- package/caps/charts/charts.css +12 -0
- package/caps/charts/charts.js +154 -0
- package/caps/charts/option.js +141 -0
- package/caps/interactive/diagram.js +415 -0
- package/caps/interactive/interactive.css +21 -0
- package/caps/interactive/interactive.js +345 -0
- package/caps/interactive/map.js +183 -0
- package/caps/interactive/mode.js +54 -0
- package/caps/layouts/layouts.css +179 -0
- package/caps/layouts/layouts.js +147 -0
- package/caps/layouts/shapes.js +159 -0
- package/caps/math/latex.js +88 -0
- package/caps/math/math.css +24 -0
- package/caps/math/math.js +117 -0
- package/caps/scores/notes.js +30 -0
- package/caps/scores/scores.css +22 -0
- package/caps/scores/scores.js +287 -0
- package/caps/scores/sound-worker.js +12 -0
- package/caps/scores/sound.js +72 -0
- package/caps/share/seal.js +86 -0
- package/caps/share/view.js +153 -0
- package/caps/skills/directory.js +57 -0
- package/caps/skills/sources.js +281 -0
- package/caps/slides/deck.js +69 -0
- package/caps/slides/slides.css +38 -0
- package/caps/slides/slides.js +122 -0
- package/core/anthropic.js +253 -0
- package/core/deferred.js +48 -0
- package/core/events.js +166 -0
- package/core/files.js +277 -0
- package/core/fs.js +186 -0
- package/core/hooks.js +53 -0
- package/core/i18n.js +151 -0
- package/core/llm.js +383 -0
- package/core/loop.js +452 -0
- package/core/rules.js +52 -0
- package/core/search.js +158 -0
- package/core/settings.js +221 -0
- package/core/skills.js +90 -0
- package/core/sse.js +51 -0
- package/core/ulid.js +17 -0
- package/core/zip.js +165 -0
- package/fonts/OFL.txt +94 -0
- package/fonts/display.woff2 +0 -0
- package/locales/am.json +395 -0
- package/locales/ar.json +427 -0
- package/locales/ask/am.json +8 -0
- package/locales/ask/ar.json +8 -0
- package/locales/ask/bn.json +8 -0
- package/locales/ask/de.json +8 -0
- package/locales/ask/en.json +8 -0
- package/locales/ask/es.json +8 -0
- package/locales/ask/fa.json +8 -0
- package/locales/ask/fr.json +8 -0
- package/locales/ask/ha.json +8 -0
- package/locales/ask/he.json +8 -0
- package/locales/ask/hi.json +8 -0
- package/locales/ask/id.json +8 -0
- package/locales/ask/it.json +8 -0
- package/locales/ask/ja.json +8 -0
- package/locales/ask/ko.json +8 -0
- package/locales/ask/mr.json +8 -0
- package/locales/ask/ms.json +8 -0
- package/locales/ask/nl.json +8 -0
- package/locales/ask/pl.json +8 -0
- package/locales/ask/pt.json +8 -0
- package/locales/ask/ru.json +8 -0
- package/locales/ask/sw.json +8 -0
- package/locales/ask/ta.json +8 -0
- package/locales/ask/te.json +8 -0
- package/locales/ask/th.json +8 -0
- package/locales/ask/tl.json +8 -0
- package/locales/ask/tr.json +8 -0
- package/locales/ask/uk.json +8 -0
- package/locales/ask/ur.json +8 -0
- package/locales/ask/vi.json +8 -0
- package/locales/ask/yo.json +8 -0
- package/locales/ask/zh-Hans.json +8 -0
- package/locales/ask/zh-Hant.json +8 -0
- package/locales/backup/am.json +8 -0
- package/locales/backup/ar.json +12 -0
- package/locales/backup/bn.json +8 -0
- package/locales/backup/de.json +8 -0
- package/locales/backup/en.json +8 -0
- package/locales/backup/es.json +9 -0
- package/locales/backup/fa.json +8 -0
- package/locales/backup/fr.json +9 -0
- package/locales/backup/ha.json +8 -0
- package/locales/backup/he.json +10 -0
- package/locales/backup/hi.json +8 -0
- package/locales/backup/id.json +7 -0
- package/locales/backup/it.json +9 -0
- package/locales/backup/ja.json +7 -0
- package/locales/backup/ko.json +7 -0
- package/locales/backup/mr.json +8 -0
- package/locales/backup/ms.json +7 -0
- package/locales/backup/nl.json +8 -0
- package/locales/backup/pl.json +10 -0
- package/locales/backup/pt.json +9 -0
- package/locales/backup/ru.json +10 -0
- package/locales/backup/sw.json +8 -0
- package/locales/backup/ta.json +8 -0
- package/locales/backup/te.json +8 -0
- package/locales/backup/th.json +7 -0
- package/locales/backup/tl.json +8 -0
- package/locales/backup/tr.json +8 -0
- package/locales/backup/uk.json +10 -0
- package/locales/backup/ur.json +8 -0
- package/locales/backup/vi.json +7 -0
- package/locales/backup/yo.json +7 -0
- package/locales/backup/zh-Hans.json +7 -0
- package/locales/backup/zh-Hant.json +7 -0
- package/locales/bn.json +395 -0
- package/locales/brain-local/am.json +13 -0
- package/locales/brain-local/ar.json +13 -0
- package/locales/brain-local/bn.json +13 -0
- package/locales/brain-local/de.json +13 -0
- package/locales/brain-local/en.json +13 -0
- package/locales/brain-local/es.json +13 -0
- package/locales/brain-local/fa.json +13 -0
- package/locales/brain-local/fr.json +13 -0
- package/locales/brain-local/ha.json +13 -0
- package/locales/brain-local/he.json +13 -0
- package/locales/brain-local/hi.json +13 -0
- package/locales/brain-local/id.json +13 -0
- package/locales/brain-local/it.json +13 -0
- package/locales/brain-local/ja.json +13 -0
- package/locales/brain-local/ko.json +13 -0
- package/locales/brain-local/mr.json +13 -0
- package/locales/brain-local/ms.json +13 -0
- package/locales/brain-local/nl.json +13 -0
- package/locales/brain-local/pl.json +13 -0
- package/locales/brain-local/pt.json +13 -0
- package/locales/brain-local/ru.json +13 -0
- package/locales/brain-local/sw.json +13 -0
- package/locales/brain-local/ta.json +13 -0
- package/locales/brain-local/te.json +13 -0
- package/locales/brain-local/th.json +13 -0
- package/locales/brain-local/tl.json +13 -0
- package/locales/brain-local/tr.json +13 -0
- package/locales/brain-local/uk.json +13 -0
- package/locales/brain-local/ur.json +13 -0
- package/locales/brain-local/vi.json +13 -0
- package/locales/brain-local/yo.json +13 -0
- package/locales/brain-local/zh-Hans.json +13 -0
- package/locales/brain-local/zh-Hant.json +13 -0
- package/locales/browser/am.json +29 -0
- package/locales/browser/ar.json +29 -0
- package/locales/browser/bn.json +29 -0
- package/locales/browser/de.json +29 -0
- package/locales/browser/en.json +29 -0
- package/locales/browser/es.json +29 -0
- package/locales/browser/fa.json +29 -0
- package/locales/browser/fr.json +29 -0
- package/locales/browser/ha.json +29 -0
- package/locales/browser/he.json +29 -0
- package/locales/browser/hi.json +29 -0
- package/locales/browser/id.json +29 -0
- package/locales/browser/it.json +29 -0
- package/locales/browser/ja.json +29 -0
- package/locales/browser/ko.json +29 -0
- package/locales/browser/mr.json +29 -0
- package/locales/browser/ms.json +29 -0
- package/locales/browser/nl.json +29 -0
- package/locales/browser/pl.json +29 -0
- package/locales/browser/pt.json +29 -0
- package/locales/browser/ru.json +29 -0
- package/locales/browser/sw.json +29 -0
- package/locales/browser/ta.json +29 -0
- package/locales/browser/te.json +29 -0
- package/locales/browser/th.json +29 -0
- package/locales/browser/tl.json +29 -0
- package/locales/browser/tr.json +29 -0
- package/locales/browser/uk.json +29 -0
- package/locales/browser/ur.json +29 -0
- package/locales/browser/vi.json +29 -0
- package/locales/browser/yo.json +29 -0
- package/locales/browser/zh-Hans.json +29 -0
- package/locales/browser/zh-Hant.json +29 -0
- package/locales/certificates/am.json +54 -0
- package/locales/certificates/ar.json +54 -0
- package/locales/certificates/bn.json +54 -0
- package/locales/certificates/de.json +54 -0
- package/locales/certificates/en.json +54 -0
- package/locales/certificates/es.json +54 -0
- package/locales/certificates/fa.json +54 -0
- package/locales/certificates/fr.json +54 -0
- package/locales/certificates/ha.json +54 -0
- package/locales/certificates/he.json +54 -0
- package/locales/certificates/hi.json +54 -0
- package/locales/certificates/id.json +54 -0
- package/locales/certificates/it.json +54 -0
- package/locales/certificates/ja.json +54 -0
- package/locales/certificates/ko.json +54 -0
- package/locales/certificates/mr.json +54 -0
- package/locales/certificates/ms.json +54 -0
- package/locales/certificates/nl.json +54 -0
- package/locales/certificates/pl.json +54 -0
- package/locales/certificates/pt.json +54 -0
- package/locales/certificates/ru.json +54 -0
- package/locales/certificates/sw.json +54 -0
- package/locales/certificates/ta.json +54 -0
- package/locales/certificates/te.json +54 -0
- package/locales/certificates/th.json +54 -0
- package/locales/certificates/tl.json +54 -0
- package/locales/certificates/tr.json +54 -0
- package/locales/certificates/uk.json +54 -0
- package/locales/certificates/ur.json +54 -0
- package/locales/certificates/vi.json +54 -0
- package/locales/certificates/yo.json +54 -0
- package/locales/certificates/zh-Hans.json +54 -0
- package/locales/certificates/zh-Hant.json +54 -0
- package/locales/charts/am.json +5 -0
- package/locales/charts/ar.json +5 -0
- package/locales/charts/bn.json +5 -0
- package/locales/charts/de.json +5 -0
- package/locales/charts/en.json +5 -0
- package/locales/charts/es.json +5 -0
- package/locales/charts/fa.json +5 -0
- package/locales/charts/fr.json +5 -0
- package/locales/charts/ha.json +5 -0
- package/locales/charts/he.json +5 -0
- package/locales/charts/hi.json +5 -0
- package/locales/charts/id.json +5 -0
- package/locales/charts/it.json +5 -0
- package/locales/charts/ja.json +5 -0
- package/locales/charts/ko.json +5 -0
- package/locales/charts/mr.json +5 -0
- package/locales/charts/ms.json +5 -0
- package/locales/charts/nl.json +5 -0
- package/locales/charts/pl.json +5 -0
- package/locales/charts/pt.json +5 -0
- package/locales/charts/ru.json +5 -0
- package/locales/charts/sw.json +5 -0
- package/locales/charts/ta.json +5 -0
- package/locales/charts/te.json +5 -0
- package/locales/charts/th.json +5 -0
- package/locales/charts/tl.json +5 -0
- package/locales/charts/tr.json +5 -0
- package/locales/charts/uk.json +5 -0
- package/locales/charts/ur.json +5 -0
- package/locales/charts/vi.json +5 -0
- package/locales/charts/yo.json +5 -0
- package/locales/charts/zh-Hans.json +5 -0
- package/locales/charts/zh-Hant.json +5 -0
- package/locales/compact/am.json +7 -0
- package/locales/compact/ar.json +7 -0
- package/locales/compact/bn.json +7 -0
- package/locales/compact/de.json +7 -0
- package/locales/compact/en.json +7 -0
- package/locales/compact/es.json +7 -0
- package/locales/compact/fa.json +7 -0
- package/locales/compact/fr.json +7 -0
- package/locales/compact/ha.json +7 -0
- package/locales/compact/he.json +7 -0
- package/locales/compact/hi.json +7 -0
- package/locales/compact/id.json +7 -0
- package/locales/compact/it.json +7 -0
- package/locales/compact/ja.json +7 -0
- package/locales/compact/ko.json +7 -0
- package/locales/compact/mr.json +7 -0
- package/locales/compact/ms.json +7 -0
- package/locales/compact/nl.json +7 -0
- package/locales/compact/pl.json +7 -0
- package/locales/compact/pt.json +7 -0
- package/locales/compact/ru.json +7 -0
- package/locales/compact/sw.json +7 -0
- package/locales/compact/ta.json +7 -0
- package/locales/compact/te.json +7 -0
- package/locales/compact/th.json +7 -0
- package/locales/compact/tl.json +7 -0
- package/locales/compact/tr.json +7 -0
- package/locales/compact/uk.json +7 -0
- package/locales/compact/ur.json +7 -0
- package/locales/compact/vi.json +7 -0
- package/locales/compact/yo.json +7 -0
- package/locales/compact/zh-Hans.json +7 -0
- package/locales/compact/zh-Hant.json +7 -0
- package/locales/computer/am.json +61 -0
- package/locales/computer/ar.json +69 -0
- package/locales/computer/bn.json +61 -0
- package/locales/computer/de.json +61 -0
- package/locales/computer/en.json +61 -0
- package/locales/computer/es.json +63 -0
- package/locales/computer/fa.json +61 -0
- package/locales/computer/fr.json +63 -0
- package/locales/computer/ha.json +61 -0
- package/locales/computer/he.json +63 -0
- package/locales/computer/hi.json +61 -0
- package/locales/computer/id.json +59 -0
- package/locales/computer/it.json +63 -0
- package/locales/computer/ja.json +59 -0
- package/locales/computer/ko.json +59 -0
- package/locales/computer/mr.json +61 -0
- package/locales/computer/ms.json +59 -0
- package/locales/computer/nl.json +61 -0
- package/locales/computer/pl.json +65 -0
- package/locales/computer/pt.json +63 -0
- package/locales/computer/ru.json +65 -0
- package/locales/computer/sw.json +61 -0
- package/locales/computer/ta.json +61 -0
- package/locales/computer/te.json +61 -0
- package/locales/computer/th.json +59 -0
- package/locales/computer/tl.json +61 -0
- package/locales/computer/tr.json +61 -0
- package/locales/computer/uk.json +65 -0
- package/locales/computer/ur.json +61 -0
- package/locales/computer/vi.json +59 -0
- package/locales/computer/yo.json +59 -0
- package/locales/computer/zh-Hans.json +59 -0
- package/locales/computer/zh-Hant.json +59 -0
- package/locales/connections/am.json +14 -0
- package/locales/connections/ar.json +14 -0
- package/locales/connections/bn.json +14 -0
- package/locales/connections/de.json +14 -0
- package/locales/connections/en.json +14 -0
- package/locales/connections/es.json +14 -0
- package/locales/connections/fa.json +14 -0
- package/locales/connections/fr.json +14 -0
- package/locales/connections/ha.json +14 -0
- package/locales/connections/he.json +14 -0
- package/locales/connections/hi.json +14 -0
- package/locales/connections/id.json +14 -0
- package/locales/connections/it.json +14 -0
- package/locales/connections/ja.json +14 -0
- package/locales/connections/ko.json +14 -0
- package/locales/connections/mr.json +14 -0
- package/locales/connections/ms.json +14 -0
- package/locales/connections/nl.json +14 -0
- package/locales/connections/pl.json +14 -0
- package/locales/connections/pt.json +14 -0
- package/locales/connections/ru.json +14 -0
- package/locales/connections/sw.json +14 -0
- package/locales/connections/ta.json +14 -0
- package/locales/connections/te.json +14 -0
- package/locales/connections/th.json +14 -0
- package/locales/connections/tl.json +14 -0
- package/locales/connections/tr.json +14 -0
- package/locales/connections/uk.json +14 -0
- package/locales/connections/ur.json +14 -0
- package/locales/connections/vi.json +14 -0
- package/locales/connections/yo.json +14 -0
- package/locales/connections/zh-Hans.json +14 -0
- package/locales/connections/zh-Hant.json +14 -0
- package/locales/de.json +395 -0
- package/locales/dialogs/am.json +347 -0
- package/locales/dialogs/ar.json +359 -0
- package/locales/dialogs/bn.json +347 -0
- package/locales/dialogs/de.json +347 -0
- package/locales/dialogs/en.json +347 -0
- package/locales/dialogs/es.json +350 -0
- package/locales/dialogs/fa.json +347 -0
- package/locales/dialogs/fr.json +350 -0
- package/locales/dialogs/ha.json +347 -0
- package/locales/dialogs/he.json +352 -0
- package/locales/dialogs/hi.json +347 -0
- package/locales/dialogs/id.json +344 -0
- package/locales/dialogs/it.json +350 -0
- package/locales/dialogs/ja.json +344 -0
- package/locales/dialogs/ko.json +344 -0
- package/locales/dialogs/mr.json +347 -0
- package/locales/dialogs/ms.json +344 -0
- package/locales/dialogs/nl.json +347 -0
- package/locales/dialogs/pl.json +353 -0
- package/locales/dialogs/pt.json +350 -0
- package/locales/dialogs/ru.json +353 -0
- package/locales/dialogs/sw.json +347 -0
- package/locales/dialogs/ta.json +347 -0
- package/locales/dialogs/te.json +347 -0
- package/locales/dialogs/th.json +344 -0
- package/locales/dialogs/tl.json +347 -0
- package/locales/dialogs/tr.json +347 -0
- package/locales/dialogs/uk.json +353 -0
- package/locales/dialogs/ur.json +347 -0
- package/locales/dialogs/vi.json +344 -0
- package/locales/dialogs/yo.json +344 -0
- package/locales/dialogs/zh-Hans.json +344 -0
- package/locales/dialogs/zh-Hant.json +344 -0
- package/locales/en.json +395 -0
- package/locales/enterprise/am.json +20 -0
- package/locales/enterprise/ar.json +20 -0
- package/locales/enterprise/bn.json +20 -0
- package/locales/enterprise/de.json +20 -0
- package/locales/enterprise/en.json +20 -0
- package/locales/enterprise/es.json +20 -0
- package/locales/enterprise/fa.json +20 -0
- package/locales/enterprise/fr.json +20 -0
- package/locales/enterprise/ha.json +20 -0
- package/locales/enterprise/he.json +20 -0
- package/locales/enterprise/hi.json +20 -0
- package/locales/enterprise/id.json +20 -0
- package/locales/enterprise/it.json +20 -0
- package/locales/enterprise/ja.json +20 -0
- package/locales/enterprise/ko.json +20 -0
- package/locales/enterprise/mr.json +20 -0
- package/locales/enterprise/ms.json +20 -0
- package/locales/enterprise/nl.json +20 -0
- package/locales/enterprise/pl.json +20 -0
- package/locales/enterprise/pt.json +20 -0
- package/locales/enterprise/ru.json +20 -0
- package/locales/enterprise/sw.json +20 -0
- package/locales/enterprise/ta.json +20 -0
- package/locales/enterprise/te.json +20 -0
- package/locales/enterprise/th.json +20 -0
- package/locales/enterprise/tl.json +20 -0
- package/locales/enterprise/tr.json +20 -0
- package/locales/enterprise/uk.json +20 -0
- package/locales/enterprise/ur.json +20 -0
- package/locales/enterprise/vi.json +20 -0
- package/locales/enterprise/yo.json +20 -0
- package/locales/enterprise/zh-Hans.json +20 -0
- package/locales/enterprise/zh-Hant.json +20 -0
- package/locales/es.json +403 -0
- package/locales/fa.json +395 -0
- package/locales/first/am.json +26 -0
- package/locales/first/ar.json +26 -0
- package/locales/first/bn.json +26 -0
- package/locales/first/de.json +26 -0
- package/locales/first/en.json +26 -0
- package/locales/first/es.json +26 -0
- package/locales/first/fa.json +26 -0
- package/locales/first/fr.json +26 -0
- package/locales/first/ha.json +26 -0
- package/locales/first/he.json +26 -0
- package/locales/first/hi.json +26 -0
- package/locales/first/id.json +26 -0
- package/locales/first/it.json +26 -0
- package/locales/first/ja.json +26 -0
- package/locales/first/ko.json +26 -0
- package/locales/first/mr.json +26 -0
- package/locales/first/ms.json +26 -0
- package/locales/first/nl.json +26 -0
- package/locales/first/pl.json +26 -0
- package/locales/first/pt.json +26 -0
- package/locales/first/ru.json +26 -0
- package/locales/first/sw.json +26 -0
- package/locales/first/ta.json +26 -0
- package/locales/first/te.json +26 -0
- package/locales/first/th.json +26 -0
- package/locales/first/tl.json +26 -0
- package/locales/first/tr.json +26 -0
- package/locales/first/uk.json +26 -0
- package/locales/first/ur.json +26 -0
- package/locales/first/vi.json +26 -0
- package/locales/first/yo.json +26 -0
- package/locales/first/zh-Hans.json +26 -0
- package/locales/first/zh-Hant.json +26 -0
- package/locales/flows/am.json +51 -0
- package/locales/flows/ar.json +51 -0
- package/locales/flows/bn.json +51 -0
- package/locales/flows/de.json +51 -0
- package/locales/flows/en.json +51 -0
- package/locales/flows/es.json +51 -0
- package/locales/flows/fa.json +51 -0
- package/locales/flows/fr.json +51 -0
- package/locales/flows/ha.json +51 -0
- package/locales/flows/he.json +51 -0
- package/locales/flows/hi.json +51 -0
- package/locales/flows/id.json +51 -0
- package/locales/flows/it.json +51 -0
- package/locales/flows/ja.json +51 -0
- package/locales/flows/ko.json +51 -0
- package/locales/flows/mr.json +51 -0
- package/locales/flows/ms.json +51 -0
- package/locales/flows/nl.json +51 -0
- package/locales/flows/pl.json +51 -0
- package/locales/flows/pt.json +51 -0
- package/locales/flows/ru.json +51 -0
- package/locales/flows/sw.json +51 -0
- package/locales/flows/ta.json +51 -0
- package/locales/flows/te.json +51 -0
- package/locales/flows/th.json +51 -0
- package/locales/flows/tl.json +51 -0
- package/locales/flows/tr.json +51 -0
- package/locales/flows/uk.json +51 -0
- package/locales/flows/ur.json +51 -0
- package/locales/flows/vi.json +51 -0
- package/locales/flows/yo.json +51 -0
- package/locales/flows/zh-Hans.json +51 -0
- package/locales/flows/zh-Hant.json +51 -0
- package/locales/folders/am.json +40 -0
- package/locales/folders/ar.json +44 -0
- package/locales/folders/bn.json +40 -0
- package/locales/folders/de.json +40 -0
- package/locales/folders/en.json +40 -0
- package/locales/folders/es.json +41 -0
- package/locales/folders/fa.json +40 -0
- package/locales/folders/fr.json +41 -0
- package/locales/folders/ha.json +40 -0
- package/locales/folders/he.json +41 -0
- package/locales/folders/hi.json +40 -0
- package/locales/folders/id.json +39 -0
- package/locales/folders/it.json +41 -0
- package/locales/folders/ja.json +39 -0
- package/locales/folders/ko.json +39 -0
- package/locales/folders/mr.json +40 -0
- package/locales/folders/ms.json +39 -0
- package/locales/folders/nl.json +40 -0
- package/locales/folders/pl.json +42 -0
- package/locales/folders/pt.json +41 -0
- package/locales/folders/ru.json +42 -0
- package/locales/folders/sw.json +40 -0
- package/locales/folders/ta.json +40 -0
- package/locales/folders/te.json +40 -0
- package/locales/folders/th.json +39 -0
- package/locales/folders/tl.json +40 -0
- package/locales/folders/tr.json +40 -0
- package/locales/folders/uk.json +42 -0
- package/locales/folders/ur.json +40 -0
- package/locales/folders/vi.json +39 -0
- package/locales/folders/yo.json +39 -0
- package/locales/folders/zh-Hans.json +39 -0
- package/locales/folders/zh-Hant.json +39 -0
- package/locales/fr.json +403 -0
- package/locales/ha.json +395 -0
- package/locales/he.json +410 -0
- package/locales/hi.json +395 -0
- package/locales/id.json +387 -0
- package/locales/interactive/am.json +7 -0
- package/locales/interactive/ar.json +7 -0
- package/locales/interactive/bn.json +7 -0
- package/locales/interactive/de.json +7 -0
- package/locales/interactive/en.json +7 -0
- package/locales/interactive/es.json +7 -0
- package/locales/interactive/fa.json +7 -0
- package/locales/interactive/fr.json +7 -0
- package/locales/interactive/ha.json +7 -0
- package/locales/interactive/he.json +7 -0
- package/locales/interactive/hi.json +7 -0
- package/locales/interactive/id.json +7 -0
- package/locales/interactive/it.json +7 -0
- package/locales/interactive/ja.json +7 -0
- package/locales/interactive/ko.json +7 -0
- package/locales/interactive/mr.json +7 -0
- package/locales/interactive/ms.json +7 -0
- package/locales/interactive/nl.json +7 -0
- package/locales/interactive/pl.json +7 -0
- package/locales/interactive/pt.json +7 -0
- package/locales/interactive/ru.json +7 -0
- package/locales/interactive/sw.json +7 -0
- package/locales/interactive/ta.json +7 -0
- package/locales/interactive/te.json +7 -0
- package/locales/interactive/th.json +7 -0
- package/locales/interactive/tl.json +7 -0
- package/locales/interactive/tr.json +7 -0
- package/locales/interactive/uk.json +7 -0
- package/locales/interactive/ur.json +7 -0
- package/locales/interactive/vi.json +7 -0
- package/locales/interactive/yo.json +7 -0
- package/locales/interactive/zh-Hans.json +7 -0
- package/locales/interactive/zh-Hant.json +7 -0
- package/locales/it.json +403 -0
- package/locales/ja.json +387 -0
- package/locales/ko.json +387 -0
- package/locales/layouts/am.json +9 -0
- package/locales/layouts/ar.json +9 -0
- package/locales/layouts/bn.json +9 -0
- package/locales/layouts/de.json +9 -0
- package/locales/layouts/en.json +9 -0
- package/locales/layouts/es.json +9 -0
- package/locales/layouts/fa.json +9 -0
- package/locales/layouts/fr.json +9 -0
- package/locales/layouts/ha.json +9 -0
- package/locales/layouts/he.json +9 -0
- package/locales/layouts/hi.json +9 -0
- package/locales/layouts/id.json +9 -0
- package/locales/layouts/it.json +9 -0
- package/locales/layouts/ja.json +9 -0
- package/locales/layouts/ko.json +9 -0
- package/locales/layouts/mr.json +9 -0
- package/locales/layouts/ms.json +9 -0
- package/locales/layouts/nl.json +9 -0
- package/locales/layouts/pl.json +9 -0
- package/locales/layouts/pt.json +9 -0
- package/locales/layouts/ru.json +9 -0
- package/locales/layouts/sw.json +9 -0
- package/locales/layouts/ta.json +9 -0
- package/locales/layouts/te.json +9 -0
- package/locales/layouts/th.json +9 -0
- package/locales/layouts/tl.json +9 -0
- package/locales/layouts/tr.json +9 -0
- package/locales/layouts/uk.json +9 -0
- package/locales/layouts/ur.json +9 -0
- package/locales/layouts/vi.json +9 -0
- package/locales/layouts/yo.json +9 -0
- package/locales/layouts/zh-Hans.json +9 -0
- package/locales/layouts/zh-Hant.json +9 -0
- package/locales/lock/am.json +32 -0
- package/locales/lock/ar.json +32 -0
- package/locales/lock/bn.json +32 -0
- package/locales/lock/de.json +32 -0
- package/locales/lock/en.json +32 -0
- package/locales/lock/es.json +32 -0
- package/locales/lock/fa.json +32 -0
- package/locales/lock/fr.json +32 -0
- package/locales/lock/ha.json +32 -0
- package/locales/lock/he.json +32 -0
- package/locales/lock/hi.json +32 -0
- package/locales/lock/id.json +32 -0
- package/locales/lock/it.json +32 -0
- package/locales/lock/ja.json +32 -0
- package/locales/lock/ko.json +32 -0
- package/locales/lock/mr.json +32 -0
- package/locales/lock/ms.json +32 -0
- package/locales/lock/nl.json +32 -0
- package/locales/lock/pl.json +32 -0
- package/locales/lock/pt.json +32 -0
- package/locales/lock/ru.json +32 -0
- package/locales/lock/sw.json +32 -0
- package/locales/lock/ta.json +32 -0
- package/locales/lock/te.json +32 -0
- package/locales/lock/th.json +32 -0
- package/locales/lock/tl.json +32 -0
- package/locales/lock/tr.json +32 -0
- package/locales/lock/uk.json +32 -0
- package/locales/lock/ur.json +32 -0
- package/locales/lock/vi.json +32 -0
- package/locales/lock/yo.json +32 -0
- package/locales/lock/zh-Hans.json +32 -0
- package/locales/lock/zh-Hant.json +32 -0
- package/locales/machine/am.json +19 -0
- package/locales/machine/ar.json +19 -0
- package/locales/machine/bn.json +19 -0
- package/locales/machine/de.json +19 -0
- package/locales/machine/en.json +19 -0
- package/locales/machine/es.json +19 -0
- package/locales/machine/fa.json +19 -0
- package/locales/machine/fr.json +19 -0
- package/locales/machine/ha.json +19 -0
- package/locales/machine/he.json +19 -0
- package/locales/machine/hi.json +19 -0
- package/locales/machine/id.json +19 -0
- package/locales/machine/it.json +19 -0
- package/locales/machine/ja.json +19 -0
- package/locales/machine/ko.json +19 -0
- package/locales/machine/mr.json +19 -0
- package/locales/machine/ms.json +19 -0
- package/locales/machine/nl.json +19 -0
- package/locales/machine/pl.json +19 -0
- package/locales/machine/pt.json +19 -0
- package/locales/machine/ru.json +19 -0
- package/locales/machine/sw.json +19 -0
- package/locales/machine/ta.json +19 -0
- package/locales/machine/te.json +19 -0
- package/locales/machine/th.json +19 -0
- package/locales/machine/tl.json +19 -0
- package/locales/machine/tr.json +19 -0
- package/locales/machine/uk.json +19 -0
- package/locales/machine/ur.json +19 -0
- package/locales/machine/vi.json +19 -0
- package/locales/machine/yo.json +19 -0
- package/locales/machine/zh-Hans.json +19 -0
- package/locales/machine/zh-Hant.json +19 -0
- package/locales/made/am.json +16 -0
- package/locales/made/ar.json +16 -0
- package/locales/made/bn.json +16 -0
- package/locales/made/de.json +16 -0
- package/locales/made/en.json +16 -0
- package/locales/made/es.json +16 -0
- package/locales/made/fa.json +16 -0
- package/locales/made/fr.json +16 -0
- package/locales/made/ha.json +16 -0
- package/locales/made/he.json +16 -0
- package/locales/made/hi.json +16 -0
- package/locales/made/id.json +16 -0
- package/locales/made/it.json +16 -0
- package/locales/made/ja.json +16 -0
- package/locales/made/ko.json +16 -0
- package/locales/made/mr.json +16 -0
- package/locales/made/ms.json +16 -0
- package/locales/made/nl.json +16 -0
- package/locales/made/pl.json +16 -0
- package/locales/made/pt.json +16 -0
- package/locales/made/ru.json +16 -0
- package/locales/made/sw.json +16 -0
- package/locales/made/ta.json +16 -0
- package/locales/made/te.json +16 -0
- package/locales/made/th.json +16 -0
- package/locales/made/tl.json +16 -0
- package/locales/made/tr.json +16 -0
- package/locales/made/uk.json +16 -0
- package/locales/made/ur.json +16 -0
- package/locales/made/vi.json +16 -0
- package/locales/made/yo.json +16 -0
- package/locales/made/zh-Hans.json +16 -0
- package/locales/made/zh-Hant.json +16 -0
- package/locales/mr.json +395 -0
- package/locales/ms.json +387 -0
- package/locales/nl.json +395 -0
- package/locales/notifications/am.json +6 -0
- package/locales/notifications/ar.json +6 -0
- package/locales/notifications/bn.json +6 -0
- package/locales/notifications/de.json +6 -0
- package/locales/notifications/en.json +6 -0
- package/locales/notifications/es.json +6 -0
- package/locales/notifications/fa.json +6 -0
- package/locales/notifications/fr.json +6 -0
- package/locales/notifications/ha.json +6 -0
- package/locales/notifications/he.json +6 -0
- package/locales/notifications/hi.json +6 -0
- package/locales/notifications/id.json +6 -0
- package/locales/notifications/it.json +6 -0
- package/locales/notifications/ja.json +6 -0
- package/locales/notifications/ko.json +6 -0
- package/locales/notifications/mr.json +6 -0
- package/locales/notifications/ms.json +6 -0
- package/locales/notifications/nl.json +6 -0
- package/locales/notifications/pl.json +6 -0
- package/locales/notifications/pt.json +6 -0
- package/locales/notifications/ru.json +6 -0
- package/locales/notifications/sw.json +6 -0
- package/locales/notifications/ta.json +6 -0
- package/locales/notifications/te.json +6 -0
- package/locales/notifications/th.json +6 -0
- package/locales/notifications/tl.json +6 -0
- package/locales/notifications/tr.json +6 -0
- package/locales/notifications/uk.json +6 -0
- package/locales/notifications/ur.json +6 -0
- package/locales/notifications/vi.json +6 -0
- package/locales/notifications/yo.json +6 -0
- package/locales/notifications/zh-Hans.json +6 -0
- package/locales/notifications/zh-Hant.json +6 -0
- package/locales/pictures/am.json +36 -0
- package/locales/pictures/ar.json +36 -0
- package/locales/pictures/bn.json +36 -0
- package/locales/pictures/de.json +36 -0
- package/locales/pictures/en.json +36 -0
- package/locales/pictures/es.json +36 -0
- package/locales/pictures/fa.json +36 -0
- package/locales/pictures/fr.json +36 -0
- package/locales/pictures/ha.json +36 -0
- package/locales/pictures/he.json +36 -0
- package/locales/pictures/hi.json +36 -0
- package/locales/pictures/id.json +36 -0
- package/locales/pictures/it.json +36 -0
- package/locales/pictures/ja.json +36 -0
- package/locales/pictures/ko.json +36 -0
- package/locales/pictures/mr.json +36 -0
- package/locales/pictures/ms.json +36 -0
- package/locales/pictures/nl.json +36 -0
- package/locales/pictures/pl.json +36 -0
- package/locales/pictures/pt.json +36 -0
- package/locales/pictures/ru.json +36 -0
- package/locales/pictures/sw.json +36 -0
- package/locales/pictures/ta.json +36 -0
- package/locales/pictures/te.json +36 -0
- package/locales/pictures/th.json +36 -0
- package/locales/pictures/tl.json +36 -0
- package/locales/pictures/tr.json +36 -0
- package/locales/pictures/uk.json +36 -0
- package/locales/pictures/ur.json +36 -0
- package/locales/pictures/vi.json +36 -0
- package/locales/pictures/yo.json +36 -0
- package/locales/pictures/zh-Hans.json +36 -0
- package/locales/pictures/zh-Hant.json +36 -0
- package/locales/pl.json +411 -0
- package/locales/plan/am.json +13 -0
- package/locales/plan/ar.json +13 -0
- package/locales/plan/bn.json +13 -0
- package/locales/plan/de.json +13 -0
- package/locales/plan/en.json +13 -0
- package/locales/plan/es.json +13 -0
- package/locales/plan/fa.json +13 -0
- package/locales/plan/fr.json +13 -0
- package/locales/plan/ha.json +13 -0
- package/locales/plan/he.json +13 -0
- package/locales/plan/hi.json +13 -0
- package/locales/plan/id.json +13 -0
- package/locales/plan/it.json +13 -0
- package/locales/plan/ja.json +13 -0
- package/locales/plan/ko.json +13 -0
- package/locales/plan/mr.json +13 -0
- package/locales/plan/ms.json +13 -0
- package/locales/plan/nl.json +13 -0
- package/locales/plan/pl.json +13 -0
- package/locales/plan/pt.json +13 -0
- package/locales/plan/ru.json +13 -0
- package/locales/plan/sw.json +13 -0
- package/locales/plan/ta.json +13 -0
- package/locales/plan/te.json +13 -0
- package/locales/plan/th.json +13 -0
- package/locales/plan/tl.json +13 -0
- package/locales/plan/tr.json +13 -0
- package/locales/plan/uk.json +13 -0
- package/locales/plan/ur.json +13 -0
- package/locales/plan/vi.json +13 -0
- package/locales/plan/yo.json +13 -0
- package/locales/plan/zh-Hans.json +13 -0
- package/locales/plan/zh-Hant.json +13 -0
- package/locales/plugins/am.json +40 -0
- package/locales/plugins/ar.json +40 -0
- package/locales/plugins/bn.json +40 -0
- package/locales/plugins/de.json +40 -0
- package/locales/plugins/en.json +40 -0
- package/locales/plugins/es.json +40 -0
- package/locales/plugins/fa.json +40 -0
- package/locales/plugins/fr.json +40 -0
- package/locales/plugins/ha.json +40 -0
- package/locales/plugins/he.json +40 -0
- package/locales/plugins/hi.json +40 -0
- package/locales/plugins/id.json +40 -0
- package/locales/plugins/it.json +40 -0
- package/locales/plugins/ja.json +40 -0
- package/locales/plugins/ko.json +40 -0
- package/locales/plugins/mr.json +40 -0
- package/locales/plugins/ms.json +40 -0
- package/locales/plugins/nl.json +40 -0
- package/locales/plugins/pl.json +40 -0
- package/locales/plugins/pt.json +40 -0
- package/locales/plugins/ru.json +40 -0
- package/locales/plugins/sw.json +40 -0
- package/locales/plugins/ta.json +40 -0
- package/locales/plugins/te.json +40 -0
- package/locales/plugins/th.json +40 -0
- package/locales/plugins/tl.json +40 -0
- package/locales/plugins/tr.json +40 -0
- package/locales/plugins/uk.json +40 -0
- package/locales/plugins/ur.json +40 -0
- package/locales/plugins/vi.json +40 -0
- package/locales/plugins/yo.json +40 -0
- package/locales/plugins/zh-Hans.json +40 -0
- package/locales/plugins/zh-Hant.json +40 -0
- package/locales/policy/am.json +39 -0
- package/locales/policy/ar.json +39 -0
- package/locales/policy/bn.json +39 -0
- package/locales/policy/de.json +39 -0
- package/locales/policy/en.json +39 -0
- package/locales/policy/es.json +39 -0
- package/locales/policy/fa.json +39 -0
- package/locales/policy/fr.json +39 -0
- package/locales/policy/ha.json +39 -0
- package/locales/policy/he.json +39 -0
- package/locales/policy/hi.json +39 -0
- package/locales/policy/id.json +39 -0
- package/locales/policy/it.json +39 -0
- package/locales/policy/ja.json +39 -0
- package/locales/policy/ko.json +39 -0
- package/locales/policy/mr.json +39 -0
- package/locales/policy/ms.json +39 -0
- package/locales/policy/nl.json +39 -0
- package/locales/policy/pl.json +39 -0
- package/locales/policy/pt.json +39 -0
- package/locales/policy/ru.json +39 -0
- package/locales/policy/sw.json +39 -0
- package/locales/policy/ta.json +39 -0
- package/locales/policy/te.json +39 -0
- package/locales/policy/th.json +39 -0
- package/locales/policy/tl.json +39 -0
- package/locales/policy/tr.json +39 -0
- package/locales/policy/uk.json +39 -0
- package/locales/policy/ur.json +39 -0
- package/locales/policy/vi.json +39 -0
- package/locales/policy/yo.json +39 -0
- package/locales/policy/zh-Hans.json +39 -0
- package/locales/policy/zh-Hant.json +39 -0
- package/locales/profiles/am.json +59 -0
- package/locales/profiles/ar.json +59 -0
- package/locales/profiles/bn.json +59 -0
- package/locales/profiles/de.json +59 -0
- package/locales/profiles/en.json +59 -0
- package/locales/profiles/es.json +59 -0
- package/locales/profiles/fa.json +59 -0
- package/locales/profiles/fr.json +59 -0
- package/locales/profiles/ha.json +59 -0
- package/locales/profiles/he.json +59 -0
- package/locales/profiles/hi.json +59 -0
- package/locales/profiles/id.json +59 -0
- package/locales/profiles/it.json +59 -0
- package/locales/profiles/ja.json +59 -0
- package/locales/profiles/ko.json +59 -0
- package/locales/profiles/mr.json +59 -0
- package/locales/profiles/ms.json +59 -0
- package/locales/profiles/nl.json +59 -0
- package/locales/profiles/pl.json +59 -0
- package/locales/profiles/pt.json +59 -0
- package/locales/profiles/ru.json +59 -0
- package/locales/profiles/sw.json +59 -0
- package/locales/profiles/ta.json +59 -0
- package/locales/profiles/te.json +59 -0
- package/locales/profiles/th.json +59 -0
- package/locales/profiles/tl.json +59 -0
- package/locales/profiles/tr.json +59 -0
- package/locales/profiles/uk.json +59 -0
- package/locales/profiles/ur.json +59 -0
- package/locales/profiles/vi.json +59 -0
- package/locales/profiles/yo.json +59 -0
- package/locales/profiles/zh-Hans.json +59 -0
- package/locales/profiles/zh-Hant.json +59 -0
- package/locales/pt.json +403 -0
- package/locales/receipt/am.json +32 -0
- package/locales/receipt/ar.json +32 -0
- package/locales/receipt/bn.json +32 -0
- package/locales/receipt/de.json +32 -0
- package/locales/receipt/en.json +32 -0
- package/locales/receipt/es.json +32 -0
- package/locales/receipt/fa.json +32 -0
- package/locales/receipt/fr.json +32 -0
- package/locales/receipt/ha.json +32 -0
- package/locales/receipt/he.json +32 -0
- package/locales/receipt/hi.json +32 -0
- package/locales/receipt/id.json +32 -0
- package/locales/receipt/it.json +32 -0
- package/locales/receipt/ja.json +32 -0
- package/locales/receipt/ko.json +32 -0
- package/locales/receipt/mr.json +32 -0
- package/locales/receipt/ms.json +32 -0
- package/locales/receipt/nl.json +32 -0
- package/locales/receipt/pl.json +32 -0
- package/locales/receipt/pt.json +32 -0
- package/locales/receipt/ru.json +32 -0
- package/locales/receipt/sw.json +32 -0
- package/locales/receipt/ta.json +32 -0
- package/locales/receipt/te.json +32 -0
- package/locales/receipt/th.json +32 -0
- package/locales/receipt/tl.json +32 -0
- package/locales/receipt/tr.json +32 -0
- package/locales/receipt/uk.json +32 -0
- package/locales/receipt/ur.json +32 -0
- package/locales/receipt/vi.json +32 -0
- package/locales/receipt/yo.json +32 -0
- package/locales/receipt/zh-Hans.json +32 -0
- package/locales/receipt/zh-Hant.json +32 -0
- package/locales/ru.json +411 -0
- package/locales/scores/am.json +8 -0
- package/locales/scores/ar.json +8 -0
- package/locales/scores/bn.json +8 -0
- package/locales/scores/de.json +8 -0
- package/locales/scores/en.json +8 -0
- package/locales/scores/es.json +8 -0
- package/locales/scores/fa.json +8 -0
- package/locales/scores/fr.json +8 -0
- package/locales/scores/ha.json +8 -0
- package/locales/scores/he.json +8 -0
- package/locales/scores/hi.json +8 -0
- package/locales/scores/id.json +8 -0
- package/locales/scores/it.json +8 -0
- package/locales/scores/ja.json +8 -0
- package/locales/scores/ko.json +8 -0
- package/locales/scores/mr.json +8 -0
- package/locales/scores/ms.json +8 -0
- package/locales/scores/nl.json +8 -0
- package/locales/scores/pl.json +8 -0
- package/locales/scores/pt.json +8 -0
- package/locales/scores/ru.json +8 -0
- package/locales/scores/sw.json +8 -0
- package/locales/scores/ta.json +8 -0
- package/locales/scores/te.json +8 -0
- package/locales/scores/th.json +8 -0
- package/locales/scores/tl.json +8 -0
- package/locales/scores/tr.json +8 -0
- package/locales/scores/uk.json +8 -0
- package/locales/scores/ur.json +8 -0
- package/locales/scores/vi.json +8 -0
- package/locales/scores/yo.json +8 -0
- package/locales/scores/zh-Hans.json +8 -0
- package/locales/scores/zh-Hant.json +8 -0
- package/locales/search/am.json +26 -0
- package/locales/search/ar.json +34 -0
- package/locales/search/bn.json +26 -0
- package/locales/search/de.json +26 -0
- package/locales/search/en.json +26 -0
- package/locales/search/es.json +28 -0
- package/locales/search/fa.json +26 -0
- package/locales/search/fr.json +28 -0
- package/locales/search/ha.json +26 -0
- package/locales/search/he.json +30 -0
- package/locales/search/hi.json +26 -0
- package/locales/search/id.json +24 -0
- package/locales/search/it.json +28 -0
- package/locales/search/ja.json +24 -0
- package/locales/search/ko.json +24 -0
- package/locales/search/mr.json +26 -0
- package/locales/search/ms.json +24 -0
- package/locales/search/nl.json +26 -0
- package/locales/search/pl.json +30 -0
- package/locales/search/pt.json +28 -0
- package/locales/search/ru.json +30 -0
- package/locales/search/sw.json +26 -0
- package/locales/search/ta.json +26 -0
- package/locales/search/te.json +26 -0
- package/locales/search/th.json +24 -0
- package/locales/search/tl.json +26 -0
- package/locales/search/tr.json +26 -0
- package/locales/search/uk.json +30 -0
- package/locales/search/ur.json +26 -0
- package/locales/search/vi.json +24 -0
- package/locales/search/yo.json +24 -0
- package/locales/search/zh-Hans.json +24 -0
- package/locales/search/zh-Hant.json +24 -0
- package/locales/share/am.json +61 -0
- package/locales/share/ar.json +65 -0
- package/locales/share/bn.json +61 -0
- package/locales/share/de.json +61 -0
- package/locales/share/en.json +61 -0
- package/locales/share/es.json +62 -0
- package/locales/share/fa.json +61 -0
- package/locales/share/fr.json +62 -0
- package/locales/share/ha.json +61 -0
- package/locales/share/he.json +62 -0
- package/locales/share/hi.json +61 -0
- package/locales/share/id.json +60 -0
- package/locales/share/it.json +62 -0
- package/locales/share/ja.json +60 -0
- package/locales/share/ko.json +60 -0
- package/locales/share/mr.json +61 -0
- package/locales/share/ms.json +60 -0
- package/locales/share/nl.json +61 -0
- package/locales/share/pl.json +63 -0
- package/locales/share/pt.json +62 -0
- package/locales/share/ru.json +63 -0
- package/locales/share/sw.json +61 -0
- package/locales/share/ta.json +61 -0
- package/locales/share/te.json +61 -0
- package/locales/share/th.json +60 -0
- package/locales/share/tl.json +61 -0
- package/locales/share/tr.json +61 -0
- package/locales/share/uk.json +63 -0
- package/locales/share/ur.json +61 -0
- package/locales/share/vi.json +60 -0
- package/locales/share/yo.json +60 -0
- package/locales/share/zh-Hans.json +60 -0
- package/locales/share/zh-Hant.json +60 -0
- package/locales/signin/am.json +6 -0
- package/locales/signin/ar.json +6 -0
- package/locales/signin/bn.json +6 -0
- package/locales/signin/de.json +6 -0
- package/locales/signin/en.json +6 -0
- package/locales/signin/es.json +6 -0
- package/locales/signin/fa.json +6 -0
- package/locales/signin/fr.json +6 -0
- package/locales/signin/ha.json +6 -0
- package/locales/signin/he.json +6 -0
- package/locales/signin/hi.json +6 -0
- package/locales/signin/id.json +6 -0
- package/locales/signin/it.json +6 -0
- package/locales/signin/ja.json +6 -0
- package/locales/signin/ko.json +6 -0
- package/locales/signin/mr.json +6 -0
- package/locales/signin/ms.json +6 -0
- package/locales/signin/nl.json +6 -0
- package/locales/signin/pl.json +6 -0
- package/locales/signin/pt.json +6 -0
- package/locales/signin/ru.json +6 -0
- package/locales/signin/sw.json +6 -0
- package/locales/signin/ta.json +6 -0
- package/locales/signin/te.json +6 -0
- package/locales/signin/th.json +6 -0
- package/locales/signin/tl.json +6 -0
- package/locales/signin/tr.json +6 -0
- package/locales/signin/uk.json +6 -0
- package/locales/signin/ur.json +6 -0
- package/locales/signin/vi.json +6 -0
- package/locales/signin/yo.json +6 -0
- package/locales/signin/zh-Hans.json +6 -0
- package/locales/signin/zh-Hant.json +6 -0
- package/locales/slides/am.json +10 -0
- package/locales/slides/ar.json +10 -0
- package/locales/slides/bn.json +10 -0
- package/locales/slides/de.json +10 -0
- package/locales/slides/en.json +10 -0
- package/locales/slides/es.json +10 -0
- package/locales/slides/fa.json +10 -0
- package/locales/slides/fr.json +10 -0
- package/locales/slides/ha.json +10 -0
- package/locales/slides/he.json +10 -0
- package/locales/slides/hi.json +10 -0
- package/locales/slides/id.json +10 -0
- package/locales/slides/it.json +10 -0
- package/locales/slides/ja.json +10 -0
- package/locales/slides/ko.json +10 -0
- package/locales/slides/mr.json +10 -0
- package/locales/slides/ms.json +10 -0
- package/locales/slides/nl.json +10 -0
- package/locales/slides/pl.json +10 -0
- package/locales/slides/pt.json +10 -0
- package/locales/slides/ru.json +10 -0
- package/locales/slides/sw.json +10 -0
- package/locales/slides/ta.json +10 -0
- package/locales/slides/te.json +10 -0
- package/locales/slides/th.json +10 -0
- package/locales/slides/tl.json +10 -0
- package/locales/slides/tr.json +10 -0
- package/locales/slides/uk.json +10 -0
- package/locales/slides/ur.json +10 -0
- package/locales/slides/vi.json +10 -0
- package/locales/slides/yo.json +10 -0
- package/locales/slides/zh-Hans.json +10 -0
- package/locales/slides/zh-Hant.json +10 -0
- package/locales/sw.json +395 -0
- package/locales/sync/am.json +13 -0
- package/locales/sync/ar.json +13 -0
- package/locales/sync/bn.json +13 -0
- package/locales/sync/de.json +13 -0
- package/locales/sync/en.json +13 -0
- package/locales/sync/es.json +13 -0
- package/locales/sync/fa.json +13 -0
- package/locales/sync/fr.json +13 -0
- package/locales/sync/ha.json +13 -0
- package/locales/sync/he.json +13 -0
- package/locales/sync/hi.json +13 -0
- package/locales/sync/id.json +13 -0
- package/locales/sync/it.json +13 -0
- package/locales/sync/ja.json +13 -0
- package/locales/sync/ko.json +13 -0
- package/locales/sync/mr.json +13 -0
- package/locales/sync/ms.json +13 -0
- package/locales/sync/nl.json +13 -0
- package/locales/sync/pl.json +13 -0
- package/locales/sync/pt.json +13 -0
- package/locales/sync/ru.json +13 -0
- package/locales/sync/sw.json +13 -0
- package/locales/sync/ta.json +13 -0
- package/locales/sync/te.json +13 -0
- package/locales/sync/th.json +13 -0
- package/locales/sync/tl.json +13 -0
- package/locales/sync/tr.json +13 -0
- package/locales/sync/uk.json +13 -0
- package/locales/sync/ur.json +13 -0
- package/locales/sync/vi.json +13 -0
- package/locales/sync/yo.json +13 -0
- package/locales/sync/zh-Hans.json +13 -0
- package/locales/sync/zh-Hant.json +13 -0
- package/locales/ta.json +395 -0
- package/locales/te.json +395 -0
- package/locales/th.json +387 -0
- package/locales/tl.json +395 -0
- package/locales/tr.json +395 -0
- package/locales/uk.json +411 -0
- package/locales/ur.json +395 -0
- package/locales/vi.json +387 -0
- package/locales/yo.json +387 -0
- package/locales/zh-Hans.json +387 -0
- package/locales/zh-Hant.json +387 -0
- package/package.json +9 -4
- package/preview.html +75 -0
- package/ui/caps.js +148 -0
- package/ui/csp.js +82 -0
- package/ui/export.js +214 -0
- package/ui/icons.js +31 -0
- package/ui/looks/blueprint.css +72 -0
- package/ui/looks/classic.css +105 -0
- package/ui/looks/fjord.css +56 -0
- package/ui/looks/human.css +232 -0
- package/ui/looks/mail.css +61 -0
- package/ui/looks/minimal.css +62 -0
- package/ui/looks/mondrian.css +90 -0
- package/ui/looks/neon.css +100 -0
- package/ui/looks/notebook.css +82 -0
- package/ui/looks/paper.css +51 -0
- package/ui/looks/swiss.css +64 -0
- package/ui/looks/terminal.css +84 -0
- package/ui/looks/tilde.css +61 -0
- package/ui/looks/velvet.css +61 -0
- package/ui/markdown.js +188 -0
- package/ui/menu-icons.js +64 -0
- package/ui/model.js +70 -0
- package/ui/reader-state.js +38 -0
- package/ui/reader.js +68 -0
- package/ui/save.js +53 -0
- package/ui/sheet.js +13 -0
- package/ui/style.css +813 -0
- package/ui/trusted.js +13 -0
- package/ui/weights.js +37 -0
- package/vendor/LICENSES/abcjs.txt +21 -0
- package/vendor/LICENSES/base64-js.txt +21 -0
- package/vendor/LICENSES/buffer.txt +21 -0
- package/vendor/LICENSES/diff.txt +29 -0
- package/vendor/LICENSES/echarts.txt +229 -0
- package/vendor/LICENSES/fflate.txt +21 -0
- package/vendor/LICENSES/huggingface-transformers.txt +202 -0
- package/vendor/LICENSES/ieee754.txt +11 -0
- package/vendor/LICENSES/jean-is-sounds.txt +92 -0
- package/vendor/LICENSES/jitl-quickjs-ffi-types.txt +21 -0
- package/vendor/LICENSES/jitl-quickjs-wasmfile-release-sync.txt +47 -0
- package/vendor/LICENSES/just-bash.txt +201 -0
- package/vendor/LICENSES/lit-html.txt +28 -0
- package/vendor/LICENSES/maplibre-gl.txt +2 -0
- package/vendor/LICENSES/marked.txt +44 -0
- package/vendor/LICENSES/onnxruntime-web.txt +2 -0
- package/vendor/LICENSES/pdfjs-dist.txt +177 -0
- package/vendor/LICENSES/preact-signals-core.txt +21 -0
- package/vendor/LICENSES/pyodide.txt +2 -0
- package/vendor/LICENSES/quickjs-emscripten-core.txt +21 -0
- package/vendor/LICENSES/silurus-ooxml.txt +21 -0
- package/vendor/LICENSES/spessasynth_core.txt +202 -0
- package/vendor/LICENSES/sprintf-js.txt +24 -0
- package/vendor/LICENSES/stb-vorbis.txt +202 -0
- package/vendor/LICENSES/temml.txt +21 -0
- package/vendor/LICENSES/turndown.txt +21 -0
- package/vendor/LICENSES/zrender.txt +29 -0
- package/vendor/abcjs/abcjs.mjs +6 -0
- package/vendor/echarts/echarts.mjs +45 -0
- package/vendor/lit-html/async-directive.js +6 -0
- package/vendor/lit-html/directive-helpers.js +6 -0
- package/vendor/lit-html/directive.js +6 -0
- package/vendor/lit-html/directives/ref.js +6 -0
- package/vendor/lit-html/lit-html.js +6 -0
- package/vendor/maplibre/maplibre-gl-worker.js +9 -0
- package/vendor/maplibre/maplibre-gl.css +1 -0
- package/vendor/maplibre/maplibre-gl.mjs +818 -0
- package/vendor/marked.esm.js +79 -0
- package/vendor/signals-core.mjs +1 -0
- package/vendor/spessasynth/spessasynth.mjs +20764 -0
- package/vendor/spessasynth/stb-vorbis.mjs +1 -0
- package/vendor/temml/Temml.woff2 +0 -0
- package/vendor/temml/temml.css +372 -0
- package/vendor/temml/temml.mjs +2 -0
package/core/files.js
ADDED
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
// The project's file library: files/sha256-<hash>.<ext> (the original), .md (its text,
|
|
2
|
+
// with a [[page N]] line before each page) and .meta.json. Named by content, so the
|
|
3
|
+
// same file dropped twice is stored once. Conversations link to files, never copy them.
|
|
4
|
+
import { encoder, join, readJSON, walk, writeJSON } from './fs.js'
|
|
5
|
+
import { isPicture } from './events.js'
|
|
6
|
+
import { lexicon, lookup } from './search.js'
|
|
7
|
+
|
|
8
|
+
/** @import { FS, Envelope, ResourceLink, DocumentPart } from './types.js' */
|
|
9
|
+
/** @typedef {{ format: 1, kind: 'file', name: string, mimeType: string, size: number, hash: string, pages: number, createdAt: string, author: string }} FileMeta */
|
|
10
|
+
|
|
11
|
+
const MARKER = /^\[\[page (\d+)\]\]$/m
|
|
12
|
+
|
|
13
|
+
/** @param {Uint8Array} bytes */
|
|
14
|
+
export async function sha256Hex(bytes) {
|
|
15
|
+
const digest = await crypto.subtle.digest('SHA-256', /** @type {BufferSource} */ (bytes))
|
|
16
|
+
return [...new Uint8Array(digest)].map((byte) => byte.toString(16).padStart(2, '0')).join('')
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** @param {string} text */
|
|
20
|
+
const utf8 = (text) => encoder.encode(text).length
|
|
21
|
+
|
|
22
|
+
/** Rough and deliberately high: UTF-8 bytes / 3 (about right for CJK, generous for Latin). @param {string} text */
|
|
23
|
+
export const estimateTokens = (text) => Math.ceil(utf8(text) / 3)
|
|
24
|
+
|
|
25
|
+
/** Roughly how much a request's messages take of a brain's window, pictures and replayed blocks aside (D359). @param {unknown} value */
|
|
26
|
+
export const estimateMessages = (value) => estimateTokens(JSON.stringify(value, (key, part) => (key === 'image' || key === 'raw' ? undefined : part)) ?? '')
|
|
27
|
+
|
|
28
|
+
/** @param {string[]} pages @param {number} [first] the first one's number */
|
|
29
|
+
export const joinPages = (pages, first = 1) => pages.map((page, i) => `[[page ${first + i}]]\n${page}`).join('\n\n')
|
|
30
|
+
|
|
31
|
+
/** @param {string} text @returns {string[]} */
|
|
32
|
+
export function splitPages(text) {
|
|
33
|
+
const parts = text.split(/^\[\[page \d+\]\]\n?/m)
|
|
34
|
+
return MARKER.test(text) ? parts.slice(1).map((page) => page.trim()) : [text.trim()]
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Stores a file and its extracted text. Returns the link a conversation keeps.
|
|
39
|
+
* @param {FS} fs @param {{ projectDir: string, name: string, mimeType?: string, bytes: Uint8Array, pages: string[], by: string, now?: Date }} input
|
|
40
|
+
* @returns {Promise<ResourceLink>}
|
|
41
|
+
*/
|
|
42
|
+
export async function addFile(fs, { projectDir, name, mimeType = '', bytes, pages, by, now = new Date() }) {
|
|
43
|
+
const hash = await sha256Hex(bytes)
|
|
44
|
+
const ext = /\.([a-z0-9]{1,8})$/i.exec(name)?.[1]?.toLowerCase() ?? 'bin'
|
|
45
|
+
const uri = `files/sha256-${hash}.${ext}`
|
|
46
|
+
const base = join(projectDir, `files/sha256-${hash}`)
|
|
47
|
+
if (!(await fs.exists(join(projectDir, uri)))) {
|
|
48
|
+
await fs.writeBytes(join(projectDir, uri), bytes)
|
|
49
|
+
await fs.write(`${base}.md`, joinPages(pages))
|
|
50
|
+
/** @type {FileMeta} */
|
|
51
|
+
const meta = { format: 1, kind: 'file', name, mimeType, size: bytes.length, hash, pages: pages.length, createdAt: now.toISOString(), author: by }
|
|
52
|
+
await writeJSON(fs, `${base}.meta.json`, meta)
|
|
53
|
+
}
|
|
54
|
+
return { type: 'resource_link', uri, name, ...(mimeType && { mimeType }), size: bytes.length }
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** @param {string} uri @returns {string} the extracted text's path, relative to the project */
|
|
58
|
+
const textPath = (uri) => uri.replace(/\.[^./]+$/, '.md')
|
|
59
|
+
|
|
60
|
+
/** @param {FS} fs @param {string} projectDir @param {string} uri */
|
|
61
|
+
export const fileText = (fs, projectDir, uri) => fs.read(join(projectDir, textPath(uri)))
|
|
62
|
+
|
|
63
|
+
/** @param {FS} fs @param {string} projectDir @param {string} uri @returns {Promise<FileMeta | null>} */
|
|
64
|
+
export const fileMeta = (fs, projectDir, uri) => readJSON(fs, join(projectDir, textPath(uri).replace(/\.md$/, '.meta.json')))
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Which pages of a file go into the brain's context: all of them if they fit the budget,
|
|
68
|
+
* otherwise the first ones that do (at least one). Decided once, when the message is sent,
|
|
69
|
+
* and recorded on the link, so the conversation's prefix never changes afterwards (D46).
|
|
70
|
+
* @param {string[]} pages @param {number} budgetTokens
|
|
71
|
+
* @returns {[number, number]} first and last page, 1-based
|
|
72
|
+
*/
|
|
73
|
+
export function pagesThatFit(pages, budgetTokens) {
|
|
74
|
+
let used = 0
|
|
75
|
+
let last = 0
|
|
76
|
+
for (const page of pages) {
|
|
77
|
+
used += estimateTokens(page)
|
|
78
|
+
if (used > budgetTokens && last > 0) break
|
|
79
|
+
last++
|
|
80
|
+
}
|
|
81
|
+
return [1, Math.max(last, 1)]
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* A document's pages cut for searching: passages of about `size` tokens (100 scored best, D24), never across a page, cut
|
|
86
|
+
* where a line ends (a longer line in pieces) or a heading starts. Each knows its page, where it lies
|
|
87
|
+
* in it, and what heads it: the headings above, a level each (lines starting with #), else its page's
|
|
88
|
+
* first line that reads like one and isn't on most pages' tops (a running header, a page number), and
|
|
89
|
+
* a table's column names.
|
|
90
|
+
* @param {string[]} pages @returns {{ page: number, start: number, end: number, head: string }[]}
|
|
91
|
+
*/
|
|
92
|
+
export function passages(pages, size = 100) {
|
|
93
|
+
/** @type {Map<string, number>} */
|
|
94
|
+
const tops = new Map()
|
|
95
|
+
for (const page of pages) for (const line of page.split('\n', 3)) tops.set(line.replace(/\d+/g, '#'), (tops.get(line.replace(/\d+/g, '#')) ?? 0) + 1)
|
|
96
|
+
/** @type {{ page: number, start: number, end: number, head: string, bytes: number }[]} */
|
|
97
|
+
const out = []
|
|
98
|
+
/** @type {string[]} the headings above, a level each */
|
|
99
|
+
let path = []
|
|
100
|
+
pages.forEach((text, i) => {
|
|
101
|
+
// The page's first line that reads like a heading, the columns of the table under way, where the line starts.
|
|
102
|
+
let [first, columns, at] = ['', '', 0]
|
|
103
|
+
/** @type {typeof out[number] | null} */
|
|
104
|
+
let passage = null
|
|
105
|
+
for (const line of text.split('\n')) {
|
|
106
|
+
const tabular = /\t|^\|/.test(line)
|
|
107
|
+
const level = /^(#{1,6})\s/.exec(line)?.[1].length ?? 0
|
|
108
|
+
// A heading starts a passage, once the one before is half full.
|
|
109
|
+
if (level && passage && passage.bytes > size * 1.5) passage = (out.push(passage), null)
|
|
110
|
+
const bytes = utf8(line) + 1
|
|
111
|
+
const step = Math.max(1, Math.floor(size * 3 * (line.length + 1) / bytes))
|
|
112
|
+
for (let cut = at; cut <= at + line.length; cut += step) {
|
|
113
|
+
const end = Math.min(at + line.length, cut + step)
|
|
114
|
+
const piece = bytes * (end - cut + 1) / (line.length + 1)
|
|
115
|
+
if (passage && passage.bytes + piece > size * 3) passage = (out.push(passage), null)
|
|
116
|
+
// A passage that starts with a heading is headed by the levels above it.
|
|
117
|
+
const above = (level && cut === at ? path.slice(0, level - 1) : path).filter(Boolean).join(' › ') || (level ? '' : first)
|
|
118
|
+
passage ??= { page: i + 1, start: cut, end, bytes: 0, head: [above, tabular && columns !== line && columns !== above ? columns : ''].filter(Boolean).join('\n') }
|
|
119
|
+
passage.end = end
|
|
120
|
+
passage.bytes += piece
|
|
121
|
+
}
|
|
122
|
+
if (level) path = Object.assign(path.slice(0, level - 1), { [level - 1]: line.slice(level).trim() })
|
|
123
|
+
// A first line heads the page only if it reads like a heading: not a table's row, not mostly figures.
|
|
124
|
+
else if (!first && line.trim() && !tabular && (line.match(/\d/g)?.length ?? 0) <= line.length / 5 && !(pages.length > 2 && (tops.get(line.replace(/\d+/g, '#')) ?? 0) > pages.length / 2)) first = line.trim().slice(0, 120)
|
|
125
|
+
columns = tabular ? columns || line : ''
|
|
126
|
+
at += line.length + 1
|
|
127
|
+
}
|
|
128
|
+
if (passage) out.push(passage)
|
|
129
|
+
})
|
|
130
|
+
return out.filter((p) => pages[p.page - 1].slice(p.start, p.end).trim()).map(({ page, start, end, head }) => ({ page, start, end, head }))
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** A document's passages and their index, made in memory. @param {string[]} pages */
|
|
134
|
+
export function indexOf(pages, size = 100) {
|
|
135
|
+
const cut = passages(pages, size)
|
|
136
|
+
return { passages: cut, lexicon: lexicon(cut.map((p) => `${p.head}\n${pages[p.page - 1].slice(p.start, p.end)}`)) }
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** Page numbers as ranges. @param {number[]} numbers @returns {[number, number][]} */
|
|
140
|
+
export const ranges = (numbers) => [...new Set(numbers)].sort((a, b) => a - b).reduce((/** @type {[number, number][]} */ out, n) => (n === out[out.length - 1]?.[1] + 1
|
|
141
|
+
? out[out.length - 1][1] = n : out.push([n, n]), out), [])
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* The pages a brain reads of a file too long for its budget: page 1, then those whose passages best
|
|
145
|
+
* match the message; the first pages when nothing in it stands out (no word rarer than most).
|
|
146
|
+
* @param {string[]} pages @param {string} message @param {number} budget tokens
|
|
147
|
+
* @returns {[number, number][]} ranges of pages, 1-based
|
|
148
|
+
*/
|
|
149
|
+
export function preselect(pages, message, budget, index = indexOf(pages)) {
|
|
150
|
+
const hits = lookup([index.lexicon], message)
|
|
151
|
+
if (!hits.length || hits[0].score < 2 || pages.reduce((sum, page) => sum + estimateTokens(page), 0) <= budget) return [pagesThatFit(pages, budget)]
|
|
152
|
+
const chosen = [1]
|
|
153
|
+
let used = estimateTokens(pages[0])
|
|
154
|
+
for (const { passage } of hits) {
|
|
155
|
+
const page = index.passages[passage].page
|
|
156
|
+
if (chosen.includes(page) || used + estimateTokens(pages[page - 1]) > budget) continue
|
|
157
|
+
chosen.push(page)
|
|
158
|
+
used += estimateTokens(pages[page - 1])
|
|
159
|
+
}
|
|
160
|
+
return ranges(chosen)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* The text the brain reads for a linked file, using the pages recorded on the link. A picture
|
|
165
|
+
* comes with its bytes for a brain that can see, and is only named to one that can't.
|
|
166
|
+
* @param {ResourceLink} link @param {string | null} text the file's extracted text
|
|
167
|
+
* @param {string} [picture] a picture's bytes, base64
|
|
168
|
+
* @returns {DocumentPart}
|
|
169
|
+
*/
|
|
170
|
+
export function documentPart(link, text, picture) {
|
|
171
|
+
const part = { name: link.name, ...(link._meta?.source && { source: link._meta.source }) }
|
|
172
|
+
if (text === null) return { ...part, text: '(This file is no longer available.)' }
|
|
173
|
+
if (isPicture(link) && picture) return { ...part, text: '(The picture follows.)', image: { mimeType: String(link.mimeType), data: picture } }
|
|
174
|
+
if (isPicture(link)) return { ...part, text: '(A picture. You cannot see pictures: say so if the user asks about it.)' }
|
|
175
|
+
const pages = splitPages(text)
|
|
176
|
+
const chosen = link._meta?.pages ?? [[1, pages.length]]
|
|
177
|
+
if (chosen.length === 1 && chosen[0][0] === 1 && chosen[0][1] >= pages.length) return { ...part, text: pages.length > 1 ? joinPages(pages) : pages[0] }
|
|
178
|
+
const which = chosen.map(([a, b]) => (a === b ? a : `${a}–${b}`)).join(', ')
|
|
179
|
+
return { ...part, text: `${chosen.map(([a, b]) => joinPages(pages.slice(a - 1, b), a)).join('\n\n')}\n\n(${/[–,]/.test(which) ? 'Pages' : 'Page'} ${which} of ${pages.length}. Use read for the others.)` }
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* The number each file is cited by: the one it was first shared with, else the next one.
|
|
184
|
+
* @param {ResourceLink[]} earlier links already in the conversation @param {ResourceLink} link
|
|
185
|
+
*/
|
|
186
|
+
export function sourceNumber(earlier, link) {
|
|
187
|
+
const numbers = earlier.map((other) => other._meta?.source ?? 0)
|
|
188
|
+
return earlier.find((other) => other.uri === link.uri && other._meta?.source)?._meta?.source ?? Math.max(0, ...numbers) + 1
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** The number a turn's first new source is cited by: after every file and source so far (D71). @param {Envelope[]} records */
|
|
192
|
+
export const nextSource = (records) => 1 + Math.max(0, ...records.flatMap(({ update }) => (update?.sessionUpdate === 'user_message_chunk' && update.content.type === 'resource_link'
|
|
193
|
+
? [update.content._meta?.source ?? 0] : update?.sessionUpdate === 'tool_call' ? (update._meta?.sources ?? []).map((source) => source.n) : [])))
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* "3", "2-5" or "4-" → a 1-based inclusive range within 1..count.
|
|
197
|
+
* @param {string | number | undefined} spec @param {number} count
|
|
198
|
+
* @returns {[number, number]}
|
|
199
|
+
*/
|
|
200
|
+
export function parsePages(spec, count) {
|
|
201
|
+
const match = /^\s*(\d+)?\s*(?:[-–]\s*(\d+)?)?\s*$/.exec(String(spec ?? ''))
|
|
202
|
+
if (!match || (!match[1] && !match[2])) return [1, count]
|
|
203
|
+
const first = Math.min(Math.max(Number(match[1] ?? 1), 1), count)
|
|
204
|
+
const last = match[2] ? Math.min(Number(match[2]), count) : /[-–]/.test(String(spec)) ? count : first
|
|
205
|
+
return [first, Math.max(first, last)]
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* The `read` tool: pages of a file the user shared in this project. Long reads are cut to
|
|
210
|
+
* about maxTokens so a small brain's context isn't flooded.
|
|
211
|
+
* @param {{ fs: FS, projectDir: () => string, files: (signal?: AbortSignal) => ResourceLink[], maxTokens?: number }} options
|
|
212
|
+
* files: those of the conversation a run's signal belongs to, which may not be on screen (D147)
|
|
213
|
+
* @returns {import('./loop.js').Tool}
|
|
214
|
+
*/
|
|
215
|
+
export function readTool({ fs, projectDir, files, maxTokens = 6000 }) {
|
|
216
|
+
/** @param {any} args @param {AbortSignal} [signal] */
|
|
217
|
+
const find = (args, signal) => {
|
|
218
|
+
const wanted = String(args?.file ?? '').trim().toLowerCase()
|
|
219
|
+
return files(signal).findLast((link) => link.name.toLowerCase() === wanted || link.uri.toLowerCase() === wanted)
|
|
220
|
+
}
|
|
221
|
+
return {
|
|
222
|
+
spec: {
|
|
223
|
+
name: 'read',
|
|
224
|
+
description: 'Read pages of a file the user shared. Pages are numbered from 1.',
|
|
225
|
+
parameters: {
|
|
226
|
+
type: 'object',
|
|
227
|
+
properties: {
|
|
228
|
+
file: { type: 'string', description: 'The file name, as shown in the conversation' },
|
|
229
|
+
pages: { type: 'string', description: 'A page or a range, e.g. "3" or "2-5". Omit to start at page 1.' },
|
|
230
|
+
},
|
|
231
|
+
required: ['file'],
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
kind: 'read',
|
|
235
|
+
title: (args) => `Read ${args?.file ?? ''}`,
|
|
236
|
+
locations: (args) => {
|
|
237
|
+
const link = find(args)
|
|
238
|
+
return link ? [{ path: link.uri }] : []
|
|
239
|
+
},
|
|
240
|
+
run: async (args, ctx) => {
|
|
241
|
+
const link = find(args, ctx?.signal)
|
|
242
|
+
if (!link) throw new Error(`No file named "${args?.file}". Files: ${files(ctx?.signal).map((f) => f.name).join(', ') || 'none'}.`)
|
|
243
|
+
if (isPicture(link)) throw new Error(`"${link.name}" is a picture, with the message it came in: it has no text to read.`)
|
|
244
|
+
const text = await fileText(fs, projectDir(), link.uri)
|
|
245
|
+
if (text === null) throw new Error(`"${link.name}" is no longer available.`)
|
|
246
|
+
const pages = splitPages(text)
|
|
247
|
+
const [first, wantedLast] = parsePages(args?.pages, pages.length)
|
|
248
|
+
let out = ''
|
|
249
|
+
let last = first - 1
|
|
250
|
+
for (let n = first; n <= wantedLast; n++) {
|
|
251
|
+
const next = `[[page ${n}]]\n${pages[n - 1]}\n\n`
|
|
252
|
+
if (out && estimateTokens(out + next) > maxTokens) break
|
|
253
|
+
out += next
|
|
254
|
+
last = n
|
|
255
|
+
}
|
|
256
|
+
const more = last < pages.length ? ` Pages ${last + 1}–${pages.length} are not shown.` : ''
|
|
257
|
+
const source = link._meta?.source ? `Source [${link._meta.source}]: ` : ''
|
|
258
|
+
return `${source}${link.name}, pages ${first}–${last} of ${pages.length}.${more}\n\n${out.trim()}`
|
|
259
|
+
},
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* What Jean's files take, in bytes, by kind, for Settings › Your data (D177): projects' conversations, files
|
|
265
|
+
* and workspaces, and the rest (settings, memory, instructions, skills, routines, keys, indexes).
|
|
266
|
+
* @param {FS} fs @returns {Promise<Record<'conversations' | 'files' | 'workspace' | 'rest', number>>}
|
|
267
|
+
*/
|
|
268
|
+
export async function weigh(fs) {
|
|
269
|
+
const kinds = { conversations: 0, files: 0, workspace: 0, rest: 0 }
|
|
270
|
+
await Promise.all((await walk(fs)).map(async (path) => {
|
|
271
|
+
const [top, , folder = ''] = path.split('/')
|
|
272
|
+
const kind = top === 'projects' && (folder === 'conversations' || folder === 'files' || folder === 'workspace') ? folder : 'rest'
|
|
273
|
+
const size = (fs.stat ? (await fs.stat(path))?.size : (await fs.readBytes(path))?.length) ?? 0
|
|
274
|
+
kinds[kind] += size
|
|
275
|
+
}))
|
|
276
|
+
return kinds
|
|
277
|
+
}
|
package/core/fs.js
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
// Paths, an in-memory FS (tests, fallback), and JSON helpers.
|
|
2
|
+
// The browser FS lives in ui/opfs.js; both implement the FS type in types.d.ts.
|
|
3
|
+
|
|
4
|
+
/** @import { FS, DirEntry } from './types.js' */
|
|
5
|
+
|
|
6
|
+
/** Like normalizePath, but '' (the root) is allowed. @param {string} path @returns {string} */
|
|
7
|
+
export function normalizeDir(path) {
|
|
8
|
+
if (typeof path !== 'string') throw new TypeError(`Path must be a string, got ${typeof path}`)
|
|
9
|
+
if (path.startsWith('/') || path.includes('\\')) throw new TypeError(`Invalid path: ${path}`)
|
|
10
|
+
const trimmed = path.endsWith('/') ? path.slice(0, -1) : path
|
|
11
|
+
if (trimmed === '') return ''
|
|
12
|
+
for (const segment of trimmed.split('/')) {
|
|
13
|
+
if (segment === '' || segment === '.' || segment === '..') throw new TypeError(`Invalid path: ${path}`)
|
|
14
|
+
}
|
|
15
|
+
return trimmed
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** @param {string} path relative POSIX path, e.g. "projects/x/project.md" @returns {string} */
|
|
19
|
+
export function normalizePath(path) {
|
|
20
|
+
const normalized = normalizeDir(path)
|
|
21
|
+
if (normalized === '') throw new TypeError('Empty path')
|
|
22
|
+
return normalized
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Empty parts are ignored; joining nothing gives '' (the root). @param {...string} parts */
|
|
26
|
+
export const join = (...parts) => parts.map(normalizeDir).filter(Boolean).join('/')
|
|
27
|
+
|
|
28
|
+
/** @param {string} path @returns {string} '' for top-level entries */
|
|
29
|
+
export function dirname(path) {
|
|
30
|
+
const normalized = normalizePath(path)
|
|
31
|
+
const slash = normalized.lastIndexOf('/')
|
|
32
|
+
return slash < 0 ? '' : normalized.slice(0, slash)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** @param {string} path */
|
|
36
|
+
export function basename(path) {
|
|
37
|
+
const normalized = normalizePath(path)
|
|
38
|
+
return normalized.slice(normalized.lastIndexOf('/') + 1)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Entries in the order of their names' code units, as every FS lists them. @param {DirEntry} a @param {DirEntry} b */
|
|
42
|
+
export const byName = (a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0)
|
|
43
|
+
|
|
44
|
+
/** @param {unknown} text */
|
|
45
|
+
function assertText(text) {
|
|
46
|
+
if (typeof text !== 'string') throw new TypeError(`File content must be a string, got ${typeof text}`)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** @param {unknown} bytes */
|
|
50
|
+
function assertBytes(bytes) {
|
|
51
|
+
if (!(bytes instanceof Uint8Array)) throw new TypeError('File content must be a Uint8Array')
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export const encoder = new TextEncoder()
|
|
55
|
+
const decoder = new TextDecoder()
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* FS backed by a Map. Directories are implicit: one exists while a file lives under it.
|
|
59
|
+
* Mirrors OPFS type conflicts (a file where a directory is expected, or the reverse).
|
|
60
|
+
* @param {Record<string, string | Uint8Array>} [initial] seed files, keyed by path
|
|
61
|
+
* @returns {FS}
|
|
62
|
+
*/
|
|
63
|
+
export function memoryFS(initial = {}) {
|
|
64
|
+
/** @type {Map<string, string | Uint8Array>} */
|
|
65
|
+
const files = new Map()
|
|
66
|
+
// When each file last changed: always later than before, even within a millisecond.
|
|
67
|
+
/** @type {Map<string, number>} */
|
|
68
|
+
const changed = new Map()
|
|
69
|
+
let clock = 0
|
|
70
|
+
/** @param {string} key @param {string | Uint8Array} value */
|
|
71
|
+
const put = (key, value) => {
|
|
72
|
+
files.set(key, value)
|
|
73
|
+
changed.set(key, (clock = Math.max(clock + 1, Date.now())))
|
|
74
|
+
}
|
|
75
|
+
/** @param {string} key */
|
|
76
|
+
const text = (key) => {
|
|
77
|
+
const value = files.get(key)
|
|
78
|
+
return value === undefined ? null : typeof value === 'string' ? value : decoder.decode(value)
|
|
79
|
+
}
|
|
80
|
+
for (const [path, value] of Object.entries(initial)) put(normalizePath(path), value)
|
|
81
|
+
|
|
82
|
+
/** @param {string} path */
|
|
83
|
+
const isDir = (path) => {
|
|
84
|
+
for (const key of files.keys()) if (key.startsWith(path + '/')) return true
|
|
85
|
+
return false
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** A path a file can be written at, normalized: not a directory, and under none of the files. @param {string} path */
|
|
89
|
+
const writable = (path) => {
|
|
90
|
+
const key = normalizePath(path)
|
|
91
|
+
if (isDir(key)) throw new DOMException(`Is a directory: ${key}`, 'TypeMismatchError')
|
|
92
|
+
for (let dir = dirname(key); dir; dir = dirname(dir)) if (files.has(dir)) throw new DOMException(`Not a directory: ${dir}`, 'TypeMismatchError')
|
|
93
|
+
return key
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return {
|
|
97
|
+
async read(path) {
|
|
98
|
+
return text(normalizePath(path))
|
|
99
|
+
},
|
|
100
|
+
async readBytes(path) {
|
|
101
|
+
const value = files.get(normalizePath(path))
|
|
102
|
+
return value === undefined ? null : typeof value === 'string' ? encoder.encode(value) : value.slice()
|
|
103
|
+
},
|
|
104
|
+
async write(path, value) {
|
|
105
|
+
assertText(value)
|
|
106
|
+
put(writable(path), value)
|
|
107
|
+
},
|
|
108
|
+
async writeBytes(path, bytes) {
|
|
109
|
+
assertBytes(bytes)
|
|
110
|
+
put(writable(path), bytes.slice())
|
|
111
|
+
},
|
|
112
|
+
async append(path, value) {
|
|
113
|
+
assertText(value)
|
|
114
|
+
const key = writable(path)
|
|
115
|
+
put(key, (text(key) ?? '') + value)
|
|
116
|
+
},
|
|
117
|
+
async list(dir) {
|
|
118
|
+
const normalized = normalizeDir(dir)
|
|
119
|
+
const prefix = normalized ? normalized + '/' : ''
|
|
120
|
+
/** @type {Map<string, DirEntry['kind']>} */
|
|
121
|
+
const children = new Map()
|
|
122
|
+
for (const key of files.keys()) {
|
|
123
|
+
if (!key.startsWith(prefix)) continue
|
|
124
|
+
const [name, ...rest] = key.slice(prefix.length).split('/')
|
|
125
|
+
children.set(name, rest.length ? 'directory' : 'file')
|
|
126
|
+
}
|
|
127
|
+
return [...children].map(([name, kind]) => ({ name, kind })).sort(byName)
|
|
128
|
+
},
|
|
129
|
+
async remove(path) {
|
|
130
|
+
const key = normalizePath(path)
|
|
131
|
+
for (const file of [...files.keys()]) {
|
|
132
|
+
if (file === key || file.startsWith(key + '/')) files.delete(file)
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
async exists(path) {
|
|
136
|
+
const key = normalizePath(path)
|
|
137
|
+
return files.has(key) || isDir(key)
|
|
138
|
+
},
|
|
139
|
+
async stat(path) {
|
|
140
|
+
const key = normalizePath(path)
|
|
141
|
+
const value = files.get(key)
|
|
142
|
+
return value === undefined ? null : { size: typeof value === 'string' ? encoder.encode(value).length : value.length, lastModified: changed.get(key) ?? 0 }
|
|
143
|
+
},
|
|
144
|
+
watch: () => () => {},
|
|
145
|
+
async estimate() {
|
|
146
|
+
let usage = 0
|
|
147
|
+
for (const value of files.values()) usage += value.length
|
|
148
|
+
return { usage }
|
|
149
|
+
},
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/** The FS seen from one of its folders as its root, a profile's (D228): nothing above is reached or heard of. @param {FS} fs @param {string} dir @returns {FS} */
|
|
154
|
+
export function rootedFS(fs, dir) {
|
|
155
|
+
const at = (/** @type {string} */ path) => join(dir, normalizePath(path))
|
|
156
|
+
const view = /** @type {any} */ (Object.fromEntries(['read', 'readBytes', 'write', 'writeBytes', 'append', 'remove', 'exists', 'stat']
|
|
157
|
+
.map((op) => [op, (/** @type {string} */ path, /** @type {any} */ value) => /** @type {any} */ (fs)[op](at(path), value)])))
|
|
158
|
+
return { ...view, list: (path) => fs.list(join(dir, path)), estimate: fs.estimate,
|
|
159
|
+
watch: (cb) => fs.watch?.((path) => { if (path.startsWith(`${dir}/`)) cb(path.slice(dir.length + 1)) }) ?? (() => {}) }
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/** Every file under `dir`, recursively, as paths relative to the root. @param {FS} fs @param {string} [dir] @returns {Promise<string[]>} */
|
|
163
|
+
export async function walk(fs, dir = '') {
|
|
164
|
+
/** @type {string[]} */
|
|
165
|
+
const paths = []
|
|
166
|
+
for (const entry of await fs.list(dir)) {
|
|
167
|
+
const path = join(dir, entry.name)
|
|
168
|
+
if (entry.kind === 'directory') paths.push(...await walk(fs, path))
|
|
169
|
+
else paths.push(path)
|
|
170
|
+
}
|
|
171
|
+
return paths
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/** @param {FS} fs @param {string} path @param {any} [fallback] returned when the file is missing or not valid JSON */
|
|
175
|
+
export async function readJSON(fs, path, fallback = null) {
|
|
176
|
+
const text = await fs.read(path)
|
|
177
|
+
if (text === null) return fallback
|
|
178
|
+
try {
|
|
179
|
+
return JSON.parse(text)
|
|
180
|
+
} catch {
|
|
181
|
+
return fallback
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/** @param {FS} fs @param {string} path @param {any} value */
|
|
186
|
+
export const writeJSON = (fs, path, value) => fs.write(path, JSON.stringify(value, null, 2) + '\n')
|
package/core/hooks.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// Hooks: what Jean does passes through named events that code can watch, change or answer in Jean's
|
|
2
|
+
// place, as Claude Code's hooks and mods do. The hooks on an event make a chain, the outermost tier
|
|
3
|
+
// first: each calls next(e), with the event or a changed copy of it (never the event changed), and the
|
|
4
|
+
// last next reaches Jean's own behaviour; one that returns without calling it answers the event. A
|
|
5
|
+
// hook that fails is passed over, unless it is a guard that fails closed. Standard APIs only, so it
|
|
6
|
+
// runs wherever core does (docs/architecture.md, "Events and slots").
|
|
7
|
+
|
|
8
|
+
/** Outermost first: the organisation's, then the person's plugins, then Jean's own capabilities. */
|
|
9
|
+
export const TIERS = /** @type {const} */ (['policy', 'user', 'jean'])
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @typedef {Object} Hook
|
|
13
|
+
* @property {string} on the event, such as 'tool.check'
|
|
14
|
+
* @property {(e: any, next: (e?: any) => Promise<any>) => any} run
|
|
15
|
+
* @property {Record<string, unknown>} [match] what the event must hold: a value, one of a list, or a pattern its text matches
|
|
16
|
+
* @property {typeof TIERS[number]} [tier] 'jean' unless said
|
|
17
|
+
* @property {string} [by] whose it is
|
|
18
|
+
* @property {string} [refuse] a guard that fails closed: what it answers when it fails before going on
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/** @param {Record<string, unknown> | undefined} match @param {any} e */
|
|
22
|
+
const matches = (match, e) => Object.entries(match ?? {}).every(([key, want]) => (Array.isArray(want) ? want.includes(e?.[key])
|
|
23
|
+
: want instanceof RegExp ? want.test(String(e?.[key] ?? '')) : e?.[key] === want))
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Runs an event through its hooks, then through Jean's behaviour, and gives back what came of it.
|
|
27
|
+
* @param {Hook[]} hooks @param {string} name @param {any} input @param {(e: any) => any} behaviour @returns {Promise<any>}
|
|
28
|
+
*/
|
|
29
|
+
export async function fire(hooks, name, input, behaviour) {
|
|
30
|
+
const chain = hooks.filter((hook) => hook.on === name && matches(hook.match, input))
|
|
31
|
+
.sort((a, b) => TIERS.indexOf(a.tier ?? 'jean') - TIERS.indexOf(b.tier ?? 'jean'))
|
|
32
|
+
/** @param {number} i @param {any} e @returns {Promise<any>} */
|
|
33
|
+
const step = async (i, e) => {
|
|
34
|
+
const hook = chain[i]
|
|
35
|
+
if (!hook) return behaviour(e)
|
|
36
|
+
/** @type {Promise<any> | undefined} */
|
|
37
|
+
let went
|
|
38
|
+
/** @type {any} what the rest of the chain gave it */
|
|
39
|
+
let gave
|
|
40
|
+
try {
|
|
41
|
+
const result = await hook.run(e, (changed = e) => (went = step(i + 1, changed).then((value) => (gave = value))))
|
|
42
|
+
// An answer of its own, not the one the chain gave it, says whose it is (D299).
|
|
43
|
+
return hook.by && result?.constructor === Object && result !== gave ? { ...result, by: hook.by } : result
|
|
44
|
+
} catch (error) {
|
|
45
|
+
const failed = () => console.warn(`${hook.by ?? 'A hook'} on ${name}`, error)
|
|
46
|
+
// Once it went on, what came back stands, and what failed further in is that failure, not this hook's.
|
|
47
|
+
if (went) return went.then((result) => (failed(), result))
|
|
48
|
+
failed()
|
|
49
|
+
return hook.refuse ? { refuse: hook.refuse } : step(i + 1, e)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return step(0, input)
|
|
53
|
+
}
|
package/core/i18n.js
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
// Messages, plurals and direction. Host-agnostic: the UI injects a loader.
|
|
2
|
+
// Catalogs are flat { key: string | { one, other, … } } objects; English is the fallback.
|
|
3
|
+
import { signal } from '@preact/signals-core'
|
|
4
|
+
|
|
5
|
+
const RTL = new Set(['ar', 'he', 'fa', 'ur', 'ps', 'sd', 'ug', 'yi', 'dv', 'ckb'])
|
|
6
|
+
|
|
7
|
+
// The 33 launch languages (docs/architecture.md#languages-i18n), machine-translated (D44).
|
|
8
|
+
export const LOCALES = ['am', 'ar', 'bn', 'de', 'en', 'es', 'fa', 'fr', 'ha', 'he', 'hi', 'id', 'it', 'ja', 'ko', 'mr', 'ms', 'nl', 'pl', 'pt', 'ru', 'sw', 'ta', 'te', 'th', 'tl', 'tr', 'uk', 'ur', 'vi', 'yo', 'zh-Hans', 'zh-Hant']
|
|
9
|
+
|
|
10
|
+
export const locale = signal('en')
|
|
11
|
+
|
|
12
|
+
/** @type {Map<string, Record<string, any>>} */
|
|
13
|
+
const catalogs = new Map()
|
|
14
|
+
/** @type {(lang: string, part: string) => Promise<Record<string, any> | null>} */
|
|
15
|
+
let loader = async () => null
|
|
16
|
+
// A catalog comes in parts: the room's (''), then others the first time a module asks for
|
|
17
|
+
// them (the dialogs', D97). `${lang}/${part}` for each part loaded.
|
|
18
|
+
const parts = new Set([''])
|
|
19
|
+
const fetched = new Set()
|
|
20
|
+
|
|
21
|
+
/** @param {(lang: string, part: string) => Promise<Record<string, any> | null>} fn */
|
|
22
|
+
export const setLoader = (fn) => { loader = fn }
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Every catalog has every key (test/locales.test.js), so English, the fallback, is only
|
|
26
|
+
* fetched when the catalog itself can't be. @param {string} lang @param {string} part
|
|
27
|
+
*/
|
|
28
|
+
async function load(lang, part) {
|
|
29
|
+
for (const code of [lang, 'en']) {
|
|
30
|
+
if (!fetched.has(`${code}/${part}`)) {
|
|
31
|
+
const messages = await loader(code, part)
|
|
32
|
+
if (messages) {
|
|
33
|
+
catalogs.set(code, { ...catalogs.get(code), ...messages })
|
|
34
|
+
fetched.add(`${code}/${part}`)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (fetched.has(`${code}/${part}`)) break
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Load every part in use, then switch. @param {string} lang */
|
|
42
|
+
export async function useLocale(lang) {
|
|
43
|
+
await Promise.all([...parts].map((part) => load(lang, part)))
|
|
44
|
+
locale.value = lang
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Loads a part of the catalog, in the current language and every later one. @param {string} part */
|
|
48
|
+
export async function useStrings(part) {
|
|
49
|
+
parts.add(part)
|
|
50
|
+
await load(locale.peek(), part)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Translate a key. Reading `locale.value` makes callers reactive. @param {string} key @param {Record<string, string | number>} [params] */
|
|
54
|
+
export function t(key, params = {}) {
|
|
55
|
+
const lang = locale.value
|
|
56
|
+
let entry = catalogs.get(lang)?.[key] ?? catalogs.get('en')?.[key] ?? key
|
|
57
|
+
if (typeof entry === 'object') {
|
|
58
|
+
const count = Number(params.count ?? 0)
|
|
59
|
+
entry = entry[new Intl.PluralRules(lang).select(count)] ?? entry.other ?? ''
|
|
60
|
+
}
|
|
61
|
+
return String(entry).replace(/\{(\w+)\}/g, (match, name) => (name in params ? format(params[name], lang) : match))
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** t(), with values that aren't text (a link, a time) kept where the translation puts them, never joined to strings. @param {string} key @param {Record<string, unknown>} params */
|
|
65
|
+
export function tParts(key, params) {
|
|
66
|
+
const kept = /** @type {unknown[]} */ ([])
|
|
67
|
+
const text = t(key, Object.fromEntries(Object.entries(params).map(([name, value]) => [name, typeof value === 'string' || typeof value === 'number' ? value : `\u0000${kept.push(value) - 1}\u0000`])))
|
|
68
|
+
return text.split(/\u0000(\d+)\u0000/).map((part, i) => (i % 2 ? kept[Number(part)] : part))
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** @param {string | number} value @param {string} lang */
|
|
72
|
+
const format = (value, lang) => (typeof value === 'number' ? new Intl.NumberFormat(lang).format(value) : value)
|
|
73
|
+
|
|
74
|
+
/** @param {string} [lang] @returns {'rtl' | 'ltr'} */
|
|
75
|
+
export const dir = (lang = locale.value) => (RTL.has(lang.split('-')[0].toLowerCase()) ? 'rtl' : 'ltr')
|
|
76
|
+
|
|
77
|
+
/** Name of a language, written in `inLang` (defaults to itself). */
|
|
78
|
+
export function languageName(/** @type {string} */ code, inLang = code) {
|
|
79
|
+
try {
|
|
80
|
+
const name = new Intl.DisplayNames([inLang], { type: 'language' }).of(code) ?? code
|
|
81
|
+
return name.charAt(0).toLocaleUpperCase(inLang) + name.slice(1)
|
|
82
|
+
} catch {
|
|
83
|
+
return code
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** Available locales that match the user's preferences, in their order, without repeats. @param {string[]} available @param {readonly string[]} preferred e.g. navigator.languages */
|
|
88
|
+
export function preferredLocales(available, preferred) {
|
|
89
|
+
/** @type {string[]} */
|
|
90
|
+
const found = []
|
|
91
|
+
for (const wanted of preferred) {
|
|
92
|
+
const match = available.find((code) => code.toLowerCase() === wanted.toLowerCase())
|
|
93
|
+
?? available.find((code) => languageAndScript(code) === languageAndScript(wanted))
|
|
94
|
+
if (match && !found.includes(match)) found.push(match)
|
|
95
|
+
}
|
|
96
|
+
return found
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** Best available locale for the user's preferences. @param {string[]} available @param {readonly string[]} preferred e.g. navigator.languages */
|
|
100
|
+
export const pickLocale = (available, preferred) => preferredLocales(available, preferred)[0] ?? (available.includes('en') ? 'en' : available[0])
|
|
101
|
+
|
|
102
|
+
// Browsers say "fil" for the Filipino that the "tl" catalogue is written in.
|
|
103
|
+
/** @type {Record<string, string>} */
|
|
104
|
+
const SAME_LANGUAGE = { fil: 'tl' }
|
|
105
|
+
|
|
106
|
+
/** Language and likely script, so zh-TW meets zh-Hant and pt-BR meets pt. @param {string} code */
|
|
107
|
+
function languageAndScript(code) {
|
|
108
|
+
try {
|
|
109
|
+
const { language, script } = new Intl.Locale(code).maximize()
|
|
110
|
+
return `${SAME_LANGUAGE[language] ?? language}-${script}`
|
|
111
|
+
} catch {
|
|
112
|
+
return null
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** "14 MB", in the current locale. @param {number} bytes */
|
|
117
|
+
export function formatBytes(bytes) {
|
|
118
|
+
const [unit, size] = bytes >= 1e9 ? ['gigabyte', bytes / 1e9] : bytes >= 1e6 ? ['megabyte', bytes / 1e6] : ['kilobyte', bytes / 1e3]
|
|
119
|
+
return new Intl.NumberFormat(locale.value, { style: 'unit', unit, maximumFractionDigits: 1 }).format(size)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** "527 ms", "1.2 sec", "1 min, 12 sec", in the current locale: to the tenth of a second under ten, else to the second. @param {number} ms */
|
|
123
|
+
export function formatDuration(ms) {
|
|
124
|
+
const tenths = Math.floor(ms / 100) % 10
|
|
125
|
+
const whole = Math.round(ms / 1e3)
|
|
126
|
+
const [duration, options] = ms < 999.5 ? [{ milliseconds: Math.round(ms) }, {}]
|
|
127
|
+
: ms < 1e4 && tenths ? [{ seconds: Math.floor(ms / 1e3), milliseconds: tenths * 100 }, /** @type {const} */ ({ milliseconds: 'numeric', fractionalDigits: 1 })]
|
|
128
|
+
: [{ hours: Math.floor(whole / 3600), minutes: Math.floor(whole / 60) % 60, seconds: whole % 60 }, {}]
|
|
129
|
+
return new Intl.DurationFormat(locale.value, { style: 'short', ...options }).format(duration)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** "3 minutes ago", in the current locale. @param {string | number | Date} when */
|
|
133
|
+
export function relativeTime(when, now = Date.now()) {
|
|
134
|
+
const seconds = Math.round((new Date(when).getTime() - now) / 1000)
|
|
135
|
+
const units = /** @type {const} */ ([['year', 31536000], ['month', 2592000], ['week', 604800], ['day', 86400], ['hour', 3600], ['minute', 60]])
|
|
136
|
+
const rtf = new Intl.RelativeTimeFormat(locale.value, { numeric: 'auto' })
|
|
137
|
+
for (const [unit, size] of units) if (Math.abs(seconds) >= size) return rtf.format(Math.round(seconds / size), unit)
|
|
138
|
+
return rtf.format(0, 'second')
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** First words of a text, segmented per language (works for CJK and Thai). @param {string} text */
|
|
142
|
+
export function firstWords(text, max = 8) {
|
|
143
|
+
const segmenter = new Intl.Segmenter(locale.value, { granularity: 'word' })
|
|
144
|
+
let words = 0
|
|
145
|
+
let out = ''
|
|
146
|
+
for (const { segment, isWordLike } of segmenter.segment(text.replace(/\s+/g, ' ').trim())) {
|
|
147
|
+
if (isWordLike && ++words > max) return out.trim() + '…'
|
|
148
|
+
out += segment
|
|
149
|
+
}
|
|
150
|
+
return out.trim()
|
|
151
|
+
}
|