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,EAAUA,EAAQnC,WAItB,IAAIqC,EAAkBC,SAASL,EAASM,QAAQC,YAC5CC,EAAiBH,SAASH,EAAQI,QAAQC,YAG9C,GAAIH,GAAmBI,EAAgB,CAEnC,IAAIC,EAAgBT,EAASpC,YACzB8C,EAAeR,EAAQtC,YAG3B,GAAIwC,EAAkBI,EAAgB,CAClC,IAAIG,EAAMP,EACVA,EAAkBI,EAClBA,EAAiBG,EACjBA,EAAMF,EACNA,EAAgBC,EAChBA,EAAeC,CACnB,CAGA,KAAgD,IAAzCvB,EAAcM,QAAQe,IACzBA,EAAgBA,EAAcG,MAAM,GAIxC,MAAoD,IAA7CxB,EAAcyB,YAAYH,IAC7BA,EAAeA,EAAaE,MAAM,GAAI,GAM1C,IAFA,IAAIE,EAAeL,EACfM,EA7DZ,SAAwBC,GAEpB,IADA,IAAIvB,EAASuB,EACc,UAApBvB,EAAOQ,UACVR,EAASA,EAAO1B,WAEpB,OAAO0B,CACX,CAuD0BwB,CAAejB,GACxBhF,EAAIoF,EAAkB,EAAIpF,EAAIwF,IAAmBxF,EAAG,CACzD,IAAIkG,EAActE,EAAO,kBAAmB,CAACrC,EAAiBG,EAAgBM,IAE9E8F,GAAgB,KADEC,EAAYI,cAAcD,GACTtD,WACvC,CAEA,OADAkD,EAAgB,KAAOJ,CAG3B,CACI,OAAOtB,CAEf,CAa4BgC,CAAyB/B,GAGzBA,EAAUU,WAE9B1E,EAAEgG,cAAcC,QAAQ,aAAclC,GACtC/D,EAAEkG,iBAEV,GA6OJ,CA3WA,CA2WEjC,OAAQP,S","sources":["webpack://sakurairo-scripts/./node_modules/.pnpm/highlightjs-line-numbers.js@2.8.0/node_modules/highlightjs-line-numbers.js/src/highlightjs-line-numbers.js"],"sourcesContent":["// jshint multistr:true\n\n(function (w, d) {\n 'use strict';\n\n var TABLE_NAME = 'hljs-ln',\n LINE_NAME = 'hljs-ln-line',\n CODE_BLOCK_NAME = 'hljs-ln-code',\n NUMBERS_BLOCK_NAME = 'hljs-ln-numbers',\n NUMBER_LINE_NAME = 'hljs-ln-n',\n DATA_ATTR_NAME = 'data-line-number',\n BREAK_LINE_REGEXP = /\\r\\n|\\r|\\n/g;\n\n if (w.hljs) {\n w.hljs.initLineNumbersOnLoad = initLineNumbersOnLoad;\n w.hljs.lineNumbersBlock = lineNumbersBlock;\n w.hljs.lineNumbersValue = lineNumbersValue;\n\n addStyles();\n } else {\n w.console.error('highlight.js not detected!');\n }\n\n function isHljsLnCodeDescendant(domElt) {\n var curElt = domElt;\n while (curElt) {\n if (curElt.className && curElt.className.indexOf('hljs-ln-code') !== -1) {\n return true;\n }\n curElt = curElt.parentNode;\n }\n return false;\n }\n\n function getHljsLnTable(hljsLnDomElt) {\n var curElt = hljsLnDomElt;\n while (curElt.nodeName !== 'TABLE') {\n curElt = curElt.parentNode;\n }\n return curElt;\n }\n\n // Function to workaround a copy issue with Microsoft Edge.\n // Due to hljs-ln wrapping the lines of code inside a <table> element,\n // itself wrapped inside a <pre> element, window.getSelection().toString()\n // does not contain any line breaks. So we need to get them back using the\n // rendered code in the DOM as reference.\n function edgeGetSelectedCodeLines(selection) {\n // current selected text without line breaks\n var selectionText = selection.toString();\n\n // get the <td> element wrapping the first line of selected code\n var tdAnchor = selection.anchorNode;\n while (tdAnchor.nodeName !== 'TD') {\n tdAnchor = tdAnchor.parentNode;\n }\n\n // get the <td> element wrapping the last line of selected code\n var tdFocus = selection.focusNode;\n while (tdFocus.nodeName !== 'TD') {\n tdFocus = tdFocus.parentNode;\n }\n\n // extract line numbers\n var firstLineNumber = parseInt(tdAnchor.dataset.lineNumber);\n var lastLineNumber = parseInt(tdFocus.dataset.lineNumber);\n\n // multi-lines copied case\n if (firstLineNumber != lastLineNumber) {\n\n var firstLineText = tdAnchor.textContent;\n var lastLineText = tdFocus.textContent;\n\n // if the selection was made backward, swap values\n if (firstLineNumber > lastLineNumber) {\n var tmp = firstLineNumber;\n firstLineNumber = lastLineNumber;\n lastLineNumber = tmp;\n tmp = firstLineText;\n firstLineText = lastLineText;\n lastLineText = tmp;\n }\n\n // discard not copied characters in first line\n while (selectionText.indexOf(firstLineText) !== 0) {\n firstLineText = firstLineText.slice(1);\n }\n\n // discard not copied characters in last line\n while (selectionText.lastIndexOf(lastLineText) === -1) {\n lastLineText = lastLineText.slice(0, -1);\n }\n\n // reconstruct and return the real copied text\n var selectedText = firstLineText;\n var hljsLnTable = getHljsLnTable(tdAnchor);\n for (var i = firstLineNumber + 1 ; i < lastLineNumber ; ++i) {\n var codeLineSel = format('.{0}[{1}=\"{2}\"]', [CODE_BLOCK_NAME, DATA_ATTR_NAME, i]);\n var codeLineElt = hljsLnTable.querySelector(codeLineSel);\n selectedText += '\\n' + codeLineElt.textContent;\n }\n selectedText += '\\n' + lastLineText;\n return selectedText;\n // single copied line case\n } else {\n return selectionText;\n }\n }\n\n // ensure consistent code copy/paste behavior across all browsers\n // (see https://github.com/wcoder/highlightjs-line-numbers.js/issues/51)\n document.addEventListener('copy', function(e) {\n // get current selection\n var selection = window.getSelection();\n // override behavior when one wants to copy line of codes\n if (isHljsLnCodeDescendant(selection.anchorNode)) {\n var selectionText;\n // workaround an issue with Microsoft Edge as copied line breaks\n // are removed otherwise from the selection string\n if (window.navigator.userAgent.indexOf('Edge') !== -1) {\n selectionText = edgeGetSelectedCodeLines(selection);\n } else {\n // other browsers can directly use the selection string\n selectionText = selection.toString();\n }\n e.clipboardData.setData('text/plain', selectionText);\n e.preventDefault();\n }\n });\n\n function addStyles () {\n var css = d.createElement('style');\n css.type = 'text/css';\n css.innerHTML = format(\n '.{0}{border-collapse:collapse}' +\n '.{0} td{padding:0}' +\n '.{1}:before{content:attr({2})}',\n [\n TABLE_NAME,\n NUMBER_LINE_NAME,\n DATA_ATTR_NAME\n ]);\n d.getElementsByTagName('head')[0].appendChild(css);\n }\n\n function initLineNumbersOnLoad (options) {\n if (d.readyState === 'interactive' || d.readyState === 'complete') {\n documentReady(options);\n } else {\n w.addEventListener('DOMContentLoaded', function () {\n documentReady(options);\n });\n }\n }\n\n function documentReady (options) {\n try {\n var blocks = d.querySelectorAll('code.hljs,code.nohighlight');\n\n for (var i in blocks) {\n if (blocks.hasOwnProperty(i)) {\n if (!isPluginDisabledForBlock(blocks[i])) {\n lineNumbersBlock(blocks[i], options);\n }\n }\n }\n } catch (e) {\n w.console.error('LineNumbers error: ', e);\n }\n }\n\n function isPluginDisabledForBlock(element) {\n return element.classList.contains('nohljsln');\n }\n\n function lineNumbersBlock (element, options) {\n if (typeof element !== 'object') return;\n\n async(function () {\n element.innerHTML = lineNumbersInternal(element, options);\n });\n }\n\n function lineNumbersValue (value, options) {\n if (typeof value !== 'string') return;\n\n var element = document.createElement('code')\n element.innerHTML = value\n\n return lineNumbersInternal(element, options);\n }\n\n function lineNumbersInternal (element, options) {\n\n var internalOptions = mapOptions(element, options);\n\n duplicateMultilineNodes(element);\n\n return addLineNumbersBlockFor(element.innerHTML, internalOptions);\n }\n\n function addLineNumbersBlockFor (inputHtml, options) {\n var lines = getLines(inputHtml);\n\n // if last line contains only carriage return remove it\n if (lines[lines.length-1].trim() === '') {\n lines.pop();\n }\n\n if (lines.length > 1 || options.singleLine) {\n var html = '';\n\n for (var i = 0, l = lines.length; i < l; i++) {\n html += format(\n '<tr>' +\n '<td class=\"{0} {1}\" {3}=\"{5}\">' +\n '<div class=\"{2}\" {3}=\"{5}\"></div>' +\n '</td>' +\n '<td class=\"{0} {4}\" {3}=\"{5}\">' +\n '{6}' +\n '</td>' +\n '</tr>',\n [\n LINE_NAME,\n NUMBERS_BLOCK_NAME,\n NUMBER_LINE_NAME,\n DATA_ATTR_NAME,\n CODE_BLOCK_NAME,\n i + options.startFrom,\n lines[i].length > 0 ? lines[i] : ' '\n ]);\n }\n\n return format('<table class=\"{0}\">{1}</table>', [ TABLE_NAME, html ]);\n }\n\n return inputHtml;\n }\n\n /**\n * @param {HTMLElement} element Code block.\n * @param {Object} options External API options.\n * @returns {Object} Internal API options.\n */\n function mapOptions (element, options) {\n options = options || {};\n return {\n singleLine: getSingleLineOption(options),\n startFrom: getStartFromOption(element, options)\n };\n }\n\n function getSingleLineOption (options) {\n var defaultValue = false;\n if (!!options.singleLine) {\n return options.singleLine;\n }\n return defaultValue;\n }\n\n function getStartFromOption (element, options) {\n var defaultValue = 1;\n var startFrom = defaultValue;\n\n if (isFinite(options.startFrom)) {\n startFrom = options.startFrom;\n }\n\n // can be overridden because local option is priority\n var value = getAttribute(element, 'data-ln-start-from');\n if (value !== null) {\n startFrom = toNumber(value, defaultValue);\n }\n\n return startFrom;\n }\n\n /**\n * Recursive method for fix multi-line elements implementation in highlight.js\n * Doing deep passage on child nodes.\n * @param {HTMLElement} element\n */\n function duplicateMultilineNodes (element) {\n var nodes = element.childNodes;\n for (var node in nodes) {\n if (nodes.hasOwnProperty(node)) {\n var child = nodes[node];\n if (getLinesCount(child.textContent) > 0) {\n if (child.childNodes.length > 0) {\n duplicateMultilineNodes(child);\n } else {\n duplicateMultilineNode(child.parentNode);\n }\n }\n }\n }\n }\n\n /**\n * Method for fix multi-line elements implementation in highlight.js\n * @param {HTMLElement} element\n */\n function duplicateMultilineNode (element) {\n var className = element.className;\n\n if ( ! /hljs-/.test(className)) return;\n\n var lines = getLines(element.innerHTML);\n\n for (var i = 0, result = ''; i < lines.length; i++) {\n var lineText = lines[i].length > 0 ? lines[i] : ' ';\n result += format('<span class=\"{0}\">{1}</span>\\n', [ className, lineText ]);\n }\n\n element.innerHTML = result.trim();\n }\n\n function getLines (text) {\n if (text.length === 0) return [];\n return text.split(BREAK_LINE_REGEXP);\n }\n\n function getLinesCount (text) {\n return (text.trim().match(BREAK_LINE_REGEXP) || []).length;\n }\n\n ///\n /// HELPERS\n ///\n\n function async (func) {\n w.setTimeout(func, 0);\n }\n\n /**\n * {@link https://wcoder.github.io/notes/string-format-for-string-formating-in-javascript}\n * @param {string} format\n * @param {array} args\n */\n function format (format, args) {\n return format.replace(/\\{(\\d+)\\}/g, function(m, n){\n return args[n] !== undefined ? args[n] : m;\n });\n }\n\n /**\n * @param {HTMLElement} element Code block.\n * @param {String} attrName Attribute name.\n * @returns {String} Attribute value or empty.\n */\n function getAttribute (element, attrName) {\n return element.hasAttribute(attrName) ? element.getAttribute(attrName) : null;\n }\n\n /**\n * @param {String} str Source string.\n * @param {Number} fallback Fallback value.\n * @returns Parsed number or fallback value.\n */\n function toNumber (str, fallback) {\n if (!str) return fallback;\n var number = Number(str);\n return isFinite(number) ? number : fallback;\n }\n\n}(window, document));\n"],"names":["w","d","css","TABLE_NAME","LINE_NAME","CODE_BLOCK_NAME","NUMBERS_BLOCK_NAME","NUMBER_LINE_NAME","DATA_ATTR_NAME","BREAK_LINE_REGEXP","documentReady","options","blocks","querySelectorAll","i","hasOwnProperty","classList","contains","lineNumbersBlock","e","console","error","element","func","innerHTML","lineNumbersInternal","setTimeout","internalOptions","singleLine","getSingleLineOption","startFrom","getStartFromOption","mapOptions","duplicateMultilineNodes","inputHtml","lines","getLines","length","trim","pop","html","l","format","addLineNumbersBlockFor","isFinite","value","attrName","hasAttribute","getAttribute","str","fallback","number","Number","toNumber","nodes","childNodes","node","child","textContent","match","duplicateMultilineNode","parentNode","className","test","result","text","split","args","replace","m","n","undefined","hljs","initLineNumbersOnLoad","readyState","addEventListener","lineNumbersValue","document","createElement","type","getElementsByTagName","appendChild","selectionText","selection","window","getSelection","domElt","curElt","indexOf","isHljsLnCodeDescendant","anchorNode","navigator","userAgent","toString","tdAnchor","nodeName","tdFocus","focusNode","firstLineNumber","parseInt","dataset","lineNumber","lastLineNumber","firstLineText","lastLineText","tmp","slice","lastIndexOf","selectedText","hljsLnTable","hljsLnDomElt","getHljsLnTable","codeLineSel","querySelector","edgeGetSelectedCodeLines","clipboardData","setData","preventDefault"],"sourceRoot":""}