From 869978d1ff2e02d52e2082d76fb1e31db168b9c6 Mon Sep 17 00:00:00 2001 From: Maksim Sukharev Date: Wed, 16 Apr 2025 16:47:16 +0200 Subject: [PATCH 1/6] fix: extend ILogEntry type to include unique id Signed-off-by: Maksim Sukharev --- src/components/table/LogTable.vue | 4 ++-- src/interfaces/ILogEntry.ts | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/table/LogTable.vue b/src/components/table/LogTable.vue index b9adc1549..9c53c566c 100644 --- a/src/components/table/LogTable.vue +++ b/src/components/table/LogTable.vue @@ -35,8 +35,8 @@ - diff --git a/src/interfaces/ILogEntry.ts b/src/interfaces/ILogEntry.ts index 559aa946d..69022207c 100644 --- a/src/interfaces/ILogEntry.ts +++ b/src/interfaces/ILogEntry.ts @@ -102,6 +102,8 @@ export type IRawLogEntry = INextcloud14LogEntry | INextcloud22LogEntry * Fixed version of the log entry where the exception has its own field of type IException */ export interface ILogEntry extends Omit { + /** Unique ID, appended to each iterator element (see LogController#poll) */ + id: string /** Full exception with trace (if applicable) */ exception?: IException } From 1435fe8f0287ef904d3935fcd3d9a4978bc2031f Mon Sep 17 00:00:00 2001 From: Maksim Sukharev Date: Wed, 16 Apr 2025 17:29:13 +0200 Subject: [PATCH 2/6] fix: hide log entry second-line message unless expanded - required to have all entries of same height initially Signed-off-by: Maksim Sukharev --- src/components/table/LogTableRow.vue | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/table/LogTableRow.vue b/src/components/table/LogTableRow.vue index 4ce9fac43..71ecef8c0 100644 --- a/src/components/table/LogTableRow.vue +++ b/src/components/table/LogTableRow.vue @@ -14,8 +14,7 @@
- -
+
{{ row.message }}
@@ -117,6 +116,13 @@ const timestamp = computed(() => Date.parse(props.row.time)) */ const isExpanded = ref(false) +/** + * Show log message if either there is no exception or a custom message was added (at expanded view) + */ +const showLogMessage = computed(() => { + return !props.row.exception || (props.row.message !== props.row.exception.Message && isExpanded.value) +}) + /** * Human readable and localized level name */ From c815d275007ca0171d04770653a27602afa3c092 Mon Sep 17 00:00:00 2001 From: Maksim Sukharev Date: Wed, 16 Apr 2025 17:44:12 +0200 Subject: [PATCH 3/6] fix: implement virtual scrolling - copied from server/apps/settings/src/components/Users/VirtualList.vue, omitting some redundant logic Signed-off-by: Maksim Sukharev --- src/components/table/LogTable.vue | 145 +++++++++++++++++++++------ src/components/table/LogTableRow.vue | 6 +- 2 files changed, 119 insertions(+), 32 deletions(-) diff --git a/src/components/table/LogTable.vue b/src/components/table/LogTable.vue index 9c53c566c..048ebde0b 100644 --- a/src/components/table/LogTable.vue +++ b/src/components/table/LogTable.vue @@ -8,8 +8,8 @@ :open.sync="isModalOpen" :current-entry.sync="currentRow" :log-entries="sortedRows" /> - - +
+ @@ -23,7 +23,7 @@ - + - - +
{{ t('logreader', 'Log entry actions') }}
@@ -35,12 +35,13 @@
@@ -59,10 +60,12 @@ diff --git a/src/components/table/LogTableRow.vue b/src/components/table/LogTableRow.vue index 71ecef8c0..678d4c357 100644 --- a/src/components/table/LogTableRow.vue +++ b/src/components/table/LogTableRow.vue @@ -181,10 +181,10 @@ watch(isExpanded, () => resizeTabeRow) \n * ```\n */\n navigationClasses: {\n type: [String, Array, Object],\n required: false,\n default: \"\"\n },\n /**\n * aria-label for the dialog navigation.\n * Use it when you want to provide a more meaningful label than the dialog name.\n *\n * By default, navigation is labeled by the dialog name.\n */\n navigationAriaLabel: {\n type: String,\n required: false,\n default: \"\"\n },\n /**\n * aria-labelledby for the dialog navigation.\n * Use it when you have an implicit navigation label (e.g. a heading).\n *\n * By default, navigation is labeled by the dialog name.\n */\n navigationAriaLabelledby: {\n type: String,\n required: false,\n default: \"\"\n },\n /**\n * Optionally pass additional classes which will be set on the content wrapper for custom styling\n * @default ''\n */\n contentClasses: {\n type: [String, Array, Object],\n required: false,\n default: \"\"\n },\n /**\n * Optionally pass additional classes which will be set on the dialog itself\n * (the default `class` attribute will be set on the modal wrapper)\n * @default ''\n */\n dialogClasses: {\n type: [String, Array, Object],\n required: false,\n default: \"\"\n }\n },\n emits: [\"closing\", \"update:open\", \"submit\"],\n setup(props, { emit, slots }) {\n const wrapper = ref();\n const { width: dialogWidth } = useElementSize(wrapper, { width: 900 });\n const isNavigationCollapsed = computed(() => dialogWidth.value < 876);\n const hasNavigation = computed(() => slots?.navigation !== void 0);\n const navigationId = GenRandomId();\n const navigationAriaLabelAttr = computed(() => props.navigationAriaLabel || void 0);\n const navigationAriaLabelledbyAttr = computed(() => {\n if (props.navigationAriaLabel) {\n return void 0;\n }\n return props.navigationAriaLabelledby || navigationId;\n });\n const dialogElement = ref();\n const dialogTagName = computed(() => props.isForm && !hasNavigation.value ? \"form\" : \"div\");\n const dialogListeners = computed(\n () => dialogTagName.value === \"form\" ? {\n /**\n * @param {SubmitEvent} event Form submit event\n */\n submit(event) {\n event.preventDefault();\n emit(\"submit\", event);\n },\n /**\n * @param {Event} event Form submit event\n */\n reset(event) {\n event.preventDefault();\n emit(\"reset\", event);\n }\n } : {}\n );\n const showModal = ref(true);\n function handleButtonClose(button, result) {\n if (button.nativeType === \"submit\" && dialogTagName.value === \"form\" && !dialogElement.value.reportValidity()) {\n return;\n }\n handleClosing(result);\n window.setTimeout(() => handleClosed(), 300);\n }\n const handleClosing = (result) => {\n showModal.value = false;\n emit(\"closing\", result);\n };\n const handleClosed = () => {\n showModal.value = true;\n emit(\"update:open\", false);\n };\n const modalProps = computed(() => ({\n noClose: props.noClose || !props.canClose,\n container: props.container === void 0 ? \"body\" : props.container,\n // we do not pass the name as we already have the name as the headline\n // name: props.name,\n // But we need to set the correct label id so the dialog is labelled\n labelId: navigationId,\n size: props.size,\n show: props.open && showModal.value,\n outTransition: props.outTransition,\n closeOnClickOutside: props.closeOnClickOutside,\n additionalTrapElements: props.additionalTrapElements\n }));\n return {\n dialogElement,\n dialogListeners,\n dialogTagName,\n handleButtonClose,\n handleClosing,\n handleClosed,\n hasNavigation,\n navigationId,\n navigationAriaLabelAttr,\n navigationAriaLabelledbyAttr,\n isNavigationCollapsed,\n modalProps,\n wrapper\n };\n }\n});\nvar _sfc_render = function render() {\n var _vm = this, _c = _vm._self._c;\n _vm._self._setupProxy;\n return _vm.open ? _c(\"NcModal\", _vm._b({ staticClass: \"dialog__modal\", attrs: { \"enable-slideshow\": false, \"enable-swipe\": false }, on: { \"close\": _vm.handleClosed, \"update:show\": function($event) {\n return _vm.handleClosing();\n } } }, \"NcModal\", _vm.modalProps, false), [_c(\"h2\", { staticClass: \"dialog__name\", attrs: { \"id\": _vm.navigationId }, domProps: { \"textContent\": _vm._s(_vm.name) } }), _c(_vm.dialogTagName, _vm._g({ ref: \"dialogElement\", tag: \"component\", staticClass: \"dialog\", class: _vm.dialogClasses }, _vm.dialogListeners), [_c(\"div\", { ref: \"wrapper\", class: [\"dialog__wrapper\", { \"dialog__wrapper--collapsed\": _vm.isNavigationCollapsed }] }, [_vm.hasNavigation ? _c(\"nav\", { staticClass: \"dialog__navigation\", class: _vm.navigationClasses, attrs: { \"aria-label\": _vm.navigationAriaLabelAttr, \"aria-labelledby\": _vm.navigationAriaLabelledbyAttr } }, [_vm._t(\"navigation\", null, { \"isCollapsed\": _vm.isNavigationCollapsed })], 2) : _vm._e(), _c(\"div\", { staticClass: \"dialog__content\", class: _vm.contentClasses }, [_vm._t(\"default\", function() {\n return [_c(\"p\", { staticClass: \"dialog__text\" }, [_vm._v(\" \" + _vm._s(_vm.message) + \" \")])];\n })], 2)]), _c(\"div\", { staticClass: \"dialog__actions\" }, [_vm._t(\"actions\", function() {\n return _vm._l(_vm.buttons, function(button, idx) {\n return _c(\"NcDialogButton\", _vm._b({ key: idx, on: { \"click\": (_, result) => _vm.handleButtonClose(button, result) } }, \"NcDialogButton\", button, false));\n });\n })], 2)])], 1) : _vm._e();\n};\nvar _sfc_staticRenderFns = [];\nvar __component__ = /* @__PURE__ */ normalizeComponent(\n _sfc_main,\n _sfc_render,\n _sfc_staticRenderFns,\n false,\n null,\n \"1aa5fbdd\"\n);\nconst NcDialog = __component__.exports;\nexport {\n NcDialog as N\n};\n//# sourceMappingURL=NcDialog-D2lwwZL-.mjs.map\n","import '../assets/NcNoteCard-C6xb7vi0.css';\nimport { n as normalizeComponent } from \"../chunks/_plugin-vue2_normalizer-DU4iP6Vu.mjs\";\nconst _sfc_main$4 = {\n name: \"CheckboxMarkedCircleIcon\",\n emits: [\"click\"],\n props: {\n title: {\n type: String\n },\n fillColor: {\n type: String,\n default: \"currentColor\"\n },\n size: {\n type: Number,\n default: 24\n }\n }\n};\nvar _sfc_render$4 = function render() {\n var _vm = this, _c = _vm._self._c;\n return _c(\"span\", _vm._b({ staticClass: \"material-design-icon checkbox-marked-circle-icon\", attrs: { \"aria-hidden\": _vm.title ? null : \"true\", \"aria-label\": _vm.title, \"role\": \"img\" }, on: { \"click\": function($event) {\n return _vm.$emit(\"click\", $event);\n } } }, \"span\", _vm.$attrs, false), [_c(\"svg\", { staticClass: \"material-design-icon__svg\", attrs: { \"fill\": _vm.fillColor, \"width\": _vm.size, \"height\": _vm.size, \"viewBox\": \"0 0 24 24\" } }, [_c(\"path\", { attrs: { \"d\": \"M10,17L5,12L6.41,10.58L10,14.17L17.59,6.58L19,8M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z\" } }, [_vm.title ? _c(\"title\", [_vm._v(_vm._s(_vm.title))]) : _vm._e()])])]);\n};\nvar _sfc_staticRenderFns$4 = [];\nvar __component__$4 = /* @__PURE__ */ normalizeComponent(\n _sfc_main$4,\n _sfc_render$4,\n _sfc_staticRenderFns$4,\n false,\n null,\n null\n);\nconst CheckboxMarkedCircle = __component__$4.exports;\nconst _sfc_main$3 = {\n name: \"AlertDecagramIcon\",\n emits: [\"click\"],\n props: {\n title: {\n type: String\n },\n fillColor: {\n type: String,\n default: \"currentColor\"\n },\n size: {\n type: Number,\n default: 24\n }\n }\n};\nvar _sfc_render$3 = function render2() {\n var _vm = this, _c = _vm._self._c;\n return _c(\"span\", _vm._b({ staticClass: \"material-design-icon alert-decagram-icon\", attrs: { \"aria-hidden\": _vm.title ? null : \"true\", \"aria-label\": _vm.title, \"role\": \"img\" }, on: { \"click\": function($event) {\n return _vm.$emit(\"click\", $event);\n } } }, \"span\", _vm.$attrs, false), [_c(\"svg\", { staticClass: \"material-design-icon__svg\", attrs: { \"fill\": _vm.fillColor, \"width\": _vm.size, \"height\": _vm.size, \"viewBox\": \"0 0 24 24\" } }, [_c(\"path\", { attrs: { \"d\": \"M23,12L20.56,9.22L20.9,5.54L17.29,4.72L15.4,1.54L12,3L8.6,1.54L6.71,4.72L3.1,5.53L3.44,9.21L1,12L3.44,14.78L3.1,18.47L6.71,19.29L8.6,22.47L12,21L15.4,22.46L17.29,19.28L20.9,18.46L20.56,14.78L23,12M13,17H11V15H13V17M13,13H11V7H13V13Z\" } }, [_vm.title ? _c(\"title\", [_vm._v(_vm._s(_vm.title))]) : _vm._e()])])]);\n};\nvar _sfc_staticRenderFns$3 = [];\nvar __component__$3 = /* @__PURE__ */ normalizeComponent(\n _sfc_main$3,\n _sfc_render$3,\n _sfc_staticRenderFns$3,\n false,\n null,\n null\n);\nconst AlertDecagram = __component__$3.exports;\nconst _sfc_main$2 = {\n name: \"AlertIcon\",\n emits: [\"click\"],\n props: {\n title: {\n type: String\n },\n fillColor: {\n type: String,\n default: \"currentColor\"\n },\n size: {\n type: Number,\n default: 24\n }\n }\n};\nvar _sfc_render$2 = function render3() {\n var _vm = this, _c = _vm._self._c;\n return _c(\"span\", _vm._b({ staticClass: \"material-design-icon alert-icon\", attrs: { \"aria-hidden\": _vm.title ? null : \"true\", \"aria-label\": _vm.title, \"role\": \"img\" }, on: { \"click\": function($event) {\n return _vm.$emit(\"click\", $event);\n } } }, \"span\", _vm.$attrs, false), [_c(\"svg\", { staticClass: \"material-design-icon__svg\", attrs: { \"fill\": _vm.fillColor, \"width\": _vm.size, \"height\": _vm.size, \"viewBox\": \"0 0 24 24\" } }, [_c(\"path\", { attrs: { \"d\": \"M13 14H11V9H13M13 18H11V16H13M1 21H23L12 2L1 21Z\" } }, [_vm.title ? _c(\"title\", [_vm._v(_vm._s(_vm.title))]) : _vm._e()])])]);\n};\nvar _sfc_staticRenderFns$2 = [];\nvar __component__$2 = /* @__PURE__ */ normalizeComponent(\n _sfc_main$2,\n _sfc_render$2,\n _sfc_staticRenderFns$2,\n false,\n null,\n null\n);\nconst Alert = __component__$2.exports;\nconst _sfc_main$1 = {\n name: \"InformationIcon\",\n emits: [\"click\"],\n props: {\n title: {\n type: String\n },\n fillColor: {\n type: String,\n default: \"currentColor\"\n },\n size: {\n type: Number,\n default: 24\n }\n }\n};\nvar _sfc_render$1 = function render4() {\n var _vm = this, _c = _vm._self._c;\n return _c(\"span\", _vm._b({ staticClass: \"material-design-icon information-icon\", attrs: { \"aria-hidden\": _vm.title ? null : \"true\", \"aria-label\": _vm.title, \"role\": \"img\" }, on: { \"click\": function($event) {\n return _vm.$emit(\"click\", $event);\n } } }, \"span\", _vm.$attrs, false), [_c(\"svg\", { staticClass: \"material-design-icon__svg\", attrs: { \"fill\": _vm.fillColor, \"width\": _vm.size, \"height\": _vm.size, \"viewBox\": \"0 0 24 24\" } }, [_c(\"path\", { attrs: { \"d\": \"M13,9H11V7H13M13,17H11V11H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z\" } }, [_vm.title ? _c(\"title\", [_vm._v(_vm._s(_vm.title))]) : _vm._e()])])]);\n};\nvar _sfc_staticRenderFns$1 = [];\nvar __component__$1 = /* @__PURE__ */ normalizeComponent(\n _sfc_main$1,\n _sfc_render$1,\n _sfc_staticRenderFns$1,\n false,\n null,\n null\n);\nconst Information = __component__$1.exports;\nconst _sfc_main = {\n name: \"NcNoteCard\",\n props: {\n /**\n * Type or severity of the message\n */\n type: {\n type: String,\n default: \"warning\",\n validator: (type) => [\"success\", \"info\", \"warning\", \"error\"].includes(type)\n },\n /**\n * Enforce the `alert` role on the note card.\n *\n * The [`alert` role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/alert_role)\n * should only be used for information that requires the user's immediate attention.\n */\n showAlert: {\n type: Boolean,\n default: false\n },\n /**\n * Optional text to show as a heading of the note card\n */\n heading: {\n type: String,\n default: \"\"\n },\n /**\n * The message text of the note card\n */\n text: {\n type: String,\n default: \"\"\n }\n },\n computed: {\n shouldShowAlert() {\n return this.showAlert || this.type === \"error\";\n },\n icon() {\n switch (this.type) {\n case \"error\":\n return AlertDecagram;\n case \"success\":\n return CheckboxMarkedCircle;\n case \"info\":\n return Information;\n case \"warning\":\n return Alert;\n default:\n return Alert;\n }\n },\n color() {\n switch (this.type) {\n case \"error\":\n return \"var(--color-error)\";\n case \"success\":\n return \"var(--color-success)\";\n case \"info\":\n return \"var(--color-info)\";\n case \"warning\":\n return \"var(--color-warning)\";\n default:\n return \"var(--color-warning)\";\n }\n }\n }\n};\nvar _sfc_render = function render5() {\n var _vm = this, _c = _vm._self._c;\n return _c(\"div\", { staticClass: \"notecard\", class: `notecard--${_vm.type}`, attrs: { \"role\": _vm.shouldShowAlert ? \"alert\" : \"note\" } }, [_vm._t(\"icon\", function() {\n return [_c(_vm.icon, { tag: \"component\", staticClass: \"notecard__icon\", class: { \"notecard__icon--heading\": _vm.heading }, attrs: { \"fill-color\": _vm.color, \"size\": 20 } })];\n }), _c(\"div\", [_vm.heading ? _c(\"p\", { staticClass: \"notecard__heading\" }, [_vm._v(\" \" + _vm._s(_vm.heading) + \" \")]) : _vm._e(), _vm._t(\"default\", function() {\n return [_c(\"p\", { staticClass: \"notecard__text\" }, [_vm._v(\" \" + _vm._s(_vm.text) + \" \")])];\n })], 2)], 2);\n};\nvar _sfc_staticRenderFns = [];\nvar __component__ = /* @__PURE__ */ normalizeComponent(\n _sfc_main,\n _sfc_render,\n _sfc_staticRenderFns,\n false,\n null,\n \"7df28e9e\"\n);\nconst NcNoteCard = __component__.exports;\nexport {\n NcNoteCard as default\n};\n//# sourceMappingURL=NcNoteCard.mjs.map\n","function loadState(app, key, fallback) {\n const elem = document.querySelector(`#initial-state-${app}-${key}`);\n if (elem === null) {\n if (fallback !== void 0) {\n return fallback;\n }\n throw new Error(`Could not find initial state ${key} of ${app}`);\n }\n try {\n return JSON.parse(atob(elem.value));\n } catch (e) {\n throw new Error(`Could not parse initial state ${key} of ${app}`);\n }\n}\nexport {\n loadState\n};\n","/**\n * SPDX-FileCopyrightText: 2023 Nextcloud Gmbh and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport type { IAppSettings } from '../interfaces'\n\nimport { getAppSettings, setAppSetting } from '../api'\nimport { loadState } from '@nextcloud/initial-state'\nimport { defineStore } from 'pinia'\nimport { computed, ref } from 'vue'\n\ninterface SettingsState extends IAppSettings {\n\t/**\n\t * Local logging file if loaded\n\t */\n\tlocalFile?: File,\n}\n\n/**\n * Store for handling app settings\n */\nexport const useSettingsStore = defineStore('logreader-settings', () => {\n\t/**\n\t * Saved setting loaded from server\n\t */\n\tconst _loadedSettings = loadState('logreader', 'settings', { enabled: false, liveLog: false, dateTimeFormat: 'raw', shownLevels: [], logLevel: 2 })\n\n\t/**\n\t * Is file logging enabled on server\n\t */\n\tconst enabled = ref(_loadedSettings.enabled)\n\n\t/**\n\t * Wether we should load log entries from server\n\t * This checks if file logging is enabled and if a local file is currently shown\n\t */\n\tconst isEnabled = computed(() => enabled.value && localFile.value === undefined)\n\n\t/**\n\t * Is live log aka polling enabled\n\t */\n\tconst liveLog = ref(_loadedSettings.liveLog)\n\n\t/**\n\t * Array of logging levels enabled to show\n\t */\n\tconst shownLevels = ref(_loadedSettings.shownLevels)\n\n\t/**\n\t * The current log level set on the server\n\t */\n\tconst logLevel = ref(_loadedSettings.logLevel)\n\n\t/**\n\t * The datetime format to used for displaying times\n\t * This is the internal property used for the computed getter\n\t */\n\tconst _dateTimeFormat = ref(_loadedSettings.dateTimeFormat)\n\n\t/**\n\t * The datetime format to use for showing times to the user\n\t * Will always be 'raw' for local files\n\t */\n\tconst dateTimeFormat = computed({\n\t\t// In case of a local file we do not know the datetime format of the logfile so we can only display the raw format\n\t\tget: () => localFile.value !== undefined ? 'raw' : _dateTimeFormat.value,\n\t\tset: (v) => {\n\t\t\t_dateTimeFormat.value = v\n\t\t},\n\t})\n\n\t/**\n\t * The uploaded log file to display\n\t */\n\tconst localFile = ref()\n\t/**\n\t * Filename of the uploaded local log file\n\t */\n\tconst localFileName = computed(() => localFile.value?.name || '')\n\n\t/**\n\t * Set app config setting through store\n\t *\n\t * @param setting The setting to change\n\t * @param value New value of setting\n\t */\n\tasync function setSetting(this: SettingsState, setting: T, value: IAppSettings[T]) {\n\t\tawait setAppSetting({ settingsKey: setting, settingsValue: value });\n\n\t\t// set setting in state\n\t\t(this as SettingsState)[setting] = value\n\t}\n\n\t/**\n\t * Get app config settings from server and update the current state\n\t */\n\tasync function getSettings(this: SettingsState) {\n\t\tconst settings = await getAppSettings();\n\n\t\t// Update current state with loaded settings\n\t\t(Object.keys(settings.data) as Array).forEach((key) => {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t(this[key] as any) = settings.data[key]\n\t\t})\n\n\t\treturn settings.data\n\t}\n\n\treturn { shownLevels, logLevel, dateTimeFormat, enabled, isEnabled, liveLog, localFile, localFileName, setSetting, getSettings }\n})\n","/**\n * SPDX-FileCopyrightText: 2023 Nextcloud Gmbh and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport type { IException, ITraceLine } from '../interfaces/ILogEntry'\n\n/*\nExample:\n```\n{\n\t...\n\t\"message\":\"Error while running background job (class: OCA\\\\Files_Versions\\\\BackgroundJob\\\\ExpireVersions, arguments: )\",\n\t\"exception\":{\n\t\t\"Exception\":\"OCP\\\\Files\\\\NotFoundException\",\n\t\t\"Message\":\"...\",\n\t\t\"Code\":0,\n\t\t\"Trace\":[{\n\t\t\t\"file\":\"/var/www/nextcloud/lib/private/Files/Node/Folder.php\",\n\t\t\t\"line\":138,\n\t\t\t\"function\":\"get\",\n\t\t\t\"class\":\"OC\\\\Files\\\\Node\\\\Root\",\n\t\t\t\"type\":\"->\"\n\t\t}]\n\t\t\"File\":\"/var/www/nextcloud/lib/private/Files/Node/Root.php\",\n\t\t\"Line\":209,\n\t\t\"CustomMessage\":\"Error while running background job (class: OCA\\\\Files_Versions\\\\BackgroundJob\\\\ExpireVersions, arguments: )\"\n\t}\n}\n```\n*/\n\n/**\n * Parse the `exception` property of a Nextcloud log entry\n *\n * @param logException The JSON parsed `exception` property\n */\nexport function parseException(logException: IException | string): IException | undefined {\n\tif (typeof logException === 'object') {\n\t\treturn logException\n\t}\n\n\t// Handle nested json exceptions\n\tif (isNestedJsonException(logException)) {\n\t\treturn tryParseJSON(logException)\n\t}\n\n\t// Handle old exceptions (up to nextcloud)\n\tif (isOldStyleException(logException)) {\n\t\tconst data = tryParseJSON(logException.slice(10))\n\t\tconst traceLines = data.Trace?.split('\\n')\n\t\tdata.Trace = traceLines?.map(parseTraceLine)\n\t\treturn data\n\t}\n\n\treturn undefined\n}\n\n/**\n * Nested JSON exceptions are exceptions where the exception property is another exception as a JSON string\n *\n * @param logMessage message to check\n */\nfunction isNestedJsonException(logMessage: unknown) {\n\treturn typeof logMessage === 'string' && logMessage[0] === '{'\n}\n\n/**\n * Check if exception is an old Nextcloud 14 exception\n *\n * @param logMessage message to check\n */\nfunction isOldStyleException(logMessage: unknown) {\n\treturn typeof logMessage === 'string' && logMessage.slice(0, 12) === 'Exception: {'\n}\n\n/**\n * Try to parse JSON, sanitized possible unescaped parts.\n *\n * @param json The json string\n * @throws Error when json could not be parsed\n */\nfunction tryParseJSON(json: string) {\n\ttry {\n\t\treturn JSON.parse(json)\n\t} catch (e) {\n\t\t// fix unescaped newlines\n\t\tjson = json.replace(/\\n/g, '\\\\n')\n\t\t// fix unescaped namespace delimiters\n\t\tjson = json.replace(/([^\\\\])\\\\([A-Z{])/g, '$1\\\\\\\\$2')\n\t\treturn JSON.parse(json)\n\t}\n}\n\n/**\n * Parse trace lines of old Nextcloud 14 exceptions\n *\n * @param line The trace line to parse\n */\nfunction parseTraceLine(line: string) {\n\tlet parts = line.split(' ')\n\tconst number = parts.shift()\n\tconst traceData = parts.join(' ')\n\tparts = traceData.split(':')\n\n\tif (parts.length > 1) {\n\t\tlet file: ITraceLine['file']\n\t\tlet line: ITraceLine['line']\n\t\tconst fileAndLine = parts.shift() as string\n\t\tconst call = parts.join(' ')\n\t\tif (fileAndLine[0] === '[') {\n\t\t\tfile = fileAndLine\n\t\t} else {\n\t\t\tconst filePaths = fileAndLine.split('(', 2)\n\t\t\tfile = filePaths[0]\n\t\t\tconst lineNumber = filePaths[1]?.slice(0, filePaths[1].length - 1)\n\t\t\tline = lineNumber ? parseInt(lineNumber) : undefined\n\t\t}\n\t\treturn {\n\t\t\tfunction: call,\n\t\t\tnumber,\n\t\t\tfile,\n\t\t\tline,\n\t\t}\n\t} else {\n\t\treturn {\n\t\t\tfunction: traceData,\n\t\t\tnumber,\n\t\t\tfile: false,\n\t\t}\n\t}\n}\n","import { getCurrentUser } from \"@nextcloud/auth\";\nvar LogLevel = /* @__PURE__ */ ((LogLevel2) => {\n LogLevel2[LogLevel2[\"Debug\"] = 0] = \"Debug\";\n LogLevel2[LogLevel2[\"Info\"] = 1] = \"Info\";\n LogLevel2[LogLevel2[\"Warn\"] = 2] = \"Warn\";\n LogLevel2[LogLevel2[\"Error\"] = 3] = \"Error\";\n LogLevel2[LogLevel2[\"Fatal\"] = 4] = \"Fatal\";\n return LogLevel2;\n})(LogLevel || {});\nvar __defProp$1 = Object.defineProperty;\nvar __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField$1 = (obj, key, value) => {\n __defNormalProp$1(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\n return value;\n};\nclass ConsoleLogger {\n constructor(context) {\n __publicField$1(this, \"context\");\n this.context = context || {};\n }\n formatMessage(message, level, context) {\n let msg = \"[\" + LogLevel[level].toUpperCase() + \"] \";\n if (context && context.app) {\n msg += context.app + \": \";\n }\n if (typeof message === \"string\")\n return msg + message;\n msg += \"Unexpected \".concat(message.name);\n if (message.message)\n msg += ' \"'.concat(message.message, '\"');\n if (level === LogLevel.Debug && message.stack)\n msg += \"\\n\\nStack trace:\\n\".concat(message.stack);\n return msg;\n }\n log(level, message, context) {\n var _a, _b;\n if (typeof ((_a = this.context) == null ? void 0 : _a.level) === \"number\" && level < ((_b = this.context) == null ? void 0 : _b.level)) {\n return;\n }\n if (typeof message === \"object\" && (context == null ? void 0 : context.error) === void 0) {\n context.error = message;\n }\n switch (level) {\n case LogLevel.Debug:\n console.debug(this.formatMessage(message, LogLevel.Debug, context), context);\n break;\n case LogLevel.Info:\n console.info(this.formatMessage(message, LogLevel.Info, context), context);\n break;\n case LogLevel.Warn:\n console.warn(this.formatMessage(message, LogLevel.Warn, context), context);\n break;\n case LogLevel.Error:\n console.error(this.formatMessage(message, LogLevel.Error, context), context);\n break;\n case LogLevel.Fatal:\n default:\n console.error(this.formatMessage(message, LogLevel.Fatal, context), context);\n break;\n }\n }\n debug(message, context) {\n this.log(LogLevel.Debug, message, Object.assign({}, this.context, context));\n }\n info(message, context) {\n this.log(LogLevel.Info, message, Object.assign({}, this.context, context));\n }\n warn(message, context) {\n this.log(LogLevel.Warn, message, Object.assign({}, this.context, context));\n }\n error(message, context) {\n this.log(LogLevel.Error, message, Object.assign({}, this.context, context));\n }\n fatal(message, context) {\n this.log(LogLevel.Fatal, message, Object.assign({}, this.context, context));\n }\n}\nfunction buildConsoleLogger(context) {\n return new ConsoleLogger(context);\n}\nvar __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => {\n __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\n return value;\n};\nclass LoggerBuilder {\n constructor(factory) {\n __publicField(this, \"context\");\n __publicField(this, \"factory\");\n this.context = {};\n this.factory = factory;\n }\n /**\n * Set the app name within the logging context\n *\n * @param appId App name\n */\n setApp(appId) {\n this.context.app = appId;\n return this;\n }\n /**\n * Set the logging level within the logging context\n *\n * @param level Logging level\n */\n setLogLevel(level) {\n this.context.level = level;\n return this;\n }\n /* eslint-disable jsdoc/no-undefined-types */\n /**\n * Set the user id within the logging context\n * @param uid User ID\n * @see {@link detectUser}\n */\n /* eslint-enable jsdoc/no-undefined-types */\n setUid(uid) {\n this.context.uid = uid;\n return this;\n }\n /**\n * Detect the currently logged in user and set the user id within the logging context\n */\n detectUser() {\n const user = getCurrentUser();\n if (user !== null) {\n this.context.uid = user.uid;\n }\n return this;\n }\n /**\n * Detect and use logging level configured in nextcloud config\n */\n detectLogLevel() {\n const self = this;\n const onLoaded = () => {\n var _a, _b;\n if (document.readyState === \"complete\" || document.readyState === \"interactive\") {\n self.context.level = (_b = (_a = window._oc_config) == null ? void 0 : _a.loglevel) != null ? _b : LogLevel.Warn;\n if (window._oc_debug) {\n self.context.level = LogLevel.Debug;\n }\n document.removeEventListener(\"readystatechange\", onLoaded);\n } else {\n document.addEventListener(\"readystatechange\", onLoaded);\n }\n };\n onLoaded();\n return this;\n }\n /** Build a logger using the logging context and factory */\n build() {\n if (this.context.level === void 0) {\n this.detectLogLevel();\n }\n return this.factory(this.context);\n }\n}\nfunction getLoggerBuilder() {\n return new LoggerBuilder(buildConsoleLogger);\n}\nfunction getLogger() {\n return getLoggerBuilder().build();\n}\nexport {\n LogLevel,\n getLogger,\n getLoggerBuilder\n};\n","/**\n * SPDX-FileCopyrightText: 2023 Nextcloud Gmbh and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { getLoggerBuilder } from '@nextcloud/logger'\n\nexport const logger = getLoggerBuilder().setApp(appName).build()\n","/**\n * SPDX-FileCopyrightText: 2023 Nextcloud Gmbh and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport type { ILogEntry, IRawLogEntry } from '../interfaces'\nimport { parseException } from './exception'\nimport { logger } from './logger'\n\n/**\n * Parse a given log file\n *\n * @param file The log file\n */\nexport async function parseLogFile(file: File): Promise {\n\treturn parseLogString(await file.text())\n}\n\n/**\n * Parse a given log file as string\n *\n * @param raw The raw log file content\n */\nexport async function parseLogString(raw: string): Promise {\n\tlet entries: IRawLogEntry[]\n\ttry {\n\t\tconst lines = raw.split('\\n')\n\t\tentries = lines.map(tryParseJSON)\n\t} catch (e) {\n\t\tlogger.debug('falling back to json splitter')\n\n\t\tconst splitter = (await import('json-string-splitter')).default\n\t\t// the input might have had its data reformatted, breaking the original newline separated json\n\t\tconst lines = splitter(raw).jsons\n\t\tentries = lines.map(tryParseJSON)\n\t}\n\treturn entries.map(parseRawLogEntry)\n}\n\n/**\n * Parse a raw (unknown type of) log entry into a modern log entry\n * @param entry The raw log entry\n */\nexport function parseRawLogEntry(entry: IRawLogEntry): ILogEntry {\n\treturn {\n\t\t...entry,\n\t\texception: parseException((entry as ILogEntry).exception || entry.message),\n\t} as ILogEntry\n}\n\n/**\n * Try to parse a single log entry\n *\n * @param json raw log entry\n */\nfunction tryParseJSON(json: string): IRawLogEntry {\n\ttry {\n\t\treturn JSON.parse(json)\n\t} catch (e) {\n\t\tlogger.debug('Could not simply parse log entry', { error: e, json })\n\n\t\t// Handle quoted log entries\n\t\tif (json.startsWith('\"') && json.endsWith('\"')) {\n\t\t\tlet inner = json.substring(1, json.length - 1)\n\n\t\t\t// csv escaped quotes\n\t\t\tif (inner.match(/^\\{\\s*\"\"/)) {\n\t\t\t\tinner = inner.replace(/\"\"/g, '\"')\n\t\t\t}\n\t\t\treturn JSON.parse(inner)\n\t\t}\n\n\t\t// fix unescaped message json\n\t\tconst startPos = json.indexOf('\"message\":\"') + 11\n\t\tconst endPos = json.lastIndexOf('\",\"level\":')\n\t\tconst start = json.substring(0, startPos)\n\t\tconst end = json.substring(endPos)\n\t\tconst message = json.slice(startPos, endPos)\n\n\t\tconst escapedMessage = message.replace(/([^\\\\]|^)[\"]/g, '$1\\\\\"')\n\t\tjson = start + escapedMessage + end\n\n\t\treturn JSON.parse(json)\n\t}\n}\n","/**\n * SPDX-FileCopyrightText: 2023 Nextcloud Gmbh and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport type { AxiosError } from '@nextcloud/axios'\nimport type { ILogEntry } from '../interfaces'\n\nimport { defineStore } from 'pinia'\nimport { computed, ref } from 'vue'\nimport { getLog, pollLog } from '../api'\nimport { POLLING_INTERVAL } from '../constants'\nimport { showError } from '@nextcloud/dialogs'\nimport { translate as t } from '@nextcloud/l10n'\nimport { useSettingsStore } from './settings'\nimport { parseLogFile, parseLogString, parseRawLogEntry } from '../utils/logfile'\nimport { logger } from '../utils/logger'\n\n/**\n * Store for handling log entries\n */\nexport const useLogStore = defineStore('logreader-logs', () => {\n\tconst _settings = useSettingsStore()\n\n\t/**\n\t * List of all log entries\n\t */\n\tconst allEntries = ref([])\n\n\t/**\n\t * The current query to filter logs\n\t */\n\tconst query = ref('')\n\n\t/**\n\t * List of filtered log entries (search query)\n\t */\n\tconst entries = computed(() => {\n\t\tif (query.value) {\n\t\t\tconst text = query.value.toLowerCase()\n\t\t\treturn allEntries.value.filter((entry) => JSON.stringify(entry).toLowerCase().includes(text))\n\t\t}\n\t\treturn allEntries.value\n\t})\n\n\t/**\n\t * Whether there are more remaining (older) log entries on the server\n\t */\n\tconst hasRemainingEntries = ref(true)\n\n\t/**\n\t * Whether polling service is currently running\n\t */\n\tconst _polling = ref(false)\n\n\t/**\n\t * Whether we are currently loading, used to prevent multiple loading requests at the same time\n\t */\n\tconst _loading = ref(false)\n\n\t/**\n\t * Load more entries from server\n\t *\n\t * @param older Load older entries (default: true)\n\t */\n\tasync function loadMore(older = true) {\n\t\t// Nothing to do if server logging is disabled\n\t\tif (!_settings.isEnabled) return\n\n\t\t// Only load any entries if there is no previous unfinished request\n\t\tif (!(_loading.value = !_loading.value)) return\n\n\t\ttry {\n\t\t\tif (older) {\n\t\t\t\tconst { data } = await getLog({ offset: allEntries.value.length, query: query.value })\n\t\t\t\tallEntries.value.push(...data.data.map(parseRawLogEntry))\n\t\t\t\thasRemainingEntries.value = data.remain\n\t\t\t} else {\n\t\t\t\tconst { data } = await pollLog({ lastReqId: allEntries.value[0]?.reqId || '' })\n\t\t\t\tallEntries.value.splice(0, 0, ...data.map(parseRawLogEntry))\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tlogger.debug(e as Error)\n\t\t\tshowError(t('logreader', 'Could not load log entries'))\n\t\t} finally {\n\t\t\t// Handle any error to prevent a dead lock of the _loading property\n\t\t\t_loading.value = false\n\t\t}\n\t}\n\n\t/**\n\t * Load entries from log file\n\t */\n\tasync function loadFile() {\n\t\tif (!_settings.localFile) {\n\t\t\tlogger.debug('Can not read file, no file was uploaded')\n\t\t\treturn\n\t\t}\n\n\t\tallEntries.value = await parseLogFile(_settings.localFile)\n\t\thasRemainingEntries.value = false\n\t}\n\n\t/**\n\t * Load entries from string\n\t */\n\tasync function loadText(text: string) {\n\t\t// Skip if aborted\n\t\tif (text === '') {\n\t\t\treturn\n\t\t}\n\n\t\ttry {\n\t\t\tallEntries.value = await parseLogString(text)\n\t\t\t// TRANSLATORS The clipboard used to paste stuff\n\t\t\t_settings.localFile = new File([], t('logreader', 'Clipboard'))\n\t\t\t// From clipboard so no more entries\n\t\t\thasRemainingEntries.value = false\n\t\t} catch (e) {\n\t\t\t// TRANSLATORS Error when the pasted content from the clipboard could not be parsed\n\t\t\tshowError(t('logreader', 'Could not parse clipboard content'))\n\t\t\tlogger.error(e as Error)\n\t\t}\n\t}\n\n\t/**\n\t * Stop polling entries\n\t */\n\tfunction stopPolling() {\n\t\t_polling.value = false\n\t}\n\n\t/**\n\t * Start polling new entries from server\n\t */\n\tfunction startPolling() {\n\t\tif (_polling.value) {\n\t\t\t// Already polling, nothing to do\n\t\t\treturn\n\t\t}\n\n\t\tconst doPolling = async () => {\n\t\t\ttry {\n\t\t\t\t// Only poll if not using a local file\n\t\t\t\tif (_settings.isEnabled && query.value === '') {\n\t\t\t\t\tconst { data } = await pollLog({ lastReqId: allEntries.value[0]?.reqId || '' })\n\t\t\t\t\tallEntries.value.splice(0, 0, ...data.map(parseRawLogEntry))\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tlogger.warn('Unexpected error while polling for new log entries', { error: e })\n\t\t\t\tconst error = e as AxiosError\n\t\t\t\tif ((error.status || 0) >= 500) {\n\t\t\t\t\tshowError(t('logreader', 'Could not fetch new log entries (server unavailable)'))\n\t\t\t\t} else {\n\t\t\t\t\tshowError(t('logreader', 'Could not fetch new entries'))\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tif (_polling.value) {\n\t\t\t\t\twindow.setTimeout(doPolling, POLLING_INTERVAL)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t_polling.value = true\n\t\twindow.setTimeout(doPolling, POLLING_INTERVAL)\n\t}\n\n\t/**\n\t * Search the logs for a string\n\t *\n\t * First it sets the query string so the filtered entries are updated,\n\t * then it searched on the server for other logs\n\t *\n\t * @param search The query string\n\t */\n\tasync function searchLogs(search = '') {\n\t\tconst oldQuery = query.value\n\t\tquery.value = search\n\n\t\t// if query changed and server logging is enabled, request new entries\n\t\tif (search !== oldQuery && _settings.isEnabled) {\n\t\t\t_loading.value = true\n\n\t\t\ttry {\n\t\t\t\tconst { data } = await getLog({ offset: 0, query: search })\n\t\t\t\tallEntries.value = [...data.data.map(parseRawLogEntry)]\n\t\t\t\thasRemainingEntries.value = data.remain\n\t\t\t} finally {\n\t\t\t\t_loading.value = false\n\t\t\t}\n\t\t}\n\t}\n\n\treturn { allEntries, entries, hasRemainingEntries, query, loadMore, loadText, loadFile, startPolling, stopPolling, searchLogs }\n})\n","import '../assets/NcEmptyContent-CSsXYYcn.css';\nimport { n as normalizeComponent } from \"../chunks/_plugin-vue2_normalizer-DU4iP6Vu.mjs\";\nconst _sfc_main = {\n name: \"NcEmptyContent\",\n props: {\n /**\n * A header message about an empty content shown\n * @example 'No comments'\n */\n name: {\n type: String,\n default: \"\"\n },\n /**\n * Desription of the empty content\n * @example 'No comments yet, start the conversation!'\n */\n description: {\n type: String,\n default: \"\"\n }\n },\n computed: {\n hasName() {\n return this.name !== \"\";\n },\n /**\n * Check if a description is given as either property or slot\n */\n hasDescription() {\n return this.description !== \"\" || this.$slots.description?.[0];\n }\n }\n};\nvar _sfc_render = function render() {\n var _vm = this, _c = _vm._self._c;\n return _c(\"div\", { staticClass: \"empty-content\", attrs: { \"role\": \"note\" } }, [_vm.$slots.icon ? _c(\"div\", { staticClass: \"empty-content__icon\", attrs: { \"aria-hidden\": \"true\" } }, [_vm._t(\"icon\")], 2) : _vm._e(), _vm._t(\"name\", function() {\n return [_vm.hasName ? _c(\"span\", { staticClass: \"empty-content__name\" }, [_vm._v(\" \" + _vm._s(_vm.name) + \" \")]) : _vm._e()];\n }), _vm.hasDescription ? _c(\"p\", { staticClass: \"empty-content__description\" }, [_vm._t(\"description\", function() {\n return [_vm._v(\" \" + _vm._s(_vm.description) + \" \")];\n })], 2) : _vm._e(), _vm.$slots.action ? _c(\"div\", { staticClass: \"empty-content__action\" }, [_vm._t(\"action\")], 2) : _vm._e()], 2);\n};\nvar _sfc_staticRenderFns = [];\nvar __component__ = /* @__PURE__ */ normalizeComponent(\n _sfc_main,\n _sfc_render,\n _sfc_staticRenderFns,\n false,\n null,\n \"12126d08\"\n);\nconst NcEmptyContent = __component__.exports;\nexport {\n NcEmptyContent as default\n};\n//# sourceMappingURL=NcEmptyContent.mjs.map\n","\n\n","\n\n","\n\n","\n\n","\n\n\n\n\n\n","import Vue, { getCurrentInstance, computed } from \"vue\";\nfunction useModelMigration(oldModelName, oldModelEvent, required = false) {\n const vm = getCurrentInstance().proxy;\n if (required && vm.$props[oldModelName] === void 0 && vm.$props.modelValue === void 0) {\n Vue.util.warn(`Missing required prop: \"modelValue\" or old \"${oldModelName}\"`);\n }\n const model = computed({\n get() {\n if (vm.$props[oldModelName] !== void 0) {\n return vm.$props[oldModelName];\n }\n return vm.$props.modelValue;\n },\n set(value) {\n vm.$emit(\"update:modelValue\", value);\n vm.$emit(\"update:model-value\", value);\n vm.$emit(oldModelEvent, value);\n }\n });\n return model;\n}\nexport {\n useModelMigration as u\n};\n//# sourceMappingURL=useModelMigration-EhAWvqDD.mjs.map\n","import '../assets/NcCheckboxRadioSwitch-DlEieXCj.css';\nimport { r as register, H as n, a as t } from \"./_l10n-Dt0m9Fxw.mjs\";\nimport { G as GenRandomId } from \"./GenRandomId-CMooMQt0.mjs\";\nimport { n as normalizeComponent } from \"./_plugin-vue2_normalizer-DU4iP6Vu.mjs\";\nimport NcLoadingIcon from \"../Components/NcLoadingIcon.mjs\";\nimport { u as useModelMigration } from \"./useModelMigration-EhAWvqDD.mjs\";\nregister();\nconst _sfc_main$8 = {\n name: \"CheckboxBlankOutlineIcon\",\n emits: [\"click\"],\n props: {\n title: {\n type: String\n },\n fillColor: {\n type: String,\n default: \"currentColor\"\n },\n size: {\n type: Number,\n default: 24\n }\n }\n};\nvar _sfc_render$8 = function render() {\n var _vm = this, _c = _vm._self._c;\n return _c(\"span\", _vm._b({ staticClass: \"material-design-icon checkbox-blank-outline-icon\", attrs: { \"aria-hidden\": _vm.title ? null : \"true\", \"aria-label\": _vm.title, \"role\": \"img\" }, on: { \"click\": function($event) {\n return _vm.$emit(\"click\", $event);\n } } }, \"span\", _vm.$attrs, false), [_c(\"svg\", { staticClass: \"material-design-icon__svg\", attrs: { \"fill\": _vm.fillColor, \"width\": _vm.size, \"height\": _vm.size, \"viewBox\": \"0 0 24 24\" } }, [_c(\"path\", { attrs: { \"d\": \"M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3M19,5V19H5V5H19Z\" } }, [_vm.title ? _c(\"title\", [_vm._v(_vm._s(_vm.title))]) : _vm._e()])])]);\n};\nvar _sfc_staticRenderFns$8 = [];\nvar __component__$8 = /* @__PURE__ */ normalizeComponent(\n _sfc_main$8,\n _sfc_render$8,\n _sfc_staticRenderFns$8,\n false,\n null,\n null\n);\nconst CheckboxBlankOutline = __component__$8.exports;\nconst _sfc_main$7 = {\n name: \"MinusBoxIcon\",\n emits: [\"click\"],\n props: {\n title: {\n type: String\n },\n fillColor: {\n type: String,\n default: \"currentColor\"\n },\n size: {\n type: Number,\n default: 24\n }\n }\n};\nvar _sfc_render$7 = function render2() {\n var _vm = this, _c = _vm._self._c;\n return _c(\"span\", _vm._b({ staticClass: \"material-design-icon minus-box-icon\", attrs: { \"aria-hidden\": _vm.title ? null : \"true\", \"aria-label\": _vm.title, \"role\": \"img\" }, on: { \"click\": function($event) {\n return _vm.$emit(\"click\", $event);\n } } }, \"span\", _vm.$attrs, false), [_c(\"svg\", { staticClass: \"material-design-icon__svg\", attrs: { \"fill\": _vm.fillColor, \"width\": _vm.size, \"height\": _vm.size, \"viewBox\": \"0 0 24 24\" } }, [_c(\"path\", { attrs: { \"d\": \"M17,13H7V11H17M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z\" } }, [_vm.title ? _c(\"title\", [_vm._v(_vm._s(_vm.title))]) : _vm._e()])])]);\n};\nvar _sfc_staticRenderFns$7 = [];\nvar __component__$7 = /* @__PURE__ */ normalizeComponent(\n _sfc_main$7,\n _sfc_render$7,\n _sfc_staticRenderFns$7,\n false,\n null,\n null\n);\nconst MinusBox = __component__$7.exports;\nconst _sfc_main$6 = {\n name: \"CheckboxMarkedIcon\",\n emits: [\"click\"],\n props: {\n title: {\n type: String\n },\n fillColor: {\n type: String,\n default: \"currentColor\"\n },\n size: {\n type: Number,\n default: 24\n }\n }\n};\nvar _sfc_render$6 = function render3() {\n var _vm = this, _c = _vm._self._c;\n return _c(\"span\", _vm._b({ staticClass: \"material-design-icon checkbox-marked-icon\", attrs: { \"aria-hidden\": _vm.title ? null : \"true\", \"aria-label\": _vm.title, \"role\": \"img\" }, on: { \"click\": function($event) {\n return _vm.$emit(\"click\", $event);\n } } }, \"span\", _vm.$attrs, false), [_c(\"svg\", { staticClass: \"material-design-icon__svg\", attrs: { \"fill\": _vm.fillColor, \"width\": _vm.size, \"height\": _vm.size, \"viewBox\": \"0 0 24 24\" } }, [_c(\"path\", { attrs: { \"d\": \"M10,17L5,12L6.41,10.58L10,14.17L17.59,6.58L19,8M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z\" } }, [_vm.title ? _c(\"title\", [_vm._v(_vm._s(_vm.title))]) : _vm._e()])])]);\n};\nvar _sfc_staticRenderFns$6 = [];\nvar __component__$6 = /* @__PURE__ */ normalizeComponent(\n _sfc_main$6,\n _sfc_render$6,\n _sfc_staticRenderFns$6,\n false,\n null,\n null\n);\nconst CheckboxMarked = __component__$6.exports;\nconst _sfc_main$5 = {\n name: \"RadioboxMarkedIcon\",\n emits: [\"click\"],\n props: {\n title: {\n type: String\n },\n fillColor: {\n type: String,\n default: \"currentColor\"\n },\n size: {\n type: Number,\n default: 24\n }\n }\n};\nvar _sfc_render$5 = function render4() {\n var _vm = this, _c = _vm._self._c;\n return _c(\"span\", _vm._b({ staticClass: \"material-design-icon radiobox-marked-icon\", attrs: { \"aria-hidden\": _vm.title ? null : \"true\", \"aria-label\": _vm.title, \"role\": \"img\" }, on: { \"click\": function($event) {\n return _vm.$emit(\"click\", $event);\n } } }, \"span\", _vm.$attrs, false), [_c(\"svg\", { staticClass: \"material-design-icon__svg\", attrs: { \"fill\": _vm.fillColor, \"width\": _vm.size, \"height\": _vm.size, \"viewBox\": \"0 0 24 24\" } }, [_c(\"path\", { attrs: { \"d\": \"M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,7A5,5 0 0,0 7,12A5,5 0 0,0 12,17A5,5 0 0,0 17,12A5,5 0 0,0 12,7Z\" } }, [_vm.title ? _c(\"title\", [_vm._v(_vm._s(_vm.title))]) : _vm._e()])])]);\n};\nvar _sfc_staticRenderFns$5 = [];\nvar __component__$5 = /* @__PURE__ */ normalizeComponent(\n _sfc_main$5,\n _sfc_render$5,\n _sfc_staticRenderFns$5,\n false,\n null,\n null\n);\nconst RadioboxMarked = __component__$5.exports;\nconst _sfc_main$4 = {\n name: \"RadioboxBlankIcon\",\n emits: [\"click\"],\n props: {\n title: {\n type: String\n },\n fillColor: {\n type: String,\n default: \"currentColor\"\n },\n size: {\n type: Number,\n default: 24\n }\n }\n};\nvar _sfc_render$4 = function render5() {\n var _vm = this, _c = _vm._self._c;\n return _c(\"span\", _vm._b({ staticClass: \"material-design-icon radiobox-blank-icon\", attrs: { \"aria-hidden\": _vm.title ? null : \"true\", \"aria-label\": _vm.title, \"role\": \"img\" }, on: { \"click\": function($event) {\n return _vm.$emit(\"click\", $event);\n } } }, \"span\", _vm.$attrs, false), [_c(\"svg\", { staticClass: \"material-design-icon__svg\", attrs: { \"fill\": _vm.fillColor, \"width\": _vm.size, \"height\": _vm.size, \"viewBox\": \"0 0 24 24\" } }, [_c(\"path\", { attrs: { \"d\": \"M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z\" } }, [_vm.title ? _c(\"title\", [_vm._v(_vm._s(_vm.title))]) : _vm._e()])])]);\n};\nvar _sfc_staticRenderFns$4 = [];\nvar __component__$4 = /* @__PURE__ */ normalizeComponent(\n _sfc_main$4,\n _sfc_render$4,\n _sfc_staticRenderFns$4,\n false,\n null,\n null\n);\nconst RadioboxBlank = __component__$4.exports;\nconst _sfc_main$3 = {\n name: \"ToggleSwitchOffIcon\",\n emits: [\"click\"],\n props: {\n title: {\n type: String\n },\n fillColor: {\n type: String,\n default: \"currentColor\"\n },\n size: {\n type: Number,\n default: 24\n }\n }\n};\nvar _sfc_render$3 = function render6() {\n var _vm = this, _c = _vm._self._c;\n return _c(\"span\", _vm._b({ staticClass: \"material-design-icon toggle-switch-off-icon\", attrs: { \"aria-hidden\": _vm.title ? null : \"true\", \"aria-label\": _vm.title, \"role\": \"img\" }, on: { \"click\": function($event) {\n return _vm.$emit(\"click\", $event);\n } } }, \"span\", _vm.$attrs, false), [_c(\"svg\", { staticClass: \"material-design-icon__svg\", attrs: { \"fill\": _vm.fillColor, \"width\": _vm.size, \"height\": _vm.size, \"viewBox\": \"0 0 24 24\" } }, [_c(\"path\", { attrs: { \"d\": \"M17,7H7A5,5 0 0,0 2,12A5,5 0 0,0 7,17H17A5,5 0 0,0 22,12A5,5 0 0,0 17,7M7,15A3,3 0 0,1 4,12A3,3 0 0,1 7,9A3,3 0 0,1 10,12A3,3 0 0,1 7,15Z\" } }, [_vm.title ? _c(\"title\", [_vm._v(_vm._s(_vm.title))]) : _vm._e()])])]);\n};\nvar _sfc_staticRenderFns$3 = [];\nvar __component__$3 = /* @__PURE__ */ normalizeComponent(\n _sfc_main$3,\n _sfc_render$3,\n _sfc_staticRenderFns$3,\n false,\n null,\n null\n);\nconst ToggleSwitchOff = __component__$3.exports;\nconst _sfc_main$2 = {\n name: \"ToggleSwitchIcon\",\n emits: [\"click\"],\n props: {\n title: {\n type: String\n },\n fillColor: {\n type: String,\n default: \"currentColor\"\n },\n size: {\n type: Number,\n default: 24\n }\n }\n};\nvar _sfc_render$2 = function render7() {\n var _vm = this, _c = _vm._self._c;\n return _c(\"span\", _vm._b({ staticClass: \"material-design-icon toggle-switch-icon\", attrs: { \"aria-hidden\": _vm.title ? null : \"true\", \"aria-label\": _vm.title, \"role\": \"img\" }, on: { \"click\": function($event) {\n return _vm.$emit(\"click\", $event);\n } } }, \"span\", _vm.$attrs, false), [_c(\"svg\", { staticClass: \"material-design-icon__svg\", attrs: { \"fill\": _vm.fillColor, \"width\": _vm.size, \"height\": _vm.size, \"viewBox\": \"0 0 24 24\" } }, [_c(\"path\", { attrs: { \"d\": \"M17,7H7A5,5 0 0,0 2,12A5,5 0 0,0 7,17H17A5,5 0 0,0 22,12A5,5 0 0,0 17,7M17,15A3,3 0 0,1 14,12A3,3 0 0,1 17,9A3,3 0 0,1 20,12A3,3 0 0,1 17,15Z\" } }, [_vm.title ? _c(\"title\", [_vm._v(_vm._s(_vm.title))]) : _vm._e()])])]);\n};\nvar _sfc_staticRenderFns$2 = [];\nvar __component__$2 = /* @__PURE__ */ normalizeComponent(\n _sfc_main$2,\n _sfc_render$2,\n _sfc_staticRenderFns$2,\n false,\n null,\n null\n);\nconst ToggleSwitch = __component__$2.exports;\nconst TYPE_CHECKBOX = \"checkbox\";\nconst TYPE_RADIO = \"radio\";\nconst TYPE_SWITCH = \"switch\";\nconst TYPE_BUTTON = \"button\";\nconst _sfc_main$1 = {\n name: \"NcCheckboxContent\",\n components: {\n NcLoadingIcon\n },\n props: {\n /**\n * Class for the icon element\n */\n iconClass: {\n type: [String, Object],\n default: null\n },\n /**\n * Class for the text element\n */\n textClass: {\n type: [String, Object],\n default: null\n },\n /**\n * Type of the input. checkbox, radio, switch, or button.\n *\n * Only use button when used in a `tablist` container and the\n * `tab` role is set.\n *\n * @type {'checkbox'|'radio'|'switch'|'button'}\n */\n type: {\n type: String,\n default: \"checkbox\",\n validator: (type) => [\n TYPE_CHECKBOX,\n TYPE_RADIO,\n TYPE_SWITCH,\n TYPE_BUTTON\n ].includes(type)\n },\n /**\n * Toggle the alternative button style\n */\n buttonVariant: {\n type: Boolean,\n default: false\n },\n /**\n * True if the entry is checked\n */\n isChecked: {\n type: Boolean,\n default: false\n },\n /**\n * Indeterminate state\n */\n indeterminate: {\n type: Boolean,\n default: false\n },\n /**\n * Loading state\n */\n loading: {\n type: Boolean,\n default: false\n },\n /**\n * Icon size\n */\n size: {\n type: Number,\n default: 24\n }\n },\n computed: {\n isButtonType() {\n return this.type === TYPE_BUTTON;\n },\n /**\n * Returns the proper Material icon depending on the select case\n *\n * @return {object}\n */\n checkboxRadioIconElement() {\n if (this.type === TYPE_RADIO) {\n if (this.isChecked) {\n return RadioboxMarked;\n }\n return RadioboxBlank;\n }\n if (this.type === TYPE_SWITCH) {\n if (this.isChecked) {\n return ToggleSwitch;\n }\n return ToggleSwitchOff;\n }\n if (this.indeterminate) {\n return MinusBox;\n }\n if (this.isChecked) {\n return CheckboxMarked;\n }\n return CheckboxBlankOutline;\n }\n }\n};\nvar _sfc_render$1 = function render8() {\n var _vm = this, _c = _vm._self._c;\n return _c(\"span\", { staticClass: \"checkbox-content\", class: {\n [\"checkbox-content-\" + _vm.type]: true,\n \"checkbox-content--button-variant\": _vm.buttonVariant,\n \"checkbox-content--has-text\": !!_vm.$slots.default\n } }, [_c(\"span\", { class: {\n \"checkbox-content__icon\": true,\n \"checkbox-content__icon--checked\": _vm.isChecked,\n [_vm.iconClass]: true\n }, attrs: { \"aria-hidden\": true, \"inert\": \"\" } }, [_vm._t(\"icon\", function() {\n return [_vm.loading ? _c(\"NcLoadingIcon\") : !_vm.buttonVariant ? _c(_vm.checkboxRadioIconElement, { tag: \"component\", attrs: { \"size\": _vm.size } }) : _vm._e()];\n }, { \"checked\": _vm.isChecked, \"loading\": _vm.loading })], 2), _vm.$slots.default ? _c(\"span\", { class: [\"checkbox-content__text\", _vm.textClass] }, [_vm._t(\"default\")], 2) : _vm._e()]);\n};\nvar _sfc_staticRenderFns$1 = [];\nvar __component__$1 = /* @__PURE__ */ normalizeComponent(\n _sfc_main$1,\n _sfc_render$1,\n _sfc_staticRenderFns$1,\n false,\n null,\n \"18de8bed\"\n);\nconst NcCheckboxContent = __component__$1.exports;\nconst _sfc_main = {\n name: \"NcCheckboxRadioSwitch\",\n components: {\n NcCheckboxContent\n },\n // We need to pass attributes to the input element\n inheritAttrs: false,\n model: {\n prop: \"modelValue\",\n event: \"update:modelValue\"\n },\n props: {\n /**\n * Unique id attribute of the input\n */\n id: {\n type: String,\n default: () => \"checkbox-radio-switch-\" + GenRandomId(),\n validator: (id) => id.trim() !== \"\"\n },\n /**\n * Unique id attribute of the wrapper element\n */\n wrapperId: {\n type: String,\n default: null\n },\n /**\n * Input name. Required for radio, optional for checkbox, and ignored\n * for button.\n */\n name: {\n type: String,\n default: null\n },\n /**\n * Required if no text is set.\n * The aria-label is forwarded to the input or button.\n */\n ariaLabel: {\n type: String,\n default: \"\"\n },\n /**\n * Type of the input. checkbox, radio, switch, or button.\n *\n * Only use button when used in a `tablist` container and the\n * `tab` role is set.\n *\n * @type {'checkbox'|'radio'|'switch'|'button'}\n */\n type: {\n type: String,\n default: \"checkbox\",\n validator: (type) => [\n TYPE_CHECKBOX,\n TYPE_RADIO,\n TYPE_SWITCH,\n TYPE_BUTTON\n ].includes(type)\n },\n /**\n * Toggle the alternative button style\n */\n buttonVariant: {\n type: Boolean,\n default: false\n },\n /**\n * Are the elements are all direct siblings?\n * If so they will be grouped horizontally or vertically\n *\n * @type {'no'|'horizontal'|'vertical'}\n */\n buttonVariantGrouped: {\n type: String,\n default: \"no\",\n validator: (v) => [\"no\", \"vertical\", \"horizontal\"].includes(v)\n },\n /**\n * Removed in v9 - use `modelValue` (`v-model`) instead\n * @deprecated\n */\n checked: {\n type: [Boolean, Array, String],\n default: void 0\n },\n /**\n * Checkbox value\n */\n modelValue: {\n type: [Boolean, Array, String],\n default: false\n },\n /**\n * Value to be synced on check\n */\n value: {\n type: String,\n default: null\n },\n /**\n * Disabled state\n */\n disabled: {\n type: Boolean,\n default: false\n },\n /**\n * Indeterminate state\n */\n indeterminate: {\n type: Boolean,\n default: false\n },\n /**\n * Required state\n */\n required: {\n type: Boolean,\n default: false\n },\n /**\n * Loading state\n */\n loading: {\n type: Boolean,\n default: false\n },\n /**\n * Wrapping element tag\n *\n * When `type` is set to `button` this will be ignored\n *\n * Defaults to `span`\n */\n wrapperElement: {\n type: String,\n default: null\n }\n },\n emits: [\n /**\n * Removed in v9 - use `update:modelValue` (`v-model`) instead\n * @deprecated\n */\n \"update:checked\",\n \"update:modelValue\",\n /** Same as update:modelValue for Vue 2 compatibility */\n \"update:model-value\"\n ],\n setup() {\n const model = useModelMigration(\"checked\", \"update:checked\");\n return {\n model\n };\n },\n computed: {\n dataAttrs() {\n return Object.fromEntries(Object.entries(this.$attrs).filter(([key]) => key.startsWith(\"data-\")));\n },\n nonDataAttrs() {\n return Object.fromEntries(Object.entries(this.$attrs).filter(([key]) => !key.startsWith(\"data-\")));\n },\n isButtonType() {\n return this.type === TYPE_BUTTON;\n },\n computedWrapperElement() {\n if (this.isButtonType) {\n return \"button\";\n }\n if (this.wrapperElement !== null) {\n return this.wrapperElement;\n }\n return \"span\";\n },\n listeners() {\n if (this.isButtonType) {\n return {\n click: this.onToggle\n };\n }\n return {\n change: this.onToggle\n };\n },\n /**\n * Icon size\n *\n * @return {number}\n */\n size() {\n return this.type === TYPE_SWITCH ? 36 : 24;\n },\n /**\n * Css local variables for this component\n *\n * @return {object}\n */\n cssVars() {\n return {\n \"--icon-size\": this.size + \"px\",\n \"--icon-height\": (this.type === TYPE_SWITCH ? 16 : this.size) + \"px\"\n };\n },\n /**\n * Return the input type.\n * Switch is not an official type\n *\n * @return {string}\n */\n inputType() {\n const nativeTypes = [\n TYPE_CHECKBOX,\n TYPE_RADIO,\n TYPE_BUTTON\n ];\n if (nativeTypes.includes(this.type)) {\n return this.type;\n }\n return TYPE_CHECKBOX;\n },\n /**\n * Check if that entry is checked\n * If value is defined, we use that as the checked value\n * If not, we expect true/false in checked state\n *\n * @return {boolean}\n */\n isChecked() {\n if (this.value !== null) {\n if (Array.isArray(this.model)) {\n return [...this.model].indexOf(this.value) > -1;\n }\n return this.model === this.value;\n }\n return this.model === true;\n },\n hasIndeterminate() {\n return [\n TYPE_CHECKBOX,\n TYPE_RADIO\n ].includes(this.inputType);\n }\n },\n mounted() {\n if (this.name && this.type === TYPE_CHECKBOX) {\n if (!Array.isArray(this.model)) {\n throw new Error(\"When using groups of checkboxes, the updated value will be an array.\");\n }\n }\n if (this.name && this.type === TYPE_SWITCH) {\n throw new Error(\"Switches are not made to be used for data sets. Please use checkboxes instead.\");\n }\n if (typeof this.model !== \"boolean\" && this.type === TYPE_SWITCH) {\n throw new Error(\"Switches can only be used with boolean as checked prop.\");\n }\n },\n methods: {\n t,\n n,\n onToggle(event) {\n if (this.disabled || event.target.tagName.toLowerCase() === \"a\") {\n return;\n }\n if (this.type === TYPE_RADIO) {\n this.model = this.value;\n return;\n }\n if (this.type === TYPE_SWITCH) {\n this.model = !this.isChecked;\n return;\n }\n if (typeof this.model === \"boolean\") {\n this.model = !this.model;\n return;\n }\n const values = this.getInputsSet().filter((input) => input.checked).map((input) => input.value);\n if (values.includes(this.value)) {\n this.model = values.filter((v) => v !== this.value);\n } else {\n this.model = [...values, this.value];\n }\n },\n /**\n * Get the input set based on this name\n *\n * @return {Node[]}\n */\n getInputsSet() {\n return [...document.getElementsByName(this.name)];\n }\n }\n};\nvar _sfc_render = function render9() {\n var _vm = this, _c = _vm._self._c;\n return _c(_vm.computedWrapperElement, _vm._g(_vm._b({ tag: \"component\", staticClass: \"checkbox-radio-switch\", class: {\n [\"checkbox-radio-switch-\" + _vm.type]: _vm.type,\n \"checkbox-radio-switch--checked\": _vm.isChecked,\n \"checkbox-radio-switch--disabled\": _vm.disabled,\n \"checkbox-radio-switch--indeterminate\": _vm.hasIndeterminate ? _vm.indeterminate : false,\n \"checkbox-radio-switch--button-variant\": _vm.buttonVariant,\n \"checkbox-radio-switch--button-variant-v-grouped\": _vm.buttonVariant && _vm.buttonVariantGrouped === \"vertical\",\n \"checkbox-radio-switch--button-variant-h-grouped\": _vm.buttonVariant && _vm.buttonVariantGrouped === \"horizontal\",\n \"button-vue\": _vm.isButtonType\n }, style: _vm.cssVars, attrs: { \"id\": _vm.wrapperId, \"aria-label\": _vm.isButtonType && _vm.ariaLabel ? _vm.ariaLabel : void 0, \"type\": _vm.isButtonType ? \"button\" : null } }, \"component\", _vm.isButtonType ? _vm.$attrs : _vm.dataAttrs, false), _vm.isButtonType ? _vm.listeners : null), [!_vm.isButtonType ? _c(\"input\", _vm._g(_vm._b({ staticClass: \"checkbox-radio-switch__input\", attrs: { \"id\": _vm.id, \"aria-labelledby\": !_vm.isButtonType && !_vm.ariaLabel ? `${_vm.id}-label` : null, \"aria-label\": _vm.ariaLabel || void 0, \"disabled\": _vm.disabled, \"type\": _vm.inputType, \"required\": _vm.required, \"name\": _vm.name }, domProps: { \"value\": _vm.value, \"checked\": _vm.isChecked, \"indeterminate\": _vm.hasIndeterminate ? _vm.indeterminate : null } }, \"input\", _vm.nonDataAttrs, false), _vm.listeners)) : _vm._e(), _c(\"NcCheckboxContent\", { staticClass: \"checkbox-radio-switch__content\", attrs: { \"id\": !_vm.isButtonType ? `${_vm.id}-label` : void 0, \"icon-class\": \"checkbox-radio-switch__icon\", \"text-class\": \"checkbox-radio-switch__text\", \"type\": _vm.type, \"indeterminate\": _vm.hasIndeterminate ? _vm.indeterminate : false, \"button-variant\": _vm.buttonVariant, \"is-checked\": _vm.isChecked, \"loading\": _vm.loading, \"size\": _vm.size }, nativeOn: { \"click\": function($event) {\n return _vm.onToggle.apply(null, arguments);\n } }, scopedSlots: _vm._u([{ key: \"icon\", fn: function() {\n return [_vm._t(\"icon\")];\n }, proxy: true }], null, true) }, [_vm._t(\"default\")], 2)], 1);\n};\nvar _sfc_staticRenderFns = [];\nvar __component__ = /* @__PURE__ */ normalizeComponent(\n _sfc_main,\n _sfc_render,\n _sfc_staticRenderFns,\n false,\n null,\n \"22cdd229\"\n);\nconst NcCheckboxRadioSwitch = __component__.exports;\nexport {\n NcCheckboxRadioSwitch as N\n};\n//# sourceMappingURL=NcCheckboxRadioSwitch-Di9rSADK.mjs.map\n","\n\n\n\n","/**\n * SPDX-FileCopyrightText: 2023 Nextcloud Gmbh and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\n/**\n * Debounce a function call for specified amount of time\n *\n * @param func The function to debounce\n * @param timeout Amount of time (ms) to wait\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function debounce(func: Function, timeout = 300) {\n\tlet timer: number\n\treturn (...args: unknown[]) => {\n\t\tclearTimeout(timer)\n\t\ttimer = window.setTimeout(() => { func.apply(this, args) }, timeout)\n\t}\n}\n","\n\n\n\n\n\n","\n\n\n\n\n\n","\n\n\n\n\n\n","import { n as normalizeComponent } from \"../chunks/_plugin-vue2_normalizer-DU4iP6Vu.mjs\";\nconst _sfc_main = {\n name: \"NcVNodes\",\n props: {\n /**\n * The vnodes to render\n */\n vnodes: {\n type: [Array, Object],\n default: null\n }\n },\n /**\n * The render function to display the component\n *\n * @param {Function} h The function to create VNodes\n * @return {object} The created VNode\n */\n render(h) {\n return this.vnodes || this.$slots?.default || this.$scopedSlots?.default?.();\n }\n};\nconst _sfc_render = null;\nconst _sfc_staticRenderFns = null;\nvar __component__ = /* @__PURE__ */ normalizeComponent(\n _sfc_main,\n _sfc_render,\n _sfc_staticRenderFns,\n false,\n null,\n null\n);\nconst NcVNodes = __component__.exports;\nexport {\n NcVNodes as default\n};\n//# sourceMappingURL=NcVNodes.mjs.map\n","import { ref, readonly } from \"vue\";\nconst MOBILE_BREAKPOINT = 1024;\nconst MOBILE_SMALL_BREAKPOINT = MOBILE_BREAKPOINT / 2;\nconst isLessThanBreakpoint = (breakpoint) => document.documentElement.clientWidth < breakpoint;\nconst isMobile = ref(isLessThanBreakpoint(MOBILE_BREAKPOINT));\nconst isSmallMobile = ref(isLessThanBreakpoint(MOBILE_SMALL_BREAKPOINT));\nwindow.addEventListener(\"resize\", () => {\n isMobile.value = isLessThanBreakpoint(MOBILE_BREAKPOINT);\n isSmallMobile.value = isLessThanBreakpoint(MOBILE_SMALL_BREAKPOINT);\n}, { passive: true });\nfunction useIsMobile() {\n return readonly(isMobile);\n}\nfunction useIsSmallMobile() {\n return readonly(isSmallMobile);\n}\nconst isMobileState = readonly(isMobile);\nexport {\n MOBILE_BREAKPOINT,\n MOBILE_SMALL_BREAKPOINT,\n isMobileState,\n useIsMobile,\n useIsSmallMobile\n};\n//# sourceMappingURL=useIsMobile.mjs.map\n","function debounce(function_, wait = 100, options = {}) {\n\tif (typeof function_ !== 'function') {\n\t\tthrow new TypeError(`Expected the first parameter to be a function, got \\`${typeof function_}\\`.`);\n\t}\n\n\tif (wait < 0) {\n\t\tthrow new RangeError('`wait` must not be negative.');\n\t}\n\n\t// TODO: Deprecate the boolean parameter at some point.\n\tconst {immediate} = typeof options === 'boolean' ? {immediate: options} : options;\n\n\tlet storedContext;\n\tlet storedArguments;\n\tlet timeoutId;\n\tlet timestamp;\n\tlet result;\n\n\tfunction run() {\n\t\tconst callContext = storedContext;\n\t\tconst callArguments = storedArguments;\n\t\tstoredContext = undefined;\n\t\tstoredArguments = undefined;\n\t\tresult = function_.apply(callContext, callArguments);\n\t\treturn result;\n\t}\n\n\tfunction later() {\n\t\tconst last = Date.now() - timestamp;\n\n\t\tif (last < wait && last >= 0) {\n\t\t\ttimeoutId = setTimeout(later, wait - last);\n\t\t} else {\n\t\t\ttimeoutId = undefined;\n\n\t\t\tif (!immediate) {\n\t\t\t\tresult = run();\n\t\t\t}\n\t\t}\n\t}\n\n\tconst debounced = function (...arguments_) {\n\t\tif (\n\t\t\tstoredContext\n\t\t\t&& this !== storedContext\n\t\t\t&& Object.getPrototypeOf(this) === Object.getPrototypeOf(storedContext)\n\t\t) {\n\t\t\tthrow new Error('Debounced method called with different contexts of the same prototype.');\n\t\t}\n\n\t\tstoredContext = this; // eslint-disable-line unicorn/no-this-assignment\n\t\tstoredArguments = arguments_;\n\t\ttimestamp = Date.now();\n\n\t\tconst callNow = immediate && !timeoutId;\n\n\t\tif (!timeoutId) {\n\t\t\ttimeoutId = setTimeout(later, wait);\n\t\t}\n\n\t\tif (callNow) {\n\t\t\tresult = run();\n\t\t}\n\n\t\treturn result;\n\t};\n\n\tObject.defineProperty(debounced, 'isPending', {\n\t\tget() {\n\t\t\treturn timeoutId !== undefined;\n\t\t},\n\t});\n\n\tdebounced.clear = () => {\n\t\tif (!timeoutId) {\n\t\t\treturn;\n\t\t}\n\n\t\tclearTimeout(timeoutId);\n\t\ttimeoutId = undefined;\n\t};\n\n\tdebounced.flush = () => {\n\t\tif (!timeoutId) {\n\t\t\treturn;\n\t\t}\n\n\t\tdebounced.trigger();\n\t};\n\n\tdebounced.trigger = () => {\n\t\tresult = run();\n\n\t\tdebounced.clear();\n\t};\n\n\treturn debounced;\n}\n\n// Adds compatibility for ES modules\nmodule.exports.debounce = debounce;\n\nmodule.exports = debounce;\n","import '../assets/NcAppSettingsDialog-kKMMsdb3.css';\nimport { N as NcDialog } from \"./NcDialog-D2lwwZL-.mjs\";\nimport NcVNodes from \"../Components/NcVNodes.mjs\";\nimport { useIsMobile } from \"../Composables/useIsMobile.mjs\";\nimport { r as register, o as t46, a as t } from \"./_l10n-Dt0m9Fxw.mjs\";\nimport debounce from \"debounce\";\nimport Vue from \"vue\";\nimport { n as normalizeComponent } from \"./_plugin-vue2_normalizer-DU4iP6Vu.mjs\";\nregister(t46);\nconst _sfc_main = {\n name: \"NcAppSettingsDialog\",\n components: {\n NcDialog,\n NcVNodes\n },\n provide() {\n return {\n registerSection: this.registerSection,\n unregisterSection: this.unregisterSection\n };\n },\n props: {\n /**\n * Determines the open / closed state of the modal\n */\n open: {\n type: Boolean,\n required: true\n },\n /**\n * Shows the navigation on desktop if true\n */\n showNavigation: {\n type: Boolean,\n default: false\n },\n /**\n * Selector for the popover container\n */\n container: {\n type: String,\n default: \"body\"\n },\n /**\n * Name of the settings\n */\n name: {\n type: String,\n default: \"\"\n },\n /**\n * Additional elements to add to the focus trap\n */\n additionalTrapElements: {\n type: Array,\n default: () => []\n }\n },\n emits: [\"update:open\"],\n setup() {\n return {\n isMobile: useIsMobile()\n };\n },\n data() {\n return {\n selectedSection: \"\",\n linkClicked: false,\n addedScrollListener: false,\n scroller: null,\n /**\n * Currently registered settings sections\n * @type {{ id: string, name: string, icon?: import('vue').VNode[] }[]}\n */\n sections: []\n };\n },\n computed: {\n dialogProperties() {\n return {\n additionalTrapElements: this.additionalTrapElements,\n closeOnClickOutside: true,\n class: \"app-settings\",\n container: this.container,\n contentClasses: \"app-settings__content\",\n size: \"large\",\n name: this.name,\n navigationClasses: \"app-settings__navigation\"\n };\n },\n /**\n * Check if one or more navigation entries provide icons\n */\n hasNavigationIcons() {\n return this.sections.some(({ icon }) => !!icon);\n },\n hasNavigation() {\n if (this.isMobile || !this.showNavigation) {\n return false;\n } else {\n return true;\n }\n },\n settingsNavigationAriaLabel() {\n return t(\"Settings navigation\");\n }\n },\n updated() {\n if (!this.$refs.settingsScroller) {\n return;\n }\n this.scroller = this.$refs.settingsScroller;\n if (!this.addedScrollListener) {\n this.scroller.addEventListener(\"scroll\", this.handleScroll);\n this.addedScrollListener = true;\n }\n },\n methods: {\n /**\n * Called when a new section is registered\n * @param {string} id The section ID\n * @param {string} name The section name\n * @param {import('vue').VNode[]|undefined} icon Optional icon component\n */\n registerSection(id, name, icon) {\n if (this.sections.some(({ id: otherId }) => id === otherId)) {\n throw new Error(`Duplicate section id found: ${id}. Settings navigation sections must have unique section ids.`);\n }\n if (this.sections.some(({ name: otherName }) => name === otherName)) {\n Vue.util.warn(`Duplicate section name found: ${name}. Settings navigation sections must have unique section names.`);\n }\n const newSections = [...this.sections, { id, name, icon }];\n this.sections = newSections.sort(({ id: idA }, { id: idB }) => {\n const indexOf = (id2) => this.$slots.default?.findIndex?.((vnode) => vnode?.componentOptions?.propsData?.id === id2) ?? -1;\n return indexOf(idA) - indexOf(idB);\n });\n if (this.sections.length === 1) {\n this.selectedSection = id;\n }\n },\n /**\n * Called when a section is unregistered to remove it from dialog\n * @param {string} id The section ID\n */\n unregisterSection(id) {\n this.sections = this.sections.filter(({ id: otherId }) => id !== otherId);\n if (this.selectedSection === id) {\n this.selectedSection = this.sections[0]?.id ?? \"\";\n }\n },\n /**\n * Scrolls the content to the selected settings section.absolute\n *\n * @param {string} item the ID of the section\n */\n handleSettingsNavigationClick(item) {\n this.linkClicked = true;\n document.getElementById(\"settings-section_\" + item).scrollIntoView({\n behavior: \"smooth\",\n inline: \"nearest\"\n });\n this.selectedSection = item;\n setTimeout(() => {\n this.linkClicked = false;\n }, 1e3);\n },\n handleCloseModal(isOpen) {\n if (isOpen) {\n return;\n }\n this.$emit(\"update:open\", false);\n this.scroller.removeEventListener(\"scroll\", this.handleScroll);\n this.addedScrollListener = false;\n this.scroller.scrollTop = 0;\n },\n handleScroll() {\n if (!this.linkClicked) {\n this.unfocusNavigationItem();\n }\n },\n // Remove selected section once the user starts scrolling\n unfocusNavigationItem: debounce(function() {\n this.selectedSection = \"\";\n if (document.activeElement.className.includes(\"navigation-list__link\")) {\n document.activeElement.blur();\n }\n }, 300)\n }\n};\nvar _sfc_render = function render() {\n var _vm = this, _c = _vm._self._c;\n return _vm.open ? _c(\"NcDialog\", _vm._b({ attrs: { \"navigation-aria-label\": _vm.settingsNavigationAriaLabel }, on: { \"update:open\": _vm.handleCloseModal }, scopedSlots: _vm._u([_vm.hasNavigation ? { key: \"navigation\", fn: function({ isCollapsed }) {\n return [!isCollapsed ? _c(\"ul\", { staticClass: \"navigation-list\" }, _vm._l(_vm.sections, function(section) {\n return _c(\"li\", { key: section.id }, [_c(\"a\", { class: {\n \"navigation-list__link\": true,\n \"navigation-list__link--active\": section.id === _vm.selectedSection,\n \"navigation-list__link--icon\": _vm.hasNavigationIcons\n }, attrs: { \"aria-current\": `${section.id === _vm.selectedSection}`, \"href\": `#settings-section_${section.id}`, \"tabindex\": \"0\" }, on: { \"click\": function($event) {\n $event.preventDefault();\n return _vm.handleSettingsNavigationClick(section.id);\n }, \"keydown\": function($event) {\n if (!$event.type.indexOf(\"key\") && _vm._k($event.keyCode, \"enter\", 13, $event.key, \"Enter\")) return null;\n return _vm.handleSettingsNavigationClick(section.id);\n } } }, [_vm.hasNavigationIcons ? _c(\"div\", { staticClass: \"navigation-list__link-icon\" }, [section.icon ? _c(\"NcVNodes\", { attrs: { \"vnodes\": section.icon } }) : _vm._e()], 1) : _vm._e(), _c(\"span\", { staticClass: \"navigation-list__link-text\" }, [_vm._v(\" \" + _vm._s(section.name) + \" \")])])]);\n }), 0) : _vm._e()];\n } } : null], null, true) }, \"NcDialog\", _vm.dialogProperties, false), [_c(\"div\", { ref: \"settingsScroller\" }, [_vm._t(\"default\")], 2)]) : _vm._e();\n};\nvar _sfc_staticRenderFns = [];\nvar __component__ = /* @__PURE__ */ normalizeComponent(\n _sfc_main,\n _sfc_render,\n _sfc_staticRenderFns,\n false,\n null,\n \"0674bd2e\"\n);\nconst NcAppSettingsDialog = __component__.exports;\nexport {\n NcAppSettingsDialog as N\n};\n//# sourceMappingURL=NcAppSettingsDialog-Dl-kMSpe.mjs.map\n","import '../assets/NcAppSettingsSection-Bl2-D3_g.css';\nimport { n as normalizeComponent } from \"../chunks/_plugin-vue2_normalizer-DU4iP6Vu.mjs\";\nconst _sfc_main = {\n name: \"NcAppSettingsSection\",\n inject: [\"registerSection\", \"unregisterSection\"],\n props: {\n name: {\n type: String,\n required: true\n },\n id: {\n type: String,\n required: true,\n validator(id) {\n return /^[a-z0-9\\-_]+$/.test(id);\n }\n }\n },\n computed: {\n // generate an id for each settingssection based on the name without whitespaces\n htmlId() {\n return \"settings-section_\" + this.id;\n }\n },\n // Reactive changes for section navigation\n watch: {\n id(newId, oldId) {\n this.unregisterSection(oldId);\n this.registerSection(newId, this.name, this.$slots?.icon);\n },\n name(newName) {\n this.unregisterSection(this.id);\n this.registerSection(this.id, newName, this.$slots?.icon);\n }\n },\n mounted() {\n this.registerSection(this.id, this.name, this.$slots?.icon);\n },\n beforeDestroy() {\n this.unregisterSection(this.id);\n }\n};\nvar _sfc_render = function render() {\n var _vm = this, _c = _vm._self._c;\n return _c(\"section\", { staticClass: \"app-settings-section\", attrs: { \"id\": _vm.htmlId, \"aria-labelledby\": `${_vm.htmlId}--label` } }, [_c(\"h3\", { staticClass: \"app-settings-section__name\", attrs: { \"id\": `${_vm.htmlId}--label` } }, [_vm._v(\" \" + _vm._s(_vm.name) + \" \")]), _vm._t(\"default\"), _vm._e()], 2);\n};\nvar _sfc_staticRenderFns = [];\nvar __component__ = /* @__PURE__ */ normalizeComponent(\n _sfc_main,\n _sfc_render,\n _sfc_staticRenderFns,\n false,\n null,\n \"e970c9f7\"\n);\nconst NcAppSettingsSection = __component__.exports;\nexport {\n NcAppSettingsSection as default\n};\n//# sourceMappingURL=NcAppSettingsSection.mjs.map\n","\n\n\n\n","\n\n\n\n","/**\n * SPDX-FileCopyrightText: 2023 Nextcloud Gmbh and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { translate as t } from '@nextcloud/l10n'\n\n/**\n * Copy text to clipboard if it fails (e.g. not secure context (https, localhost...))\n * a prompt will be opened for the user to copy the text manually\n *\n * @param text The text to copy\n * @return true if automatic copy suceeded, false if prompt was used\n */\nexport const copyToCipboard = async (text: string) => {\n\ttry {\n\t\tawait window.navigator.clipboard.writeText(text)\n\t\treturn true\n\t} catch (e) {\n\t\twindow.prompt(\n\t\t\tt('logreader', 'Could not copy to clipboard, please copy manually:'),\n\t\t\ttext,\n\t\t)\n\t}\n\treturn false\n}\n","/**\n * SPDX-FileCopyrightText: 2023 Nextcloud Gmbh and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport type { Pinia } from 'pinia'\nimport type { ILogEntry } from '../interfaces'\n\nimport { getCanonicalLocale, translate as t } from '@nextcloud/l10n'\nimport { LOGGING_LEVEL_NAMES } from '../constants'\nimport { useSettingsStore } from '../store/settings'\n\nexport const useLogFormatting = (pinia?: Pinia) => {\n\tconst settingsStore = useSettingsStore(pinia)\n\n\tconst formatTime = (time: string) => {\n\t\tconst dateFormat = Intl.DateTimeFormat(getCanonicalLocale(), {\n\t\t\tdateStyle: 'medium',\n\t\t\ttimeStyle: 'medium',\n\t\t\ttimeZone: settingsStore.dateTimeFormat === 'utc' ? 'UTC' : undefined,\n\t\t})\n\t\treturn dateFormat.format(new Date(time))\n\t}\n\t/**\n\t * Format a log entry into a human readable text\n\t *\n\t * @param entry The log entry to format\n\t */\n\tconst formatLogEntry = (entry: ILogEntry) => {\n\t\treturn (\n\t\t\t`[${entry.app}] ${LOGGING_LEVEL_NAMES[entry.level]}: ${entry.message}\\n`\n\t\t\t+ (entry.method ? `\\t${entry.method} ${entry.url}\\n` : '')\n\t\t\t+ t('logreader', '\\tfrom {address} by {user} at {time}\\n', {\n\t\t\t\taddress: entry.remoteAddr || '?',\n\t\t\t\tuser: entry.user || '?',\n\t\t\t\ttime: formatTime(entry.time),\n\t\t\t})\n\t\t)\n\t}\n\treturn {\n\t\tformatTime,\n\t\tformatLogEntry,\n\t}\n}\n","\n\n","/* eslint-disable no-multi-assign */\n\nfunction deepFreeze(obj) {\n if (obj instanceof Map) {\n obj.clear =\n obj.delete =\n obj.set =\n function () {\n throw new Error('map is read-only');\n };\n } else if (obj instanceof Set) {\n obj.add =\n obj.clear =\n obj.delete =\n function () {\n throw new Error('set is read-only');\n };\n }\n\n // Freeze self\n Object.freeze(obj);\n\n Object.getOwnPropertyNames(obj).forEach((name) => {\n const prop = obj[name];\n const type = typeof prop;\n\n // Freeze prop if it is an object or function and also not already frozen\n if ((type === 'object' || type === 'function') && !Object.isFrozen(prop)) {\n deepFreeze(prop);\n }\n });\n\n return obj;\n}\n\n/** @typedef {import('highlight.js').CallbackResponse} CallbackResponse */\n/** @typedef {import('highlight.js').CompiledMode} CompiledMode */\n/** @implements CallbackResponse */\n\nclass Response {\n /**\n * @param {CompiledMode} mode\n */\n constructor(mode) {\n // eslint-disable-next-line no-undefined\n if (mode.data === undefined) mode.data = {};\n\n this.data = mode.data;\n this.isMatchIgnored = false;\n }\n\n ignoreMatch() {\n this.isMatchIgnored = true;\n }\n}\n\n/**\n * @param {string} value\n * @returns {string}\n */\nfunction escapeHTML(value) {\n return value\n .replace(/&/g, '&')\n .replace(//g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''');\n}\n\n/**\n * performs a shallow merge of multiple objects into one\n *\n * @template T\n * @param {T} original\n * @param {Record[]} objects\n * @returns {T} a single new object\n */\nfunction inherit$1(original, ...objects) {\n /** @type Record */\n const result = Object.create(null);\n\n for (const key in original) {\n result[key] = original[key];\n }\n objects.forEach(function(obj) {\n for (const key in obj) {\n result[key] = obj[key];\n }\n });\n return /** @type {T} */ (result);\n}\n\n/**\n * @typedef {object} Renderer\n * @property {(text: string) => void} addText\n * @property {(node: Node) => void} openNode\n * @property {(node: Node) => void} closeNode\n * @property {() => string} value\n */\n\n/** @typedef {{scope?: string, language?: string, sublanguage?: boolean}} Node */\n/** @typedef {{walk: (r: Renderer) => void}} Tree */\n/** */\n\nconst SPAN_CLOSE = '';\n\n/**\n * Determines if a node needs to be wrapped in \n *\n * @param {Node} node */\nconst emitsWrappingTags = (node) => {\n // rarely we can have a sublanguage where language is undefined\n // TODO: track down why\n return !!node.scope;\n};\n\n/**\n *\n * @param {string} name\n * @param {{prefix:string}} options\n */\nconst scopeToCSSClass = (name, { prefix }) => {\n // sub-language\n if (name.startsWith(\"language:\")) {\n return name.replace(\"language:\", \"language-\");\n }\n // tiered scope: comment.line\n if (name.includes(\".\")) {\n const pieces = name.split(\".\");\n return [\n `${prefix}${pieces.shift()}`,\n ...(pieces.map((x, i) => `${x}${\"_\".repeat(i + 1)}`))\n ].join(\" \");\n }\n // simple scope\n return `${prefix}${name}`;\n};\n\n/** @type {Renderer} */\nclass HTMLRenderer {\n /**\n * Creates a new HTMLRenderer\n *\n * @param {Tree} parseTree - the parse tree (must support `walk` API)\n * @param {{classPrefix: string}} options\n */\n constructor(parseTree, options) {\n this.buffer = \"\";\n this.classPrefix = options.classPrefix;\n parseTree.walk(this);\n }\n\n /**\n * Adds texts to the output stream\n *\n * @param {string} text */\n addText(text) {\n this.buffer += escapeHTML(text);\n }\n\n /**\n * Adds a node open to the output stream (if needed)\n *\n * @param {Node} node */\n openNode(node) {\n if (!emitsWrappingTags(node)) return;\n\n const className = scopeToCSSClass(node.scope,\n { prefix: this.classPrefix });\n this.span(className);\n }\n\n /**\n * Adds a node close to the output stream (if needed)\n *\n * @param {Node} node */\n closeNode(node) {\n if (!emitsWrappingTags(node)) return;\n\n this.buffer += SPAN_CLOSE;\n }\n\n /**\n * returns the accumulated buffer\n */\n value() {\n return this.buffer;\n }\n\n // helpers\n\n /**\n * Builds a span element\n *\n * @param {string} className */\n span(className) {\n this.buffer += ``;\n }\n}\n\n/** @typedef {{scope?: string, language?: string, children: Node[]} | string} Node */\n/** @typedef {{scope?: string, language?: string, children: Node[]} } DataNode */\n/** @typedef {import('highlight.js').Emitter} Emitter */\n/** */\n\n/** @returns {DataNode} */\nconst newNode = (opts = {}) => {\n /** @type DataNode */\n const result = { children: [] };\n Object.assign(result, opts);\n return result;\n};\n\nclass TokenTree {\n constructor() {\n /** @type DataNode */\n this.rootNode = newNode();\n this.stack = [this.rootNode];\n }\n\n get top() {\n return this.stack[this.stack.length - 1];\n }\n\n get root() { return this.rootNode; }\n\n /** @param {Node} node */\n add(node) {\n this.top.children.push(node);\n }\n\n /** @param {string} scope */\n openNode(scope) {\n /** @type Node */\n const node = newNode({ scope });\n this.add(node);\n this.stack.push(node);\n }\n\n closeNode() {\n if (this.stack.length > 1) {\n return this.stack.pop();\n }\n // eslint-disable-next-line no-undefined\n return undefined;\n }\n\n closeAllNodes() {\n while (this.closeNode());\n }\n\n toJSON() {\n return JSON.stringify(this.rootNode, null, 4);\n }\n\n /**\n * @typedef { import(\"./html_renderer\").Renderer } Renderer\n * @param {Renderer} builder\n */\n walk(builder) {\n // this does not\n return this.constructor._walk(builder, this.rootNode);\n // this works\n // return TokenTree._walk(builder, this.rootNode);\n }\n\n /**\n * @param {Renderer} builder\n * @param {Node} node\n */\n static _walk(builder, node) {\n if (typeof node === \"string\") {\n builder.addText(node);\n } else if (node.children) {\n builder.openNode(node);\n node.children.forEach((child) => this._walk(builder, child));\n builder.closeNode(node);\n }\n return builder;\n }\n\n /**\n * @param {Node} node\n */\n static _collapse(node) {\n if (typeof node === \"string\") return;\n if (!node.children) return;\n\n if (node.children.every(el => typeof el === \"string\")) {\n // node.text = node.children.join(\"\");\n // delete node.children;\n node.children = [node.children.join(\"\")];\n } else {\n node.children.forEach((child) => {\n TokenTree._collapse(child);\n });\n }\n }\n}\n\n/**\n Currently this is all private API, but this is the minimal API necessary\n that an Emitter must implement to fully support the parser.\n\n Minimal interface:\n\n - addText(text)\n - __addSublanguage(emitter, subLanguageName)\n - startScope(scope)\n - endScope()\n - finalize()\n - toHTML()\n\n*/\n\n/**\n * @implements {Emitter}\n */\nclass TokenTreeEmitter extends TokenTree {\n /**\n * @param {*} options\n */\n constructor(options) {\n super();\n this.options = options;\n }\n\n /**\n * @param {string} text\n */\n addText(text) {\n if (text === \"\") { return; }\n\n this.add(text);\n }\n\n /** @param {string} scope */\n startScope(scope) {\n this.openNode(scope);\n }\n\n endScope() {\n this.closeNode();\n }\n\n /**\n * @param {Emitter & {root: DataNode}} emitter\n * @param {string} name\n */\n __addSublanguage(emitter, name) {\n /** @type DataNode */\n const node = emitter.root;\n if (name) node.scope = `language:${name}`;\n\n this.add(node);\n }\n\n toHTML() {\n const renderer = new HTMLRenderer(this, this.options);\n return renderer.value();\n }\n\n finalize() {\n this.closeAllNodes();\n return true;\n }\n}\n\n/**\n * @param {string} value\n * @returns {RegExp}\n * */\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction source(re) {\n if (!re) return null;\n if (typeof re === \"string\") return re;\n\n return re.source;\n}\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction lookahead(re) {\n return concat('(?=', re, ')');\n}\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction anyNumberOfTimes(re) {\n return concat('(?:', re, ')*');\n}\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction optional(re) {\n return concat('(?:', re, ')?');\n}\n\n/**\n * @param {...(RegExp | string) } args\n * @returns {string}\n */\nfunction concat(...args) {\n const joined = args.map((x) => source(x)).join(\"\");\n return joined;\n}\n\n/**\n * @param { Array } args\n * @returns {object}\n */\nfunction stripOptionsFromArgs(args) {\n const opts = args[args.length - 1];\n\n if (typeof opts === 'object' && opts.constructor === Object) {\n args.splice(args.length - 1, 1);\n return opts;\n } else {\n return {};\n }\n}\n\n/** @typedef { {capture?: boolean} } RegexEitherOptions */\n\n/**\n * Any of the passed expresssions may match\n *\n * Creates a huge this | this | that | that match\n * @param {(RegExp | string)[] | [...(RegExp | string)[], RegexEitherOptions]} args\n * @returns {string}\n */\nfunction either(...args) {\n /** @type { object & {capture?: boolean} } */\n const opts = stripOptionsFromArgs(args);\n const joined = '('\n + (opts.capture ? \"\" : \"?:\")\n + args.map((x) => source(x)).join(\"|\") + \")\";\n return joined;\n}\n\n/**\n * @param {RegExp | string} re\n * @returns {number}\n */\nfunction countMatchGroups(re) {\n return (new RegExp(re.toString() + '|')).exec('').length - 1;\n}\n\n/**\n * Does lexeme start with a regular expression match at the beginning\n * @param {RegExp} re\n * @param {string} lexeme\n */\nfunction startsWith(re, lexeme) {\n const match = re && re.exec(lexeme);\n return match && match.index === 0;\n}\n\n// BACKREF_RE matches an open parenthesis or backreference. To avoid\n// an incorrect parse, it additionally matches the following:\n// - [...] elements, where the meaning of parentheses and escapes change\n// - other escape sequences, so we do not misparse escape sequences as\n// interesting elements\n// - non-matching or lookahead parentheses, which do not capture. These\n// follow the '(' with a '?'.\nconst BACKREF_RE = /\\[(?:[^\\\\\\]]|\\\\.)*\\]|\\(\\??|\\\\([1-9][0-9]*)|\\\\./;\n\n// **INTERNAL** Not intended for outside usage\n// join logically computes regexps.join(separator), but fixes the\n// backreferences so they continue to match.\n// it also places each individual regular expression into it's own\n// match group, keeping track of the sequencing of those match groups\n// is currently an exercise for the caller. :-)\n/**\n * @param {(string | RegExp)[]} regexps\n * @param {{joinWith: string}} opts\n * @returns {string}\n */\nfunction _rewriteBackreferences(regexps, { joinWith }) {\n let numCaptures = 0;\n\n return regexps.map((regex) => {\n numCaptures += 1;\n const offset = numCaptures;\n let re = source(regex);\n let out = '';\n\n while (re.length > 0) {\n const match = BACKREF_RE.exec(re);\n if (!match) {\n out += re;\n break;\n }\n out += re.substring(0, match.index);\n re = re.substring(match.index + match[0].length);\n if (match[0][0] === '\\\\' && match[1]) {\n // Adjust the backreference.\n out += '\\\\' + String(Number(match[1]) + offset);\n } else {\n out += match[0];\n if (match[0] === '(') {\n numCaptures++;\n }\n }\n }\n return out;\n }).map(re => `(${re})`).join(joinWith);\n}\n\n/** @typedef {import('highlight.js').Mode} Mode */\n/** @typedef {import('highlight.js').ModeCallback} ModeCallback */\n\n// Common regexps\nconst MATCH_NOTHING_RE = /\\b\\B/;\nconst IDENT_RE = '[a-zA-Z]\\\\w*';\nconst UNDERSCORE_IDENT_RE = '[a-zA-Z_]\\\\w*';\nconst NUMBER_RE = '\\\\b\\\\d+(\\\\.\\\\d+)?';\nconst C_NUMBER_RE = '(-?)(\\\\b0[xX][a-fA-F0-9]+|(\\\\b\\\\d+(\\\\.\\\\d*)?|\\\\.\\\\d+)([eE][-+]?\\\\d+)?)'; // 0x..., 0..., decimal, float\nconst BINARY_NUMBER_RE = '\\\\b(0b[01]+)'; // 0b...\nconst RE_STARTERS_RE = '!|!=|!==|%|%=|&|&&|&=|\\\\*|\\\\*=|\\\\+|\\\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\\\?|\\\\[|\\\\{|\\\\(|\\\\^|\\\\^=|\\\\||\\\\|=|\\\\|\\\\||~';\n\n/**\n* @param { Partial & {binary?: string | RegExp} } opts\n*/\nconst SHEBANG = (opts = {}) => {\n const beginShebang = /^#![ ]*\\//;\n if (opts.binary) {\n opts.begin = concat(\n beginShebang,\n /.*\\b/,\n opts.binary,\n /\\b.*/);\n }\n return inherit$1({\n scope: 'meta',\n begin: beginShebang,\n end: /$/,\n relevance: 0,\n /** @type {ModeCallback} */\n \"on:begin\": (m, resp) => {\n if (m.index !== 0) resp.ignoreMatch();\n }\n }, opts);\n};\n\n// Common modes\nconst BACKSLASH_ESCAPE = {\n begin: '\\\\\\\\[\\\\s\\\\S]', relevance: 0\n};\nconst APOS_STRING_MODE = {\n scope: 'string',\n begin: '\\'',\n end: '\\'',\n illegal: '\\\\n',\n contains: [BACKSLASH_ESCAPE]\n};\nconst QUOTE_STRING_MODE = {\n scope: 'string',\n begin: '\"',\n end: '\"',\n illegal: '\\\\n',\n contains: [BACKSLASH_ESCAPE]\n};\nconst PHRASAL_WORDS_MODE = {\n begin: /\\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\\b/\n};\n/**\n * Creates a comment mode\n *\n * @param {string | RegExp} begin\n * @param {string | RegExp} end\n * @param {Mode | {}} [modeOptions]\n * @returns {Partial}\n */\nconst COMMENT = function(begin, end, modeOptions = {}) {\n const mode = inherit$1(\n {\n scope: 'comment',\n begin,\n end,\n contains: []\n },\n modeOptions\n );\n mode.contains.push({\n scope: 'doctag',\n // hack to avoid the space from being included. the space is necessary to\n // match here to prevent the plain text rule below from gobbling up doctags\n begin: '[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)',\n end: /(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,\n excludeBegin: true,\n relevance: 0\n });\n const ENGLISH_WORD = either(\n // list of common 1 and 2 letter words in English\n \"I\",\n \"a\",\n \"is\",\n \"so\",\n \"us\",\n \"to\",\n \"at\",\n \"if\",\n \"in\",\n \"it\",\n \"on\",\n // note: this is not an exhaustive list of contractions, just popular ones\n /[A-Za-z]+['](d|ve|re|ll|t|s|n)/, // contractions - can't we'd they're let's, etc\n /[A-Za-z]+[-][a-z]+/, // `no-way`, etc.\n /[A-Za-z][a-z]{2,}/ // allow capitalized words at beginning of sentences\n );\n // looking like plain text, more likely to be a comment\n mode.contains.push(\n {\n // TODO: how to include \", (, ) without breaking grammars that use these for\n // comment delimiters?\n // begin: /[ ]+([()\"]?([A-Za-z'-]{3,}|is|a|I|so|us|[tT][oO]|at|if|in|it|on)[.]?[()\":]?([.][ ]|[ ]|\\))){3}/\n // ---\n\n // this tries to find sequences of 3 english words in a row (without any\n // \"programming\" type syntax) this gives us a strong signal that we've\n // TRULY found a comment - vs perhaps scanning with the wrong language.\n // It's possible to find something that LOOKS like the start of the\n // comment - but then if there is no readable text - good chance it is a\n // false match and not a comment.\n //\n // for a visual example please see:\n // https://github.com/highlightjs/highlight.js/issues/2827\n\n begin: concat(\n /[ ]+/, // necessary to prevent us gobbling up doctags like /* @author Bob Mcgill */\n '(',\n ENGLISH_WORD,\n /[.]?[:]?([.][ ]|[ ])/,\n '){3}') // look for 3 words in a row\n }\n );\n return mode;\n};\nconst C_LINE_COMMENT_MODE = COMMENT('//', '$');\nconst C_BLOCK_COMMENT_MODE = COMMENT('/\\\\*', '\\\\*/');\nconst HASH_COMMENT_MODE = COMMENT('#', '$');\nconst NUMBER_MODE = {\n scope: 'number',\n begin: NUMBER_RE,\n relevance: 0\n};\nconst C_NUMBER_MODE = {\n scope: 'number',\n begin: C_NUMBER_RE,\n relevance: 0\n};\nconst BINARY_NUMBER_MODE = {\n scope: 'number',\n begin: BINARY_NUMBER_RE,\n relevance: 0\n};\nconst REGEXP_MODE = {\n scope: \"regexp\",\n begin: /\\/(?=[^/\\n]*\\/)/,\n end: /\\/[gimuy]*/,\n contains: [\n BACKSLASH_ESCAPE,\n {\n begin: /\\[/,\n end: /\\]/,\n relevance: 0,\n contains: [BACKSLASH_ESCAPE]\n }\n ]\n};\nconst TITLE_MODE = {\n scope: 'title',\n begin: IDENT_RE,\n relevance: 0\n};\nconst UNDERSCORE_TITLE_MODE = {\n scope: 'title',\n begin: UNDERSCORE_IDENT_RE,\n relevance: 0\n};\nconst METHOD_GUARD = {\n // excludes method names from keyword processing\n begin: '\\\\.\\\\s*' + UNDERSCORE_IDENT_RE,\n relevance: 0\n};\n\n/**\n * Adds end same as begin mechanics to a mode\n *\n * Your mode must include at least a single () match group as that first match\n * group is what is used for comparison\n * @param {Partial} mode\n */\nconst END_SAME_AS_BEGIN = function(mode) {\n return Object.assign(mode,\n {\n /** @type {ModeCallback} */\n 'on:begin': (m, resp) => { resp.data._beginMatch = m[1]; },\n /** @type {ModeCallback} */\n 'on:end': (m, resp) => { if (resp.data._beginMatch !== m[1]) resp.ignoreMatch(); }\n });\n};\n\nvar MODES = /*#__PURE__*/Object.freeze({\n __proto__: null,\n APOS_STRING_MODE: APOS_STRING_MODE,\n BACKSLASH_ESCAPE: BACKSLASH_ESCAPE,\n BINARY_NUMBER_MODE: BINARY_NUMBER_MODE,\n BINARY_NUMBER_RE: BINARY_NUMBER_RE,\n COMMENT: COMMENT,\n C_BLOCK_COMMENT_MODE: C_BLOCK_COMMENT_MODE,\n C_LINE_COMMENT_MODE: C_LINE_COMMENT_MODE,\n C_NUMBER_MODE: C_NUMBER_MODE,\n C_NUMBER_RE: C_NUMBER_RE,\n END_SAME_AS_BEGIN: END_SAME_AS_BEGIN,\n HASH_COMMENT_MODE: HASH_COMMENT_MODE,\n IDENT_RE: IDENT_RE,\n MATCH_NOTHING_RE: MATCH_NOTHING_RE,\n METHOD_GUARD: METHOD_GUARD,\n NUMBER_MODE: NUMBER_MODE,\n NUMBER_RE: NUMBER_RE,\n PHRASAL_WORDS_MODE: PHRASAL_WORDS_MODE,\n QUOTE_STRING_MODE: QUOTE_STRING_MODE,\n REGEXP_MODE: REGEXP_MODE,\n RE_STARTERS_RE: RE_STARTERS_RE,\n SHEBANG: SHEBANG,\n TITLE_MODE: TITLE_MODE,\n UNDERSCORE_IDENT_RE: UNDERSCORE_IDENT_RE,\n UNDERSCORE_TITLE_MODE: UNDERSCORE_TITLE_MODE\n});\n\n/**\n@typedef {import('highlight.js').CallbackResponse} CallbackResponse\n@typedef {import('highlight.js').CompilerExt} CompilerExt\n*/\n\n// Grammar extensions / plugins\n// See: https://github.com/highlightjs/highlight.js/issues/2833\n\n// Grammar extensions allow \"syntactic sugar\" to be added to the grammar modes\n// without requiring any underlying changes to the compiler internals.\n\n// `compileMatch` being the perfect small example of now allowing a grammar\n// author to write `match` when they desire to match a single expression rather\n// than being forced to use `begin`. The extension then just moves `match` into\n// `begin` when it runs. Ie, no features have been added, but we've just made\n// the experience of writing (and reading grammars) a little bit nicer.\n\n// ------\n\n// TODO: We need negative look-behind support to do this properly\n/**\n * Skip a match if it has a preceding dot\n *\n * This is used for `beginKeywords` to prevent matching expressions such as\n * `bob.keyword.do()`. The mode compiler automatically wires this up as a\n * special _internal_ 'on:begin' callback for modes with `beginKeywords`\n * @param {RegExpMatchArray} match\n * @param {CallbackResponse} response\n */\nfunction skipIfHasPrecedingDot(match, response) {\n const before = match.input[match.index - 1];\n if (before === \".\") {\n response.ignoreMatch();\n }\n}\n\n/**\n *\n * @type {CompilerExt}\n */\nfunction scopeClassName(mode, _parent) {\n // eslint-disable-next-line no-undefined\n if (mode.className !== undefined) {\n mode.scope = mode.className;\n delete mode.className;\n }\n}\n\n/**\n * `beginKeywords` syntactic sugar\n * @type {CompilerExt}\n */\nfunction beginKeywords(mode, parent) {\n if (!parent) return;\n if (!mode.beginKeywords) return;\n\n // for languages with keywords that include non-word characters checking for\n // a word boundary is not sufficient, so instead we check for a word boundary\n // or whitespace - this does no harm in any case since our keyword engine\n // doesn't allow spaces in keywords anyways and we still check for the boundary\n // first\n mode.begin = '\\\\b(' + mode.beginKeywords.split(' ').join('|') + ')(?!\\\\.)(?=\\\\b|\\\\s)';\n mode.__beforeBegin = skipIfHasPrecedingDot;\n mode.keywords = mode.keywords || mode.beginKeywords;\n delete mode.beginKeywords;\n\n // prevents double relevance, the keywords themselves provide\n // relevance, the mode doesn't need to double it\n // eslint-disable-next-line no-undefined\n if (mode.relevance === undefined) mode.relevance = 0;\n}\n\n/**\n * Allow `illegal` to contain an array of illegal values\n * @type {CompilerExt}\n */\nfunction compileIllegal(mode, _parent) {\n if (!Array.isArray(mode.illegal)) return;\n\n mode.illegal = either(...mode.illegal);\n}\n\n/**\n * `match` to match a single expression for readability\n * @type {CompilerExt}\n */\nfunction compileMatch(mode, _parent) {\n if (!mode.match) return;\n if (mode.begin || mode.end) throw new Error(\"begin & end are not supported with match\");\n\n mode.begin = mode.match;\n delete mode.match;\n}\n\n/**\n * provides the default 1 relevance to all modes\n * @type {CompilerExt}\n */\nfunction compileRelevance(mode, _parent) {\n // eslint-disable-next-line no-undefined\n if (mode.relevance === undefined) mode.relevance = 1;\n}\n\n// allow beforeMatch to act as a \"qualifier\" for the match\n// the full match begin must be [beforeMatch][begin]\nconst beforeMatchExt = (mode, parent) => {\n if (!mode.beforeMatch) return;\n // starts conflicts with endsParent which we need to make sure the child\n // rule is not matched multiple times\n if (mode.starts) throw new Error(\"beforeMatch cannot be used with starts\");\n\n const originalMode = Object.assign({}, mode);\n Object.keys(mode).forEach((key) => { delete mode[key]; });\n\n mode.keywords = originalMode.keywords;\n mode.begin = concat(originalMode.beforeMatch, lookahead(originalMode.begin));\n mode.starts = {\n relevance: 0,\n contains: [\n Object.assign(originalMode, { endsParent: true })\n ]\n };\n mode.relevance = 0;\n\n delete originalMode.beforeMatch;\n};\n\n// keywords that should have no default relevance value\nconst COMMON_KEYWORDS = [\n 'of',\n 'and',\n 'for',\n 'in',\n 'not',\n 'or',\n 'if',\n 'then',\n 'parent', // common variable name\n 'list', // common variable name\n 'value' // common variable name\n];\n\nconst DEFAULT_KEYWORD_SCOPE = \"keyword\";\n\n/**\n * Given raw keywords from a language definition, compile them.\n *\n * @param {string | Record | Array} rawKeywords\n * @param {boolean} caseInsensitive\n */\nfunction compileKeywords(rawKeywords, caseInsensitive, scopeName = DEFAULT_KEYWORD_SCOPE) {\n /** @type {import(\"highlight.js/private\").KeywordDict} */\n const compiledKeywords = Object.create(null);\n\n // input can be a string of keywords, an array of keywords, or a object with\n // named keys representing scopeName (which can then point to a string or array)\n if (typeof rawKeywords === 'string') {\n compileList(scopeName, rawKeywords.split(\" \"));\n } else if (Array.isArray(rawKeywords)) {\n compileList(scopeName, rawKeywords);\n } else {\n Object.keys(rawKeywords).forEach(function(scopeName) {\n // collapse all our objects back into the parent object\n Object.assign(\n compiledKeywords,\n compileKeywords(rawKeywords[scopeName], caseInsensitive, scopeName)\n );\n });\n }\n return compiledKeywords;\n\n // ---\n\n /**\n * Compiles an individual list of keywords\n *\n * Ex: \"for if when while|5\"\n *\n * @param {string} scopeName\n * @param {Array} keywordList\n */\n function compileList(scopeName, keywordList) {\n if (caseInsensitive) {\n keywordList = keywordList.map(x => x.toLowerCase());\n }\n keywordList.forEach(function(keyword) {\n const pair = keyword.split('|');\n compiledKeywords[pair[0]] = [scopeName, scoreForKeyword(pair[0], pair[1])];\n });\n }\n}\n\n/**\n * Returns the proper score for a given keyword\n *\n * Also takes into account comment keywords, which will be scored 0 UNLESS\n * another score has been manually assigned.\n * @param {string} keyword\n * @param {string} [providedScore]\n */\nfunction scoreForKeyword(keyword, providedScore) {\n // manual scores always win over common keywords\n // so you can force a score of 1 if you really insist\n if (providedScore) {\n return Number(providedScore);\n }\n\n return commonKeyword(keyword) ? 0 : 1;\n}\n\n/**\n * Determines if a given keyword is common or not\n *\n * @param {string} keyword */\nfunction commonKeyword(keyword) {\n return COMMON_KEYWORDS.includes(keyword.toLowerCase());\n}\n\n/*\n\nFor the reasoning behind this please see:\nhttps://github.com/highlightjs/highlight.js/issues/2880#issuecomment-747275419\n\n*/\n\n/**\n * @type {Record}\n */\nconst seenDeprecations = {};\n\n/**\n * @param {string} message\n */\nconst error = (message) => {\n console.error(message);\n};\n\n/**\n * @param {string} message\n * @param {any} args\n */\nconst warn = (message, ...args) => {\n console.log(`WARN: ${message}`, ...args);\n};\n\n/**\n * @param {string} version\n * @param {string} message\n */\nconst deprecated = (version, message) => {\n if (seenDeprecations[`${version}/${message}`]) return;\n\n console.log(`Deprecated as of ${version}. ${message}`);\n seenDeprecations[`${version}/${message}`] = true;\n};\n\n/* eslint-disable no-throw-literal */\n\n/**\n@typedef {import('highlight.js').CompiledMode} CompiledMode\n*/\n\nconst MultiClassError = new Error();\n\n/**\n * Renumbers labeled scope names to account for additional inner match\n * groups that otherwise would break everything.\n *\n * Lets say we 3 match scopes:\n *\n * { 1 => ..., 2 => ..., 3 => ... }\n *\n * So what we need is a clean match like this:\n *\n * (a)(b)(c) => [ \"a\", \"b\", \"c\" ]\n *\n * But this falls apart with inner match groups:\n *\n * (a)(((b)))(c) => [\"a\", \"b\", \"b\", \"b\", \"c\" ]\n *\n * Our scopes are now \"out of alignment\" and we're repeating `b` 3 times.\n * What needs to happen is the numbers are remapped:\n *\n * { 1 => ..., 2 => ..., 5 => ... }\n *\n * We also need to know that the ONLY groups that should be output\n * are 1, 2, and 5. This function handles this behavior.\n *\n * @param {CompiledMode} mode\n * @param {Array} regexes\n * @param {{key: \"beginScope\"|\"endScope\"}} opts\n */\nfunction remapScopeNames(mode, regexes, { key }) {\n let offset = 0;\n const scopeNames = mode[key];\n /** @type Record */\n const emit = {};\n /** @type Record */\n const positions = {};\n\n for (let i = 1; i <= regexes.length; i++) {\n positions[i + offset] = scopeNames[i];\n emit[i + offset] = true;\n offset += countMatchGroups(regexes[i - 1]);\n }\n // we use _emit to keep track of which match groups are \"top-level\" to avoid double\n // output from inside match groups\n mode[key] = positions;\n mode[key]._emit = emit;\n mode[key]._multi = true;\n}\n\n/**\n * @param {CompiledMode} mode\n */\nfunction beginMultiClass(mode) {\n if (!Array.isArray(mode.begin)) return;\n\n if (mode.skip || mode.excludeBegin || mode.returnBegin) {\n error(\"skip, excludeBegin, returnBegin not compatible with beginScope: {}\");\n throw MultiClassError;\n }\n\n if (typeof mode.beginScope !== \"object\" || mode.beginScope === null) {\n error(\"beginScope must be object\");\n throw MultiClassError;\n }\n\n remapScopeNames(mode, mode.begin, { key: \"beginScope\" });\n mode.begin = _rewriteBackreferences(mode.begin, { joinWith: \"\" });\n}\n\n/**\n * @param {CompiledMode} mode\n */\nfunction endMultiClass(mode) {\n if (!Array.isArray(mode.end)) return;\n\n if (mode.skip || mode.excludeEnd || mode.returnEnd) {\n error(\"skip, excludeEnd, returnEnd not compatible with endScope: {}\");\n throw MultiClassError;\n }\n\n if (typeof mode.endScope !== \"object\" || mode.endScope === null) {\n error(\"endScope must be object\");\n throw MultiClassError;\n }\n\n remapScopeNames(mode, mode.end, { key: \"endScope\" });\n mode.end = _rewriteBackreferences(mode.end, { joinWith: \"\" });\n}\n\n/**\n * this exists only to allow `scope: {}` to be used beside `match:`\n * Otherwise `beginScope` would necessary and that would look weird\n\n {\n match: [ /def/, /\\w+/ ]\n scope: { 1: \"keyword\" , 2: \"title\" }\n }\n\n * @param {CompiledMode} mode\n */\nfunction scopeSugar(mode) {\n if (mode.scope && typeof mode.scope === \"object\" && mode.scope !== null) {\n mode.beginScope = mode.scope;\n delete mode.scope;\n }\n}\n\n/**\n * @param {CompiledMode} mode\n */\nfunction MultiClass(mode) {\n scopeSugar(mode);\n\n if (typeof mode.beginScope === \"string\") {\n mode.beginScope = { _wrap: mode.beginScope };\n }\n if (typeof mode.endScope === \"string\") {\n mode.endScope = { _wrap: mode.endScope };\n }\n\n beginMultiClass(mode);\n endMultiClass(mode);\n}\n\n/**\n@typedef {import('highlight.js').Mode} Mode\n@typedef {import('highlight.js').CompiledMode} CompiledMode\n@typedef {import('highlight.js').Language} Language\n@typedef {import('highlight.js').HLJSPlugin} HLJSPlugin\n@typedef {import('highlight.js').CompiledLanguage} CompiledLanguage\n*/\n\n// compilation\n\n/**\n * Compiles a language definition result\n *\n * Given the raw result of a language definition (Language), compiles this so\n * that it is ready for highlighting code.\n * @param {Language} language\n * @returns {CompiledLanguage}\n */\nfunction compileLanguage(language) {\n /**\n * Builds a regex with the case sensitivity of the current language\n *\n * @param {RegExp | string} value\n * @param {boolean} [global]\n */\n function langRe(value, global) {\n return new RegExp(\n source(value),\n 'm'\n + (language.case_insensitive ? 'i' : '')\n + (language.unicodeRegex ? 'u' : '')\n + (global ? 'g' : '')\n );\n }\n\n /**\n Stores multiple regular expressions and allows you to quickly search for\n them all in a string simultaneously - returning the first match. It does\n this by creating a huge (a|b|c) regex - each individual item wrapped with ()\n and joined by `|` - using match groups to track position. When a match is\n found checking which position in the array has content allows us to figure\n out which of the original regexes / match groups triggered the match.\n\n The match object itself (the result of `Regex.exec`) is returned but also\n enhanced by merging in any meta-data that was registered with the regex.\n This is how we keep track of which mode matched, and what type of rule\n (`illegal`, `begin`, end, etc).\n */\n class MultiRegex {\n constructor() {\n this.matchIndexes = {};\n // @ts-ignore\n this.regexes = [];\n this.matchAt = 1;\n this.position = 0;\n }\n\n // @ts-ignore\n addRule(re, opts) {\n opts.position = this.position++;\n // @ts-ignore\n this.matchIndexes[this.matchAt] = opts;\n this.regexes.push([opts, re]);\n this.matchAt += countMatchGroups(re) + 1;\n }\n\n compile() {\n if (this.regexes.length === 0) {\n // avoids the need to check length every time exec is called\n // @ts-ignore\n this.exec = () => null;\n }\n const terminators = this.regexes.map(el => el[1]);\n this.matcherRe = langRe(_rewriteBackreferences(terminators, { joinWith: '|' }), true);\n this.lastIndex = 0;\n }\n\n /** @param {string} s */\n exec(s) {\n this.matcherRe.lastIndex = this.lastIndex;\n const match = this.matcherRe.exec(s);\n if (!match) { return null; }\n\n // eslint-disable-next-line no-undefined\n const i = match.findIndex((el, i) => i > 0 && el !== undefined);\n // @ts-ignore\n const matchData = this.matchIndexes[i];\n // trim off any earlier non-relevant match groups (ie, the other regex\n // match groups that make up the multi-matcher)\n match.splice(0, i);\n\n return Object.assign(match, matchData);\n }\n }\n\n /*\n Created to solve the key deficiently with MultiRegex - there is no way to\n test for multiple matches at a single location. Why would we need to do\n that? In the future a more dynamic engine will allow certain matches to be\n ignored. An example: if we matched say the 3rd regex in a large group but\n decided to ignore it - we'd need to started testing again at the 4th\n regex... but MultiRegex itself gives us no real way to do that.\n\n So what this class creates MultiRegexs on the fly for whatever search\n position they are needed.\n\n NOTE: These additional MultiRegex objects are created dynamically. For most\n grammars most of the time we will never actually need anything more than the\n first MultiRegex - so this shouldn't have too much overhead.\n\n Say this is our search group, and we match regex3, but wish to ignore it.\n\n regex1 | regex2 | regex3 | regex4 | regex5 ' ie, startAt = 0\n\n What we need is a new MultiRegex that only includes the remaining\n possibilities:\n\n regex4 | regex5 ' ie, startAt = 3\n\n This class wraps all that complexity up in a simple API... `startAt` decides\n where in the array of expressions to start doing the matching. It\n auto-increments, so if a match is found at position 2, then startAt will be\n set to 3. If the end is reached startAt will return to 0.\n\n MOST of the time the parser will be setting startAt manually to 0.\n */\n class ResumableMultiRegex {\n constructor() {\n // @ts-ignore\n this.rules = [];\n // @ts-ignore\n this.multiRegexes = [];\n this.count = 0;\n\n this.lastIndex = 0;\n this.regexIndex = 0;\n }\n\n // @ts-ignore\n getMatcher(index) {\n if (this.multiRegexes[index]) return this.multiRegexes[index];\n\n const matcher = new MultiRegex();\n this.rules.slice(index).forEach(([re, opts]) => matcher.addRule(re, opts));\n matcher.compile();\n this.multiRegexes[index] = matcher;\n return matcher;\n }\n\n resumingScanAtSamePosition() {\n return this.regexIndex !== 0;\n }\n\n considerAll() {\n this.regexIndex = 0;\n }\n\n // @ts-ignore\n addRule(re, opts) {\n this.rules.push([re, opts]);\n if (opts.type === \"begin\") this.count++;\n }\n\n /** @param {string} s */\n exec(s) {\n const m = this.getMatcher(this.regexIndex);\n m.lastIndex = this.lastIndex;\n let result = m.exec(s);\n\n // The following is because we have no easy way to say \"resume scanning at the\n // existing position but also skip the current rule ONLY\". What happens is\n // all prior rules are also skipped which can result in matching the wrong\n // thing. Example of matching \"booger\":\n\n // our matcher is [string, \"booger\", number]\n //\n // ....booger....\n\n // if \"booger\" is ignored then we'd really need a regex to scan from the\n // SAME position for only: [string, number] but ignoring \"booger\" (if it\n // was the first match), a simple resume would scan ahead who knows how\n // far looking only for \"number\", ignoring potential string matches (or\n // future \"booger\" matches that might be valid.)\n\n // So what we do: We execute two matchers, one resuming at the same\n // position, but the second full matcher starting at the position after:\n\n // /--- resume first regex match here (for [number])\n // |/---- full match here for [string, \"booger\", number]\n // vv\n // ....booger....\n\n // Which ever results in a match first is then used. So this 3-4 step\n // process essentially allows us to say \"match at this position, excluding\n // a prior rule that was ignored\".\n //\n // 1. Match \"booger\" first, ignore. Also proves that [string] does non match.\n // 2. Resume matching for [number]\n // 3. Match at index + 1 for [string, \"booger\", number]\n // 4. If #2 and #3 result in matches, which came first?\n if (this.resumingScanAtSamePosition()) {\n if (result && result.index === this.lastIndex) ; else { // use the second matcher result\n const m2 = this.getMatcher(0);\n m2.lastIndex = this.lastIndex + 1;\n result = m2.exec(s);\n }\n }\n\n if (result) {\n this.regexIndex += result.position + 1;\n if (this.regexIndex === this.count) {\n // wrap-around to considering all matches again\n this.considerAll();\n }\n }\n\n return result;\n }\n }\n\n /**\n * Given a mode, builds a huge ResumableMultiRegex that can be used to walk\n * the content and find matches.\n *\n * @param {CompiledMode} mode\n * @returns {ResumableMultiRegex}\n */\n function buildModeRegex(mode) {\n const mm = new ResumableMultiRegex();\n\n mode.contains.forEach(term => mm.addRule(term.begin, { rule: term, type: \"begin\" }));\n\n if (mode.terminatorEnd) {\n mm.addRule(mode.terminatorEnd, { type: \"end\" });\n }\n if (mode.illegal) {\n mm.addRule(mode.illegal, { type: \"illegal\" });\n }\n\n return mm;\n }\n\n /** skip vs abort vs ignore\n *\n * @skip - The mode is still entered and exited normally (and contains rules apply),\n * but all content is held and added to the parent buffer rather than being\n * output when the mode ends. Mostly used with `sublanguage` to build up\n * a single large buffer than can be parsed by sublanguage.\n *\n * - The mode begin ands ends normally.\n * - Content matched is added to the parent mode buffer.\n * - The parser cursor is moved forward normally.\n *\n * @abort - A hack placeholder until we have ignore. Aborts the mode (as if it\n * never matched) but DOES NOT continue to match subsequent `contains`\n * modes. Abort is bad/suboptimal because it can result in modes\n * farther down not getting applied because an earlier rule eats the\n * content but then aborts.\n *\n * - The mode does not begin.\n * - Content matched by `begin` is added to the mode buffer.\n * - The parser cursor is moved forward accordingly.\n *\n * @ignore - Ignores the mode (as if it never matched) and continues to match any\n * subsequent `contains` modes. Ignore isn't technically possible with\n * the current parser implementation.\n *\n * - The mode does not begin.\n * - Content matched by `begin` is ignored.\n * - The parser cursor is not moved forward.\n */\n\n /**\n * Compiles an individual mode\n *\n * This can raise an error if the mode contains certain detectable known logic\n * issues.\n * @param {Mode} mode\n * @param {CompiledMode | null} [parent]\n * @returns {CompiledMode | never}\n */\n function compileMode(mode, parent) {\n const cmode = /** @type CompiledMode */ (mode);\n if (mode.isCompiled) return cmode;\n\n [\n scopeClassName,\n // do this early so compiler extensions generally don't have to worry about\n // the distinction between match/begin\n compileMatch,\n MultiClass,\n beforeMatchExt\n ].forEach(ext => ext(mode, parent));\n\n language.compilerExtensions.forEach(ext => ext(mode, parent));\n\n // __beforeBegin is considered private API, internal use only\n mode.__beforeBegin = null;\n\n [\n beginKeywords,\n // do this later so compiler extensions that come earlier have access to the\n // raw array if they wanted to perhaps manipulate it, etc.\n compileIllegal,\n // default to 1 relevance if not specified\n compileRelevance\n ].forEach(ext => ext(mode, parent));\n\n mode.isCompiled = true;\n\n let keywordPattern = null;\n if (typeof mode.keywords === \"object\" && mode.keywords.$pattern) {\n // we need a copy because keywords might be compiled multiple times\n // so we can't go deleting $pattern from the original on the first\n // pass\n mode.keywords = Object.assign({}, mode.keywords);\n keywordPattern = mode.keywords.$pattern;\n delete mode.keywords.$pattern;\n }\n keywordPattern = keywordPattern || /\\w+/;\n\n if (mode.keywords) {\n mode.keywords = compileKeywords(mode.keywords, language.case_insensitive);\n }\n\n cmode.keywordPatternRe = langRe(keywordPattern, true);\n\n if (parent) {\n if (!mode.begin) mode.begin = /\\B|\\b/;\n cmode.beginRe = langRe(cmode.begin);\n if (!mode.end && !mode.endsWithParent) mode.end = /\\B|\\b/;\n if (mode.end) cmode.endRe = langRe(cmode.end);\n cmode.terminatorEnd = source(cmode.end) || '';\n if (mode.endsWithParent && parent.terminatorEnd) {\n cmode.terminatorEnd += (mode.end ? '|' : '') + parent.terminatorEnd;\n }\n }\n if (mode.illegal) cmode.illegalRe = langRe(/** @type {RegExp | string} */ (mode.illegal));\n if (!mode.contains) mode.contains = [];\n\n mode.contains = [].concat(...mode.contains.map(function(c) {\n return expandOrCloneMode(c === 'self' ? mode : c);\n }));\n mode.contains.forEach(function(c) { compileMode(/** @type Mode */ (c), cmode); });\n\n if (mode.starts) {\n compileMode(mode.starts, parent);\n }\n\n cmode.matcher = buildModeRegex(cmode);\n return cmode;\n }\n\n if (!language.compilerExtensions) language.compilerExtensions = [];\n\n // self is not valid at the top-level\n if (language.contains && language.contains.includes('self')) {\n throw new Error(\"ERR: contains `self` is not supported at the top-level of a language. See documentation.\");\n }\n\n // we need a null object, which inherit will guarantee\n language.classNameAliases = inherit$1(language.classNameAliases || {});\n\n return compileMode(/** @type Mode */ (language));\n}\n\n/**\n * Determines if a mode has a dependency on it's parent or not\n *\n * If a mode does have a parent dependency then often we need to clone it if\n * it's used in multiple places so that each copy points to the correct parent,\n * where-as modes without a parent can often safely be re-used at the bottom of\n * a mode chain.\n *\n * @param {Mode | null} mode\n * @returns {boolean} - is there a dependency on the parent?\n * */\nfunction dependencyOnParent(mode) {\n if (!mode) return false;\n\n return mode.endsWithParent || dependencyOnParent(mode.starts);\n}\n\n/**\n * Expands a mode or clones it if necessary\n *\n * This is necessary for modes with parental dependenceis (see notes on\n * `dependencyOnParent`) and for nodes that have `variants` - which must then be\n * exploded into their own individual modes at compile time.\n *\n * @param {Mode} mode\n * @returns {Mode | Mode[]}\n * */\nfunction expandOrCloneMode(mode) {\n if (mode.variants && !mode.cachedVariants) {\n mode.cachedVariants = mode.variants.map(function(variant) {\n return inherit$1(mode, { variants: null }, variant);\n });\n }\n\n // EXPAND\n // if we have variants then essentially \"replace\" the mode with the variants\n // this happens in compileMode, where this function is called from\n if (mode.cachedVariants) {\n return mode.cachedVariants;\n }\n\n // CLONE\n // if we have dependencies on parents then we need a unique\n // instance of ourselves, so we can be reused with many\n // different parents without issue\n if (dependencyOnParent(mode)) {\n return inherit$1(mode, { starts: mode.starts ? inherit$1(mode.starts) : null });\n }\n\n if (Object.isFrozen(mode)) {\n return inherit$1(mode);\n }\n\n // no special dependency issues, just return ourselves\n return mode;\n}\n\nvar version = \"11.11.1\";\n\nclass HTMLInjectionError extends Error {\n constructor(reason, html) {\n super(reason);\n this.name = \"HTMLInjectionError\";\n this.html = html;\n }\n}\n\n/*\nSyntax highlighting with language autodetection.\nhttps://highlightjs.org/\n*/\n\n\n\n/**\n@typedef {import('highlight.js').Mode} Mode\n@typedef {import('highlight.js').CompiledMode} CompiledMode\n@typedef {import('highlight.js').CompiledScope} CompiledScope\n@typedef {import('highlight.js').Language} Language\n@typedef {import('highlight.js').HLJSApi} HLJSApi\n@typedef {import('highlight.js').HLJSPlugin} HLJSPlugin\n@typedef {import('highlight.js').PluginEvent} PluginEvent\n@typedef {import('highlight.js').HLJSOptions} HLJSOptions\n@typedef {import('highlight.js').LanguageFn} LanguageFn\n@typedef {import('highlight.js').HighlightedHTMLElement} HighlightedHTMLElement\n@typedef {import('highlight.js').BeforeHighlightContext} BeforeHighlightContext\n@typedef {import('highlight.js/private').MatchType} MatchType\n@typedef {import('highlight.js/private').KeywordData} KeywordData\n@typedef {import('highlight.js/private').EnhancedMatch} EnhancedMatch\n@typedef {import('highlight.js/private').AnnotatedError} AnnotatedError\n@typedef {import('highlight.js').AutoHighlightResult} AutoHighlightResult\n@typedef {import('highlight.js').HighlightOptions} HighlightOptions\n@typedef {import('highlight.js').HighlightResult} HighlightResult\n*/\n\n\nconst escape = escapeHTML;\nconst inherit = inherit$1;\nconst NO_MATCH = Symbol(\"nomatch\");\nconst MAX_KEYWORD_HITS = 7;\n\n/**\n * @param {any} hljs - object that is extended (legacy)\n * @returns {HLJSApi}\n */\nconst HLJS = function(hljs) {\n // Global internal variables used within the highlight.js library.\n /** @type {Record} */\n const languages = Object.create(null);\n /** @type {Record} */\n const aliases = Object.create(null);\n /** @type {HLJSPlugin[]} */\n const plugins = [];\n\n // safe/production mode - swallows more errors, tries to keep running\n // even if a single syntax or parse hits a fatal error\n let SAFE_MODE = true;\n const LANGUAGE_NOT_FOUND = \"Could not find the language '{}', did you forget to load/include a language module?\";\n /** @type {Language} */\n const PLAINTEXT_LANGUAGE = { disableAutodetect: true, name: 'Plain text', contains: [] };\n\n // Global options used when within external APIs. This is modified when\n // calling the `hljs.configure` function.\n /** @type HLJSOptions */\n let options = {\n ignoreUnescapedHTML: false,\n throwUnescapedHTML: false,\n noHighlightRe: /^(no-?highlight)$/i,\n languageDetectRe: /\\blang(?:uage)?-([\\w-]+)\\b/i,\n classPrefix: 'hljs-',\n cssSelector: 'pre code',\n languages: null,\n // beta configuration options, subject to change, welcome to discuss\n // https://github.com/highlightjs/highlight.js/issues/1086\n __emitter: TokenTreeEmitter\n };\n\n /* Utility functions */\n\n /**\n * Tests a language name to see if highlighting should be skipped\n * @param {string} languageName\n */\n function shouldNotHighlight(languageName) {\n return options.noHighlightRe.test(languageName);\n }\n\n /**\n * @param {HighlightedHTMLElement} block - the HTML element to determine language for\n */\n function blockLanguage(block) {\n let classes = block.className + ' ';\n\n classes += block.parentNode ? block.parentNode.className : '';\n\n // language-* takes precedence over non-prefixed class names.\n const match = options.languageDetectRe.exec(classes);\n if (match) {\n const language = getLanguage(match[1]);\n if (!language) {\n warn(LANGUAGE_NOT_FOUND.replace(\"{}\", match[1]));\n warn(\"Falling back to no-highlight mode for this block.\", block);\n }\n return language ? match[1] : 'no-highlight';\n }\n\n return classes\n .split(/\\s+/)\n .find((_class) => shouldNotHighlight(_class) || getLanguage(_class));\n }\n\n /**\n * Core highlighting function.\n *\n * OLD API\n * highlight(lang, code, ignoreIllegals, continuation)\n *\n * NEW API\n * highlight(code, {lang, ignoreIllegals})\n *\n * @param {string} codeOrLanguageName - the language to use for highlighting\n * @param {string | HighlightOptions} optionsOrCode - the code to highlight\n * @param {boolean} [ignoreIllegals] - whether to ignore illegal matches, default is to bail\n *\n * @returns {HighlightResult} Result - an object that represents the result\n * @property {string} language - the language name\n * @property {number} relevance - the relevance score\n * @property {string} value - the highlighted HTML code\n * @property {string} code - the original raw code\n * @property {CompiledMode} top - top of the current mode stack\n * @property {boolean} illegal - indicates whether any illegal matches were found\n */\n function highlight(codeOrLanguageName, optionsOrCode, ignoreIllegals) {\n let code = \"\";\n let languageName = \"\";\n if (typeof optionsOrCode === \"object\") {\n code = codeOrLanguageName;\n ignoreIllegals = optionsOrCode.ignoreIllegals;\n languageName = optionsOrCode.language;\n } else {\n // old API\n deprecated(\"10.7.0\", \"highlight(lang, code, ...args) has been deprecated.\");\n deprecated(\"10.7.0\", \"Please use highlight(code, options) instead.\\nhttps://github.com/highlightjs/highlight.js/issues/2277\");\n languageName = codeOrLanguageName;\n code = optionsOrCode;\n }\n\n // https://github.com/highlightjs/highlight.js/issues/3149\n // eslint-disable-next-line no-undefined\n if (ignoreIllegals === undefined) { ignoreIllegals = true; }\n\n /** @type {BeforeHighlightContext} */\n const context = {\n code,\n language: languageName\n };\n // the plugin can change the desired language or the code to be highlighted\n // just be changing the object it was passed\n fire(\"before:highlight\", context);\n\n // a before plugin can usurp the result completely by providing it's own\n // in which case we don't even need to call highlight\n const result = context.result\n ? context.result\n : _highlight(context.language, context.code, ignoreIllegals);\n\n result.code = context.code;\n // the plugin can change anything in result to suite it\n fire(\"after:highlight\", result);\n\n return result;\n }\n\n /**\n * private highlight that's used internally and does not fire callbacks\n *\n * @param {string} languageName - the language to use for highlighting\n * @param {string} codeToHighlight - the code to highlight\n * @param {boolean?} [ignoreIllegals] - whether to ignore illegal matches, default is to bail\n * @param {CompiledMode?} [continuation] - current continuation mode, if any\n * @returns {HighlightResult} - result of the highlight operation\n */\n function _highlight(languageName, codeToHighlight, ignoreIllegals, continuation) {\n const keywordHits = Object.create(null);\n\n /**\n * Return keyword data if a match is a keyword\n * @param {CompiledMode} mode - current mode\n * @param {string} matchText - the textual match\n * @returns {KeywordData | false}\n */\n function keywordData(mode, matchText) {\n return mode.keywords[matchText];\n }\n\n function processKeywords() {\n if (!top.keywords) {\n emitter.addText(modeBuffer);\n return;\n }\n\n let lastIndex = 0;\n top.keywordPatternRe.lastIndex = 0;\n let match = top.keywordPatternRe.exec(modeBuffer);\n let buf = \"\";\n\n while (match) {\n buf += modeBuffer.substring(lastIndex, match.index);\n const word = language.case_insensitive ? match[0].toLowerCase() : match[0];\n const data = keywordData(top, word);\n if (data) {\n const [kind, keywordRelevance] = data;\n emitter.addText(buf);\n buf = \"\";\n\n keywordHits[word] = (keywordHits[word] || 0) + 1;\n if (keywordHits[word] <= MAX_KEYWORD_HITS) relevance += keywordRelevance;\n if (kind.startsWith(\"_\")) {\n // _ implied for relevance only, do not highlight\n // by applying a class name\n buf += match[0];\n } else {\n const cssClass = language.classNameAliases[kind] || kind;\n emitKeyword(match[0], cssClass);\n }\n } else {\n buf += match[0];\n }\n lastIndex = top.keywordPatternRe.lastIndex;\n match = top.keywordPatternRe.exec(modeBuffer);\n }\n buf += modeBuffer.substring(lastIndex);\n emitter.addText(buf);\n }\n\n function processSubLanguage() {\n if (modeBuffer === \"\") return;\n /** @type HighlightResult */\n let result = null;\n\n if (typeof top.subLanguage === 'string') {\n if (!languages[top.subLanguage]) {\n emitter.addText(modeBuffer);\n return;\n }\n result = _highlight(top.subLanguage, modeBuffer, true, continuations[top.subLanguage]);\n continuations[top.subLanguage] = /** @type {CompiledMode} */ (result._top);\n } else {\n result = highlightAuto(modeBuffer, top.subLanguage.length ? top.subLanguage : null);\n }\n\n // Counting embedded language score towards the host language may be disabled\n // with zeroing the containing mode relevance. Use case in point is Markdown that\n // allows XML everywhere and makes every XML snippet to have a much larger Markdown\n // score.\n if (top.relevance > 0) {\n relevance += result.relevance;\n }\n emitter.__addSublanguage(result._emitter, result.language);\n }\n\n function processBuffer() {\n if (top.subLanguage != null) {\n processSubLanguage();\n } else {\n processKeywords();\n }\n modeBuffer = '';\n }\n\n /**\n * @param {string} text\n * @param {string} scope\n */\n function emitKeyword(keyword, scope) {\n if (keyword === \"\") return;\n\n emitter.startScope(scope);\n emitter.addText(keyword);\n emitter.endScope();\n }\n\n /**\n * @param {CompiledScope} scope\n * @param {RegExpMatchArray} match\n */\n function emitMultiClass(scope, match) {\n let i = 1;\n const max = match.length - 1;\n while (i <= max) {\n if (!scope._emit[i]) { i++; continue; }\n const klass = language.classNameAliases[scope[i]] || scope[i];\n const text = match[i];\n if (klass) {\n emitKeyword(text, klass);\n } else {\n modeBuffer = text;\n processKeywords();\n modeBuffer = \"\";\n }\n i++;\n }\n }\n\n /**\n * @param {CompiledMode} mode - new mode to start\n * @param {RegExpMatchArray} match\n */\n function startNewMode(mode, match) {\n if (mode.scope && typeof mode.scope === \"string\") {\n emitter.openNode(language.classNameAliases[mode.scope] || mode.scope);\n }\n if (mode.beginScope) {\n // beginScope just wraps the begin match itself in a scope\n if (mode.beginScope._wrap) {\n emitKeyword(modeBuffer, language.classNameAliases[mode.beginScope._wrap] || mode.beginScope._wrap);\n modeBuffer = \"\";\n } else if (mode.beginScope._multi) {\n // at this point modeBuffer should just be the match\n emitMultiClass(mode.beginScope, match);\n modeBuffer = \"\";\n }\n }\n\n top = Object.create(mode, { parent: { value: top } });\n return top;\n }\n\n /**\n * @param {CompiledMode } mode - the mode to potentially end\n * @param {RegExpMatchArray} match - the latest match\n * @param {string} matchPlusRemainder - match plus remainder of content\n * @returns {CompiledMode | void} - the next mode, or if void continue on in current mode\n */\n function endOfMode(mode, match, matchPlusRemainder) {\n let matched = startsWith(mode.endRe, matchPlusRemainder);\n\n if (matched) {\n if (mode[\"on:end\"]) {\n const resp = new Response(mode);\n mode[\"on:end\"](match, resp);\n if (resp.isMatchIgnored) matched = false;\n }\n\n if (matched) {\n while (mode.endsParent && mode.parent) {\n mode = mode.parent;\n }\n return mode;\n }\n }\n // even if on:end fires an `ignore` it's still possible\n // that we might trigger the end node because of a parent mode\n if (mode.endsWithParent) {\n return endOfMode(mode.parent, match, matchPlusRemainder);\n }\n }\n\n /**\n * Handle matching but then ignoring a sequence of text\n *\n * @param {string} lexeme - string containing full match text\n */\n function doIgnore(lexeme) {\n if (top.matcher.regexIndex === 0) {\n // no more regexes to potentially match here, so we move the cursor forward one\n // space\n modeBuffer += lexeme[0];\n return 1;\n } else {\n // no need to move the cursor, we still have additional regexes to try and\n // match at this very spot\n resumeScanAtSamePosition = true;\n return 0;\n }\n }\n\n /**\n * Handle the start of a new potential mode match\n *\n * @param {EnhancedMatch} match - the current match\n * @returns {number} how far to advance the parse cursor\n */\n function doBeginMatch(match) {\n const lexeme = match[0];\n const newMode = match.rule;\n\n const resp = new Response(newMode);\n // first internal before callbacks, then the public ones\n const beforeCallbacks = [newMode.__beforeBegin, newMode[\"on:begin\"]];\n for (const cb of beforeCallbacks) {\n if (!cb) continue;\n cb(match, resp);\n if (resp.isMatchIgnored) return doIgnore(lexeme);\n }\n\n if (newMode.skip) {\n modeBuffer += lexeme;\n } else {\n if (newMode.excludeBegin) {\n modeBuffer += lexeme;\n }\n processBuffer();\n if (!newMode.returnBegin && !newMode.excludeBegin) {\n modeBuffer = lexeme;\n }\n }\n startNewMode(newMode, match);\n return newMode.returnBegin ? 0 : lexeme.length;\n }\n\n /**\n * Handle the potential end of mode\n *\n * @param {RegExpMatchArray} match - the current match\n */\n function doEndMatch(match) {\n const lexeme = match[0];\n const matchPlusRemainder = codeToHighlight.substring(match.index);\n\n const endMode = endOfMode(top, match, matchPlusRemainder);\n if (!endMode) { return NO_MATCH; }\n\n const origin = top;\n if (top.endScope && top.endScope._wrap) {\n processBuffer();\n emitKeyword(lexeme, top.endScope._wrap);\n } else if (top.endScope && top.endScope._multi) {\n processBuffer();\n emitMultiClass(top.endScope, match);\n } else if (origin.skip) {\n modeBuffer += lexeme;\n } else {\n if (!(origin.returnEnd || origin.excludeEnd)) {\n modeBuffer += lexeme;\n }\n processBuffer();\n if (origin.excludeEnd) {\n modeBuffer = lexeme;\n }\n }\n do {\n if (top.scope) {\n emitter.closeNode();\n }\n if (!top.skip && !top.subLanguage) {\n relevance += top.relevance;\n }\n top = top.parent;\n } while (top !== endMode.parent);\n if (endMode.starts) {\n startNewMode(endMode.starts, match);\n }\n return origin.returnEnd ? 0 : lexeme.length;\n }\n\n function processContinuations() {\n const list = [];\n for (let current = top; current !== language; current = current.parent) {\n if (current.scope) {\n list.unshift(current.scope);\n }\n }\n list.forEach(item => emitter.openNode(item));\n }\n\n /** @type {{type?: MatchType, index?: number, rule?: Mode}}} */\n let lastMatch = {};\n\n /**\n * Process an individual match\n *\n * @param {string} textBeforeMatch - text preceding the match (since the last match)\n * @param {EnhancedMatch} [match] - the match itself\n */\n function processLexeme(textBeforeMatch, match) {\n const lexeme = match && match[0];\n\n // add non-matched text to the current mode buffer\n modeBuffer += textBeforeMatch;\n\n if (lexeme == null) {\n processBuffer();\n return 0;\n }\n\n // we've found a 0 width match and we're stuck, so we need to advance\n // this happens when we have badly behaved rules that have optional matchers to the degree that\n // sometimes they can end up matching nothing at all\n // Ref: https://github.com/highlightjs/highlight.js/issues/2140\n if (lastMatch.type === \"begin\" && match.type === \"end\" && lastMatch.index === match.index && lexeme === \"\") {\n // spit the \"skipped\" character that our regex choked on back into the output sequence\n modeBuffer += codeToHighlight.slice(match.index, match.index + 1);\n if (!SAFE_MODE) {\n /** @type {AnnotatedError} */\n const err = new Error(`0 width match regex (${languageName})`);\n err.languageName = languageName;\n err.badRule = lastMatch.rule;\n throw err;\n }\n return 1;\n }\n lastMatch = match;\n\n if (match.type === \"begin\") {\n return doBeginMatch(match);\n } else if (match.type === \"illegal\" && !ignoreIllegals) {\n // illegal match, we do not continue processing\n /** @type {AnnotatedError} */\n const err = new Error('Illegal lexeme \"' + lexeme + '\" for mode \"' + (top.scope || '') + '\"');\n err.mode = top;\n throw err;\n } else if (match.type === \"end\") {\n const processed = doEndMatch(match);\n if (processed !== NO_MATCH) {\n return processed;\n }\n }\n\n // edge case for when illegal matches $ (end of line) which is technically\n // a 0 width match but not a begin/end match so it's not caught by the\n // first handler (when ignoreIllegals is true)\n if (match.type === \"illegal\" && lexeme === \"\") {\n // advance so we aren't stuck in an infinite loop\n modeBuffer += \"\\n\";\n return 1;\n }\n\n // infinite loops are BAD, this is a last ditch catch all. if we have a\n // decent number of iterations yet our index (cursor position in our\n // parsing) still 3x behind our index then something is very wrong\n // so we bail\n if (iterations > 100000 && iterations > match.index * 3) {\n const err = new Error('potential infinite loop, way more iterations than matches');\n throw err;\n }\n\n /*\n Why might be find ourselves here? An potential end match that was\n triggered but could not be completed. IE, `doEndMatch` returned NO_MATCH.\n (this could be because a callback requests the match be ignored, etc)\n\n This causes no real harm other than stopping a few times too many.\n */\n\n modeBuffer += lexeme;\n return lexeme.length;\n }\n\n const language = getLanguage(languageName);\n if (!language) {\n error(LANGUAGE_NOT_FOUND.replace(\"{}\", languageName));\n throw new Error('Unknown language: \"' + languageName + '\"');\n }\n\n const md = compileLanguage(language);\n let result = '';\n /** @type {CompiledMode} */\n let top = continuation || md;\n /** @type Record */\n const continuations = {}; // keep continuations for sub-languages\n const emitter = new options.__emitter(options);\n processContinuations();\n let modeBuffer = '';\n let relevance = 0;\n let index = 0;\n let iterations = 0;\n let resumeScanAtSamePosition = false;\n\n try {\n if (!language.__emitTokens) {\n top.matcher.considerAll();\n\n for (;;) {\n iterations++;\n if (resumeScanAtSamePosition) {\n // only regexes not matched previously will now be\n // considered for a potential match\n resumeScanAtSamePosition = false;\n } else {\n top.matcher.considerAll();\n }\n top.matcher.lastIndex = index;\n\n const match = top.matcher.exec(codeToHighlight);\n // console.log(\"match\", match[0], match.rule && match.rule.begin)\n\n if (!match) break;\n\n const beforeMatch = codeToHighlight.substring(index, match.index);\n const processedCount = processLexeme(beforeMatch, match);\n index = match.index + processedCount;\n }\n processLexeme(codeToHighlight.substring(index));\n } else {\n language.__emitTokens(codeToHighlight, emitter);\n }\n\n emitter.finalize();\n result = emitter.toHTML();\n\n return {\n language: languageName,\n value: result,\n relevance,\n illegal: false,\n _emitter: emitter,\n _top: top\n };\n } catch (err) {\n if (err.message && err.message.includes('Illegal')) {\n return {\n language: languageName,\n value: escape(codeToHighlight),\n illegal: true,\n relevance: 0,\n _illegalBy: {\n message: err.message,\n index,\n context: codeToHighlight.slice(index - 100, index + 100),\n mode: err.mode,\n resultSoFar: result\n },\n _emitter: emitter\n };\n } else if (SAFE_MODE) {\n return {\n language: languageName,\n value: escape(codeToHighlight),\n illegal: false,\n relevance: 0,\n errorRaised: err,\n _emitter: emitter,\n _top: top\n };\n } else {\n throw err;\n }\n }\n }\n\n /**\n * returns a valid highlight result, without actually doing any actual work,\n * auto highlight starts with this and it's possible for small snippets that\n * auto-detection may not find a better match\n * @param {string} code\n * @returns {HighlightResult}\n */\n function justTextHighlightResult(code) {\n const result = {\n value: escape(code),\n illegal: false,\n relevance: 0,\n _top: PLAINTEXT_LANGUAGE,\n _emitter: new options.__emitter(options)\n };\n result._emitter.addText(code);\n return result;\n }\n\n /**\n Highlighting with language detection. Accepts a string with the code to\n highlight. Returns an object with the following properties:\n\n - language (detected language)\n - relevance (int)\n - value (an HTML string with highlighting markup)\n - secondBest (object with the same structure for second-best heuristically\n detected language, may be absent)\n\n @param {string} code\n @param {Array} [languageSubset]\n @returns {AutoHighlightResult}\n */\n function highlightAuto(code, languageSubset) {\n languageSubset = languageSubset || options.languages || Object.keys(languages);\n const plaintext = justTextHighlightResult(code);\n\n const results = languageSubset.filter(getLanguage).filter(autoDetection).map(name =>\n _highlight(name, code, false)\n );\n results.unshift(plaintext); // plaintext is always an option\n\n const sorted = results.sort((a, b) => {\n // sort base on relevance\n if (a.relevance !== b.relevance) return b.relevance - a.relevance;\n\n // always award the tie to the base language\n // ie if C++ and Arduino are tied, it's more likely to be C++\n if (a.language && b.language) {\n if (getLanguage(a.language).supersetOf === b.language) {\n return 1;\n } else if (getLanguage(b.language).supersetOf === a.language) {\n return -1;\n }\n }\n\n // otherwise say they are equal, which has the effect of sorting on\n // relevance while preserving the original ordering - which is how ties\n // have historically been settled, ie the language that comes first always\n // wins in the case of a tie\n return 0;\n });\n\n const [best, secondBest] = sorted;\n\n /** @type {AutoHighlightResult} */\n const result = best;\n result.secondBest = secondBest;\n\n return result;\n }\n\n /**\n * Builds new class name for block given the language name\n *\n * @param {HTMLElement} element\n * @param {string} [currentLang]\n * @param {string} [resultLang]\n */\n function updateClassName(element, currentLang, resultLang) {\n const language = (currentLang && aliases[currentLang]) || resultLang;\n\n element.classList.add(\"hljs\");\n element.classList.add(`language-${language}`);\n }\n\n /**\n * Applies highlighting to a DOM node containing code.\n *\n * @param {HighlightedHTMLElement} element - the HTML element to highlight\n */\n function highlightElement(element) {\n /** @type HTMLElement */\n let node = null;\n const language = blockLanguage(element);\n\n if (shouldNotHighlight(language)) return;\n\n fire(\"before:highlightElement\",\n { el: element, language });\n\n if (element.dataset.highlighted) {\n console.log(\"Element previously highlighted. To highlight again, first unset `dataset.highlighted`.\", element);\n return;\n }\n\n // we should be all text, no child nodes (unescaped HTML) - this is possibly\n // an HTML injection attack - it's likely too late if this is already in\n // production (the code has likely already done its damage by the time\n // we're seeing it)... but we yell loudly about this so that hopefully it's\n // more likely to be caught in development before making it to production\n if (element.children.length > 0) {\n if (!options.ignoreUnescapedHTML) {\n console.warn(\"One of your code blocks includes unescaped HTML. This is a potentially serious security risk.\");\n console.warn(\"https://github.com/highlightjs/highlight.js/wiki/security\");\n console.warn(\"The element with unescaped HTML:\");\n console.warn(element);\n }\n if (options.throwUnescapedHTML) {\n const err = new HTMLInjectionError(\n \"One of your code blocks includes unescaped HTML.\",\n element.innerHTML\n );\n throw err;\n }\n }\n\n node = element;\n const text = node.textContent;\n const result = language ? highlight(text, { language, ignoreIllegals: true }) : highlightAuto(text);\n\n element.innerHTML = result.value;\n element.dataset.highlighted = \"yes\";\n updateClassName(element, language, result.language);\n element.result = {\n language: result.language,\n // TODO: remove with version 11.0\n re: result.relevance,\n relevance: result.relevance\n };\n if (result.secondBest) {\n element.secondBest = {\n language: result.secondBest.language,\n relevance: result.secondBest.relevance\n };\n }\n\n fire(\"after:highlightElement\", { el: element, result, text });\n }\n\n /**\n * Updates highlight.js global options with the passed options\n *\n * @param {Partial} userOptions\n */\n function configure(userOptions) {\n options = inherit(options, userOptions);\n }\n\n // TODO: remove v12, deprecated\n const initHighlighting = () => {\n highlightAll();\n deprecated(\"10.6.0\", \"initHighlighting() deprecated. Use highlightAll() now.\");\n };\n\n // TODO: remove v12, deprecated\n function initHighlightingOnLoad() {\n highlightAll();\n deprecated(\"10.6.0\", \"initHighlightingOnLoad() deprecated. Use highlightAll() now.\");\n }\n\n let wantsHighlight = false;\n\n /**\n * auto-highlights all pre>code elements on the page\n */\n function highlightAll() {\n function boot() {\n // if a highlight was requested before DOM was loaded, do now\n highlightAll();\n }\n\n // if we are called too early in the loading process\n if (document.readyState === \"loading\") {\n // make sure the event listener is only added once\n if (!wantsHighlight) {\n window.addEventListener('DOMContentLoaded', boot, false);\n }\n wantsHighlight = true;\n return;\n }\n\n const blocks = document.querySelectorAll(options.cssSelector);\n blocks.forEach(highlightElement);\n }\n\n /**\n * Register a language grammar module\n *\n * @param {string} languageName\n * @param {LanguageFn} languageDefinition\n */\n function registerLanguage(languageName, languageDefinition) {\n let lang = null;\n try {\n lang = languageDefinition(hljs);\n } catch (error$1) {\n error(\"Language definition for '{}' could not be registered.\".replace(\"{}\", languageName));\n // hard or soft error\n if (!SAFE_MODE) { throw error$1; } else { error(error$1); }\n // languages that have serious errors are replaced with essentially a\n // \"plaintext\" stand-in so that the code blocks will still get normal\n // css classes applied to them - and one bad language won't break the\n // entire highlighter\n lang = PLAINTEXT_LANGUAGE;\n }\n // give it a temporary name if it doesn't have one in the meta-data\n if (!lang.name) lang.name = languageName;\n languages[languageName] = lang;\n lang.rawDefinition = languageDefinition.bind(null, hljs);\n\n if (lang.aliases) {\n registerAliases(lang.aliases, { languageName });\n }\n }\n\n /**\n * Remove a language grammar module\n *\n * @param {string} languageName\n */\n function unregisterLanguage(languageName) {\n delete languages[languageName];\n for (const alias of Object.keys(aliases)) {\n if (aliases[alias] === languageName) {\n delete aliases[alias];\n }\n }\n }\n\n /**\n * @returns {string[]} List of language internal names\n */\n function listLanguages() {\n return Object.keys(languages);\n }\n\n /**\n * @param {string} name - name of the language to retrieve\n * @returns {Language | undefined}\n */\n function getLanguage(name) {\n name = (name || '').toLowerCase();\n return languages[name] || languages[aliases[name]];\n }\n\n /**\n *\n * @param {string|string[]} aliasList - single alias or list of aliases\n * @param {{languageName: string}} opts\n */\n function registerAliases(aliasList, { languageName }) {\n if (typeof aliasList === 'string') {\n aliasList = [aliasList];\n }\n aliasList.forEach(alias => { aliases[alias.toLowerCase()] = languageName; });\n }\n\n /**\n * Determines if a given language has auto-detection enabled\n * @param {string} name - name of the language\n */\n function autoDetection(name) {\n const lang = getLanguage(name);\n return lang && !lang.disableAutodetect;\n }\n\n /**\n * Upgrades the old highlightBlock plugins to the new\n * highlightElement API\n * @param {HLJSPlugin} plugin\n */\n function upgradePluginAPI(plugin) {\n // TODO: remove with v12\n if (plugin[\"before:highlightBlock\"] && !plugin[\"before:highlightElement\"]) {\n plugin[\"before:highlightElement\"] = (data) => {\n plugin[\"before:highlightBlock\"](\n Object.assign({ block: data.el }, data)\n );\n };\n }\n if (plugin[\"after:highlightBlock\"] && !plugin[\"after:highlightElement\"]) {\n plugin[\"after:highlightElement\"] = (data) => {\n plugin[\"after:highlightBlock\"](\n Object.assign({ block: data.el }, data)\n );\n };\n }\n }\n\n /**\n * @param {HLJSPlugin} plugin\n */\n function addPlugin(plugin) {\n upgradePluginAPI(plugin);\n plugins.push(plugin);\n }\n\n /**\n * @param {HLJSPlugin} plugin\n */\n function removePlugin(plugin) {\n const index = plugins.indexOf(plugin);\n if (index !== -1) {\n plugins.splice(index, 1);\n }\n }\n\n /**\n *\n * @param {PluginEvent} event\n * @param {any} args\n */\n function fire(event, args) {\n const cb = event;\n plugins.forEach(function(plugin) {\n if (plugin[cb]) {\n plugin[cb](args);\n }\n });\n }\n\n /**\n * DEPRECATED\n * @param {HighlightedHTMLElement} el\n */\n function deprecateHighlightBlock(el) {\n deprecated(\"10.7.0\", \"highlightBlock will be removed entirely in v12.0\");\n deprecated(\"10.7.0\", \"Please use highlightElement now.\");\n\n return highlightElement(el);\n }\n\n /* Interface definition */\n Object.assign(hljs, {\n highlight,\n highlightAuto,\n highlightAll,\n highlightElement,\n // TODO: Remove with v12 API\n highlightBlock: deprecateHighlightBlock,\n configure,\n initHighlighting,\n initHighlightingOnLoad,\n registerLanguage,\n unregisterLanguage,\n listLanguages,\n getLanguage,\n registerAliases,\n autoDetection,\n inherit,\n addPlugin,\n removePlugin\n });\n\n hljs.debugMode = function() { SAFE_MODE = false; };\n hljs.safeMode = function() { SAFE_MODE = true; };\n hljs.versionString = version;\n\n hljs.regex = {\n concat: concat,\n lookahead: lookahead,\n either: either,\n optional: optional,\n anyNumberOfTimes: anyNumberOfTimes\n };\n\n for (const key in MODES) {\n // @ts-ignore\n if (typeof MODES[key] === \"object\") {\n // @ts-ignore\n deepFreeze(MODES[key]);\n }\n }\n\n // merge all the modes/regexes into our main object\n Object.assign(hljs, MODES);\n\n return hljs;\n};\n\n// Other names for the variable may break build script\nconst highlight = HLJS({});\n\n// returns a new instance of the highlighter to be used for extensions\n// check https://github.com/wooorm/lowlight/issues/47\nhighlight.newInstance = () => HLJS({});\n\nmodule.exports = highlight;\nhighlight.HighlightJS = highlight;\nhighlight.default = highlight;\n","/*\nLanguage: JSON\nDescription: JSON (JavaScript Object Notation) is a lightweight data-interchange format.\nAuthor: Ivan Sagalaev \nWebsite: http://www.json.org\nCategory: common, protocols, web\n*/\n\nfunction json(hljs) {\n const ATTRIBUTE = {\n className: 'attr',\n begin: /\"(\\\\.|[^\\\\\"\\r\\n])*\"(?=\\s*:)/,\n relevance: 1.01\n };\n const PUNCTUATION = {\n match: /[{}[\\],:]/,\n className: \"punctuation\",\n relevance: 0\n };\n const LITERALS = [\n \"true\",\n \"false\",\n \"null\"\n ];\n // NOTE: normally we would rely on `keywords` for this but using a mode here allows us\n // - to use the very tight `illegal: \\S` rule later to flag any other character\n // - as illegal indicating that despite looking like JSON we do not truly have\n // - JSON and thus improve false-positively greatly since JSON will try and claim\n // - all sorts of JSON looking stuff\n const LITERALS_MODE = {\n scope: \"literal\",\n beginKeywords: LITERALS.join(\" \"),\n };\n\n return {\n name: 'JSON',\n aliases: ['jsonc'],\n keywords:{\n literal: LITERALS,\n },\n contains: [\n ATTRIBUTE,\n PUNCTUATION,\n hljs.QUOTE_STRING_MODE,\n LITERALS_MODE,\n hljs.C_NUMBER_MODE,\n hljs.C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE\n ],\n illegal: '\\\\S'\n };\n}\n\nexport { json as default };\n","\n\n\n\n\n\n","\n\n\n\n\n","\n\n\n\n\n\n","\n\n","\n\n","\n\n","\n\n\n\n\n\n","import { n as normalizeComponent } from \"./_plugin-vue2_normalizer-DU4iP6Vu.mjs\";\nconst _sfc_main = {\n name: \"CheckIcon\",\n emits: [\"click\"],\n props: {\n title: {\n type: String\n },\n fillColor: {\n type: String,\n default: \"currentColor\"\n },\n size: {\n type: Number,\n default: 24\n }\n }\n};\nvar _sfc_render = function render() {\n var _vm = this, _c = _vm._self._c;\n return _c(\"span\", _vm._b({ staticClass: \"material-design-icon check-icon\", attrs: { \"aria-hidden\": _vm.title ? null : \"true\", \"aria-label\": _vm.title, \"role\": \"img\" }, on: { \"click\": function($event) {\n return _vm.$emit(\"click\", $event);\n } } }, \"span\", _vm.$attrs, false), [_c(\"svg\", { staticClass: \"material-design-icon__svg\", attrs: { \"fill\": _vm.fillColor, \"width\": _vm.size, \"height\": _vm.size, \"viewBox\": \"0 0 24 24\" } }, [_c(\"path\", { attrs: { \"d\": \"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z\" } }, [_vm.title ? _c(\"title\", [_vm._v(_vm._s(_vm.title))]) : _vm._e()])])]);\n};\nvar _sfc_staticRenderFns = [];\nvar __component__ = /* @__PURE__ */ normalizeComponent(\n _sfc_main,\n _sfc_render,\n _sfc_staticRenderFns,\n false,\n null,\n null\n);\nconst Check = __component__.exports;\nexport {\n Check as C\n};\n//# sourceMappingURL=Check-BkThHPH7.mjs.map\n","import { n as normalizeComponent } from \"./_plugin-vue2_normalizer-DU4iP6Vu.mjs\";\nconst _sfc_main = {\n name: \"ChevronRightIcon\",\n emits: [\"click\"],\n props: {\n title: {\n type: String\n },\n fillColor: {\n type: String,\n default: \"currentColor\"\n },\n size: {\n type: Number,\n default: 24\n }\n }\n};\nvar _sfc_render = function render() {\n var _vm = this, _c = _vm._self._c;\n return _c(\"span\", _vm._b({ staticClass: \"material-design-icon chevron-right-icon\", attrs: { \"aria-hidden\": _vm.title ? null : \"true\", \"aria-label\": _vm.title, \"role\": \"img\" }, on: { \"click\": function($event) {\n return _vm.$emit(\"click\", $event);\n } } }, \"span\", _vm.$attrs, false), [_c(\"svg\", { staticClass: \"material-design-icon__svg\", attrs: { \"fill\": _vm.fillColor, \"width\": _vm.size, \"height\": _vm.size, \"viewBox\": \"0 0 24 24\" } }, [_c(\"path\", { attrs: { \"d\": \"M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z\" } }, [_vm.title ? _c(\"title\", [_vm._v(_vm._s(_vm.title))]) : _vm._e()])])]);\n};\nvar _sfc_staticRenderFns = [];\nvar __component__ = /* @__PURE__ */ normalizeComponent(\n _sfc_main,\n _sfc_render,\n _sfc_staticRenderFns,\n false,\n null,\n null\n);\nconst ChevronRight = __component__.exports;\nexport {\n ChevronRight as C\n};\n//# sourceMappingURL=ChevronRight-BUv-PtHh.mjs.map\n","const ActionGlobalMixin = {\n beforeUpdate() {\n this.text = this.getText();\n },\n data() {\n return {\n // $slots are not reactive.\n // We need to update the content manually\n text: this.getText()\n };\n },\n computed: {\n isLongText() {\n return this.text && this.text.trim().length > 20;\n }\n },\n methods: {\n getText() {\n return this.$slots.default ? this.$slots.default[0].text.trim() : \"\";\n }\n }\n};\nexport {\n ActionGlobalMixin as A\n};\n//# sourceMappingURL=actionGlobal-DqVa7c7G.mjs.map\n","import { A as ActionGlobalMixin } from \"./actionGlobal-DqVa7c7G.mjs\";\nconst GetParent = function(context, name) {\n let parent = context.$parent;\n while (parent) {\n if (parent.$options.name === name) {\n return parent;\n }\n parent = parent.$parent;\n }\n};\nconst ActionTextMixin = {\n mixins: [ActionGlobalMixin],\n props: {\n /**\n * Icon to show with the action, can be either a CSS class or an URL\n */\n icon: {\n type: String,\n default: \"\"\n },\n /**\n * The main text content of the entry.\n */\n name: {\n type: String,\n default: \"\"\n },\n /**\n * The title attribute of the element.\n */\n title: {\n type: String,\n default: \"\"\n },\n /**\n * Whether we close the Actions menu after the click\n */\n closeAfterClick: {\n type: Boolean,\n default: false\n },\n /**\n * Aria label for the button. Not needed if the button has text.\n */\n ariaLabel: {\n type: String,\n default: null\n },\n /**\n * @deprecated To be removed in @nextcloud/vue 9. Migration guide: remove ariaHidden prop from NcAction* components.\n * @todo Add a check in @nextcloud/vue 9 that this prop is not provided,\n * otherwise root element will inherit incorrect aria-hidden.\n */\n ariaHidden: {\n type: Boolean,\n default: null\n }\n },\n emits: [\n \"click\"\n ],\n computed: {\n /**\n * Check if icon prop is an URL\n * @return {boolean} Whether the icon prop is an URL\n */\n isIconUrl() {\n try {\n return !!new URL(this.icon, this.icon.startsWith(\"/\") ? window.location.origin : void 0);\n } catch (error) {\n return false;\n }\n }\n },\n methods: {\n onClick(event) {\n this.$emit(\"click\", event);\n if (this.closeAfterClick) {\n const parent = GetParent(this, \"NcActions\");\n if (parent && parent.closeMenu) {\n parent.closeMenu(false);\n }\n }\n }\n }\n};\nexport {\n ActionTextMixin as A\n};\n//# sourceMappingURL=actionText-fFcUPi2g.mjs.map\n","import { isRTL } from \"@nextcloud/l10n\";\nconst isRtl = isRTL();\nexport {\n isRtl as i\n};\n//# sourceMappingURL=rtl-v0UOPAM7.mjs.map\n","import '../assets/NcActionButton-BqMeBMdA.css';\nimport { C as Check } from \"./Check-BkThHPH7.mjs\";\nimport { C as ChevronRight } from \"./ChevronRight-BUv-PtHh.mjs\";\nimport { n as normalizeComponent } from \"./_plugin-vue2_normalizer-DU4iP6Vu.mjs\";\nimport { A as ActionTextMixin } from \"./actionText-fFcUPi2g.mjs\";\nimport { i as isRtl } from \"./rtl-v0UOPAM7.mjs\";\nconst _sfc_main$1 = {\n name: \"ChevronLeftIcon\",\n emits: [\"click\"],\n props: {\n title: {\n type: String\n },\n fillColor: {\n type: String,\n default: \"currentColor\"\n },\n size: {\n type: Number,\n default: 24\n }\n }\n};\nvar _sfc_render$1 = function render() {\n var _vm = this, _c = _vm._self._c;\n return _c(\"span\", _vm._b({ staticClass: \"material-design-icon chevron-left-icon\", attrs: { \"aria-hidden\": _vm.title ? null : \"true\", \"aria-label\": _vm.title, \"role\": \"img\" }, on: { \"click\": function($event) {\n return _vm.$emit(\"click\", $event);\n } } }, \"span\", _vm.$attrs, false), [_c(\"svg\", { staticClass: \"material-design-icon__svg\", attrs: { \"fill\": _vm.fillColor, \"width\": _vm.size, \"height\": _vm.size, \"viewBox\": \"0 0 24 24\" } }, [_c(\"path\", { attrs: { \"d\": \"M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z\" } }, [_vm.title ? _c(\"title\", [_vm._v(_vm._s(_vm.title))]) : _vm._e()])])]);\n};\nvar _sfc_staticRenderFns$1 = [];\nvar __component__$1 = /* @__PURE__ */ normalizeComponent(\n _sfc_main$1,\n _sfc_render$1,\n _sfc_staticRenderFns$1,\n false,\n null,\n null\n);\nconst ChevronLeftIcon = __component__$1.exports;\nconst _sfc_main = {\n name: \"NcActionButton\",\n components: {\n CheckIcon: Check,\n ChevronRightIcon: ChevronRight,\n ChevronLeftIcon\n },\n mixins: [ActionTextMixin],\n inject: {\n isInSemanticMenu: {\n from: \"NcActions:isSemanticMenu\",\n default: false\n }\n },\n props: {\n /**\n * @deprecated To be removed in @nextcloud/vue 9. Migration guide: remove ariaHidden prop from NcAction* components.\n * @todo Add a check in @nextcloud/vue 9 that this prop is not provided,\n * otherwise root element will inherit incorrect aria-hidden.\n */\n ariaHidden: {\n type: Boolean,\n default: null\n },\n /**\n * disabled state of the action button\n */\n disabled: {\n type: Boolean,\n default: false\n },\n /**\n * If this is a menu, a chevron icon will\n * be added at the end of the line\n */\n isMenu: {\n type: Boolean,\n default: false\n },\n /**\n * The button's behavior, by default the button acts like a normal button with optional toggle button behavior if `modelValue` is `true` or `false`.\n * But you can also set to checkbox button behavior with tri-state or radio button like behavior.\n * This extends the native HTML button type attribute.\n */\n type: {\n type: String,\n default: \"button\",\n validator: (behavior) => [\"button\", \"checkbox\", \"radio\", \"reset\", \"submit\"].includes(behavior)\n },\n /**\n * The buttons state if `type` is 'checkbox' or 'radio' (meaning if it is pressed / selected).\n * For checkbox and toggle button behavior - boolean value.\n * For radio button behavior - could be a boolean checked or a string with the value of the button.\n * Note: Unlike native radio buttons, NcActionButton are not grouped by name, so you need to connect them by bind correct modelValue.\n *\n * **This is not availabe for `type='submit'` or `type='reset'`**\n *\n * If using `type='checkbox'` a `model-value` of `true` means checked, `false` means unchecked and `null` means indeterminate (tri-state)\n * For `type='radio'` `null` is equal to `false`\n */\n modelValue: {\n type: [Boolean, String],\n default: null\n },\n /**\n * The value used for the `modelValue` when this component is used with radio behavior\n * Similar to the `value` attribute of ``\n */\n value: {\n type: String,\n default: null\n }\n },\n setup() {\n return {\n isRtl\n };\n },\n computed: {\n /**\n * determines if the action is focusable\n *\n * @return {boolean} is the action focusable ?\n */\n isFocusable() {\n return !this.disabled;\n },\n /**\n * The current \"checked\" or \"pressed\" state for the model behavior\n */\n isChecked() {\n if (this.type === \"radio\" && typeof this.modelValue !== \"boolean\") {\n return this.modelValue === this.value;\n }\n return this.modelValue;\n },\n /**\n * The native HTML type to set on the button\n */\n nativeType() {\n if (this.type === \"submit\" || this.type === \"reset\") {\n return this.type;\n }\n return \"button\";\n },\n /**\n * HTML attributes to bind to the