• Resolve the final Name and (pre-uniqueness) Shortcode base for a Create-dialog confirmation, honoring the archetype-first defaulting rules (issue #643):

    • A user-typed value always wins (typedName / typedShortcode).
    • Otherwise, when an archetype is chosen, its own name / shortcode are the defaults — leaving both fields blank creates a document that matches the archetype (subject only to later uniqueness bumping).
    • With (none) chosen (blank-slate authoring), the Name falls back to the class defaultName and the Shortcode is derived from the resolved name.
    • A blank shortcode always derives from the resolved name, then the class default, and finally the type token, so the key is never empty.

    Both the typed and archetype shortcodes are run through slugifyShortcode, so the returned shortcodeBase is always a clean token. The caller applies sohl.utils.uniqueShortcode against the taken set.

    Parameters

    • typedName: string

      The trimmed Name field value ("" when left at its default).

    • typedShortcode: string

      The trimmed Shortcode field value ("" when defaulted).

    • archetype: undefined | ArchetypeIdentity

      The chosen archetype's identity, or undefined for (none).

    • classDefaultName: string

      The document class's defaultName for the type.

    • typeFallback: string

      The document type token, used as the last-resort base.

    Returns { name: string; shortcodeBase: string }

    The resolved name and the pre-uniqueness shortcodeBase.