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AAA,QAAAkJ,EACA,CGhDIC,CAAanH,IAEjB,YAAA1G,SAAAqM,WACArM,SAAA0E,iBAAA,uBAAAiJ,EAAA3N,WAEA2N,EAAA3N,UAEAA,SAAA0E,iBAAA,mBAAAC,GAAAgJ,EAAAhJ,EAAAgB,QAAA3F,WAEAA,SAAA0E,iBAAA,gBAAAC,GAAAgJ,EAAAhJ,EAAAmJ,QAAAnJ,EAAAmJ,OAAA1O,MAAAY,UACA,C","sources":["webpack://djancloud-frontend/./src/js/field_errors.js","webpack://djancloud-frontend/./src/js/search/query.js","webpack://djancloud-frontend/./src/js/ui/choices_core.js","webpack://djancloud-frontend/./src/js/ui/choices.js","webpack://djancloud-frontend/./src/js/ui/file_upload.js","webpack://djancloud-frontend/./src/js/ui/required_groups.js","webpack://djancloud-frontend/./src/js/ui/show_when.js","webpack://djancloud-frontend/./src/js/ui/slideover.js","webpack://djancloud-frontend/./src/js/ui/targets.js","webpack://djancloud-frontend/./src/js/modules.js"],"sourcesContent":["/**\n * @file Fields in error: the field turns red and says why on a line under it.\n *\n * A field in error carries `aria-invalid=\"true\"`, which the red of `.dc-input`\n * in main.css keys on, and a `.dc-field-error` line that its\n * `aria-describedby` points at, so a screen reader reads the reason along with\n * the label. Two sources end up here:\n *\n *   - The browser's own checks: required, type=\"email\", pattern, min and max.\n *     `setupFieldValidation()` catches them on every form of every page and\n *     puts the browser's message on the line, instead of the bubble that fades\n *     after a few seconds and never marks the field.\n *   - What only the server can tell, such as an address already in use. The\n *     JSON API names the field such an error is about, by its `name`:\n *       {\"error\": \"Email already in use.\", \"field\": \"email\"}\n *     and `showFieldError()` puts the message under that field.\n *\n * The line goes away once the field is edited into a valid value. A server's\n * verdict was about the value before the edit, so it goes at the first one.\n *\n * The state lives in the DOM rather than in this module: a page bundle that\n * imports these helpers carries its own copy of the module, and the listeners\n * of the `common` copy still have to clear the lines that copy adds.\n */\n\n// The fields main.css can draw in error. Any other control keeps the bubble.\nconst FIELD_SELECTOR = '.dc-input, .dc-guest-input, .dc-guest-code > input';\n\n// On the field: the id of its line, and whose verdict the line holds\n// ('browser' or 'server').\nconst LINE_ATTR = 'data-error-line';\nconst SOURCE_ATTR = 'data-error-source';\n\n// How far up a line may move to get out of a row. Past that, a line under the\n// field beats one under half the page.\nconst MAX_ANCHOR_CLIMB = 3;\n\nfunction describedBy(field) {\n    return (field.getAttribute('aria-describedby') || '').split(/\\s+/).filter(Boolean);\n}\n\nfunction setDescribedBy(field, ids) {\n    if (ids.length) field.setAttribute('aria-describedby', ids.join(' '));\n    else field.removeAttribute('aria-describedby');\n}\n\n// Children laid side by side: a line added among them would sit next to the\n// field instead of under it.\nfunction isRow(element) {\n    const style = getComputedStyle(element);\n    if (style.display.includes('grid')) {\n        return style.gridTemplateColumns.trim().split(/\\s+/).length > 1;\n    }\n    return style.display.includes('flex') && !style.flexDirection.startsWith('column');\n}\n\n// Something laid over the field (the icon of a search box) is positioned\n// against the parent, and would drift if a line made the parent taller.\nfunction hasOverlay(parent, node) {\n    return Array.from(parent.children).some(\n        child => child !== node && getComputedStyle(child).position === 'absolute');\n}\n\n/**\n * The element the line goes right after: the field itself, or the row it\n * shares with its button, or the box it is laid over (the boxed code entry of\n * the guest pages, whose input is invisible).\n *\n * @param {Element} field\n * @returns {Element}\n */\nfunction lineAnchor(field) {\n    let node = field;\n    for (let climbed = 0; climbed < MAX_ANCHOR_CLIMB; climbed += 1) {\n        const parent = node.parentElement;\n        if (!parent || parent === document.body) break;\n        const overlaid = getComputedStyle(node).position === 'absolute';\n        if (!overlaid && !isRow(parent) && !hasOverlay(parent, node)) break;\n        node = parent;\n    }\n    return node;\n}\n\n/**\n * Mark a field in error, or change the reason it already shows.\n *\n * @param {HTMLInputElement|HTMLSelectElement|HTMLTextAreaElement} field\n * @param {string} message - Shown under the field, as text.\n * @param {'browser'|'server'} [source='server'] - A browser verdict is taken\n *   again on each edit; a server one goes at the first edit.\n * @returns {void}\n */\nexport function setFieldError(field, message, source = 'server') {\n    const previous = field.getAttribute(LINE_ATTR);\n    let line = previous ? document.getElementById(previous) : null;\n    if (!line) {\n        line = document.createElement('p');\n        line.id = 'dc-field-error-' + Math.random().toString(36).slice(2, 10);\n        line.className = 'dc-field-error';\n        // After the lines already under the same row, so that two fields of\n        // one row keep their order.\n        let previousSibling = lineAnchor(field);\n        while (previousSibling.nextElementSibling?.classList.contains('dc-field-error')) {\n            previousSibling = previousSibling.nextElementSibling;\n        }\n        previousSibling.after(line);\n        setDescribedBy(field, describedBy(field).filter(id => id !== previous).concat(line.id));\n        field.setAttribute(LINE_ATTR, line.id);\n    }\n    line.textContent = message;\n    field.setAttribute(SOURCE_ATTR, source);\n    field.setAttribute('aria-invalid', 'true');\n}\n\n/**\n * Take a field out of error and remove its line. A no-op on a field in order.\n *\n * @param {Element} field\n * @returns {void}\n */\nexport function clearFieldError(field) {\n    const id = field.getAttribute(LINE_ATTR);\n    if (!id) return;\n    const line = document.getElementById(id);\n    if (line) line.remove();\n    setDescribedBy(field, describedBy(field).filter(x => x !== id));\n    field.removeAttribute(LINE_ATTR);\n    field.removeAttribute(SOURCE_ATTR);\n    field.removeAttribute('aria-invalid');\n}\n\n/**\n * Take every field under `root` out of error, typically before sending a form\n * again: the answer decides what is still wrong.\n *\n * @param {ParentNode|null} root - The form or panel; nothing happens without one.\n * @returns {void}\n */\nexport function clearFieldErrors(root) {\n    if (!root) return;\n    root.querySelectorAll(`[${LINE_ATTR}]`).forEach(clearFieldError);\n}\n\n/**\n * Show a JSON API error under the field it is about, and move the focus there.\n *\n * @param {ParentNode} root - The form (or the panel) holding the field.\n * @param {{error?: string, field?: string}} data - The error response.\n * @returns {boolean} False when the error names no field of `root`: the caller\n *   still has to show the message its own way.\n */\nexport function showFieldError(root, data) {\n    if (!root || !data || !data.error || !data.field) return false;\n    const field = root.querySelector(`[name=\"${CSS.escape(data.field)}\"]:not([type=\"hidden\"])`);\n    if (!field) return false;\n    setFieldError(field, data.error, 'server');\n    field.focus();\n    return true;\n}\n\n/**\n * Show the browser's own checks on the fields instead of in its bubble, on\n * every form of the page. Wired once per page by common.js.\n *\n * @returns {void}\n */\nexport function setupFieldValidation() {\n    let focusTaken = false;\n\n    // `invalid` does not bubble: the capture phase is the one way to hear it\n    // from the document.\n    document.addEventListener('invalid', (event) => {\n        const field = event.target;\n        if (!(field instanceof Element) || !field.matches(FIELD_SELECTOR)) return;\n        event.preventDefault();\n        setFieldError(field, field.validationMessage, 'browser');\n        // Cancelling the event also cancels the browser's move to the first\n        // field at fault. All of them get their event within the same task, so\n        // the flag, reset by the next one, leaves the focus to the first.\n        if (!focusTaken) {\n            focusTaken = true;\n            field.focus();\n            setTimeout(() => { focusTaken = false; });\n        }\n    }, true);\n\n    const recheck = (event) => {\n        const field = event.target;\n        if (!(field instanceof Element) || !field.hasAttribute(LINE_ATTR)) return;\n        if (field.getAttribute(SOURCE_ATTR) === 'browser' && !field.validity.valid) {\n            setFieldError(field, field.validationMessage, 'browser');\n        } else {\n            clearFieldError(field);\n        }\n    };\n    document.addEventListener('input', recheck, true);\n    document.addEventListener('change', recheck, true);\n}\n","/**\n * @file query.js\n * @description The query language of the contextual search bar, as the\n * browser reads it: free words, \"quoted phrases\" and `key:value` filters, a\n * value quoted when it holds a space (`de:\"camille martin\"`). The server parses\n * the same grammar (file/search_query.py) and turns the filters into database\n * filters; the bar turns the ones its page knows into chips.\n *\n * The grammar knows no key: a page hands its vocabulary (canonical key ->\n * accepted spellings) and gets canonical keys back. Pure functions, tested\n * under `node --test` (query.test.js).\n */\n\n// `key:\"quoted value\"`, `key:value`, `\"quoted phrase\"` or a word. A key starts\n// with a letter, accented ones included -- `\\w` is ASCII-only in JavaScript,\n// hence the Unicode classes; an unclosed quote runs to the end, the user is\n// typing it.\nconst KEY = '(\\\\p{L}[\\\\p{L}\\\\p{N}_-]*)';\nconst TOKEN = new RegExp(`${KEY}:(?:\"([^\"]*)\"?|(\\\\S*))|\"([^\"]*)\"?|(\\\\S+)`, 'gu');\n\n/**\n * Lower case, accents stripped: how the server indexes and matches text.\n *\n * @param {string} text - Any text.\n * @returns {string} The folded text.\n */\nexport function fold(text) {\n  return String(text || '').normalize('NFKD').replace(/\\p{M}/gu, '').toLowerCase();\n}\n\n/**\n * Map every spelling of a vocabulary to its canonical key.\n *\n * @param {Object<string, string[]>} vocabulary - Key -> spellings.\n * @returns {Map<string, string>} Folded spelling -> key, the key included.\n */\nexport function spellings(vocabulary) {\n  const table = new Map();\n  Object.entries(vocabulary || {}).forEach(([key, names]) => {\n    table.set(fold(key), key);\n    (names || []).forEach((name) => table.set(fold(name), key));\n  });\n  return table;\n}\n\n/**\n * Take a query apart.\n *\n * @param {string} text - What was typed.\n * @param {Object<string, string[]>} [vocabulary] - The filters the page knows.\n * @returns {{words: string[], phrases: string[], filters: Array<{key: string, value: string}>}}\n *     A filter typed without its value yet (`de:`) is left out; a key the page\n *     does not know stays a word, colon and all.\n */\nexport function parse(text, vocabulary) {\n  const known = spellings(vocabulary);\n  const parsed = { words: [], phrases: [], filters: [] };\n  for (const match of String(text || '').matchAll(TOKEN)) {\n    const [whole, rawKey, quoted, bare, phrase, word] = match;\n    if (rawKey !== undefined) {\n      const key = known.get(fold(rawKey));\n      const value = (quoted !== undefined ? quoted : bare).trim();\n      if (key === undefined) parsed.words.push(whole.replace(/\"/g, ''));\n      else if (value) parsed.filters.push({ key, value });\n    } else if (phrase !== undefined) {\n      if (phrase.trim()) parsed.phrases.push(phrase.trim());\n    } else {\n      parsed.words.push(word);\n    }\n  }\n  return parsed;\n}\n\n/**\n * Write a filter back as the grammar reads it.\n *\n * @param {string} name - The spelling to write (`de`).\n * @param {string} value - Its value, quoted when it holds a space or a quote.\n * @returns {string} `de:camille` or `de:\"camille martin\"`.\n */\nexport function formatFilter(name, value) {\n  const text = String(value || '').replace(/\"/g, '');\n  return /\\s/.test(text) ? `${name}:\"${text}\"` : `${name}:${text}`;\n}\n\n/**\n * The query a set of chips and the free text stand for.\n *\n * @param {Array<{key: string, value: string}>} filters - The chips.\n * @param {string} text - What is typed beside them.\n * @param {Object<string, string[]>} [vocabulary] - Written with each key's\n *     first spelling (the French one), the canonical key without one.\n * @returns {string} The query, filters first.\n */\nexport function serialize(filters, text, vocabulary) {\n  const parts = (filters || []).map(({ key, value }) => {\n    const names = (vocabulary && vocabulary[key]) || [];\n    return formatFilter(names[0] || key, value);\n  });\n  const free = String(text || '').trim();\n  if (free) parts.push(free);\n  return parts.join(' ');\n}\n\n// A key where a word starts, and its colon.\nconst KEY_AT_WORD = new RegExp(`(^|\\\\s)${KEY}:`, 'gu');\n\n/**\n * Drop the quotes around a value, the closing one possibly not typed yet.\n *\n * @param {string} raw - A value as typed.\n * @returns {string} The value.\n */\nfunction unquote(raw) {\n  return raw.trim().replace(/^\"/, '').replace(/\"$/, '').trim();\n}\n\n/**\n * The filters typed in the field, and the free text around them, as the bar\n * reads what is being typed -- more lenient than `parse`, which reads a\n * finished query:\n *\n * - the value of a text filter (`contenu:`) runs to the next filter, spaces\n *   included: the user is still typing it until Enter or Tab takes it;\n * - the value of any other filter (`pj:oui`, `après:2026-01-01`) is one word;\n * - a key the page does not know, or a one-word filter left without its\n *   value, is free text.\n *\n * @param {string} text - The field's value.\n * @param {Object<string, string[]>} vocabulary - The filters the page knows.\n * @param {Set<string>} [textKeys] - The canonical keys whose values are text.\n * @returns {{free: string, filters: Array<{key: string, name: string, value: string,\n *     start: number, open: boolean}>}} `free` whitespace-collapsed; each filter\n *     with its key as typed (`name`), where it starts, and whether it runs to\n *     the end of the text (`open`: the one still being typed).\n */\nexport function splitTyped(text, vocabulary, textKeys = new Set()) {\n  const source = String(text || '');\n  const known = spellings(vocabulary);\n  const tokens = [];\n  for (const match of source.matchAll(KEY_AT_WORD)) {\n    const key = known.get(fold(match[2]));\n    if (key !== undefined) {\n      tokens.push({ key, name: match[2], start: match.index + match[1].length });\n    }\n  }\n  const filters = [];\n  const free = [];\n  let cursor = 0;\n  tokens.forEach((token, index) => {\n    if (token.start < cursor) return;\n    const valueStart = token.start + token.name.length + 1;\n    let end;\n    if (textKeys.has(token.key)) {\n      const next = tokens.slice(index + 1).find((other) => other.start >= valueStart);\n      end = next ? next.start : source.length;\n    } else if (source[valueStart] === '\"') {\n      const closing = source.indexOf('\"', valueStart + 1);\n      end = closing === -1 ? source.length : closing + 1;\n    } else {\n      const space = /\\s/u.exec(source.slice(valueStart));\n      end = space ? valueStart + space.index : source.length;\n    }\n    const value = unquote(source.slice(valueStart, end));\n    const open = end >= source.length;\n    if (!value && !open) return;\n    free.push(source.slice(cursor, token.start));\n    filters.push({ key: token.key, name: token.name, value, start: token.start, open });\n    cursor = end;\n  });\n  free.push(source.slice(cursor));\n  return { free: free.join(' ').replace(/\\s+/g, ' ').trim(), filters };\n}\n\n/**\n * The filter still being typed at the end of the field, if any: `de:cam`, or\n * `contenu:comité de` for a text filter. What the bar offers suggestions and\n * the Enter row for.\n *\n * @param {string} text - The field's value.\n * @param {Object<string, string[]>} vocabulary - The filters the page knows.\n * @param {Set<string>} [textKeys] - See `splitTyped`.\n * @returns {?{key: string, name: string, value: string, start: number}}\n */\nexport function pendingFilter(text, vocabulary, textKeys) {\n  const { filters } = splitTyped(text, vocabulary, textKeys);\n  const last = filters[filters.length - 1];\n  if (!last || !last.open) return null;\n  const { key, name, value, start } = last;\n  return { key, name, value, start };\n}\n","/**\n * @file choices_core.js\n * @description The pure part of the searchable select and of the tag input\n * (ui/choices.js): which options a typed text matches, and in what order.\n * Tested under `node --test` (choices_core.test.js).\n */\n\nimport { fold } from '../search/query.js';\n\n/**\n * The options a text matches: those whose label holds every word typed,\n * case and accents aside -- the ones starting with it first, then in their\n * own order. All of them for an empty text.\n *\n * @param {Array<{value: string, label: string}>} options - In their order.\n * @param {string} text - What is typed.\n * @param {Set<string>} [left] - Values to leave out (the tags already there).\n * @returns {Array<{value: string, label: string}>}\n */\nexport function matchOptions(options, text, left = new Set()) {\n  const words = fold(text).split(/\\s+/).filter(Boolean);\n  const kept = options.filter((option) => !left.has(option.value));\n  if (!words.length) return kept;\n  const first = [];\n  const rest = [];\n  kept.forEach((option) => {\n    const label = fold(option.label);\n    if (!words.every((word) => label.includes(word))) return;\n    (label.startsWith(words[0]) ? first : rest).push(option);\n  });\n  return first.concat(rest);\n}\n\n/**\n * The values left once `value` is added to a multiple choice: an exclusive\n * option (none of the others, \"None\") stands alone, and another option takes\n * the exclusive ones away.\n *\n * @param {string[]} values - The values chosen so far.\n * @param {string} value - The one added.\n * @param {Set<string>} exclusive - The values that stand alone.\n * @returns {string[]}\n */\nexport function addValue(values, value, exclusive = new Set()) {\n  if (exclusive.has(value)) return [value];\n  return values.filter((kept) => kept !== value && !exclusive.has(kept)).concat([value]);\n}\n","/**\n * @file choices.js\n * @description Two enhancements of a native <select>, for the pages of the\n * core and the pages of modules alike -- the common bundle and the modules\n * bundle (js/modules.js) both run them:\n *\n *   <select data-combo>             a searchable select: a field to type in,\n *                                   the options matching it in a list under it;\n *   <select multiple data-tags>     a tag input: each chosen option a tag with\n *                                   its cross, a field to add more, Backspace\n *                                   in the empty field takes the last one.\n *\n * The <select> stays in the form, hidden, and carries what is posted: a page\n * without this script keeps a working native control, and the server reads\n * the same field either way. An option with `data-exclusive` stands alone in\n * a tag input (\"None\": choosing it takes the others away, and the reverse).\n * The few words the script writes come from the select, in the page's\n * language: `data-empty-text` (no option matches) and `data-remove-text`\n * (the cross of a tag, `%s` the tag).\n *\n * The list is fixed to the window rather than placed under the field: a\n * card clips what overflows it, and the list would be cut. It closes when\n * the page scrolls under it.\n */\n\nimport { addValue, matchOptions } from './choices_core.js';\n\nlet serial = 0;\n\n/**\n * The options of a select, as the matching takes them.\n *\n * @param {HTMLSelectElement} select - The native control.\n * @returns {Array<{value: string, label: string, exclusive: boolean}>}\n */\nfunction optionsOf(select) {\n  return Array.from(select.options)\n    .filter((option) => !option.disabled)\n    .map((option) => ({\n      value: option.value,\n      label: (option.textContent || '').trim() || option.value,\n      exclusive: option.hasAttribute('data-exclusive'),\n    }));\n}\n\n/**\n * The list under a field: drawn on demand, walked with the arrows, an option\n * taken with Enter or a click.\n *\n * @param {HTMLInputElement} input - The field it belongs to.\n * @param {string} emptyText - What it says when nothing matches.\n * @param {function(Object): void} onPick - Called with the option taken.\n * @returns {Object} show(items, selected), hide(), move(step), pick(), open\n */\nfunction listFor(input, emptyText, onPick) {\n  const list = document.createElement('ul');\n  serial += 1;\n  list.id = `dc-combo-list-${serial}`;\n  list.className = 'dc-combo-list';\n  list.setAttribute('role', 'listbox');\n  list.hidden = true;\n  document.body.append(list);\n  input.setAttribute('aria-controls', list.id);\n  input.setAttribute('aria-expanded', 'false');\n\n  let items = [];\n  let active = -1;\n\n  function place() {\n    const box = input.getBoundingClientRect();\n    list.style.left = `${box.left}px`;\n    list.style.width = `${box.width}px`;\n    const below = window.innerHeight - box.bottom;\n    if (below < 220 && box.top > below) {\n      list.style.top = '';\n      list.style.bottom = `${window.innerHeight - box.top + 4}px`;\n    } else {\n      list.style.bottom = '';\n      list.style.top = `${box.bottom + 4}px`;\n    }\n  }\n\n  function paintActive() {\n    Array.from(list.children).forEach((row, index) => {\n      row.classList.toggle('is-active', index === active);\n    });\n    const row = list.children[active];\n    if (row && row.id) {\n      input.setAttribute('aria-activedescendant', row.id);\n      row.scrollIntoView({ block: 'nearest' });\n    } else {\n      input.removeAttribute('aria-activedescendant');\n    }\n  }\n\n  const api = {\n    get open() {\n      return !list.hidden;\n    },\n    show(found, selected = new Set()) {\n      items = found;\n      list.replaceChildren();\n      if (!found.length) {\n        const empty = document.createElement('li');\n        empty.className = 'dc-combo-empty';\n        empty.textContent = emptyText;\n        list.append(empty);\n      }\n      found.slice(0, 200).forEach((item, index) => {\n        const row = document.createElement('li');\n        row.id = `${list.id}-${index}`;\n        row.className = 'dc-combo-option';\n        row.setAttribute('role', 'option');\n        row.setAttribute('aria-selected', selected.has(item.value) ? 'true' : 'false');\n        row.textContent = item.label;\n        // Keeps the focus in the field: a click picks without blurring it.\n        row.addEventListener('mousedown', (event) => event.preventDefault());\n        row.addEventListener('click', () => onPick(item));\n        list.append(row);\n      });\n      active = found.findIndex((item) => selected.has(item.value));\n      if (active < 0 && found.length) active = 0;\n      place();\n      list.hidden = false;\n      input.setAttribute('aria-expanded', 'true');\n      paintActive();\n    },\n    hide() {\n      list.hidden = true;\n      input.setAttribute('aria-expanded', 'false');\n      input.removeAttribute('aria-activedescendant');\n    },\n    move(step) {\n      if (!items.length) return;\n      active = (active + step + items.length) % items.length;\n      paintActive();\n    },\n    pick() {\n      if (active >= 0 && items[active]) onPick(items[active]);\n    },\n  };\n  window.addEventListener('scroll', (event) => {\n    if (event.target !== list && api.open) api.hide();\n  }, true);\n  window.addEventListener('resize', () => api.hide());\n  return api;\n}\n\n/**\n * Put the field where the select was, the select kept in the form, hidden;\n * a <label for> of the select names the field from now on.\n *\n * @param {HTMLSelectElement} select - The native control.\n * @param {HTMLElement} control - What stands in its place.\n * @param {HTMLInputElement} input - The field of that control.\n * @returns {void}\n */\nfunction replaceSelect(select, control, input) {\n  select.before(control);\n  control.append(select);\n  select.hidden = true;\n  select.tabIndex = -1;\n  if (select.id) {\n    input.id = select.id;\n    select.id = `${select.id}-choices`;\n  }\n  // The error a server put on the select (aria-invalid, its line) is the\n  // field's now: field_errors.js takes it away at the first edit.\n  ['aria-describedby', 'aria-invalid', 'aria-label', 'data-error-line', 'data-error-source'].forEach((name) => {\n    if (select.hasAttribute(name)) input.setAttribute(name, select.getAttribute(name));\n  });\n  // A value picked from the list is the select's change, not the field's:\n  // its error goes all the same.\n  select.addEventListener('change', () => {\n    if (input.hasAttribute('data-error-line')) input.dispatchEvent(new Event('change', { bubbles: true }));\n  });\n  // A hidden control cannot be focused, so the browser would refuse the form\n  // without saying where: the field asks for the value instead.\n  if (select.required) {\n    input.required = true;\n    select.required = false;\n  }\n  input.disabled = select.disabled;\n}\n\nfunction newField(className) {\n  const input = document.createElement('input');\n  input.type = 'text';\n  input.className = className;\n  input.autocomplete = 'off';\n  input.spellcheck = false;\n  input.setAttribute('role', 'combobox');\n  input.setAttribute('aria-autocomplete', 'list');\n  return input;\n}\n\n/**\n * A searchable select (`<select data-combo>`).\n *\n * @param {HTMLSelectElement} select - The native control.\n * @returns {void}\n */\nfunction setupCombo(select) {\n  const options = optionsOf(select);\n  const control = document.createElement('div');\n  control.className = 'dc-combo';\n  const input = newField('dc-input');\n  input.placeholder = select.getAttribute('data-placeholder') || '';\n  control.append(input);\n  replaceSelect(select, control, input);\n\n  const label = () => {\n    const chosen = select.selectedOptions[0];\n    return chosen ? (chosen.textContent || '').trim() : '';\n  };\n  input.value = label();\n\n  const list = listFor(input, select.getAttribute('data-empty-text') || 'No match', (item) => {\n    select.value = item.value;\n    input.value = item.label;\n    list.hide();\n    select.dispatchEvent(new Event('change', { bubbles: true }));\n  });\n\n  input.addEventListener('focus', () => {\n    input.select();\n    list.show(options, new Set([select.value]));\n  });\n  input.addEventListener('input', () => list.show(matchOptions(options, input.value), new Set([select.value])));\n  input.addEventListener('keydown', (event) => {\n    if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n      event.preventDefault();\n      if (!list.open) list.show(matchOptions(options, input.value), new Set([select.value]));\n      else list.move(event.key === 'ArrowDown' ? 1 : -1);\n    } else if (event.key === 'Enter' && list.open) {\n      event.preventDefault();\n      list.pick();\n    } else if (event.key === 'Escape' && list.open) {\n      event.preventDefault();\n      list.hide();\n      input.value = label();\n    }\n  });\n  input.addEventListener('blur', () => {\n    // A label typed whole counts as picking it; anything else gives the\n    // value back, rather than post something the list never offered.\n    const typed = input.value.trim().toLowerCase();\n    const exact = options.find((item) => item.label.toLowerCase() === typed);\n    if (exact && exact.value !== select.value) {\n      select.value = exact.value;\n      select.dispatchEvent(new Event('change', { bubbles: true }));\n    }\n    input.value = label();\n    list.hide();\n  });\n}\n\n/**\n * A tag input (`<select multiple data-tags>`).\n *\n * @param {HTMLSelectElement} select - The native control.\n * @returns {void}\n */\nfunction setupTags(select) {\n  const options = optionsOf(select);\n  const exclusive = new Set(options.filter((item) => item.exclusive).map((item) => item.value));\n  const removeText = select.getAttribute('data-remove-text') || 'Remove %s';\n  const control = document.createElement('div');\n  control.className = 'dc-tags';\n  const tags = document.createElement('span');\n  tags.className = 'dc-tags-list';\n  const input = newField('dc-tags-field');\n  input.placeholder = select.getAttribute('data-placeholder') || '';\n  control.append(tags, input);\n  replaceSelect(select, control, input);\n  // The field is not the value: the tags are.\n  input.required = false;\n\n  const chosen = () => Array.from(select.selectedOptions).map((option) => option.value);\n\n  function setValues(values) {\n    const keep = new Set(values);\n    Array.from(select.options).forEach((option) => {\n      option.selected = keep.has(option.value);\n    });\n    paint();\n    select.dispatchEvent(new Event('change', { bubbles: true }));\n  }\n\n  function paint() {\n    tags.replaceChildren();\n    Array.from(select.selectedOptions).forEach((option) => {\n      const text = (option.textContent || '').trim() || option.value;\n      const tag = document.createElement('span');\n      tag.className = 'dc-tag-removable';\n      const name = document.createElement('span');\n      name.textContent = text;\n      const remove = document.createElement('button');\n      remove.type = 'button';\n      remove.className = 'dc-tag-remove';\n      remove.textContent = '×';\n      remove.setAttribute('aria-label', removeText.replace('%s', text));\n      remove.addEventListener('click', (event) => {\n        event.stopPropagation();\n        setValues(chosen().filter((value) => value !== option.value));\n        input.focus();\n      });\n      tag.append(name, remove);\n      tags.append(tag);\n    });\n  }\n\n  const list = listFor(input, select.getAttribute('data-empty-text') || 'No match', (item) => {\n    setValues(addValue(chosen(), item.value, exclusive));\n    input.value = '';\n    list.show(matchOptions(options, '', new Set(chosen())));\n  });\n\n  const offer = () => list.show(matchOptions(options, input.value, new Set(chosen())));\n  control.addEventListener('click', () => input.focus());\n  input.addEventListener('focus', offer);\n  input.addEventListener('input', offer);\n  input.addEventListener('keydown', (event) => {\n    if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n      event.preventDefault();\n      if (!list.open) offer();\n      else list.move(event.key === 'ArrowDown' ? 1 : -1);\n    } else if (event.key === 'Enter') {\n      // Never the form's submit from here: Enter takes the option shown.\n      event.preventDefault();\n      if (list.open && input.value.trim()) list.pick();\n    } else if (event.key === 'Backspace' && !input.value) {\n      const values = chosen();\n      if (values.length) setValues(values.slice(0, -1));\n    } else if (event.key === 'Escape' && list.open) {\n      event.preventDefault();\n      list.hide();\n    }\n  });\n  input.addEventListener('blur', () => {\n    input.value = '';\n    list.hide();\n  });\n  paint();\n}\n\n/**\n * Turn the selects that ask for it into a searchable select or a tag input.\n * Idempotent: a select already done is left alone, so a page can call this\n * again on what it swapped in.\n *\n * @param {ParentNode} [root=document] - Where to look.\n * @returns {void}\n */\nexport function setupChoices(root = document) {\n  root.querySelectorAll('select[data-combo]:not([data-choices-ready])').forEach((select) => {\n    select.setAttribute('data-choices-ready', '');\n    setupCombo(select);\n  });\n  root.querySelectorAll('select[multiple][data-tags]:not([data-choices-ready])').forEach((select) => {\n    select.setAttribute('data-choices-ready', '');\n    setupTags(select);\n  });\n}\n","/**\n * @file file_upload.js\n * @description The \"From the computer…\" button of a file field (dcmod\n * ui.file_field(upload=True)), for the core's pages and the pages of modules\n * alike: the file input hides in the button, and the name of the file chosen\n * goes into the field beside it, so the person sees what will be sent. The\n * file itself is posted as <name>_upload; the field's text is then only a\n * label of it, which the page's server reads after the file.\n */\n\nlet wired = false;\n\n/**\n * Listen, once, for the files chosen in the page's upload buttons.\n *\n * @returns {void}\n */\nexport function setupFileUploads() {\n  if (wired || typeof document === 'undefined') return;\n  wired = true;\n  document.addEventListener('change', (event) => {\n    const input = event.target;\n    if (!(input instanceof HTMLInputElement) || input.type !== 'file' || !input.dataset.uploadInto) return;\n    const field = document.getElementById(input.dataset.uploadInto);\n    const file = input.files && input.files[0];\n    if (!field || !file) return;\n    field.value = file.name;\n    // As if typed: an error on the field goes.\n    field.dispatchEvent(new Event('input', { bubbles: true }));\n  });\n}\n","/**\n * @file required_groups.js\n * @description \"At least one of these\" for a group of checkboxes, which the\n * browser's own checks cannot say: a form is not sent while a group marked\n * `data-required-group` (and in use: not in a disabled fieldset) has no box\n * ticked. Its message (`data-required-message`) shows under the group, as\n * field_errors.js shows the others, and goes once a box is ticked. A group\n * holding no box at all -- nothing to choose from yet -- refuses the same way,\n * with what its message says to do. For the core's pages and modules alike.\n *\n * It listens on the window, in the capture phase, so it speaks before any\n * other handler of the submission: the module frame's, which marks the button\n * busy, and htmx's, which would send the form anyway.\n */\n\nlet wired = false;\n\nfunction lineOf(group) {\n  return group.querySelector(':scope > .dc-field-error[data-required-line]');\n}\n\nfunction clear(group) {\n  const line = lineOf(group);\n  if (line) line.remove();\n  group.removeAttribute('aria-invalid');\n}\n\nfunction refuse(group) {\n  let line = lineOf(group);\n  if (!line) {\n    line = document.createElement('p');\n    line.className = 'dc-field-error';\n    line.setAttribute('data-required-line', '');\n    group.append(line);\n  }\n  line.textContent = group.getAttribute('data-required-message') || '';\n  group.setAttribute('aria-invalid', 'true');\n}\n\n/**\n * Listen, once, for the forms of the page being sent, and for the boxes ticked.\n *\n * @returns {void}\n */\nexport function setupRequiredGroups() {\n  if (wired || typeof document === 'undefined') return;\n  wired = true;\n  window.addEventListener('submit', (event) => {\n    const form = event.target;\n    if (!(form instanceof HTMLFormElement)) return;\n    let first = null;\n    form.querySelectorAll('[data-required-group]').forEach((group) => {\n      if (group.closest('fieldset:disabled')) return;\n      const boxes = Array.from(group.querySelectorAll('input[type=\"checkbox\"]'));\n      if (boxes.some((box) => box.checked)) {\n        clear(group);\n        return;\n      }\n      refuse(group);\n      if (!first) first = group;\n    });\n    if (first) {\n      event.preventDefault();\n      event.stopPropagation();\n      const box = first.querySelector('input[type=\"checkbox\"]');\n      (box || first).focus?.();\n      first.scrollIntoView({ block: 'center', behavior: 'smooth' });\n    }\n  }, true);\n  document.addEventListener('change', (event) => {\n    const box = event.target;\n    if (!(box instanceof HTMLInputElement) || box.type !== 'checkbox' || !box.checked) return;\n    const group = box.closest('[data-required-group]');\n    if (group) clear(group);\n  });\n}\n","/**\n * @file show_when.js\n * @description Parts of a form shown only for some values of another field,\n * for the core's pages and the pages of modules alike -- the common bundle\n * and the modules bundle both run it:\n *\n *   <select name=\"subject_type\">...</select>\n *   <fieldset data-show-when=\"subject_type\" data-show-values=\"entity both\" hidden disabled>\n *     ... the registration number ...\n *   </fieldset>\n *\n * The page renders each part as it should stand for the value it holds; a\n * change of the field shows or hides the parts that name it. A part that is\n * a <fieldset> is disabled while hidden, so its fields are neither posted\n * nor required: what was typed there stays in the page, and comes back when\n * the part does.\n */\n\nlet wired = false;\n\n/**\n * Whether a part is shown for the field's current value.\n *\n * @param {string} values - The part's data-show-values: values apart by spaces.\n * @param {string|string[]} current - The field's value, or a checkbox group's values.\n * @returns {boolean}\n */\nexport function shownFor(values, current) {\n  const wanted = (values || '').split(/\\s+/).filter(Boolean);\n  const held = Array.isArray(current) ? current : [current];\n  return held.some((value) => value !== '' && wanted.includes(value));\n}\n\n/**\n * The value of the field named `name` in a form (or the page): a select's or\n * a text's value, the checked radio's, the checked checkboxes'.\n *\n * @param {ParentNode} scope - The form, or the document.\n * @param {string} name - The field's name.\n * @returns {string|string[]}\n */\nfunction valueOf(scope, name) {\n  const fields = Array.from(scope.querySelectorAll(`[name=\"${CSS.escape(name)}\"]`))\n    .filter((field) => !(field instanceof HTMLInputElement && field.type === 'hidden'));\n  if (!fields.length) return '';\n  const first = fields[0];\n  if (first instanceof HTMLInputElement && first.type === 'radio') {\n    const checked = fields.find((field) => field.checked);\n    return checked ? checked.value : '';\n  }\n  if (first instanceof HTMLInputElement && first.type === 'checkbox') {\n    return fields.filter((field) => field.checked).map((field) => field.value);\n  }\n  return first.value;\n}\n\nfunction apply(part) {\n  const name = part.getAttribute('data-show-when');\n  const scope = part.closest('form') || document;\n  const shown = shownFor(part.getAttribute('data-show-values'), valueOf(scope, name));\n  part.hidden = !shown;\n  if (part instanceof HTMLFieldSetElement) part.disabled = !shown;\n}\n\n/**\n * Bring the parts under `root` in line with their fields -- the browser may\n * have given a field back its value after a reload -- and listen, once, for\n * the changes of the page's fields.\n *\n * @param {ParentNode} [root=document] - Where to look.\n * @returns {void}\n */\nexport function setupShowWhen(root = document) {\n  if (typeof document === 'undefined') return;\n  root.querySelectorAll('[data-show-when]').forEach(apply);\n  if (wired) return;\n  wired = true;\n  const changed = (event) => {\n    const field = event.target;\n    if (!(field instanceof Element) || !field.getAttribute('name')) return;\n    const scope = field.closest('form') || document;\n    scope.querySelectorAll(`[data-show-when=\"${CSS.escape(field.getAttribute('name'))}\"]`).forEach(apply);\n  };\n  document.addEventListener('change', changed);\n  document.addEventListener('input', changed);\n}\n","/**\n * @file slideover.js\n * @description The panel sliding over the right of a page (shared/\n * slideover.css), for the core's pages and the pages of modules alike -- the\n * common bundle and the modules bundle both run it:\n *\n *   <aside id=\"journal\" class=\"dc-slideover\" hidden data-slideover-src=\"/journal\">\n *     <div class=\"dc-slideover-head\">... <button data-slideover-close>\n *     <div class=\"dc-slideover-body\" data-slideover-body></div>\n *   </aside>\n *   <button type=\"button\" data-slideover-open=\"journal\">Journal</button>\n *\n * A click on the opener slides the panel in, and loads its body from\n * `data-slideover-src` each time, so it shows what is current; the page\n * under it is not touched. In a module's frame the request goes through\n * htmx, which carries the frame's sign-in and CSRF value (frame.js); on a\n * page of the core it is a plain same-origin fetch. The cross and Escape\n * close it, and the focus goes back to the opener. A panel the address\n * names (`#journal`) opens with the page: where a form posted from it sends\n * the person back, the panel is there again.\n */\n\nlet wired = false;\nlet opener = null;\n\n/**\n * Fill the body of a panel from its source.\n *\n * @param {HTMLElement} panel - The .dc-slideover.\n * @returns {void}\n */\nfunction load(panel) {\n  const src = panel.getAttribute('data-slideover-src');\n  const body = panel.querySelector('[data-slideover-body]');\n  if (!src || !body) return;\n  const waiting = document.createElement('p');\n  waiting.className = 'dc-slideover-loading';\n  waiting.textContent = panel.getAttribute('data-loading-text') || 'Loading…';\n  body.replaceChildren(waiting);\n  if (window.htmx && typeof window.htmx.ajax === 'function') {\n    window.htmx.ajax('GET', src, { target: body, swap: 'innerHTML' });\n    return;\n  }\n  fetch(src, { credentials: 'same-origin', headers: { 'X-Requested-With': 'XMLHttpRequest' } })\n    .then((response) => (response.ok ? response.text() : Promise.reject(new Error(String(response.status)))))\n    .then((html) => {\n      // The page's own server answering for its own panel.\n      body.innerHTML = html;\n    })\n    .catch(() => {\n      waiting.textContent = panel.getAttribute('data-error-text') || 'Could not be loaded.';\n    });\n}\n\nfunction open(panel, trigger) {\n  // One panel at a time: another one open goes first.\n  document.querySelectorAll('.dc-slideover.is-open').forEach((other) => {\n    if (other !== panel) close(other);\n  });\n  opener = trigger || null;\n  panel.hidden = false;\n  // The panel slides from where it waits, off the edge: one frame there first.\n  requestAnimationFrame(() => panel.classList.add('is-open'));\n  if (trigger) trigger.setAttribute('aria-expanded', 'true');\n  load(panel);\n  const close = panel.querySelector('[data-slideover-close]');\n  if (close) close.focus();\n}\n\n/**\n * Open the panel the address names, if there is one.\n *\n * @returns {void}\n */\nfunction openNamed() {\n  const name = decodeURIComponent((window.location.hash || '').slice(1));\n  const panel = name ? document.getElementById(name) : null;\n  if (panel && panel.classList.contains('dc-slideover') && panel.hidden) open(panel, null);\n}\n\nfunction close(panel) {\n  if (panel.hidden) return;\n  panel.classList.remove('is-open');\n  document.querySelectorAll(`[data-slideover-open=\"${CSS.escape(panel.id)}\"]`).forEach((trigger) => {\n    trigger.setAttribute('aria-expanded', 'false');\n  });\n  const done = () => {\n    if (!panel.classList.contains('is-open')) panel.hidden = true;\n  };\n  panel.addEventListener('transitionend', done, { once: true });\n  // No transition to wait for (reduced motion): hidden at once.\n  setTimeout(done, 300);\n  if (opener && document.contains(opener)) opener.focus();\n  opener = null;\n  // Closed, it is no longer what the address names: a reload leaves it shut.\n  if (window.location.hash === `#${panel.id}`) {\n    window.history.replaceState(window.history.state, '', window.location.pathname + window.location.search);\n  }\n}\n\n/**\n * Listen for the openers and closers of the page, once: by delegation, so\n * an opener swapped in later works too.\n *\n * @returns {void}\n */\nexport function setupSlideovers() {\n  if (typeof document === 'undefined') return;\n  if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', openNamed, { once: true });\n  else openNamed();\n  if (wired) return;\n  wired = true;\n  document.addEventListener('click', (event) => {\n    const target = event.target instanceof Element ? event.target : null;\n    if (!target) return;\n    const trigger = target.closest('[data-slideover-open]');\n    if (trigger) {\n      const panel = document.getElementById(trigger.getAttribute('data-slideover-open'));\n      if (!panel || !panel.classList.contains('dc-slideover')) return;\n      event.preventDefault();\n      if (panel.hidden) open(panel, trigger);\n      else close(panel);\n      return;\n    }\n    const closer = target.closest('[data-slideover-close]');\n    if (closer) {\n      const panel = closer.closest('.dc-slideover');\n      if (panel) close(panel);\n    }\n  });\n  document.addEventListener('keydown', (event) => {\n    if (event.key !== 'Escape') return;\n    const panel = document.querySelector('.dc-slideover.is-open');\n    if (panel) close(panel);\n  });\n}\n","/**\n * @file targets.js\n * @description The rows a link of the same page points at (`.dc-targetable`,\n * shared/controls.css): each arrival rings the row again -- a second click on\n * the same link included, which the `:target` of CSS does not redo -- and\n * brings it into view, for the core's pages and the pages of modules alike.\n */\n\nlet wired = false;\n\n/**\n * Ring the row `id` names, and bring it into view.\n *\n * @param {string} id - The row's id.\n * @returns {void}\n */\nfunction reach(id) {\n  const row = id ? document.getElementById(id) : null;\n  if (!row || !row.classList.contains('dc-targetable')) return;\n  row.classList.remove('is-reached');\n  // A reflow between the two: the animation starts over.\n  void row.offsetWidth;\n  row.classList.add('is-reached');\n  row.scrollIntoView({ block: 'start', behavior: 'smooth' });\n}\n\n/**\n * Listen, once, for the links of the page to its own rows.\n *\n * @returns {void}\n */\nexport function setupTargets() {\n  if (wired || typeof document === 'undefined') return;\n  wired = true;\n  document.addEventListener('click', (event) => {\n    const link = event.target instanceof Element ? event.target.closest('a[href^=\"#\"]') : null;\n    if (!link || link.hasAttribute('data-slideover-open')) return;\n    const id = decodeURIComponent(link.getAttribute('href').slice(1));\n    const row = id ? document.getElementById(id) : null;\n    if (!row || !row.classList.contains('dc-targetable')) return;\n    event.preventDefault();\n    window.history.replaceState(window.history.state, '', `#${id}`);\n    reach(id);\n  });\n  // Arriving with the address naming a row (a form posted, then back on it).\n  const named = decodeURIComponent((window.location.hash || '').slice(1));\n  if (named) {\n    if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', () => reach(named), { once: true });\n    else reach(named);\n  }\n}\n","/**\n * The stylesheet of module pages (todo/module-support.md, section 7): the\n * product's fonts and src/css/modules.css; and the core's components that\n * need a script, the same code as on the core's own pages: the searchable\n * select and the tag input (ui/choices.js), the panel sliding over the\n * right (ui/slideover.js), the parts of a form shown for some values of a\n * field (ui/show_when.js), and the fields in error, which leave it once\n * edited (field_errors.js). A module page runs no JavaScript of its own:\n * this bundle, the frame script and htmx are the core's. Django reaches the\n * hashed URLs through file/modules/assets.py, which also names the script\n * in the frame's CSP.\n */\nimport '@fontsource/instrument-sans/400.css';\nimport '@fontsource/instrument-sans/500.css';\nimport '@fontsource/instrument-sans/600.css';\nimport '@fontsource/jetbrains-mono/400.css';\nimport '@fontsource/jetbrains-mono/500.css';\nimport '../css/modules.css';\n\nimport { setupFieldValidation } from './field_errors';\nimport { setupChoices } from './ui/choices';\nimport { setupFileUploads } from './ui/file_upload';\nimport { setupRequiredGroups } from './ui/required_groups';\nimport { setupShowWhen } from './ui/show_when';\nimport { setupSlideovers } from './ui/slideover';\nimport { setupTargets } from './ui/targets';\n\n\n// On the page as it came, then on what htmx swaps in.\nif (typeof document !== 'undefined') {\n  setupSlideovers();\n  setupFieldValidation();\n  setupFileUploads();\n  setupTargets();\n  setupRequiredGroups();\n  const wire = (root) => {\n    setupChoices(root);\n    setupShowWhen(root);\n  };\n  if (document.readyState === 'loading') {\n    document.addEventListener('DOMContentLoaded', () => wire(document));\n  } else {\n    wire(document);\n  }\n  document.addEventListener('htmx:afterSettle', (event) => wire(event.target || document));\n  // What the frame script swaps in for a search of the top bar (frame.js).\n  document.addEventListener('dcmod:swapped', (event) => wire((event.detail && event.detail.node) || document));\n}\n"],"names":["LINE_ATTR","SOURCE_ATTR","describedBy","field","getAttribute","split","filter","Boolean","setDescribedBy","ids","length","setAttribute","join","removeAttribute","isRow","element","style","getComputedStyle","display","includes","gridTemplateColumns","trim","flexDirection","startsWith","hasOverlay","parent","node","Array","from","children","some","child","position","setFieldError","message","source","previous","line","document","getElementById","createElement","id","Math","random","toString","slice","className","previousSibling","climbed","parentElement","body","lineAnchor","nextElementSibling","classList","contains","after","concat","textContent","KEY","fold","text","String","normalize","replace","toLowerCase","matchOptions","options","left","Set","words","kept","option","has","value","first","rest","forEach","label","every","word","push","RegExp","serial","optionsOf","select","disabled","map","exclusive","hasAttribute","listFor","input","emptyText","onPick","list","hidden","append","items","active","paintActive","row","index","toggle","scrollIntoView","block","api","open","show","found","selected","replaceChildren","empty","item","addEventListener","event","preventDefault","findIndex","box","getBoundingClientRect","width","below","window","innerHeight","bottom","top","place","hide","move","step","pick","target","replaceSelect","control","before","tabIndex","name","dispatchEvent","Event","bubbles","required","newField","type","autocomplete","spellcheck","setupChoices","root","querySelectorAll","placeholder","chosen","selectedOptions","key","typed","exact","find","setupCombo","removeText","tags","setValues","values","keep","paint","tag","remove","stopPropagation","focus","addValue","offer","setupTags","wired","required_groups_wired","lineOf","group","querySelector","clear","show_when_wired","apply","part","scope","closest","shown","current","wanted","isArray","shownFor","fields","CSS","escape","HTMLInputElement","checked","show_when_valueOf","HTMLFieldSetElement","slideover_wired","slideover_opener","slideover_open","panel","trigger","other","close","requestAnimationFrame","add","src","waiting","htmx","ajax","swap","fetch","credentials","headers","then","response","ok","Promise","reject","Error","status","html","innerHTML","catch","load","openNamed","decodeURIComponent","location","hash","slideover_close","done","once","setTimeout","history","replaceState","state","pathname","search","targets_wired","reach","offsetWidth","behavior","readyState","Element","closer","focusTaken","matches","validationMessage","recheck","validity","valid","x","clearFieldError","setupFieldValidation","dataset","uploadInto","file","files","link","named","setupTargets","form","HTMLFormElement","refuse","wire","changed","setupShowWhen","detail"],"sourceRoot":""}