{"version":3,"file":"esnext.min.js","sources":["js/i18n/datepicker/jquery.ui.datepicker-nl.js","js/lib/gettext.js","js/i18n/nl.js","js/lib/polyfills/url-search-params.js","js/lib/tokenize.js","js/lib/mode.js","js/lib/a11y-user-detect.js","js/lib/a11y.js","js/lib/escape.js","js/lib/notify.js","js/lib/lenses.js","js/lib/functional.js","js/lib/conf.js","js/lib/location.js","js/lib/ajax.js","js/lib/settled.js","js/lib/bbi.js","js/lib/collect-values.js","js/lib/control-helpers.js","js/lib/text-utils.js","js/lib/dates.js","js/lib/feature-queries.js","js/lib/form-widgets.js","js/lib/dynprops.js","js/lib/hooks.js","js/lib/control.js","js/lib/types.js","js/lib/groupings.js","js/lib/font-classes.js","js/lib/names.js","js/lib/form-groups.js","js/lib/numerals.js","js/lib/vars.js","js/lib/url-utils.js","js/lib/form-widgets-definitions.js","js/lib/utils.js","js/lib/jumplist.js","js/json.js","js/lib/$.scrollTo.js","js/lib/control-validation.js","plugins/Dialogue/Dialogue.js","plugins/a11y-describedby/a11y-describedby.js","js/lib/getmetadata.js","plugins/all-or-nothing-anywhere/all-or-nothing-anywhere.js","custom/ap/plugins/i18n/i18n.js","custom/ap/plugins/switch-icon/switch-icon.js","plugins/array._groupby/array._groupby.js","plugins/auto-next-when-only-radio/auto-next-when-only-radio.js","plugins/auto-scroll/auto-scroll.js","plugins/bb-input-wrap-and-unit/bb-input-wrap-and-unit.js","custom/template-toggle-clean/plugins/case-filter-extra/case-filter-extra.js","plugins/mustache/mustache.js","plugins/change-anything-earlier-then-next/change-anything-earlier-then-next.js","node_modules/ramda/es/internal/_isPlaceholder.js","node_modules/ramda/es/internal/_curry1.js","node_modules/ramda/es/internal/_curry2.js","node_modules/ramda/es/internal/_arity.js","node_modules/ramda/es/internal/_curryN.js","plugins/case-template/case-template.js","plugins/chapters/chapters.js","node_modules/ramda/es/curryN.js","node_modules/ramda/es/internal/_curry3.js","node_modules/ramda/es/internal/_isArray.js","node_modules/ramda/es/internal/_isTransformer.js","node_modules/ramda/es/internal/_dispatchable.js","node_modules/ramda/es/internal/_xfBase.js","node_modules/ramda/es/internal/_isArrayLike.js","node_modules/ramda/es/internal/_isString.js","node_modules/ramda/es/internal/_xwrap.js","node_modules/ramda/es/bind.js","node_modules/ramda/es/internal/_reduce.js","node_modules/ramda/es/internal/_xmap.js","node_modules/ramda/es/internal/_has.js","node_modules/ramda/es/internal/_isArguments.js","node_modules/ramda/es/keys.js","node_modules/ramda/es/map.js","node_modules/ramda/es/internal/_map.js","node_modules/ramda/es/reduce.js","node_modules/ramda/es/internal/_pipe.js","node_modules/ramda/es/internal/_checkForMethod.js","node_modules/ramda/es/slice.js","node_modules/ramda/es/tail.js","node_modules/ramda/es/internal/_xfilter.js","node_modules/ramda/es/filter.js","node_modules/ramda/es/internal/_isObject.js","node_modules/ramda/es/internal/_filter.js","node_modules/ramda/es/hasPath.js","node_modules/ramda/es/has.js","plugins/checkboxes-like-radios/checkboxes-like-radios.js","plugins/custom-checkboxes/custom-checkboxes.js","plugins/custom-radios/custom-radios.js","plugins/close-caseslist/close-caseslist.js","plugins/collapsable-jumplist/collapsable-jumplist.js","plugins/convert-metadata/convert-metadata.js","node_modules/print-js/dist/print.js","plugins/end-tools/end-tools.js","plugins/grid-tabs/grid-tabs.js","custom/template-toggle-clean/plugins/has-no-next/has-no-next.js","plugins/has-required/has-required.js","plugins/headings/headings.js","plugins/history/history.js","node_modules/markdown-it/lib/common/entities.js","node_modules/uc.micro/categories/P/regex.js","node_modules/mdurl/encode.js","node_modules/mdurl/decode.js","node_modules/mdurl/parse.js","node_modules/mdurl/index.js","node_modules/mdurl/format.js","node_modules/uc.micro/properties/Any/regex.js","node_modules/uc.micro/categories/Cc/regex.js","node_modules/uc.micro/categories/Z/regex.js","node_modules/uc.micro/index.js","node_modules/uc.micro/categories/Cf/regex.js","node_modules/markdown-it/lib/common/utils.js","node_modules/markdown-it/lib/helpers/parse_link_destination.js","node_modules/markdown-it/lib/helpers/parse_link_title.js","node_modules/markdown-it/lib/helpers/index.js","node_modules/markdown-it/lib/helpers/parse_link_label.js","node_modules/markdown-it/lib/renderer.js","node_modules/markdown-it/lib/ruler.js","node_modules/markdown-it/lib/rules_core/normalize.js","node_modules/markdown-it/lib/rules_core/linkify.js","node_modules/markdown-it/lib/rules_core/replacements.js","node_modules/markdown-it/lib/rules_core/smartquotes.js","node_modules/markdown-it/lib/token.js","node_modules/markdown-it/lib/rules_core/state_core.js","node_modules/markdown-it/lib/parser_core.js","node_modules/markdown-it/lib/rules_core/block.js","node_modules/markdown-it/lib/rules_core/inline.js","node_modules/markdown-it/lib/rules_block/table.js","node_modules/markdown-it/lib/rules_block/blockquote.js","node_modules/markdown-it/lib/rules_block/hr.js","node_modules/markdown-it/lib/rules_block/list.js","node_modules/markdown-it/lib/rules_block/reference.js","node_modules/markdown-it/lib/common/html_re.js","node_modules/markdown-it/lib/rules_block/html_block.js","node_modules/markdown-it/lib/common/html_blocks.js","node_modules/markdown-it/lib/rules_block/heading.js","node_modules/markdown-it/lib/rules_block/state_block.js","node_modules/markdown-it/lib/parser_block.js","node_modules/markdown-it/lib/rules_block/code.js","node_modules/markdown-it/lib/rules_block/fence.js","node_modules/markdown-it/lib/rules_block/lheading.js","node_modules/markdown-it/lib/rules_block/paragraph.js","node_modules/markdown-it/lib/rules_inline/text.js","node_modules/markdown-it/lib/rules_inline/escape.js","node_modules/markdown-it/lib/rules_inline/newline.js","node_modules/markdown-it/lib/rules_inline/strikethrough.js","node_modules/markdown-it/lib/rules_inline/emphasis.js","node_modules/markdown-it/lib/rules_inline/link.js","node_modules/markdown-it/lib/rules_inline/image.js","node_modules/markdown-it/lib/rules_inline/autolink.js","node_modules/markdown-it/lib/rules_inline/html_inline.js","node_modules/markdown-it/lib/rules_inline/entity.js","node_modules/markdown-it/lib/rules_inline/balance_pairs.js","node_modules/markdown-it/lib/rules_inline/state_inline.js","node_modules/markdown-it/lib/parser_inline.js","node_modules/markdown-it/lib/rules_inline/backticks.js","node_modules/markdown-it/lib/rules_inline/text_collapse.js","node_modules/linkify-it/index.js","node_modules/linkify-it/lib/re.js","node_modules/punycode/punycode.es6.js","node_modules/markdown-it/lib/index.js","node_modules/markdown-it/lib/presets/default.js","node_modules/markdown-it/lib/presets/zero.js","node_modules/markdown-it/lib/presets/commonmark.js","plugins/markdown-it-converter/markdown-it-converter.js","plugins/metarestart/metarestart.js","plugins/info-inline/info-inline.js","plugins/jump-node/jump-node.js","plugins/max-chars-indicator/max-chars-indicator.js","plugins/md-labels/md-labels.js","plugins/metadata-change-navtext/metadata-change-navtext.js","plugins/model-filter/model-filter.js","plugins/modelinfo/modelinfo.js","plugins/modelitem/modelitem.js","plugins/open/open.js","plugins/previews/previews.js","plugins/progressbar/progressbar.js","plugins/questionlabelgroup-ng/questionlabelgroup-ng.js","plugins/session-timeout-indicator/session-timeout-indicator.js","plugins/show-server-side-validation/show-server-side-validation.js","custom/template-toggle-clean/plugins/tabs/tabs.js","plugins/uploads/interoperable-filename.js","node_modules/redux/es/redux.mjs","node_modules/lit-html/lit-html.js","node_modules/@lit/reactive-element/css-tag.js","node_modules/@lit/reactive-element/reactive-element.js","node_modules/lit-element/lit-element.js","node_modules/lit-html/directive.js","node_modules/lit-html/directives/class-map.js","node_modules/lit-html/directives/unsafe-html.js","node_modules/lit-html/directive-helpers.js","node_modules/lit-html/directives/live.js","plugins/uploads/uploads.js","node_modules/ramda/es/pipe.js","plugins/warn-before-closing-tab/warn-before-closing-tab.js","plugins/wrap-table/wrap-table.js"],"sourcesContent":["/* Dutch (UTF-8) initialisation for the jQuery UI date picker plugin. */\n/* Written by Mathias Bynens */\njQuery(function($){\n\t$.datepicker.regional.nl = {\n\t\tcloseText: 'Sluiten',\n\t\tprevText: '←',\n\t\tnextText: '→',\n\t\tcurrentText: 'Vandaag',\n\t\tmonthNames: ['januari', 'februari', 'maart', 'april', 'mei', 'juni',\n\t\t'juli', 'augustus', 'september', 'oktober', 'november', 'december'],\n\t\tmonthNamesShort: ['jan', 'feb', 'mrt', 'apr', 'mei', 'jun',\n\t\t'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],\n\t\tdayNames: ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'],\n\t\tdayNamesShort: ['zon', 'maa', 'din', 'woe', 'don', 'vri', 'zat'],\n\t\tdayNamesMin: ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'],\n\t\tweekHeader: 'Wk',\n\t\tdateFormat: 'dd-mm-yy',\n\t\tfirstDay: 1,\n\t\tisRTL: false,\n\t\tshowMonthAfterYear: false,\n\t\tyearSuffix: ''};\n\t$.datepicker.setDefaults($.datepicker.regional.nl);\n});\n","/******* Translations ******/\n\nconst dict = {};\n\n// gettext stub\nfunction _(s, fb) {\n return dict[s] || fb || s;\n}\n\n_.tagged = (strings, ...values) =>\n strings.reduce((acc, cur, idx) => acc + cur + _(values[idx] || \"\"), \"\");\n\n_.taggedWithin = prefix => (strings, ...values) =>\n strings.reduce(\n (acc, cur, idx) =>\n acc +\n cur +\n (_(prefix, { [values[idx]]: values[idx] })[values[idx]] ||\n values[idx] ||\n \"\"),\n \"\"\n );\n\n_.set = function (ob) {\n for (let [key, val] of Object.entries(ob)) {\n dict[key] = val;\n }\n};\n_.addTranslations = function (translations) {\n var lang = _(\"lang\");\n for (var term in translations) {\n if (translations.hasOwnProperty(term))\n if (translations[term][lang]) dict[term] = translations[term][lang];\n }\n};\n_.addTranslation = function (from, to) {\n dict[from] = to;\n};\n\nObject.freeze(_);\n\nexport { _ };\n","import { _ } from \"$json/lib/gettext\";\n\n_.set({\n \"lang\": \"nl\",\n \"Input required\": \"Invoer verplicht\",\n \"Choice required\": \"Keuze verplicht\",\n \"Doubleclick to go back to this question\":\n \"Dubbelklikken om naar deze vraag terug te springen\",\n \"create a new case\": \"maak een nieuwe casus aan\",\n \"new\": \"nieuw\",\n \"Delete\": \"Verwijder\",\n \"case\": \"casus\",\n \"cases\": \"casus\",\n \"Last opened\": \"Laatst geopend\",\n \"created\": \"gemaakt\",\n \"report\": \"rapport\",\n \"Sun\": \"Zo\",\n \"Mon\": \"Ma\",\n \"Tue\": \"Di\",\n \"Wed\": \"Wo\",\n \"Thu\": \"Do\",\n \"Fri\": \"Vr\",\n \"Sat\": \"Za\",\n \"Jan\": \"Jan\",\n \"Feb\": \"Feb\",\n \"Mar\": \"Maart\",\n \"Apr\": \"April\",\n \"May\": \"Mei\",\n \"June\": \"Juni\",\n \"July\": \"Juli\",\n \"Aug\": \"Aug\",\n \"Sep\": \"Sep\",\n \"Oct\": \"Okt\",\n \"Nov\": \"Nov\",\n \"Dec\": \"Dec\",\n \"press enter to accept\": \"accepteer met ENTER\",\n \"filter cases by name\": \"zoek casus op naam\",\n \"Value has to lie between {0} and {1}\":\n \"Waarde moet tussen {0} en {1} liggen\",\n \"Date has to lie between {0} and {1}\": \"Datum moet tussen {0} en {1} liggen\",\n\n \"Negative number or zero expected\": \"Getal moet negatief zijn of nul\",\n \"Negative number expected\": \"Getal moet negatief zijn\",\n \"Value has to lie below {0}\": \"Getal moet lager zijn dan {0}\",\n \"Positive number or zero expected\": \"Getal moet positief zijn of nul\",\n \"Positive number expected\": \"Getal moet positief zijn\",\n \"Value has to lie above {0}\": \"Getal moet hoger zijn dan {0}\",\n \"A date after {0} is not allowed\": \"Datum ná {0} is niet toegestaan\",\n\n \"A date before {0} is not allowed\": \"Datum vóór {0} is niet toegestaan\",\n \"Invalid date\": \"Ongeldige datum\",\n \"click for more...\": \"klik voor meer...\",\n \" (click to open link)\": \" (klik om link te openen)\",\n \"Are you sure? This will reset all values.\":\n \"Weet u het zeker? Dit zal alle ingevulde velden leegmaken.\",\n \"Yesterday\": \"Gisteren\",\n \"No valid session\": \"Ongeldige gebruikersnaam of wachtwoord\",\n \"Text length exceeds the maximum of {0} characters\":\n \"Deze tekst mag maximaal {0} karakters bevatten\",\n \"Maximum allowed characters: {0}\": \"Maximaal {0} karakters toegestaan\",\n \"No interfaces to show\":\n \"Geen zichtbare elementen (vragen, tekstvelden) gedefinieerd\",\n // feedback\n \"Feedback\": \"Feedback\",\n \"describe the problem\": \"omschrijf het probleem\",\n \"Please do not collate issues.\": \"Een melding per keer!\",\n \"Please send only feedback about the currently visible question or questions; information about these will be sent back to the developers.\":\n \"Geef alleen feedback over de vraag of vragen die je op dit moment op je scherm ziet; informatie over die vragen wordt namelijk meegezonden naar de ontwikkelaars.\",\n \"send\": \"verstuur\",\n \"Thanks for your feedback!\": \"Bedankt voor uw melding!\",\n \"Interface has failed (probably a failing SOAP or database connection)\":\n \"Interface gefaald (waarschijnlijk een falende SOAP- of databasekoppeling)\",\n \"Choose...\": \"Kies...\",\n \"Choose or type...\": \"Kies of typ...\",\n \"cUMWrongUserNamePassword\": \"Ongeldige gebruikersnaam of wachtwoord\",\n \"cWebCaseIsRunning\":\n \"Casus laden is niet gelukt; deze casus wordt al gedraaid in een andere sessie\",\n \"The model you are trying to open does not exist\":\n \"Het beslismodel dat u probeert te openen bestaat niet\",\n \"You may now safely close this window\": \"U kunt het venster nu sluiten\",\n \"user name\": \"gebruikersnaam\",\n \"password\": \"wachtwoord\",\n \"Your models\": \"Uw modellen\",\n \"Your sessions\": \"Uw sessies\",\n \"log in\": \"inloggen\",\n \"load session\": \"Lees uw gegevens in\",\n \"load\": \"inlezen\",\n \"Choose the session file you saved earlier\":\n \"Kies het gegevensbestand dat u de vorige keer hebt opgeslagen\",\n \"Error loading session (wrong data)\":\n \"Inlezen gegevens mislukt (verkeerde gegevens).\",\n \"Please login\": \"Gelieve in te loggen\",\n \"open\": \"open\",\n \"copy\": \"kopie\",\n 'You have no tickets left for model \"{0}\"':\n 'Uw strippenkaart voor model \"{0}\" is op',\n \"__digitgroupingchar__\": \".\",\n \"__radixpoint__\": \",\",\n \"__digitgroupingrules__\": [3],\n \"Invalid number\": \"Ongeldig getal\",\n \"attachments\": \"bijlagen\",\n \"your documents\": \"uw documenten\",\n \"saved sessions\": \"bewaarde sessies\",\n \"We are currently updating. Please try again later.\":\n \"Er is momenteel een update aan de gang, probeert u het binnenkort nogmaals.\",\n \"case name\": \"casusnaam\",\n \"dateplaceholder\": \"dd - mm - j j j j\",\n \"Error: No response from server, server probably down\":\n \"Fout: Server is tijdelijk buiten gebruik. U moet zich opnieuw aanmelden.\",\n \"Session has timed out. Please log in again.\":\n \"De sessie is afgelopen. U moet zich opnieuw aanmelden.\",\n \"first {0} results\": \"eerste {0} resultaten\",\n \"previous {0} results\": \"vorige {0} resultaten\",\n \"next {0} results\": \"volgende {0} resultaten\",\n \"last {0} results\": \"laatste {0} resultaten\",\n \"results {0} to {1} from {2}\": \"resultaten {0} tot {1} van {2}\",\n \"add row\": \"Voeg rij toe\",\n \"insert row\": \"voeg rij in\",\n \"delete row\": \"verwijder rij\",\n \"There are errors, please double check your answers.\":\n \"Er zijn nog fouten, gelieve uw antwoorden nogmaals na te gaan.\",\n \"cancel\": \"annuleer\"\n});\n","/*! (c) Andrea Giammarchi - ISC */\nvar self = window || /* istanbul ignore next */ {};\ntry {\n (function (URLSearchParams, plus) {\n if (\n new URLSearchParams('q=%2B').get('q') !== plus ||\n new URLSearchParams({q: plus}).get('q') !== plus ||\n new URLSearchParams([['q', plus]]).get('q') !== plus ||\n new URLSearchParams('q=\\n').toString() !== 'q=%0A' ||\n new URLSearchParams({q: ' &'}).toString() !== 'q=+%26' ||\n new URLSearchParams({q: '%zx'}).toString() !== 'q=%25zx'\n )\n throw URLSearchParams;\n self.URLSearchParams = URLSearchParams;\n }(URLSearchParams, '+'));\n} catch(URLSearchParams) {\n (function (Object, String, isArray) {'use strict';\n var create = Object.create;\n var defineProperty = Object.defineProperty;\n var find = /[!'\\(\\)~]|%20|%00/g;\n var findPercentSign = /%(?![0-9a-fA-F]{2})/g;\n var plus = /\\+/g;\n var replace = {\n '!': '%21',\n \"'\": '%27',\n '(': '%28',\n ')': '%29',\n '~': '%7E',\n '%20': '+',\n '%00': '\\x00'\n };\n var proto = {\n append: function (key, value) {\n appendTo(this._ungap, key, value);\n },\n delete: function (key) {\n delete this._ungap[key];\n },\n get: function (key) {\n return this.has(key) ? this._ungap[key][0] : null;\n },\n getAll: function (key) {\n return this.has(key) ? this._ungap[key].slice(0) : [];\n },\n has: function (key) {\n return key in this._ungap;\n },\n set: function (key, value) {\n this._ungap[key] = [String(value)];\n },\n forEach: function (callback, thisArg) {\n var self = this;\n for (var key in self._ungap)\n self._ungap[key].forEach(invoke, key);\n function invoke(value) {\n callback.call(thisArg, value, String(key), self);\n }\n },\n toJSON: function () {\n return {};\n },\n toString: function () {\n var query = [];\n for (var key in this._ungap) {\n var encoded = encode(key);\n for (var\n i = 0,\n value = this._ungap[key];\n i < value.length; i++\n ) {\n query.push(encoded + '=' + encode(value[i]));\n }\n }\n return query.join('&');\n }\n };\n for (var key in proto)\n defineProperty(URLSearchParams.prototype, key, {\n configurable: true,\n writable: true,\n value: proto[key]\n });\n self.URLSearchParams = URLSearchParams;\n function URLSearchParams(query) {\n var dict = create(null);\n defineProperty(this, '_ungap', {value: dict});\n switch (true) {\n case !query:\n break;\n case typeof query === 'string':\n if (query.charAt(0) === '?') {\n query = query.slice(1);\n }\n for (var\n pairs = query.split('&'),\n i = 0,\n length = pairs.length; i < length; i++\n ) {\n var value = pairs[i];\n var index = value.indexOf('=');\n if (-1 < index) {\n appendTo(\n dict,\n decode(value.slice(0, index)),\n decode(value.slice(index + 1))\n );\n } else if (value.length){\n appendTo(\n dict,\n decode(value),\n ''\n );\n }\n }\n break;\n case isArray(query):\n for (var\n i = 0,\n length = query.length; i < length; i++\n ) {\n var value = query[i];\n appendTo(dict, value[0], value[1]);\n }\n break;\n case 'forEach' in query:\n query.forEach(addEach, dict);\n break;\n default:\n for (var key in query)\n appendTo(dict, key, query[key]);\n }\n }\n\n function addEach(value, key) {\n appendTo(this, key, value);\n }\n\n function appendTo(dict, key, value) {\n var res = isArray(value) ? value.join(',') : value;\n if (key in dict)\n dict[key].push(res);\n else\n dict[key] = [res];\n }\n\n function decode(str) {\n return decodeURIComponent(str.replace(findPercentSign, '%25').replace(plus, ' '));\n }\n\n function encode(str) {\n return encodeURIComponent(str).replace(find, replacer);\n }\n\n function replacer(match) {\n return replace[match];\n }\n\n }(Object, String, Array.isArray));\n}\n\n(function (URLSearchParamsProto) {\n\n var iterable = false;\n try { iterable = !!Symbol.iterator; } catch (o_O) {}\n\n /* istanbul ignore else */\n if (!('forEach' in URLSearchParamsProto)) {\n URLSearchParamsProto.forEach = function forEach(callback, thisArg) {\n var self = this;\n var names = Object.create(null);\n this.toString()\n .replace(/=[\\s\\S]*?(?:&|$)/g, '=')\n .split('=')\n .forEach(function (name) {\n if (!name.length || name in names)\n return;\n (names[name] = self.getAll(name)).forEach(function(value) {\n callback.call(thisArg, value, name, self);\n });\n });\n };\n }\n\n /* istanbul ignore else */\n if (!('keys' in URLSearchParamsProto)) {\n URLSearchParamsProto.keys = function keys() {\n return iterator(this, function(value, key) { this.push(key); });\n };\n }\n\n /* istanbul ignore else */\n if (!('values' in URLSearchParamsProto)) {\n URLSearchParamsProto.values = function values() {\n return iterator(this, function(value, key) { this.push(value); });\n };\n }\n\n /* istanbul ignore else */\n if (!('entries' in URLSearchParamsProto)) {\n URLSearchParamsProto.entries = function entries() {\n return iterator(this, function(value, key) { this.push([key, value]); });\n };\n }\n\n /* istanbul ignore else */\n if (iterable && !(Symbol.iterator in URLSearchParamsProto)) {\n URLSearchParamsProto[Symbol.iterator] = URLSearchParamsProto.entries;\n }\n\n /* istanbul ignore else */\n if (!('sort' in URLSearchParamsProto)) {\n URLSearchParamsProto.sort = function sort() {\n var\n entries = this.entries(),\n entry = entries.next(),\n done = entry.done,\n keys = [],\n values = Object.create(null),\n i, key, value\n ;\n while (!done) {\n value = entry.value;\n key = value[0];\n keys.push(key);\n if (!(key in values)) {\n values[key] = [];\n }\n values[key].push(value[1]);\n entry = entries.next();\n done = entry.done;\n }\n // not the champion in efficiency\n // but these two bits just do the job\n keys.sort();\n for (i = 0; i < keys.length; i++) {\n this.delete(keys[i]);\n }\n for (i = 0; i < keys.length; i++) {\n key = keys[i];\n this.append(key, values[key].shift());\n }\n };\n }\n\n function iterator(self, callback) {\n var items = [];\n self.forEach(callback, items);\n return iterable ?\n items[Symbol.iterator]() :\n {\n next: function() {\n var value = items.shift();\n return {done: value === undefined, value: value};\n }\n };\n }\n\n /* istanbul ignore next */\n (function (Object) {\n var\n dP = Object.defineProperty,\n gOPD = Object.getOwnPropertyDescriptor,\n createSearchParamsPollute = function (search) {\n function append(name, value) {\n URLSearchParamsProto.append.call(this, name, value);\n name = this.toString();\n search.set.call(this._usp, name ? ('?' + name) : '');\n }\n function del(name) {\n URLSearchParamsProto.delete.call(this, name);\n name = this.toString();\n search.set.call(this._usp, name ? ('?' + name) : '');\n }\n function set(name, value) {\n URLSearchParamsProto.set.call(this, name, value);\n name = this.toString();\n search.set.call(this._usp, name ? ('?' + name) : '');\n }\n return function (sp, value) {\n sp.append = append;\n sp.delete = del;\n sp.set = set;\n return dP(sp, '_usp', {\n configurable: true,\n writable: true,\n value: value\n });\n };\n },\n createSearchParamsCreate = function (polluteSearchParams) {\n return function (obj, sp) {\n dP(\n obj, '_searchParams', {\n configurable: true,\n writable: true,\n value: polluteSearchParams(sp, obj)\n }\n );\n return sp;\n };\n },\n updateSearchParams = function (sp) {\n var append = sp.append;\n sp.append = URLSearchParamsProto.append;\n URLSearchParams.call(sp, sp._usp.search.slice(1));\n sp.append = append;\n },\n verifySearchParams = function (obj, Class) {\n if (!(obj instanceof Class)) throw new TypeError(\n \"'searchParams' accessed on an object that \" +\n \"does not implement interface \" + Class.name\n );\n },\n upgradeClass = function (Class) {\n var\n ClassProto = Class.prototype,\n searchParams = gOPD(ClassProto, 'searchParams'),\n href = gOPD(ClassProto, 'href'),\n search = gOPD(ClassProto, 'search'),\n createSearchParams\n ;\n if (!searchParams && search && search.set) {\n createSearchParams = createSearchParamsCreate(\n createSearchParamsPollute(search)\n );\n Object.defineProperties(\n ClassProto,\n {\n href: {\n get: function () {\n return href.get.call(this);\n },\n set: function (value) {\n var sp = this._searchParams;\n href.set.call(this, value);\n if (sp) updateSearchParams(sp);\n }\n },\n search: {\n get: function () {\n return search.get.call(this);\n },\n set: function (value) {\n var sp = this._searchParams;\n search.set.call(this, value);\n if (sp) updateSearchParams(sp);\n }\n },\n searchParams: {\n get: function () {\n verifySearchParams(this, Class);\n return this._searchParams || createSearchParams(\n this,\n new URLSearchParams(this.search.slice(1))\n );\n },\n set: function (sp) {\n verifySearchParams(this, Class);\n createSearchParams(this, sp);\n }\n }\n }\n );\n }\n }\n ;\n try {\n upgradeClass(HTMLAnchorElement);\n if (/^function|object$/.test(typeof URL) && URL.prototype)\n upgradeClass(URL);\n } catch (meh) {}\n }(Object));\n\n}(self.URLSearchParams.prototype, Object));\nexport default self.URLSearchParams;\n","/**\n * Tokenize a string on whitespace\n * @function tokenize\n * @param {string} s String to tokenize\n * @return {array} Zero or more tokens\n */\nfunction tokenize(s) {\n if (typeof s !== \"string\") return [];\n return s.split(/\\s+/).filter(Boolean);\n}\n\nexport { tokenize };\n","import { tokenize } from \"./tokenize.js\";\n\nvar mode = function () {\n var modes = {};\n var Mode = this;\n function aTokenApplies(tokens) {\n return !!tokens.find(Mode.get);\n }\n this.get = function (mode) {\n return modes[mode];\n };\n this.toggle = function (mode, bool) {\n bool = typeof bool === \"boolean\" ? bool : !this.get(mode);\n // Refrain from unnecessary redraw (by checking previous value):\n if (bool !== this.get(mode)) {\n $(document).trigger(\"bb:mode:\" + mode, bool);\n $(\"body\").toggleClass(mode, bool);\n modes[mode] = bool;\n // ON\n if (bool) {\n // HIDE-WHEN ON always supercedes WHEN\n $('[data-hide-when~=\"' + mode + '\"]').attr(\"hidden\", true);\n $('[data-when~=\"' + mode + '\"]').each(function () {\n var hidewhens = tokenize(this.getAttribute(\"data-hide-when\"));\n // There is no mode for which we should still HIDE this.\n if (!aTokenApplies(hidewhens)) {\n this.removeAttribute(\"hidden\");\n $(this).prop(\"hidden\", false);\n }\n });\n }\n // OFF\n else {\n $('[data-when~=\"' + mode + '\"]').each(function () {\n var whens = tokenize(this.getAttribute(\"data-when\"));\n // There is no mode for which we should still SHOW this.\n // HIDE-WHEN is irrelevant\n if (!aTokenApplies(whens)) $(this).attr(\"hidden\", true);\n });\n $('[data-hide-when~=\"' + mode + '\"]').each(function () {\n var hidewhens = tokenize(this.getAttribute(\"data-hide-when\"));\n var whens = tokenize(this.getAttribute(\"data-when\"));\n // There is no mode for which we should still HIDE this.\n if (!aTokenApplies(hidewhens))\n if (whens.length === 0 || aTokenApplies(whens)) {\n // And there are no whens OR there are whens and one of them applies\n this.removeAttribute(\"hidden\");\n $(this).prop(\"hidden\", false);\n }\n });\n }\n }\n // Make all setting calls chainable:\n return this;\n };\n this.set = function (mode) {\n return this.toggle(mode, true);\n };\n this.unset = function (mode) {\n return this.toggle(mode, false);\n };\n};\n\nconst Mode = new mode();\n\nexport { Mode };\n","/* a11y-user-detect:\n *\n * \"User Detect\" will dynamically toggle between\n * a-keyboard-user & a-mouse-user (described in a11y.less)\n * depending on user interaction on document.\n *\n * The idea is to give keyboard users more visual queues,\n * without effecting the aesthetics for non-keyboard users.\n *\n * Author: Tim Bauwens\n * Copyright 2017 Berkeley Bridge\n *\n */\n\nimport { Mode } from \"$json/lib/mode\";\n\nexport const isKeyboardUser = () => Mode.get(\"a-keyboard-user\");\n\nexport const isMouseUser = () => Mode.get(\"a-mouse-user\");\n\nexport const setKeyboardUser = () => {\n Mode.set(\"a-keyboard-user\");\n Mode.unset(\"a-mouse-user\");\n};\n\nexport const setMouseUser = () => {\n Mode.unset(\"a-keyboard-user\");\n Mode.set(\"a-mouse-user\");\n};\n\n$(function () {\n let openingMatch, mouse;\n try {\n // Could have no opener, or opener could be X-Origin\n if (window.opener.document.body) {\n openingMatch = window.opener.document.body.className.match(\n /\\ba-(keyboard|mouse)-user\\b/\n );\n if (openingMatch) mouse = openingMatch[1] === \"mouse\";\n }\n } catch (e) {\n mouse = false;\n }\n if (mouse) {\n setMouseUser();\n } else {\n setKeyboardUser();\n }\n $(document.body).on(\"mousedown touchstart\", function () {\n setMouseUser();\n });\n $(document.body).on(\"keydown\", function (e) {\n if (\n e.key === \"Tab\" ||\n e.target.matches(`input[type=\"radio\"], input[type=\"checkbox\"]`)\n ) {\n setKeyboardUser();\n }\n });\n});\n","/* global $ */\nimport \"./a11y-user-detect.js\";\nimport { _ } from \"./gettext.js\";\n\n/*** A11y BEGIN ***/\nexport const A11y = {\n log: function (message) {\n var logdiv = document.getElementById(\"a-logdiv\");\n if (logdiv) logdiv.innerHTML = \"
\" + message + \"
\";\n }\n};\n\n/**\n * Datepicker a11y enhancements\n */\nexport const observeDatepickers = (function () {\n var init = false;\n return function initDateObservance() {\n var picker, observer;\n\n if (init || !(\"MutationObserver\" in window)) {\n init = true;\n return;\n }\n\n $(document).on(\"blur\", '[data-type=\"datetimepicker\"]', function () {\n A11y.log(\"\");\n });\n\n function observation(records, instance) {\n try {\n var infocus =\n document.activeElement.className.split(\" \").indexOf(\"hasDatepicker\") >\n -1;\n } catch (e) {\n // there mayn't be an activeElement, in which case className is undefined.\n }\n if (infocus) {\n var message = [\n $(\".ui-state-hover\").text(),\n $(\".ui-datepicker-month [selected]\").text(),\n $(\".ui-datepicker-year [selected]\").text()\n ].join(\" \");\n A11y.log(message + \", \" + _(\"press enter to accept\"));\n }\n }\n\n picker = document.getElementById(\"ui-datepicker-div\");\n\n if (picker) {\n observer = new window.MutationObserver(observation);\n observer.observe(picker, { attributes: true });\n init = true;\n }\n };\n})();\n","let escapeHTML = (function () {\n var entityMap = {\n \"&\": \"&\",\n \"<\": \"<\",\n \">\": \">\",\n '\"': \""\",\n \"'\": \"'\",\n \"/\": \"/\"\n };\n var re = new RegExp(\"[&<>\\\"'/]\", \"g\");\n return function escapeHTML(string) {\n return String(string).replace(re, function (s) {\n return entityMap[s];\n });\n };\n})();\n\nconst escaped = (strings, ...values) =>\n strings.reduce(\n (acc, cur, idx) =>\n acc +\n cur +\n (values.length > idx ? escapeHTML(values[idx]) : \"\"),\n \"\"\n );\n\nexport { escapeHTML, escaped };\n","import { Mode } from \"./mode.js\";\n\n/*** NOTIFICATIONS BEGIN ***/\n\n// Notification can either be a String or an object with a message\n// property. When supplying an object, the message property will be\n// shown to the user, but the entire object will be given to\n// console.error.\nfunction notify(options = { keepalive: false, html: false }, notification) {\n if (!notification) return;\n var text = notification.message || notification,\n timeout = 5000;\n if (\n typeof console !== \"undefined\" &&\n console &&\n typeof console.error === \"function\"\n )\n console.error(notification);\n Mode.set(\"hasMessage\");\n if (options.html) {\n document\n .querySelectorAll(\".bb-notification\")\n .forEach(area => (area.innerHTML = text));\n } else {\n document\n .querySelectorAll(\".bb-notification\")\n .forEach(area => (area.textContent = text));\n }\n if (!options.keepalive)\n window.setTimeout(Mode.unset.bind(Mode, \"hasMessage\"), timeout);\n}\n\nexport { notify };\n/*** NOTIFICATIONS END ***/\n","const Identity = x => ({ x, map: fn => Identity(fn(x)) });\n\nconst Const = x => ({ x, map: fn => Const(x) });\n\nconst lens = (getter, setter) => functor => target =>\n functor(getter(target)).map(focus => setter(focus, target));\n\nconst over = (lens, fn, obj) => lens(x => Identity(fn(x)))(obj).x;\n\nconst set = (lens, val, obj) => over(lens, () => val, obj);\n\nconst view = (lens, obj) => lens(Const)(obj).x;\n\nexport { lens, over, set, view };\n","/** Map fn on array, then join it with joiner */\nimport * as Lenses from \"./lenses.js\";\n\nexport const applyTo = arg => fn => fn(arg);\n\nconst _apply = (fn, args) => fn(...args);\n\nexport const dec = arg => arg - 1;\n\nexport const inc = arg => arg + 1;\n\nexport function mapConcat(arr, fn, joiner) {\n return arr.map(fn).join(joiner);\n}\n\nexport const identity = x => x;\n\nexport const isNil = x => x == null;\n\nexport const not = a => !a;\n\n/**\n Differs from Ramda in that the first function in the pipe chain is\n called with a single argument.\n */\nexport const pipe =\n (...fns) =>\n value =>\n fns.reduce((acc, cur) => cur(acc), value);\n\n/**\n Differs from Ramda in that the first function in the compose chain is\n called with a single argument.\n */\nexport const compose =\n (...fns) =>\n value =>\n fns.reduceRight((acc, cur) => cur(acc), value);\n\nexport const curry = (fn, ...args) => {\n if (args.length >= fn.length) return fn(...args);\n return (...args2) => curry(fn, ...[...args, ...args2]);\n};\n\nexport const join = curry((sep, arr) => arr.join(sep));\n\nexport const split = curry((sep, arr) => arr.split(sep));\n\nexport const reverse = arr => [...arr].reverse();\n\nexport const type = compose(\n s => s.slice(8, -1),\n ob => Object.prototype.toString.call(ob)\n);\n\nexport const always = value => () => value;\n\nexport const F = always(false);\n\nexport const T = always(true);\n\nexport const propOr = curry((or, prop, obj) => {\n try {\n return ifElse(isNil, () => or, identity)(obj[prop]);\n } catch (_) {\n return or;\n }\n});\n\nexport const prop = propOr(undefined);\nexport const pathOr = curry((or, pathArg, obj) =>\n reduce((acc, cur) => propOr(or, cur, acc), obj, pathArg)\n);\n\nexport const path = pathOr(undefined);\n\nexport const tail = arr => Array.prototype.slice.call(arr, 1);\n\nexport const head = arr => arr[0];\n\nexport const last = arr => arr[arr.length - 1];\n\nexport const cond = curry((rules, ob) => {\n const cur = rules[0];\n if (!cur) return undefined;\n return ifElse(cur[0], cur[1], cond(tail(rules)))(ob);\n});\n\nexport const length = prop(\"length\");\n\nexport const strictUniq = arr =>\n reduce((acc, cur) => (acc.indexOf(cur) > -1 ? acc : [...acc, cur]), [])(arr);\n\nexport const any = curry((fn, arr) => {\n return arr.length === 0\n ? false\n : compose(fn, head)(arr)\n ? true\n : any(fn, tail(arr));\n});\n\nexport const find = curry((fn, arr) => {\n return arr.length === 0\n ? undefined\n : fn(head(arr))\n ? head(arr)\n : find(fn, tail(arr));\n});\n/**\n * Returns a function applying all arguments to a *manually* curried function.\n *\n * Behaves a bit strange (see tests), so keeping it private-ish\n **/\nexport const _uncurry =\n fn =>\n (...args) =>\n args.reduce((acc, cur) => {\n return acc(cur);\n }, fn);\n\n/** Curriable functions **/\n\n/**\n * Takes a function and two values and returns true if the values map\n * to the same value; false otherwise.\n */\nconst _eqBy = (fn, a, b) => _equals(fn(a), fn(b));\n\nconst _all = (fn, arr) =>\n reduce((acc, cur) => (acc ? fn(cur) : acc), true, arr);\n\nconst _none = (fn, arr) =>\n reduce((acc, cur) => (fn(cur) ? false : acc), true, arr);\n\nconst _append = (arg, arr) => [...((arr instanceof Array && arr) || []), arg];\n\nconst _test = (regex, string) => regex.test(string);\n\nconst _match = (regex, string) => string.match(regex) || [];\n\n// https://raphacmartin.medium.com/deep-equality-in-javascript-objects-1eea8abb3649\n/**\n *\n * @param a Object\n * @param b Object\n * @returns {boolean}\n */\nfunction _equals(a, b) {\n if (!(a instanceof Object) || !(b instanceof Object)) return a === b;\n // if the number of keys is different, they are different\n if (Object.keys(a).length !== Object.keys(b).length) {\n return false;\n }\n\n for (const key in a) {\n const a_value = a[key];\n const b_value = b[key];\n // If the value is an object, check if they're different objects\n // If it isn't, uses !== to check\n if (\n (a_value instanceof Object && !_equals(a_value, b_value)) ||\n (!(a_value instanceof Object) && a_value !== b_value)\n ) {\n return false;\n }\n }\n return true;\n}\n\nconst _eqProps = (prop, a, b) => _equals(a[prop], b[prop]);\n\nconst _hasPath = (p, ob) => {\n if (p.length === 0) return true;\n return has(p[0], ob) && _hasPath(tail(p), prop(p[0], ob));\n};\n\n/** Associate prop with val in obj */\nfunction _assoc(prop, val, obj) {\n var result = {};\n for (var p in obj) {\n result[p] = obj[p];\n }\n result[prop] = val;\n return result;\n}\n\nconst _assocPath = (path, val, obj) => {\n if (path.length === 0) {\n return val;\n }\n var idx = path[0];\n if (path.length > 1) {\n var nextObj =\n !isNil(obj) && Object.prototype.hasOwnProperty.call(obj, idx)\n ? obj[idx]\n : Number.isInteger(path[1])\n ? []\n : {};\n val = assocPath(Array.prototype.slice.call(path, 1), val, nextObj);\n }\n if (Number.isInteger(idx) && Array.isArray(obj)) {\n var arr = [].concat(obj);\n arr[idx] = val;\n return arr;\n } else {\n return assoc(idx, val, obj);\n }\n};\n\n/**\n * Apply fun to all but first argN args */\nconst _consume =\n (fn, argN) =>\n (...args) => {\n return fn(...args.slice(argN));\n };\n\nconst _propEq = (key, value, ob) => _equals(prop(key, ob), value);\n\nconst _pathEq = (key, value, ob) => _equals(path(key, ob), value);\n\nconst _has = (prop, ob) =>\n complement(isNil)(ob) && Object.prototype.hasOwnProperty.call(ob, prop);\n\nconst _tryCatch = (tryer, catcher) => arg => {\n try {\n return tryer(arg);\n } catch (e) {\n return catcher(e, arg);\n }\n};\n\n/**\n Call arr.map(fn)\n\n Note: differs from Ramda, in that the callback will receive both the item, the index and the list.\n\n If you want the callback function `fn` to read only the first parameter, wrap `fn` in `unary(fn)`.\n */\nconst _map = (fn, arr) => arr.map(fn);\n\n/**\n Call arr.filter(fn)\n\n Note: differs from Ramda, in that the callback will receive both the item, the index and the list.\n\n If you want the callback function `fn` to read only the first parameter, wrap `fn` in `unary(fn)`.\n */\nconst _filter = (fn, arr) => arr.filter(fn);\n\nconst _when = (predicate, whenTrueFn, arg) =>\n predicate(arg) ? whenTrueFn(arg) : arg;\n\nconst _ifElse = (predicate, whenTrueFn, whenFalseFn, arg) =>\n predicate(arg) ? whenTrueFn(arg) : whenFalseFn(arg);\n\nconst _either = (fn1, fn2, arg) => fn1(arg) || fn2(arg);\n\nconst _allPass = (fns, arg) =>\n fns.reduce((mem, cur) => (!mem ? false : cur(arg)), true);\n\nconst _anyPass = (fns, arg) =>\n fns.reduce((mem, cur) => (mem ? true : cur(arg)), false);\n\nconst _both = (fn1, fn2, arg) => _allPass([fn1, fn2], arg);\n\nconst _complement = (fn, arg) => !fn(arg);\n\nconst _includes = (item, c) => c.includes(item);\n\nconst _lte = (first, second) => first <= second;\n\nconst _lt = (first, second) => first < second;\n\nconst _gte = (first, second) => first >= second;\n\nconst _gt = (first, second) => first > second;\n\n/**\n Call arr.reduce(fn, into);\n\n Note: differs from Ramda, in that the callback will receive the\n accumular, the item, the index and the list.\n\n If you want the callback function `fn` to read only the first two\n parameters, as with Ramda, wrap `fn` in `binary(fn)`.\n */\nconst _reduce = (fn, into, arr) => arr.reduce(fn, into);\n\nconst _tap = (fn, value) => (fn(value), value);\n\nconst _groupWith = (fn, arr) =>\n reduce(\n (acc, cur, index, arr) =>\n index === 0 || !fn(cur, arr[index - 1])\n ? [...acc, [cur]]\n : [...acc.slice(0, acc.length - 1), [...acc[acc.length - 1], cur]],\n []\n )(arr);\n\nconst _groupBy = (fn, arr) =>\n reduce((acc, cur) => over(lensProp(fn(cur)), append(cur), acc), {})(arr);\n\n/** Dissociate props from obj */\nconst _omit = (props, obj) => {\n var result = {};\n for (var p in obj) {\n if (!props.includes(p)) result[p] = obj[p];\n }\n return result;\n};\n\nconst _pickBy = (pred, obj) => {\n var result = {};\n for (var k in obj) {\n if (pred(obj[k], k)) result[k] = obj[k];\n }\n return result;\n};\n\nconst _pick = (props, obj) => {\n var result = {};\n props.forEach(prop => {\n if (has(prop, obj)) result[prop] = obj[prop];\n });\n return result;\n};\n\nconst _pickAll = (props, obj) => {\n var result = {};\n props.forEach(prop => {\n result[prop] = obj[prop];\n });\n return result;\n};\n\nfunction _dissoc(prop, obj) {\n return _omit([prop], obj);\n}\n\nconst _infichain = (fns, arg) =>\n fns.reduce(\n (acc, cur, index) => (index === 0 ? cur(arg) : cur(acc, arg)),\n null\n );\n\nconst _mergeRight = (ob1, ob2) => Object.assign({}, ob1, ob2);\n\nconst _mergeLeft = (ob1, ob2) => Object.assign({}, ob2, ob1);\n\nconst _unary = fn => arg => fn(arg);\n\nconst _binary = fn => (arg1, arg2) => fn(arg1, arg2);\n\nexport const all = curry(_all),\n append = curry(_append),\n apply = curry(_apply),\n assoc = curry(_assoc),\n assocPath = curry(_assocPath),\n anyPass = curry(_anyPass),\n both = curry(_both),\n consume = curry(_consume),\n dissoc = curry(_dissoc),\n eqProps = curry(_eqProps),\n equals = curry(_equals),\n filter = curry(_filter),\n has = curry(_has),\n hasPath = curry(_hasPath),\n map = curry(_map),\n propEq = curry(_propEq),\n tryCatch = curry(_tryCatch),\n when = curry(_when),\n ifElse = curry(_ifElse),\n either = curry(_either),\n allPass = curry(_allPass),\n complement = curry(_complement),\n includes = curry(_includes),\n infichain = curry(_infichain),\n mergeLeft = curry(_mergeLeft),\n mergeRight = curry(_mergeRight),\n omit = curry(_omit),\n pathEq = curry(_pathEq),\n pick = curry(_pick),\n pickBy = curry(_pickBy),\n pickAll = curry(_pickAll),\n lt = curry(_lt),\n lte = curry(_lte),\n gt = curry(_gt),\n gte = curry(_gte),\n reduce = curry(_reduce),\n groupBy = curry(_groupBy),\n groupWith = curry(_groupWith),\n tap = curry(_tap),\n eqBy = curry(_eqBy),\n lens = curry(Lenses.lens),\n over = curry(Lenses.over),\n set = curry(Lenses.set),\n view = curry(Lenses.view),\n test = curry(_test),\n match = curry(_match),\n none = curry(_none),\n unary = curry(_unary),\n binary = curry(_binary),\n lensPath = p => Lenses.lens(path(p), assocPath(p)),\n lensProp = p => Lenses.lens(prop(p), assoc(p));\n\nexport const uncurried = {\n all: _all,\n apply: _apply,\n append: _append,\n assoc: _assoc,\n assocPath: _assocPath,\n both: _both,\n filter: _filter,\n propEq: _propEq,\n consume: _consume,\n tryCatch: _tryCatch,\n when: _when,\n ifElse: _ifElse,\n either: _either,\n allPass: _allPass,\n complement: _complement,\n includes: _includes,\n lt: _lt,\n lte: _lte,\n gt: _gt,\n gte: _gte,\n has: _has,\n hasPath: _hasPath,\n tap: _tap,\n groupBy: _groupBy,\n groupWith: _groupWith,\n eqBy: _eqBy,\n eqProps: _eqProps,\n equals: _equals,\n omit: _omit,\n pathEq: _pathEq,\n pick: _pick,\n pickBy: _pickBy,\n pickAll: _pickAll,\n dissoc: _dissoc,\n test: _test,\n match: _match,\n mergeLeft: _mergeLeft,\n mergeRight: _mergeRight,\n unary: _unary,\n binary: _binary,\n ...Lenses\n};\n","/*** CONFIG BEGIN ***/\n\nimport conf from \"$conf.json\";\nimport { has } from \"./functional.js\";\n\nconf.a11y = Object.assign(\n {\n captions: false,\n optionfieldsets: false,\n strictlegends: false\n },\n conf.a11y\n);\n\nfunction propFinder(ob, prefix) {\n if (prefix) ob = find(prefix);\n\n function find(prop, fallback) {\n if (ob === undefined) return fallback;\n if (prop === undefined) return fallback;\n var leafs = prop.split(\".\").filter(Boolean),\n leaf = ob;\n while (has(leafs[0], leaf)) {\n leaf = leaf[leafs.shift()];\n }\n if (leafs.length === 0) return leaf;\n return fallback;\n }\n\n return find;\n}\n\nexport { conf, propFinder };\n\n/*** CONFIG END ***/\n","import { conf } from \"./conf\";\nexport const fromApiServer = s =>\n s.startsWith(\"http://\") || s.startsWith(\"https://\")\n ? s\n : [conf.apiserver, s].filter(Boolean).join(\"/\");\n","/* global jQuery */\nlet $ = jQuery;\n\nimport { escapeHTML } from \"./escape.js\";\nimport { notify } from \"./notify.js\";\nimport { _ } from \"./gettext.js\";\nimport { fromApiServer } from \"./location.js\";\n\n/**\n * Keep track of ajax requests + some convenience\n *\n * Exports busy and replace to bb.ajax object for plugins to use.\n */\nvar Ajax = {\n busy: false,\n last: null,\n direction: null,\n\n defaultOptions: {\n dataType: \"json\",\n type: \"POST\",\n url: \"action\",\n cache: false,\n async: true,\n success: checkJSON,\n error: onJSONError\n },\n\n post: function (options) {\n const _options = Object.assign({}, Ajax.defaultOptions, options, {\n url: fromApiServer(options.url || Ajax.defaultOptions.url)\n });\n $(document).trigger(\"bb:prePost\", _options);\n return $.ajax(_options);\n },\n\n replace: function (obj) {\n Ajax.last && Ajax.last.abort();\n Ajax.last = Ajax.post(obj);\n return Ajax.last;\n },\n\n release: function () {\n Ajax.busy = false;\n $(\".group.selected\").prop(\"disabled\", false);\n }\n};\n\n/**\n * Convenience method, like getJSON, but with POST\n *\n * @param {String} url URL where we POST to\n * @param {Object|String} data POST data\n *\n * Use Ajax.post instead if you want to overrule any default\n * settings from Ajax.defaultOptions.\n */\n$.postJSON = function (url, data) {\n return Ajax.post({ url: url, data: data });\n};\n\n/**\n * The default JSON error handler.\n *\n * Set appropriate flags, let user now what went wrong (as good as\n * possible).\n *\n * Trigger custom 'bb:jsonError' event on document.\n *\n * @param {Object} data XMLHTTPRequest object\n * @param {String} err Error message\n */\nfunction onJSONError(data, err) {\n Ajax.release();\n $(document).trigger(\"bb:jsonError\", data, err);\n if (data.responseText === undefined) {\n if (data.statusText === \"abort\");\n else {\n notify(\n { html: false, keepalive: true },\n _(\"Error: No response from server, server probably down\")\n );\n }\n } else if ($.trim(data.responseText) === \"\") {\n notify(\n { html: false, keepalive: true },\n _(\"Error: No response from server, server probably down\")\n );\n } else {\n notify(\n { html: true, keepalive: true },\n \"Error: \" +\n escapeHTML(err) +\n \"
Response was:
\" +\n \"
\" +\n        escapeHTML(data.responseText) +\n        \"
\"\n );\n }\n}\n\n/**\n * Indicate further processing ought to be skipped when this symbol is\n * set on JSON data.\n * @example\n import { stopDispatches } from \"$json/lib/ajax\";\n $(document).on(\"bb:preHandleData\", (event, data) => {\n event.stopImmediatePropagation(); // prevent further bb:preHandleData handlers.\n data[stopDispatches] = true;\n })\n * @constant\n * @type {Symbol}\n */\nexport const stopDispatches = Symbol(\"Skip all further dispatches\");\n\n/**\n * The default AJAX success handler. Perform actions on data.\n\n *\n * If data is not a JSON object, do nothing.\n *\n * @todo Either check data against JSON API, in some way or the\n * other, or make sure this function doesn't get called in the\n * first place when we're dealing with a non-core request; as\n * checkJSON is currently bound to ALL $.ajax requests,\n * this function may also fire for non-core requests.\n *\n * @param {Object} data 'JSON object according to BB JSON API'\n * @param {String} status Status of XHR\n * @param {Object} req The XHR object retrieving the resource\n *\n * @return undefined\n */\nfunction checkJSON(data, status, req) {\n if (typeof req.responseJSON !== \"undefined\") {\n // Since subsequent events may mess with the responseJSON\n // object, give (debuggers) the option to see the raw stuff.\n // Could be solved with a service worker instead.\n $(document).trigger(\"bb:responseText\", req.responseText);\n // use bb:preHandleData to change the JSON object for later invocations\n $(document).trigger(\"bb:preHandleData\", data);\n\n if (data[stopDispatches]) return;\n // handleData has the main stuff - the core rendering\n $(document).trigger(\"bb:handleData\", data);\n if (data[stopDispatches]) return;\n\n // use bb:postHandleData to change the DOM after initial rendering\n $(document).trigger(\"bb:postHandleData\", data);\n if (data[stopDispatches]) return;\n\n // finalHandleData may not change the DOM, but set focus for instance.\n $(document).trigger(\"bb:finalHandleData\", data);\n if (data[stopDispatches]) return;\n }\n}\n\nexport { Ajax, checkJSON };\n","import { Mode } from \"./mode.js\";\n\nexport const setSettled = () => Mode.set(\"isSettled\");\n","import { setSettled } from \"./settled.js\";\n/* global $ */\nfunction BBI(options) {\n options = options || {};\n if (options.redirect_uri) {\n /** Example response:\n *\n * {\n * \"bbis\" : \"test\",\n * \"authid\" : \"Stubby\",\n * \"redirect_uri\" : \"https:\\/\\/HOST:8078\\/login?returnurl=http%3A%2F%2Fhost%3A80%2Fbbisreturns%3Fbbis%3Dtest&state=1507301556%3AGUID&authid=Stubby\",\n * \"url\": \"http:\\/\\/HOST:80\\/bbisreturns?bbis=test\",\n * \"state\": \"1507301556:6F2146D3-E0E6-4EB2-9DE4-2F31670B80D6\"\n * }\n *\n */\n var path = window.location.pathname.split(\"/\"),\n template = path.pop() || \"inlog.html\",\n returnurl =\n window.location.origin +\n path.concat(template).join(\"/\") +\n \"?\" +\n $.param({ bbis: options.bbis }),\n server = options.redirect_uri.split(\"?\")[0]; // The identity server sans params\n this.params = Object.assign(\n\t {},\n\t options.extraparams,\n\t {\n returnurl,\n authid: options.authid,\n // Add specific HTML page to state:\n state: options.state\n });\n this.url = server + \"?\" + $.param(this.params);\n this.stage = 1;\n } else {\n this.params = $.extend($.parseQuery(), { fmt: \"json\" });\n this.stage = 2;\n }\n return this;\n}\n\nBBI.prototype.authenticate = function () {\n if (!this.stage) throw \"BBI was not properly initialized\";\n if (this.stage === 1) {\n window.location.href = this.url;\n } else if (this.stage === 2) {\n $.postJSON(\"bbisreturns\", this.params).then(setSettled);\n }\n};\n\nexport { BBI };\n","/* global URLSearchParams FormData */\n\nimport { mapConcat, either, when } from \"./functional.js\";\n\nconst ATTR_SNAME = \"data-server-name\";\nconst ATTR_SVALUE = \"data-server-value\";\nconst CONTAINER_SELECTOR = \"#bb-q .group.selected\";\n\nconst INPUT_SELECTOR = mapConcat(\n [\"input\", \"textarea\", \"select\"],\n function (c) {\n return c + \"[name]:not([disabled])\";\n },\n \", \"\n);\n\nconst inputsOf = container => container.querySelectorAll(INPUT_SELECTOR);\n\nconst isEmptyRadioValue = val => val === null;\nconst isEmptyCheckboxValue = val => val === false;\nconst isCheckedCheckboxValue = val => val === true;\n\nfunction collectWithin({\n params = null, // Object with an .append method, taking two params\n flavor = URLSearchParams, // Constructor for an object with an .append method, taking two params, used when params is not provided\n container = document.querySelector(CONTAINER_SELECTOR),\n omitFn = isEmptyCheckboxValue,\n changeFn = when(isCheckedCheckboxValue, () => \"on\"),\n collector = inputsOf\n} = {}) {\n return _collectAll(\n collector(container),\n params || new flavor(),\n omitFn,\n changeFn\n );\n}\n\nfunction _collectAll(nodeList, params, omitFn, changeFn) {\n for (const node of nodeList) {\n const val = valueOf(node),\n name = node.getAttribute(ATTR_SNAME) || node.getAttribute(\"name\");\n if (!either(isEmptyRadioValue, omitFn, val)) {\n params.append(name, changeFn(val));\n }\n }\n return params;\n}\n\nfunction valueOf(node) {\n if (node.hasAttribute(ATTR_SVALUE)) return node.getAttribute(ATTR_SVALUE);\n switch (node.type) {\n case \"radio\":\n return node.checked ? node.value : null; // Do not collect unchecked radios -- stripped in collectAll.\n case \"checkbox\":\n /* Collect unchecked checkboxes as false -- goes against usual form submission,\n but we need this for Studio API (using JSON). Stripped out by collectAll() unless provided with a omitFn. */\n if (!node.checked) return false;\n return node.hasAttribute(\"value\") // NOT the property -- this would still be \"on\".\n ? node.value // A checkbox should send either its value or\n : true; // Return Boolean true instead of \"on\", to be changed by collectAll() with changeFn,\n // or leave it at true (for JSON communication for instance) */\n default:\n return String(node.value).replace(/\\r?\\n/g, \"\\r\\n\");\n }\n}\n\nconst serializeQuestions = () =>\n collectWithin({}).toString().replace(/\\r?\\n/g, \"%0D%0A\");\n\nexport { valueOf, serializeQuestions, collectWithin };\n","import { escapeHTML } from \"./escape.js\";\nimport {\n allPass,\n anyPass,\n both,\n complement,\n compose,\n either,\n F,\n has,\n ifElse,\n pipe,\n prop,\n propEq,\n type\n} from \"./functional.js\";\nexport const isOptional = allPass([\n complement(prop(\"notnull\")),\n either(\n complement(prop(\"stringmask\")),\n pipe(prop(\"stringmask\"), RegExp, re => re.test(\"\"))\n )\n]);\n\nexport const isVisible = prop(\"visible\");\n\nexport const isLabel = either(\n propEq(\"name\", \"label\"),\n propEq(\"controltype\", \"label\")\n);\n\nexport const isOption = either(\n propEq(\"controltype\", \"radio\"),\n propEq(\"controltype\", \"checkbox\")\n);\n\nexport const isLink = propEq(\"name\", \"linklabel\");\n\nexport const isTextual = either(isLabel, isLink);\n\nexport const isPicture = propEq(\"controltype\", \"picture\");\n\nexport const isQuestion = complement(either(isTextual, isPicture));\n\nexport const isReadOnly = both(\n isQuestion,\n either(\n ifElse(has(\"originalreadonly\"), prop(\"originalreadonly\"), prop(\"readonly\")),\n propEq(\"visible\", false)\n )\n);\n\nexport const isValidatable = ifElse(\n either(isReadOnly, propEq(\"visible\", false)),\n F,\n anyPass([\n has(\"minimum\"),\n has(\"maximum\"),\n both(has(\"maxlength\"), complement(propEq(\"maxlength\", 0))),\n prop(\"notnull\"),\n compose(s => s === \"string\", type, prop(\"stringmask\"))\n ])\n);\n\nexport const renderAttribs = attr =>\n Object.entries(attr).reduce(\n (acc, [key, value]) => acc + ` ${key}=\"${escapeHTML(value)}\"`,\n \"\"\n );\n\nexport const setAttribs = (elt, attr) =>\n Object.entries(attr).forEach(([key, value]) => elt.setAttribute(key, value));\n\nexport const bbmClass = stylename =>\n `bbm-${stylename.toLowerCase().replace(/[^a-z0-9]/g, \"-\")}`;\n","/******* positionalFormat() BEGIN ******/\n\n/* https://github.com/pft/javascript/blob/master/positionalformat.js\n *\n * Copyright (C) 2006-2013 Niels Giesen.\n *\n * Contact: \n *\n * Author: Niels Giesen\n * Keywords: JavaScript, formatting, String\n *\n * This file is dual-licensed under either the BSD license or the\n * GNU Affero General Public License.\n *\n * positionalFormat enables you to replace numbers enclosed in curly braces (C# format\n * apparently) with positional arguments (that can be reused), like\n * this:\n *\n * positionalFormat('argument { 1 } (or is it { 2 }, or { 0 }?) comes { 1 }',3,'first',1)\n *\n * evals to:\n *\n * \"argument first (or is it 1, or 3?) comes first\"\n */\n\nexport function positionalFormat(str) {\n var args = arguments;\n return str.replace(/{\\s*(\\d+)\\s*}/g, function (match, num) {\n return args[parseInt(num) + 1] !== undefined\n ? args[parseInt(num) + 1]\n : match;\n });\n}\n\n/******* positionalFormat() END ******/\n","/* global $ */\nimport {\n apply,\n cond,\n dec,\n equals,\n identity,\n lensPath,\n match,\n over,\n path,\n pipe,\n tail,\n tap,\n test,\n T\n} from \"./functional.js\";\nimport { _ } from \"./gettext.js\";\nimport { positionalFormat } from \"./text-utils.js\";\n\n/*** DATE UTILITIES BEGIN ***/\nDate.prototype.toHoursAndMinutes = function () {\n var hours = this.getHours();\n var minutes = this.getMinutes();\n if (hours < 10) hours = \"0\" + hours;\n if (minutes < 10) minutes = \"0\" + minutes;\n return hours + \":\" + minutes;\n};\nconst dateTimeRe = /^\\/Date\\((-?\\d+)\\)\\/$/,\n pureDateRe = /^(\\d{4})-(\\d{2})-(\\d{2})$/,\n ISO8601DateTimeInZuluRe = /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2}(\\.\\d{3})?)?Z$/;\n\n/*\n * Convert JSON date string to a Date object and return it.\n *\n * @{datestring}:\n *\n * An ISO-8601 datetime string in Zulu Time\n *\n * OR\n *\n * a JSON date string of the form\n *\n * \"/Date(102938293293)/\"\n *\n * where the numerical part is\n * seconds from epoch\n *\n * OR:\n *\n * a date formatted as \"yyyy-mm-dd\"\n *\n * OR:\n *\n * undefined -> undefined\n *\n */\nconst date = (...args) => new Date(...args);\n\nexport const parseDate = cond([\n [equals(0), () => undefined],\n [equals(undefined), identity],\n [equals(\"\"), identity],\n [\n test(pureDateRe),\n // Note if we were to pass pureDates to new Date as a valid\n // DateStamp, the engine will interpret it as 0:00 Zulu\n // time. Which, in this very case, is probably not what we\n // want. We want the date as in the minds of the case (min/max in\n // a calendar etc). It should be represented 'as is' to the user,\n // so 2022-02-09 may never become 2022-02-08 in users TZ, so\n // interpret it according in users TZ.\n pipe(match(pureDateRe), tail, over(lensPath([1]), dec), apply(date))\n ],\n [test(ISO8601DateTimeInZuluRe), date],\n [test(dateTimeRe), pipe(match(dateTimeRe), path([1]), parseInt, date)],\n [\n T,\n thing => {\n throw `Not a date in our book: ${thing}`\n }\n ]\n]);\n\nexport const leadWithZeroes = string =>\n string.replace(/([^0-9]|^)([0-9]{3})([^0-9]|$)/, \"$10$2$3\");\n\n/**\n *\n * @param {Object} spec Object describing a control conforming to the BB json api.\n * @param {String} value The value to be checked\n * @returns {Boolean|Error} true when value is according to spec\n * @throws Localized error message\n */\nexport function checkDate(spec = { notnull: false }, value) {\n const UIFormat = $.datepicker._defaults.dateFormat;\n const formatDate = $.datepicker.formatDate.bind($.datepicker);\n var date, mindate, maxdate;\n if (!spec.notnull && value.trim() === \"\") {\n return true;\n }\n try {\n date = valueToDate(UIFormat, value); // $.datepicker.parseDate(UIFormat, value); // This line may throw an error.\n } catch (e) {\n //couldn't parse - throw a translatable error message\n throw _(\"Invalid date\");\n }\n if (date === null) {\n if (spec.notnull) throw _(\"Input required\");\n return true;\n }\n (mindate = parseDate(spec.minimum)), (maxdate = parseDate(spec.maximum));\n if (!(mindate || maxdate)) return true; // Neither is set\n const fmindate = formatDate(UIFormat, mindate),\n fmaxdate = formatDate(UIFormat, maxdate);\n if (mindate && !maxdate && date < mindate)\n throw positionalFormat(_(\"A date before {0} is not allowed\"), fmindate);\n else if (mindate && maxdate && (date < mindate || maxdate < date))\n throw positionalFormat(\n _(\"Date has to lie between {0} and {1}\"),\n fmindate,\n fmaxdate\n );\n else if (maxdate && !mindate && maxdate < date)\n throw positionalFormat(_(\"A date after {0} is not allowed\"), fmaxdate);\n return true;\n}\n\nexport const valueToDate = (format, value) => {\n let date;\n try {\n date = $.datepicker.parseDate(format, value);\n } catch (e) {\n const yyyycleanformat = format.replace(/[^mdy]/g, \"\").replace(\"yy\", \"yyyy\"),\n clean = value.replace(/[^0-9]/g, \"\");\n date = new Date();\n const yearindex = yyyycleanformat.indexOf(\"yyyy\");\n // If year was less than 4 digits, and not at end, adjust indices of other fields.\n const adjustment = yearindex === 0 ? clean.length - 8 : 0;\n let year = Number(clean.substr(yearindex, 4 + adjustment));\n if (year <= 99) {\n const cutoffyear = Number.isInteger(\n $.datepicker._defaults.shortYearCutoff\n )\n ? $.datepicker._defaults.shortYearCutoff\n : (date.getYear() % 100) +\n Number($.datepicker._defaults.shortYearCutoff);\n // Note: this will become odd if current year approaches end of\n // century. Let's say we live in 2099. User enters 98 -> fine.\n // Is below 109. User enters 02 => not fine. Still below 109.\n // But jQuery UI should also fix this. And it's still a long time.\n const century = (date.getFullYear() / 100) >> 0;\n if (year <= cutoffyear) {\n year += century * 100;\n } else {\n year += (century - 1) * 100;\n }\n }\n const month = Math.max(\n 0,\n Number(clean.substr(yyyycleanformat.indexOf(\"mm\") + adjustment, 2)) - 1\n );\n const dom = Number(\n clean.substr(yyyycleanformat.indexOf(\"dd\") + adjustment, 2)\n );\n date.setFullYear(year);\n date.setMonth(month);\n date.setDate(dom);\n if (\n date.getFullYear() !== year ||\n date.getMonth() !== month ||\n date.getDate() !== dom\n ) {\n throw \"invalid date\";\n }\n }\n return date;\n};\n\nexport const onChangeDate = ev => {\n let date;\n try {\n date = valueToDate($.datepicker._defaults.dateFormat, ev.target.value);\n } catch (e) {\n // ignore\n } finally {\n if (date) {\n ev.target.value = leadWithZeroes(\n $.datepicker.formatDate($.datepicker._defaults.dateFormat, date)\n );\n }\n }\n};\n\nexport const humanDate = (function () {\n var now = new Date();\n var hour0 = now.setHours(0, 0, 0, 0);\n var dayinms = 1000 * 60 * 60 * 24;\n var hour24 = hour0 + dayinms;\n var thisyear = now.getYear();\n var daysofweek = [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"].map(\n function (day) {\n return _(day);\n }\n );\n var monthsofyear = [\n \"Jan\",\n \"Feb\",\n \"Mar\",\n \"Apr\",\n \"May\",\n \"June\",\n \"July\",\n \"Aug\",\n \"Sep\",\n \"Oct\",\n \"Nov\",\n \"Dec\"\n ].map(function (month) {\n return _(month);\n });\n function isToday(ms) {\n return ms > hour0 && ms < hour24;\n }\n function isYesterday(ms) {\n return hour0 > ms && ms > hour0 - dayinms;\n }\n function isLastWeek(ms) {\n return ms > hour0 - dayinms * 6;\n }\n function isThisYear(date) {\n return thisyear == date.getYear();\n }\n function humanDate(date) {\n if (!(date instanceof Date)) throw \"Expects a Date object\";\n var ms = date.valueOf();\n var hm = \"\";\n hm = date.toHoursAndMinutes();\n if (isToday(ms)) {\n return hm;\n }\n if (isYesterday(ms)) {\n return _(\"Yesterday\") + \", \" + hm;\n }\n if (isLastWeek(ms)) {\n return daysofweek[date.getDay()] + \" \" + hm;\n }\n return (\n date.getDate() +\n \" \" +\n monthsofyear[date.getMonth()] +\n (isThisYear(date) ? \"\" : \" \" + date.getFullYear()) +\n \", \" +\n hm\n );\n }\n return humanDate;\n})();\n","import { compose, either, isNil, not, path } from \"./functional.js\";\n\n/* editPolicy may be \"return\", \"stay\", or undefined, meaning off */\nexport const editPolicy = path([\"arbitrary\", \"core\", \"editPolicy\"]);\n\nexport const canEditEarlier = compose(not, isNil, editPolicy);\n\nconst isLabelValueDynamic = compose(\n value => value === true,\n path([\"arbitrary\", \"core\", \"isLabelValueDynamic\"])\n);\n\nconst preferUpdate = compose(\n value => value === true,\n path([\"arbitrary\", \"core\", \"preferUpdate\"])\n);\n\nexport const mustUpdate = either(preferUpdate, canEditEarlier);\n\nexport const updateLabels = either(mustUpdate, isLabelValueDynamic);\n","const _Widgets = {};\n\nexport function registerWidget(options) {\n _Widgets[options.name] = options;\n}\nexport function getWidget(name) {\n return _Widgets[name];\n}\n","/* global $ */\n\nimport { parseDate } from \"./dates\";\nimport { isReadOnly, isValidatable } from \"./control-helpers\";\nimport { updateLabels } from \"./feature-queries.js\";\nimport { conf } from \"./conf.js\";\nimport { getWidget } from \"./form-widgets.js\";\nimport { anyPass, has, prop } from \"./functional.js\";\nconst Dynprops = {};\n\n// Update the control element\nDynprops.update = function ($widget, control, Updates, requestor) {\n if (!$widget.get(0)) return;\n const oldval = $widget.val();\n\n const updates = Object.keys(Updates);\n const definition = getWidget(control.controltype);\n $widget.removeData([\"validated\"]);\n\n /** isForNotNull **/\n if (has(\"isForNotNull\", Updates)) {\n $widget.toggleClass(\"bb-for-required\", Boolean(control.isForNotNull));\n $widget.toggleClass(\"bb-for-optional\", !control.isForNotNull);\n }\n\n /** Placeholder **/\n if (has(\"placeholder\", Updates) > -1) {\n $widget.attr(\"placeholder\", control.placeholder);\n }\n\n /** Visible **/\n if (has(\"visible\", Updates)) {\n if (control.identifier === \"gformulier.gegevens.geschil_partner\")\n $widget.attr(\"aria-hidden\", !control.visible);\n $widget.attr(\"data-visible\", control.visible);\n\n if (control.visible) {\n window.setTimeout(function () {\n $widget.removeAttr(\"hidden\");\n }, 80);\n } else {\n window.setTimeout(function () {\n $widget.attr(\"hidden\", !control.visible);\n }, 80);\n }\n }\n\n /** Value **/\n if (has(\"value\", Updates)) {\n if (updateLabels(conf)) {\n /**\n @done: linklabel, listlabel, checkmultilist, memo, combobox, radio,\n checkbox, numedit, datetimepicker, edit, grid, multilist(?), listbox(?)\n @todo: freebox.\n\n NOTE: A widget currently can change itself *only* if\n they are registered with allowUpdatingSelf : true\n\n Widgets within a grid can update other widgets in a grid.\n */\n if (definition.setValue) {\n definition.setValue($widget.get(0), control.value, requestor, Updates);\n }\n }\n }\n\n /** Readonly **/\n if (\n anyPass([has(\"readonly\"), has(\"originalreadonly\"), has(\"visible\")], Updates)\n ) {\n const readonly = isReadOnly(control);\n if (typeof definition.onreadonly === \"function\") {\n definition.onreadonly($widget.get(0), readonly);\n } else {\n $widget.prop(\"disabled\", readonly);\n }\n }\n\n /** Minimum **/\n if (has(\"minimum\", Updates)) {\n $widget.attr(\"min\", control.minimum);\n if (control.controltype === \"datetimepicker\") {\n if (control.minimum) {\n $widget.datepicker(\"option\", \"minDate\", parseDate(control.minimum));\n }\n }\n }\n\n /** Maximum **/\n if (has(\"maximum\", Updates)) {\n $widget.attr(\"max\", control.maximum);\n if (control.controltype === \"datetimepicker\") {\n if (control.maximum) {\n $widget.datepicker(\"option\", \"maxDate\", parseDate(control.maximum));\n }\n }\n }\n\n /** Maxlength **/\n if (has(\"maxlength\", Updates)) {\n if (control.maxlength === 0) $widget.removeAttr(\"maxlength\");\n else $widget.attr(\"maxlength\", control.maxlength);\n }\n\n /** Let user know something changed perhaps against their intent. **/\n if (oldval !== $widget.val()) {\n $widget.addClass(\"bb-programmatically-changed\");\n $widget.trigger(\"change\", { programmatically: true });\n self.setTimeout(function () {\n $widget.removeClass(\"bb-programmatically-changed\");\n }, 1000);\n }\n\n /** Notnull **/\n if (has(\"notnull\", Updates)) {\n if (typeof definition.onrequired === \"function\") {\n definition.onrequired($widget.get(0), control.notnull);\n } else {\n $widget.attr(\"aria-required\", control.notnull);\n }\n if (control.notnull) {\n $widget.addClass(\"notnull\");\n } else {\n $widget.removeClass(\"notnull\");\n }\n }\n\n if (isValidatable(control)) {\n $widget.addClass(\"validatable\");\n } else {\n $widget.removeClass(\"validatable\");\n }\n\n if (updates.length > 0) {\n const event = new CustomEvent(\"bb:updatedControl\", {\n detail: { control, Updates },\n bubbles: true\n });\n $widget.get(0).dispatchEvent(event);\n $(document).trigger(\"bb:updated\", [$widget, control, updates]);\n }\n};\n\n$.fn.extend({\n updateControl: function (controls, requestor) {\n return this.each(function () {\n const $this = $(this),\n control = $this.data(\"control\");\n if (\n this === requestor &&\n !prop(\"allowUpdatingSelf\", getWidget(control.controltype))\n ) {\n // This was the one requesting an update\n return this;\n }\n if (!control) throw (\"No updateControl defined for\", $this);\n const id = control.id,\n update = controls.find(function (c) {\n return c.id === id;\n }),\n // updates = [],\n Updates = {},\n props = [\n \"maxlength\",\n \"isForNotNull\",\n \"minimum\",\n \"maximum\",\n \"notnull\",\n \"readonly\",\n \"originalreadonly\",\n \"placeholder\",\n \"precision\",\n \"stringmask\",\n \"errortext\",\n \"visible\",\n \"value\",\n \"columns\",\n \"text\"\n ];\n // Caron-syntax used in label, therefore no (text) interface\n // returned -- should not mix and match dynprops with empty\n // labels! Do not allow this to error on the user though!\n\n // Does also handle (cause to ignore) labels within a grid!\n if (typeof update === \"undefined\") {\n return this;\n // update = $.extend({}, control, {visible: false});\n }\n for (var i in props) {\n if (control[props[i]] !== update[props[i]]) {\n Updates[props[i]] = { from: control[props[i]], to: update[props[i]] };\n control[props[i]] = update[props[i]];\n // updates.push(props[i]);\n }\n }\n Dynprops.update($this, control, Updates, requestor);\n return this;\n });\n }\n});\n\nexport { Dynprops };\n","const Hooks = new Map();\n\nexport const registerHook = key => hook => {\n if (typeof hook !== \"function\") throw \"Can only add a function as a hook\";\n Hooks.set(key, hook);\n};\n\nexport const runHook = key => (...args) => {\n if (Hooks.has(key)) Hooks.get(key)(...args);\n};\n","/* global $ */\nimport { bbmClass, isReadOnly, renderAttribs } from \"./control-helpers\";\nimport { Dynprops } from \"./dynprops\";\nimport { escaped, escapeHTML } from \"./escape.js\";\nimport { conf, propFinder } from \"./conf\";\nimport { getWidget } from \"./form-widgets.js\";\nimport {\n assoc,\n both,\n compose,\n complement,\n has,\n isNil,\n not,\n prop\n} from \"./functional.js\";\nimport { runHook } from \"./hooks.js\";\nimport { Mode } from \"./mode.js\";\n\nconst arbitraryCoreProp = propFinder(conf, \"arbitrary.core\");\n\n/**\n * Create a control widget, then insert it into the DOM\n *\n * @param {Object} control A control object as defined in the JSON API. The one to render + add.\n * @param {Object} group The group object to which this control belongs.\n * @param {Element} wGroup Element whereto this control should be added. *NOTE* that this need not be a .bb-group\n *\n * @return undefined\n *\n * @todo Simplify parameter list.\n */\nfunction wControl(control, group, wGroup) {\n control._group = group;\n let attribs = {};\n let widget;\n const enabled = group.current || complement(isReadOnly)(control);\n // Has been rendered\n if (control.$elt) {\n $(wGroup).append(control.$elt);\n return control.$elt;\n }\n if (compose(has(\"fixup\"), getWidget)(control.controltype))\n compose(fn => fn(control), prop(\"fixup\"), getWidget)(control.controltype);\n\n if (control.datatype) attribs[\"data-datatype\"] = control.datatype;\n\n if (control.meta)\n for (let d in control.meta) {\n if (both(has(d), compose(not, isNil, prop(d)))(control.meta))\n attribs[\"data-\" + d] = escape(control.meta[d]);\n }\n if (control.metadata) {\n attribs[\"data-metadata-keys\"] = Object.keys(control.metadata)\n .map(s => s.replace(/\\s/g, \"-\"))\n .join(\" \");\n }\n if (control.aria)\n for (let a in control.aria) {\n if (has(a, control.aria)) attribs[\"aria-\" + a] = control.aria[a];\n }\n\n if (control.name) {\n attribs[\"name\"] = control.name;\n }\n\n const wdef = getWidget(control.controltype);\n if (!wdef) {\n console.warn(`No widget definition for ${control.controltype}`);\n return null;\n }\n const tagName = wdef.tagName;\n attribs = wdef.attribs(attribs, control, enabled);\n\n attribs[\"data-type\"] = control.controltype;\n if (tagName) {\n widget = $(\"<\" + tagName + \" \" + renderAttribs(attribs) + \"/>\");\n } else {\n widget = $(wdef.render(control, group, attribs));\n if (!widget) return null;\n }\n\n if (control.className) {\n widget.addClass(control.className);\n }\n control.$elt = widget;\n control._elt = widget.get(0);\n\n if (wdef && wdef.tagName) {\n /**\n Okay, some (older) definitions have a tagName definition ->\n from which a quite empty skeleton widget is created.\n\n Afterwards, they fill that very widget with a render function\n of a different signature than usual:\n\n Instead of (control (plain object), group (plain object), attribs (array)), they get\n (control (plain object), widget (jQuery collection), group (plain object))).\n\n */\n wdef.render(control, widget, group);\n }\n\n // attach an id whenever meaningful:\n // if (control.id && /\\d+$/.test(control.id))\n if (control.id) {\n // id used not to be safe, but now we prepend the groupid, making it safe.\n widget.attr(\"id\", control.id);\n }\n if (control._originalid) {\n // Use data-id for stuff refering to the interface, no matter in which group it is, such as informationsources.\n widget.attr(\"data-id\", control._originalid);\n }\n\n if (has(\"autocomplete\", control)) {\n widget\n .attr(\"data-server-name\", control.name)\n .attr(\"name\", control.autocomplete)\n .attr(\"autocomplete\", control.autocomplete);\n }\n\n $(wGroup).append(widget);\n\n /* Insert a space between elements so that elements are reasonably\n * well-placed when CSS is disabled.\n */\n $(wGroup).append(\" \");\n\n // Tooltips:\n if (control.hint) {\n if (enabled) Mode.set(\"hasHints\");\n runHook(\"hinter\")(widget, assoc(\"enabled\", enabled, control));\n }\n widget.data(\"control\", control);\n\n /**\n * Dynamic properties\n */\n var dynprops = [\n \"maxlength\",\n \"minimum\",\n \"maximum\",\n \"notnull\",\n \"isForNotNull\",\n \"readonly\",\n \"precision\",\n \"stringmask\",\n \"errortext\",\n \"placeholder\"\n ],\n dynpropsforus = {};\n\n for (var ii in dynprops) {\n if (has(dynprops[ii], control))\n dynpropsforus[dynprops[ii]] = { to: control[dynprops[ii]] }; // .push(dynprops[ii]);\n }\n\n if (has(\"visible\", control) && control.visible === false) {\n dynpropsforus[\"visible\"] = { to: false }; // .push(dynprops[ii]);\n }\n // dynpropsforus.push(\"visible\");\n\n widget.data(\"anchor\", widget);\n\n if (wdef && wdef.afterRender) {\n wdef.afterRender(widget, control);\n }\n\n if (shouldWrap(control)) {\n wrapInlineInput(widget);\n }\n\n /* Allow class-based styling */\n if (control[\"font-class\"]) {\n widget.addClass(bbmClass(control[\"font-class\"]));\n }\n\n /**\n * Two things:\n * - Put control tags in data-tags of Element.\n * - Make TAG known to CSS as bb-tagged-TAG.\n */\n if (control[\"tags\"] instanceof Array) {\n $(widget).data(\"tags\", control[\"tags\"]);\n $.each(control[\"tags\"], function (i, tag) {\n widget.addClass(\"bb-tagged-\" + tag);\n });\n }\n\n Dynprops.update(widget, control, dynpropsforus);\n\n return widget;\n}\n\nfunction shouldWrap(control) {\n return (\n control.prelabel ||\n control.postlabel ||\n (arbitraryCoreProp(\"wrapAllSingleLiners\") === true &&\n compose(prop(\"couldWrap\"), getWidget)(control.controltype))\n );\n}\n\nfunction wrapInlineInput(widget) {\n var control = widget.data(\"control\"),\n prelabel = control.prelabel,\n postlabel = control.postlabel;\n var anchor = widget.data(\"anchor\");\n var wraptag = \"span\";\n if (anchor.get(0).nodeName === \"DIV\") wraptag = \"div\";\n anchor.wrapAll(\n \"<\" +\n wraptag +\n ' data-wraps-type=\"' +\n control.controltype +\n '\" class=\"bb-input-wrap\">\"\n );\n anchor = anchor.parent();\n widget.data(\"anchor\", anchor);\n anchor.data({\n control: control,\n type: control.controltype\n });\n if (prelabel)\n anchor.prepend(\n '' +\n escapeHTML(prelabel) +\n \"\"\n );\n if (postlabel)\n anchor.append(\n '' +\n escapeHTML(postlabel) +\n \"\"\n );\n}\n\nconst getControl = elt => $.data(elt, \"control\");\n\nexport { getControl, wControl };\n","export const listtypes = {\n radio: \"LIST\",\n checkmultilist: \"LIST\",\n customlist: \"LIST\",\n combobox: \"BOX\",\n listbox: \"BOX\",\n multilist: \"BOX\"\n};\n","import {\n groupWith,\n map,\n filter,\n pipe,\n path,\n strictUniq,\n lensPath\n} from \"./functional.js\";\n\nconst pathToGroup = [\"metadata\", \"group\"];\nexport const pathGroup = path(pathToGroup);\nexport const lensGroup = lensPath([\"metadata\", \"group\"]);\n\nconst areOfOneQuestion = (a, b) => a.isfor === b.id || b.isfor === a.id;\n\nexport const groupInner = groupWith(areOfOneQuestion);\n\nconst InfinityIfMinus1 = num => (num + 1 || Infinity) - 1;\nconst indexOfOrInfinity = (sub, s) => InfinityIfMinus1(s.indexOf(sub));\nexport const baseGroup = s => s.substr(0, indexOfOrInfinity(\".\", s));\nexport const tailGroup = s => s.substr(indexOfOrInfinity(\".\", s) + 1);\n\nconst belongTogether = (a, b) =>\n areOfOneQuestion(a, b) ||\n (pathGroup(a) &&\n pathGroup(b) &&\n baseGroup(pathGroup(a)) === baseGroup(pathGroup(b)));\n\nexport const groupOuter = groupWith(belongTogether);\n\nexport const groupClasses = pipe(\n map(path[(\"metadata\", \"groupClasses\")]),\n filter(Boolean),\n strictUniq\n);\n\nexport const doGrouping = path([\"arbitrary\", \"core\", \"form-group\", \"on\"]);\n","export const normalize = s => s.toLowerCase().replace(/[^a-z0-9]/g, \"-\");\n","import { path, either, compose, prop } from \"./functional.js\";\nimport { conf } from \"./conf.js\";\n\n/**\n\nName keys follow this pattern:\n\n__\n\n is any of:\n\n- GROUPING: subgroup of questions and/or texts and/or links\n- ITEM: a question and/or text and/or link\n- QUESTION: a question (is also an item)\n- TEXT: a top level text (not a label for a question)\n- LINK: a top level link (so: not inside markdown)\n- PICTURE: a top level image (so : nto inside markdown)\n\nGROUPING ::= ITEM+\nITEM ::= QUESTION | TEXT | LINK | PICTURE\n\n is any of:\n\n- _CLASS_ : the css class to put on this type \n- _PREFIX_: a css class prefix\n- _DATA_: a data- attribute\n\nwhere can be anything.\n\nThe default values for those keys, thus the strings that willl be used\nin the generated DOM, are provided in nameDefaults. They can be\noverwritten in the `conf.json` file in the property\n`core.form-group.names` in order to retrofit older or other naming\nschemes.\n\n*/\n\nexport const /* A grouping groups items */\n GROUPING_CLASS = \"grouping-class\", // Class of grouping\n GROUPING_PREFIX_TYPE = \"grouping-prefix-type\", // prefix for -question, -text or -author\n GROUPING_DATA_NAME = \"grouping-data-name\", // data attribute conveying author provided group name\n GROUPING_DATA_LEVEL = \"grouping-data-level\", // grouping level, 1-based\n ITEM_PREFIX_AUTHORCLASS = \"item-prefix-authorclass\", // prefix for author class set with cssclasses on the metadata\n QUESTION_CLASS = \"question-class\", //: \"bb-questionlabelgroup\",\n QUESTION_PREFIX_TYPE = \"question-prefix-type\", //: \"bb-itype\",\n QUESTION_PREFIX_PROPERTY = \"question-prefix-property\", //: \"bb-itype\",\n QUESTION_DATA_LAYOUT = \"question-data-layout\", //: \"data-form-group-layout\",\n QUESTION_PREFIX_AUTHORSTYLE = \"question-prefix-authorstyle\", //: \"bb-g-\",\n QUESTION_CLASS_NOLABEL = \"question-class-nolabel\"; //: \"form-group__question--no-label\",\n\nconst nameDefaults = {\n [GROUPING_CLASS]: \"form-group\",\n [GROUPING_PREFIX_TYPE]: \"form-group-\",\n [GROUPING_DATA_NAME]: \"data-form-group-name\",\n [GROUPING_DATA_LEVEL]: \"data-form-group-level\",\n [ITEM_PREFIX_AUTHORCLASS]: \"form-group__item--author-class-\",\n [QUESTION_CLASS]: \"bb-questionlabelgroup\",\n [QUESTION_PREFIX_TYPE]: \"bb-itype\",\n [QUESTION_PREFIX_PROPERTY]: \"question-\", //: \"bb-itype\",\n [QUESTION_DATA_LAYOUT]: \"data-form-group-layout\",\n [QUESTION_PREFIX_AUTHORSTYLE]: \"bb-g-\",\n [QUESTION_CLASS_NOLABEL]: \"form-group__question--no-label\"\n};\n\n// const fg = {\n// [GROUPING_CLASS]: \"no-form-group-outer\",\n// [GROUPING_PREFIX_TYPE]: \"form-group-\",\n// [QUESTION_CLASS]: \"bb-questionlabelgroup p-form-group\",\n// [QUESTION_PREFIX_TYPE]: \"bb-itype-\",\n// [QUESTION_DATA_LAYOUT]: \"data-p-form-group-layout-type\",\n// [QUESTION_CLASS_NOLABEL]: \"p-form-group-orphaned\"\n// };\n\n// const bem_example = {\n// [GROUPING_CLASS]: \"form-group\",\n// [GROUPING_PREFIX_TYPE]: \"form-group-\",\n// [ITEM_PREFIX_AUTHORCLASS]: \"form-group__item--author-class-\",\n// [QUESTION_CLASS]: \"bb-questionlabelgroup\",\n// [QUESTION_PREFIX_TYPE]: \"form-group__question-\",\n// [QUESTION_DATA_LAYOUT]: \"data-form-group-layout\",\n// [QUESTION_PREFIX_AUTHORSTYLE]: \"form-group__question--author-style-\"\n// };\n\nconst pathToNames = path([\"arbitrary\", \"core\", \"form-group\", \"names\"]);\n\nexport const names = propArg =>\n either(compose(prop(propArg), pathToNames), _ => prop(propArg, nameDefaults))(\n conf\n );\n","/* global $ */\nimport {\n all,\n both,\n curry,\n filter,\n has,\n compose,\n ifElse,\n head,\n path,\n prop,\n any,\n find,\n pathOr,\n split,\n join,\n map,\n when,\n tap,\n cond,\n not\n} from \"./functional.js\";\nimport {\n isTextual,\n isPicture,\n isQuestion,\n isVisible\n} from \"./control-helpers.js\";\nimport {\n groupOuter,\n baseGroup,\n tailGroup,\n pathGroup\n} from \"./groupings\";\nimport { normalize } from \"./font-classes\";\nimport { getWidget } from \"./form-widgets.js\";\nimport { conf } from \"./conf\";\nimport * as n from \"./names.js\";\nimport { names } from \"./names.js\";\n\nconst doTopLevel = pathOr(false, [\n \"arbitrary\",\n \"core\",\n \"form-group\",\n \"toplevel\"\n]);\n\nconst getLayout = type =>\n pathOr(compose(prop(\"layout\"), getWidget)(type), [\"arbitrary\", \"form-group\", type]);\n\nconst getGroupName = compose(when(Boolean, baseGroup), pathGroup, head);\n\n// Interface Font Style\nconst questionGroupClass = compose(\n s => names(n.QUESTION_PREFIX_AUTHORSTYLE) + s,\n normalize,\n prop(\"font-class\")\n);\n\n// interface metadata: cssclasses=\nexport const extraClasses = prefix =>\n compose(\n when(\n Boolean,\n compose(\n join(\" \"),\n map(compose(s => names(prefix) + s, normalize)),\n split(\" \")\n )\n ),\n path([\"metadata\", \"cssclasses\"])\n );\n\nconst asciify = s => s.replace(/[^a-z-]/g, \"-\");\n\nconst areAllInvisible = compose(not, any(isVisible));\nconst areAllReadonly = both(\n any(both(isQuestion, isVisible)),\n compose(all(prop(\"originalreadonly\")), filter(both(isQuestion, isVisible)))\n);\n\nconst areAllNotNull = both(\n any(both(isQuestion, isVisible)),\n compose(all(prop(\"notnull\")), filter(both(isQuestion, isVisible)))\n);\n\nconst updateClassWhen = curry((className, fn, controls, elt) => {\n elt.classList.toggle(className, fn(controls));\n});\n\nconst setReadonlyFGClass = updateClassWhen(\n names(n.GROUPING_PREFIX_TYPE) + \"-readonly\",\n areAllReadonly\n);\nconst setEmptyFGClass = updateClassWhen(\n names(n.GROUPING_PREFIX_TYPE) + \"-empty\",\n areAllInvisible\n);\nconst setRequiredFGClass = updateClassWhen(\n names(n.GROUPING_PREFIX_TYPE) + \"-required\",\n areAllNotNull\n);\n\nconst setReadonlyQClass = updateClassWhen(\n names(n.QUESTION_PREFIX_PROPERTY) + \"-readonly\",\n areAllReadonly\n);\nconst setEmptyQClass = updateClassWhen(\n names(n.QUESTION_PREFIX_PROPERTY) + \"-empty\",\n areAllInvisible\n);\nconst setRequiredQClass = updateClassWhen(\n names(n.QUESTION_PREFIX_PROPERTY) + \"-required\",\n areAllNotNull\n);\n\nexport const createFormGroup = (wControl, group, level) => c => {\n let formGroup;\n const groupName = getGroupName(c);\n if (groupName || doTopLevel(conf)) {\n formGroup = document.createElement(\"div\");\n formGroup.className = names(n.GROUPING_CLASS);\n formGroup.setAttribute(names(n.GROUPING_DATA_LEVEL), level);\n setEmptyFGClass(c, formGroup);\n setReadonlyFGClass(c, formGroup);\n setRequiredFGClass(c, formGroup);\n formGroup.addEventListener(\"bb:updatedControl\", ({ detail }) => {\n if (has(\"visible\", detail.Updates)) {\n setEmptyFGClass(c, formGroup);\n }\n if (has(\"readonly\", detail.Updates)) {\n setReadonlyFGClass(c, formGroup);\n }\n if (has(\"notnull\", detail.Updates)) {\n setRequiredFGClass(c, formGroup);\n }\n });\n if (groupName) {\n formGroup.setAttribute(names(n.GROUPING_DATA_NAME), asciify(groupName));\n formGroup.classList.add(names(n.GROUPING_PREFIX_TYPE) + \"-author\");\n } else if (find(isQuestion, c)) {\n formGroup.classList.add(names(n.GROUPING_PREFIX_TYPE) + \"-interface\");\n } else if (compose(isPicture, head)(c)) {\n formGroup.classList.add(names(n.GROUPING_PREFIX_TYPE) + \"-picture\");\n } else if (compose(isTextual, head)(c)) {\n formGroup.classList.add(names(n.GROUPING_PREFIX_TYPE) + \"-text\");\n }\n } else {\n formGroup = document.createDocumentFragment();\n }\n\n const cWithin = compose(\n groupOuter,\n map(\n when(\n pathGroup,\n tap(control =>\n compose(\n ifElse(\n s => s === \"\",\n () => delete control.metadata.group,\n group => (control.metadata.group = group)\n ),\n tailGroup\n )(control.metadata.group)\n )\n )\n )\n )(c);\n cWithin.forEach(\n cond([\n [\n getGroupName,\n compose(\n n => formGroup.appendChild(n),\n createFormGroup(wControl, group, level + 1)\n )\n ],\n [\n any(isQuestion),\n controls => {\n const answer = find(isQuestion, controls);\n const classes = [\n names(n.QUESTION_CLASS),\n `${names(n.QUESTION_PREFIX_TYPE)}-${answer.controltype}`,\n questionGroupClass(answer),\n extraClasses(n.ITEM_PREFIX_AUTHORCLASS)(answer),\n controls.length === 1 && names(n.QUESTION_CLASS_NOLABEL)\n ].filter(Boolean);\n const qlg = document.createElement(\"div\");\n qlg.setAttribute(\n names(n.QUESTION_DATA_LAYOUT),\n answer._layout || getLayout(answer.controltype)(conf)\n );\n qlg.className = classes.join(\" \");\n setEmptyQClass(controls, qlg);\n setReadonlyQClass(controls, qlg);\n setRequiredQClass(controls, qlg);\n qlg.addEventListener(\"bb:updatedControl\", ({ detail }) => {\n if (has(\"visible\", detail.Updates)) {\n setEmptyQClass(controls, qlg);\n }\n if (has(\"readonly\", detail.Updates)) {\n setReadonlyQClass(controls, qlg);\n }\n if (has(\"notnull\", detail.Updates)) {\n setRequiredQClass(controls, qlg);\n }\n });\n controls.forEach(c => wControl(c, group, $(qlg)));\n formGroup.appendChild(qlg);\n }\n ],\n [\n () => true,\n map(c => {\n const $widget = wControl(c, group, $(formGroup));\n if ($widget) $widget.addClass(extraClasses(n.ITEM_PREFIX_AUTHORCLASS)(c));\n })\n ]\n ])\n );\n return formGroup;\n};\n","import { _ } from \"./gettext\";\n\n/*** NUMBER UTILITIES BEGIN ***/\n\nexport function forceInRange(num, min, max) {\n if (typeof min == \"undefined\" && typeof max == \"undefined\") return num;\n if (typeof min == \"undefined\") return Math.min(max, num);\n if (typeof max == \"undefined\") return Math.max(min, num);\n if (min === max) return min;\n return Math.max(Math.min(max, num), min);\n}\n\nexport const Numerals = (function () {\n /**\n * Create a getter for array, consuming items, repeating the last one\n * indefinitely.\n *\n * @param {Array} arr The array to make a repeater for\n * @return {Function()} Gets next item in arr, repeating last item indefinitely\n */\n function makeLastItemRepeater(arr) {\n var _a = arr.slice();\n var _last;\n return function getIter() {\n _last = _a.shift() || _last;\n return _last;\n };\n }\n /**\n * Create a formatting function for (arabic-hindu) numerals.\n *\n * @param {String} radixPoint String (character) used as radix point.\n * @param {String} groupingChar String (character) used for grouping\n * digits before the radix point.\n * @param {Array} groupingRules (optional) Array defining\n * grouping rules. Each element in this array stands for a group,\n * tracking leftwards from the radix point. When no more elements\n * remain, the last element will be repeated indefinitely.\n *\n * Most language use [3] (the default). For Indian, use [3,2]; for Chinese (and\n * Japanese?), use [4].\n *\n * Besides these rules, the special case of formatting\n * four digits in a row without grouping and no\n * fractional part is supported, and cannot be overruled.\n *\n * @return {Function()} Formatting function.\n */\n function makeFormatter(radixPoint, groupingChar, groupingRules) {\n return function formatter(num) {\n var idx = makeLastItemRepeater(groupingRules || [3]);\n var split = num.toString().split(\".\");\n var integralPart = split[0];\n var fractionalPart = split[1];\n var neg = (integralPart[0] === \"-\" && \"-\") || \"\";\n if (neg) integralPart = integralPart.substr(1);\n var th,\n out = \"\";\n if (integralPart) {\n // The four-digit exception rule (such as in years):\n if (!fractionalPart && integralPart.length === 4) out = integralPart;\n else {\n integralPart = integralPart.split(\"\").reverse();\n while ((th = integralPart.splice(0, idx()))[0]) {\n out = th.reverse().join(\"\") + (out ? groupingChar : \"\") + out;\n }\n }\n }\n if (fractionalPart) return neg + out + radixPoint + fractionalPart;\n return neg + out;\n };\n }\n function makeParser(radixPoint, groupingChar) {\n /**\n * Match anything not a digit or negative sign\n */\n var thre = /[^0-9-]/g;\n /**\n * Match only optional leading minus digits,\n * radixPoint, groupingChar and space characters.\n */\n var testre = new RegExp(\"^s?-?[0-9 \" + radixPoint + groupingChar + \"]*$\");\n\n return function parser(s) {\n if (!testre.test(s)) throw new Error(_(\"Invalid number\"));\n var split = s.split(radixPoint);\n var integralPart = split[0].replace(thre, \"\");\n if (!/^-?[0-9]*$/.test(integralPart))\n throw new Error(_(\"Invalid number\"));\n var fractionalPart = split[1];\n if (fractionalPart) fractionalPart = fractionalPart.replace(/\\s/g, \"\");\n if (!fractionalPart) fractionalPart = \"0\";\n if (!/^[0-9]*$/.test(fractionalPart))\n throw new Error(_(\"Invalid number\"));\n // Room for errors here.\n return new Number(integralPart + \".\" + fractionalPart) + 0;\n };\n }\n\n return {\n parser: makeParser(\n _(\"__radixpoint__\", \".\"),\n _(\"__digitgroupingchar__\", \",\")\n ),\n formatter: makeFormatter(\n _(\"__radixpoint__\", \".\"),\n _(\"__digitgroupingchar__\", \",\"),\n _(\"__digitgroupingrules__\", [3])\n ),\n makeFormatter: makeFormatter,\n makeParse: makeParser\n };\n})();\n/*** NUMBER UTILITIES END ***/\n","/* global $ FormData URLSearchParams */\nlet _vars = {};\n\nconst SESSION_KEYS = [\"dbname\", \"sessionid\", \"uniqueid\"];\nconst NAV_KEYS = [\"screenid\", ...SESSION_KEYS];\n\nObject.freeze(SESSION_KEYS);\nObject.freeze(NAV_KEYS);\n\nfunction setValueInVars(data, key) {\n if (typeof data[key] != \"undefined\") _vars[key] = data[key];\n}\n\nfunction setVars(data) {\n setValueInVars(data, \"version\");\n setValueInVars(data, \"uniqueid\");\n setValueInVars(data, \"replyserveraddress\");\n setValueInVars(data, \"replyserverport\");\n setValueInVars(data, \"proxyredirect\");\n setValueInVars(data, \"sessionid\");\n setValueInVars(data, \"modelname\");\n setValueInVars(data, \"dbname\");\n setValueInVars(data, \"modelid\");\n setValueInVars(data, \"showdeleteinmenu\");\n setValueInVars(data, \"showdatecreated\");\n setValueInVars(data, \"showreport\");\n setValueInVars(data, \"userinfo\");\n setValueInVars(data, \"showcopycase\");\n setValueInVars(data, \"screenid\");\n var version = getVar(\"version\");\n if (typeof version === \"string\") _vars[\"version\"] = version.split(\".\");\n}\n\nexport function getVar(string, obj) {\n return $.extend({}, _vars, obj)[string];\n}\n\n/**\n * Unset either all vars, or only those present in param vars\n *\n * @param {Array} vars An array of variable keys to delete\n *\n **/\nfunction unsetVars(arr) {\n if (!arr) return (_vars = {});\n arr.forEach(function (key) {\n delete _vars[key];\n });\n return _vars;\n}\n\nfunction collect(keys, collector = new FormData(), obj) {\n function append(key) {\n const val = getVar(key, obj);\n if (val !== undefined) collector.append(key, getVar(key, obj));\n }\n if (Array.isArray(keys)) {\n keys.forEach(append);\n } else {\n append(keys);\n }\n return collector;\n}\n\nfunction querify(keys, obj) {\n const usp = collect(keys, new URLSearchParams(), obj);\n return usp.toString();\n}\n\nexport default {\n querify,\n setVars,\n getVar,\n unsetVars,\n collect,\n NAV_KEYS,\n SESSION_KEYS\n};\n","import { fromApiServer } from \"./location.js\";\nimport Vars from \"./vars.js\";\n\nif (!window.location.origin) {\n window.location.origin =\n window.location.protocol +\n \"//\" +\n window.location.hostname +\n (window.location.port ? \":\" + window.location.port : \"\");\n}\n\n/*** URL UTILITIES BEGIN ***/\nexport const urlutils = (function () {\n var mimetypes = {\n xsl: \"text/html\",\n html: \"text/html\",\n docx: \"application/msword\",\n pdf: \"application/pdf\",\n odt: \"application/vnd.oasis.opendocument.text\",\n rtf: \"application/rtf\",\n doc: \"application/msword\",\n jpg: \"image/jpeg\",\n jpeg: \"image/jpeg\",\n png: \"image/png\"\n };\n function caseReport(casus) {\n return fromApiServer(\"report?\" + Vars.querify(Vars.SESSION_KEYS, casus));\n }\n function getFiles(casus) {\n return \"getfiles?\" + Vars.querify(Vars.SESSION_KEYS, casus);\n }\n function isJS(url) {\n return url.match(/javascript:/);\n }\n function isEmptyish(url) {\n return url[0] === \"?\";\n }\n var JSAlertMessage =\n \"ALERT:\\nIt looks like someone is trying to eavesdrop on you,\" +\n \" trying to evaluate JavaScript code. \" +\n \"This person may want to steal private information \" +\n \"from you or other persons. \" +\n \"For your safety and that of others, \" +\n \"please contact this website \" +\n \"to report this message.\";\n return {\n isJS,\n isEmptyish,\n JSAlertMessage,\n getFiles,\n caseReport,\n mimetype: function (url) {\n const absoluteURL = new URL(\n fromApiServer(url),\n `${location.protocol}${location.host}${location.pathname}`\n );\n const filename = absoluteURL.pathname.endsWith(\"/getfile\")\n ? new URLSearchParams(absoluteURL.search).get(\"filename\")\n : absoluteURL.pathname.split(\"/\").pop();\n if (!filename) return null;\n const ext = filename.match(/\\.([^?.]+)$/),\n mimetype = ext && mimetypes[ext[1]];\n if (!mimetype) return null;\n return {\n mimetype: mimetype,\n ext: ext[1]\n };\n }\n };\n})();\n/*** URL UTILITIES END ***/\n","/* global $ */\nimport { A11y, observeDatepickers } from \"./a11y.js\";\nimport { conf, propFinder } from \"./conf.js\";\nimport { wControl, getControl } from \"./control.js\";\nimport {\n isLabel,\n isOption,\n isQuestion,\n isReadOnly,\n renderAttribs,\n setAttribs\n} from \"./control-helpers.js\";\nimport { checkDate, onChangeDate, parseDate, leadWithZeroes } from \"./dates.js\";\nimport { escapeHTML } from \"./escape.js\";\nimport { registerWidget } from \"./form-widgets.js\";\nimport {\n allPass,\n always,\n applyTo,\n both,\n compose,\n dissoc,\n find,\n F,\n gt,\n has,\n ifElse,\n join,\n map,\n mergeLeft,\n propEq,\n when,\n pipe,\n lensPath,\n lensProp,\n over,\n append,\n assoc,\n infichain,\n omit,\n prop,\n propOr,\n equals,\n tap\n} from \"./functional.js\";\n\nimport { _ } from \"./gettext.js\";\nimport { fromApiServer } from \"./location.js\";\nimport { forceInRange, Numerals } from \"./numerals.js\";\nimport { positionalFormat } from \"./text-utils.js\";\nimport { urlutils } from \"./url-utils.js\";\n\nconst arbitraryCoreProp = propFinder(conf, \"arbitrary.core\");\n\nfunction disconnectValue({ input, value, filter = x => x }) {\n input.setAttribute(\"data-server-value\", value);\n $(input).on(\"change\", function () {\n try {\n var newVal = filter(input.value, input);\n } catch (e) {\n //\n } finally {\n if (typeof newVal !== \"undefined\") {\n input.setAttribute(\"data-server-value\", newVal);\n }\n }\n });\n}\n\nconst noAttribs = always({});\n\nconst omitName = dissoc(\"name\");\nconst omitRequired = dissoc(\"aria-required\");\n\nconst emptyTag = (tagName, attribs) => {\n const elt = document.createElement(tagName);\n setAttribs(elt, attribs);\n return elt;\n};\nconst valueInside = (control, attribs, tagName) => {\n const elt = emptyTag(tagName, attribs);\n if (tagName === \"textarea\") {\n elt.value = control.value;\n } else {\n elt.innerHTML =\n control.text || escapeHTML(control.value).replace(/\\r?\\n/g, \"
\");\n }\n return elt;\n};\n\nconst checkbox = {\n name: \"checkbox\",\n render: (control, group, attribs) => {\n return emptyTag(\"input\", attribs);\n },\n attribs: (attr, control, enabled) =>\n Object.assign(\n {},\n attr,\n {\n type: \"checkbox\"\n },\n //Interface already has got a value server-side, so not\n //sending it back poses no problem.\n control.value && { checked: true }\n ),\n setValue: (input, value, requestor) => {\n input.checked = value;\n },\n layout: \"inline\"\n};\n\nregisterWidget(checkbox);\n\nconst picture = {\n name: \"picture\",\n render: (control, group, attribs) => emptyTag(\"img\", attribs),\n attribs: (attr, control, enabled) =>\n Object.assign({}, attr, {\n alt: control.alttext,\n src: fromApiServer(control.filename)\n })\n};\n\nregisterWidget(picture);\n\nexport const edit = {\n name: \"edit\",\n couldWrap: true,\n attribs: (attr, control, enabled) =>\n Object.assign({}, attr, {\n type: \"text\",\n autocomplete: \"off\",\n value: control.value\n }),\n render: (control, group, attribs) => emptyTag(\"input\", attribs),\n setValue: (input, value) => {\n input.value = value;\n },\n layout: \"aside\"\n};\n\nregisterWidget(edit);\n\nconst memo = {\n name: \"memo\",\n attribs: (attr, control, enabled) => {\n // const attribs = [\"name\", control.name];\n // if (control.width && control.height && control[\"font-size\"]) {\n // attribs.cols= parseInt(control.width / (control[\"font-size\"] * 0.75))\n // attribs.rows = parseInt(control.height / (control[\"font-size\"] * 1.5))\n // }\n // return [...attr, ...attribs];\n return attr;\n },\n render: (control, group, attribs) => {\n return valueInside(control, attribs, \"textarea\");\n },\n setValue: edit.setValue,\n layout: \"below\"\n};\n\nregisterWidget(memo);\n\nconst label = {\n name: \"label\",\n fixup: control => {\n control.value = control.value.replace(/\\r\\n/g, \"\\n\"); // Normalize Windows-style (typewriter) newlines\n return control;\n },\n attribs: (attr, control, enabled) =>\n Object.assign(\n omitName(attr),\n enabled && control.isFor && { for: control.isFor },\n {\n class: `${\n control.isfor || has(\"colname\", control) ? \"bb-label\" : \"bb-text\"\n } bb-md-able`\n }\n ),\n render: (control, group, attribs) => {\n return valueInside(\n control,\n attribs,\n control._subtype === \"heading\"\n ? \"h\" + Math.min(6, control._level || 2)\n : control.isFor\n ? \"label\"\n : \"div\"\n );\n },\n setValue: (input, value) => {\n input.innerHTML = escapeHTML(value).replace(/\\r?\\n/g, \"
\");\n }\n};\n\nregisterWidget(label);\n\nexport const linklabel = {\n name: \"linklabel\",\n fixup: control => {\n control.value = control.value.trim();\n // Fix 'empty' or JS-links\n if (urlutils.isEmptyish(control.url) || urlutils.isJS(control.url)) {\n if (urlutils.isJS(control.url)) control.value = urlutils.JSAlertMessage;\n delete control.url;\n }\n return control;\n },\n attribs: (attr, control, enabled) => {\n let linkClassName = \"\";\n\n if (control.url) {\n attr[\"href\"] = fromApiServer(control.url);\n if (control.url.match(/mailto:/)) {\n attr[\"type\"] = \"email\";\n linkClassName = \"mail\";\n } else {\n linkClassName = \"bb-external\";\n if (control.isreport) linkClassName += \" report\";\n var mimetype = control.mimetype || urlutils.mimetype(control.url);\n if (mimetype) {\n attr[\"type\"] = mimetype.mimetype;\n linkClassName += \" \" + mimetype.ext;\n }\n }\n if (control.url[0] !== \"#\") attr[\"target\"] = \"_blank\";\n }\n linkClassName += \" bb-text\";\n attr[\"class\"] = linkClassName;\n return omitName(attr);\n },\n render: (control, group, attribs) => {\n return valueInside(control, attribs, \"a\");\n },\n setValue: (input, value) => {\n input.innerHTML = escapeHTML(value).replace(/\\r?\\n/g, \"
\");\n },\n layout: \"below\"\n};\n\nregisterWidget(linklabel);\n\nconst listlabel = {\n name: \"listlabel\",\n attribs: compose(\n omitName,\n omitRequired,\n mergeLeft({\n type: \"listlabel\",\n class: \"listlabel\"\n })\n ),\n item: item =>\n `
  • ${escapeHTML(item).replace(/\\\\n/g, \"
    \")}
  • `,\n render: (control, group, attribs) => {\n const value = control.value;\n const items = compose(join(\"\"), map(listlabel.item))(value);\n const widget = `
      \n${items}
    `;\n return $(widget);\n },\n setValue: (input, value, requestor) => {\n input.innerHTML = compose(join(\"\"), map(listlabel.item))(value);\n $.fn.showdown && $(input).find(\"li\").showdown();\n },\n layout: \"below\"\n};\n\nregisterWidget(listlabel);\n\nconst optionbox = {\n render: (control, group, attribs) => {\n const value = control.value;\n const widget = $(``);\n // Set head of drop-down list to an empty item.\n // If value[0].value is already the empty string, the server\n // has already done this for us (pre 4.7 or dataset-based\n // drop-down).\n // If one of the options has already been selected, do *not*\n // add this empty option.\n // @todo: remove this code once server release 4.7 or higher\n // runs everywhere.\n if (\n control.controltype === \"combobox\" &&\n value.length > 0 &&\n value[0].value !== \"\" &&\n !value.some(function (value) {\n return value.selected === true;\n })\n ) {\n value.unshift({ option: \"\", value: \"\" });\n }\n for (let i = 0; i < value.length; i++) {\n let option = $(\n \"