=r.length?c.focus():r[a].focus()}else t.shiftKey?s.focus():l.focus()}})),!0===t.options.backdropOptions.closeOnClick&&t.$modal.on("click",(function(e){o()(e.target).closest("."+t.options.templateOptions.classModal).length||t.hide()})),t.$modal.find(".modal-title").focus()},positionModal:function(){var t=this;if(t.modalInitialized()){t.$modal.removeAttr("style"),t.$wrapper.parent().is("body")&&t.$wrapper.height(o()(window.parent).height());var e="function"==typeof t.options.margin?t.options.margin():t.options.margin,n={position:"absolute"};"0"!==e&&(n.padding=e),t.$modal.css(n),t.$modalDialog.css({width:t.options.width,height:t.options.height}),t.$modalContent.css({width:t.options.width});var r=t.options.position.split(" "),a=r[0],i=r[1],l=t.$modalDialog.outerWidth(!0),s=t.$modalDialog.outerHeight(!0),c=t.$wrapperInner.width(),u=t.$wrapperInner.height(),d=t.findPosition(a,i,e,l,s,c,u);for(var p in d)t.$modalDialog.css(p,d[p])}},render:function(t){var e=this;e.emit("render"),e.options.render.apply(e,[t]),e.emit("rendered")},show:function(){var t=this;t.backdrop=t.createBackdrop(),t.createModal()},createBackdrop:function(){var t=this,e=new g(t.$el.parents(t.options.backdrop),t.options.backdropOptions),n=t.options.backdropOptions.zIndex||1041;return o()(t.options.zIndexSelector).each((function(){n=Math.max(n,parseInt(o()(this).css("zIndex"))+1||1041)})),t.$wrapper=o()("").hide().css({"z-index":n,"overflow-y":"auto",position:"fixed",height:"100%",width:"100%",bottom:"0",left:"0",right:"0",top:"0"}).addClass(t.options.templateOptions.classWrapperName).insertBefore(e.$backdrop).on("click",(function(n){t.options.backdropOptions.closeOnClick&&(n.stopPropagation(),n.preventDefault(),e.hide())})),e.on("hidden",(function(){void 0!==t.$modal&&t.$modal.hasClass(t.options.templateOptions.classActiveName)&&t.hide()})),t.loading=new b({backdrop:e}),t.$wrapperInner=o()("").addClass(t.options.classWrapperInnerName).css({position:"absolute",bottom:"0",left:"0",right:"0",top:"0"}).appendTo(t.$wrapper),e},_show:function(){var t=this;t.render.apply(t,[t.options]),t.emit("show"),t.backdrop.show(),t.$wrapper.show(),t.loading.hide(),t.$el.addClass(t.options.templateOptions.classActiveName),t.$modal.addClass(t.options.templateOptions.classActiveName),a.A.scan(t.$modal),t.positionModal(),o()(window.parent).on("resize.plone-modal.patterns",(function(){t.positionModal()})),o()("body").addClass("modal-open"),t.emit("shown"),t.activateFocusTrap()},hide:function(){var t=this;t.ajaxXHR&&t.ajaxXHR.abort(),t.emit("hide"),t._suppressHide&&!window.confirm(t._suppressHide)||(t.loading.hide(),t.$el.removeClass(t.options.templateOptions.classActiveName),void 0!==t.$modal&&(t.$modal.remove(),t.initModal()),t.$wrapper.remove(),o()(".modal",o()("body")).length<1&&(t._suppressHide=void 0,t.backdrop.hide(),o()("body").removeClass("modal-open"),o()(window.parent).off("resize.plone-modal.patterns")),t.emit("hidden"),t.$el.focus())},redraw:function(t,e){var n=this;n.emit("beforeDraw"),n.$modal.remove(),n.$raw=o()("").append(o()(w(t))),n.render.apply(n,[e||n.options]),n.$modal.addClass(n.options.templateOptions.classActiveName),n.positionModal(),a.A.scan(n.$modal),n.emit("afterDraw")}})}}]);
+//# sourceMappingURL=11023.acafa8ebbc3f5a37bbc3.min.js.map
\ No newline at end of file
diff --git a/collective/behavior/relatedmedia/resources/bundles/chunks/11023.acafa8ebbc3f5a37bbc3.min.js.map b/collective/behavior/relatedmedia/resources/bundles/chunks/11023.acafa8ebbc3f5a37bbc3.min.js.map
new file mode 100644
index 00000000..01b9d303
--- /dev/null
+++ b/collective/behavior/relatedmedia/resources/bundles/chunks/11023.acafa8ebbc3f5a37bbc3.min.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"chunks/11023.acafa8ebbc3f5a37bbc3.min.js","mappings":"++CAOO,IAAMA,EAAqB,IAAIC,IAwDhCC,EAAwB,SAACC,EAAIC,GAC/B,IACoBC,EAD8BC,EAAAC,EAAtCJ,EAAK,CAACA,GAAMH,EAAmBQ,QACvB,IAApB,IAAAF,EAAAG,MAAAJ,EAAAC,EAAAI,KAAAC,MAA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OAAS,IAChCynB,EAAK6K,mBAAgBryB,EACrBwnB,EAAKU,SAASnc,OACd4M,IAAE,QAAQqP,YAAY,cACtBrP,IAAExQ,OAAOmE,QAAQqiB,IAAI,gCAEzBnH,EAAKnB,KAAK,UACVmB,EAAKvP,IAAI0Z,QACb,EAEAjE,OAAQ,SAAUnB,EAAU/kB,GACxB,IAAIggB,EAAO9f,KACX8f,EAAKnB,KAAK,cACVmB,EAAKiF,OAAO7N,SACZ4I,EAAK2G,KAAOxV,IAAE,WAAWyU,OAAOzU,IAAEzZ,EAAmBqtB,KACrD/E,EAAK0G,OAAO1nB,MAAMghB,EAAM,CAAChgB,GAAWggB,EAAKhgB,UACzCggB,EAAKiF,OAAO9E,SAASH,EAAKhgB,QAAQojB,gBAAgBvD,iBAClDG,EAAKoH,gBACLvU,EAAAA,EAASI,KAAK+M,EAAKiF,QACnBjF,EAAKnB,KAAK,YACd,G","sources":["webpack://relatedmedia/./node_modules/@patternslib/patternslib/src/core/events.js","webpack://relatedmedia/./node_modules/@patternslib/patternslib/src/core/basepattern.js","webpack://relatedmedia/./node_modules/@patternslib/patternslib/src/core/dom.js","webpack://relatedmedia/./node_modules/@patternslib/patternslib/src/core/logging.js","webpack://relatedmedia/./node_modules/@patternslib/patternslib/src/core/parser.js","webpack://relatedmedia/./node_modules/@patternslib/patternslib/src/core/registry.js","webpack://relatedmedia/./node_modules/@patternslib/patternslib/src/core/utils.js","webpack://relatedmedia/./node_modules/@patternslib/patternslib/src/core/mockup-parser.js","webpack://relatedmedia/./node_modules/@patternslib/patternslib/src/core/base.js","webpack://relatedmedia/./node_modules/@plone/mockup/src/pat/backdrop/backdrop.js","webpack://relatedmedia/./node_modules/@plone/mockup/src/core/utils.js","webpack://relatedmedia/./node_modules/@plone/mockup/src/core/i18n.js","webpack://relatedmedia/./node_modules/@plone/mockup/src/pat/modal/modal.js"],"sourcesContent":["import utils from \"./utils\";\n\n// Event related methods and event factories\n\n// Event listener registration for easy-to-remove event listeners.\n// once Safari supports the ``signal`` option for addEventListener we can abort\n// event handlers by calling AbortController.abort().\nexport const event_listener_map = new Map();\n\n/**\n * Add an event listener to a DOM element under a unique id.\n * If a event is registered under the same id for the same element, the old handler is removed first.\n *\n * @param {DOM Node} el - The element to register the event for.\n * @param {string} event_type - The event type to listen for.\n * @param {string} id - A unique id under which the event is registered.\n * @param {function} cb - The event handler / callback function.\n * @param {Object} opts - Options for the addEventListener API.\n *\n */\nconst add_event_listener = (el, event_type, id, cb, opts = {}) => {\n if (!el?.addEventListener) {\n return; // nothing to do.\n }\n remove_event_listener(el, id); // do not register one listener twice.\n\n // Create event_listener_map entry if not existent.\n if (!event_listener_map.has(el)) {\n event_listener_map.set(el, new Map());\n }\n let _cb = cb;\n if (opts?.once === true) {\n // For `once` events, also remove the entry from the event_listener_map.\n _cb = (e) => {\n event_listener_map.get(el)?.delete(id);\n cb(e);\n };\n }\n // Only `capture` option is necessary for `removeEventListener`.\n event_listener_map\n .get(el)\n .set(id, [event_type, _cb, opts.capture ? opts : undefined]);\n el.addEventListener(event_type, _cb, opts);\n};\n\n/**\n * Remove an event listener from a DOM element under a unique id.\n *\n * If an element and id are given, the event listeners for the given element matching the id are removed.\n * If an element but no id is given, all event listeners for that element are removed.\n * If an id but no element is given, all event listeners for any element matching the id are removed.\n * If no element and no id are given, all event listeners are removed.\n *\n * The id can be a wildcard string, e.g. `test-*-event`, which would match any\n * event which starts with \"test-\" and ends with \"-event\". The wildcard \"*\" can\n * be anywhere in the string and also be used multiple times. If no wildcard is\n * present the search string is used for an exact match.\n *\n * @param {DOM Node} [el] - The element to register the event for.\n * @param {string} [id] - A unique id under which the event is registered.\n * Can be a wildcard string.\n *\n */\nconst remove_event_listener = (el, id) => {\n const els = el ? [el] : event_listener_map.keys();\n for (const el of els) {\n if (!el?.removeEventListener) {\n return; // nothing to do.\n }\n const el_events = event_listener_map.get(el);\n if (!el_events) {\n return;\n }\n let entries;\n if (id) {\n // remove event listener with matching id\n entries = [...el_events.entries()].filter((entry) =>\n utils.regexp_from_wildcard(id).test(entry[0])\n );\n } else {\n // remove all event listeners of element\n entries = el_events.entries();\n }\n for (const entry of entries || []) {\n // Remove event listener\n el.removeEventListener(entry[1][0], entry[1][1], entry[1][2]);\n // Delete entry from event_listener_map\n event_listener_map.get(el).delete(entry[0]);\n // Delete element from event_listener_map if no more events are registered.\n if (!event_listener_map.get(el).size) {\n event_listener_map.delete(el);\n }\n }\n }\n};\n\n/**\n * Await an event to be thrown.\n *\n * Usage:\n * await events.await_event(button, \"click\");\n *\n * @param {DOM Node} el - The element to listen on.\n * @param {String} event_name - The event name to listen for.\n *\n * @returns {Promise} - Returns a Promise which can be used for ``await`` and which will be resolved when the event is throwm.\n *\n */\nconst await_event = (el, event_name) => {\n // See: https://stackoverflow.com/a/44746691/1337474\n return new Promise((resolve) =>\n el.addEventListener(event_name, resolve, { once: true })\n );\n};\n\n/**\n * Await pattern init.\n *\n * Usage:\n * await events.await_pattern_init(PATTERN);\n *\n * @param {Pattern instance} pattern - The pattern instance.\n *\n * @returns {Promise} - Returns a Promise which can be used for ``await`` and which will be resolved when the event is throwm.\n *\n */\nconst await_pattern_init = (pattern) => {\n // See: https://stackoverflow.com/a/44746691/1337474\n return new Promise((resolve, reject) => {\n // Case initialized\n pattern.one(\"init\", (e) => {\n if (e.target !== pattern.el) {\n // Don't handle bubbling init events from child elements. We\n // want to check on init events coming directly from this\n // Pattern's element.\n return;\n }\n // Resolve promise and unregister the not-init event handler.\n remove_event_listener(\n pattern.el,\n `basepattern-one--not-init.${pattern.name}.patterns`\n );\n resolve();\n });\n\n // Case not initialized\n pattern.one(\"not-init\", (e) => {\n if (e.target !== pattern.el) {\n // Don't handle bubbling not-init events from child elements.\n // We want to check on not-init events coming directly from\n // this Pattern's element.\n return;\n }\n // Reject promise and unregister the init event handler.\n remove_event_listener(\n pattern.el,\n `basepattern-one--init.${pattern.name}.patterns`\n );\n reject();\n });\n }).catch(() => {\n throw new Error(`Pattern \"${pattern.name}\" not initialized.`);\n });\n};\n\n/**\n * Event factories\n */\n\n/** Generic event factory.\n *\n * A event factory for a bubbling and cancelable generic event.\n *\n * @param {string} name - The event name.\n * @returns {Event} - Returns a blur event.\n */\nconst generic_event = (name) => {\n return new Event(name, {\n bubbles: true,\n cancelable: true,\n });\n};\n\nconst blur_event = () => {\n return new Event(\"blur\", {\n bubbles: false,\n cancelable: false,\n });\n};\n\nconst click_event = () => {\n return new Event(\"click\", {\n bubbles: true,\n cancelable: true,\n });\n};\n\nconst change_event = () => {\n return new Event(\"change\", {\n bubbles: true,\n cancelable: false,\n });\n};\n\nconst focus_event = () => {\n return new Event(\"focus\", {\n bubbles: false,\n cancelable: false,\n });\n};\n\nconst input_event = () => {\n return new Event(\"input\", {\n bubbles: true,\n cancelable: false,\n });\n};\n\nconst mousedown_event = () => {\n return new Event(\"mousedown\", {\n bubbles: true,\n cancelable: true,\n });\n};\n\nconst mouseup_event = () => {\n return new Event(\"mouseup\", {\n bubbles: true,\n cancelable: true,\n });\n};\n\nconst scroll_event = () => {\n return new Event(\"scroll\", {\n bubbles: true,\n cancelable: false,\n });\n};\n\nconst submit_event = ({ submitter } = { submitter: undefined }) => {\n const event = new Event(\"submit\", {\n bubbles: true,\n cancelable: true,\n });\n event.submitter = submitter; // undefined or the submitting element\n return event;\n};\n\nconst dragstart_event = () => {\n return new Event(\"dragstart\", {\n bubbles: true,\n cancelable: true,\n });\n};\n\nconst dragend_event = () => {\n return new Event(\"dragend\", {\n bubbles: true,\n cancelable: true,\n });\n};\n\nexport default {\n add_event_listener: add_event_listener,\n remove_event_listener: remove_event_listener,\n await_event: await_event,\n await_pattern_init: await_pattern_init,\n generic_event: generic_event,\n blur_event: blur_event,\n click_event: click_event,\n change_event: change_event,\n focus_event: focus_event,\n input_event: input_event,\n mousedown_event: mousedown_event,\n mouseup_event: mouseup_event,\n scroll_event: scroll_event,\n submit_event: submit_event,\n dragstart_event: dragstart_event,\n dragend_event: dragend_event,\n};\n","/**\n * A Base pattern for creating scoped patterns.\n *\n * Each instance of a pattern has its own local scope.\n * A new instance is created for each DOM element on which a pattern applies.\n *\n * For usage, see basepattern.md\n */\nimport events from \"./events\";\nimport logging from \"./logging\";\n\nconst log = logging.getLogger(\"basepattern\");\n\nclass BasePattern {\n static name; // name of pattern used in Registry.\n static trigger; // A CSS selector to match elements that should trigger the pattern instantiation.\n static parser; // Options parser.\n\n // Parser options\n parser_group_options = true;\n parser_multiple = undefined;\n parser_inherit = true;\n\n constructor(el, options = {}) {\n // Make static variables available on instance.\n this.name = this.constructor.name;\n this.trigger = this.constructor.trigger;\n this.parser = this.constructor.parser;\n\n if (!el) {\n log.warn(`No element given to pattern ${this.name}.`);\n return;\n }\n if (el.jquery) {\n el = el[0];\n }\n this.el = el;\n\n // Notify pre-init\n this.el.dispatchEvent(\n new Event(`pre-init.${this.name}.patterns`, {\n bubbles: true,\n cancelable: true,\n })\n );\n\n // Initialize asynchronously.\n //\n // 1) We need to call the concrete implementation of ``init``, but the\n // inheritance chain is not yet set up and ``init`` not available.\n //\n // 2) We want to wait for the init() to successfuly finish and fire an\n // event then.\n // But the constructer cannot not return a Promise, thus not be\n // asynchronous but only return itself.\n //\n // Both limitations are gone in next tick.\n //\n window.setTimeout(async () => {\n if (typeof this.el[`pattern-${this.name}`] !== \"undefined\") {\n // Do not reinstantiate\n log.debug(`Not reinstatiating the pattern ${this.name}.`, this.el);\n\n // Notify that not instantiated\n this.el.dispatchEvent(\n new Event(`not-init.${this.name}.patterns`, {\n bubbles: true,\n cancelable: false,\n })\n );\n return;\n }\n\n // Create the options object by parsing the element and using the\n // optional options as default.\n this.options =\n this.parser?.parse(\n this.el,\n options,\n this.parser_multiple,\n this.parser_inherit,\n this.parser_group_options\n ) ?? options;\n\n // Store pattern instance on element\n this.el[`pattern-${this.name}`] = this;\n\n // Initialize the pattern\n await this.init();\n\n // Notify that now ready\n this.el.dispatchEvent(\n new Event(`init.${this.name}.patterns`, {\n bubbles: true,\n cancelable: true,\n })\n );\n }, 0);\n }\n\n async init() {\n // Extend this method in your pattern.\n }\n\n /**\n * Listen to an event on the element only once.\n *\n * @param {string} event_name - Name of the event to listen to.\n * @param {function} callback - Callback to call when the event is thrown.\n */\n one(event_name, event_callback) {\n events.add_event_listener(\n this.el,\n `${event_name}.${this.name}.patterns`,\n `basepattern-one--${event_name}.${this.name}.patterns`,\n event_callback,\n {\n once: true,\n }\n );\n }\n\n /**\n * Destroy/remove/unload the pattern from the element.\n */\n destroy() {\n delete this.el[`pattern-${this.name}`];\n }\n}\n\nexport default BasePattern;\nexport { BasePattern };\n","/* Utilities for DOM traversal or navigation */\nimport logging from \"./logging\";\n\nconst logger = logging.getLogger(\"core dom\");\n\nconst DATA_PREFIX = \"__patternslib__data_prefix__\";\nconst DATA_STYLE_DISPLAY = \"__patternslib__style__display\";\n\n/**\n * Return an array of DOM nodes.\n *\n * @param {Node|NodeList|jQuery} nodes - The DOM node to start the search from.\n *\n * @returns {Array} - An array of DOM nodes.\n */\nconst toNodeArray = (nodes) => {\n if (nodes.jquery || nodes instanceof NodeList) {\n // jQuery or document.querySelectorAll\n nodes = [...nodes];\n } else if (nodes instanceof Array === false) {\n nodes = [nodes];\n }\n return nodes;\n};\n\n/**\n * Like querySelectorAll but including the element where it starts from.\n * Returns an Array, not a NodeList\n *\n * @param {Node} el - The DOM node to start the search from.\n *\n * @returns {Array} - The DOM nodes found.\n */\nconst querySelectorAllAndMe = (el, selector) => {\n if (!el) {\n return [];\n }\n\n const all = [...el.querySelectorAll(selector)];\n if (el.matches(selector)) {\n all.unshift(el); // start element should be first.\n }\n return all;\n};\n\n/**\n * Wrap a element with a wrapper element.\n *\n * The element to be wrapped will be moved into the wrapper element and the\n * wrapper element is placed just before the old element was.\n *\n * @param {Node} el - The DOM node to wrap.\n * @param {Node} wrapper - The wrapper element.\n */\nconst wrap = (el, wrapper) => {\n // See: https://stackoverflow.com/a/13169465/1337474\n el.parentNode.insertBefore(wrapper, el);\n wrapper.appendChild(el);\n};\n\n/**\n * Hides the element with ``display: none`` and stores the current display value.\n *\n * @param {Node} el - The DOM node to hide.\n */\nconst hide = (el) => {\n if (el.style.display === \"none\") {\n // Nothing to do.\n return;\n }\n if (el.style.display) {\n el[DATA_STYLE_DISPLAY] = el.style.display;\n }\n el.style.display = \"none\";\n};\n\n/**\n * Shows element by removing ``display: none`` and restoring the display value\n * to whatever it was before.\n *\n * @param {Node} el - The DOM node to show.\n */\nconst show = (el) => {\n const val = el[DATA_STYLE_DISPLAY] || null;\n el.style.display = val;\n delete el[DATA_STYLE_DISPLAY];\n};\n\n/**\n * Test, if a element is visible or not.\n *\n * @param {Node} el - The DOM node to test.\n * @returns {Boolean} - True if the element is visible.\n */\nconst is_visible = (el) => {\n // Check, if element is visible in DOM.\n // https://stackoverflow.com/a/19808107/1337474\n return el.offsetWidth > 0 && el.offsetHeight > 0;\n};\n\n/**\n * Test, if a element is a input-type element.\n *\n * This is taken from Sizzle/jQuery at:\n * https://github.com/jquery/sizzle/blob/f2a2412e5e8a5d9edf168ae3b6633ac8e6bd9f2e/src/sizzle.js#L139\n * https://github.com/jquery/sizzle/blob/f2a2412e5e8a5d9edf168ae3b6633ac8e6bd9f2e/src/sizzle.js#L1773\n *\n * @param {Node} el - The DOM node to test.\n * @returns {Boolean} - True if the element is a input-type element.\n */\nconst is_input = (el) => {\n const re_input = /^(?:input|select|textarea|button)$/i;\n return re_input.test(el.nodeName);\n};\n\n/**\n * Return all direct parents of ``el`` matching ``selector``.\n * This matches against all parents but not the element itself.\n * The order of elements is from the search starting point up to higher\n * DOM levels.\n *\n * @param {Node} el - The DOM node to start the search from.\n * @param {String} selector - CSS selector to match against.\n * @returns {Array} - List of matching DOM nodes.\n */\nconst find_parents = (el, selector) => {\n const ret = [];\n let parent = el;\n while (parent) {\n parent = parent.parentNode?.closest?.(selector);\n if (parent) ret.push(parent);\n }\n return ret;\n};\n\n/**\n * Find an element in the whole DOM tree if the selector is an ID selector,\n * otherwise use the given element as the starting point.\n *\n * @param {Node} el - The DOM node to start the search from.\n * @param {String} selector - The CSS selector to search for.\n *\n * @returns {NodeList} - The DOM nodes found.\n *\n */\nconst find_scoped = (el, selector) => {\n // If the selector starts with an object id do a global search,\n // otherwise do a local search.\n return (selector.indexOf(\"#\") === 0 ? document : el).querySelectorAll(selector);\n};\n\n/**\n * Return all HTMLElement parents of el, starting from the direct parent of el.\n * The document itself is excluded because it's not a real DOM node.\n *\n * @param {Node} el - The DOM node to start the search from.\n *\n * @returns {Array} - The DOM nodes found.\n */\nconst get_parents = (el) => {\n // Return all HTMLElement parents of el, starting from the direct parent of el.\n const parents = [];\n let parent = el?.parentNode;\n while (parent) {\n parents.push(parent);\n parent = parent?.parentNode;\n parent = parent instanceof HTMLElement ? parent : null;\n }\n return parents;\n};\n\n/**\n * Return the value of the first attribute found in the list of parents.\n *\n * @param {Node} el - The DOM element to start the acquisition search for the given attribute.\n * @param {string} attribute - Name of the attribute to search for.\n * @param {Boolean} include_empty - Also return empty values.\n * @param {Boolean} include_all - Return a list of attribute values found in all parents.\n *\n * @returns {*} - Returns the value of the searched attribute or a list of all attributes.\n */\nconst acquire_attribute = (\n el,\n attribute,\n include_empty = false,\n include_all = false\n) => {\n let _el = el;\n const ret = []; // array for ``include_all`` mode.\n while (_el) {\n const val = _el.getAttribute(attribute);\n if (val || (include_empty && val === \"\")) {\n if (!include_all) {\n return val;\n }\n ret.push(val);\n }\n _el = _el.parentElement;\n }\n if (include_all) {\n return ret;\n }\n};\n\n/**\n * Return a DocumentFragment from a given string.\n *\n * @param {String} string - The HTML structure as a string.\n *\n * @returns {DocumentFragment} - The DOM nodes as a DocumentFragment.\n */\nconst create_from_string = (string) => {\n // See: https://davidwalsh.name/convert-html-stings-dom-nodes\n return document.createRange().createContextualFragment(string.trim());\n};\n\n/**\n * Return a CSS property value for a given DOM node.\n * For length-values, relative values are converted to pixels.\n * Optionally parse as pixels, if applicable.\n *\n * Note: The element must be attached to the body to make CSS caluclations work.\n *\n * @param {Node} el - DOM node.\n * @param {String} property - CSS property to query on DOM node.\n * @param {Boolean} [as_pixels=false] - Convert value to pixels, if applicable.\n * @param {Boolean} [as_float=false] - Convert value to float, if applicable.\n *\n * @returns {(String|Number)} - The CSS value to return.\n */\nfunction get_css_value(el, property, as_pixels = false, as_float = false) {\n let value = window.getComputedStyle(el).getPropertyValue(property);\n if (as_pixels || as_float) {\n value = parseFloat(value) || 0.0;\n }\n if (as_pixels && !as_float) {\n value = parseInt(Math.round(value), 10);\n }\n return value;\n}\n\n/**\n * Find a scrollable element up in the DOM tree.\n *\n * Note: Setting the ``overflow`` shorthand property also sets the individual overflow-y and overflow-y properties.\n *\n * @param {Node} el - The DOM element to start the search on.\n * @param {String} [direction=] - Not given: Search for any scrollable element up in the DOM tree.\n * ``x``: Search for a horizontally scrollable element.\n * ``y``: Search for a vertically scrollable element.\n * @param {(Node|null)} [fallback=document.body] - Fallback, if no scroll container can be found.\n * The default is to use document.body.\n *\n * @returns {Node} - Return the first scrollable element.\n * If no other element could be found, document.body would be returned.\n */\nconst find_scroll_container = (el, direction, fallback = document.body) => {\n while (el && el !== document.body) {\n if (!direction || direction === \"y\") {\n let overflow_y = get_css_value(el, \"overflow-y\");\n if ([\"auto\", \"scroll\"].includes(overflow_y)) {\n return el;\n }\n }\n if (!direction || direction === \"x\") {\n let overflow_x = get_css_value(el, \"overflow-x\");\n if ([\"auto\", \"scroll\"].includes(overflow_x)) {\n return el;\n }\n }\n el = el.parentElement;\n }\n return fallback;\n};\n\n/**\n * Get the horizontal scroll position.\n *\n * @param {Node} scroll_reference - The element to get the scroll position from.\n *\n * @returns {number} The horizontal scroll position.\n */\nconst get_scroll_x = (scroll_reference) => {\n // scroll_listener == window: window.scrollX\n // scroll_listener == html: html.scrollLeft == window.scrollX\n // scroll_listener == DOM node: node.scrollLeft\n return typeof scroll_reference.scrollLeft !== \"undefined\"\n ? scroll_reference.scrollLeft\n : scroll_reference.scrollX;\n};\n\n/**\n * Get the vertical scroll position.\n *\n * @param {Node} scroll_reference - The element to get the scroll position from.\n *\n * @returns {number} The vertical scroll position.\n */\nconst get_scroll_y = (scroll_reference) => {\n // scroll_listener == window: window.scrollY\n // scroll_listener == html: html.scrollTop == window.scrollY\n // scroll_listener == DOM node: node.scrollTop\n return typeof scroll_reference.scrollTop !== \"undefined\"\n ? scroll_reference.scrollTop\n : scroll_reference.scrollY;\n};\n\n/**\n * Get the elements position relative to another element.\n *\n * @param {Node} el - The DOM element to get the position for.\n * @param {Node} [reference_el=document.body] - The DOM element to get the position relative to.\n *\n * @returns {{top: number, left: number}} - The position of the element relative to the other element.\n */\nconst get_relative_position = (el, reference_el = document.body) => {\n // Get the reference element to which against we calculate\n // the relative position of the target.\n // In case of a scroll container of window, we do not have\n // getBoundingClientRect method, so get the body instead.\n if (reference_el === window) {\n reference_el = document.body;\n }\n\n // Calculate absolute [¹] position difference between\n // scroll_container and scroll_target.\n // Substract the container's border from the scrolling\n // value, as this one isn't respected by\n // getBoundingClientRect [²] and would lead to covered\n // items [³].\n // ¹) so that it doesn't make a difference, if the element\n // is below or above the scrolling container. We just need\n // to know the absolute difference.\n // ²) Calculations are based from the viewport.\n // ³) See:\n // https://docs.microsoft.com/en-us/previous-versions//hh781509(v=vs.85)\n // https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect\n const left = Math.abs(\n el.getBoundingClientRect().left +\n reference_el.scrollLeft -\n reference_el.getBoundingClientRect().left -\n dom.get_css_value(reference_el, \"border-left-width\", true)\n );\n const top = Math.abs(\n el.getBoundingClientRect().top +\n reference_el.scrollTop -\n reference_el.getBoundingClientRect().top -\n dom.get_css_value(reference_el, \"border-top-width\", true)\n );\n\n return { top, left };\n};\n\n/**\n * Scroll to a given element.\n * The element will be scrolled to the top of the scroll container.\n *\n * @param {Node} el - The element which should be scrolled to.\n * @param {Node} scroll_container - The element which is scrollable.\n * @param {number} [offset=0] - Optional offset in pixels to stop scrolling before the target position. Can also be a negative number.\n * @param {string} [direction=\"top\"] - The direction to scroll to. Can be either \"top\", \"left\" or \"both\".\n */\nconst scroll_to_element = (el, scroll_container, offset = 0, direction = \"top\") => {\n // Get the position of the element relative to the scroll container.\n const position = get_relative_position(el, scroll_container);\n\n const options = { behavior: \"auto\" };\n if (direction === \"top\" || direction === \"both\") {\n options.top = position.top - offset;\n }\n if (direction === \"left\" || direction === \"both\") {\n options.left = position.left - offset;\n }\n\n // Scroll to the target position.\n scroll_container.scrollTo(options);\n};\n\n/**\n * Scroll to the top of a scrolling container.\n *\n * @param {Node} [scroll_container = document.body] - The element which is scrollable.\n * @param {number} [offset=0] - Optional offset in pixels to stop scrolling before the target position. Can also be a negative number.\n */\nconst scroll_to_top = (scroll_container = document.body, offset = 0) => {\n // Just scroll up, period.\n scroll_container.scrollTo({ top: 0 - offset, behavior: \"auto\" });\n};\n\n/**\n * Scroll to the bottom of a scrolling container.\n *\n * @param {Node} [scroll_container = document.body] - The element which is scrollable.\n * @param {number} [offset=0] - Optional offset in pixels to stop scrolling before the target position. Can also be a negative number.\n */\nconst scroll_to_bottom = (scroll_container = document.body, offset = 0) => {\n // Just scroll up, period.\n //\n const top = (scroll_container === window ? document.body : scroll_container)\n .scrollHeight;\n scroll_container.scrollTo({ top: top - offset, behavior: \"auto\" });\n};\n\n/**\n * Get data stored directly on the node instance.\n * We are using a prefix to make sure the data doesn't collide with other attributes.\n *\n * @param el {Node} - The DOM node from which we want to retrieve the data.\n * @param name {String} - The name of the variable. Note - this is stored on\n * the DOM node prefixed with the DATA_PREFIX.\n * @param default_value {Any} - Optional default value.\n * @returns {Any} - The value which is stored on the DOM node.\n */\nconst get_data = (el, name, default_value) => {\n return el[`${DATA_PREFIX}${name}`] || default_value;\n};\n\n/**\n * Set and store data directly on the node instance.\n * We are using a prefix to make sure the data doesn't collide with other attributes.\n *\n * @param el {Node} - The DOM node which we want to store the data on.\n * @param name {String} - The name of the variable. Note - this is stored on\n * the DOM node prefixed with the DATA_PREFIX.\n * @param value {Any} - The value we want to store on the DOM node.\n */\nconst set_data = (el, name, value) => {\n el[`${DATA_PREFIX}${name}`] = value;\n};\n\n/**\n * Delete a variable from the node instance.\n * We are using a prefix to make sure the data doesn't collide with other attributes.\n *\n * @param el {Node} - The DOM node which we want to delete the variable from.\n * @param name {String} - The name of the variable. Note - this is stored on\n * the DOM node prefixed with the DATA_PREFIX.\n */\nconst delete_data = (el, name) => {\n delete el[`${DATA_PREFIX}${name}`];\n};\n\n/**\n * Simple template engine, based on JS template literal\n *\n * NOTE: This uses eval and would break if Content-Security-Policy does not\n * allow 'unsafe-eval'.\n * Because of this CSR problem the use of this method is not recommended.\n *\n * Please note: You cannot pass a template literal as template_string.\n * JavaScript itself would try to expand it and would fail.\n *\n * See: https://stackoverflow.com/a/37217166/1337474\n *\n * @param {String} template_string - The template string as a JavaScript template literal.\n * For each variable in the template you have to use ``this``.\n * E.g. if you pass ``{message: \"ok\"}`` as template_variables, you can use it like so:\n * `${this.message}
`\n * @param {Object} template_variables - Object literal with all the variables which should be used in the template.\n *\n * @returns {String} - Returns the a string as template expanded with the template_variables.\n */\nconst template = (template_string, template_variables = {}) => {\n logger.warn(\n \"Using dom.template is not recommended due to a problem with Content-Security-Policy.\"\n );\n return new Function(\"return `\" + template_string + \"`;\").call(template_variables);\n};\n\n/**\n * Get the visible ratio of an element compared to container.\n * If no container is given, the viewport is used.\n *\n * Note: currently only vertical ratio is supported.\n *\n * @param {Node} el - The element to get the visible ratio from.\n * @param {Node} [container] - The container to compare the element to.\n * @returns {number} - The visible ratio of the element.\n * 0 means the element is not visible.\n * 1 means the element is fully visible.\n */\nconst get_visible_ratio = (el, container) => {\n if (!el) {\n return 0;\n }\n\n const rect = el.getBoundingClientRect();\n const container_rect =\n container !== window\n ? container.getBoundingClientRect()\n : {\n top: 0,\n bottom: window.innerHeight,\n };\n\n let visible_ratio = 0;\n if (rect.top < container_rect.bottom && rect.bottom > container_rect.top) {\n const rect_height = rect.bottom - rect.top;\n const visible_height =\n Math.min(rect.bottom, container_rect.bottom) -\n Math.max(rect.top, container_rect.top);\n visible_ratio = visible_height / rect_height;\n }\n\n return visible_ratio;\n};\n\n/**\n * Get an escaped CSS selector for a given id string.\n *\n * id selectors should - but don't have to - start with a letter.\n * If the id starts with a number or a dash, it should be escaped.\n * This method does that for you.\n *\n * Alse see:\n * - https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id\n * - https://developer.mozilla.org/en-US/docs/Web/API/CSS/escape\n *\n * @param {String} id - The id to escape.\n *\n * @returns {String} - The escaped CSS selector.\n *\n * @example\n * escape_css_id_selector(\"#123\"); // returns \"#\\\\31 23\"\"\n * escape_css_id_selector(\"#-123\"); // returns \"#-\\\\31 23\"\n */\nconst escape_css_id = (id) => {\n return `#${CSS.escape(id.split(\"#\")[1])}`;\n};\n\n/**\n * Get a universally unique id (uuid) for a DOM element.\n *\n * This method returns a uuid for the given element. On the first call it will\n * generate a uuid and store it on the element.\n *\n * @param {Node} el - The DOM node to get the uuid for.\n * @returns {String} - The uuid.\n */\nconst element_uuid = (el) => {\n if (!get_data(el, \"uuid\", false)) {\n let uuid;\n if (window.crypto.randomUUID) {\n // Create a real UUID\n // window.crypto.randomUUID does only exist in browsers with secure\n // context.\n // See: https://developer.mozilla.org/en-US/docs/Web/API/Crypto/randomUUID\n uuid = window.crypto.randomUUID();\n } else {\n // Create a sufficiently unique ID\n const array = new Uint32Array(4);\n uuid = window.crypto.getRandomValues(array).join(\"\");\n }\n set_data(el, \"uuid\", uuid);\n }\n return get_data(el, \"uuid\");\n};\n\n/**\n * Find a related form element.\n *\n * @param {Node} el - The DOM node to start the search from.\n * @returns {Node} - The closest form element.\n *\n * @example\n * find_form(document.querySelector(\"input\"));\n */\nconst find_form = (el) => {\n // Prefer input.form which allows for input outside form elements and fall\n // back to search for a parent form.\n const form =\n el.closest(\".pat-subform\") || // Special Patternslib subform concept has precedence.\n el.form ||\n el.querySelector(\"input, select, textarea, button\")?.form ||\n el.closest(\"form\");\n return form;\n};\n\nconst dom = {\n toNodeArray: toNodeArray,\n querySelectorAllAndMe: querySelectorAllAndMe,\n wrap: wrap,\n hide: hide,\n show: show,\n find_parents: find_parents,\n find_scoped: find_scoped,\n get_parents: get_parents,\n acquire_attribute: acquire_attribute,\n is_visible: is_visible,\n is_input: is_input,\n create_from_string: create_from_string,\n get_css_value: get_css_value,\n find_scroll_container: find_scroll_container,\n get_scroll_x: get_scroll_x,\n get_scroll_y: get_scroll_y,\n get_relative_position: get_relative_position,\n scroll_to_element: scroll_to_element,\n scroll_to_top: scroll_to_top,\n scroll_to_bottom: scroll_to_bottom,\n get_data: get_data,\n set_data: set_data,\n delete_data: delete_data,\n template: template,\n get_visible_ratio: get_visible_ratio,\n escape_css_id: escape_css_id,\n element_uuid: element_uuid,\n find_form: find_form,\n};\n\nexport default dom;\n","/**\n * Patterns logging - minimal logging framework\n *\n * Copyright 2012 Simplon B.V.\n */\n\n// source: https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/bind\nif (!Function.prototype.bind) {\n Function.prototype.bind = function (oThis) {\n if (typeof this !== \"function\") {\n // closest thing possible to the ECMAScript 5 internal IsCallable function\n throw new TypeError(\n \"Function.prototype.bind - what is trying to be bound is not callable\"\n );\n }\n\n var aArgs = Array.prototype.slice.call(arguments, 1),\n fToBind = this,\n fNOP = function () {},\n fBound = function () {\n return fToBind.apply(\n this instanceof fNOP && oThis ? this : oThis,\n aArgs.concat(Array.prototype.slice.call(arguments))\n );\n };\n fNOP.prototype = this.prototype;\n fBound.prototype = new fNOP();\n\n return fBound;\n };\n}\n\nvar root, // root logger instance\n writer; // writer instance, used to output log entries\n\nvar Level = {\n DEBUG: 10,\n INFO: 20,\n WARN: 30,\n ERROR: 40,\n FATAL: 50,\n};\n\nfunction ConsoleWriter() {}\n\nConsoleWriter.prototype = {\n output: function (log_name, level, messages) {\n if (log_name) messages.unshift(log_name + \":\");\n if (level <= Level.DEBUG) {\n // console.debug exists but is deprecated\n messages.unshift(\"[DEBUG]\");\n console.log.apply(console, messages);\n } else if (level <= Level.INFO) console.info.apply(console, messages);\n else if (level <= Level.WARN) console.warn.apply(console, messages);\n else console.error.apply(console, messages);\n },\n};\n\nfunction Logger(name, parent) {\n this._loggers = {};\n this.name = name || \"\";\n this._parent = parent || null;\n if (!parent) {\n this._enabled = true;\n this._level = Level.WARN;\n }\n}\n\nLogger.prototype = {\n getLogger: function (name) {\n var path = name.split(\".\"),\n root = this,\n route = this.name ? [this.name] : [];\n while (path.length) {\n var entry = path.shift();\n route.push(entry);\n if (!(entry in root._loggers))\n root._loggers[entry] = new Logger(route.join(\".\"), root);\n root = root._loggers[entry];\n }\n return root;\n },\n\n _getFlag: function (flag) {\n var context = this;\n flag = \"_\" + flag;\n while (context !== null) {\n if (context[flag] !== undefined) return context[flag];\n context = context._parent;\n }\n return null;\n },\n\n setEnabled: function (state) {\n this._enabled = !!state;\n },\n\n isEnabled: function () {\n this._getFlag(\"enabled\");\n },\n\n setLevel: function (level) {\n if (typeof level === \"number\") this._level = level;\n else if (typeof level === \"string\") {\n level = level.toUpperCase();\n if (level in Level) this._level = Level[level];\n }\n },\n\n getLevel: function () {\n return this._getFlag(\"level\");\n },\n\n log: function (level, messages) {\n if (\n !messages.length ||\n !this._getFlag(\"enabled\") ||\n level < this._getFlag(\"level\")\n )\n return;\n messages = Array.prototype.slice.call(messages);\n writer.output(this.name, level, messages);\n },\n\n debug: function () {\n this.log(Level.DEBUG, arguments);\n },\n\n info: function () {\n this.log(Level.INFO, arguments);\n },\n\n warn: function () {\n this.log(Level.WARN, arguments);\n },\n\n error: function () {\n this.log(Level.ERROR, arguments);\n },\n\n fatal: function () {\n this.log(Level.FATAL, arguments);\n },\n};\n\nfunction getWriter() {\n return writer;\n}\n\nfunction setWriter(w) {\n writer = w;\n}\n\nsetWriter(new ConsoleWriter());\n\nroot = new Logger();\n\nvar logconfig = /loglevel(|-[^=]+)=([^&]+)/g,\n match;\n\nwhile ((match = logconfig.exec(window.location.search)) !== null) {\n var logger = match[1] === \"\" ? root : root.getLogger(match[1].slice(1));\n logger.setLevel(match[2].toUpperCase());\n}\n\nvar api = {\n Level: Level,\n getLogger: root.getLogger.bind(root),\n setEnabled: root.setEnabled.bind(root),\n isEnabled: root.isEnabled.bind(root),\n setLevel: root.setLevel.bind(root),\n getLevel: root.getLevel.bind(root),\n debug: root.debug.bind(root),\n info: root.info.bind(root),\n warn: root.warn.bind(root),\n error: root.error.bind(root),\n fatal: root.fatal.bind(root),\n getWriter: getWriter,\n setWriter: setWriter,\n};\n\nexport default api;\n","// Patterns argument parser\nimport $ from \"jquery\";\nimport utils from \"./utils.js\";\nimport logging from \"./logging\";\n\nclass ArgumentParser {\n constructor(name) {\n this.order = [];\n this.parameters = {};\n this.attribute = \"data-pat-\" + name;\n this.enum_values = {};\n this.enum_conflicts = [];\n this.groups = {};\n this.possible_groups = {};\n this.log = logging.getLogger(name + \".parser\");\n\n this.group_pattern = /([a-z][a-z0-9]*)-([A-Z][a-z0-0\\-]*)/i;\n this.json_param_pattern = /^\\s*\\[?\\s*{/i;\n this.named_param_pattern = /^\\s*([a-z][a-z0-9\\-]*)\\s*:(.*)/is;\n this.token_pattern = /(([\"']).*?(?!\\\\)\\2)|\\s*(\\S+)\\s*/g;\n }\n\n _camelCase(str) {\n return str.replace(/\\-([a-z])/g, (__, p1) => p1.toUpperCase());\n }\n\n addAlias(alias, original) {\n /* Add an alias for a previously added parser argument.\n *\n * Useful when you want to support both US and UK english argument\n * names.\n */\n if (this.parameters[original]) {\n this.parameters[original].alias = alias;\n } else {\n throw `Attempted to add an alias \"${alias}\" for a non-existing parser argument \"${original}\".`;\n }\n }\n\n addGroupToSpec(spec) {\n /* Determine wether an argument being parsed can be grouped and\n * update its specifications object accordingly.\n *\n * Internal method used by addArgument and addJSONArgument\n */\n const m = spec.name.match(this.group_pattern);\n if (m) {\n const group = m[1];\n const field = m[2];\n if (group in this.possible_groups) {\n const first_spec = this.possible_groups[group];\n const first_name = first_spec.name.match(this.group_pattern)[2];\n first_spec.group = group;\n first_spec.dest = first_name;\n this.groups[group] = new ArgumentParser();\n this.groups[group].addArgument(\n first_name,\n first_spec.value,\n first_spec.choices,\n first_spec.multiple\n );\n delete this.possible_groups[group];\n }\n if (group in this.groups) {\n this.groups[group].addArgument(\n field,\n spec.value,\n spec.choices,\n spec.multiple\n );\n spec.group = group;\n spec.dest = field;\n } else {\n this.possible_groups[group] = spec;\n spec.dest = this._camelCase(spec.name);\n }\n }\n return spec;\n }\n\n addJSONArgument(name, default_value) {\n /* Add an argument where the value is provided in JSON format.\n *\n * This is a different usecase than specifying all arguments to\n * the data-pat-... attributes in JSON format, and instead is part\n * of the normal notation except that a value is in JSON instead of\n * for example a string.\n */\n this.order.push(name);\n this.parameters[name] = this.addGroupToSpec({\n name: name,\n value: default_value,\n dest: name,\n group: null,\n type: \"json\",\n });\n }\n\n addArgument(name, default_value, choices, multiple) {\n const spec = {\n name: name,\n value:\n multiple && !Array.isArray(default_value)\n ? [default_value]\n : default_value,\n multiple: multiple,\n dest: name,\n group: null,\n };\n if (choices && Array.isArray(choices) && choices.length) {\n spec.choices = choices;\n spec.type = this._typeof(choices[0]);\n for (const choice of choices) {\n if (this.enum_conflicts.indexOf(choice) !== -1) {\n continue;\n } else if (choice in this.enum_values) {\n this.enum_conflicts.push(choice);\n delete this.enum_values[choice];\n } else {\n this.enum_values[choice] = name;\n }\n }\n } else if (typeof spec.value === \"string\" && spec.value.slice(0, 1) === \"$\") {\n spec.type = this.parameters[spec.value.slice(1)].type;\n } else {\n // Note that this will get reset by _defaults if default_value is a function.\n spec.type = this._typeof(multiple ? spec.value[0] : spec.value);\n }\n this.order.push(name);\n this.parameters[name] = this.addGroupToSpec(spec);\n }\n\n _typeof(obj) {\n if (obj === null) {\n return \"null\";\n }\n return typeof obj;\n }\n\n _coerce(name, value) {\n const spec = this.parameters[name];\n if (typeof value !== spec.type)\n try {\n switch (spec.type) {\n case \"json\":\n value = JSON.parse(value);\n break;\n case \"boolean\":\n if (typeof value === \"string\") {\n value = value.toLowerCase();\n const num = parseInt(value, 10);\n if (!isNaN(num)) value = !!num;\n else\n value =\n value === \"true\" ||\n value === \"y\" ||\n value === \"yes\" ||\n value === \"y\" ||\n value === \"on\";\n } else if (typeof value === \"number\") {\n value = !!value;\n } else {\n throw `Cannot convert value for ${name} to boolean.`;\n }\n break;\n case \"number\":\n if (typeof value === \"string\") {\n value = parseInt(value, 10);\n if (isNaN(value)) {\n throw `Cannot convert value for ${name} to number.`;\n }\n } else if (typeof value === \"boolean\") {\n value = value + 0;\n } else {\n throw `Cannot convert value for ${name} to number.`;\n }\n break;\n case \"string\":\n value = value.toString();\n break;\n case \"null\": // Missing default values\n case \"undefined\":\n break;\n default:\n throw `Do not know how to convert value for ${name} of type ${typeof value} to ${\n spec.type\n }.`;\n }\n } catch (e) {\n this.log.warn(e);\n return null;\n }\n\n if (spec.choices && spec.choices.indexOf(value) === -1) {\n this.log.warn(`Illegal value for ${name}: ${value}.`);\n return null;\n }\n return value;\n }\n\n _set(opts, name, value) {\n if (!(name in this.parameters)) {\n this.log.debug(`Ignoring value for unknown argument: ${name}.`);\n return;\n }\n const spec = this.parameters[name];\n let parts;\n if (spec.multiple) {\n if (typeof value === \"string\") {\n parts = value.split(/,+/);\n } else {\n parts = value;\n }\n value = [];\n for (const part of parts) {\n const v = this._coerce(name, part.trim());\n if (v !== null) {\n value.push(v);\n }\n }\n } else {\n value = this._coerce(name, value);\n if (value === null) {\n return;\n }\n }\n opts[name] = value;\n }\n\n _split(text) {\n const tokens = [];\n text.replace(this.token_pattern, (match, quoted, __, simple) => {\n if (quoted) {\n tokens.push(quoted);\n } else if (simple) {\n tokens.push(simple);\n }\n });\n return tokens;\n }\n\n _parseExtendedNotation(argstring) {\n const opts = {};\n const parts = argstring\n .replace(/;;/g, \"\\0x1f\")\n .replace(/&/g, \"&\\0x1f\")\n .split(/;/)\n .map((el) => el.replace(new RegExp(\"\\0x1f\", \"g\"), \";\"));\n for (const part of parts) {\n if (!part) {\n continue;\n }\n const matches = part.match(this.named_param_pattern);\n if (!matches) {\n this.log.warn(`Invalid parameter: ${part}: ${argstring}.`);\n continue;\n }\n const name = matches[1];\n const value = matches[2].trim();\n const arg = Object.values(this.parameters).filter((it) => it.alias === name);\n\n const is_alias = arg.length === 1;\n\n if (is_alias) {\n this._set(opts, arg[0].name, value);\n } else if (name in this.parameters) {\n this._set(opts, name, value);\n } else if (name in this.groups) {\n const subopt = this.groups[name]._parseShorthandNotation(value);\n for (const field in subopt) {\n this._set(opts, name + \"-\" + field, subopt[field]);\n }\n } else {\n this.log.warn(`Unknown named parameter: ${matches[1]}.`);\n continue;\n }\n }\n return opts;\n }\n\n _parseShorthandNotation(parameter) {\n const parts = this._split(parameter);\n const opts = {};\n let i = 0;\n\n while (parts.length) {\n const part = parts.shift().trim();\n let sense;\n let flag;\n let positional = true;\n if (part.slice(0, 3) === \"no-\") {\n sense = false;\n flag = part.slice(3);\n } else {\n sense = true;\n flag = part;\n }\n if (flag in this.parameters && this.parameters[flag].type === \"boolean\") {\n positional = false;\n this._set(opts, flag, sense);\n } else if (flag in this.enum_values) {\n positional = false;\n this._set(opts, this.enum_values[flag], flag);\n } else if (positional) this._set(opts, this.order[i], part);\n else {\n parts.unshift(part);\n break;\n }\n i++;\n if (i >= this.order.length) {\n break;\n }\n }\n if (parts.length) this.log.warn(`Ignore extra arguments: ${parts.join(\" \")}.`);\n return opts;\n }\n\n _parse(parameter) {\n if (!parameter) {\n return {};\n }\n if (parameter.match(this.json_param_pattern)) {\n try {\n return JSON.parse(parameter);\n } catch (e) {\n this.log.warn(`Invalid JSON argument found: ${parameter}.`);\n }\n }\n if (parameter.match(this.named_param_pattern)) {\n return this._parseExtendedNotation(parameter);\n }\n const sep = parameter.indexOf(\";\");\n if (sep === -1) {\n return this._parseShorthandNotation(parameter);\n }\n const opts = this._parseShorthandNotation(parameter.slice(0, sep));\n const extended = this._parseExtendedNotation(parameter.slice(sep + 1));\n for (const name in extended) {\n opts[name] = extended[name];\n }\n return opts;\n }\n\n _defaults($el) {\n const result = {};\n for (const name in this.parameters) {\n if (typeof this.parameters[name].value === \"function\") {\n try {\n result[name] = this.parameters[name].value($el, name);\n this.parameters[name].type = typeof result[name];\n } catch (e) {\n this.log.error(`Default function for ${name} failed.`);\n }\n } else {\n result[name] = this.parameters[name].value;\n }\n }\n return result;\n }\n\n _cleanupOptions(options, group_options = true) {\n // Resolve references\n for (const name of Object.keys(options)) {\n const spec = this.parameters[name];\n if (spec === undefined) {\n continue;\n }\n\n if (\n options[name] === spec.value &&\n typeof spec.value === \"string\" &&\n spec.value.slice(0, 1) === \"$\"\n ) {\n options[name] = options[spec.value.slice(1)];\n }\n }\n if (group_options) {\n // Move options into groups and do renames\n for (const name of Object.keys(options)) {\n const spec = this.parameters[name];\n let target;\n if (spec === undefined) {\n continue;\n }\n\n if (spec.group) {\n if (typeof options[spec.group] !== \"object\") {\n options[spec.group] = {};\n }\n target = options[spec.group];\n } else {\n target = options;\n }\n\n if (spec.dest !== name) {\n target[spec.dest] = options[name];\n delete options[name];\n }\n }\n }\n return options;\n }\n\n parse($el, options, multiple, inherit = true, group_options = true) {\n if (!$el.jquery) {\n $el = $($el);\n }\n if (typeof options === \"boolean\" && multiple === undefined) {\n // Fix argument order: ``multiple`` passed instead of ``options``.\n multiple = options;\n options = {};\n }\n const stack = inherit ? [[this._defaults($el)]] : [[{}]];\n let $possible_config_providers;\n let final_length = 1;\n /*\n * XXX this is a workaround for:\n * - https://github.com/Patternslib/Patterns/issues/393\n *\n * Prevents the parser to pollute the pat-modal configuration\n * with data-pat-inject elements define in a `.pat-modal` parent element.\n *\n * Probably this function should be completely revisited, see:\n * - https://github.com/Patternslib/Patterns/issues/627\n *\n */\n if (\n !inherit ||\n ($el.hasClass(\"pat-modal\") && this.attribute === \"data-pat-inject\")\n ) {\n $possible_config_providers = $el;\n } else {\n $possible_config_providers = $el.parents(`[${this.attribute}]`).addBack();\n }\n\n for (const provider of $possible_config_providers) {\n let frame;\n const data = ($(provider).attr(this.attribute) || \"\").trim();\n if (!data) {\n continue;\n }\n const _parse = this._parse.bind(this);\n if (data.match(/&&/)) {\n frame = data.split(/\\s*&&\\s*/).map(_parse);\n } else {\n frame = _parse(data);\n }\n if (!Array.isArray(frame)) {\n frame = [frame];\n }\n final_length = Math.max(frame.length, final_length);\n stack.push(frame);\n }\n\n if (typeof options === \"object\") {\n if (Array.isArray(options)) {\n stack.push(options);\n final_length = Math.max(options.length, final_length);\n } else {\n stack.push([options]);\n }\n }\n if (!multiple) {\n final_length = 1;\n }\n const results = utils\n .removeDuplicateObjects(utils.mergeStack(stack, final_length))\n .map((current_value) => this._cleanupOptions(current_value, group_options));\n return multiple ? results : results[0];\n }\n}\n\n// BBB\nArgumentParser.prototype.add_argument = ArgumentParser.prototype.addArgument;\n\nexport default ArgumentParser;\n","/**\n * Patterns registry - Central registry and scan logic for patterns\n *\n * Copyright 2012-2013 Simplon B.V.\n * Copyright 2012-2013 Florian Friesdorf\n * Copyright 2013 Marko Durkovic\n * Copyright 2013 Rok Garbas\n * Copyright 2014-2015 Syslab.com GmBH, JC Brand\n */\n\n/*\n * changes to previous patterns.register/scan mechanism\n * - if you want initialised class, do it in init\n * - init returns set of elements actually initialised\n * - handle once within init\n * - no turnstile anymore\n * - set pattern.jquery_plugin if you want it\n */\nimport $ from \"jquery\";\nimport dom from \"./dom\";\nimport logging from \"./logging\";\nimport utils from \"./utils\";\n\nconst log = logging.getLogger(\"registry\");\nconst disable_re = /patterns-disable=([^&]+)/g;\nconst dont_catch_re = /patterns-dont-catch/g;\nconst disabled = {};\nlet dont_catch = false;\nlet match;\n\nwhile ((match = disable_re.exec(window.location.search)) !== null) {\n disabled[match[1]] = true;\n log.info(\"Pattern disabled via url config:\", match[1]);\n}\n\nwhile ((match = dont_catch_re.exec(window.location.search)) !== null) {\n dont_catch = true;\n log.info(\"I will not catch init exceptions\");\n}\n\n/**\n * Global pattern registry.\n *\n * This is a singleton and shared among any instance of the Patternslib\n * registry since Patternslib version 8.\n *\n * You normally don't need this as the registry handles it for you.\n */\nif (typeof window.__patternslib_registry === \"undefined\") {\n window.__patternslib_registry = {};\n}\nexport const PATTERN_REGISTRY = window.__patternslib_registry;\nif (typeof window.__patternslib_registry_initialized === \"undefined\") {\n window.__patternslib_registry_initialized = false;\n}\n\nconst registry = {\n patterns: PATTERN_REGISTRY, // reference to global patterns registry\n // as long as the registry is not initialized, pattern\n // registration just registers a pattern. Once init is called,\n // the DOM is scanned. After that registering a new pattern\n // results in rescanning the DOM only for this pattern.\n init() {\n $(document).ready(function () {\n if (window.__patternslib_registry_initialized) {\n // Do not reinitialize a already initialized registry.\n return;\n }\n window.__patternslib_registry_initialized = true;\n log.debug(\"Loaded: \" + Object.keys(registry.patterns).sort().join(\", \"));\n registry.scan(document.body);\n log.debug(\"Finished initial scan.\");\n });\n },\n\n clear() {\n // Removes all patterns from the registry. Currently only being\n // used in tests.\n for (const name in registry.patterns) {\n delete registry.patterns[name];\n }\n },\n\n transformPattern(name, content) {\n /* Call the transform method on the pattern with the given name, if\n * it exists.\n */\n if (disabled[name]) {\n log.debug(`Skipping disabled pattern: ${name}.`);\n return;\n }\n\n const pattern = registry.patterns[name];\n const transform = pattern.transform || pattern.prototype?.transform;\n if (transform) {\n try {\n transform($(content));\n } catch (e) {\n if (dont_catch) {\n throw e;\n }\n log.error(`Transform error for pattern ${name}.`, e);\n }\n }\n },\n\n initPattern(name, el, trigger) {\n /* Initialize the pattern with the provided name and in the context\n * of the passed in DOM element.\n */\n const $el = $(el);\n const pattern = registry.patterns[name];\n const plog = logging.getLogger(`pat.${name}`);\n if (el.matches(pattern.trigger)) {\n plog.debug(\"Initialising.\", el);\n try {\n if (pattern.init) {\n // old style initialisation\n pattern.init($el, null, trigger);\n } else {\n // class based pattern initialisation\n new pattern($el, null, trigger);\n }\n\n plog.debug(\"done.\");\n } catch (e) {\n if (dont_catch) {\n throw e;\n }\n plog.error(\"Caught error:\", e);\n }\n }\n },\n\n orderPatterns(patterns) {\n // Always add pat-validation as first pattern, so that it can prevent\n // other patterns from reacting to submit events if form validation\n // fails.\n if (patterns.includes(\"validation\")) {\n patterns.splice(patterns.indexOf(\"validation\"), 1);\n patterns.unshift(\"validation\");\n }\n // Add clone-code to the very beginning - we want to copy the markup\n // before any other patterns changed the markup.\n if (patterns.includes(\"clone-code\")) {\n patterns.splice(patterns.indexOf(\"clone-code\"), 1);\n patterns.unshift(\"clone-code\");\n }\n\n return patterns;\n },\n\n scan(content, patterns, trigger) {\n if (!content) {\n return;\n }\n\n if (typeof content === \"string\") {\n content = document.querySelector(content);\n } else if (content instanceof Text) {\n // No need to scan a TextNode.\n return;\n } else if (content.jquery) {\n content = content[0];\n }\n\n const selectors = [];\n patterns = this.orderPatterns(patterns || Object.keys(registry.patterns));\n for (const name of patterns) {\n this.transformPattern(name, content);\n const pattern = registry.patterns[name];\n if (pattern.trigger) {\n selectors.unshift(pattern.trigger);\n }\n }\n\n let matches = dom.querySelectorAllAndMe(\n content,\n selectors.map((it) => it.trim().replace(/,$/, \"\")).join(\",\")\n );\n matches = matches.filter((el) => {\n // Filter out patterns:\n // - with class ``.disable-patterns``\n // - wrapped in ``.disable-patterns`` elements\n // - wrapped in ```` elements\n // - wrapped in ```` elements\n return (\n !el.matches(\".disable-patterns\") &&\n !el?.parentNode?.closest?.(\".disable-patterns\") &&\n !el?.parentNode?.closest?.(\"pre\") &&\n !el?.parentNode?.closest?.(\"template\") && // NOTE: not strictly necessary. Template is a DocumentFragment and not reachable except for IE.\n !el.matches(\".cant-touch-this\") && // BBB. TODO: Remove with next major version.\n !el?.parentNode?.closest?.(\".cant-touch-this\") // BBB. TODO: Remove with next major version.\n );\n });\n\n // walk list backwards and initialize patterns inside-out.\n for (const el of matches.reverse()) {\n for (const name of patterns) {\n this.initPattern(name, el, trigger);\n }\n }\n document.body.classList.add(\"patterns-loaded\");\n },\n\n register(pattern, name) {\n name = name || pattern.name;\n if (!name) {\n log.error(\"Pattern lacks a name.\", pattern);\n return false;\n }\n if (registry.patterns[name]) {\n log.debug(`Already have a pattern called ${name}.`);\n return false;\n }\n // register pattern to be used for scanning new content\n registry.patterns[name] = pattern;\n\n // register pattern as jquery plugin\n if (pattern.jquery_plugin) {\n const plugin_name = (\"pat-\" + name).replace(\n /-([a-zA-Z])/g,\n function (match, p1) {\n return p1.toUpperCase();\n }\n );\n $.fn[plugin_name] = utils.jqueryPlugin(pattern);\n // BBB 2012-12-10 and also for Mockup patterns.\n $.fn[plugin_name.replace(/^pat/, \"pattern\")] = $.fn[plugin_name];\n }\n log.debug(`Registered pattern ${name}`, pattern);\n if (window.__patternslib_registry_initialized) {\n // Once the first initialization has been done, do only scan for\n // newly registered patterns.\n registry.scan(document.body, [name]);\n log.debug(`Re-scanned dom with newly registered pattern ${name}.`);\n }\n return true;\n },\n};\n\nexport default registry;\n","import $ from \"jquery\";\nimport dom from \"./dom\";\n\nconst _MS_PER_DAY = 1000 * 60 * 60 * 24; // Milliseconds per day.\n\n$.fn.safeClone = function () {\n var $clone = this.clone();\n return $clone;\n};\n\n// Production steps of ECMA-262, Edition 5, 15.4.4.18\n// Reference: http://es5.github.io/#x15.4.4.18\nif (!Array.prototype.forEach) {\n Array.prototype.forEach = function (callback, thisArg) {\n var T, k;\n if (this === null) {\n throw new TypeError(\" this is null or not defined\");\n }\n // 1. Let O be the result of calling ToObject passing the |this| value as the argument.\n var O = Object(this);\n // 2. Let lenValue be the result of calling the Get internal method of O with the argument \"length\".\n // 3. Let len be ToUint32(lenValue).\n var len = O.length >>> 0;\n // 4. If IsCallable(callback) is false, throw a TypeError exception.\n // See: http://es5.github.com/#x9.11\n if (typeof callback !== \"function\") {\n throw new TypeError(callback + \" is not a function\");\n }\n // 5. If thisArg was supplied, let T be thisArg; else let T be undefined.\n if (arguments.length > 1) {\n T = thisArg;\n }\n // 6. Let k be 0\n k = 0;\n // 7. Repeat, while k < len\n while (k < len) {\n var kValue;\n // a. Let Pk be ToString(k).\n // This is implicit for LHS operands of the in operator\n // b. Let kPresent be the result of calling the HasProperty internal method of O with argument Pk.\n // This step can be combined with c\n // c. If kPresent is true, then\n if (k in O) {\n // i. Let kValue be the result of calling the Get internal method of O with argument Pk.\n kValue = O[k];\n // ii. Call the Call internal method of callback with T as the this value and\n // argument list containing kValue, k, and O.\n callback.call(T, kValue, k, O);\n }\n // d. Increase k by 1.\n k++;\n }\n // 8. return undefined\n };\n}\n\nvar singleBoundJQueryPlugin = function (pattern, method, options) {\n /* This is a jQuery plugin for patterns which are invoked ONCE FOR EACH\n * matched element in the DOM.\n *\n * This is how the Mockup-type patterns behave. They are constructor\n * functions which need to be invoked once per jQuery-wrapped DOM node\n * for all DOM nodes on which the pattern applies.\n */\n var $this = this;\n $this.each(function () {\n var pat,\n $el = $(this);\n pat = pattern.init($el, options);\n if (method) {\n if (pat[method] === undefined) {\n $.error(\n \"Method \" + method + \" does not exist on jQuery.\" + pattern.name\n );\n return false;\n }\n if (method.charAt(0) === \"_\") {\n $.error(\"Method \" + method + \" is private on jQuery.\" + pattern.name);\n return false;\n }\n pat[method].apply(pat, [options]);\n }\n });\n return $this;\n};\n\nvar pluralBoundJQueryPlugin = function (pattern, method, options) {\n /* This is a jQuery plugin for patterns which are invoked ONCE FOR ALL\n * matched elements in the DOM.\n *\n * This is how the vanilla Patternslib-type patterns behave. They are\n * simple objects with an init method and this method gets called once\n * with a list of jQuery-wrapped DOM nodes on which the pattern\n * applies.\n */\n var $this = this;\n if (method) {\n if (pattern[method]) {\n return pattern[method].apply($this, [$this].concat([options]));\n } else {\n $.error(\"Method \" + method + \" does not exist on jQuery.\" + pattern.name);\n }\n } else {\n pattern.init.apply($this, [$this].concat([options]));\n }\n return $this;\n};\n\nvar jqueryPlugin = function (pattern) {\n return function (method, options) {\n var $this = this;\n if ($this.length === 0) {\n return $this;\n }\n if (typeof method === \"object\") {\n options = method;\n method = undefined;\n }\n if (typeof pattern === \"function\") {\n return singleBoundJQueryPlugin.call(this, pattern, method, options);\n } else {\n return pluralBoundJQueryPlugin.call(this, pattern, method, options);\n }\n };\n};\n\n// Is a given variable an object?\nfunction isObject(obj) {\n var type = typeof obj;\n return type === \"function\" || (type === \"object\" && !!obj);\n}\n\n// Extend a given object with all the properties in passed-in object(s).\nfunction extend(obj) {\n if (!isObject(obj)) return obj;\n var source, prop;\n for (var i = 1, length = arguments.length; i < length; i++) {\n source = arguments[i];\n for (prop in source) {\n if (hasOwnProperty.call(source, prop)) {\n obj[prop] = source[prop];\n }\n }\n }\n return obj;\n}\n// END: Taken from Underscore.js until here.\n\nfunction findLabel(input) {\n var $label;\n for (\n var label = input.parentNode;\n label && label.nodeType !== 11;\n label = label.parentNode\n ) {\n if (label.tagName === \"LABEL\") {\n return label;\n }\n }\n if (input.id) {\n $label = $('label[for=\"' + input.id + '\"]');\n }\n if ($label && $label.length === 0 && input.form) {\n $label = $('label[for=\"' + input.name + '\"]', input.form);\n }\n if ($label && $label.length) {\n return $label[0];\n } else {\n return null;\n }\n}\n\n// Taken from http://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex\nfunction escapeRegExp(str) {\n return str.replace(/[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\");\n}\n\n/**\n * Create a RegExp object of a wildcard search string.\n *\n * @param {string} wildcard: A search string which can contain wildcards \"*\".\n * The wildcard \"*\" can be anywhere in the string and\n * can also be used multiple times. If no wildcard is\n * present the search string is used for an exact match.\n\n * @returns {RegExp}: A RegExp object which can be used to match strings.\n */\nfunction regexp_from_wildcard(wildcard) {\n let regexp = wildcard.replace(/[\\-\\[\\]{}()+?.,\\\\\\^$|#\\s]/g, \"\\\\$&\");\n regexp = regexp.replace(/[*]/g, \".*\");\n regexp = new RegExp(`^${regexp}$`);\n return regexp;\n}\n\n/**\n * Remove classes from a list of targets if they match a specific pattern.\n *\n * @param {Node, NodeList} targets: Dom Node or NodeList where the classes should be removed.\n * @param {string} classes: String matching classes to be removed.\n * You can add a \"*\" as wildcard to search for classes to be removed.\n * E.g. \"icon-*-alert\" to remove any of \"icon-1-alert icon-2-alert\".\n *\n * @returns {undefined}: This method directly operates on the targets.\n */\nfunction removeWildcardClass(targets, classes) {\n targets = utils.ensureArray(targets);\n\n if (classes.indexOf(\"*\") === -1) {\n for (const target of targets) {\n target.classList.remove(classes);\n }\n } else {\n const matcher = regexp_from_wildcard(classes);\n for (const target of targets) {\n const class_list = (target.getAttribute(\"class\") || \"\").split(/\\s+/);\n if (!class_list.length) {\n continue;\n }\n const ok = class_list.filter((it) => !matcher.test(it));\n if (ok.length) {\n target.setAttribute(\"class\", ok.join(\" \"));\n } else {\n target.removeAttribute(\"class\");\n }\n }\n }\n}\n\nfunction hasValue(el) {\n if (el.tagName === \"INPUT\") {\n if (el.type === \"checkbox\" || el.type === \"radio\") {\n return el.checked;\n }\n return el.value !== \"\";\n }\n if (el.tagName === \"SELECT\") {\n return el.selectedIndex !== -1;\n }\n if (el.tagName === \"TEXTAREA\") {\n return el.value !== \"\";\n }\n return false;\n}\n\nconst hideOrShow = (nodes, visible, options, pattern_name) => {\n nodes = dom.toNodeArray(nodes);\n\n const transitions = {\n none: { hide: \"hide\", show: \"show\" },\n fade: { hide: \"fadeOut\", show: \"fadeIn\" },\n slide: { hide: \"slideUp\", show: \"slideDown\" },\n };\n\n const duration =\n options.transition === \"css\" || options.transition === \"none\"\n ? null\n : options.effect.duration;\n\n const on_complete = (el) => {\n el.classList.remove(\"in-progress\");\n el.classList.add(visible ? \"visible\" : \"hidden\");\n $(el).trigger(\"pat-update\", {\n pattern: pattern_name,\n action: \"attribute-changed\",\n dom: el,\n transition: \"complete\",\n });\n };\n\n for (const el of nodes) {\n el.classList.remove(\"visible\");\n el.classList.remove(\"hidden\");\n el.classList.remove(\"in-progress\");\n\n if (duration) {\n const t = transitions[options.transition];\n el.classList.add(\"in-progress\");\n $(el).trigger(\"pat-update\", {\n pattern: pattern_name,\n action: \"attribute-changed\",\n dom: el,\n transition: \"start\",\n });\n $(el)[visible ? t.show : t.hide]({\n duration: duration,\n easing: options.effect.easing,\n complete: () => on_complete(el),\n });\n } else {\n if (options.transition !== \"css\") {\n dom[visible ? \"show\" : \"hide\"](el);\n }\n on_complete(el);\n }\n }\n};\n\nfunction addURLQueryParameter(fullURL, param, value) {\n /* Using a positive lookahead (?=\\=) to find the given parameter,\n * preceded by a ? or &, and followed by a = with a value after\n * than (using a non-greedy selector) and then followed by\n * a & or the end of the string.\n *\n * Taken from http://stackoverflow.com/questions/7640270/adding-modify-query-string-get-variables-in-a-url-with-javascript\n */\n var val = new RegExp(\"(\\\\?|\\\\&)\" + param + \"=.*?(?=(&|$))\"),\n parts = fullURL.toString().split(\"#\"),\n url = parts[0],\n hash = parts[1],\n qstring = /\\?.+$/,\n newURL = url;\n // Check if the parameter exists\n if (val.test(url)) {\n // if it does, replace it, using the captured group\n // to determine & or ? at the beginning\n newURL = url.replace(val, \"$1\" + param + \"=\" + value);\n } else if (qstring.test(url)) {\n // otherwise, if there is a query string at all\n // add the param to the end of it\n newURL = url + \"&\" + param + \"=\" + value;\n } else {\n // if there's no query string, add one\n newURL = url + \"?\" + param + \"=\" + value;\n }\n if (hash) {\n newURL += \"#\" + hash;\n }\n return newURL;\n}\n\nfunction removeDuplicateObjects(objs) {\n /* Given an array of objects, remove any duplicate objects which might\n * be present.\n */\n const comparator = function (k, v) {\n return this[k] === v;\n };\n\n return objs.reduce(function (list, next_obj) {\n let is_duplicate = false;\n for (const obj of list) {\n is_duplicate =\n Object.keys(obj).length === Object.keys(next_obj).length &&\n Object.entries(obj).filter(\n (it) => !comparator.bind(next_obj)(it[0], it[1])\n ).length === 0;\n }\n if (!is_duplicate) {\n list.push(next_obj);\n }\n return list;\n }, []);\n}\n\nfunction mergeStack(stack, length) {\n /* Given a list of lists of objects (which for brevity we call a stack),\n * return a list of objects where each object is the merge of all the\n * corresponding original objects at that particular index.\n *\n * If a certain sub-list doesn't have an object at that particular\n * index, the last object in that list is merged.\n */\n const results = [];\n for (let i = 0; i < length; i++) {\n results.push({});\n }\n for (const frame of stack) {\n const frame_length = frame.length - 1;\n for (let x = 0; x < length; x++) {\n results[x] = $.extend(\n results[x] || {},\n frame[x > frame_length ? frame_length : x]\n );\n }\n }\n return results;\n}\n\nfunction isElementInViewport(el, partial = false, offset = 0) {\n /* returns true if element is visible to the user ie. is in the viewport.\n * Setting partial parameter to true, will only check if a part of the element is visible\n * in the viewport, specifically that some part of that element is touching the top part\n * of the viewport. This only applies to the vertical direction, ie. doesnt check partial\n * visibility for horizontal scrolling\n * some code taken from:\n * http://stackoverflow.com/questions/123999/how-to-tell-if-a-dom-element-is-visible-in-the-current-viewport/7557433#7557433\n */\n if (el instanceof $) {\n el = el[0];\n }\n\n const rec = el.getBoundingClientRect();\n const rec_values = [rec.top, rec.bottom, rec.left, rec.right];\n\n if (rec_values.every((val) => val === 0)) {\n // if every property of rec is 0, the element is invisible;\n return false;\n } else if (partial) {\n // when using getBoundingClientRect() (in the vertical case)\n // negative means above top of viewport, positive means below top of viewport\n // therefore for part of the element to be touching or crossing the top of the viewport\n // rec.top must <= 0 and rec.bottom must >= 0\n // an optional tolerance offset can be added for when the desired element is not exactly\n // toucing the top of the viewport but needs to be considered as touching.\n return (\n rec.top <= 0 + offset && rec.bottom >= 0 + offset\n //(rec.top >= 0+offset && rec.top <= window.innerHeight) // this checks if the element\n // touches bottom part of viewport\n // XXX do we want to include a check for the padding of an element?\n // using window.getComputedStyle(target).paddingTop\n );\n } else {\n // this will return true if the entire element is completely in the viewport\n return (\n rec.top >= 0 &&\n rec.left >= 0 &&\n rec.bottom <=\n (window.innerHeight || document.documentElement.clientHeight) &&\n rec.right <= (window.innerWidth || document.documentElement.clientWidth)\n );\n }\n}\n\n/* parseTime - Parse a duration from a string and return the parsed time in milliseconds.\n *\n * @param {String} time - A duration/time string like ``1ms``, ``1s`` or ``1m``.\n *\n * @returns {Number} - A integer which represents the parsed time in milliseconds.\n */\nfunction parseTime(time) {\n var m = /^(\\d+(?:\\.\\d+)?)\\s*(\\w*)/.exec(time);\n if (!m) {\n throw new Error(\"Invalid time\");\n }\n var amount = parseFloat(m[1]);\n switch (m[2]) {\n case \"s\":\n return Math.round(amount * 1000);\n case \"m\":\n return Math.round(amount * 1000 * 60);\n case \"ms\":\n default:\n return Math.round(amount);\n }\n}\n\n/*\n\n * parseLength - Parse a length from a string and return the parsed length in\n * pixels.\n\n * @param {String} length - A length string like `1px` or `25%`. Lengths without a unit are treated as pixels.\n * @param {Number} reference_length - The reference length to use for percentage lengths.\n *\n * @returns {Number} - A integer which represents the parsed length in pixels.\n *\n * @throws {Error} - If the length string is invalid.\n *\n * @example\n * parseLength(\"1px\"); // 1\n * parseLength(\"10%\", 100); // 10\n *\n */\nfunction parseLength(length, reference_length = null) {\n const m = /^(\\d+(?:\\.\\d+)?)\\s*(\\%?\\w*)/.exec(length);\n if (!m) {\n throw new Error(\"Invalid length\");\n }\n const amount = parseFloat(m[1]);\n switch (m[2]) {\n case \"px\":\n return Math.round(amount);\n case \"%\":\n if (!reference_length) {\n return 0;\n }\n return (reference_length / 100) * Math.round(amount);\n case \"vw\":\n return Math.round((amount * window.innerWidth) / 100);\n case \"vh\":\n return Math.round((amount * window.innerHeight) / 100);\n case \"vmin\":\n return Math.round(\n (amount * Math.min(window.innerWidth, window.innerHeight)) / 100\n );\n case \"vmax\":\n return Math.round(\n (amount * Math.max(window.innerWidth, window.innerHeight)) / 100\n );\n default:\n return Math.round(amount);\n }\n}\n\n// Return a jQuery object with elements related to an input element.\nfunction findRelatives(el) {\n var $el = $(el),\n $relatives = $(el),\n $label = $();\n\n $relatives = $relatives.add($el.closest(\"label\"));\n $relatives = $relatives.add($el.closest(\"fieldset\"));\n\n if (el.id) $label = $(\"label[for='\" + el.id + \"']\");\n if (!$label.length) {\n var $form = $el.closest(\"form\");\n if (!$form.length) $form = $(document.body);\n $label = $form.find(\"label[for='\" + el.name + \"']\");\n }\n $relatives = $relatives.add($label);\n return $relatives;\n}\n\nfunction get_bounds(el) {\n // Return bounds of an element with it's values rounded and converted to ints.\n const bounds = el.getBoundingClientRect();\n return {\n x: parseInt(Math.round(bounds.x), 10) || 0,\n y: parseInt(Math.round(bounds.y), 10) || 0,\n top: parseInt(Math.round(bounds.top), 10) || 0,\n bottom: parseInt(Math.round(bounds.bottom), 10) || 0,\n left: parseInt(Math.round(bounds.left), 10) || 0,\n right: parseInt(Math.round(bounds.right), 10) || 0,\n width: parseInt(Math.round(bounds.width), 10) || 0,\n height: parseInt(Math.round(bounds.height), 10) || 0,\n };\n}\n\nfunction checkInputSupport(type, invalid_value) {\n /* Check input type support.\n * See: https://stackoverflow.com/a/10199306/1337474\n */\n let support = false;\n const input = document.createElement(\"input\");\n input.setAttribute(\"type\", type);\n support = input.type == type;\n\n if (invalid_value !== undefined) {\n // Check for input type UI support\n input.setAttribute(\"value\", invalid_value);\n support = input.value !== invalid_value;\n }\n return support;\n}\n\nconst checkCSSFeature = (attribute, value, tag = \"div\") => {\n /* Check for browser support of specific CSS feature.\n */\n tag = document.createElement(tag);\n let supported = tag.style[attribute] !== undefined;\n if (supported && value !== undefined) {\n tag.style[attribute] = value;\n supported = tag.style[attribute] === value;\n }\n return supported;\n};\n\nconst animation_frame = () => {\n // Return promise to await next repaint cycle\n // Use it in your async function like so: ``await utils.animation_frame()``\n // From: http://www.albertlobo.com/fractals/async-await-requestanimationframe-buddhabrot\n return new Promise(window.requestAnimationFrame);\n};\n\nconst timeout = (ms) => {\n return new Promise((resolve) => setTimeout(resolve, ms));\n};\n\n/**\n * Returns a function, that, as long as it continues to be invoked, will not\n * be triggered. The function will be called after it stops being called for\n * N milliseconds.\n * From: https://underscorejs.org/#debounce\n *\n * @param {Function} func - The function to debounce.\n * @param {Number} ms - The time in milliseconds to debounce.\n * @param {Object} timer - A module-global timer as an object.\n * @param {Boolean} [postpone=true] - If true, the function will only be called\n * at the end, after it stops being called for N milliseconds. If false, the\n * function will be called no more than each [ms] milliseconds, ensuring that\n * the function isn't postponed for for too long.\n *\n * @returns {Function} - The debounced function.\n */\nconst debounce = (func, ms, timer = { timer: null }, postpone = true) => {\n // Returns a function, that, as long as it continues to be invoked, will not\n // be triggered. The function will be called after it stops being called for\n // N milliseconds.\n // From: https://underscorejs.org/#debounce\n //\n // Make sure to initialize ``debounce`` only once per to-be-debounced\n // function to not reinitialize the timer each time and debounce not being\n // able to cancel previouse runs.\n //\n // Pass a module-global timer as an object ``{ timer: null }`` if you want\n // to also cancel debounced functions from other pattern-invocations.\n timer.last_run = 0;\n return function () {\n const args = arguments;\n if (!postpone && timer.timer && Date.now() - timer.last_run <= ms) {\n return;\n }\n clearTimeout(timer.timer);\n timer.last_run = Date.now();\n timer.timer = setTimeout(() => {\n func.apply(this, args);\n }, ms);\n };\n};\n\nconst isIE = () => {\n // See: https://stackoverflow.com/a/9851769/1337474\n // Internet Explorer 6-11\n return /*@cc_on!@*/ false || !!document.documentMode;\n};\n\nconst jqToNode = (el) => {\n // Return a DOM node if a jQuery node was passed.\n if (el.jquery) {\n el = el[0];\n }\n return el;\n};\n\n/**\n * Always return an iterable object.\n *\n * @param {any} it: The object which needs to be wrapped in an array or returned as is if it is iterable.\n * @param {boolean} force_array: If the object is iterable but not an Array, convert it to an array (e.g. For jQuery items or NodeList objects).\n *\n * @returns {Array}: Returns the object wrapped in an Array, expanded to an Array or as-is if it is already iterable.\n */\nconst ensureArray = (it, force_array) => {\n // Ensure to return always an array\n const array_like = !!(\n NodeList.prototype.isPrototypeOf(it) || // eslint-disable-line no-prototype-builtins\n Array.isArray(it) ||\n it.jquery\n );\n return array_like ? (force_array ? [...it] : it) : [it];\n};\n\nconst localized_isodate = (date) => {\n // Return a iso date (date only) in the current timezone instead of a\n // UTC ISO 8601 date+time component which toISOString returns.\n\n const day = date.getDate().toString().padStart(2, \"0\");\n const month = (date.getMonth() + 1).toString().padStart(2, \"0\");\n const year = date.getFullYear().toString();\n\n return `${year}-${month}-${day}`;\n};\n\n/**\n * Replace HTML reserved characters with html entities to add HTML for user\n * editing to e.g. a textarea or a contenteditable.\n *\n * See:\n * https://stackoverflow.com/a/22706073/1337474\n * https://developer.mozilla.org/en-US/docs/Glossary/Entity#reserved_characters\n *\n * @param {string} html - The HTML string to encode.\n *\n * @returns {string} - Returns the escaped html string:\n * ``&`` will be replaced with ``&``.\n * ``<`` will be repalced with ``<``,\n * ``>`` will be replaced with ``>``,\n * ``\"`` will be replaced with ``"``.\n */\nconst escape_html = (html) => {\n if (!html) {\n return \"\";\n }\n const el = document.createElement(\"div\");\n el.appendChild(document.createTextNode(html));\n // Return escaped html and also replace quotes.\n return el.innerHTML.replace(/\"/g, \""\");\n};\n\n/**\n * Return unescaped, raw HTML from an escaped HTML string.\n *\n * See:\n * https://stackoverflow.com/a/34064434/1337474\n * https://developer.mozilla.org/en-US/docs/Glossary/Entity#reserved_characters\n *\n * @param {string} escaped_html - The HTML string to decode.\n *\n * @returns {string} - Returns the escaped html string:\n * ``&`` will be replaced with ``&``,\n * ``<`` will be repalced with ``<``,\n * ``>`` will be replaced with ``>``,\n * ``"`` will be replaced with ``\"``.\n */\nconst unescape_html = (escaped_html) => {\n if (!escaped_html) {\n return \"\";\n }\n const doc = new DOMParser().parseFromString(escaped_html, \"text/html\");\n // Return unescaped html and also unescape quote named entities.\n return doc.documentElement.textContent.replace(/"/g, '\"');\n};\n\n/**\n * Return true, if the given value is a valid ISO 8601 date/time string with or without an optional time component.\n *\n * @param {String} value - The date/time value to be checked.\n * @param {Boolean} [optional_time=false] - True, if time component is optional.\n * @return {Boolean} - True, if the given value is a valid Date string. False if not.\n */\nconst is_iso_date_time = (value, optional_time = false) => {\n const re_date_time = optional_time\n ? /^\\d{4}-[01]\\d-[0-3]\\d(T[0-2]\\d:[0-5]\\d)?$/\n : /^\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d$/;\n return re_date_time.test(value);\n};\n\n/**\n * Return true, if the given value is a valid ISO 8601 date string and without a time component.\n *\n * @param {String} value - The date value to be checked.\n * @return {Boolean} - True, if the given value is a valid ISO 8601 date string without a time component. False if not.\n */\nconst is_iso_date = (value) => {\n const re_date_time = /^\\d{4}-[01]\\d-[0-3]\\d$/;\n return re_date_time.test(value);\n};\n\n/**\n * Return the number of days between two dates.\n * Based on: https://stackoverflow.com/a/15289883/1337474\n *\n * @param {Date} date_1 - First date to compare. We will substract date_2 from date_1.\n * @param {Date} date_2 - Second date to compare.\n * @return {Number} - The number of days between the two dates.\n */\nconst date_diff = (date_1, date_2) => {\n // Discard the time and time-zone information.\n const utc_1 = Date.UTC(date_1.getFullYear(), date_1.getMonth(), date_1.getDate());\n const utc_2 = Date.UTC(date_2.getFullYear(), date_2.getMonth(), date_2.getDate());\n\n return Math.floor((utc_1 - utc_2) / _MS_PER_DAY);\n};\n\n/**\n * Build intersection observer threshold list.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API#building_the_array_of_threshold_ratios\n *\n * @param {Number} num_steps - The number of steps to use.\n *\n * @returns {Array} - Returns the threshold list.\n */\nconst threshold_list = (num_steps = 0) => {\n let thresholds = [];\n\n for (let i = 1.0; i <= num_steps; i++) {\n thresholds.push(i / num_steps);\n }\n thresholds.push(0);\n return thresholds.sort();\n};\n\n/**\n * is_option_truthy - Check if an Pattern option is set.\n *\n * An option is set if it is not one of:\n * - undefined\n * - null\n * - \"none\"\n * - \"\"\n *\n * @param {String} option - The option to check.\n *\n * @returns {Boolean} - Returns true if the option is set, false otherwise.\n *\n * @example\n *\n * is_option_truthy() // false\n * is_option_truthy(undefined) // false\n * is_option_truthy(null) // false\n * is_option_truthy(\"\") // false\n * is_option_truthy(\"none\") // false\n * is_option_truthy(\"false\") // false\n * is_option_truthy(\"foo\") // true\n * is_option_truthy(true) // true\n * is_option_truthy(0) // true\n *\n */\nconst is_option_truthy = (option) => {\n return ![undefined, null, \"none\", false, \"false\", \"\"].includes(option);\n};\n\nvar utils = {\n jqueryPlugin: jqueryPlugin,\n escapeRegExp: escapeRegExp,\n isObject: isObject,\n extend: extend,\n findLabel: findLabel,\n regexp_from_wildcard: regexp_from_wildcard,\n removeWildcardClass: removeWildcardClass,\n hideOrShow: hideOrShow,\n addURLQueryParameter: addURLQueryParameter,\n removeDuplicateObjects: removeDuplicateObjects,\n mergeStack: mergeStack,\n isElementInViewport: isElementInViewport,\n hasValue: hasValue,\n parseTime: parseTime,\n parseLength: parseLength,\n findRelatives: findRelatives,\n get_bounds: get_bounds,\n checkInputSupport: checkInputSupport,\n checkCSSFeature: checkCSSFeature,\n animation_frame: animation_frame,\n timeout: timeout,\n debounce: debounce,\n isIE: isIE,\n jqToNode: jqToNode,\n ensureArray: ensureArray,\n localized_isodate: localized_isodate,\n escape_html: escape_html,\n unescape_html: unescape_html,\n is_iso_date_time: is_iso_date_time,\n is_iso_date: is_iso_date,\n date_diff: date_diff,\n threshold_list: threshold_list,\n is_option_truthy: is_option_truthy,\n //getCSSValue: dom.get_css_value, // BBB: moved to dom. TODO: Remove in upcoming version.\n elementInViewport: (el) => {\n // BBB: Remove with next major version.\n console.warn(\"Deprecated. Use utils.isElementInViewport\");\n return isElementInViewport(el);\n },\n};\n\nexport default utils;\n","import $ from \"jquery\";\n\nvar parser = {\n getOptions($el, patternName, options) {\n /* This is the Mockup parser. An alternative parser for Patternslib\n * patterns.\n *\n * NOTE: Use of the Mockup parser is discouraged and is added here for\n * legacy support for the Plone Mockup project.\n *\n * It parses a DOM element for pattern configuration options.\n */\n options = options || {};\n // get options from parent element first, stop if element tag name is 'body'\n if ($el.length !== 0 && !$.nodeName($el[0], \"body\")) {\n options = this.getOptions($el.parent(), patternName, options);\n }\n // collect all options from element\n let elOptions = {};\n if ($el.length !== 0) {\n elOptions = $el.data(\"pat-\" + patternName);\n if (elOptions) {\n // parse options if string\n if (typeof elOptions === \"string\") {\n const tmpOptions = {};\n $.each(elOptions.split(\";\"), function (i, item) {\n item = item.split(\":\");\n item.reverse();\n let key = item.pop();\n key = key.replace(/^\\s+|\\s+$/g, \"\"); // trim\n item.reverse();\n let value = item.join(\":\");\n value = value.replace(/^\\s+|\\s+$/g, \"\"); // trim\n tmpOptions[key] = value;\n });\n elOptions = tmpOptions;\n }\n }\n }\n return $.extend(true, {}, options, elOptions);\n },\n};\n\nexport default parser;\n","/**\n * A Base pattern for creating scoped patterns. It's similar to Backbone's\n * Model class. The advantage of this approach is that each instance of a\n * pattern has its own local scope (closure).\n *\n * A new instance is created for each DOM element on which a pattern applies.\n *\n * You can assign values, such as $el, to `this` for an instance and they\n * will remain unique to that instance.\n *\n * Older Patternslib patterns on the other hand have a single global scope for\n * all DOM elements.\n */\nimport $ from \"jquery\";\nimport Registry from \"./registry\";\nimport logging from \"./logging\";\nimport mockupParser from \"./mockup-parser\";\n\nconst log = logging.getLogger(\"Patternslib Base\");\n\nconst initBasePattern = function ($el, options, trigger) {\n if (!$el.jquery) {\n $el = $($el);\n }\n const name = this.prototype.name;\n const plog = logging.getLogger(`pat.${name}`);\n let pattern = $el.data(`pattern-${name}`);\n if (pattern === undefined && Registry.patterns[name]) {\n try {\n // Immediately set the pattern instance to the temporary value\n // ``initializing`` before the async Base constructor is setting\n // the value later.\n // This prevents re-init the pattern on this element on multiple\n // initialization calls..\n $el.data(`pattern-${name}`, \"initializing\");\n options =\n this.prototype.parser === \"mockup\"\n ? mockupParser.getOptions($el, name, options)\n : options;\n pattern = new Registry.patterns[name]($el, options, trigger);\n } catch (e) {\n plog.error(`Failed while initializing ${name} pattern.`, e);\n }\n }\n return pattern;\n};\n\nconst Base = async function ($el, options, trigger) {\n if (($el?.jquery && $el.length === 0) || !$el) {\n log.warn(\"No element given to pattern.\");\n return;\n }\n if (!$el.jquery) {\n $el = $($el);\n }\n this.$el = $el;\n this.el = $el[0];\n this.options = $.extend(true, {}, this.defaults || {}, options || {});\n\n this.emit(\"pre-init\");\n\n await this.init($el, options, trigger);\n\n // Store pattern instance on element\n this.$el.data(`pattern-${this.name}`, this);\n this.el[`pattern-${this.name}`] = this;\n\n this.emit(\"init\");\n};\n\nBase.prototype = {\n constructor: Base,\n on(eventName, eventCallback) {\n this.$el.on(`${eventName}.${this.name}.patterns`, eventCallback);\n },\n one(eventName, eventCallback) {\n this.$el.one(`${eventName}.${this.name}.patterns`, eventCallback);\n },\n emit(eventName, args) {\n // args should be a list\n if (args === undefined) {\n args = [];\n }\n this.$el.trigger(`${eventName}.${this.name}.patterns`, args);\n },\n};\n\nBase.extend = function (patternProps) {\n /* Helper function to correctly set up the prototype chain for new patterns.\n */\n const parent = this;\n let child;\n\n // Check that the required configuration properties are given.\n if (!patternProps) {\n throw new Error(\n \"Pattern configuration properties required when calling Base.extend\"\n );\n }\n\n // The constructor function for the new subclass is either defined by you\n // (the \"constructor\" property in your `extend` definition), or defaulted\n // by us to simply call the parent's constructor.\n if (Object.hasOwnProperty.call(patternProps, \"constructor\")) {\n child = patternProps.constructor;\n } else {\n child = function () {\n parent.apply(this, arguments);\n };\n }\n\n // Allow patterns to be extended indefinitely\n child.extend = Base.extend;\n\n // Static properties required by the Patternslib registry\n child.init = initBasePattern;\n child.jquery_plugin = true;\n child.trigger = patternProps.trigger;\n child.parser = patternProps?.parser || null;\n\n // Set the prototype chain to inherit from `parent`, without calling\n // `parent`'s constructor function.\n var Surrogate = function () {\n this.constructor = child;\n };\n Surrogate.prototype = parent.prototype;\n child.prototype = new Surrogate();\n\n // Add pattern's configuration properties (instance properties) to the subclass,\n $.extend(true, child.prototype, patternProps);\n\n // Set a convenience property in case the parent's prototype is needed\n // later.\n child.__super__ = parent.prototype;\n\n // Register the pattern in the Patternslib registry.\n if (!patternProps.name) {\n log.warn(\"This pattern without a name attribute will not be registered!\");\n } else if (!patternProps.trigger) {\n log.warn(\n `The pattern ${patternProps.name} does not have a trigger attribute, it will not be registered.`\n );\n } else if (patternProps.autoregister !== false) {\n Registry.register(child, patternProps.name);\n }\n return child;\n};\n\nexport default Base;\n","import $ from \"jquery\";\nimport Base from \"@patternslib/patternslib/src/core/base\";\n\nexport default Base.extend({\n name: \"backdrop\",\n trigger: \".pat-backdrop\",\n parser: \"mockup\",\n defaults: {\n zIndex: null,\n opacity: 0.8,\n className: \"plone-backdrop\",\n classActiveName: \"plone-backdrop-active\",\n closeOnEsc: true,\n closeOnClick: true,\n },\n init: function () {\n var self = this;\n self.$backdrop = $(\"> .\" + self.options.className, self.$el);\n if (self.$backdrop.length === 0) {\n self.$backdrop = $(\"\")\n .hide()\n .appendTo(self.$el)\n .addClass(self.options.className);\n if (self.options.zIndex !== null) {\n self.$backdrop.css(\"z-index\", self.options.zIndex);\n }\n }\n if (self.options.closeOnEsc === true) {\n // eslint-disable-next-line no-unused-vars\n $(document).on(\"keydown\", function (e, data) {\n if (self.$el.is(\".\" + self.options.classActiveName)) {\n if (e.keyCode === 27) {\n // ESC key pressed\n self.hide();\n }\n }\n });\n }\n if (self.options.closeOnClick === true) {\n self.$backdrop.on(\"click\", function () {\n if (self.$el.is(\".\" + self.options.classActiveName)) {\n self.hide();\n }\n });\n }\n },\n show: function () {\n var self = this;\n if (!self.$el.hasClass(self.options.classActiveName)) {\n self.emit(\"show\");\n self.$backdrop.css(\"opacity\", \"0\").show();\n self.$el.addClass(self.options.classActiveName);\n self.$backdrop.animate({ opacity: self.options.opacity }, 500);\n self.emit(\"shown\");\n }\n },\n hide: function () {\n var self = this;\n if (self.$el.hasClass(self.options.classActiveName)) {\n self.emit(\"hide\");\n self.$backdrop.animate({ opacity: \"0\" }, 500).hide();\n self.$el.removeClass(self.options.classActiveName);\n self.emit(\"hidden\");\n }\n },\n});\n","import $ from \"jquery\";\nimport logging from \"@patternslib/patternslib/src/core/logging\";\n\nconst logger = logging.getLogger(\"core utils\");\n\nvar QueryHelper = function (options) {\n /* if pattern argument provided, it can implement the interface of:\n * - browsing: boolean if currently browsing\n * - currentPath: string of current path to apply to search if browsing\n * - basePath: default path to provide if no subpath used\n */\n\n var self = this;\n var defaults = {\n pattern: null, // must be passed in\n vocabularyUrl: null,\n searchParam: \"SearchableText\", // query string param to pass to search url\n pathOperator: \"plone.app.querystring.operation.string.path\",\n attributes: [\"UID\", \"Title\", \"Description\", \"getURL\", \"portal_type\"],\n batchSize: 10, // number of results to retrive\n baseCriteria: [],\n sort_on: \"is_folderish\",\n sort_order: \"reverse\",\n pathDepth: 1,\n };\n self.options = $.extend({}, defaults, options);\n\n self.pattern = self.options.pattern;\n if (self.pattern === undefined || self.pattern === null) {\n self.pattern = {\n browsing: false,\n basePath: \"/\",\n };\n }\n\n if (self.options.url && !self.options.vocabularyUrl) {\n self.options.vocabularyUrl = self.options.url;\n } else if (self.pattern.vocabularyUrl) {\n self.options.vocabularyUrl = self.pattern.vocabularyUrl;\n }\n self.valid = Boolean(self.options.vocabularyUrl);\n\n self.getBatch = function (page) {\n return {\n page: page ? page : 1,\n size: self.options.batchSize,\n };\n };\n\n self.getCurrentPath = function () {\n var pattern = self.pattern;\n var currentPath;\n /* If currentPath is set on the QueryHelper object, use that first.\n * Then, check on the pattern.\n * Finally, see if it is a function and call it if it is.\n */\n if (self.currentPath) {\n currentPath = self.currentPath;\n } else {\n currentPath = pattern.currentPath;\n }\n if (typeof currentPath === \"function\") {\n currentPath = currentPath();\n }\n var path = currentPath;\n if (!path) {\n if (pattern.basePath) {\n path = pattern.basePath;\n } else if (pattern.options.basePath) {\n path = pattern.options.basePath;\n } else {\n path = \"/\";\n }\n }\n return path;\n };\n\n self.getCriterias = function (term, searchOptions) {\n if (searchOptions === undefined) {\n searchOptions = {};\n }\n searchOptions = $.extend(\n {},\n {\n useBaseCriteria: true,\n additionalCriterias: [],\n },\n searchOptions\n );\n\n var criterias = [];\n if (searchOptions.useBaseCriteria) {\n criterias = self.options.baseCriteria.slice(0);\n }\n if (term) {\n term += \"*\";\n criterias.push({\n i: self.options.searchParam,\n o: \"plone.app.querystring.operation.string.contains\",\n v: term,\n });\n }\n if (searchOptions.searchPath) {\n criterias.push({\n i: \"path\",\n o: self.options.pathOperator,\n v: searchOptions.searchPath + \"::\" + self.options.pathDepth,\n });\n } else if (self.pattern.browsing) {\n criterias.push({\n i: \"path\",\n o: self.options.pathOperator,\n v: self.getCurrentPath() + \"::\" + self.options.pathDepth,\n });\n }\n criterias = criterias.concat(searchOptions.additionalCriterias);\n return criterias;\n };\n\n self.getQueryData = function (term, page) {\n var data = {\n query: JSON.stringify({\n criteria: self.getCriterias(term),\n sort_on: self.options.sort_on,\n sort_order: self.options.sort_order,\n }),\n attributes: JSON.stringify(self.options.attributes),\n };\n if (page) {\n data.batch = JSON.stringify(self.getBatch(page));\n }\n return data;\n };\n\n self.getUrl = function () {\n var url = self.options.vocabularyUrl;\n if (url.indexOf(\"?\") === -1) {\n url += \"?\";\n } else {\n url += \"&\";\n }\n return url + $.param(self.getQueryData());\n };\n\n self.selectAjax = function () {\n return {\n url: self.options.vocabularyUrl,\n dataType: \"JSON\",\n quietMillis: 100,\n data: function (term, page) {\n return self.getQueryData(term, page);\n },\n results: function (data, page) {\n var more = page * 10 < data.total; // whether or not there are more results available\n // notice we return the value of more so Select2 knows if more results can be loaded\n return {\n results: data.results,\n more: more,\n };\n },\n };\n };\n\n self.search = function (term, operation, value, callback, useBaseCriteria, type) {\n if (useBaseCriteria === undefined) {\n useBaseCriteria = true;\n }\n if (type === undefined) {\n type = \"GET\";\n }\n var criteria = [];\n if (useBaseCriteria) {\n criteria = self.options.baseCriteria.slice(0);\n }\n criteria.push({\n i: term,\n o: operation,\n v: value,\n });\n var data = {\n query: JSON.stringify({\n criteria: criteria,\n }),\n attributes: JSON.stringify(self.options.attributes),\n };\n $.ajax({\n url: self.options.vocabularyUrl,\n dataType: \"JSON\",\n data: data,\n type: type,\n success: callback,\n });\n };\n\n return self;\n};\n\nvar Loading = function (options) {\n /*\n * Options:\n * backdrop(pattern): if you want to have the progress indicator work\n * seamlessly with backdrop pattern\n * zIndex(integer or function): to override default z-index used\n */\n var self = this;\n self.className = \"spinner-border\";\n var defaults = {\n backdrop: null,\n zIndex: 10005, // can be a function\n };\n if (!options) {\n options = {};\n }\n self.options = $.extend({}, defaults, options);\n\n self.init = function () {\n self.$el = $(\".\" + self.className);\n if (self.$el.length === 0) {\n self.$el = $(\"\");\n self.$el.addClass(self.className).hide().appendTo(\"body\");\n }\n };\n\n self.show = function (closable) {\n self.init();\n self.$el.show();\n self.$el.css(\"position\", \"absolute\");\n self.$el.css(\"top\", \"50%\");\n self.$el.css(\"left\", \"50%\");\n var zIndex = self.options.zIndex;\n if (typeof zIndex === \"function\") {\n zIndex = Math.max(zIndex(), 10005);\n } else {\n // go through all modals and backdrops and make sure we have a higher\n // z-index to use\n zIndex = 10005;\n $(\".modal-wrapper,.-modal-backdrop\").each(function () {\n zIndex = Math.max(zIndex, $(this).css(\"zIndex\") || 10005);\n });\n zIndex += 1;\n }\n self.$el.css(\"zIndex\", zIndex);\n\n if (closable === undefined) {\n closable = true;\n }\n if (self.options.backdrop) {\n self.options.backdrop.closeOnClick = closable;\n self.options.backdrop.closeOnEsc = closable;\n self.options.backdrop.init();\n self.options.backdrop.show();\n }\n };\n\n self.hide = function () {\n self.init();\n self.$el.hide();\n };\n\n return self;\n};\n\nvar getAuthenticator = function () {\n var $el = $('input[name=\"_authenticator\"]');\n if ($el.length === 0) {\n $el = $('a[href*=\"_authenticator\"]');\n if ($el.length > 0) {\n return $el.attr(\"href\").split(\"_authenticator=\")[1];\n }\n return \"\";\n } else {\n return $el.val();\n }\n};\n\nvar generateId = function (prefix) {\n if (prefix === undefined) {\n prefix = \"id\";\n }\n return (\n prefix +\n Math.floor((1 + Math.random()) * 0x10000)\n .toString(16)\n .substring(1)\n );\n};\n\nvar setId = function ($el, prefix) {\n if (prefix === undefined) {\n prefix = \"id\";\n }\n var id = $el.attr(\"id\");\n if (id === undefined) {\n id = generateId(prefix);\n } else {\n /* hopefully we don't screw anything up here... changing the id\n * in some cases so we get a decent selector */\n id = id.replace(/\\./g, \"-\");\n }\n $el.attr(\"id\", id);\n return id;\n};\n\nvar getWindow = function () {\n var win = window;\n if (win.parent !== window) {\n win = win.parent;\n }\n return win;\n};\n\nvar parseBodyTag = function (txt) {\n return $(\n /]*>[^]*<\\/body>/im\n .exec(txt)[0]\n .replace(\"\", \"