@fieldia/core 0.26.1 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +307 -3
- package/package.json +1 -1
- package/schema/page.schema.json +227 -23
- package/src/index.d.mts +8 -2
- package/src/index.d.ts +8 -2
- package/src/index.js +22 -1
- package/src/index.js.map +1 -1
- package/src/index.mjs +9 -2
- package/src/index.mjs.map +1 -1
- package/src/lib/expression/app-functions.d.mts +47 -0
- package/src/lib/expression/app-functions.d.ts +47 -0
- package/src/lib/expression/app-functions.js +64 -0
- package/src/lib/expression/app-functions.js.map +1 -0
- package/src/lib/expression/app-functions.mjs +58 -0
- package/src/lib/expression/app-functions.mjs.map +1 -0
- package/src/lib/expression/dates.d.mts +21 -0
- package/src/lib/expression/dates.d.ts +21 -0
- package/src/lib/expression/dates.js +73 -0
- package/src/lib/expression/dates.js.map +1 -0
- package/src/lib/expression/dates.mjs +67 -0
- package/src/lib/expression/dates.mjs.map +1 -0
- package/src/lib/expression/evaluator.js +12 -6
- package/src/lib/expression/evaluator.js.map +1 -1
- package/src/lib/expression/evaluator.mjs +12 -6
- package/src/lib/expression/evaluator.mjs.map +1 -1
- package/src/lib/expression/expression.d.mts +7 -3
- package/src/lib/expression/expression.d.ts +7 -3
- package/src/lib/expression/expression.js +8 -2
- package/src/lib/expression/expression.js.map +1 -1
- package/src/lib/expression/expression.mjs +7 -2
- package/src/lib/expression/expression.mjs.map +1 -1
- package/src/lib/expression/functions-part.d.mts +7 -0
- package/src/lib/expression/functions-part.d.ts +7 -0
- package/src/lib/expression/functions-part.js +13 -0
- package/src/lib/expression/functions-part.js.map +1 -0
- package/src/lib/expression/functions-part.mjs +8 -0
- package/src/lib/expression/functions-part.mjs.map +1 -0
- package/src/lib/expression/functions.d.mts +60 -3
- package/src/lib/expression/functions.d.ts +60 -3
- package/src/lib/expression/functions.js +109 -15
- package/src/lib/expression/functions.js.map +1 -1
- package/src/lib/expression/functions.mjs +103 -16
- package/src/lib/expression/functions.mjs.map +1 -1
- package/src/lib/expression/kinds.d.mts +31 -0
- package/src/lib/expression/kinds.d.ts +31 -0
- package/src/lib/expression/kinds.js +159 -0
- package/src/lib/expression/kinds.js.map +1 -0
- package/src/lib/expression/kinds.mjs +151 -0
- package/src/lib/expression/kinds.mjs.map +1 -0
- package/src/lib/expression/modifier.d.mts +4 -3
- package/src/lib/expression/modifier.d.ts +4 -3
- package/src/lib/expression/modifier.js +4 -3
- package/src/lib/expression/modifier.js.map +1 -1
- package/src/lib/expression/modifier.mjs +4 -3
- package/src/lib/expression/modifier.mjs.map +1 -1
- package/src/lib/expression/more-functions.d.mts +8 -0
- package/src/lib/expression/more-functions.d.ts +8 -0
- package/src/lib/expression/more-functions.js +235 -0
- package/src/lib/expression/more-functions.js.map +1 -0
- package/src/lib/expression/more-functions.mjs +230 -0
- package/src/lib/expression/more-functions.mjs.map +1 -0
- package/src/lib/expression/parser.d.mts +4 -1
- package/src/lib/expression/parser.d.ts +4 -1
- package/src/lib/expression/parser.js +6 -3
- package/src/lib/expression/parser.js.map +1 -1
- package/src/lib/expression/parser.mjs +6 -3
- package/src/lib/expression/parser.mjs.map +1 -1
- package/src/lib/expression/reads.d.mts +2 -2
- package/src/lib/expression/reads.d.ts +2 -2
- package/src/lib/expression/reads.js +6 -4
- package/src/lib/expression/reads.js.map +1 -1
- package/src/lib/expression/reads.mjs +6 -4
- package/src/lib/expression/reads.mjs.map +1 -1
- package/src/lib/format/actions.d.mts +16 -16
- package/src/lib/format/actions.d.ts +16 -16
- package/src/lib/format/check-page.d.mts +7 -2
- package/src/lib/format/check-page.d.ts +7 -2
- package/src/lib/format/check-page.js +10 -4
- package/src/lib/format/check-page.js.map +1 -1
- package/src/lib/format/check-page.mjs +10 -4
- package/src/lib/format/check-page.mjs.map +1 -1
- package/src/lib/format/choice-options.d.mts +34 -0
- package/src/lib/format/choice-options.d.ts +34 -0
- package/src/lib/format/choice-options.js +60 -0
- package/src/lib/format/choice-options.js.map +1 -0
- package/src/lib/format/choice-options.mjs +51 -0
- package/src/lib/format/choice-options.mjs.map +1 -0
- package/src/lib/format/endings-checks.d.mts +8 -0
- package/src/lib/format/endings-checks.d.ts +8 -0
- package/src/lib/format/endings-checks.js +23 -0
- package/src/lib/format/endings-checks.js.map +1 -0
- package/src/lib/format/endings-checks.mjs +20 -0
- package/src/lib/format/endings-checks.mjs.map +1 -0
- package/src/lib/format/endings.d.mts +40 -0
- package/src/lib/format/endings.d.ts +40 -0
- package/src/lib/format/endings.js +15 -0
- package/src/lib/format/endings.js.map +1 -0
- package/src/lib/format/endings.mjs +12 -0
- package/src/lib/format/endings.mjs.map +1 -0
- package/src/lib/format/field.d.mts +151 -16
- package/src/lib/format/field.d.ts +151 -16
- package/src/lib/format/field.js +64 -11
- package/src/lib/format/field.js.map +1 -1
- package/src/lib/format/field.mjs +63 -10
- package/src/lib/format/field.mjs.map +1 -1
- package/src/lib/format/head-checks.d.mts +2 -0
- package/src/lib/format/head-checks.d.ts +2 -0
- package/src/lib/format/head-checks.js +2 -59
- package/src/lib/format/head-checks.js.map +1 -1
- package/src/lib/format/head-checks.mjs +1 -58
- package/src/lib/format/head-checks.mjs.map +1 -1
- package/src/lib/format/later-checks.d.mts +17 -0
- package/src/lib/format/later-checks.d.ts +17 -0
- package/src/lib/format/later-checks.js +20 -0
- package/src/lib/format/later-checks.js.map +1 -0
- package/src/lib/format/later-checks.mjs +17 -0
- package/src/lib/format/later-checks.mjs.map +1 -0
- package/src/lib/format/layout.d.mts +241 -188
- package/src/lib/format/layout.d.ts +241 -188
- package/src/lib/format/layout.js +33 -28
- package/src/lib/format/layout.js.map +1 -1
- package/src/lib/format/layout.mjs +13 -3
- package/src/lib/format/layout.mjs.map +1 -1
- package/src/lib/format/layout.types.d.mts +2 -1
- package/src/lib/format/layout.types.d.ts +2 -1
- package/src/lib/format/limits-checks.d.mts +14 -0
- package/src/lib/format/limits-checks.d.ts +14 -0
- package/src/lib/format/limits-checks.js +36 -0
- package/src/lib/format/limits-checks.js.map +1 -0
- package/src/lib/format/limits-checks.mjs +33 -0
- package/src/lib/format/limits-checks.mjs.map +1 -0
- package/src/lib/format/limits.d.mts +24 -0
- package/src/lib/format/limits.d.ts +24 -0
- package/src/lib/format/limits.js +35 -0
- package/src/lib/format/limits.js.map +1 -0
- package/src/lib/format/limits.mjs +32 -0
- package/src/lib/format/limits.mjs.map +1 -0
- package/src/lib/format/list-checks.d.mts +44 -0
- package/src/lib/format/list-checks.d.ts +44 -0
- package/src/lib/format/list-checks.js +340 -0
- package/src/lib/format/list-checks.js.map +1 -0
- package/src/lib/format/list-checks.mjs +336 -0
- package/src/lib/format/list-checks.mjs.map +1 -0
- package/src/lib/format/map-checks.d.mts +33 -0
- package/src/lib/format/map-checks.d.ts +33 -0
- package/src/lib/format/map-checks.js +180 -0
- package/src/lib/format/map-checks.js.map +1 -0
- package/src/lib/format/map-checks.mjs +175 -0
- package/src/lib/format/map-checks.mjs.map +1 -0
- package/src/lib/format/mapchecks-part.d.mts +5 -0
- package/src/lib/format/mapchecks-part.d.ts +5 -0
- package/src/lib/format/mapchecks-part.js +11 -0
- package/src/lib/format/mapchecks-part.js.map +1 -0
- package/src/lib/format/mapchecks-part.mjs +6 -0
- package/src/lib/format/mapchecks-part.mjs.map +1 -0
- package/src/lib/format/option-checks.d.mts +16 -0
- package/src/lib/format/option-checks.d.ts +16 -0
- package/src/lib/format/option-checks.js +39 -0
- package/src/lib/format/option-checks.js.map +1 -0
- package/src/lib/format/option-checks.mjs +36 -0
- package/src/lib/format/option-checks.mjs.map +1 -0
- package/src/lib/format/options-part.d.mts +6 -0
- package/src/lib/format/options-part.d.ts +6 -0
- package/src/lib/format/options-part.js +11 -0
- package/src/lib/format/options-part.js.map +1 -0
- package/src/lib/format/options-part.mjs +7 -0
- package/src/lib/format/options-part.mjs.map +1 -0
- package/src/lib/format/page.d.mts +147 -71
- package/src/lib/format/page.d.ts +147 -71
- package/src/lib/format/page.js +5 -0
- package/src/lib/format/page.js.map +1 -1
- package/src/lib/format/page.mjs +5 -0
- package/src/lib/format/page.mjs.map +1 -1
- package/src/lib/format/part-checks.d.mts +20 -0
- package/src/lib/format/part-checks.d.ts +20 -0
- package/src/lib/format/part-checks.js +3 -0
- package/src/lib/format/part-checks.js.map +1 -0
- package/src/lib/format/part-checks.mjs +2 -0
- package/src/lib/format/part-checks.mjs.map +1 -0
- package/src/lib/format/references.d.mts +71 -65
- package/src/lib/format/references.d.ts +71 -65
- package/src/lib/format/references.js +194 -631
- package/src/lib/format/references.js.map +1 -1
- package/src/lib/format/references.mjs +194 -631
- package/src/lib/format/references.mjs.map +1 -1
- package/src/lib/format/seats-checks.d.mts +3 -0
- package/src/lib/format/seats-checks.d.ts +3 -0
- package/src/lib/format/seats-checks.js +13 -0
- package/src/lib/format/seats-checks.js.map +1 -0
- package/src/lib/format/seats-checks.mjs +10 -0
- package/src/lib/format/seats-checks.mjs.map +1 -0
- package/src/lib/format/sheet-head-checks.d.mts +4 -0
- package/src/lib/format/sheet-head-checks.d.ts +4 -0
- package/src/lib/format/sheet-head-checks.js +68 -0
- package/src/lib/format/sheet-head-checks.js.map +1 -0
- package/src/lib/format/sheet-head-checks.mjs +65 -0
- package/src/lib/format/sheet-head-checks.mjs.map +1 -0
- package/src/lib/format/signature-checks.d.mts +7 -0
- package/src/lib/format/signature-checks.d.ts +7 -0
- package/src/lib/format/signature-checks.js +32 -0
- package/src/lib/format/signature-checks.js.map +1 -0
- package/src/lib/format/signature-checks.mjs +29 -0
- package/src/lib/format/signature-checks.mjs.map +1 -0
- package/src/lib/format/signature-options.d.mts +24 -0
- package/src/lib/format/signature-options.d.ts +24 -0
- package/src/lib/format/signature-options.js +30 -0
- package/src/lib/format/signature-options.js.map +1 -0
- package/src/lib/format/signature-options.mjs +26 -0
- package/src/lib/format/signature-options.mjs.map +1 -0
- package/src/lib/format/slots-checks.d.mts +4 -0
- package/src/lib/format/slots-checks.d.ts +4 -0
- package/src/lib/format/slots-checks.js +21 -0
- package/src/lib/format/slots-checks.js.map +1 -0
- package/src/lib/format/slots-checks.mjs +18 -0
- package/src/lib/format/slots-checks.mjs.map +1 -0
- package/src/lib/format/statusbar-checks.d.mts +8 -0
- package/src/lib/format/statusbar-checks.d.ts +8 -0
- package/src/lib/format/statusbar-checks.js +35 -0
- package/src/lib/format/statusbar-checks.js.map +1 -0
- package/src/lib/format/statusbar-checks.mjs +32 -0
- package/src/lib/format/statusbar-checks.mjs.map +1 -0
- package/src/lib/format/table-checks.d.mts +21 -0
- package/src/lib/format/table-checks.d.ts +21 -0
- package/src/lib/format/table-checks.js +86 -0
- package/src/lib/format/table-checks.js.map +1 -0
- package/src/lib/format/table-checks.mjs +82 -0
- package/src/lib/format/table-checks.mjs.map +1 -0
- package/src/lib/format/translate.js +2 -2
- package/src/lib/format/translate.js.map +1 -1
- package/src/lib/format/translate.mjs +2 -2
- package/src/lib/format/translate.mjs.map +1 -1
- package/src/lib/format/upgrade.d.mts +6 -3
- package/src/lib/format/upgrade.d.ts +6 -3
- package/src/lib/format/upgrade.js +6 -3
- package/src/lib/format/upgrade.js.map +1 -1
- package/src/lib/format/upgrade.mjs +6 -3
- package/src/lib/format/upgrade.mjs.map +1 -1
- package/src/lib/format/validate.d.mts +18 -2
- package/src/lib/format/validate.d.ts +18 -2
- package/src/lib/format/validate.js +36 -3
- package/src/lib/format/validate.js.map +1 -1
- package/src/lib/format/validate.mjs +35 -3
- package/src/lib/format/validate.mjs.map +1 -1
- package/src/lib/format/version.d.mts +2 -2
- package/src/lib/format/version.d.ts +2 -2
- package/src/lib/format/version.js +2 -2
- package/src/lib/format/version.js.map +1 -1
- package/src/lib/format/version.mjs +2 -2
- package/src/lib/format/version.mjs.map +1 -1
- package/src/lib/format/words.d.mts +6 -2
- package/src/lib/format/words.d.ts +6 -2
- package/src/lib/format/words.js +13 -7
- package/src/lib/format/words.js.map +1 -1
- package/src/lib/format/words.mjs +13 -7
- package/src/lib/format/words.mjs.map +1 -1
- package/src/lib/parts.d.mts +45 -0
- package/src/lib/parts.d.ts +45 -0
- package/src/lib/parts.js +60 -0
- package/src/lib/parts.js.map +1 -0
- package/src/lib/parts.mjs +53 -0
- package/src/lib/parts.mjs.map +1 -0
- package/src/lib/record/cells.d.mts +3 -3
- package/src/lib/record/cells.d.ts +3 -3
- package/src/lib/record/cells.js +16 -15
- package/src/lib/record/cells.js.map +1 -1
- package/src/lib/record/cells.mjs +16 -15
- package/src/lib/record/cells.mjs.map +1 -1
- package/src/lib/record/compute.d.mts +16 -5
- package/src/lib/record/compute.d.ts +16 -5
- package/src/lib/record/compute.js +57 -16
- package/src/lib/record/compute.js.map +1 -1
- package/src/lib/record/compute.mjs +57 -16
- package/src/lib/record/compute.mjs.map +1 -1
- package/src/lib/record/data-source.d.mts +140 -3
- package/src/lib/record/data-source.d.ts +140 -3
- package/src/lib/record/data-source.js.map +1 -1
- package/src/lib/record/data-source.mjs.map +1 -1
- package/src/lib/record/drafts.d.mts +19 -0
- package/src/lib/record/drafts.d.ts +19 -0
- package/src/lib/record/drafts.js +35 -0
- package/src/lib/record/drafts.js.map +1 -0
- package/src/lib/record/drafts.mjs +31 -0
- package/src/lib/record/drafts.mjs.map +1 -0
- package/src/lib/record/env.d.mts +5 -1
- package/src/lib/record/env.d.ts +5 -1
- package/src/lib/record/env.js +9 -1
- package/src/lib/record/env.js.map +1 -1
- package/src/lib/record/env.mjs +8 -1
- package/src/lib/record/env.mjs.map +1 -1
- package/src/lib/record/form-limits.d.mts +81 -0
- package/src/lib/record/form-limits.d.ts +81 -0
- package/src/lib/record/form-limits.js +231 -0
- package/src/lib/record/form-limits.js.map +1 -0
- package/src/lib/record/form-limits.mjs +224 -0
- package/src/lib/record/form-limits.mjs.map +1 -0
- package/src/lib/record/form.d.mts +173 -4
- package/src/lib/record/form.d.ts +173 -4
- package/src/lib/record/form.js +792 -88
- package/src/lib/record/form.js.map +1 -1
- package/src/lib/record/form.mjs +792 -88
- package/src/lib/record/form.mjs.map +1 -1
- package/src/lib/record/limits-part.d.mts +6 -0
- package/src/lib/record/limits-part.d.ts +6 -0
- package/src/lib/record/limits-part.js +12 -0
- package/src/lib/record/limits-part.js.map +1 -0
- package/src/lib/record/limits-part.mjs +7 -0
- package/src/lib/record/limits-part.mjs.map +1 -0
- package/src/lib/record/line-choices.d.mts +30 -0
- package/src/lib/record/line-choices.d.ts +30 -0
- package/src/lib/record/line-choices.js +42 -0
- package/src/lib/record/line-choices.js.map +1 -0
- package/src/lib/record/line-choices.mjs +36 -0
- package/src/lib/record/line-choices.mjs.map +1 -0
- package/src/lib/record/locales/ar.js +10 -0
- package/src/lib/record/locales/ar.js.map +1 -1
- package/src/lib/record/locales/ar.mjs +10 -0
- package/src/lib/record/locales/ar.mjs.map +1 -1
- package/src/lib/record/locales/de.js +10 -0
- package/src/lib/record/locales/de.js.map +1 -1
- package/src/lib/record/locales/de.mjs +10 -0
- package/src/lib/record/locales/de.mjs.map +1 -1
- package/src/lib/record/locales/fr.js +10 -0
- package/src/lib/record/locales/fr.js.map +1 -1
- package/src/lib/record/locales/fr.mjs +10 -0
- package/src/lib/record/locales/fr.mjs.map +1 -1
- package/src/lib/record/memory-data-source.d.mts +44 -3
- package/src/lib/record/memory-data-source.d.ts +44 -3
- package/src/lib/record/memory-data-source.js +102 -40
- package/src/lib/record/memory-data-source.js.map +1 -1
- package/src/lib/record/memory-data-source.mjs +101 -40
- package/src/lib/record/memory-data-source.mjs.map +1 -1
- package/src/lib/record/memory-kept.d.mts +20 -0
- package/src/lib/record/memory-kept.d.ts +20 -0
- package/src/lib/record/memory-kept.js +46 -0
- package/src/lib/record/memory-kept.js.map +1 -0
- package/src/lib/record/memory-kept.mjs +43 -0
- package/src/lib/record/memory-kept.mjs.map +1 -0
- package/src/lib/record/memory-later.d.mts +19 -0
- package/src/lib/record/memory-later.d.ts +19 -0
- package/src/lib/record/memory-later.js +39 -0
- package/src/lib/record/memory-later.js.map +1 -0
- package/src/lib/record/memory-later.mjs +35 -0
- package/src/lib/record/memory-later.mjs.map +1 -0
- package/src/lib/record/memory-part.d.mts +7 -0
- package/src/lib/record/memory-part.d.ts +7 -0
- package/src/lib/record/memory-part.js +13 -0
- package/src/lib/record/memory-part.js.map +1 -0
- package/src/lib/record/memory-part.mjs +8 -0
- package/src/lib/record/memory-part.mjs.map +1 -0
- package/src/lib/record/messages.d.mts +17 -0
- package/src/lib/record/messages.d.ts +17 -0
- package/src/lib/record/messages.js +10 -0
- package/src/lib/record/messages.js.map +1 -1
- package/src/lib/record/messages.mjs +10 -0
- package/src/lib/record/messages.mjs.map +1 -1
- package/src/lib/record/option-rules.d.mts +50 -0
- package/src/lib/record/option-rules.d.ts +50 -0
- package/src/lib/record/option-rules.js +137 -0
- package/src/lib/record/option-rules.js.map +1 -0
- package/src/lib/record/option-rules.mjs +134 -0
- package/src/lib/record/option-rules.mjs.map +1 -0
- package/src/lib/record/rules.d.mts +2 -2
- package/src/lib/record/rules.d.ts +2 -2
- package/src/lib/record/rules.js +3 -3
- package/src/lib/record/rules.js.map +1 -1
- package/src/lib/record/rules.mjs +3 -3
- package/src/lib/record/rules.mjs.map +1 -1
- package/src/lib/record/run.js +9 -7
- package/src/lib/record/run.js.map +1 -1
- package/src/lib/record/run.mjs +9 -7
- package/src/lib/record/run.mjs.map +1 -1
- package/src/lib/record/search.d.mts +12 -2
- package/src/lib/record/search.d.ts +12 -2
- package/src/lib/record/search.js +29 -4
- package/src/lib/record/search.js.map +1 -1
- package/src/lib/record/search.mjs +29 -4
- package/src/lib/record/search.mjs.map +1 -1
- package/src/lib/record/set-when.d.mts +3 -3
- package/src/lib/record/set-when.d.ts +3 -3
- package/src/lib/record/set-when.js +9 -9
- package/src/lib/record/set-when.js.map +1 -1
- package/src/lib/record/set-when.mjs +9 -9
- package/src/lib/record/set-when.mjs.map +1 -1
- package/src/lib/record/signed.d.mts +21 -0
- package/src/lib/record/signed.d.ts +21 -0
- package/src/lib/record/signed.js +62 -0
- package/src/lib/record/signed.js.map +1 -0
- package/src/lib/record/signed.mjs +57 -0
- package/src/lib/record/signed.mjs.map +1 -0
- package/src/lib/record/taking.d.mts +60 -0
- package/src/lib/record/taking.d.ts +60 -0
- package/src/lib/record/taking.js +58 -0
- package/src/lib/record/taking.js.map +1 -0
- package/src/lib/record/taking.mjs +50 -0
- package/src/lib/record/taking.mjs.map +1 -0
- package/src/lib/record/value-map.js +11 -4
- package/src/lib/record/value-map.js.map +1 -1
- package/src/lib/record/value-map.mjs +11 -4
- package/src/lib/record/value-map.mjs.map +1 -1
- package/src/lib/record/values.d.mts +20 -0
- package/src/lib/record/values.d.ts +20 -0
- package/src/lib/record/values.js.map +1 -1
- package/src/lib/record/values.mjs.map +1 -1
- package/src/lib/record/waits.d.mts +6 -1
- package/src/lib/record/waits.d.ts +6 -1
- package/src/lib/record/waits.js +2 -2
- package/src/lib/record/waits.js.map +1 -1
- package/src/lib/record/waits.mjs +2 -2
- package/src/lib/record/waits.mjs.map +1 -1
- package/src/runtime.d.mts +16 -5
- package/src/runtime.d.ts +16 -5
- package/src/runtime.js +41 -3
- package/src/runtime.js.map +1 -1
- package/src/runtime.mjs +13 -0
- package/src/runtime.mjs.map +1 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.draftRead = draftRead;
|
|
4
|
+
exports.resumeStep = resumeStep;
|
|
5
|
+
/** A draft read back from the browser's store, of this Fieldia or an older one (answers alone); null for none, or words that are none. */
|
|
6
|
+
function draftRead(raw) {
|
|
7
|
+
if (!raw)
|
|
8
|
+
return null;
|
|
9
|
+
try {
|
|
10
|
+
const read = JSON.parse(raw);
|
|
11
|
+
if (!read || typeof read !== 'object' || typeof read['savedAt'] !== 'string')
|
|
12
|
+
return null;
|
|
13
|
+
if (typeof read['key'] === 'string')
|
|
14
|
+
return { savedAt: read['savedAt'], key: read['key'] };
|
|
15
|
+
return read['values'] && typeof read['values'] === 'object' && !Array.isArray(read['values']) ? read : null;
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The step a draft opens at: its own where it applies still, else the nearest before it that does — never one after
|
|
23
|
+
* it, whose questions were not reached — and the first that applies for a draft that names none (or one the page
|
|
24
|
+
* no longer has). Null for a page with no steps.
|
|
25
|
+
*/
|
|
26
|
+
function resumeStep(steps, applies, step) {
|
|
27
|
+
if (!steps.length)
|
|
28
|
+
return null;
|
|
29
|
+
const at = step ? steps.indexOf(step) : -1;
|
|
30
|
+
for (let i = at; i >= 0; i--)
|
|
31
|
+
if (applies.includes(steps[i]))
|
|
32
|
+
return steps[i];
|
|
33
|
+
return applies[0] ?? steps[0];
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=drafts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drafts.js","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/record/drafts.ts"],"names":[],"mappings":";;AAYA,8BAUC;AAOD,gCAKC;AAvBD,0IAA0I;AAC1I,SAAgB,SAAS,CAAC,GAAkB;IAC1C,IAAI,CAAC,GAAG;QAAE,OAAO,IAAI,CAAC;IACtB,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAmC,CAAC;QAC/D,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAC;QAC1F,IAAI,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,QAAQ;YAAE,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3F,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAE,IAA+B,CAAC,CAAC,CAAC,IAAI,CAAC;IAC1I,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,SAAgB,UAAU,CAAC,KAAwB,EAAE,OAA0B,EAAE,IAA+B;IAC9G,IAAI,CAAC,KAAK,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAC/B,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,KAAK,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;QAAE,IAAI,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;IAC9E,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** A draft read back from the browser's store, of this Fieldia or an older one (answers alone); null for none, or words that are none. */
|
|
2
|
+
export function draftRead(raw) {
|
|
3
|
+
if (!raw)
|
|
4
|
+
return null;
|
|
5
|
+
try {
|
|
6
|
+
const read = JSON.parse(raw);
|
|
7
|
+
if (!read || typeof read !== 'object' || typeof read['savedAt'] !== 'string')
|
|
8
|
+
return null;
|
|
9
|
+
if (typeof read['key'] === 'string')
|
|
10
|
+
return { savedAt: read['savedAt'], key: read['key'] };
|
|
11
|
+
return read['values'] && typeof read['values'] === 'object' && !Array.isArray(read['values']) ? read : null;
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The step a draft opens at: its own where it applies still, else the nearest before it that does — never one after
|
|
19
|
+
* it, whose questions were not reached — and the first that applies for a draft that names none (or one the page
|
|
20
|
+
* no longer has). Null for a page with no steps.
|
|
21
|
+
*/
|
|
22
|
+
export function resumeStep(steps, applies, step) {
|
|
23
|
+
if (!steps.length)
|
|
24
|
+
return null;
|
|
25
|
+
const at = step ? steps.indexOf(step) : -1;
|
|
26
|
+
for (let i = at; i >= 0; i--)
|
|
27
|
+
if (applies.includes(steps[i]))
|
|
28
|
+
return steps[i];
|
|
29
|
+
return applies[0] ?? steps[0];
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=drafts.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drafts.mjs","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/record/drafts.ts"],"names":[],"mappings":"AAWA,0IAA0I;AAC1I,MAAM,UAAU,SAAS,CAAC,GAAkB;IAC1C,IAAI,CAAC,GAAG;QAAE,OAAO,IAAI,CAAC;IACtB,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAmC,CAAC;QAC/D,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAC;QAC1F,IAAI,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,QAAQ;YAAE,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3F,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAE,IAA+B,CAAC,CAAC,CAAC,IAAI,CAAC;IAC1I,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,KAAwB,EAAE,OAA0B,EAAE,IAA+B;IAC9G,IAAI,CAAC,KAAK,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAC/B,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,KAAK,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;QAAE,IAAI,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;IAC9E,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;AAChC,CAAC"}
|
package/src/lib/record/env.d.mts
CHANGED
|
@@ -43,4 +43,8 @@ export declare function recordContext(values: Values, fields: Record<string, Fie
|
|
|
43
43
|
* same name comes first.
|
|
44
44
|
*/
|
|
45
45
|
export declare function lineContext(values: Values, fields: Record<string, LineField>, parent: Record<string, unknown>, id?: RecordId | null): Record<string, unknown>;
|
|
46
|
-
|
|
46
|
+
/** What a form hands every expression of the app's own: its functions, and the answers of those that ask (`ExpressionEnv`). */
|
|
47
|
+
export type AppReads = Pick<ExpressionEnv, 'functions' | 'answer'>;
|
|
48
|
+
/** The name of the record a link field holds: a currency's "EGP". */
|
|
49
|
+
export declare function nameIn(values: Values, field: string): string | undefined;
|
|
50
|
+
export declare function expressionEnv(values: Values, fields: Record<string, Field | LineField>, today: () => string, app?: AppReads): ExpressionEnv;
|
package/src/lib/record/env.d.ts
CHANGED
|
@@ -43,4 +43,8 @@ export declare function recordContext(values: Values, fields: Record<string, Fie
|
|
|
43
43
|
* same name comes first.
|
|
44
44
|
*/
|
|
45
45
|
export declare function lineContext(values: Values, fields: Record<string, LineField>, parent: Record<string, unknown>, id?: RecordId | null): Record<string, unknown>;
|
|
46
|
-
|
|
46
|
+
/** What a form hands every expression of the app's own: its functions, and the answers of those that ask (`ExpressionEnv`). */
|
|
47
|
+
export type AppReads = Pick<ExpressionEnv, 'functions' | 'answer'>;
|
|
48
|
+
/** The name of the record a link field holds: a currency's "EGP". */
|
|
49
|
+
export declare function nameIn(values: Values, field: string): string | undefined;
|
|
50
|
+
export declare function expressionEnv(values: Values, fields: Record<string, Field | LineField>, today: () => string, app?: AppReads): ExpressionEnv;
|
package/src/lib/record/env.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.builtIns = builtIns;
|
|
4
4
|
exports.recordContext = recordContext;
|
|
5
5
|
exports.lineContext = lineContext;
|
|
6
|
+
exports.nameIn = nameIn;
|
|
6
7
|
exports.expressionEnv = expressionEnv;
|
|
7
8
|
const values_1 = require("./values");
|
|
8
9
|
/**
|
|
@@ -45,10 +46,17 @@ function lineContext(values, fields, parent, id = null) {
|
|
|
45
46
|
delete names[name];
|
|
46
47
|
return { ...names, ...(0, values_1.expressionContext)(values, fields) };
|
|
47
48
|
}
|
|
48
|
-
|
|
49
|
+
/** The name of the record a link field holds: a currency's "EGP". */
|
|
50
|
+
function nameIn(values, field) {
|
|
51
|
+
const value = values[field];
|
|
52
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value) && typeof value.label === 'string' ? value.label : undefined;
|
|
53
|
+
}
|
|
54
|
+
function expressionEnv(values, fields, today, app = {}) {
|
|
49
55
|
const rows = new Map();
|
|
50
56
|
return {
|
|
57
|
+
...app,
|
|
51
58
|
today,
|
|
59
|
+
nameOf: (field) => nameIn(values, field),
|
|
52
60
|
lines(name) {
|
|
53
61
|
const def = fields[name];
|
|
54
62
|
if (def?.type !== 'one2many')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/record/env.ts"],"names":[],"mappings":";;AAaA,4BAkBC;AAoBD,sCAEC;AAOD,kCAMC;AAED,
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/record/env.ts"],"names":[],"mappings":";;AAaA,4BAkBC;AAoBD,sCAEC;AAOD,kCAMC;AAMD,wBAGC;AAED,sCAkBC;AA5FD,qCAA8F;AAE9F;;;;;;;GAOG;AACH,SAAgB,QAAQ,CACtB,MAA+B,EAC/B,QAAyB,EACzB,IAAmF,EACnF,OAAO,GAAG,IAAI,EACd,UAA+C,EAAE,EACjD,MAAgC;IAEhC,MAAM,KAAK,GAA4B;QACrC,EAAE,EAAE,QAAQ,IAAI,IAAI;QACpB,IAAI,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,IAAI,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,EAAE;QACzF,OAAO;QACP,OAAO;QACP,qEAAqE;QACrE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC9B,CAAC;IACF,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,IAAI,IAAI,IAAI,MAAM;YAAE,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC;IAC9E,OAAO,KAAK,CAAC;AACf,CAAC;AAmBD,yGAAyG;AACzG,SAAgB,aAAa,CAAC,MAAc,EAAE,MAAyC,EAAE,KAAY;IACnG,OAAO,EAAE,GAAG,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,G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E,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;QACxC,KAAK,CAAC,IAAI;YACR,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;YACzB,IAAI,GAAG,EAAE,IAAI,KAAK,UAAU;gBAAE,OAAO,SAAS,CAAC;YAC/C,IAAI,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC3B,IAAI,CAAC,KAAK,EAAE,CAAC;gBACX,MAAM,KAAK,GAAG,CAAE,MAAM,CAAC,IAAI,CAAmB,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,iBAAQ,EAAC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,CAAC;gBAC5G,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,0BAAiB,EAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;gBACxE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YACxB,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/src/lib/record/env.mjs
CHANGED
|
@@ -39,10 +39,17 @@ export function lineContext(values, fields, parent, id = null) {
|
|
|
39
39
|
delete names[name];
|
|
40
40
|
return { ...names, ...expressionContext(values, fields) };
|
|
41
41
|
}
|
|
42
|
-
|
|
42
|
+
/** The name of the record a link field holds: a currency's "EGP". */
|
|
43
|
+
export function nameIn(values, field) {
|
|
44
|
+
const value = values[field];
|
|
45
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value) && typeof value.label === 'string' ? value.label : undefined;
|
|
46
|
+
}
|
|
47
|
+
export function expressionEnv(values, fields, today, app = {}) {
|
|
43
48
|
const rows = new Map();
|
|
44
49
|
return {
|
|
50
|
+
...app,
|
|
45
51
|
today,
|
|
52
|
+
nameOf: (field) => nameIn(values, field),
|
|
46
53
|
lines(name) {
|
|
47
54
|
const def = fields[name];
|
|
48
55
|
if (def?.type !== 'one2many')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.mjs","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/record/env.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAyC,MAAM,UAAU,CAAC;AAE9F;;;;;;;GAOG;AACH,MAAM,UAAU,QAAQ,CACtB,MAA+B,EAC/B,QAAyB,EACzB,IAAmF,EACnF,OAAO,GAAG,IAAI,EACd,UAA+C,EAAE,EACjD,MAAgC;IAEhC,MAAM,KAAK,GAA4B;QACrC,EAAE,EAAE,QAAQ,IAAI,IAAI;QACpB,IAAI,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,IAAI,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,EAAE;QACzF,OAAO;QACP,OAAO;QACP,qEAAqE;QACrE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC9B,CAAC;IACF,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,IAAI,IAAI,IAAI,MAAM;YAAE,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC;IAC9E,OAAO,KAAK,CAAC;AACf,CAAC;AAmBD,yGAAyG;AACzG,MAAM,UAAU,aAAa,CAAC,MAAc,EAAE,MAAyC,EAAE,KAAY;IACnG,OAAO,EAAE,GAAG,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAA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,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;gBACxE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YACxB,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { Option } from '../format/field.mjs';
|
|
2
|
+
import type { Page } from '../format/page.mjs';
|
|
3
|
+
import type { DataSource, LimitsResult } from './data-source.mjs';
|
|
4
|
+
import type { FormState, FormUser } from './form.mjs';
|
|
5
|
+
import { type Messages } from './messages.mjs';
|
|
6
|
+
import type { Stopped } from './run.mjs';
|
|
7
|
+
import type { Scheduler } from './scheduler.mjs';
|
|
8
|
+
import { type FormLimits, type Seats } from './taking.mjs';
|
|
9
|
+
import type { Value } from './values.mjs';
|
|
10
|
+
/**
|
|
11
|
+
* A form's limits (the limits part): when the page takes answers and each choice's places, worked out from the page,
|
|
12
|
+
* the form's clock and the data source's counts — asked as it opens, again before its answers go and after — a full
|
|
13
|
+
* choice refused when picked or held. A form on a page with `limits` or options with `seats` (or an app's list whose
|
|
14
|
+
* options come with them) makes this from the part as it comes (form.ts, `limitsCode`); before, it takes answers as a
|
|
15
|
+
* page without limits does, and a save waits for it.
|
|
16
|
+
*/
|
|
17
|
+
/** What the limits ask of the form they are made for. */
|
|
18
|
+
export interface LimitsHost {
|
|
19
|
+
readonly page: Page;
|
|
20
|
+
readonly dataSource: DataSource | undefined;
|
|
21
|
+
readonly user: FormUser | undefined;
|
|
22
|
+
readonly messages: Messages;
|
|
23
|
+
readonly scheduler: Scheduler;
|
|
24
|
+
state(): FormState;
|
|
25
|
+
set(patch: Partial<FormState>): void;
|
|
26
|
+
/** Now, in ms, by the form's clock. */
|
|
27
|
+
clock(): number;
|
|
28
|
+
/** Whether the form has its state yet: a list's choices are read from it once it has. */
|
|
29
|
+
started(): boolean;
|
|
30
|
+
/** Whether what is asked now still lands on the record shown, when it answers. */
|
|
31
|
+
shownNow(): () => boolean;
|
|
32
|
+
/** The record shown's generation: another shown since a save started, it is told so. */
|
|
33
|
+
generation(): number;
|
|
34
|
+
/** The words a save says when another record was shown since it started. */
|
|
35
|
+
replaced(): string;
|
|
36
|
+
/** Whether something listens to the form: a page left open is told as it opens or closes then. */
|
|
37
|
+
listened(): boolean;
|
|
38
|
+
disposed(): boolean;
|
|
39
|
+
/** Words said under a field until it changes from what it holds, as a refused save's are. */
|
|
40
|
+
refuse(name: string, message: string): void;
|
|
41
|
+
}
|
|
42
|
+
/** A form's limits, made for it (`formLimits`). */
|
|
43
|
+
export interface Limits {
|
|
44
|
+
/** The limits shown as they are now, and the next moment they change of themselves awaited. */
|
|
45
|
+
show(): void;
|
|
46
|
+
/** Ask the source's `limits` again and show what it tells, on the record it was asked for. */
|
|
47
|
+
ask(): Promise<void>;
|
|
48
|
+
/** Whether the form asks the source for counts: a source that tells them, and something to count. */
|
|
49
|
+
asks(): boolean;
|
|
50
|
+
/** Whether the counts of a choice of an app's list whose options came with places were never told. */
|
|
51
|
+
uncounted(name: string): boolean;
|
|
52
|
+
/** Whether the page takes these answers now, asked of the source again: why not, as a save's problem, or null. */
|
|
53
|
+
stillTaking(asked: number): Promise<Stopped | null>;
|
|
54
|
+
/** A choice of a full option, picked by the person, refused under its field: the field keeps what it held. */
|
|
55
|
+
refusedFull(name: string, value: Value): boolean;
|
|
56
|
+
/** A choice held whose places filled up since it was picked, said under it: never sent. */
|
|
57
|
+
fullErrors(seen: ReadonlySet<string>, errors: Readonly<Record<string, string>>): Record<string, string>;
|
|
58
|
+
/** Something listens now, or no longer does: the timer for the page opening or closing kept, or let go. */
|
|
59
|
+
heard(listening: boolean): void;
|
|
60
|
+
dispose(): void;
|
|
61
|
+
}
|
|
62
|
+
/** What a form tells of its limits now: from the page, the clock, the options it shows and the source's last answer. */
|
|
63
|
+
export declare function limitsNow(page: Page, now: number, told: LimitsResult | null, asking: boolean, optionsOf: (field: string) => readonly Option[]): FormLimits | null;
|
|
64
|
+
/**
|
|
65
|
+
* The options of a choice's value that are full now, in the order they are held: those `before` held too left out
|
|
66
|
+
* when given — a choice made now, not one held already.
|
|
67
|
+
*/
|
|
68
|
+
export declare function fullChosen(field: Page['fields'][string] | undefined, places: Readonly<Record<string, Seats>> | undefined, value: Value | undefined, before?: Value | undefined): Option[];
|
|
69
|
+
/** A form's limits: what it tells of them, and what it asks and refuses by them. */
|
|
70
|
+
export declare function formLimits(host: LimitsHost): Limits;
|
|
71
|
+
/**
|
|
72
|
+
* A day or a day and a time in words, in the messages' language, on the page's clock: "20 November 2026", "1 November
|
|
73
|
+
* 2026 at 09:00" — with the zone's short name where it is not the browser's own ("09:00 GMT+2").
|
|
74
|
+
*/
|
|
75
|
+
export declare function whenWords(written: string, at: number, messages: Messages, zone?: string): string;
|
|
76
|
+
/**
|
|
77
|
+
* Why a page takes no answers now, in the messages' words — "This form opens on 1 November 2026 at 09:00.", "This form
|
|
78
|
+
* closed on 20 November 2026.", "This form has all the responses it takes.", "You have sent your answers to this form
|
|
79
|
+
* already." — or null while it takes them (or still asks).
|
|
80
|
+
*/
|
|
81
|
+
export declare function takingWords(page: Page, limits: FormLimits | null | undefined, messages: Messages): string | null;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { Option } from '../format/field';
|
|
2
|
+
import type { Page } from '../format/page';
|
|
3
|
+
import type { DataSource, LimitsResult } from './data-source';
|
|
4
|
+
import type { FormState, FormUser } from './form';
|
|
5
|
+
import { type Messages } from './messages';
|
|
6
|
+
import type { Stopped } from './run';
|
|
7
|
+
import type { Scheduler } from './scheduler';
|
|
8
|
+
import { type FormLimits, type Seats } from './taking';
|
|
9
|
+
import type { Value } from './values';
|
|
10
|
+
/**
|
|
11
|
+
* A form's limits (the limits part): when the page takes answers and each choice's places, worked out from the page,
|
|
12
|
+
* the form's clock and the data source's counts — asked as it opens, again before its answers go and after — a full
|
|
13
|
+
* choice refused when picked or held. A form on a page with `limits` or options with `seats` (or an app's list whose
|
|
14
|
+
* options come with them) makes this from the part as it comes (form.ts, `limitsCode`); before, it takes answers as a
|
|
15
|
+
* page without limits does, and a save waits for it.
|
|
16
|
+
*/
|
|
17
|
+
/** What the limits ask of the form they are made for. */
|
|
18
|
+
export interface LimitsHost {
|
|
19
|
+
readonly page: Page;
|
|
20
|
+
readonly dataSource: DataSource | undefined;
|
|
21
|
+
readonly user: FormUser | undefined;
|
|
22
|
+
readonly messages: Messages;
|
|
23
|
+
readonly scheduler: Scheduler;
|
|
24
|
+
state(): FormState;
|
|
25
|
+
set(patch: Partial<FormState>): void;
|
|
26
|
+
/** Now, in ms, by the form's clock. */
|
|
27
|
+
clock(): number;
|
|
28
|
+
/** Whether the form has its state yet: a list's choices are read from it once it has. */
|
|
29
|
+
started(): boolean;
|
|
30
|
+
/** Whether what is asked now still lands on the record shown, when it answers. */
|
|
31
|
+
shownNow(): () => boolean;
|
|
32
|
+
/** The record shown's generation: another shown since a save started, it is told so. */
|
|
33
|
+
generation(): number;
|
|
34
|
+
/** The words a save says when another record was shown since it started. */
|
|
35
|
+
replaced(): string;
|
|
36
|
+
/** Whether something listens to the form: a page left open is told as it opens or closes then. */
|
|
37
|
+
listened(): boolean;
|
|
38
|
+
disposed(): boolean;
|
|
39
|
+
/** Words said under a field until it changes from what it holds, as a refused save's are. */
|
|
40
|
+
refuse(name: string, message: string): void;
|
|
41
|
+
}
|
|
42
|
+
/** A form's limits, made for it (`formLimits`). */
|
|
43
|
+
export interface Limits {
|
|
44
|
+
/** The limits shown as they are now, and the next moment they change of themselves awaited. */
|
|
45
|
+
show(): void;
|
|
46
|
+
/** Ask the source's `limits` again and show what it tells, on the record it was asked for. */
|
|
47
|
+
ask(): Promise<void>;
|
|
48
|
+
/** Whether the form asks the source for counts: a source that tells them, and something to count. */
|
|
49
|
+
asks(): boolean;
|
|
50
|
+
/** Whether the counts of a choice of an app's list whose options came with places were never told. */
|
|
51
|
+
uncounted(name: string): boolean;
|
|
52
|
+
/** Whether the page takes these answers now, asked of the source again: why not, as a save's problem, or null. */
|
|
53
|
+
stillTaking(asked: number): Promise<Stopped | null>;
|
|
54
|
+
/** A choice of a full option, picked by the person, refused under its field: the field keeps what it held. */
|
|
55
|
+
refusedFull(name: string, value: Value): boolean;
|
|
56
|
+
/** A choice held whose places filled up since it was picked, said under it: never sent. */
|
|
57
|
+
fullErrors(seen: ReadonlySet<string>, errors: Readonly<Record<string, string>>): Record<string, string>;
|
|
58
|
+
/** Something listens now, or no longer does: the timer for the page opening or closing kept, or let go. */
|
|
59
|
+
heard(listening: boolean): void;
|
|
60
|
+
dispose(): void;
|
|
61
|
+
}
|
|
62
|
+
/** What a form tells of its limits now: from the page, the clock, the options it shows and the source's last answer. */
|
|
63
|
+
export declare function limitsNow(page: Page, now: number, told: LimitsResult | null, asking: boolean, optionsOf: (field: string) => readonly Option[]): FormLimits | null;
|
|
64
|
+
/**
|
|
65
|
+
* The options of a choice's value that are full now, in the order they are held: those `before` held too left out
|
|
66
|
+
* when given — a choice made now, not one held already.
|
|
67
|
+
*/
|
|
68
|
+
export declare function fullChosen(field: Page['fields'][string] | undefined, places: Readonly<Record<string, Seats>> | undefined, value: Value | undefined, before?: Value | undefined): Option[];
|
|
69
|
+
/** A form's limits: what it tells of them, and what it asks and refuses by them. */
|
|
70
|
+
export declare function formLimits(host: LimitsHost): Limits;
|
|
71
|
+
/**
|
|
72
|
+
* A day or a day and a time in words, in the messages' language, on the page's clock: "20 November 2026", "1 November
|
|
73
|
+
* 2026 at 09:00" — with the zone's short name where it is not the browser's own ("09:00 GMT+2").
|
|
74
|
+
*/
|
|
75
|
+
export declare function whenWords(written: string, at: number, messages: Messages, zone?: string): string;
|
|
76
|
+
/**
|
|
77
|
+
* Why a page takes no answers now, in the messages' words — "This form opens on 1 November 2026 at 09:00.", "This form
|
|
78
|
+
* closed on 20 November 2026.", "This form has all the responses it takes.", "You have sent your answers to this form
|
|
79
|
+
* already." — or null while it takes them (or still asks).
|
|
80
|
+
*/
|
|
81
|
+
export declare function takingWords(page: Page, limits: FormLimits | null | undefined, messages: Messages): string | null;
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.limitsNow = limitsNow;
|
|
4
|
+
exports.fullChosen = fullChosen;
|
|
5
|
+
exports.formLimits = formLimits;
|
|
6
|
+
exports.whenWords = whenWords;
|
|
7
|
+
exports.takingWords = takingWords;
|
|
8
|
+
const choice_options_1 = require("../format/choice-options");
|
|
9
|
+
const messages_1 = require("./messages");
|
|
10
|
+
const taking_1 = require("./taking");
|
|
11
|
+
const zones_1 = require("./zones");
|
|
12
|
+
/** What a form tells of its limits now: from the page, the clock, the options it shows and the source's last answer. */
|
|
13
|
+
function limitsNow(page, now, told, asking, optionsOf) {
|
|
14
|
+
const limits = page.data.kind === 'responses' ? page.limits : undefined;
|
|
15
|
+
const seats = {};
|
|
16
|
+
for (const [field, counted] of Object.entries(told?.perChoice ?? {})) {
|
|
17
|
+
const places = {};
|
|
18
|
+
for (const option of optionsOf(field)) {
|
|
19
|
+
if (option.seats === undefined)
|
|
20
|
+
continue;
|
|
21
|
+
const taken = Math.max(0, Number(counted?.[String(option.value)] ?? 0) || 0);
|
|
22
|
+
places[String(option.value)] = { seats: option.seats, taken, left: Math.max(0, option.seats - taken) };
|
|
23
|
+
}
|
|
24
|
+
if (Object.keys(places).length)
|
|
25
|
+
seats[field] = places;
|
|
26
|
+
}
|
|
27
|
+
if (!limits && !Object.keys(seats).length)
|
|
28
|
+
return null;
|
|
29
|
+
const opens = limits?.opens ? (0, taking_1.limitInstant)(limits.opens, page.timeZone) : null;
|
|
30
|
+
const closes = limits?.closes ? (0, taking_1.limitInstant)(limits.closes, page.timeZone, true) : null;
|
|
31
|
+
const max = limits?.maxResponses;
|
|
32
|
+
const responses = told?.responses;
|
|
33
|
+
const left = max !== undefined && typeof responses === 'number' ? Math.max(0, max - responses) : undefined;
|
|
34
|
+
const state = opens !== null && now < opens ? 'soon'
|
|
35
|
+
: closes !== null && now >= closes ? 'closed'
|
|
36
|
+
: asking ? 'asking'
|
|
37
|
+
: left === 0 ? 'full'
|
|
38
|
+
: limits?.onePerPerson && (told?.mine ?? 0) >= 1 ? 'sent'
|
|
39
|
+
: 'open';
|
|
40
|
+
return {
|
|
41
|
+
state,
|
|
42
|
+
...(opens !== null ? { opens: new Date(opens).toISOString() } : {}),
|
|
43
|
+
...(closes !== null ? { closes: new Date(closes).toISOString() } : {}),
|
|
44
|
+
...(limits?.message ? { message: limits.message } : {}),
|
|
45
|
+
...(left !== undefined ? { left } : {}),
|
|
46
|
+
seats,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/** The values a choice holds: one, several (a choice of many), or none. */
|
|
50
|
+
const chosenOf = (value) => (Array.isArray(value) ? value : value === null || value === undefined ? [] : [value]);
|
|
51
|
+
/**
|
|
52
|
+
* The options of a choice's value that are full now, in the order they are held: those `before` held too left out
|
|
53
|
+
* when given — a choice made now, not one held already.
|
|
54
|
+
*/
|
|
55
|
+
function fullChosen(field, places, value, before) {
|
|
56
|
+
if (!places || field?.type !== 'selection')
|
|
57
|
+
return [];
|
|
58
|
+
const held = new Set(chosenOf(before).map(String));
|
|
59
|
+
return chosenOf(value)
|
|
60
|
+
.filter((one) => !(before !== undefined && held.has(String(one))) && places[String(one)]?.left === 0)
|
|
61
|
+
.map((one) => (field.options ?? []).find((option) => String(option.value) === String(one)) ?? { value: String(one), label: String(one) });
|
|
62
|
+
}
|
|
63
|
+
/** A form's limits: what it tells of them, and what it asks and refuses by them. */
|
|
64
|
+
function formLimits(host) {
|
|
65
|
+
const { page, scheduler, messages } = host;
|
|
66
|
+
/** The source's last answer to `limits`: null until it told. */
|
|
67
|
+
let counted = null;
|
|
68
|
+
let timer = null;
|
|
69
|
+
/** The choice fields whose own options have places. */
|
|
70
|
+
const seated = (0, taking_1.seatedFields)(page);
|
|
71
|
+
/** A choice's options as shown: its own, or its app's list's once loaded. */
|
|
72
|
+
const optionsOf = (name) => {
|
|
73
|
+
const def = page.fields[name];
|
|
74
|
+
if (def?.type !== 'selection')
|
|
75
|
+
return [];
|
|
76
|
+
if ((0, choice_options_1.optionsList)(def.optionsFrom))
|
|
77
|
+
return (host.started() ? host.state().choices[name]?.options : null) ?? [];
|
|
78
|
+
// Carried from an earlier question: its options, and the choice's own after them.
|
|
79
|
+
return (0, choice_options_1.optionsField)(def.optionsFrom) ? (0, choice_options_1.choiceOptions)(page.fields, name) : (def.options ?? []);
|
|
80
|
+
};
|
|
81
|
+
/** The choice fields with places now: those of the page's own, and of the app's lists whose options loaded with them. */
|
|
82
|
+
const seatedNow = () => [...seated, ...Object.keys(host.started() ? host.state().choices : {}).filter((name) => !seated.includes(name) && optionsOf(name).some((option) => option.seats !== undefined))];
|
|
83
|
+
const asks = () => !!host.dataSource?.limits && ((0, taking_1.countsAsked)(page) || seatedNow().length > 0);
|
|
84
|
+
/** The page's counts asked as it opens and not told yet: nothing is typed meanwhile. */
|
|
85
|
+
let askingFirst = asks() && (0, taking_1.countsAsked)(page);
|
|
86
|
+
const limitsHere = () => limitsNow(page, host.clock(), counted, askingFirst, optionsOf);
|
|
87
|
+
function show() {
|
|
88
|
+
const limits = limitsHere();
|
|
89
|
+
if (JSON.stringify(limits) !== JSON.stringify(host.state().limits ?? null))
|
|
90
|
+
host.set({ limits });
|
|
91
|
+
if (timer !== null)
|
|
92
|
+
scheduler.clearTimeout(timer);
|
|
93
|
+
timer = null;
|
|
94
|
+
const next = [limits?.opens, limits?.closes].map((at) => (at ? Date.parse(at) - host.clock() : -1)).filter((ms) => ms > 0).sort((a, b) => a - b)[0];
|
|
95
|
+
// Within the longest wait a timer keeps (24 days), while something listens: a page left open as it opens or closes
|
|
96
|
+
// says so then. (A form no one listens to keeps no timer that would hold a process open.)
|
|
97
|
+
if (next !== undefined && next < 2 ** 31 - 1 && !host.disposed() && host.listened())
|
|
98
|
+
timer = scheduler.setTimeout(show, next + 50);
|
|
99
|
+
}
|
|
100
|
+
async function ask() {
|
|
101
|
+
const source = host.dataSource;
|
|
102
|
+
if (!asks() || !source?.limits)
|
|
103
|
+
return show();
|
|
104
|
+
const shown = host.shownNow();
|
|
105
|
+
const user = host.user ? { user: { id: host.user.id, ...(host.user.name ? { name: host.user.name } : {}) } } : {};
|
|
106
|
+
// A source that never answers keeps no one from the questions for long: past 10 seconds they show, and its submit decides.
|
|
107
|
+
const waited = askingFirst
|
|
108
|
+
? scheduler.setTimeout(() => {
|
|
109
|
+
if (!askingFirst || !shown())
|
|
110
|
+
return;
|
|
111
|
+
askingFirst = false;
|
|
112
|
+
show();
|
|
113
|
+
}, 10000)
|
|
114
|
+
: null;
|
|
115
|
+
try {
|
|
116
|
+
const told = await source.limits({ pageId: page.id, model: page.data.kind === 'record' ? page.data.model : '', recordId: host.state().recordId, fields: seatedNow(), ...user });
|
|
117
|
+
if (!shown())
|
|
118
|
+
return;
|
|
119
|
+
counted = told ?? {};
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
// Not told: the page keeps to its dates alone, and the source's submit refuses as it would.
|
|
123
|
+
if (!shown())
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
finally {
|
|
127
|
+
if (waited !== null)
|
|
128
|
+
scheduler.clearTimeout(waited);
|
|
129
|
+
}
|
|
130
|
+
askingFirst = false;
|
|
131
|
+
show();
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
show,
|
|
135
|
+
ask,
|
|
136
|
+
asks,
|
|
137
|
+
uncounted: (name) => !counted?.perChoice?.[name],
|
|
138
|
+
async stillTaking(asked) {
|
|
139
|
+
if (!page.limits && !seatedNow().length)
|
|
140
|
+
return null;
|
|
141
|
+
await ask();
|
|
142
|
+
if (asked !== host.generation())
|
|
143
|
+
return { reason: 'save', message: host.replaced() };
|
|
144
|
+
const limits = limitsHere();
|
|
145
|
+
const why = limits && limits.state !== 'open' && limits.state !== 'asking' ? takingWords(page, limits, messages) : null;
|
|
146
|
+
if (!why)
|
|
147
|
+
return null;
|
|
148
|
+
const problem = { kind: 'rule', message: why };
|
|
149
|
+
host.set({ status: 'error', error: why, saveProblem: problem, conflict: null, limits });
|
|
150
|
+
return { reason: 'save', message: why };
|
|
151
|
+
},
|
|
152
|
+
refusedFull(name, value) {
|
|
153
|
+
const state = host.state();
|
|
154
|
+
const full = fullChosen(page.fields[name], state.limits?.seats[name], value, state.values[name]);
|
|
155
|
+
if (!full.length)
|
|
156
|
+
return false;
|
|
157
|
+
host.refuse(name, (0, messages_1.fill)(messages.choiceFull, { option: full.map((option) => option.label).join(', ') }));
|
|
158
|
+
return true;
|
|
159
|
+
},
|
|
160
|
+
fullErrors(seen, errors) {
|
|
161
|
+
const state = host.state();
|
|
162
|
+
const found = {};
|
|
163
|
+
for (const [name, places] of Object.entries(state.limits?.seats ?? {})) {
|
|
164
|
+
const full = seen.has(name) && !errors[name] ? fullChosen(page.fields[name], places, state.values[name]) : [];
|
|
165
|
+
if (full.length)
|
|
166
|
+
found[name] = (0, messages_1.fill)(messages.choiceFilled, { option: full.map((option) => option.label).join(', ') });
|
|
167
|
+
}
|
|
168
|
+
return found;
|
|
169
|
+
},
|
|
170
|
+
heard(listening) {
|
|
171
|
+
if (listening) {
|
|
172
|
+
const limits = host.state().limits;
|
|
173
|
+
if (timer === null && (limits?.opens || limits?.closes))
|
|
174
|
+
show();
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
if (timer === null)
|
|
178
|
+
return;
|
|
179
|
+
scheduler.clearTimeout(timer);
|
|
180
|
+
timer = null;
|
|
181
|
+
},
|
|
182
|
+
dispose() {
|
|
183
|
+
if (timer !== null)
|
|
184
|
+
scheduler.clearTimeout(timer);
|
|
185
|
+
timer = null;
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* A day or a day and a time in words, in the messages' language, on the page's clock: "20 November 2026", "1 November
|
|
191
|
+
* 2026 at 09:00" — with the zone's short name where it is not the browser's own ("09:00 GMT+2").
|
|
192
|
+
*/
|
|
193
|
+
function whenWords(written, at, messages, zone) {
|
|
194
|
+
if ((0, taking_1.dayAlone)(written)) {
|
|
195
|
+
const [y, m, d] = written.split('-').map(Number);
|
|
196
|
+
return new Intl.DateTimeFormat(messages.locale, { year: 'numeric', month: 'long', day: 'numeric', timeZone: 'UTC', numberingSystem: 'latn' }).format(Date.UTC(y, m - 1, d));
|
|
197
|
+
}
|
|
198
|
+
const elsewhere = !!zone && !(0, zones_1.isOwnZone)(zone);
|
|
199
|
+
return new Intl.DateTimeFormat(messages.locale, {
|
|
200
|
+
year: 'numeric',
|
|
201
|
+
month: 'long',
|
|
202
|
+
day: 'numeric',
|
|
203
|
+
hour: '2-digit',
|
|
204
|
+
minute: '2-digit',
|
|
205
|
+
hourCycle: 'h23',
|
|
206
|
+
numberingSystem: 'latn',
|
|
207
|
+
...(zone ? { timeZone: zone } : {}),
|
|
208
|
+
...(elsewhere ? { timeZoneName: 'short' } : {}),
|
|
209
|
+
}).format(at);
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Why a page takes no answers now, in the messages' words — "This form opens on 1 November 2026 at 09:00.", "This form
|
|
213
|
+
* closed on 20 November 2026.", "This form has all the responses it takes.", "You have sent your answers to this form
|
|
214
|
+
* already." — or null while it takes them (or still asks).
|
|
215
|
+
*/
|
|
216
|
+
function takingWords(page, limits, messages) {
|
|
217
|
+
const written = page.limits;
|
|
218
|
+
switch (limits?.state) {
|
|
219
|
+
case 'soon':
|
|
220
|
+
return written?.opens && limits.opens ? (0, messages_1.fill)(messages.formOpens, { when: whenWords(written.opens, Date.parse(limits.opens), messages, page.timeZone) }) : null;
|
|
221
|
+
case 'closed':
|
|
222
|
+
return written?.closes && limits.closes ? (0, messages_1.fill)(messages.formClosed, { when: whenWords(written.closes, Date.parse(limits.closes), messages, page.timeZone) }) : null;
|
|
223
|
+
case 'full':
|
|
224
|
+
return messages.formFull;
|
|
225
|
+
case 'sent':
|
|
226
|
+
return messages.formSent;
|
|
227
|
+
default:
|
|
228
|
+
return null;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
//# sourceMappingURL=form-limits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-limits.js","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/record/form-limits.ts"],"names":[],"mappings":";;AAoEA,8BAuCC;AASD,gCAMC;AAGD,gCA2GC;AAMD,8BAiBC;AAOD,kCAcC;AAlRD,6DAAoF;AAGpF,yCAAiD;AAGjD,qCAA4H;AAC5H,mCAAoC;AA0DpC,wHAAwH;AACxH,SAAgB,SAAS,CACvB,IAAU,EACV,GAAW,EACX,IAAyB,EACzB,MAAe,EACf,SAA+C;IAE/C,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IACxE,MAAM,KAAK,GAA0C,EAAE,CAAC;IACxD,KAAK,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,IAAI,EAAE,CAAC,EAAE,CAAC;QACrE,MAAM,MAAM,GAA0B,EAAE,CAAC;QACzC,KAAK,MAAM,MAAM,IAAI,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;YACtC,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS;gBAAE,SAAS;YACzC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YAC7E,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,E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