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4D2F,EAAK,IAAI,qDAOvIjD,EAAQiD,EAAK,GAAG,OAA3BvB,EAOM,MAAAyB,GAAA,QANLzB,EAK4BY,EAAA,KAAAK,EAJE3C,EAAQiD,EAAK,GAAG,GAArCG,EAAQC,SADjBjB,EAK4BT,EAAA9C,CAAA,GAH1B,IAAKwE,EACL,IAAKD,EACL,WAAYjG,EAAA,WACZ,WAAYS,EAAA,qEAGR0C,EAAY2C,EAAK,GAAG,OAD3Bb,EAOWT,EAAAO,CAAA,SALV,0BACA,KAAK,SACL,QAAQ,WACP,QAAKU,GAAEhC,GAAYqC,EAAK,GAAG,cAC5B,IAA4C,KAAzCtB,EAAArE,CAAA,EAAC,+DAESiD,EAAa0C,EAAK,GAAG,OAAnCvB,EAOI,IAPJ4B,GAOIzB,EALFF,EAAArE,CAAA,+GAQI2F,EAAK,UADZvB,EAqBU,iBAnBT,MAAK6B,GAAA,CAAC,+BAA8B,yCAEe3E,IAAUP,EAAA,MAAY,GADxE,mBAAkB4E,EAAK,KAAK,KAE7BjB,EASK,KATLwB,GASK,CARJxB,EAOS,UAPD,KAAK,SAAU,eAAcpD,IAAUP,EAAA,aAAwB,OAAY,WAAOV,EAAA,MAAYsF,EAAK,KAAK,MAE9GtB,EAAArE,CAAA,EAAC,0CAAyD2F,EAAK,KAAK,kBAA8BA,EAAK,KAAK,6BAO/GvB,EAK4BY,EAAA,KAAAK,EAJGM,EAAK,KAAK,KAAI,CAApCQ,EAASJ,SADlBjB,EAK4BT,EAAA9C,CAAA,GAH1B,IAAKwE,EACL,IAAKI,EACL,WAAYtG,EAAA,WACZ,WAAYS,EAAA","names":["props","__props","sides","sideLabels","t","loading","ref","error","model","currentId","activeSide","rowsByGap","reactive","root","tabs","controller","generation","materialize","rowLimit","currentIndex","computed","id","slots","gaps","gap","hunk","index","SourceRow","defineComponent","rowProps","line","value","side","operation","trailing","showEol","h","segment","display","load","request","sourceComparison","__vitePreload","createMarkdownSourceComparison","result","exception","gapRows","rowCount","hunkRows","total","rows","availableRows","canShowMore","isGapLimited","appendGap","currentRows","page","toggleGap","showMoreGap","move","offset","nextTick","scrollBehavior","setSide","setTab","element","onTabKeydown","event","sideForKey","watch","onMounted","onBeforeUnmount","_createElementBlock","_unref","_hoisted_2","_toDisplayString","_openBlock","_hoisted_3","_createElementVNode","_createVNode","NcButton","_hoisted_4","_createBlock","MarkdownSourceFallback","_Fragment","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_renderList","$event","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_13","slot","_hoisted_14","_hoisted_15","gapRow","rowIndex","_hoisted_16","_normalizeClass","_hoisted_18","hunkRow"],"ignoreList":[],"sources":["../src/components/MarkdownSourceComparison.vue"],"sourcesContent":["<!--\n  - SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors\n  - SPDX-License-Identifier: AGPL-3.0-or-later\n-->\n\n<template>\n\t<section ref=\"root\" class=\"text-source-comparison\" :aria-label=\"t('text', 'Markdown source comparison')\">\n\t\t<div v-if=\"loading\" class=\"text-source-comparison__message\" role=\"status\">\n\t\t\t{{ t('text', 'Loading Markdown source differences…') }}\n\t\t</div>\n\t\t<div v-else-if=\"error\" class=\"text-source-comparison__message\" role=\"alert\">\n\t\t\t<p>{{ t('text', 'Could not load Markdown source differences.') }}</p>\n\t\t\t<NcButton type=\"button\" variant=\"primary\" @click=\"load\">\n\t\t\t\t{{ t('text', 'Retry') }}\n\t\t\t</NcButton>\n\t\t</div>\n\t\t<div\n\t\t\tv-else-if=\"model?.status === 'limited'\"\n\t\t\tdata-source-limited\n\t\t\tclass=\"text-source-comparison__message\"\n\t\t\trole=\"status\">\n\t\t\t{{\n\t\t\t\tt(\n\t\t\t\t\t'text',\n\t\t\t\t\t'Detailed source differences exceeded the safe processing limit.',\n\t\t\t\t)\n\t\t\t}}\n\t\t</div>\n\n\t\t<MarkdownSourceFallback v-if=\"model?.status !== 'ready'\" :beforeContent=\"beforeContent\" :afterContent=\"afterContent\" />\n\n\t\t<template v-else>\n\t\t\t<header class=\"text-source-comparison__toolbar\">\n\t\t\t\t<p v-if=\"model.lineEndingChange\" data-source-line-ending-change>\n\t\t\t\t\t{{\n\t\t\t\t\t\tt(\n\t\t\t\t\t\t\t'text',\n\t\t\t\t\t\t\t'Line endings changed: {before} → {after}',\n\t\t\t\t\t\t\tmodel.lineEndingChange,\n\t\t\t\t\t\t)\n\t\t\t\t\t}}\n\t\t\t\t</p>\n\t\t\t\t<div v-if=\"model.hunks.length\" class=\"text-source-comparison__navigation\">\n\t\t\t\t\t<NcButton\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t:disabled=\"model.hunks.length < 2\"\n\t\t\t\t\t\t@click=\"move(-1)\">\n\t\t\t\t\t\t{{ t('text', 'Previous') }}\n\t\t\t\t\t</NcButton>\n\t\t\t\t\t<p aria-live=\"polite\" aria-atomic=\"true\">\n\t\t\t\t\t\t{{\n\t\t\t\t\t\t\tt('text', 'Source change {current} of {total}', {\n\t\t\t\t\t\t\t\tcurrent: currentIndex + 1,\n\t\t\t\t\t\t\t\ttotal: model.hunks.length,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}}\n\t\t\t\t\t</p>\n\t\t\t\t\t<NcButton\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t:disabled=\"model.hunks.length < 2\"\n\t\t\t\t\t\t@click=\"move(1)\">\n\t\t\t\t\t\t{{ t('text', 'Next') }}\n\t\t\t\t\t</NcButton>\n\t\t\t\t</div>\n\t\t\t\t<div\n\t\t\t\t\tv-if=\"layoutMode === 'single'\"\n\t\t\t\t\tclass=\"text-source-comparison__side-tabs\"\n\t\t\t\t\trole=\"tablist\"\n\t\t\t\t\t:aria-label=\"t('text', 'Source version to display')\">\n\t\t\t\t\t<button\n\t\t\t\t\t\tv-for=\"side in sides\"\n\t\t\t\t\t\t:key=\"side\"\n\t\t\t\t\t\t:ref=\"(element) => setTab(side, element)\"\n\t\t\t\t\t\trole=\"tab\"\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t:aria-selected=\"activeSide === side\"\n\t\t\t\t\t\t:tabindex=\"activeSide === side ? 0 : -1\"\n\t\t\t\t\t\t@click=\"setSide(side)\"\n\t\t\t\t\t\t@keydown=\"onTabKeydown\">\n\t\t\t\t\t\t{{ sideLabels[side] }}\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t</header>\n\t\t\t<div class=\"text-source-comparison__side-headings\">\n\t\t\t\t<h2\n\t\t\t\t\tv-for=\"side in sides\"\n\t\t\t\t\t:key=\"side\"\n\t\t\t\t\t:data-source-side=\"side\"\n\t\t\t\t\t:hidden=\"layoutMode === 'single' && activeSide !== side\">\n\t\t\t\t\t{{ sideLabels[side] }}\n\t\t\t\t</h2>\n\t\t\t</div>\n\n\t\t\t<div class=\"text-source-comparison__hunks\">\n\t\t\t\t<template v-for=\"(slot, index) in slots\" :key=\"`slot-${index}`\">\n\t\t\t\t\t<div v-if=\"slot.gap\" class=\"text-source-comparison__gap\">\n\t\t\t\t\t\t<NcButton\n\t\t\t\t\t\t\tdata-source-gap-toggle\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t:aria-expanded=\"Boolean(gapRows(slot.gap))\"\n\t\t\t\t\t\t\t@click=\"toggleGap(slot.gap)\">\n\t\t\t\t\t\t\t{{\n\t\t\t\t\t\t\t\tgapRows(slot.gap)\n\t\t\t\t\t\t\t\t\t? t('text', 'Hide unchanged lines')\n\t\t\t\t\t\t\t\t\t: t('text', 'Show {count} unchanged lines', {\n\t\t\t\t\t\t\t\t\t\tcount: slot.gap.count,\n\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t</NcButton>\n\t\t\t\t\t\t<div v-if=\"gapRows(slot.gap)\">\n\t\t\t\t\t\t\t<SourceRow\n\t\t\t\t\t\t\t\tv-for=\"(gapRow, rowIndex) in gapRows(slot.gap)\"\n\t\t\t\t\t\t\t\t:key=\"rowIndex\"\n\t\t\t\t\t\t\t\t:row=\"gapRow\"\n\t\t\t\t\t\t\t\t:layoutMode=\"layoutMode\"\n\t\t\t\t\t\t\t\t:activeSide=\"activeSide\" />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<NcButton\n\t\t\t\t\t\t\tv-if=\"canShowMore(slot.gap)\"\n\t\t\t\t\t\t\tdata-source-gap-more\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t@click=\"showMoreGap(slot.gap)\">\n\t\t\t\t\t\t\t{{ t('text', 'Show more unchanged lines') }}\n\t\t\t\t\t\t</NcButton>\n\t\t\t\t\t\t<p v-else-if=\"isGapLimited(slot.gap)\" data-source-gap-limited role=\"status\">\n\t\t\t\t\t\t\t{{\n\t\t\t\t\t\t\t\tt(\n\t\t\t\t\t\t\t\t\t'text',\n\t\t\t\t\t\t\t\t\t'Additional unchanged lines are hidden to keep the comparison responsive.',\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</div>\n\t\t\t\t\t<section\n\t\t\t\t\t\tv-if=\"slot.hunk\"\n\t\t\t\t\t\tclass=\"text-source-comparison__hunk\"\n\t\t\t\t\t\t:data-source-hunk=\"slot.hunk.id\"\n\t\t\t\t\t\t:class=\"{ 'text-source-comparison__hunk--current': index === currentIndex }\">\n\t\t\t\t\t\t<h3 class=\"text-source-comparison__hunk-title\">\n\t\t\t\t\t\t\t<button type=\"button\" :aria-current=\"index === currentIndex ? 'true' : undefined\" @click=\"currentId = slot.hunk.id\">\n\t\t\t\t\t\t\t\t{{\n\t\t\t\t\t\t\t\t\tt('text', 'Lines {before} / {after}', {\n\t\t\t\t\t\t\t\t\t\tbefore: slot.hunk.beforeStart,\n\t\t\t\t\t\t\t\t\t\tafter: slot.hunk.afterStart,\n\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t</h3>\n\t\t\t\t\t\t<SourceRow\n\t\t\t\t\t\t\tv-for=\"(hunkRow, rowIndex) in slot.hunk.rows\"\n\t\t\t\t\t\t\t:key=\"rowIndex\"\n\t\t\t\t\t\t\t:row=\"hunkRow\"\n\t\t\t\t\t\t\t:layoutMode=\"layoutMode\"\n\t\t\t\t\t\t\t:activeSide=\"activeSide\" />\n\t\t\t\t\t</section>\n\t\t\t\t</template>\n\t\t\t</div>\n\t\t</template>\n\t</section>\n</template>\n\n<script setup lang=\"ts\">\nimport type { ComponentPublicInstance as Public } from 'vue'\nimport type { SourceDiffGap as Gap, SourceGapMaterializer as Materializer, SourceDiffModel as Model, SourceDiffRow as Row } from '../comparison/markdownSourceComparison.ts'\n\nimport { t } from '@nextcloud/l10n'\nimport { computed, defineComponent, h, nextTick, onBeforeUnmount, onMounted, reactive, ref, watch } from 'vue'\nimport NcButton from '@nextcloud/vue/components/NcButton'\nimport MarkdownSourceFallback from './MarkdownSourceFallback.vue'\nimport { comparisonScrollBehavior as scrollBehavior, comparisonSideForKey as sideForKey } from '../comparison/comparisonNavigation.ts'\nimport { displayMarkdownSource as display } from '../comparison/markdownSourceDisplay.ts'\n\nconst props = defineProps<{\n\tbeforeContent: string\n\tafterContent: string\n\tlayoutMode: 'paired' | 'single'\n}>()\ntype Side = 'before' | 'after'\nconst sides: readonly Side[] = ['before', 'after']\nconst sideLabels = { before: t('text', 'Before'), after: t('text', 'After') }\nconst loading = ref(true)\nconst error = ref<unknown>(null)\nconst model = ref<Model | null>(null)\nconst currentId = ref<string | null>(null)\nconst activeSide = ref<Side>('before')\nconst rowsByGap = reactive(new Map<string, readonly Row[]>())\nconst root = ref<HTMLElement | null>(null)\nconst tabs: Record<Side, HTMLButtonElement | null> = { before: null, after: null }\nlet controller: AbortController | null = null\nlet generation = 0\nlet materialize: Materializer | null = null\nlet rowLimit = 0\n\nconst currentIndex = computed(() => model.value?.status === 'ready'\n\t? Math.max(\n\t\t\t0,\n\t\t\tmodel.value.hunks.findIndex(({ id }) => id === currentId.value),\n\t\t)\n\t: 0)\nconst slots = computed(() => {\n\tif (model.value?.status !== 'ready') {\n\t\treturn []\n\t}\n\tconst gaps = new Map(model.value.gaps.map((gap) => [gap.slot, gap]))\n\treturn [...model.value.hunks, null].map((hunk, index) => ({ hunk, gap: gaps.get(index) }))\n})\nconst SourceRow = defineComponent({\n\tprops: {\n\t\trow: { type: Object as () => Row, required: true },\n\t\tlayoutMode: { type: String as () => 'paired' | 'single', required: true },\n\t\tactiveSide: { type: String as () => Side, required: true },\n\t},\n\n\tsetup(rowProps) {\n\t\tconst line = (value: Row[Side], side: Side) => {\n\t\t\tconst operation = value?.changed ? (side === 'before' ? 'removed' : 'added') : undefined\n\t\t\tconst trailing = value?.text.match(/ +$/)?.[0].length ?? 0\n\t\t\tconst showEol = rowProps.row.before && rowProps.row.after\n\t\t\t\t&& rowProps.row.before.eol !== rowProps.row.after.eol\n\t\t\treturn h('div', {\n\t\t\t\tclass: ['text-source-comparison__line', operation && `text-source-comparison__line--${operation}`],\n\t\t\t\thidden: rowProps.layoutMode === 'single' && rowProps.activeSide !== side,\n\t\t\t\t'aria-label': operation && t('text', operation === 'removed' ? 'Removed line {line}' : 'Added line {line}', { line: value!.number }),\n\t\t\t\t'data-source-operation': operation,\n\t\t\t}, value\n\t\t\t\t? [\n\t\t\t\t\t\toperation ? h('span', { 'aria-hidden': 'true', 'data-source-cue': '' }, operation === 'removed' ? '−' : '+') : null,\n\t\t\t\t\t\th('span', { class: 'text-source-comparison__line-number', 'aria-hidden': 'true' }, String(value.number)),\n\t\t\t\t\t\th('code', { dir: 'auto' }, value.segments.map((segment) => h('bdi', {\n\t\t\t\t\t\t\tclass: segment.changed ? 'text-source-comparison__segment--changed' : undefined,\n\t\t\t\t\t\t}, display(segment.text)))),\n\t\t\t\t\t\tshowEol && value.eol !== 'none' ? h('span', { class: 'text-source-comparison__annotation', 'data-source-eol': value.eol }, `⟦${value.eol.toUpperCase()}⟧`) : null,\n\t\t\t\t\t\ttrailing ? h('span', { class: 'text-source-comparison__annotation', 'data-source-trailing': trailing }, t('text', '{count} trailing spaces', { count: trailing }).toUpperCase()) : null,\n\t\t\t\t\t\tvalue.eol === 'none' ? h('span', { class: 'text-source-comparison__annotation' }, t('text', 'No newline at end of file')) : null,\n\t\t\t\t\t]\n\t\t\t\t: [])\n\t\t}\n\t\treturn () => h('div', {\n\t\t\tclass: ['text-source-comparison__row', rowProps.layoutMode === 'single' && 'text-source-comparison__row--single'],\n\t\t}, [\n\t\t\tline(rowProps.row.before, 'before'),\n\t\t\tline(rowProps.row.after, 'after'),\n\t\t])\n\t},\n})\n\nasync function load() {\n\tconst request = ++generation\n\tcontroller?.abort()\n\tcontroller = new AbortController()\n\tloading.value = true\n\terror.value = null\n\tmodel.value = null\n\trowsByGap.clear()\n\ttry {\n\t\tconst sourceComparison\n\t\t\t= await import('../comparison/markdownSourceComparison.ts')\n\t\tconst { createMarkdownSourceComparison } = sourceComparison\n\t\tconst result = await createMarkdownSourceComparison(\n\t\t\tprops.beforeContent,\n\t\t\tprops.afterContent,\n\t\t\tcontroller.signal,\n\t\t)\n\t\tif (request !== generation) {\n\t\t\treturn\n\t\t}\n\t\tmaterialize = sourceComparison.materializeSourceDiffGap\n\t\trowLimit\n\t\t\t= sourceComparison.SOURCE_DIFF_LIMITS.maximumDisplayedRows\n\t\tmodel.value = result\n\t\tcurrentId.value\n\t\t\t= result.status === 'ready' ? (result.hunks[0]?.id ?? null) : null\n\t} catch (exception) {\n\t\tif (\n\t\t\trequest === generation\n\t\t\t&& (!(exception instanceof DOMException) || exception.name !== 'AbortError')\n\t\t) {\n\t\t\terror.value = exception\n\t\t}\n\t} finally {\n\t\tif (request === generation) {\n\t\t\tloading.value = false\n\t\t}\n\t}\n}\nfunction gapRows(gap: Gap) {\n\treturn rowsByGap.get(gap.id)\n}\nfunction rowCount() {\n\tconst hunkRows\n\t\t= model.value?.status === 'ready'\n\t\t\t? model.value.hunks.reduce((total, hunk) => total + hunk.rows.length, 0)\n\t\t\t: 0\n\treturn [...rowsByGap.values()].reduce(\n\t\t(total, rows) => total + rows.length,\n\t\thunkRows,\n\t)\n}\nfunction availableRows() {\n\treturn Math.max(0, rowLimit - rowCount())\n}\nfunction canShowMore(gap: Gap) {\n\tconst rows = rowsByGap.get(gap.id)\n\treturn Boolean(rows && rows.length < gap.count && availableRows() > 0)\n}\nfunction isGapLimited(gap: Gap) {\n\tconst rows = rowsByGap.get(gap.id)\n\treturn Boolean(rows && rows.length < gap.count && availableRows() === 0)\n}\nfunction appendGap(gap: Gap) {\n\tif (!materialize) {\n\t\treturn\n\t}\n\tconst currentRows = rowsByGap.get(gap.id) ?? []\n\tconst page = materialize(\n\t\tprops.beforeContent,\n\t\tprops.afterContent,\n\t\tgap,\n\t\tavailableRows(),\n\t\tcurrentRows.length,\n\t)\n\trowsByGap.set(gap.id, [...currentRows, ...page])\n}\nfunction toggleGap(gap: Gap) {\n\tif (rowsByGap.has(gap.id)) {\n\t\trowsByGap.delete(gap.id)\n\t} else if (materialize) {\n\t\trowsByGap.set(gap.id, [])\n\t\tappendGap(gap)\n\t}\n}\nfunction showMoreGap(gap: Gap) {\n\tappendGap(gap)\n}\nfunction move(offset: number) {\n\tif (model.value?.status !== 'ready' || !model.value.hunks.length) {\n\t\treturn\n\t}\n\tconst index\n\t\t= (currentIndex.value + offset + model.value.hunks.length)\n\t\t\t% model.value.hunks.length\n\tcurrentId.value = model.value.hunks[index]!.id\n\tnextTick(() => root.value\n\t\t?.querySelector<HTMLElement>(`[data-source-hunk=\"${currentId.value}\"]`)\n\t\t?.scrollIntoView({\n\t\t\tblock: 'center',\n\t\t\tbehavior: scrollBehavior(),\n\t\t}))\n}\nfunction setSide(side: Side) {\n\tactiveSide.value = side\n\tnextTick(() => tabs[side]?.focus())\n}\nfunction setTab(side: Side, element: Element | Public | null) {\n\ttabs[side] = element instanceof HTMLButtonElement ? element : null\n}\nfunction onTabKeydown(event: KeyboardEvent) {\n\tconst side = sideForKey(event.key)\n\tif (side) {\n\t\tevent.preventDefault()\n\t\tsetSide(side)\n\t}\n}\nwatch(() => [props.beforeContent, props.afterContent], load)\nonMounted(load)\nonBeforeUnmount(() => {\n\tgeneration++\n\tcontroller?.abort()\n})\n</script>\n\n<style lang=\"scss\">\n$g: var(--default-grid-baseline);\n\n.text-source-comparison {\n\tcontainer-type: inline-size;\n\tmin-block-size: 0;\n\toverflow: auto;\n\n\t&__toolbar {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: space-between;\n\t\tgap: calc(2 * $g);\n\t\tflex-wrap: wrap;\n\t\tpadding: calc(2 * $g) calc(3 * $g);\n\t}\n\t&__toolbar > p,\n\t&__navigation p {\n\t\tmargin: 0;\n\t}\n\t&__navigation {\n\t\tdisplay: grid;\n\t\talign-items: center;\n\t\tgrid-template-columns: auto minmax(12rem, 1fr) auto;\n\t\tgap: $g;\n\t\tmargin-inline-start: auto;\n\t}\n\t&__navigation p { text-align: center; }\n\t&__side-tabs {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: center;\n\t\tgap: calc(2 * $g);\n\t\tinline-size: 100%;\n\t\tbutton[role='tab'] {\n\t\t\tmargin: 0 !important;\n\t\t\tborder: 0 !important;\n\t\t\tborder-block-end: 2px solid transparent !important;\n\t\t\tborder-radius: 0 !important;\n\t\t\tbackground: transparent !important;\n\t\t\t&:focus-visible {\n\t\t\t\tbox-shadow: none !important;\n\t\t\t\toutline: 2px solid var(--color-primary-element) !important;\n\t\t\t\toutline-offset: -2px;\n\t\t\t}\n\t\t}\n\t}\n\t&__row {\n\t\tdisplay: grid;\n\t\tgrid-template-columns: repeat(2, minmax(0, 1fr));\n\t}\n\t&__side-headings {\n\t\tdisplay: grid;\n\t\tgrid-template-columns: repeat(2, minmax(0, 1fr));\n\t\tborder-block: 1px solid var(--color-border);\n\t\th2 {\n\t\t\tmargin: 0;\n\t\t\tpadding: calc(2 * $g) calc(3 * $g);\n\t\t\tfont-size: var(--default-font-size);\n\t\t\tfont-weight: var(--font-weight-heading);\n\t\t\tline-height: var(--default-line-height);\n\t\t}\n\t\th2 + h2 { border-inline-start: 1px solid var(--color-border); }\n\t}\n\t&__row--single { grid-template-columns: minmax(0, 1fr); }\n\t&__line {\n\t\tdisplay: grid;\n\t\talign-items: start;\n\t\tgrid-template-columns: 1.5rem 4rem minmax(12rem, 1fr) repeat(2, max-content);\n\t\tmin-inline-size: 0;\n\t\tfont-family: var(--font-face-monospace);\n\t\tfont-size: var(--font-size-small);\n\t}\n\t&__line[hidden] { display: none; }\n\t[data-source-cue] {\n\t\tgrid-column: 1;\n\t\ttext-align: center;\n\t}\n\t&__line-number {\n\t\tgrid-column: 2;\n\t\tcolor: var(--color-text-maxcontrast);\n\t\ttext-align: end;\n\t\tpadding-inline: 8px;\n\t}\n\tcode {\n\t\tgrid-column: 3;\n\t\toverflow-x: auto;\n\t\twhite-space: pre;\n\t\tuser-select: text;\n\t}\n\t&__annotation {\n\t\tpadding-inline: 4px;\n\t\twhite-space: nowrap;\n\t}\n\t&__line--removed { background: var(--color-error-hover); }\n\t&__line--added { background: var(--color-success-hover); }\n\t&__segment--changed {\n\t\tfont-weight: bold;\n\t\ttext-decoration: underline;\n\t}\n\t&__hunk {\n\t\tborder-block-end: 1px solid var(--color-border);\n\t\t&--current { box-shadow: inset calc(0.75 * $g) 0 var(--color-primary-element); }\n\t}\n\t&__hunk-title {\n\t\tmargin: 0;\n\t\tbackground: var(--color-background-dark);\n\t\tcolor: var(--color-text-maxcontrast);\n\t\tfont-size: var(--font-size-small);\n\t\tbutton {\n\t\t\tdisplay: block;\n\t\t\tinline-size: 100%;\n\t\t\tmin-block-size: var(--default-clickable-area);\n\t\t\tmargin: 0 !important;\n\t\t\tpadding: calc(2 * $g) calc(3 * $g);\n\t\t\tborder: 0;\n\t\t\tborder-radius: 0;\n\t\t\tbackground: transparent;\n\t\t\tcolor: inherit;\n\t\t\tfont: inherit;\n\t\t\tfont-weight: var(--font-weight-heading);\n\t\t\ttext-align: start;\n\t\t}\n\t}\n\t&__gap {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\talign-items: center;\n\t\tpadding: calc(2 * $g);\n\t\tborder-block-end: 1px solid var(--color-border);\n\t\ttext-align: center;\n\t\t> div { inline-size: 100%; }\n\t}\n\t&__side-tabs [role='tab'][aria-selected='true'] {\n\t\tborder-block-end-color: var(--color-primary-element) !important;\n\t\tfont-weight: var(--font-weight-heading);\n\t}\n}\n@container (max-width: 560px) {\n\t.text-source-comparison__navigation {\n\t\tgrid-template-columns: repeat(2, minmax(0, 1fr));\n\t\tinline-size: 100%;\n\t\tmargin-inline-start: 0;\n\t\tbutton:first-child { grid-column: 1; }\n\t\tbutton:last-child { grid-column: 2; }\n\t\tp {\n\t\t\tgrid-row: 2;\n\t\t\tgrid-column: 1 / -1;\n\t\t}\n\t}\n}\n</style>\n"],"file":"MarkdownSourceComparison-i1atH9Xz.chunk.mjs"}