@eifi1/ui-kit 0.28.1 → 0.29.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.
Files changed (160) hide show
  1. package/README.md +21 -3
  2. package/dist/auth/accept-invitation.d.ts +90 -0
  3. package/dist/auth/accept-invitation.js +117 -0
  4. package/dist/auth/accept-invitation.js.map +1 -0
  5. package/dist/auth/auth-errors.d.ts +60 -0
  6. package/dist/auth/auth-errors.js +32 -0
  7. package/dist/auth/auth-errors.js.map +1 -0
  8. package/dist/auth/complete-name-dialog.d.ts +71 -0
  9. package/dist/auth/complete-name-dialog.js +168 -0
  10. package/dist/auth/complete-name-dialog.js.map +1 -0
  11. package/dist/auth/email-tag.d.ts +60 -0
  12. package/dist/auth/email-tag.js +23 -0
  13. package/dist/auth/email-tag.js.map +1 -0
  14. package/dist/auth/forgot-password-form.d.ts +79 -0
  15. package/dist/auth/forgot-password-form.js +120 -0
  16. package/dist/auth/forgot-password-form.js.map +1 -0
  17. package/dist/auth/form-rules.d.ts +27 -0
  18. package/dist/auth/form-rules.js +23 -0
  19. package/dist/auth/form-rules.js.map +1 -0
  20. package/dist/auth/new-password-fields.d.ts +38 -0
  21. package/dist/auth/new-password-fields.js +54 -0
  22. package/dist/auth/new-password-fields.js.map +1 -0
  23. package/dist/auth/not-found-page.d.ts +57 -0
  24. package/dist/auth/not-found-page.js +40 -0
  25. package/dist/auth/not-found-page.js.map +1 -0
  26. package/dist/auth/register-form.d.ts +86 -0
  27. package/dist/auth/register-form.js +268 -0
  28. package/dist/auth/register-form.js.map +1 -0
  29. package/dist/auth/reset-password-form.d.ts +124 -0
  30. package/dist/auth/reset-password-form.js +164 -0
  31. package/dist/auth/reset-password-form.js.map +1 -0
  32. package/dist/auth/sign-in-form.d.ts +243 -0
  33. package/dist/auth/sign-in-form.js +345 -0
  34. package/dist/auth/sign-in-form.js.map +1 -0
  35. package/dist/auth/status-parts.d.ts +78 -0
  36. package/dist/auth/status-parts.js +83 -0
  37. package/dist/auth/status-parts.js.map +1 -0
  38. package/dist/auth/verify-email.d.ts +121 -0
  39. package/dist/auth/verify-email.js +207 -0
  40. package/dist/auth/verify-email.js.map +1 -0
  41. package/dist/chart.d.ts +17 -2
  42. package/dist/components/amount-input.d.ts +18 -2
  43. package/dist/components/button-group.d.ts +18 -2
  44. package/dist/components/calculator.d.ts +18 -2
  45. package/dist/components/confirm-dialog.d.ts +18 -2
  46. package/dist/components/copy-button.d.ts +18 -2
  47. package/dist/components/danger-confirm.d.ts +18 -2
  48. package/dist/components/facing-pair.d.ts +18 -2
  49. package/dist/components/file-button.d.ts +18 -2
  50. package/dist/components/file-dropzone.d.ts +18 -2
  51. package/dist/components/form-actions.d.ts +18 -2
  52. package/dist/components/iban-input.d.ts +18 -2
  53. package/dist/components/language-select.d.ts +18 -9
  54. package/dist/components/legal-page.d.ts +18 -2
  55. package/dist/components/legal.d.ts +18 -2
  56. package/dist/components/money-field.d.ts +18 -2
  57. package/dist/components/number-field.d.ts +18 -2
  58. package/dist/components/number-input.d.ts +18 -2
  59. package/dist/components/numpad-sheet.d.ts +18 -2
  60. package/dist/components/phone-input.d.ts +18 -2
  61. package/dist/components/series-chart.d.ts +18 -2
  62. package/dist/components/settings-fields.d.ts +15 -2
  63. package/dist/components/share-card.d.ts +18 -2
  64. package/dist/components/text-link.d.ts +18 -2
  65. package/dist/components/time-input.d.ts +18 -2
  66. package/dist/components/ui.d.ts +17 -1
  67. package/dist/components/user-avatar.d.ts +16 -2
  68. package/dist/components/user-avatar.js +7 -3
  69. package/dist/components/user-avatar.js.map +1 -1
  70. package/dist/feedback/feedback-attachment.d.ts +18 -2
  71. package/dist/feedback/feedback-context.d.ts +18 -2
  72. package/dist/feedback/feedback-crash.d.ts +18 -2
  73. package/dist/feedback/feedback-dialog.d.ts +18 -2
  74. package/dist/feedback/feedback-inbox.d.ts +18 -2
  75. package/dist/feedback/feedback-labels.d.ts +18 -2
  76. package/dist/feedback/feedback-menu.d.ts +18 -2
  77. package/dist/feedback/feedback-record.d.ts +18 -2
  78. package/dist/feedback/feedback-row-detail.d.ts +18 -2
  79. package/dist/feedback/feedback-status-undo.d.ts +18 -2
  80. package/dist/feedback/feedback-submit.d.ts +18 -2
  81. package/dist/feedback/feedback-swipe.d.ts +18 -2
  82. package/dist/feedback/feedback-table.d.ts +18 -2
  83. package/dist/feedback/feedback-thread.d.ts +18 -2
  84. package/dist/feedback.d.ts +18 -2
  85. package/dist/hooks/use-file-drop.d.ts +18 -2
  86. package/dist/i18n/defaults.d.ts +18 -2
  87. package/dist/i18n/defaults.js +18 -0
  88. package/dist/i18n/defaults.js.map +1 -1
  89. package/dist/i18n/german.d.ts +18 -2
  90. package/dist/i18n/german.js +137 -0
  91. package/dist/i18n/german.js.map +1 -1
  92. package/dist/i18n/kit-labels.d.ts +18 -2
  93. package/dist/i18n/kit-labels.js.map +1 -1
  94. package/dist/i18n/languages.d.ts +13 -201
  95. package/dist/i18n/locales/de-CH.d.ts +18 -2
  96. package/dist/i18n/locales/en.d.ts +18 -2
  97. package/dist/i18n/locales/es.d.ts +18 -2
  98. package/dist/i18n/locales/es.js +137 -1
  99. package/dist/i18n/locales/es.js.map +1 -1
  100. package/dist/i18n/locales/fr.d.ts +18 -2
  101. package/dist/i18n/locales/fr.js +139 -0
  102. package/dist/i18n/locales/fr.js.map +1 -1
  103. package/dist/i18n/locales/hu.d.ts +18 -2
  104. package/dist/i18n/locales/hu.js +139 -1
  105. package/dist/i18n/locales/hu.js.map +1 -1
  106. package/dist/i18n/locales/it.d.ts +18 -2
  107. package/dist/i18n/locales/it.js +137 -0
  108. package/dist/i18n/locales/it.js.map +1 -1
  109. package/dist/i18n/locales/zh.d.ts +18 -2
  110. package/dist/i18n/locales/zh.js +137 -0
  111. package/dist/i18n/locales/zh.js.map +1 -1
  112. package/dist/i18n/review.d.ts +18 -2
  113. package/dist/i18n/review.js +9 -1
  114. package/dist/i18n/review.js.map +1 -1
  115. package/dist/index.d.ts +13 -2
  116. package/dist/index.js +36 -0
  117. package/dist/index.js.map +1 -1
  118. package/dist/lib/person-name.d.ts +69 -0
  119. package/dist/lib/person-name.js +65 -0
  120. package/dist/lib/person-name.js.map +1 -0
  121. package/dist/{kit-labels-Du0uHBq4.d.ts → register-form-V1OeNlMr.d.ts} +383 -2
  122. package/dist/rhf/fields.d.ts +18 -2
  123. package/dist/rhf/form.d.ts +18 -2
  124. package/dist/rhf.d.ts +18 -2
  125. package/dist/shell/app-shell.d.ts +18 -2
  126. package/dist/shell/company-switcher.d.ts +59 -0
  127. package/dist/shell/company-switcher.js +85 -0
  128. package/dist/shell/company-switcher.js.map +1 -0
  129. package/dist/shell/top-bar-brand.d.ts +18 -2
  130. package/dist/shell/topbar-action-menu.d.ts +1 -0
  131. package/dist/shell.d.ts +12 -2
  132. package/dist/wizard/stepper-nav.d.ts +18 -2
  133. package/dist/wizard.d.ts +18 -2
  134. package/package.json +1 -1
  135. package/src/auth/accept-invitation.tsx +227 -0
  136. package/src/auth/auth-errors.ts +105 -0
  137. package/src/auth/complete-name-dialog.tsx +253 -0
  138. package/src/auth/email-tag.ts +75 -0
  139. package/src/auth/forgot-password-form.tsx +213 -0
  140. package/src/auth/form-rules.ts +40 -0
  141. package/src/auth/new-password-fields.tsx +85 -0
  142. package/src/auth/not-found-page.tsx +98 -0
  143. package/src/auth/register-form.tsx +459 -0
  144. package/src/auth/reset-password-form.tsx +337 -0
  145. package/src/auth/sign-in-form.tsx +687 -0
  146. package/src/auth/status-parts.tsx +138 -0
  147. package/src/auth/verify-email.tsx +358 -0
  148. package/src/components/user-avatar.tsx +22 -4
  149. package/src/i18n/defaults.ts +18 -0
  150. package/src/i18n/german.ts +143 -0
  151. package/src/i18n/kit-labels.tsx +27 -0
  152. package/src/i18n/locales/es.ts +144 -1
  153. package/src/i18n/locales/fr.ts +147 -0
  154. package/src/i18n/locales/hu.ts +147 -1
  155. package/src/i18n/locales/it.ts +143 -0
  156. package/src/i18n/locales/zh.ts +138 -0
  157. package/src/i18n/review.ts +8 -0
  158. package/src/index.ts +53 -0
  159. package/src/lib/person-name.ts +157 -0
  160. package/src/shell/company-switcher.tsx +140 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/auth/complete-name-dialog.tsx"],"sourcesContent":["import { useContext, useEffect, useId, useRef, useState } from \"react\";\nimport type { KeyboardEvent, ReactNode } from \"react\";\n\nimport { useKitLabels } from \"../i18n/kit-labels\";\nimport { usePromisePending } from \"../components/danger-confirm\";\nimport { DialogFrame } from \"../components/dialog-frame\";\nimport { ModalCloseContext } from \"../components/modal\";\nimport { Button, Input } from \"../components/ui\";\nimport { personNameOk, PERSON_NAME_MAX_LENGTH } from \"./form-rules\";\n\n/** What `CompleteNameDialog` hands `onSave`: both names, trimmed, 1–120 characters —\n * `PATCH /auth/me {first_name, last_name}` (§6.1). */\nexport interface CompleteNameValues {\n firstName: string;\n lastName: string;\n}\n\n/**\n * Every string the dialog renders — the `completeName` namespace of `<UiKitProvider\n * labels>`, overridable per instance through `labels`.\n */\nexport interface CompleteNameLabels {\n title: string;\n description: string;\n firstName: string;\n lastName: string;\n save: string;\n /** Dismisses the dialog until the next sign-in. */\n later: string;\n /** Under the fields when `onSave` rejected and the app passed no `error`. */\n failed: string;\n}\n\nexport const DEFAULT_COMPLETE_NAME_LABELS: CompleteNameLabels = {\n title: \"Complete your name\",\n description: \"First and last name are now asked for separately. Check what is filled in and add what is missing.\",\n firstName: \"First name\",\n lastName: \"Last name\",\n save: \"Save\",\n later: \"Later\",\n failed: \"Your name could not be saved. Please try again.\",\n};\n\nexport interface CompleteNameDialogProps {\n /** What the account holds now — after the migration, the old display name (§3.3). */\n firstName?: string;\n /** Usually empty: that is why the dialog is up. */\n lastName?: string;\n /**\n * Save the names (`PATCH /auth/me`). Resolve and the dialog closes (`onClose(true)`);\n * reject and it stays open with the names kept and `error` — or \"Your name could not\n * be saved\" — under them.\n */\n onSave: (values: CompleteNameValues) => Promise<unknown>;\n /**\n * The dialog has closed: `true` after a resolved `onSave`, `false` for \"Later\", Escape,\n * the backdrop and Back. `false` only DEFERS it: the app shows it again after the\n * next sign-in while `/auth/me` still answers `name_incomplete: true`.\n */\n onClose: (saved: boolean) => void;\n /** The app's words for the last failed save, instead of `labels.failed`. Hidden again\n * once a name is edited. */\n error?: ReactNode;\n /** Kept-mounted mode, as on `Modal`: left out, the dialog is open while mounted. */\n open?: boolean;\n labels?: Partial<CompleteNameLabels>;\n}\n\n/**\n * \"Complete your name\" — asked once after sign-in of a user whose name was migrated\n * (docs/auth-harmonization.md §3.3). keksdose's and Kurvenschmiede's accounts had one\n * `display_name`; it moved whole into `first_name`, `last_name` stayed empty, and\n * nothing was split by guesswork (§2.4). The app shows this while `/auth/me` answers\n * `name_incomplete: true` — never for a demo user.\n *\n * Both names prefilled with what is there; \"Save\" waits until both have 1–120\n * characters after trimming. **\"Later\" only defers it**: nothing else waits on a\n * complete name, no page is blocked, and the app asks again at the next sign-in.\n *\n * The promise handling is `ReauthDialog`'s: busy while `onSave` runs (the fields\n * read-only, \"Later\" disabled, Escape held — a request that has left cannot be called\n * back by closing the dialog), closed on resolve, kept open on reject. Save is a\n * `commit` control, so a `WriteLockProvider` above it locks it with its reason.\n *\n * Focus starts in the first EMPTY field — the last name, as a rule — because filling it\n * in is the whole of what the dialog is for.\n */\nexport function CompleteNameDialog({\n firstName: initialFirst = \"\",\n lastName: initialLast = \"\",\n onSave,\n onClose,\n error,\n open,\n labels: labelsProp,\n}: CompleteNameDialogProps) {\n const labels = useKitLabels(\"completeName\", DEFAULT_COMPLETE_NAME_LABELS, labelsProp);\n const [first, setFirst] = useState(initialFirst);\n const [last, setLast] = useState(initialLast);\n // A failed save describes the names that were sent; an edit makes it stale.\n const [failed, setFailed] = useState(false);\n const { pending, run } = usePromisePending();\n const [done, setDone] = useState(false);\n const saved = useRef(false);\n const formId = useId();\n const firstRef = useRef<HTMLInputElement>(null);\n const lastRef = useRef<HTMLInputElement>(null);\n const isOpen = open ?? true;\n\n // Reopened (kept-mounted): start again from what the account holds. During render,\n // as ReauthDialog wipes its password, so no frame shows the old draft.\n const [wasOpen, setWasOpen] = useState(isOpen);\n if (wasOpen !== isOpen) {\n setWasOpen(isOpen);\n if (isOpen) {\n setFirst(initialFirst);\n setLast(initialLast);\n setFailed(false);\n setDone(false);\n }\n }\n\n // After Modal's own effect, so its trap has recorded the trigger before focus moves.\n useEffect(() => {\n if (!isOpen) return;\n saved.current = false;\n const target = firstRef.current?.value.trim() ? lastRef.current : firstRef.current;\n target?.focus();\n }, [isOpen]);\n\n const canSave = personNameOk(first) && personNameOk(last);\n\n const submit = () => {\n if (pending || !canSave) return;\n setFailed(false);\n const values = { firstName: first.trim(), lastName: last.trim() };\n let result: Promise<unknown>;\n try {\n result = Promise.resolve(onSave(values));\n } catch (err) {\n result = Promise.reject(err);\n }\n // A rejection must not go unhandled; usePromisePending clears `pending` on it.\n result.catch(() => setFailed(true));\n run(result, () => {\n saved.current = true;\n setDone(true);\n });\n };\n\n const edit = (set: (value: string) => void) => (value: string) => {\n set(value);\n setFailed(false);\n };\n\n const message = failed ? (error ?? labels.failed) : undefined;\n\n return (\n <DialogFrame\n open={open}\n title={labels.title}\n description={labels.description}\n onClose={() => onClose(saved.current)}\n onKeyDown={(e: KeyboardEvent<HTMLDivElement>) => {\n if (pending && e.key === \"Escape\") e.preventDefault();\n }}\n aria-busy={pending || undefined}\n actions={\n <CompleteNameActions\n formId={formId}\n done={done}\n busy={pending}\n canSave={canSave}\n laterLabel={labels.later}\n saveLabel={labels.save}\n />\n }\n >\n <form\n id={formId}\n noValidate\n className=\"grid gap-3 @container\"\n onSubmit={(e) => {\n e.preventDefault();\n submit();\n }}\n >\n <div className=\"grid gap-3 @xs:grid-cols-2\">\n <Input\n ref={firstRef}\n name=\"given-name\"\n autoComplete=\"given-name\"\n label={labels.firstName}\n value={first}\n onChange={(e) => edit(setFirst)(e.target.value)}\n maxLength={PERSON_NAME_MAX_LENGTH}\n readOnly={pending}\n required\n />\n <Input\n ref={lastRef}\n name=\"family-name\"\n autoComplete=\"family-name\"\n label={labels.lastName}\n value={last}\n onChange={(e) => edit(setLast)(e.target.value)}\n maxLength={PERSON_NAME_MAX_LENGTH}\n readOnly={pending}\n required\n />\n </div>\n {message !== undefined && (\n <p role=\"alert\" className=\"text-xs text-[var(--danger)]\">\n {message}\n </p>\n )}\n </form>\n </DialogFrame>\n );\n}\n\n/** The actions row, inside the `Modal`, where its animated close is in context: a\n * resolved save lowers the panel through it, as \"Later\" and Escape do. */\nfunction CompleteNameActions({\n formId,\n done,\n busy,\n canSave,\n laterLabel,\n saveLabel,\n}: {\n formId: string;\n done: boolean;\n busy: boolean;\n canSave: boolean;\n laterLabel: string;\n saveLabel: string;\n}) {\n const close = useContext(ModalCloseContext);\n useEffect(() => {\n if (done) close?.();\n }, [done, close]);\n return (\n <>\n <Button type=\"button\" variant=\"ghost\" disabled={busy} onClick={() => close?.()}>\n {laterLabel}\n </Button>\n <Button type=\"submit\" form={formId} commit disabled={!busy && !canSave} pending={busy}>\n {saveLabel}\n </Button>\n </>\n );\n}\n"],"mappings":";AAwKQ,SA2EJ,UA3EI,KAmBA,YAnBA;AAxKR,SAAS,YAAY,WAAW,OAAO,QAAQ,gBAAgB;AAG/D,SAAS,oBAAoB;AAC7B,SAAS,yBAAyB;AAClC,SAAS,mBAAmB;AAC5B,SAAS,yBAAyB;AAClC,SAAS,QAAQ,aAAa;AAC9B,SAAS,cAAc,8BAA8B;AAyB9C,MAAM,+BAAmD;AAAA,EAC9D,OAAO;AAAA,EACP,aAAa;AAAA,EACb,WAAW;AAAA,EACX,UAAU;AAAA,EACV,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AACV;AA8CO,SAAS,mBAAmB;AAAA,EACjC,WAAW,eAAe;AAAA,EAC1B,UAAU,cAAc;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AACV,GAA4B;AAC1B,QAAM,SAAS,aAAa,gBAAgB,8BAA8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AAU;AAAA,kBACV,UAAQ;AAAA;AAAA,cACV;AAAA,eACF;AAAA,YACC,YAAY,UACX,oBAAC,OAAE,MAAK,SAAQ,WAAU,gCACvB,mBACH;AAAA;AAAA;AAAA,MAEJ;AAAA;AAAA,EACF;AAEJ;AAIA,SAAS,oBAAoB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAOG;AACD,QAAM,QAAQ,WAAW,iBAAiB;AAC1C,YAAU,MAAM;AACd,QAAI,KAAM,SAAQ;AAAA,EACpB,GAAG,CAAC,MAAM,KAAK,CAAC;AAChB,SACE,iCACE;AAAA,wBAAC,UAAO,MAAK,UAAS,SAAQ,SAAQ,UAAU,MAAM,SAAS,MAAM,QAAQ,GAC1E,sBACH;AAAA,IACA,oBAAC,UAAO,MAAK,UAAS,MAAM,QAAQ,QAAM,MAAC,UAAU,CAAC,QAAQ,CAAC,SAAS,SAAS,MAC9E,qBACH;AAAA,KACF;AAEJ;","names":[]}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * The address tag: `you@example.com` → `you+kastlan@example.com`, the app's own name as
3
+ * a sub-address of the address a person types for themselves (docs/auth-harmonization.md
4
+ * §4.5, Marcel 2026-10-05). Lifted from keksdose (`features/auth/email-tag.ts`, feedback
5
+ * dev#481), where the tag was the constant `keksdose`; here it is the app's.
6
+ *
7
+ * **Structurally valid is not the same as deliverable.** `+` is an ordinary character in
8
+ * the local part under RFC 5322, and sub-addressing — `user+tag@host` delivered to
9
+ * `user@host` — is specified (RFC 5233). But it is specified as a convention the
10
+ * RECEIVING server may implement: Gmail, Outlook, iCloud, Fastmail and Proton do; many
11
+ * Exchange installs, small hosters and corporate filters do not, and some web forms
12
+ * refuse the character outright.
13
+ *
14
+ * Which is why every caller OFFERS the result and never applies it. Silently registering
15
+ * somebody as `you+kastlan@example.com` would send the verification mail — the one
16
+ * message the account depends on — down a delivery path nobody checked, and make the
17
+ * address they sign in with one they never typed. The tag is a convenience for the
18
+ * person who wants it: one click, with the exact resulting address on the button
19
+ * (`RegisterForm` does this with its `emailTag`).
20
+ *
21
+ * The tagged address is then the identity. The server trims and lower-cases an address
22
+ * at every entry and never strips a tag, so `you@…` and `you+kastlan@…` are two
23
+ * different accounts; sign-in stays exact (§4.5), which is why `SignInForm`'s hint after
24
+ * a failed sign-in names the tagged address rather than trying it.
25
+ *
26
+ * Offer it only where a person types an address FOR THEMSELVES — sign-up, a later email
27
+ * change in the profile — never in a field for someone else's (an invite dialog, a
28
+ * share), where the tag would be a guess about another person's mail server.
29
+ */
30
+ /**
31
+ * `taggedEmail("you@example.com", "kastlan")` → `"you+kastlan@example.com"`, or `null`
32
+ * when there is nothing to offer:
33
+ *
34
+ * - the address is not complete enough to split — no local part, no domain, or a
35
+ * domain without an inner dot (the shape the field's own `type="email"` accepts), so
36
+ * the offer cannot appear before the address is plausible or linger once it stops
37
+ * being one;
38
+ * - the address already carries a `+` — the person's own scheme wins, and stacking a
39
+ * second tag on it would be wrong;
40
+ * - the tag is empty or not a plain name (see `TAG_SHAPE`).
41
+ *
42
+ * The tag is the app's name in lower case (`keksdose`, `kastlan`, `kurvenschmiede`); it
43
+ * is trimmed and lower-cased here, so `"Kastlan"` gives the same answer. The address is
44
+ * trimmed and otherwise kept as typed — normalising it is the server's job (server-kit's
45
+ * `normalise_email`).
46
+ */
47
+ declare function taggedEmail(email: string, tag: string): string | null;
48
+ /**
49
+ * The trimmed address split at its last `@`, or `null` while it is not complete enough
50
+ * to split: no local part, no domain, or a domain without an inner dot — the shape the
51
+ * field's own `type="email"` accepts.
52
+ *
53
+ * @internal `RegisterForm` gates its submit on it; not part of the barrel.
54
+ */
55
+ declare function emailParts(email: string): {
56
+ local: string;
57
+ domain: string;
58
+ } | null;
59
+
60
+ export { emailParts, taggedEmail };
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ const TAG_SHAPE = /^[a-z0-9][a-z0-9._-]*$/;
3
+ function taggedEmail(email, tag) {
4
+ const name = tag.trim().toLowerCase();
5
+ if (!TAG_SHAPE.test(name)) return null;
6
+ const parts = emailParts(email);
7
+ if (!parts || parts.local.includes("+")) return null;
8
+ return `${parts.local}+${name}@${parts.domain}`;
9
+ }
10
+ function emailParts(email) {
11
+ const trimmed = email.trim();
12
+ const at = trimmed.lastIndexOf("@");
13
+ if (at <= 0 || at === trimmed.length - 1) return null;
14
+ const local = trimmed.slice(0, at);
15
+ const domain = trimmed.slice(at + 1);
16
+ if (!domain.includes(".") || domain.startsWith(".") || domain.endsWith(".")) return null;
17
+ return { local, domain };
18
+ }
19
+ export {
20
+ emailParts,
21
+ taggedEmail
22
+ };
23
+ //# sourceMappingURL=email-tag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/auth/email-tag.ts"],"sourcesContent":["/**\n * The address tag: `you@example.com` → `you+kastlan@example.com`, the app's own name as\n * a sub-address of the address a person types for themselves (docs/auth-harmonization.md\n * §4.5, Marcel 2026-10-05). Lifted from keksdose (`features/auth/email-tag.ts`, feedback\n * dev#481), where the tag was the constant `keksdose`; here it is the app's.\n *\n * **Structurally valid is not the same as deliverable.** `+` is an ordinary character in\n * the local part under RFC 5322, and sub-addressing — `user+tag@host` delivered to\n * `user@host` — is specified (RFC 5233). But it is specified as a convention the\n * RECEIVING server may implement: Gmail, Outlook, iCloud, Fastmail and Proton do; many\n * Exchange installs, small hosters and corporate filters do not, and some web forms\n * refuse the character outright.\n *\n * Which is why every caller OFFERS the result and never applies it. Silently registering\n * somebody as `you+kastlan@example.com` would send the verification mail — the one\n * message the account depends on — down a delivery path nobody checked, and make the\n * address they sign in with one they never typed. The tag is a convenience for the\n * person who wants it: one click, with the exact resulting address on the button\n * (`RegisterForm` does this with its `emailTag`).\n *\n * The tagged address is then the identity. The server trims and lower-cases an address\n * at every entry and never strips a tag, so `you@…` and `you+kastlan@…` are two\n * different accounts; sign-in stays exact (§4.5), which is why `SignInForm`'s hint after\n * a failed sign-in names the tagged address rather than trying it.\n *\n * Offer it only where a person types an address FOR THEMSELVES — sign-up, a later email\n * change in the profile — never in a field for someone else's (an invite dialog, a\n * share), where the tag would be a guess about another person's mail server.\n */\n\n/** What a tag may be: the app's name, lower case — letters, digits, `.`, `_`, `-`. A\n * space, `@` or `+` would make the result something other than a sub-address. */\nconst TAG_SHAPE = /^[a-z0-9][a-z0-9._-]*$/;\n\n/**\n * `taggedEmail(\"you@example.com\", \"kastlan\")` → `\"you+kastlan@example.com\"`, or `null`\n * when there is nothing to offer:\n *\n * - the address is not complete enough to split — no local part, no domain, or a\n * domain without an inner dot (the shape the field's own `type=\"email\"` accepts), so\n * the offer cannot appear before the address is plausible or linger once it stops\n * being one;\n * - the address already carries a `+` — the person's own scheme wins, and stacking a\n * second tag on it would be wrong;\n * - the tag is empty or not a plain name (see `TAG_SHAPE`).\n *\n * The tag is the app's name in lower case (`keksdose`, `kastlan`, `kurvenschmiede`); it\n * is trimmed and lower-cased here, so `\"Kastlan\"` gives the same answer. The address is\n * trimmed and otherwise kept as typed — normalising it is the server's job (server-kit's\n * `normalise_email`).\n */\nexport function taggedEmail(email: string, tag: string): string | null {\n const name = tag.trim().toLowerCase();\n if (!TAG_SHAPE.test(name)) return null;\n const parts = emailParts(email);\n if (!parts || parts.local.includes(\"+\")) return null;\n return `${parts.local}+${name}@${parts.domain}`;\n}\n\n/**\n * The trimmed address split at its last `@`, or `null` while it is not complete enough\n * to split: no local part, no domain, or a domain without an inner dot — the shape the\n * field's own `type=\"email\"` accepts.\n *\n * @internal `RegisterForm` gates its submit on it; not part of the barrel.\n */\nexport function emailParts(email: string): { local: string; domain: string } | null {\n const trimmed = email.trim();\n const at = trimmed.lastIndexOf(\"@\");\n if (at <= 0 || at === trimmed.length - 1) return null;\n const local = trimmed.slice(0, at);\n const domain = trimmed.slice(at + 1);\n if (!domain.includes(\".\") || domain.startsWith(\".\") || domain.endsWith(\".\")) return null;\n return { local, domain };\n}\n"],"mappings":";AAgCA,MAAM,YAAY;AAmBX,SAAS,YAAY,OAAe,KAA4B;AACrE,QAAM,OAAO,IAAI,KAAK,EAAE,YAAY;AACpC,MAAI,CAAC,UAAU,KAAK,IAAI,EAAG,QAAO;AAClC,QAAM,QAAQ,WAAW,KAAK;AAC9B,MAAI,CAAC,SAAS,MAAM,MAAM,SAAS,GAAG,EAAG,QAAO;AAChD,SAAO,GAAG,MAAM,KAAK,IAAI,IAAI,IAAI,MAAM,MAAM;AAC/C;AASO,SAAS,WAAW,OAAyD;AAClF,QAAM,UAAU,MAAM,KAAK;AAC3B,QAAM,KAAK,QAAQ,YAAY,GAAG;AAClC,MAAI,MAAM,KAAK,OAAO,QAAQ,SAAS,EAAG,QAAO;AACjD,QAAM,QAAQ,QAAQ,MAAM,GAAG,EAAE;AACjC,QAAM,SAAS,QAAQ,MAAM,KAAK,CAAC;AACnC,MAAI,CAAC,OAAO,SAAS,GAAG,KAAK,OAAO,WAAW,GAAG,KAAK,OAAO,SAAS,GAAG,EAAG,QAAO;AACpF,SAAO,EAAE,OAAO,OAAO;AACzB;","names":[]}
@@ -0,0 +1,79 @@
1
+ import * as react from 'react';
2
+ import { ComponentPropsWithoutRef, ReactNode } from 'react';
3
+ import { AuthHeadingLevel } from './status-parts.js';
4
+
5
+ /** Every string the form renders — the `forgotPassword` namespace. keksdose's words
6
+ * (`auth.forgot.*`), which kastlan took over unchanged. */
7
+ interface ForgotPasswordLabels {
8
+ /** The heading. */
9
+ title: string;
10
+ /** Under the heading, before the field. */
11
+ intro: string;
12
+ /** The email field's label. */
13
+ email: string;
14
+ submit: string;
15
+ /** The one answer, whatever the server knows — given the address as typed. */
16
+ sent: (email: string) => string;
17
+ /** Under it: how long the link lives, and where else to look. */
18
+ sentHint: string;
19
+ /** The link back to the sign-in page, on both states. */
20
+ backToSignIn: string;
21
+ /** A request that did not go through: a throttle, an outage. Never "unknown
22
+ * address" — the endpoint does not say. */
23
+ error: string;
24
+ }
25
+ declare const DEFAULT_FORGOT_PASSWORD_LABELS: ForgotPasswordLabels;
26
+ interface ForgotPasswordFormProps extends Omit<ComponentPropsWithoutRef<"div">, "onSubmit" | "children" | "title"> {
27
+ /**
28
+ * The address was submitted, trimmed: send `POST /auth/password-reset/request`.
29
+ * Resolve when the server answered — whatever it answered: it is `204` whether or not
30
+ * an account exists. Reject only when the request did not go through (a throttle, an
31
+ * outage); the form then stays, with the address, and says so. The form never sends a
32
+ * request itself (§8).
33
+ */
34
+ onSubmit: (email: string) => Promise<unknown> | void;
35
+ /** "Back to sign in" — the app's `/login`. Default `/login`. */
36
+ signInHref?: string;
37
+ /** The field's start value — the address the sign-in form already had, so someone
38
+ * whose password just failed need not type it twice. */
39
+ defaultEmail?: string;
40
+ /**
41
+ * The app's words for a failed request (a `429`: "Too many requests — try again in
42
+ * an hour"), or `undefined` for the kit's `error`. The same hook as `SignInForm`'s.
43
+ */
44
+ describeError?: (error: unknown) => ReactNode | undefined;
45
+ /** App content under the intro — a notice, a support address. */
46
+ formContent?: ReactNode;
47
+ /** The heading. Default `labels.title`; `null` draws none, for a page that puts it
48
+ * in `AuthLayout`'s `title` instead. */
49
+ title?: ReactNode;
50
+ /** The heading's level. Default `h2`, under the page's `h1`. */
51
+ headingAs?: AuthHeadingLevel;
52
+ labels?: Partial<ForgotPasswordLabels>;
53
+ }
54
+ /**
55
+ * "I forgot my password" for every app (docs/auth-harmonization.md §7): one field, then
56
+ * the same sentence whatever the answer — keksdose's `ForgotPasswordPage`
57
+ * (features/auth/forgot-password-page.tsx), kastlan's copy of it, as one component.
58
+ *
59
+ * **It always ends on the same message**: "If an account exists for …, the link is on
60
+ * its way." The server answers `204` whether or not the address has an account — so the
61
+ * page cannot be used to find out who has one — and the page must not undo that by
62
+ * saying more than the server knows. Worded as a promise ("we sent you a link"), a typo
63
+ * would look like a mail-delivery problem and send the person waiting instead of trying
64
+ * their other address (keksdose #198). The address shown is the one they typed, so a
65
+ * typo is visible.
66
+ *
67
+ * The only failure it can show is a request that did not go through (throttled, the
68
+ * server down), never "unknown address". §4.5's fallback to a tagged address
69
+ * (`you+kastlan@…` when `you@…` has no account) is the server's and changes nothing here.
70
+ *
71
+ * The submit is not disabled while the field is empty — a browser that autofills
72
+ * withholds the value until the first interaction, and a disabled button would swallow
73
+ * that first click; the field's own `required` answers an empty submit instead. After a
74
+ * submit the confirmation takes focus, because the button that had it is gone with the
75
+ * form.
76
+ */
77
+ declare function ForgotPasswordForm({ onSubmit, signInHref, defaultEmail, describeError, formContent, title, headingAs: Heading, labels: labelsProp, className, ...rest }: ForgotPasswordFormProps): react.JSX.Element;
78
+
79
+ export { DEFAULT_FORGOT_PASSWORD_LABELS, ForgotPasswordForm, type ForgotPasswordFormProps, type ForgotPasswordLabels };
@@ -0,0 +1,120 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useId, useRef, useState } from "react";
4
+ import { MailCheck } from "lucide-react";
5
+ import { cn } from "../lib/cn.js";
6
+ import { useKitLabels } from "../i18n/kit-labels.js";
7
+ import { AlertBanner } from "../components/alert-banner.js";
8
+ import { TextLink } from "../components/text-link.js";
9
+ import { Button, Input } from "../components/ui.js";
10
+ import { FORM_HEADING_CLASS, INTRO_CLASS, OutcomeMessage, isThenable, useFocusWhen } from "./status-parts.js";
11
+ const DEFAULT_FORGOT_PASSWORD_LABELS = {
12
+ title: "Forgot password",
13
+ intro: "Enter your account\u2019s email address. We\u2019ll send you a link to choose a new password.",
14
+ email: "Email",
15
+ submit: "Send the link",
16
+ sent: (email) => `If an account exists for ${email}, the link is on its way.`,
17
+ sentHint: "The link is valid for one hour and works exactly once. Check your spam folder too.",
18
+ backToSignIn: "Back to sign in",
19
+ error: "The request failed. Please try again later."
20
+ };
21
+ function ForgotPasswordForm({
22
+ onSubmit,
23
+ signInHref = "/login",
24
+ defaultEmail = "",
25
+ describeError,
26
+ formContent,
27
+ title,
28
+ headingAs: Heading = "h2",
29
+ labels: labelsProp,
30
+ className,
31
+ ...rest
32
+ }) {
33
+ const labels = useKitLabels("forgotPassword", DEFAULT_FORGOT_PASSWORD_LABELS, labelsProp);
34
+ const [email, setEmail] = useState(defaultEmail);
35
+ const [pending, setPending] = useState(false);
36
+ const [failure, setFailure] = useState(null);
37
+ const [sentTo, setSentTo] = useState(null);
38
+ const headingId = useId();
39
+ const sentRef = useRef(null);
40
+ useFocusWhen(sentTo !== null, sentRef);
41
+ const heading = title === null ? null : /* @__PURE__ */ jsx(Heading, { id: headingId, className: FORM_HEADING_CLASS, children: title ?? labels.title });
42
+ const back = /* @__PURE__ */ jsx("p", { className: "text-center text-sm", children: /* @__PURE__ */ jsx(TextLink, { href: signInHref, tone: "primary", children: labels.backToSignIn }) });
43
+ if (sentTo !== null) {
44
+ return /* @__PURE__ */ jsxs("div", { ...rest, "data-state": "sent", className: cn("space-y-3", className), children: [
45
+ heading,
46
+ /* @__PURE__ */ jsxs(OutcomeMessage, { icon: /* @__PURE__ */ jsx(MailCheck, { className: "text-[var(--success)]" }), focusRef: sentRef, children: [
47
+ /* @__PURE__ */ jsx("p", { className: INTRO_CLASS, children: labels.sent(sentTo) }),
48
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-[var(--text-muted)]", children: labels.sentHint })
49
+ ] }),
50
+ back
51
+ ] });
52
+ }
53
+ const submit = (e) => {
54
+ e.preventDefault();
55
+ const address = email.trim();
56
+ if (pending || address === "") return;
57
+ setFailure(null);
58
+ let result;
59
+ try {
60
+ result = onSubmit(address);
61
+ } catch (error) {
62
+ setFailure(describeError?.(error) ?? labels.error);
63
+ return;
64
+ }
65
+ if (!isThenable(result)) {
66
+ setSentTo(address);
67
+ return;
68
+ }
69
+ setPending(true);
70
+ result.then(
71
+ () => {
72
+ setPending(false);
73
+ setSentTo(address);
74
+ },
75
+ (error) => {
76
+ setPending(false);
77
+ setFailure(describeError?.(error) ?? labels.error);
78
+ }
79
+ );
80
+ };
81
+ return /* @__PURE__ */ jsxs("div", { ...rest, "data-state": "form", className: cn("space-y-3", className), children: [
82
+ /* @__PURE__ */ jsxs(
83
+ "form",
84
+ {
85
+ className: "space-y-3",
86
+ "aria-labelledby": title === null ? void 0 : headingId,
87
+ onSubmit: submit,
88
+ children: [
89
+ heading,
90
+ /* @__PURE__ */ jsx("p", { className: INTRO_CLASS, children: labels.intro }),
91
+ formContent,
92
+ /* @__PURE__ */ jsx(
93
+ Input,
94
+ {
95
+ type: "email",
96
+ name: "email",
97
+ autoComplete: "email",
98
+ label: labels.email,
99
+ value: email,
100
+ onChange: (e) => {
101
+ setEmail(e.target.value);
102
+ if (failure) setFailure(null);
103
+ },
104
+ readOnly: pending,
105
+ required: true
106
+ }
107
+ ),
108
+ failure != null && /* @__PURE__ */ jsx(AlertBanner, { tone: "danger", size: "sm", role: "alert", children: failure }),
109
+ /* @__PURE__ */ jsx(Button, { type: "submit", className: "w-full", pending, children: labels.submit })
110
+ ]
111
+ }
112
+ ),
113
+ back
114
+ ] });
115
+ }
116
+ export {
117
+ DEFAULT_FORGOT_PASSWORD_LABELS,
118
+ ForgotPasswordForm
119
+ };
120
+ //# sourceMappingURL=forgot-password-form.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/auth/forgot-password-form.tsx"],"sourcesContent":["import { useId, useRef, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, FormEvent, ReactNode } from \"react\";\nimport { MailCheck } from \"lucide-react\";\nimport { cn } from \"../lib/cn\";\nimport { useKitLabels } from \"../i18n/kit-labels\";\nimport { AlertBanner } from \"../components/alert-banner\";\nimport { TextLink } from \"../components/text-link\";\nimport { Button, Input } from \"../components/ui\";\nimport { FORM_HEADING_CLASS, INTRO_CLASS, OutcomeMessage, isThenable, useFocusWhen } from \"./status-parts\";\nimport type { AuthHeadingLevel } from \"./status-parts\";\n\n/* ── Labels ──────────────────────────────────────────────────────────────── */\n\n/** Every string the form renders — the `forgotPassword` namespace. keksdose's words\n * (`auth.forgot.*`), which kastlan took over unchanged. */\nexport interface ForgotPasswordLabels {\n /** The heading. */\n title: string;\n /** Under the heading, before the field. */\n intro: string;\n /** The email field's label. */\n email: string;\n submit: string;\n /** The one answer, whatever the server knows — given the address as typed. */\n sent: (email: string) => string;\n /** Under it: how long the link lives, and where else to look. */\n sentHint: string;\n /** The link back to the sign-in page, on both states. */\n backToSignIn: string;\n /** A request that did not go through: a throttle, an outage. Never \"unknown\n * address\" — the endpoint does not say. */\n error: string;\n}\n\nexport const DEFAULT_FORGOT_PASSWORD_LABELS: ForgotPasswordLabels = {\n title: \"Forgot password\",\n intro: \"Enter your account’s email address. We’ll send you a link to choose a new password.\",\n email: \"Email\",\n submit: \"Send the link\",\n sent: (email) => `If an account exists for ${email}, the link is on its way.`,\n sentHint: \"The link is valid for one hour and works exactly once. Check your spam folder too.\",\n backToSignIn: \"Back to sign in\",\n error: \"The request failed. Please try again later.\",\n};\n\n/* ── The form ────────────────────────────────────────────────────────────── */\n\nexport interface ForgotPasswordFormProps\n extends Omit<ComponentPropsWithoutRef<\"div\">, \"onSubmit\" | \"children\" | \"title\"> {\n /**\n * The address was submitted, trimmed: send `POST /auth/password-reset/request`.\n * Resolve when the server answered — whatever it answered: it is `204` whether or not\n * an account exists. Reject only when the request did not go through (a throttle, an\n * outage); the form then stays, with the address, and says so. The form never sends a\n * request itself (§8).\n */\n onSubmit: (email: string) => Promise<unknown> | void;\n /** \"Back to sign in\" — the app's `/login`. Default `/login`. */\n signInHref?: string;\n /** The field's start value — the address the sign-in form already had, so someone\n * whose password just failed need not type it twice. */\n defaultEmail?: string;\n /**\n * The app's words for a failed request (a `429`: \"Too many requests — try again in\n * an hour\"), or `undefined` for the kit's `error`. The same hook as `SignInForm`'s.\n */\n describeError?: (error: unknown) => ReactNode | undefined;\n /** App content under the intro — a notice, a support address. */\n formContent?: ReactNode;\n /** The heading. Default `labels.title`; `null` draws none, for a page that puts it\n * in `AuthLayout`'s `title` instead. */\n title?: ReactNode;\n /** The heading's level. Default `h2`, under the page's `h1`. */\n headingAs?: AuthHeadingLevel;\n labels?: Partial<ForgotPasswordLabels>;\n}\n\n/**\n * \"I forgot my password\" for every app (docs/auth-harmonization.md §7): one field, then\n * the same sentence whatever the answer — keksdose's `ForgotPasswordPage`\n * (features/auth/forgot-password-page.tsx), kastlan's copy of it, as one component.\n *\n * **It always ends on the same message**: \"If an account exists for …, the link is on\n * its way.\" The server answers `204` whether or not the address has an account — so the\n * page cannot be used to find out who has one — and the page must not undo that by\n * saying more than the server knows. Worded as a promise (\"we sent you a link\"), a typo\n * would look like a mail-delivery problem and send the person waiting instead of trying\n * their other address (keksdose #198). The address shown is the one they typed, so a\n * typo is visible.\n *\n * The only failure it can show is a request that did not go through (throttled, the\n * server down), never \"unknown address\". §4.5's fallback to a tagged address\n * (`you+kastlan@…` when `you@…` has no account) is the server's and changes nothing here.\n *\n * The submit is not disabled while the field is empty — a browser that autofills\n * withholds the value until the first interaction, and a disabled button would swallow\n * that first click; the field's own `required` answers an empty submit instead. After a\n * submit the confirmation takes focus, because the button that had it is gone with the\n * form.\n */\nexport function ForgotPasswordForm({\n onSubmit,\n signInHref = \"/login\",\n defaultEmail = \"\",\n describeError,\n formContent,\n title,\n headingAs: Heading = \"h2\",\n labels: labelsProp,\n className,\n ...rest\n}: ForgotPasswordFormProps) {\n const labels = useKitLabels(\"forgotPassword\", DEFAULT_FORGOT_PASSWORD_LABELS, labelsProp);\n const [email, setEmail] = useState(defaultEmail);\n const [pending, setPending] = useState(false);\n const [failure, setFailure] = useState<ReactNode>(null);\n const [sentTo, setSentTo] = useState<string | null>(null);\n const headingId = useId();\n const sentRef = useRef<HTMLDivElement>(null);\n useFocusWhen(sentTo !== null, sentRef);\n\n const heading =\n title === null ? null : (\n <Heading id={headingId} className={FORM_HEADING_CLASS}>\n {title ?? labels.title}\n </Heading>\n );\n const back = (\n <p className=\"text-center text-sm\">\n <TextLink href={signInHref} tone=\"primary\">\n {labels.backToSignIn}\n </TextLink>\n </p>\n );\n\n if (sentTo !== null) {\n return (\n <div {...rest} data-state=\"sent\" className={cn(\"space-y-3\", className)}>\n {heading}\n <OutcomeMessage icon={<MailCheck className=\"text-[var(--success)]\" />} focusRef={sentRef}>\n <p className={INTRO_CLASS}>{labels.sent(sentTo)}</p>\n <p className=\"text-xs text-[var(--text-muted)]\">{labels.sentHint}</p>\n </OutcomeMessage>\n {back}\n </div>\n );\n }\n\n const submit = (e: FormEvent) => {\n e.preventDefault();\n const address = email.trim();\n if (pending || address === \"\") return;\n setFailure(null);\n let result: unknown;\n try {\n result = onSubmit(address);\n } catch (error) {\n setFailure(describeError?.(error) ?? labels.error);\n return;\n }\n if (!isThenable(result)) {\n setSentTo(address);\n return;\n }\n setPending(true);\n result.then(\n () => {\n setPending(false);\n setSentTo(address);\n },\n (error: unknown) => {\n setPending(false);\n setFailure(describeError?.(error) ?? labels.error);\n },\n );\n };\n\n return (\n <div {...rest} data-state=\"form\" className={cn(\"space-y-3\", className)}>\n <form\n className=\"space-y-3\"\n aria-labelledby={title === null ? undefined : headingId}\n onSubmit={submit}\n >\n {heading}\n <p className={INTRO_CLASS}>{labels.intro}</p>\n {formContent}\n <Input\n type=\"email\"\n name=\"email\"\n autoComplete=\"email\"\n label={labels.email}\n value={email}\n onChange={(e) => {\n setEmail(e.target.value);\n if (failure) setFailure(null);\n }}\n readOnly={pending}\n required\n />\n {failure != null && (\n <AlertBanner tone=\"danger\" size=\"sm\" role=\"alert\">\n {failure}\n </AlertBanner>\n )}\n <Button type=\"submit\" className=\"w-full\" pending={pending}>\n {labels.submit}\n </Button>\n </form>\n {back}\n </div>\n );\n}\n"],"mappings":";AA2HM,cAgBE,YAhBF;AA3HN,SAAS,OAAO,QAAQ,gBAAgB;AAExC,SAAS,iBAAiB;AAC1B,SAAS,UAAU;AACnB,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB;AACzB,SAAS,QAAQ,aAAa;AAC9B,SAAS,oBAAoB,aAAa,gBAAgB,YAAY,oBAAoB;AA0BnF,MAAM,iCAAuD;AAAA,EAClE,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,QAAQ;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
2
+ * The few hard rules of the sign-up and sign-in forms, in one place — and the only ones
3
+ * (docs/auth-harmonization.md §3.1, §8). The servers check the same; the kit adds no
4
+ * rule of its own, and everything the strength meter shows beyond these is advice.
5
+ *
6
+ * @internal Shared by RegisterForm, SignInForm and CompleteNameDialog; the coordinator
7
+ * decides whether the constants join the barrel.
8
+ */
9
+ /** At least 8 characters. */
10
+ declare const PASSWORD_MIN_LENGTH = 8;
11
+ /** At most 72 BYTES — bcrypt reads no further, so a longer password would be silently
12
+ * cut. "ü" is two bytes, an emoji four. */
13
+ declare const PASSWORD_MAX_BYTES = 72;
14
+ /** A first or last name: 1–120 characters after trimming — the old `display_name`
15
+ * limit, so a migrated name fits (§3.1). */
16
+ declare const PERSON_NAME_MAX_LENGTH = 120;
17
+ /** 1–120 characters after trimming. */
18
+ declare function personNameOk(value: string): boolean;
19
+ /**
20
+ * Why a new password and its confirmation may not be submitted yet, or `null` when they
21
+ * may — keksdose's `passwordPairError` (features/auth/password-fields.tsx). Characters
22
+ * are counted as code points, as the strength meter counts them: an emoji is one
23
+ * character to the person typing it.
24
+ */
25
+ declare function newPasswordProblem(password: string, confirm: string): "length" | "bytes" | "mismatch" | null;
26
+
27
+ export { PASSWORD_MAX_BYTES, PASSWORD_MIN_LENGTH, PERSON_NAME_MAX_LENGTH, newPasswordProblem, personNameOk };
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ import { passwordByteLength } from "../components/password-strength.js";
3
+ const PASSWORD_MIN_LENGTH = 8;
4
+ const PASSWORD_MAX_BYTES = 72;
5
+ const PERSON_NAME_MAX_LENGTH = 120;
6
+ function personNameOk(value) {
7
+ const length = value.trim().length;
8
+ return length >= 1 && length <= PERSON_NAME_MAX_LENGTH;
9
+ }
10
+ function newPasswordProblem(password, confirm) {
11
+ if ([...password].length < PASSWORD_MIN_LENGTH) return "length";
12
+ if (passwordByteLength(password) > PASSWORD_MAX_BYTES) return "bytes";
13
+ if (password !== confirm) return "mismatch";
14
+ return null;
15
+ }
16
+ export {
17
+ PASSWORD_MAX_BYTES,
18
+ PASSWORD_MIN_LENGTH,
19
+ PERSON_NAME_MAX_LENGTH,
20
+ newPasswordProblem,
21
+ personNameOk
22
+ };
23
+ //# sourceMappingURL=form-rules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/auth/form-rules.ts"],"sourcesContent":["import { passwordByteLength } from \"../components/password-strength\";\n\n/**\n * The few hard rules of the sign-up and sign-in forms, in one place — and the only ones\n * (docs/auth-harmonization.md §3.1, §8). The servers check the same; the kit adds no\n * rule of its own, and everything the strength meter shows beyond these is advice.\n *\n * @internal Shared by RegisterForm, SignInForm and CompleteNameDialog; the coordinator\n * decides whether the constants join the barrel.\n */\n\n/** At least 8 characters. */\nexport const PASSWORD_MIN_LENGTH = 8;\n\n/** At most 72 BYTES — bcrypt reads no further, so a longer password would be silently\n * cut. \"ü\" is two bytes, an emoji four. */\nexport const PASSWORD_MAX_BYTES = 72;\n\n/** A first or last name: 1–120 characters after trimming — the old `display_name`\n * limit, so a migrated name fits (§3.1). */\nexport const PERSON_NAME_MAX_LENGTH = 120;\n\n/** 1–120 characters after trimming. */\nexport function personNameOk(value: string): boolean {\n const length = value.trim().length;\n return length >= 1 && length <= PERSON_NAME_MAX_LENGTH;\n}\n\n/**\n * Why a new password and its confirmation may not be submitted yet, or `null` when they\n * may — keksdose's `passwordPairError` (features/auth/password-fields.tsx). Characters\n * are counted as code points, as the strength meter counts them: an emoji is one\n * character to the person typing it.\n */\nexport function newPasswordProblem(password: string, confirm: string): \"length\" | \"bytes\" | \"mismatch\" | null {\n if ([...password].length < PASSWORD_MIN_LENGTH) return \"length\";\n if (passwordByteLength(password) > PASSWORD_MAX_BYTES) return \"bytes\";\n if (password !== confirm) return \"mismatch\";\n return null;\n}\n"],"mappings":";AAAA,SAAS,0BAA0B;AAY5B,MAAM,sBAAsB;AAI5B,MAAM,qBAAqB;AAI3B,MAAM,yBAAyB;AAG/B,SAAS,aAAa,OAAwB;AACnD,QAAM,SAAS,MAAM,KAAK,EAAE;AAC5B,SAAO,UAAU,KAAK,UAAU;AAClC;AAQO,SAAS,mBAAmB,UAAkB,SAAyD;AAC5G,MAAI,CAAC,GAAG,QAAQ,EAAE,SAAS,oBAAqB,QAAO;AACvD,MAAI,mBAAmB,QAAQ,IAAI,mBAAoB,QAAO;AAC9D,MAAI,aAAa,QAAS,QAAO;AACjC,SAAO;AACT;","names":[]}
@@ -0,0 +1,38 @@
1
+ import * as react from 'react';
2
+ import { ReactNode, Ref } from 'react';
3
+
4
+ /** @internal The words the fields show — the host form's own labels. */
5
+ interface NewPasswordFieldsText {
6
+ password: ReactNode;
7
+ confirm: ReactNode;
8
+ mismatch: ReactNode;
9
+ }
10
+ /** @internal */
11
+ interface NewPasswordFieldsProps {
12
+ password: string;
13
+ confirm: string;
14
+ onPasswordChange: (value: string) => void;
15
+ onConfirmChange: (value: string) => void;
16
+ text: NewPasswordFieldsText;
17
+ /** A request is running: both fields `readOnly` (not `disabled`, which would drop
18
+ * the focus of the one being typed in). */
19
+ busy?: boolean;
20
+ passwordRef?: Ref<HTMLInputElement>;
21
+ }
22
+ /**
23
+ * "Choose a password": the field, the strength meter with its advisory checklist, and
24
+ * the confirmation — keksdose's `PasswordFields`, which its register form, its reset
25
+ * page and its forced-change step share so that every screen choosing a password does
26
+ * it under the same rules and the same feedback. Here `RegisterForm` and
27
+ * `SignInForm`'s set-a-new-password step share it.
28
+ *
29
+ * Both fields are `new-password`: a password manager offers to generate one and never
30
+ * fills in the current one. The confirmation carries the mismatch as its own `error`,
31
+ * attached with `aria-describedby`; the key is always passed, so the message coming and
32
+ * going never remounts the field under the typist.
33
+ *
34
+ * @internal Not part of the barrel; the forms are.
35
+ */
36
+ declare function NewPasswordFields({ password, confirm, onPasswordChange, onConfirmChange, text, busy, passwordRef, }: NewPasswordFieldsProps): react.JSX.Element;
37
+
38
+ export { NewPasswordFields, type NewPasswordFieldsProps, type NewPasswordFieldsText };
@@ -0,0 +1,54 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { PasswordStrengthMeter } from "../components/password-strength.js";
4
+ import { Input } from "../components/ui.js";
5
+ import { PASSWORD_MAX_BYTES, PASSWORD_MIN_LENGTH } from "./form-rules.js";
6
+ function NewPasswordFields({
7
+ password,
8
+ confirm,
9
+ onPasswordChange,
10
+ onConfirmChange,
11
+ text,
12
+ busy = false,
13
+ passwordRef
14
+ }) {
15
+ const mismatch = confirm !== "" && confirm !== password;
16
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
17
+ /* @__PURE__ */ jsxs("div", { children: [
18
+ /* @__PURE__ */ jsx(
19
+ Input,
20
+ {
21
+ ref: passwordRef,
22
+ type: "password",
23
+ name: "new-password",
24
+ autoComplete: "new-password",
25
+ label: text.password,
26
+ value: password,
27
+ onChange: (e) => onPasswordChange(e.target.value),
28
+ minLength: PASSWORD_MIN_LENGTH,
29
+ readOnly: busy,
30
+ required: true
31
+ }
32
+ ),
33
+ /* @__PURE__ */ jsx(PasswordStrengthMeter, { value: password, minLength: PASSWORD_MIN_LENGTH, maxBytes: PASSWORD_MAX_BYTES })
34
+ ] }),
35
+ /* @__PURE__ */ jsx(
36
+ Input,
37
+ {
38
+ type: "password",
39
+ name: "confirm-password",
40
+ autoComplete: "new-password",
41
+ label: text.confirm,
42
+ value: confirm,
43
+ onChange: (e) => onConfirmChange(e.target.value),
44
+ readOnly: busy,
45
+ error: mismatch ? text.mismatch : void 0,
46
+ required: true
47
+ }
48
+ )
49
+ ] });
50
+ }
51
+ export {
52
+ NewPasswordFields
53
+ };
54
+ //# sourceMappingURL=new-password-fields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/auth/new-password-fields.tsx"],"sourcesContent":["import type { ReactNode, Ref } from \"react\";\nimport { PasswordStrengthMeter } from \"../components/password-strength\";\nimport { Input } from \"../components/ui\";\nimport { PASSWORD_MAX_BYTES, PASSWORD_MIN_LENGTH } from \"./form-rules\";\n\n/** @internal The words the fields show — the host form's own labels. */\nexport interface NewPasswordFieldsText {\n password: ReactNode;\n confirm: ReactNode;\n mismatch: ReactNode;\n}\n\n/** @internal */\nexport interface NewPasswordFieldsProps {\n password: string;\n confirm: string;\n onPasswordChange: (value: string) => void;\n onConfirmChange: (value: string) => void;\n text: NewPasswordFieldsText;\n /** A request is running: both fields `readOnly` (not `disabled`, which would drop\n * the focus of the one being typed in). */\n busy?: boolean;\n passwordRef?: Ref<HTMLInputElement>;\n}\n\n/**\n * \"Choose a password\": the field, the strength meter with its advisory checklist, and\n * the confirmation — keksdose's `PasswordFields`, which its register form, its reset\n * page and its forced-change step share so that every screen choosing a password does\n * it under the same rules and the same feedback. Here `RegisterForm` and\n * `SignInForm`'s set-a-new-password step share it.\n *\n * Both fields are `new-password`: a password manager offers to generate one and never\n * fills in the current one. The confirmation carries the mismatch as its own `error`,\n * attached with `aria-describedby`; the key is always passed, so the message coming and\n * going never remounts the field under the typist.\n *\n * @internal Not part of the barrel; the forms are.\n */\nexport function NewPasswordFields({\n password,\n confirm,\n onPasswordChange,\n onConfirmChange,\n text,\n busy = false,\n passwordRef,\n}: NewPasswordFieldsProps) {\n const mismatch = confirm !== \"\" && confirm !== password;\n return (\n <>\n <div>\n <Input\n ref={passwordRef}\n type=\"password\"\n name=\"new-password\"\n autoComplete=\"new-password\"\n label={text.password}\n value={password}\n onChange={(e) => onPasswordChange(e.target.value)}\n minLength={PASSWORD_MIN_LENGTH}\n readOnly={busy}\n required\n />\n {/* The 72-byte cap is passed because a SIGN-IN password has one (bcrypt); the\n minimum is passed rather than left to the meter's own default 8, so the two\n cannot drift apart. */}\n <PasswordStrengthMeter value={password} minLength={PASSWORD_MIN_LENGTH} maxBytes={PASSWORD_MAX_BYTES} />\n </div>\n {/* A typo'd password costs a reset mail — and under keksdose's end-to-end\n encryption, data (feedback #124) — so it is typed twice. */}\n <Input\n type=\"password\"\n name=\"confirm-password\"\n autoComplete=\"new-password\"\n label={text.confirm}\n value={confirm}\n onChange={(e) => onConfirmChange(e.target.value)}\n readOnly={busy}\n error={mismatch ? text.mismatch : undefined}\n required\n />\n </>\n );\n}\n"],"mappings":";AAkDI,mBAEI,KADF,YADF;AAjDJ,SAAS,6BAA6B;AACtC,SAAS,aAAa;AACtB,SAAS,oBAAoB,2BAA2B;AAoCjD,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AACF,GAA2B;AACzB,QAAM,WAAW,YAAY,MAAM,YAAY;AAC/C,SACE,iCACE;AAAA,yBAAC,SACC;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,KAAK;AAAA,UACL,MAAK;AAAA,UACL,MAAK;AAAA,UACL,cAAa;AAAA,UACb,OAAO,KAAK;AAAA,UACZ,OAAO;AAAA,UACP,UAAU,CAAC,MAAM,iBAAiB,EAAE,OAAO,KAAK;AAAA,UAChD,WAAW;AAAA,UACX,UAAU;AAAA,UACV,UAAQ;AAAA;AAAA,MACV;AAAA,MAIA,oBAAC,yBAAsB,OAAO,UAAU,WAAW,qBAAqB,UAAU,oBAAoB;AAAA,OACxG;AAAA,IAGA;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,MAAK;AAAA,QACL,cAAa;AAAA,QACb,OAAO,KAAK;AAAA,QACZ,OAAO;AAAA,QACP,UAAU,CAAC,MAAM,gBAAgB,EAAE,OAAO,KAAK;AAAA,QAC/C,UAAU;AAAA,QACV,OAAO,WAAW,KAAK,WAAW;AAAA,QAClC,UAAQ;AAAA;AAAA,IACV;AAAA,KACF;AAEJ;","names":[]}
@@ -0,0 +1,57 @@
1
+ import * as react from 'react';
2
+ import { ComponentPropsWithoutRef, ReactNode } from 'react';
3
+ import { AuthHeadingLevel } from './status-parts.js';
4
+
5
+ /** Every string the page renders — the `notFound` namespace. keksdose's words
6
+ * (`error.not_found_*`), which kastlan took over. */
7
+ interface NotFoundLabels {
8
+ /** The heading. */
9
+ title: string;
10
+ /** Under it. */
11
+ body: string;
12
+ /** The way out for everyone — to `homeHref`. */
13
+ home: string;
14
+ /** The second way out for someone signed in — to `appHref`. */
15
+ app: string;
16
+ }
17
+ declare const DEFAULT_NOT_FOUND_LABELS: NotFoundLabels;
18
+ interface NotFoundPageProps extends Omit<ComponentPropsWithoutRef<"div">, "children" | "title"> {
19
+ /** "Go to the start page". Default `/`, which takes a signed-in user into the app and
20
+ * anyone else to sign-in in all three apps. */
21
+ homeHref?: string;
22
+ /**
23
+ * "Back to the app", beside it — pass it while someone is signed in. A LITERAL page
24
+ * (keksdose's `/budget`), never the "last visited page" an app restores on start: a
25
+ * stale one of those pointing at a route that is gone is the likeliest way a
26
+ * signed-in user lands here (keksdose's not-found-page.tsx).
27
+ */
28
+ appHref?: string;
29
+ /** App content under the text — a search field, a support address. */
30
+ children?: ReactNode;
31
+ /** `false` adds no `noindex` — for a preview inside another page. Default `true`. */
32
+ noIndex?: boolean;
33
+ /** The heading's level. Default `h2`, under `AuthLayout`'s `h1`; `h1` where the page
34
+ * stands alone (inside the app shell). */
35
+ headingAs?: AuthHeadingLevel;
36
+ labels?: Partial<NotFoundLabels>;
37
+ }
38
+ /**
39
+ * What an unknown address renders (the router's catch-all), signed out and signed in —
40
+ * keksdose's `NotFoundPage` (app/not-found-page.tsx, feedback #129), which kastlan took
41
+ * over on `AuthLayout` (docs/auth-harmonization.md §7).
42
+ *
43
+ * In place of the silent `<Navigate to="/">` keksdose had: bouncing every typo, dead link
44
+ * and fabricated URL to the start page is what Search Console reports as a soft 404, and
45
+ * it hid broken links. An SPA cannot send a real 404 status — the web server answers
46
+ * every path with index.html — so the page says it in words and calls
47
+ * {@link useNoIndex}, which makes a crawler drop it (the server's `X-Robots-Tag` is the
48
+ * authoritative half).
49
+ *
50
+ * It is the page's CONTENT, not a frame, so it sits in either: as `AuthLayout`'s child
51
+ * for a visitor (`headingAs` default `h2`, under the layout's title), or bare inside the
52
+ * app shell for someone signed in (`headingAs="h1"`, and `appHref`). The large "404" is
53
+ * decoration — the heading says it in words — and hidden from a screen reader.
54
+ */
55
+ declare function NotFoundPage({ homeHref, appHref, children, noIndex, headingAs: Heading, labels: labelsProp, className, ...rest }: NotFoundPageProps): react.JSX.Element;
56
+
57
+ export { DEFAULT_NOT_FOUND_LABELS, type NotFoundLabels, NotFoundPage, type NotFoundPageProps };
@@ -0,0 +1,40 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { cn } from "../lib/cn.js";
4
+ import { useKitLabels } from "../i18n/kit-labels.js";
5
+ import { useNoIndex } from "../hooks/use-noindex.js";
6
+ import { Button } from "../components/ui.js";
7
+ const DEFAULT_NOT_FOUND_LABELS = {
8
+ title: "Page not found",
9
+ body: "This address doesn\u2019t exist (any more). It may be a typo, or the page has moved.",
10
+ home: "Go to the start page",
11
+ app: "Back to the app"
12
+ };
13
+ function NotFoundPage({
14
+ homeHref = "/",
15
+ appHref,
16
+ children,
17
+ noIndex = true,
18
+ headingAs: Heading = "h2",
19
+ labels: labelsProp,
20
+ className,
21
+ ...rest
22
+ }) {
23
+ const labels = useKitLabels("notFound", DEFAULT_NOT_FOUND_LABELS, labelsProp);
24
+ useNoIndex(noIndex);
25
+ return /* @__PURE__ */ jsxs("div", { ...rest, className: cn("flex flex-col items-center gap-2 py-4 text-center", className), children: [
26
+ /* @__PURE__ */ jsx("p", { "aria-hidden": true, className: "text-6xl font-bold leading-none tracking-tight text-[var(--text-placeholder)]", children: "404" }),
27
+ /* @__PURE__ */ jsx(Heading, { className: "mt-2 text-xl font-semibold text-[var(--text-primary)]", children: labels.title }),
28
+ /* @__PURE__ */ jsx("p", { className: "max-w-prose text-sm text-[var(--text-secondary)]", children: labels.body }),
29
+ children,
30
+ /* @__PURE__ */ jsxs("div", { className: "mt-4 flex flex-wrap justify-center gap-3", children: [
31
+ /* @__PURE__ */ jsx(Button, { href: homeHref, variant: "brand", children: labels.home }),
32
+ appHref !== void 0 && /* @__PURE__ */ jsx(Button, { href: appHref, variant: "secondary", children: labels.app })
33
+ ] })
34
+ ] });
35
+ }
36
+ export {
37
+ DEFAULT_NOT_FOUND_LABELS,
38
+ NotFoundPage
39
+ };
40
+ //# sourceMappingURL=not-found-page.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/auth/not-found-page.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef, ReactNode } from \"react\";\nimport { cn } from \"../lib/cn\";\nimport { useKitLabels } from \"../i18n/kit-labels\";\nimport { useNoIndex } from \"../hooks/use-noindex\";\nimport { Button } from \"../components/ui\";\nimport type { AuthHeadingLevel } from \"./status-parts\";\n\n/** Every string the page renders — the `notFound` namespace. keksdose's words\n * (`error.not_found_*`), which kastlan took over. */\nexport interface NotFoundLabels {\n /** The heading. */\n title: string;\n /** Under it. */\n body: string;\n /** The way out for everyone — to `homeHref`. */\n home: string;\n /** The second way out for someone signed in — to `appHref`. */\n app: string;\n}\n\nexport const DEFAULT_NOT_FOUND_LABELS: NotFoundLabels = {\n title: \"Page not found\",\n body: \"This address doesn’t exist (any more). It may be a typo, or the page has moved.\",\n home: \"Go to the start page\",\n app: \"Back to the app\",\n};\n\nexport interface NotFoundPageProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\" | \"title\"> {\n /** \"Go to the start page\". Default `/`, which takes a signed-in user into the app and\n * anyone else to sign-in in all three apps. */\n homeHref?: string;\n /**\n * \"Back to the app\", beside it — pass it while someone is signed in. A LITERAL page\n * (keksdose's `/budget`), never the \"last visited page\" an app restores on start: a\n * stale one of those pointing at a route that is gone is the likeliest way a\n * signed-in user lands here (keksdose's not-found-page.tsx).\n */\n appHref?: string;\n /** App content under the text — a search field, a support address. */\n children?: ReactNode;\n /** `false` adds no `noindex` — for a preview inside another page. Default `true`. */\n noIndex?: boolean;\n /** The heading's level. Default `h2`, under `AuthLayout`'s `h1`; `h1` where the page\n * stands alone (inside the app shell). */\n headingAs?: AuthHeadingLevel;\n labels?: Partial<NotFoundLabels>;\n}\n\n/**\n * What an unknown address renders (the router's catch-all), signed out and signed in —\n * keksdose's `NotFoundPage` (app/not-found-page.tsx, feedback #129), which kastlan took\n * over on `AuthLayout` (docs/auth-harmonization.md §7).\n *\n * In place of the silent `<Navigate to=\"/\">` keksdose had: bouncing every typo, dead link\n * and fabricated URL to the start page is what Search Console reports as a soft 404, and\n * it hid broken links. An SPA cannot send a real 404 status — the web server answers\n * every path with index.html — so the page says it in words and calls\n * {@link useNoIndex}, which makes a crawler drop it (the server's `X-Robots-Tag` is the\n * authoritative half).\n *\n * It is the page's CONTENT, not a frame, so it sits in either: as `AuthLayout`'s child\n * for a visitor (`headingAs` default `h2`, under the layout's title), or bare inside the\n * app shell for someone signed in (`headingAs=\"h1\"`, and `appHref`). The large \"404\" is\n * decoration — the heading says it in words — and hidden from a screen reader.\n */\nexport function NotFoundPage({\n homeHref = \"/\",\n appHref,\n children,\n noIndex = true,\n headingAs: Heading = \"h2\",\n labels: labelsProp,\n className,\n ...rest\n}: NotFoundPageProps) {\n const labels = useKitLabels(\"notFound\", DEFAULT_NOT_FOUND_LABELS, labelsProp);\n useNoIndex(noIndex);\n return (\n <div {...rest} className={cn(\"flex flex-col items-center gap-2 py-4 text-center\", className)}>\n <p aria-hidden className=\"text-6xl font-bold leading-none tracking-tight text-[var(--text-placeholder)]\">\n 404\n </p>\n <Heading className=\"mt-2 text-xl font-semibold text-[var(--text-primary)]\">{labels.title}</Heading>\n <p className=\"max-w-prose text-sm text-[var(--text-secondary)]\">{labels.body}</p>\n {children}\n <div className=\"mt-4 flex flex-wrap justify-center gap-3\">\n <Button href={homeHref} variant=\"brand\">\n {labels.home}\n </Button>\n {appHref !== undefined && (\n <Button href={appHref} variant=\"secondary\">\n {labels.app}\n </Button>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";AA+EM,cAMA,YANA;AA9EN,SAAS,UAAU;AACnB,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAC3B,SAAS,cAAc;AAgBhB,MAAM,2BAA2C;AAAA,EACtD,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,KAAK;AACP;AAwCO,SAAS,aAAa;AAAA,EAC3B,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV,WAAW,UAAU;AAAA,EACrB,QAAQ;AAAA,EACR;AAAA,EACA,GAAG;AACL,GAAsB;AACpB,QAAM,SAAS,aAAa,YAAY,0BAA0B,UAAU;AAC5E,aAAW,OAAO;AAClB,SACE,qBAAC,SAAK,GAAG,MAAM,WAAW,GAAG,qDAAqD,SAAS,GACzF;AAAA,wBAAC,OAAE,eAAW,MAAC,WAAU,iFAAgF,iBAEzG;AAAA,IACA,oBAAC,WAAQ,WAAU,yDAAyD,iBAAO,OAAM;AAAA,IACzF,oBAAC,OAAE,WAAU,oDAAoD,iBAAO,MAAK;AAAA,IAC5E;AAAA,IACD,qBAAC,SAAI,WAAU,4CACb;AAAA,0BAAC,UAAO,MAAM,UAAU,SAAQ,SAC7B,iBAAO,MACV;AAAA,MACC,YAAY,UACX,oBAAC,UAAO,MAAM,SAAS,SAAQ,aAC5B,iBAAO,KACV;AAAA,OAEJ;AAAA,KACF;AAEJ;","names":[]}