quikchat 1.1.17 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +167 -276
- package/dist/build-manifest.json +157 -0
- package/dist/quikchat-md-full.cjs.js +2742 -0
- package/dist/quikchat-md-full.cjs.js.map +1 -0
- package/dist/quikchat-md-full.cjs.min.js +10 -0
- package/dist/quikchat-md-full.cjs.min.js.map +1 -0
- package/dist/quikchat-md-full.esm.js +2740 -0
- package/dist/quikchat-md-full.esm.js.map +1 -0
- package/dist/quikchat-md-full.esm.min.js +10 -0
- package/dist/quikchat-md-full.esm.min.js.map +1 -0
- package/dist/quikchat-md-full.umd.js +2748 -0
- package/dist/quikchat-md-full.umd.js.map +1 -0
- package/dist/quikchat-md-full.umd.min.js +10 -0
- package/dist/quikchat-md-full.umd.min.js.map +1 -0
- package/dist/quikchat-md.cjs.js +1641 -0
- package/dist/quikchat-md.cjs.js.map +1 -0
- package/dist/quikchat-md.cjs.min.js +8 -0
- package/dist/quikchat-md.cjs.min.js.map +1 -0
- package/dist/quikchat-md.esm.js +1639 -0
- package/dist/quikchat-md.esm.js.map +1 -0
- package/dist/quikchat-md.esm.min.js +8 -0
- package/dist/quikchat-md.esm.min.js.map +1 -0
- package/dist/quikchat-md.umd.js +1647 -0
- package/dist/quikchat-md.umd.js.map +1 -0
- package/dist/quikchat-md.umd.min.js +8 -0
- package/dist/quikchat-md.umd.min.js.map +1 -0
- package/dist/quikchat.cjs.js +454 -1729
- package/dist/quikchat.cjs.js.map +1 -1
- package/dist/quikchat.cjs.min.js +1 -1
- package/dist/quikchat.cjs.min.js.map +1 -1
- package/dist/quikchat.css +753 -226
- package/dist/quikchat.esm.js +454 -1729
- package/dist/quikchat.esm.js.map +1 -1
- package/dist/quikchat.esm.min.js +1 -1
- package/dist/quikchat.esm.min.js.map +1 -1
- package/dist/quikchat.min.css +1 -1
- package/dist/quikchat.react.js +63 -0
- package/dist/quikchat.umd.js +454 -1729
- package/dist/quikchat.umd.js.map +1 -1
- package/dist/quikchat.umd.min.js +1 -1
- package/dist/quikchat.umd.min.js.map +1 -1
- package/package.json +59 -39
- package/dist/quikchat.d.ts +0 -194
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quikchat-md.umd.js","sources":["../src/quikchat.js","../node_modules/quikdown/dist/quikdown.esm.js","../src/quikchat-md.js"],"sourcesContent":["\nclass quikchat {\n /**\n *\n * @param string or DOM element parentElement\n * @param {*} meta\n */\n constructor(parentElement, onSend = () => { }, options = {}) {\n const defaultOpts = {\n theme: 'quikchat-theme-light',\n trackHistory: true,\n showTimestamps: false,\n titleArea: { title: \"Chat\", show: false, align: \"center\" },\n messagesArea: { alternating: true },\n };\n const meta = { ...defaultOpts, ...options }; // merge options with defaults\n\n if (typeof parentElement === 'string') {\n parentElement = document.querySelector(parentElement);\n }\n this._parentElement = parentElement;\n this._theme = meta.theme;\n this._onSend = onSend ? onSend : () => { }; // call back function for onSend\n this._messageFormatter = meta.messageFormatter || null;\n this._sanitize = meta.sanitize || false;\n this._createWidget();\n // title area\n if (meta.titleArea) {\n this.titleAreaSetContents(meta.titleArea.title, meta.titleArea.align);\n if (meta.titleArea.show === true) {\n this.titleAreaShow();\n } else {\n this.titleAreaHide();\n }\n }\n // messages area\n if (meta.messagesArea) {\n this.messagesAreaAlternateColors(meta.messagesArea.alternating);\n }\n // timestamps\n if (meta.showTimestamps) {\n this.messagesAreaShowTimestamps(true);\n }\n // direction (ltr/rtl)\n if (meta.direction) {\n this.setDirection(meta.direction);\n }\n // plumbing\n this._attachEventListeners();\n this.trackHistory = meta.trackHistory !== false;\n this._historyLimit = 10000000;\n this._history = [];\n }\n\n _createWidget() {\n const widgetHTML =\n `\n <div class=\"quikchat-base ${this.theme}\">\n <div class=\"quikchat-title-area\"></div>\n <div class=\"quikchat-messages-wrapper\"><div class=\"quikchat-messages-area\" role=\"log\" aria-live=\"polite\" aria-label=\"Chat messages\"></div><button class=\"quikchat-scroll-bottom\" aria-label=\"Scroll to bottom\"></button></div>\n <div class=\"quikchat-input-area\">\n <textarea class=\"quikchat-input-textbox\" rows=\"1\" aria-label=\"Type a message\"></textarea>\n <button class=\"quikchat-input-send-btn\">Send</button>\n </div>\n </div>\n `;\n\n this._parentElement.innerHTML = widgetHTML;\n this._chatWidget = this._parentElement.querySelector('.quikchat-base');\n this._titleArea = this._chatWidget.querySelector('.quikchat-title-area');\n this._messagesWrapper = this._chatWidget.querySelector('.quikchat-messages-wrapper');\n this._messagesArea = this._chatWidget.querySelector('.quikchat-messages-area');\n this._scrollBottomBtn = this._messagesWrapper.querySelector('.quikchat-scroll-bottom');\n this._inputArea = this._chatWidget.querySelector('.quikchat-input-area');\n this._textEntry = this._inputArea.querySelector('.quikchat-input-textbox');\n this._sendButton = this._inputArea.querySelector('.quikchat-input-send-btn');\n this.msgid = 0;\n }\n\n /**\n * Attach event listeners to the widget\n */\n _attachEventListeners() {\n this._sendButton.addEventListener('click', () => {\n const text = this._textEntry.value.trim();\n if (text === '') return;\n this._onSend(this, text);\n });\n this._textEntry.addEventListener('keydown', (event) => {\n // Check if Shift + Enter is pressed\n if (event.shiftKey && event.keyCode === 13) {\n event.preventDefault();\n const text = this._textEntry.value.trim();\n if (text === '') return;\n this._onSend(this, text);\n }\n });\n\n // Auto-grow textarea\n this._textEntry.addEventListener('input', () => this._autoGrowTextarea());\n\n this._messagesArea.addEventListener('scroll', () => {\n const { scrollTop, scrollHeight, clientHeight } = this._messagesArea;\n this.userScrolledUp = scrollTop + clientHeight < scrollHeight - 1;\n this._updateScrollBottomBtn();\n });\n\n // Scroll-to-bottom button\n this._scrollBottomBtn.addEventListener('click', () => this.scrollToBottom());\n\n // Ctrl+End to scroll to bottom\n this._chatWidget.addEventListener('keydown', (event) => {\n if (event.ctrlKey && event.key === 'End') {\n event.preventDefault();\n this.scrollToBottom();\n }\n });\n\n // Use ResizeObserver to detect parent container resize\n if (typeof ResizeObserver !== 'undefined') {\n this._resizeObserver = new ResizeObserver(() => this._handleContainerResize());\n this._resizeObserver.observe(this._parentElement);\n }\n }\n\n // set the onSend function callback.\n setCallbackOnSend(callback) {\n this._onSend = callback;\n }\n // set a callback for everytime a message is added (listener)\n setCallbackonMessageAdded(callback) {\n this._onMessageAdded = callback;\n }\n setCallbackonMessageAppend(callback) {\n this._onMessageAppend = callback;\n }\n setCallbackonMessageReplace(callback) {\n this._onMessageReplace = callback;\n }\n setCallbackonMessageDelete(callback) {\n this._onMessageDelete = callback;\n }\n\n // Public methods\n titleAreaToggle() {\n if (this._titleArea.style.display === 'none') {\n this.titleAreaShow();\n } else {\n this.titleAreaHide();\n }\n }\n\n titleAreaShow() {\n this._titleArea.style.display = '';\n }\n\n titleAreaHide() {\n this._titleArea.style.display = 'none';\n }\n\n titleAreaSetContents(title, align = 'center') {\n this._titleArea.innerHTML = title;\n this._titleArea.style.textAlign = align;\n }\n\n titleAreaGetContents() {\n return this._titleArea.innerHTML;\n }\n\n inputAreaToggle() {\n if (this._inputArea.style.display === 'none') {\n this.inputAreaShow();\n } else {\n this.inputAreaHide();\n }\n }\n\n inputAreaShow() {\n this._inputArea.style.display = '';\n }\n\n inputAreaHide() {\n this._inputArea.style.display = 'none';\n }\n\n inputAreaSetEnabled(enabled) {\n this._textEntry.disabled = !enabled;\n this._sendButton.disabled = !enabled;\n }\n\n inputAreaSetButtonText(text) {\n this._sendButton.textContent = text;\n }\n\n inputAreaGetButtonText() {\n return this._sendButton.textContent;\n }\n\n setDirection(dir) {\n const d = dir === 'rtl' ? 'rtl' : 'ltr';\n this._chatWidget.setAttribute('dir', d);\n if (d === 'rtl') {\n this._chatWidget.classList.add('quikchat-rtl');\n } else {\n this._chatWidget.classList.remove('quikchat-rtl');\n }\n }\n\n getDirection() {\n return this._chatWidget.getAttribute('dir') || 'ltr';\n }\n\n _handleContainerResize() {\n // Layout is handled by CSS flexbox — no JS height calculation needed.\n // This hook exists for future use or custom resize callbacks.\n }\n\n scrollToBottom() {\n this._messagesArea.scrollTop = this._messagesArea.scrollHeight;\n this.userScrolledUp = false;\n this._updateScrollBottomBtn();\n }\n\n _updateScrollBottomBtn() {\n if (this.userScrolledUp) {\n this._scrollBottomBtn.classList.add('quikchat-scroll-bottom-visible');\n } else {\n this._scrollBottomBtn.classList.remove('quikchat-scroll-bottom-visible');\n }\n }\n\n _autoGrowTextarea() {\n const el = this._textEntry;\n el.style.height = 'auto';\n const maxHeight = parseInt(getComputedStyle(el).getPropertyValue('--quikchat-input-max-height')) || 120;\n el.style.height = Math.min(el.scrollHeight, maxHeight) + 'px';\n el.style.overflowY = el.scrollHeight > maxHeight ? 'auto' : 'hidden';\n }\n\n _formatTimestamp(isoString) {\n const d = new Date(isoString);\n const h = d.getHours();\n const m = String(d.getMinutes()).padStart(2, '0');\n const ampm = h >= 12 ? 'PM' : 'AM';\n const h12 = h % 12 || 12;\n return h12 + ':' + m + ' ' + ampm;\n }\n\n messagesAreaShowTimestamps(show) {\n if (show) {\n this._messagesArea.classList.add('quikchat-show-timestamps');\n } else {\n this._messagesArea.classList.remove('quikchat-show-timestamps');\n }\n }\n\n messagesAreaShowTimestampsGet() {\n return this._messagesArea.classList.contains('quikchat-show-timestamps');\n }\n\n messagesAreaShowTimestampsToggle() {\n this._messagesArea.classList.toggle('quikchat-show-timestamps');\n }\n\n _escapeHTML(str) {\n const div = document.createElement('div');\n div.textContent = str;\n return div.innerHTML;\n }\n\n _processContent(content) {\n if (this._sanitize === true) {\n content = this._escapeHTML(content);\n } else if (typeof this._sanitize === 'function') {\n content = this._sanitize(content);\n }\n if (this._messageFormatter) {\n content = this._messageFormatter(content);\n }\n return content;\n }\n\n //messagesArea functions\n messagesAreaAlternateColors(alt = true) {\n if (alt) {\n this._messagesArea.classList.add('quikchat-messages-area-alt');\n }\n else {\n this._messagesArea.classList.remove('quikchat-messages-area-alt');\n }\n return alt === true;\n }\n messagesAreaAlternateColorsToggle() {\n this._messagesArea.classList.toggle('quikchat-messages-area-alt');\n }\n messagesAreaAlternateColorsGet() {\n return this._messagesArea.classList.contains('quikchat-messages-area-alt');\n }\n // message functions\n messageAddFull(input = { content: \"\", userString: \"user\", align: \"right\", role: \"user\", userID: -1 }) {\n const msgid = this.msgid;\n const messageDiv = document.createElement('div');\n const msgidClass = 'quikchat-msgid-' + String(msgid).padStart(10, '0');\n messageDiv.classList.add('quikchat-message', msgidClass);\n messageDiv.classList.add('quikchat-role-' + (input.role || 'user'));\n messageDiv.classList.add('quikchat-align-' + (input.align || 'right'));\n this.msgid++;\n messageDiv.classList.add(this._messagesArea.children.length % 2 === 1 ? 'quikchat-message-1' : 'quikchat-message-2');\n\n // Visibility: default true, hidden messages get display:none\n const visible = input.visible !== false;\n if (!visible) {\n messageDiv.style.display = 'none';\n }\n\n // Tags: array of strings for group-based visibility control\n const tags = Array.isArray(input.tags) ? input.tags.slice() : [];\n\n const userDiv = document.createElement('div');\n userDiv.classList.add('quikchat-user-label');\n userDiv.style.textAlign = input.align;\n userDiv.innerHTML = input.userString;\n\n const contentDiv = document.createElement('div');\n contentDiv.classList.add('quikchat-message-content');\n contentDiv.style.textAlign = input.align;\n contentDiv.innerHTML = this._processContent(input.content);\n\n const timestamp = new Date().toISOString();\n const timestampSpan = document.createElement('span');\n timestampSpan.classList.add('quikchat-timestamp');\n timestampSpan.textContent = this._formatTimestamp(timestamp);\n\n messageDiv.appendChild(userDiv);\n messageDiv.appendChild(contentDiv);\n messageDiv.appendChild(timestampSpan);\n this._messagesArea.appendChild(messageDiv);\n\n // Scroll to the last message only if the user is not actively scrolling up\n if (!this.userScrolledUp) {\n this._messagesArea.scrollTop = this._messagesArea.scrollHeight;\n }\n\n this._textEntry.value = '';\n this._autoGrowTextarea();\n const updatedtime = timestamp;\n\n if (this.trackHistory) {\n this._history.push({ msgid, ...input, visible, tags, timestamp, updatedtime, messageDiv });\n if (this._history.length > this._historyLimit) {\n this._history.shift();\n }\n }\n\n if (this._onMessageAdded) {\n this._onMessageAdded(this, msgid);\n }\n\n return msgid;\n }\n\n\n messageAddNew(content = \"\", userString = \"user\", align = \"right\", role = \"user\") {\n return this.messageAddFull(\n { content: content, userString: userString, align: align, role: role }\n );\n }\n messageRemove(n) {\n let success = false;\n try {\n this._messagesArea.removeChild(this._messagesArea.querySelector(`.quikchat-msgid-${String(n).padStart(10, '0')}`));\n success = true;\n }\n catch (_error) {\n // Message ID not found\n }\n if (success) {\n this._history.splice(this._history.findIndex((item) => item.msgid === n), 1);\n if (this._onMessageDelete) {\n this._onMessageDelete(this, n);\n }\n }\n return success;\n }\n /* returns the message html object from the DOM\n */\n messageGetDOMObject(n) {\n let msg = null;\n try {\n msg = this._messagesArea.querySelector(`.quikchat-msgid-${String(n).padStart(10, '0')}`);\n }\n catch (_error) {\n // Message ID not found\n }\n return msg;\n }\n /* returns the message content only\n */\n messageGetContent(n) {\n let content = \"\";\n try {\n content = this._history.filter((item) => item.msgid === n)[0].content;\n }\n catch (_error) {\n // Message ID not found\n }\n return content;\n }\n\n messageSetVisible(n, visible) {\n const msgEl = this.messageGetDOMObject(n);\n if (!msgEl) return false;\n msgEl.style.display = visible ? '' : 'none';\n const item = this._history.find((entry) => entry.msgid === n);\n if (item) item.visible = visible;\n return true;\n }\n\n messageGetVisible(n) {\n const item = this._history.find((entry) => entry.msgid === n);\n return item ? item.visible !== false : false;\n }\n\n messageToggleVisible(n) {\n const current = this.messageGetVisible(n);\n return this.messageSetVisible(n, !current);\n }\n\n messageSetVisibleByTag(tag, visible) {\n let count = 0;\n for (const item of this._history) {\n if (item.tags && item.tags.includes(tag)) {\n this.messageSetVisible(item.msgid, visible);\n count++;\n }\n }\n return count;\n }\n\n messageGetTags(n) {\n const item = this._history.find((entry) => entry.msgid === n);\n return item && item.tags ? item.tags.slice() : [];\n }\n\n messageSetTags(n, tags) {\n const item = this._history.find((entry) => entry.msgid === n);\n if (!item) return false;\n item.tags = Array.isArray(tags) ? tags.slice() : [];\n return true;\n }\n\n /* append message to the message content\n */\n messageAppendContent(n, content) {\n let success = false;\n try {\n const msgEl = this._messagesArea.querySelector(`.quikchat-msgid-${String(n).padStart(10, '0')}`);\n const item = this._history.filter((entry) => entry.msgid === n)[0];\n item.content += content;\n item.updatedtime = new Date().toISOString();\n msgEl.querySelector('.quikchat-message-content').innerHTML = this._processContent(item.content);\n msgEl.classList.remove('quikchat-typing');\n success = true;\n\n if (!this.userScrolledUp) {\n this._messagesArea.scrollTop = this._messagesArea.scrollHeight;\n }\n if (this._onMessageAppend) {\n this._onMessageAppend(this, n, content);\n }\n } catch (_error) {\n // Message ID not found\n }\n return success;\n }\n\n /* replace message content\n */\n messageReplaceContent(n, content) {\n let success = false;\n try {\n const msgEl = this._messagesArea.querySelector(`.quikchat-msgid-${String(n).padStart(10, '0')}`);\n const item = this._history.filter((entry) => entry.msgid === n)[0];\n item.content = content;\n item.updatedtime = new Date().toISOString();\n msgEl.querySelector('.quikchat-message-content').innerHTML = this._processContent(content);\n msgEl.classList.remove('quikchat-typing');\n success = true;\n\n if (!this.userScrolledUp) {\n this._messagesArea.scrollTop = this._messagesArea.scrollHeight;\n }\n if (this._onMessageReplace) {\n this._onMessageReplace(this, n, content);\n }\n } catch (_error) {\n // Message ID not found\n }\n return success;\n }\n\n messageAddTypingIndicator(userString = '', align = 'left') {\n const msgid = this.messageAddFull({\n content: '',\n userString: userString,\n align: align,\n role: 'assistant',\n });\n const msgEl = this.messageGetDOMObject(msgid);\n msgEl.classList.add('quikchat-typing');\n const contentDiv = msgEl.querySelector('.quikchat-message-content');\n contentDiv.innerHTML = '<span class=\"quikchat-typing-dots\"><span>.</span><span>.</span><span>.</span></span>';\n return msgid;\n }\n\n setMessageFormatter(formatter) {\n this._messageFormatter = formatter;\n }\n\n setSanitize(sanitize) {\n this._sanitize = sanitize;\n }\n\n // history functions\n /**\n *\n * @param {*} n\n * @param {*} m\n * @returns array of history messages\n */\n historyGet(n, m) {\n if (n === undefined) {\n return this._history.slice();\n }\n if (m === undefined) {\n if (n < 0) {\n return this._history.slice(n);\n }\n return this._history.slice(n, n + 1);\n }\n return this._history.slice(n, m);\n }\n\n historyClear() {\n this.msgid = 0;\n this._history = [];\n }\n\n historyGetLength() {\n return this._history.length;\n }\n\n historyGetMessage(n) {\n if (n >= 0 && n < this._history.length) {\n return this._history[n];\n }\n return {};\n }\n\n historyGetMessageContent(n) {\n if (n >= 0 && n < this._history.length) {\n return this._history[n].content;\n }\n return \"\";\n }\n\n historyExport() {\n return this._history.map((item) => ({\n msgid: item.msgid,\n content: item.content,\n userString: item.userString,\n align: item.align,\n role: item.role,\n userID: item.userID,\n visible: item.visible,\n tags: item.tags ? item.tags.slice() : [],\n timestamp: item.timestamp,\n updatedtime: item.updatedtime,\n }));\n }\n\n historyImport(data) {\n // Clear existing messages from DOM and history\n this._messagesArea.innerHTML = '';\n this._history = [];\n this.msgid = 0;\n\n for (const entry of data) {\n this.messageAddFull({\n content: entry.content || '',\n userString: entry.userString || 'user',\n align: entry.align || 'right',\n role: entry.role || 'user',\n userID: entry.userID,\n visible: entry.visible,\n tags: entry.tags,\n });\n }\n }\n\n changeTheme(newTheme) {\n this._chatWidget.classList.remove(this._theme);\n this._chatWidget.classList.add(newTheme);\n this._theme = newTheme;\n }\n\n get theme() {\n return this._theme;\n }\n\n static version() {\n return { \"version\": \"1.2.4\", \"license\": \"BSD-2\", \"url\": \"https://github/deftio/quikchat\" };\n }\n\n /**\n * quikchat.loremIpsum() - Generate a simple string of Lorem Ipsum text (sample typographer's text) of numChars in length.\n * borrowed from github.com/deftio/bitwrench.js\n * @param {number} numChars - The number of characters to generate (random btw 25 and 150 if undefined).\n * @param {number} [startSpot=0] - The starting index in the Lorem Ipsum text. If undefined, a random startSpot will be generated.\n * @param {boolean} [startWithCapitalLetter=true] - If true, capitalize the first character or inject a capital letter if the first character isn't a capital letter.\n *\n * @returns {string} A string of Lorem Ipsum text.\n *\n * @example\n * // Returns 200 characters of Lorem Ipsum starting from index 50\n * loremIpsum(200, 50);\n *\n * @example\n * //Returns a 200 Lorem Ipsum characters starting from a random index\n * loremIpsum(200);\n */\n\n static loremIpsum(numChars, startSpot = undefined, startWithCapitalLetter = true) {\n const loremText = \"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. \";\n\n if (typeof numChars !== \"number\") {\n numChars = Math.floor(Math.random() * 126) + 25;\n }\n\n if (startSpot === undefined) {\n startSpot = Math.floor(Math.random() * loremText.length);\n }\n\n startSpot = startSpot % loremText.length;\n\n // Move startSpot to the next non-whitespace and non-punctuation character\n while (loremText[startSpot] === ' ' || /[.,:;!?]/.test(loremText[startSpot])) {\n startSpot = (startSpot + 1) % loremText.length;\n }\n\n const l = loremText.substring(startSpot) + loremText.substring(0, startSpot);\n\n let s = \"\";\n while (numChars > 0) {\n s += numChars < l.length ? l.substring(0, numChars) : l;\n numChars -= l.length;\n }\n\n if (s[s.length - 1] === \" \") {\n s = s.substring(0, s.length - 1) + \".\"; // always end on non-whitespace. \".\" was chosen arbitrarily.\n }\n\n if (startWithCapitalLetter) {\n s = s[0].toUpperCase() + s.substring(1);\n }\n\n return s;\n };\n\n\n}\n\nexport default quikchat;\n","/**\n * quikdown - Lightweight Markdown Parser\n * @version 1.1.1\n * @license BSD-2-Clause\n * @copyright DeftIO 2025\n */\n/**\n * quikdown - A minimal markdown parser optimized for chat/LLM output\n * Supports tables, code blocks, lists, and common formatting\n * @param {string} markdown - The markdown source text\n * @param {Object} options - Optional configuration object\n * @param {Function} options.fence_plugin - Custom renderer for fenced code blocks\n * (content, fence_string) => html string\n * @param {boolean} options.inline_styles - If true, uses inline styles instead of classes\n * @param {boolean} options.bidirectional - If true, adds data-qd attributes for source tracking\n * @param {boolean} options.lazy_linefeeds - If true, single newlines become <br> tags\n * @returns {string} - The rendered HTML\n */\n\n// Version will be injected at build time \nconst quikdownVersion = '1.1.1';\n\n// Constants for reuse\nconst CLASS_PREFIX = 'quikdown-';\nconst PLACEHOLDER_CB = '§CB';\nconst PLACEHOLDER_IC = '§IC';\n\n// Escape map at module level\nconst ESC_MAP = {'&':'&','<':'<','>':'>','\"':'"',\"'\":'''};\n\n// Single source of truth for all style definitions - optimized\nconst QUIKDOWN_STYLES = {\n h1: 'font-size:2em;font-weight:600;margin:.67em 0;text-align:left',\n h2: 'font-size:1.5em;font-weight:600;margin:.83em 0',\n h3: 'font-size:1.25em;font-weight:600;margin:1em 0',\n h4: 'font-size:1em;font-weight:600;margin:1.33em 0',\n h5: 'font-size:.875em;font-weight:600;margin:1.67em 0',\n h6: 'font-size:.85em;font-weight:600;margin:2em 0',\n pre: 'background:#f4f4f4;padding:10px;border-radius:4px;overflow-x:auto;margin:1em 0',\n code: 'background:#f0f0f0;padding:2px 4px;border-radius:3px;font-family:monospace',\n blockquote: 'border-left:4px solid #ddd;margin-left:0;padding-left:1em',\n table: 'border-collapse:collapse;width:100%;margin:1em 0',\n th: 'border:1px solid #ddd;padding:8px;background-color:#f2f2f2;font-weight:bold;text-align:left',\n td: 'border:1px solid #ddd;padding:8px;text-align:left',\n hr: 'border:none;border-top:1px solid #ddd;margin:1em 0',\n img: 'max-width:100%;height:auto',\n a: 'color:#06c;text-decoration:underline',\n strong: 'font-weight:bold',\n em: 'font-style:italic',\n del: 'text-decoration:line-through',\n ul: 'margin:.5em 0;padding-left:2em',\n ol: 'margin:.5em 0;padding-left:2em',\n li: 'margin:.25em 0',\n // Task list specific styles\n 'task-item': 'list-style:none',\n 'task-checkbox': 'margin-right:.5em'\n};\n\n// Factory function to create getAttr for a given context\nfunction createGetAttr(inline_styles, styles) {\n return function(tag, additionalStyle = '') {\n if (inline_styles) {\n let style = styles[tag];\n if (!style && !additionalStyle) return '';\n \n // Remove default text-align if we're adding a different alignment\n if (additionalStyle && additionalStyle.includes('text-align') && style && style.includes('text-align')) {\n style = style.replace(/text-align:[^;]+;?/, '').trim();\n if (style && !style.endsWith(';')) style += ';';\n }\n \n /* istanbul ignore next - defensive: additionalStyle without style doesn't occur with current tags */\n const fullStyle = additionalStyle ? (style ? `${style}${additionalStyle}` : additionalStyle) : style;\n return ` style=\"${fullStyle}\"`;\n } else {\n const classAttr = ` class=\"${CLASS_PREFIX}${tag}\"`;\n // Apply inline styles for alignment even when using CSS classes\n if (additionalStyle) {\n return `${classAttr} style=\"${additionalStyle}\"`;\n }\n return classAttr;\n }\n };\n}\n\nfunction quikdown(markdown, options = {}) {\n if (!markdown || typeof markdown !== 'string') {\n return '';\n }\n \n const { fence_plugin, inline_styles = false, bidirectional = false, lazy_linefeeds = false } = options;\n const styles = QUIKDOWN_STYLES; // Use module-level styles\n const getAttr = createGetAttr(inline_styles, styles); // Create getAttr once\n\n // Escape HTML entities to prevent XSS\n function escapeHtml(text) {\n return text.replace(/[&<>\"']/g, m => ESC_MAP[m]);\n }\n \n // Helper to add data-qd attributes for bidirectional support\n const dataQd = bidirectional ? (marker) => ` data-qd=\"${escapeHtml(marker)}\"` : () => '';\n \n // Sanitize URLs to prevent XSS attacks\n function sanitizeUrl(url, allowUnsafe = false) {\n /* istanbul ignore next - defensive programming, regex ensures url is never empty */\n if (!url) return '';\n \n // If unsafe URLs are explicitly allowed, return as-is\n if (allowUnsafe) return url;\n \n const trimmedUrl = url.trim();\n const lowerUrl = trimmedUrl.toLowerCase();\n \n // Block dangerous protocols\n const dangerousProtocols = ['javascript:', 'vbscript:', 'data:'];\n \n for (const protocol of dangerousProtocols) {\n if (lowerUrl.startsWith(protocol)) {\n // Exception: Allow data:image/* for images\n if (protocol === 'data:' && lowerUrl.startsWith('data:image/')) {\n return trimmedUrl;\n }\n // Return safe empty link for dangerous protocols\n return '#';\n }\n }\n \n return trimmedUrl;\n }\n\n // Process the markdown in phases\n let html = markdown;\n \n // Phase 1: Extract and protect code blocks and inline code\n const codeBlocks = [];\n const inlineCodes = [];\n \n // Extract fenced code blocks first (supports both ``` and ~~~)\n // Match paired fences - ``` with ``` and ~~~ with ~~~\n // Fence must be at start of line\n html = html.replace(/^(```|~~~)([^\\n]*)\\n([\\s\\S]*?)^\\1$/gm, (match, fence, lang, code) => {\n const placeholder = `${PLACEHOLDER_CB}${codeBlocks.length}§`;\n \n // Trim the language specification\n const langTrimmed = lang ? lang.trim() : '';\n \n // If custom fence plugin is provided, use it (v1.1.0: object format required)\n if (fence_plugin && fence_plugin.render && typeof fence_plugin.render === 'function') {\n codeBlocks.push({\n lang: langTrimmed,\n code: code.trimEnd(),\n custom: true,\n fence: fence,\n hasReverse: !!fence_plugin.reverse\n });\n } else {\n codeBlocks.push({\n lang: langTrimmed,\n code: escapeHtml(code.trimEnd()),\n custom: false,\n fence: fence\n });\n }\n return placeholder;\n });\n \n // Extract inline code\n html = html.replace(/`([^`]+)`/g, (match, code) => {\n const placeholder = `${PLACEHOLDER_IC}${inlineCodes.length}§`;\n inlineCodes.push(escapeHtml(code));\n return placeholder;\n });\n \n // Now escape HTML in the rest of the content\n html = escapeHtml(html);\n \n // Phase 2: Process block elements\n \n // Process tables\n html = processTable(html, getAttr);\n \n // Process headings (supports optional trailing #'s)\n html = html.replace(/^(#{1,6})\\s+(.+?)\\s*#*$/gm, (match, hashes, content) => {\n const level = hashes.length;\n return `<h${level}${getAttr('h' + level)}${dataQd(hashes)}>${content}</h${level}>`;\n });\n \n // Process blockquotes (must handle escaped > since we already escaped HTML)\n html = html.replace(/^>\\s+(.+)$/gm, `<blockquote${getAttr('blockquote')}>$1</blockquote>`);\n // Merge consecutive blockquotes\n html = html.replace(/<\\/blockquote>\\n<blockquote>/g, '\\n');\n \n // Process horizontal rules (allow trailing spaces)\n html = html.replace(/^---+\\s*$/gm, `<hr${getAttr('hr')}>`);\n \n // Process lists\n html = processLists(html, getAttr, inline_styles, bidirectional);\n \n // Phase 3: Process inline elements\n \n // Images (must come before links, with URL sanitization)\n html = html.replace(/!\\[([^\\]]*)\\]\\(([^)]+)\\)/g, (match, alt, src) => {\n const sanitizedSrc = sanitizeUrl(src, options.allow_unsafe_urls);\n const altAttr = bidirectional && alt ? ` data-qd-alt=\"${escapeHtml(alt)}\"` : '';\n const srcAttr = bidirectional ? ` data-qd-src=\"${escapeHtml(src)}\"` : '';\n return `<img${getAttr('img')} src=\"${sanitizedSrc}\" alt=\"${alt}\"${altAttr}${srcAttr}${dataQd('!')}>`;\n });\n \n // Links (with URL sanitization)\n html = html.replace(/\\[([^\\]]+)\\]\\(([^)]+)\\)/g, (match, text, href) => {\n // Sanitize URL to prevent XSS\n const sanitizedHref = sanitizeUrl(href, options.allow_unsafe_urls);\n const isExternal = /^https?:\\/\\//i.test(sanitizedHref);\n const rel = isExternal ? ' rel=\"noopener noreferrer\"' : '';\n const textAttr = bidirectional ? ` data-qd-text=\"${escapeHtml(text)}\"` : '';\n return `<a${getAttr('a')} href=\"${sanitizedHref}\"${rel}${textAttr}${dataQd('[')}>${text}</a>`;\n });\n \n // Autolinks - convert bare URLs to clickable links\n html = html.replace(/(^|\\s)(https?:\\/\\/[^\\s<]+)/g, (match, prefix, url) => {\n const sanitizedUrl = sanitizeUrl(url, options.allow_unsafe_urls);\n return `${prefix}<a${getAttr('a')} href=\"${sanitizedUrl}\" rel=\"noopener noreferrer\">${url}</a>`;\n });\n \n // Process inline formatting (bold, italic, strikethrough)\n const inlinePatterns = [\n [/\\*\\*(.+?)\\*\\*/g, 'strong', '**'],\n [/__(.+?)__/g, 'strong', '__'],\n [/(?<!\\*)\\*(?!\\*)(.+?)(?<!\\*)\\*(?!\\*)/g, 'em', '*'],\n [/(?<!_)_(?!_)(.+?)(?<!_)_(?!_)/g, 'em', '_'],\n [/~~(.+?)~~/g, 'del', '~~']\n ];\n \n inlinePatterns.forEach(([pattern, tag, marker]) => {\n html = html.replace(pattern, `<${tag}${getAttr(tag)}${dataQd(marker)}>$1</${tag}>`);\n });\n \n // Line breaks\n if (lazy_linefeeds) {\n // Lazy linefeeds: single newline becomes <br> (except between paragraphs and after/before block elements)\n const blocks = [];\n let bi = 0;\n \n // Protect tables and lists \n html = html.replace(/<(table|[uo]l)[^>]*>[\\s\\S]*?<\\/\\1>/g, m => {\n blocks[bi] = m;\n return `§B${bi++}§`;\n });\n \n // Handle paragraphs and block elements\n html = html.replace(/\\n\\n+/g, '§P§')\n // After block elements\n .replace(/(<\\/(?:h[1-6]|blockquote|pre)>)\\n/g, '$1§N§')\n .replace(/(<(?:h[1-6]|blockquote|pre|hr)[^>]*>)\\n/g, '$1§N§')\n // Before block elements \n .replace(/\\n(<(?:h[1-6]|blockquote|pre|hr)[^>]*>)/g, '§N§$1')\n .replace(/\\n(§B\\d+§)/g, '§N§$1')\n .replace(/(§B\\d+§)\\n/g, '$1§N§')\n // Convert remaining newlines\n .replace(/\\n/g, `<br${getAttr('br')}>`)\n // Restore\n .replace(/§N§/g, '\\n')\n .replace(/§P§/g, '</p><p>');\n \n // Restore protected blocks\n blocks.forEach((b, i) => html = html.replace(`§B${i}§`, b));\n \n html = '<p>' + html + '</p>';\n } else {\n // Standard: two spaces at end of line for line breaks\n html = html.replace(/ $/gm, `<br${getAttr('br')}>`);\n \n // Paragraphs (double newlines)\n // Don't add </p> after block elements (they're not in paragraphs)\n html = html.replace(/\\n\\n+/g, (match, offset) => {\n // Check if we're after a block element closing tag\n const before = html.substring(0, offset);\n if (before.match(/<\\/(h[1-6]|blockquote|ul|ol|table|pre|hr)>$/)) {\n return '<p>'; // Just open a new paragraph\n }\n return '</p><p>'; // Normal paragraph break\n });\n html = '<p>' + html + '</p>';\n }\n \n // Clean up empty paragraphs and unwrap block elements\n const cleanupPatterns = [\n [/<p><\\/p>/g, ''],\n [/<p>(<h[1-6][^>]*>)/g, '$1'],\n [/(<\\/h[1-6]>)<\\/p>/g, '$1'],\n [/<p>(<blockquote[^>]*>)/g, '$1'],\n [/(<\\/blockquote>)<\\/p>/g, '$1'],\n [/<p>(<ul[^>]*>|<ol[^>]*>)/g, '$1'],\n [/(<\\/ul>|<\\/ol>)<\\/p>/g, '$1'],\n [/<p>(<hr[^>]*>)<\\/p>/g, '$1'],\n [/<p>(<table[^>]*>)/g, '$1'],\n [/(<\\/table>)<\\/p>/g, '$1'],\n [/<p>(<pre[^>]*>)/g, '$1'],\n [/(<\\/pre>)<\\/p>/g, '$1'],\n [new RegExp(`<p>(${PLACEHOLDER_CB}\\\\d+§)<\\/p>`, 'g'), '$1']\n ];\n \n cleanupPatterns.forEach(([pattern, replacement]) => {\n html = html.replace(pattern, replacement);\n });\n \n // Fix orphaned closing </p> tags after block elements\n // When a paragraph follows a block element, ensure it has opening <p>\n html = html.replace(/(<\\/(?:h[1-6]|blockquote|ul|ol|table|pre|hr)>)\\n([^<])/g, '$1\\n<p>$2');\n \n // Phase 4: Restore code blocks and inline code\n \n // Restore code blocks\n codeBlocks.forEach((block, i) => {\n let replacement;\n \n if (block.custom && fence_plugin && fence_plugin.render) {\n // Use custom fence plugin (v1.1.0: object format with render function)\n replacement = fence_plugin.render(block.code, block.lang);\n \n // If plugin returns undefined, fall back to default rendering\n if (replacement === undefined) {\n const langClass = !inline_styles && block.lang ? ` class=\"language-${block.lang}\"` : '';\n const codeAttr = inline_styles ? getAttr('code') : langClass;\n const langAttr = bidirectional && block.lang ? ` data-qd-lang=\"${escapeHtml(block.lang)}\"` : '';\n const fenceAttr = bidirectional ? ` data-qd-fence=\"${escapeHtml(block.fence)}\"` : '';\n replacement = `<pre${getAttr('pre')}${fenceAttr}${langAttr}><code${codeAttr}>${escapeHtml(block.code)}</code></pre>`;\n } else if (bidirectional) {\n // If bidirectional and plugin provided HTML, add data attributes for roundtrip\n replacement = replacement.replace(/^<(\\w+)/, \n `<$1 data-qd-fence=\"${escapeHtml(block.fence)}\" data-qd-lang=\"${escapeHtml(block.lang)}\" data-qd-source=\"${escapeHtml(block.code)}\"`);\n }\n } else {\n // Default rendering\n const langClass = !inline_styles && block.lang ? ` class=\"language-${block.lang}\"` : '';\n const codeAttr = inline_styles ? getAttr('code') : langClass;\n const langAttr = bidirectional && block.lang ? ` data-qd-lang=\"${escapeHtml(block.lang)}\"` : '';\n const fenceAttr = bidirectional ? ` data-qd-fence=\"${escapeHtml(block.fence)}\"` : '';\n replacement = `<pre${getAttr('pre')}${fenceAttr}${langAttr}><code${codeAttr}>${block.code}</code></pre>`;\n }\n \n const placeholder = `${PLACEHOLDER_CB}${i}§`;\n html = html.replace(placeholder, replacement);\n });\n \n // Restore inline code\n inlineCodes.forEach((code, i) => {\n const placeholder = `${PLACEHOLDER_IC}${i}§`;\n html = html.replace(placeholder, `<code${getAttr('code')}${dataQd('`')}>${code}</code>`);\n });\n \n return html.trim();\n}\n\n/**\n * Process inline markdown formatting\n */\nfunction processInlineMarkdown(text, getAttr) {\n \n // Process inline formatting patterns\n const patterns = [\n [/\\*\\*(.+?)\\*\\*/g, 'strong'],\n [/__(.+?)__/g, 'strong'],\n [/(?<!\\*)\\*(?!\\*)(.+?)(?<!\\*)\\*(?!\\*)/g, 'em'],\n [/(?<!_)_(?!_)(.+?)(?<!_)_(?!_)/g, 'em'],\n [/~~(.+?)~~/g, 'del'],\n [/`([^`]+)`/g, 'code']\n ];\n \n patterns.forEach(([pattern, tag]) => {\n text = text.replace(pattern, `<${tag}${getAttr(tag)}>$1</${tag}>`);\n });\n \n return text;\n}\n\n/**\n * Process markdown tables\n */\nfunction processTable(text, getAttr) {\n const lines = text.split('\\n');\n const result = [];\n let inTable = false;\n let tableLines = [];\n \n for (let i = 0; i < lines.length; i++) {\n const line = lines[i].trim();\n \n // Check if this line looks like a table row (with or without trailing |)\n if (line.includes('|') && (line.startsWith('|') || /[^\\\\|]/.test(line))) {\n if (!inTable) {\n inTable = true;\n tableLines = [];\n }\n tableLines.push(line);\n } else {\n // Not a table line\n if (inTable) {\n // Process the accumulated table\n const tableHtml = buildTable(tableLines, getAttr);\n if (tableHtml) {\n result.push(tableHtml);\n } else {\n // Not a valid table, restore original lines\n result.push(...tableLines);\n }\n inTable = false;\n tableLines = [];\n }\n result.push(lines[i]);\n }\n }\n \n // Handle table at end of text\n if (inTable && tableLines.length > 0) {\n const tableHtml = buildTable(tableLines, getAttr);\n if (tableHtml) {\n result.push(tableHtml);\n } else {\n result.push(...tableLines);\n }\n }\n \n return result.join('\\n');\n}\n\n/**\n * Build an HTML table from markdown table lines\n */\nfunction buildTable(lines, getAttr) {\n \n if (lines.length < 2) return null;\n \n // Check for separator line (second line should be the separator)\n let separatorIndex = -1;\n for (let i = 1; i < lines.length; i++) {\n // Support separator with or without leading/trailing pipes\n if (/^\\|?[\\s\\-:|]+\\|?$/.test(lines[i]) && lines[i].includes('-')) {\n separatorIndex = i;\n break;\n }\n }\n \n if (separatorIndex === -1) return null;\n \n const headerLines = lines.slice(0, separatorIndex);\n const bodyLines = lines.slice(separatorIndex + 1);\n \n // Parse alignment from separator\n const separator = lines[separatorIndex];\n // Handle pipes at start/end or not\n const separatorCells = separator.trim().replace(/^\\|/, '').replace(/\\|$/, '').split('|');\n const alignments = separatorCells.map(cell => {\n const trimmed = cell.trim();\n if (trimmed.startsWith(':') && trimmed.endsWith(':')) return 'center';\n if (trimmed.endsWith(':')) return 'right';\n return 'left';\n });\n \n let html = `<table${getAttr('table')}>\\n`;\n \n // Build header\n // Note: headerLines will always have length > 0 since separatorIndex starts from 1\n html += `<thead${getAttr('thead')}>\\n`;\n headerLines.forEach(line => {\n html += `<tr${getAttr('tr')}>\\n`;\n // Handle pipes at start/end or not\n const cells = line.trim().replace(/^\\|/, '').replace(/\\|$/, '').split('|');\n cells.forEach((cell, i) => {\n const alignStyle = alignments[i] && alignments[i] !== 'left' ? `text-align:${alignments[i]}` : '';\n const processedCell = processInlineMarkdown(cell.trim(), getAttr);\n html += `<th${getAttr('th', alignStyle)}>${processedCell}</th>\\n`;\n });\n html += '</tr>\\n';\n });\n html += '</thead>\\n';\n \n // Build body\n if (bodyLines.length > 0) {\n html += `<tbody${getAttr('tbody')}>\\n`;\n bodyLines.forEach(line => {\n html += `<tr${getAttr('tr')}>\\n`;\n // Handle pipes at start/end or not\n const cells = line.trim().replace(/^\\|/, '').replace(/\\|$/, '').split('|');\n cells.forEach((cell, i) => {\n const alignStyle = alignments[i] && alignments[i] !== 'left' ? `text-align:${alignments[i]}` : '';\n const processedCell = processInlineMarkdown(cell.trim(), getAttr);\n html += `<td${getAttr('td', alignStyle)}>${processedCell}</td>\\n`;\n });\n html += '</tr>\\n';\n });\n html += '</tbody>\\n';\n }\n \n html += '</table>';\n return html;\n}\n\n/**\n * Process markdown lists (ordered and unordered)\n */\nfunction processLists(text, getAttr, inline_styles, bidirectional) {\n \n const lines = text.split('\\n');\n const result = [];\n let listStack = []; // Track nested lists\n \n // Helper to escape HTML for data-qd attributes\n const escapeHtml = (text) => text.replace(/[&<>\"']/g, m => ({'&':'&','<':'<','>':'>','\"':'"',\"'\":'''})[m]);\n const dataQd = bidirectional ? (marker) => ` data-qd=\"${escapeHtml(marker)}\"` : () => '';\n \n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n const match = line.match(/^(\\s*)([*\\-+]|\\d+\\.)\\s+(.+)$/);\n \n if (match) {\n const [, indent, marker, content] = match;\n const level = Math.floor(indent.length / 2);\n const isOrdered = /^\\d+\\./.test(marker);\n const listType = isOrdered ? 'ol' : 'ul';\n \n // Check for task list items\n let listItemContent = content;\n let taskListClass = '';\n const taskMatch = content.match(/^\\[([x ])\\]\\s+(.*)$/i);\n if (taskMatch && !isOrdered) {\n const [, checked, taskContent] = taskMatch;\n const isChecked = checked.toLowerCase() === 'x';\n const checkboxAttr = inline_styles \n ? ' style=\"margin-right:.5em\"' \n : ` class=\"${CLASS_PREFIX}task-checkbox\"`;\n listItemContent = `<input type=\"checkbox\"${checkboxAttr}${isChecked ? ' checked' : ''} disabled> ${taskContent}`;\n taskListClass = inline_styles ? ' style=\"list-style:none\"' : ` class=\"${CLASS_PREFIX}task-item\"`;\n }\n \n // Close deeper levels\n while (listStack.length > level + 1) {\n const list = listStack.pop();\n result.push(`</${list.type}>`);\n }\n \n // Open new level if needed\n if (listStack.length === level) {\n // Need to open a new list\n listStack.push({ type: listType, level });\n result.push(`<${listType}${getAttr(listType)}>`);\n } else if (listStack.length === level + 1) {\n // Check if we need to switch list type\n const currentList = listStack[listStack.length - 1];\n if (currentList.type !== listType) {\n result.push(`</${currentList.type}>`);\n listStack.pop();\n listStack.push({ type: listType, level });\n result.push(`<${listType}${getAttr(listType)}>`);\n }\n }\n \n const liAttr = taskListClass || getAttr('li');\n result.push(`<li${liAttr}${dataQd(marker)}>${listItemContent}</li>`);\n } else {\n // Not a list item, close all lists\n while (listStack.length > 0) {\n const list = listStack.pop();\n result.push(`</${list.type}>`);\n }\n result.push(line);\n }\n }\n \n // Close any remaining lists\n while (listStack.length > 0) {\n const list = listStack.pop();\n result.push(`</${list.type}>`);\n }\n \n return result.join('\\n');\n}\n\n/**\n * Emit CSS styles for quikdown elements\n * @param {string} prefix - Optional class prefix (default: 'quikdown-')\n * @param {string} theme - Optional theme: 'light' (default) or 'dark'\n * @returns {string} CSS string with quikdown styles\n */\nquikdown.emitStyles = function(prefix = 'quikdown-', theme = 'light') {\n const styles = QUIKDOWN_STYLES;\n \n // Define theme color overrides\n const themeOverrides = {\n dark: {\n '#f4f4f4': '#2a2a2a', // pre background\n '#f0f0f0': '#2a2a2a', // code background\n '#f2f2f2': '#2a2a2a', // th background\n '#ddd': '#3a3a3a', // borders\n '#06c': '#6db3f2', // links\n _textColor: '#e0e0e0'\n },\n light: {\n _textColor: '#333' // Explicit text color for light theme\n }\n };\n \n let css = '';\n for (const [tag, style] of Object.entries(styles)) {\n let themedStyle = style;\n \n // Apply theme overrides if dark theme\n if (theme === 'dark' && themeOverrides.dark) {\n // Replace colors\n for (const [oldColor, newColor] of Object.entries(themeOverrides.dark)) {\n if (!oldColor.startsWith('_')) {\n themedStyle = themedStyle.replace(new RegExp(oldColor, 'g'), newColor);\n }\n }\n \n // Add text color for certain elements in dark theme\n const needsTextColor = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'td', 'li', 'blockquote'];\n if (needsTextColor.includes(tag)) {\n themedStyle += `;color:${themeOverrides.dark._textColor}`;\n }\n } else if (theme === 'light' && themeOverrides.light) {\n // Add explicit text color for light theme elements too\n const needsTextColor = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'td', 'li', 'blockquote'];\n if (needsTextColor.includes(tag)) {\n themedStyle += `;color:${themeOverrides.light._textColor}`;\n }\n }\n \n css += `.${prefix}${tag} { ${themedStyle} }\\n`;\n }\n \n return css;\n};\n\n/**\n * Configure quikdown with options and return a function\n * @param {Object} options - Configuration options\n * @returns {Function} Configured quikdown function\n */\nquikdown.configure = function(options) {\n return function(markdown) {\n return quikdown(markdown, options);\n };\n};\n\n/**\n * Version information\n */\nquikdown.version = quikdownVersion;\n\n// Export for both CommonJS and ES6\n/* istanbul ignore next */\nif (typeof module !== 'undefined' && module.exports) {\n module.exports = quikdown;\n}\n\n// For browser global\n/* istanbul ignore next */\nif (typeof window !== 'undefined') {\n window.quikdown = quikdown;\n}\n\nexport { quikdown as default };\n","import quikchat from './quikchat.js';\nimport quikdown from 'quikdown';\n\n// Subclass that pre-wires quikdown as the message formatter\nclass quikchatMD extends quikchat {\n constructor(parentElement, onSend, options = {}) {\n if (!options.messageFormatter) {\n options.messageFormatter = (content) => quikdown(content);\n }\n super(parentElement, onSend, options);\n }\n}\n\n// Expose quikdown on the class for direct access\nquikchatMD.quikdown = quikdown;\n\nexport default quikchatMD;\n"],"names":["quikchat","parentElement","onSend","arguments","length","undefined","options","_classCallCheck","defaultOpts","theme","trackHistory","showTimestamps","titleArea","title","show","align","messagesArea","alternating","meta","_objectSpread","document","querySelector","_parentElement","_theme","_onSend","_messageFormatter","messageFormatter","_sanitize","sanitize","_createWidget","titleAreaSetContents","titleAreaShow","titleAreaHide","messagesAreaAlternateColors","messagesAreaShowTimestamps","direction","setDirection","_attachEventListeners","_historyLimit","_history","_createClass","key","value","widgetHTML","concat","innerHTML","_chatWidget","_titleArea","_messagesWrapper","_messagesArea","_scrollBottomBtn","_inputArea","_textEntry","_sendButton","msgid","_this","addEventListener","text","trim","event","shiftKey","keyCode","preventDefault","_autoGrowTextarea","_this$_messagesArea","scrollTop","scrollHeight","clientHeight","userScrolledUp","_updateScrollBottomBtn","scrollToBottom","ctrlKey","ResizeObserver","_resizeObserver","_handleContainerResize","observe","setCallbackOnSend","callback","setCallbackonMessageAdded","_onMessageAdded","setCallbackonMessageAppend","_onMessageAppend","setCallbackonMessageReplace","_onMessageReplace","setCallbackonMessageDelete","_onMessageDelete","titleAreaToggle","style","display","textAlign","titleAreaGetContents","inputAreaToggle","inputAreaShow","inputAreaHide","inputAreaSetEnabled","enabled","disabled","inputAreaSetButtonText","textContent","inputAreaGetButtonText","dir","d","setAttribute","classList","add","remove","getDirection","getAttribute","el","height","maxHeight","parseInt","getComputedStyle","getPropertyValue","Math","min","overflowY","_formatTimestamp","isoString","Date","h","getHours","m","String","getMinutes","padStart","ampm","h12","messagesAreaShowTimestampsGet","contains","messagesAreaShowTimestampsToggle","toggle","_escapeHTML","str","div","createElement","_processContent","content","alt","messagesAreaAlternateColorsToggle","messagesAreaAlternateColorsGet","messageAddFull","input","userString","role","userID","messageDiv","msgidClass","children","visible","tags","Array","isArray","slice","userDiv","contentDiv","timestamp","toISOString","timestampSpan","appendChild","updatedtime","push","shift","messageAddNew","messageRemove","n","success","removeChild","_error","splice","findIndex","item","messageGetDOMObject","msg","messageGetContent","filter","messageSetVisible","msgEl","find","entry","messageGetVisible","messageToggleVisible","current","messageSetVisibleByTag","tag","count","_iterator","_createForOfIteratorHelper","_step","s","done","includes","err","e","f","messageGetTags","messageSetTags","messageAppendContent","messageReplaceContent","messageAddTypingIndicator","setMessageFormatter","formatter","setSanitize","historyGet","historyClear","historyGetLength","historyGetMessage","historyGetMessageContent","historyExport","map","historyImport","data","_iterator2","_step2","changeTheme","newTheme","get","version","loremIpsum","numChars","startSpot","startWithCapitalLetter","loremText","floor","random","test","l","substring","toUpperCase","quikchatMD","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,EAAA;EAUjCqO,UAAU,CAACE,QAAQ,GAAGA,QAAQ;;;;;;;;","x_google_ignoreList":[1]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).quikchat=t()}(this,(function(){"use strict";function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,s=Array(t);n<t;n++)s[n]=e[n];return s}function t(e,t,n){return t=o(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,l()?Reflect.construct(t,n||[],o(e).constructor):t.apply(e,n))}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,g(s.key),s)}}function r(e,t,n){return t&&s(e.prototype,t),n&&s(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function i(t,n){var s="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!s){if(Array.isArray(t)||(s=function(t,n){if(t){if("string"==typeof t)return e(t,n);var s={}.toString.call(t).slice(8,-1);return"Object"===s&&t.constructor&&(s=t.constructor.name),"Map"===s||"Set"===s?Array.from(t):"Arguments"===s||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?e(t,n):void 0}}(t))||n){s&&(t=s);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,l=!1;return{s:function(){s=s.call(t)},n:function(){var e=s.next();return o=e.done,e},e:function(e){l=!0,a=e},f:function(){try{o||null==s.return||s.return()}finally{if(l)throw a}}}}function a(e,t,n){return(t=g(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e){return o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},o(e)}function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(l=function(){return!!e})()}function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function h(e,t){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},h(e,t)}function g(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t);if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}var d=function(){return r((function e(t){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n(this,e);var i=u(u({},{theme:"quikchat-theme-light",trackHistory:!0,showTimestamps:!1,titleArea:{title:"Chat",show:!1,align:"center"},messagesArea:{alternating:!0}}),r);"string"==typeof t&&(t=document.querySelector(t)),this._parentElement=t,this._theme=i.theme,this._onSend=s||function(){},this._messageFormatter=i.messageFormatter||null,this._sanitize=i.sanitize||!1,this._createWidget(),i.titleArea&&(this.titleAreaSetContents(i.titleArea.title,i.titleArea.align),!0===i.titleArea.show?this.titleAreaShow():this.titleAreaHide()),i.messagesArea&&this.messagesAreaAlternateColors(i.messagesArea.alternating),i.showTimestamps&&this.messagesAreaShowTimestamps(!0),i.direction&&this.setDirection(i.direction),this._attachEventListeners(),this.trackHistory=!1!==i.trackHistory,this._historyLimit=1e7,this._history=[]}),[{key:"_createWidget",value:function(){var e='\n <div class="quikchat-base '.concat(this.theme,'">\n <div class="quikchat-title-area"></div>\n <div class="quikchat-messages-wrapper"><div class="quikchat-messages-area" role="log" aria-live="polite" aria-label="Chat messages"></div><button class="quikchat-scroll-bottom" aria-label="Scroll to bottom"></button></div>\n <div class="quikchat-input-area">\n <textarea class="quikchat-input-textbox" rows="1" aria-label="Type a message"></textarea>\n <button class="quikchat-input-send-btn">Send</button>\n </div>\n </div>\n ');this._parentElement.innerHTML=e,this._chatWidget=this._parentElement.querySelector(".quikchat-base"),this._titleArea=this._chatWidget.querySelector(".quikchat-title-area"),this._messagesWrapper=this._chatWidget.querySelector(".quikchat-messages-wrapper"),this._messagesArea=this._chatWidget.querySelector(".quikchat-messages-area"),this._scrollBottomBtn=this._messagesWrapper.querySelector(".quikchat-scroll-bottom"),this._inputArea=this._chatWidget.querySelector(".quikchat-input-area"),this._textEntry=this._inputArea.querySelector(".quikchat-input-textbox"),this._sendButton=this._inputArea.querySelector(".quikchat-input-send-btn"),this.msgid=0}},{key:"_attachEventListeners",value:function(){var e=this;this._sendButton.addEventListener("click",(function(){var t=e._textEntry.value.trim();""!==t&&e._onSend(e,t)})),this._textEntry.addEventListener("keydown",(function(t){if(t.shiftKey&&13===t.keyCode){t.preventDefault();var n=e._textEntry.value.trim();if(""===n)return;e._onSend(e,n)}})),this._textEntry.addEventListener("input",(function(){return e._autoGrowTextarea()})),this._messagesArea.addEventListener("scroll",(function(){var t=e._messagesArea,n=t.scrollTop,s=t.scrollHeight,r=t.clientHeight;e.userScrolledUp=n+r<s-1,e._updateScrollBottomBtn()})),this._scrollBottomBtn.addEventListener("click",(function(){return e.scrollToBottom()})),this._chatWidget.addEventListener("keydown",(function(t){t.ctrlKey&&"End"===t.key&&(t.preventDefault(),e.scrollToBottom())})),"undefined"!=typeof ResizeObserver&&(this._resizeObserver=new ResizeObserver((function(){return e._handleContainerResize()})),this._resizeObserver.observe(this._parentElement))}},{key:"setCallbackOnSend",value:function(e){this._onSend=e}},{key:"setCallbackonMessageAdded",value:function(e){this._onMessageAdded=e}},{key:"setCallbackonMessageAppend",value:function(e){this._onMessageAppend=e}},{key:"setCallbackonMessageReplace",value:function(e){this._onMessageReplace=e}},{key:"setCallbackonMessageDelete",value:function(e){this._onMessageDelete=e}},{key:"titleAreaToggle",value:function(){"none"===this._titleArea.style.display?this.titleAreaShow():this.titleAreaHide()}},{key:"titleAreaShow",value:function(){this._titleArea.style.display=""}},{key:"titleAreaHide",value:function(){this._titleArea.style.display="none"}},{key:"titleAreaSetContents",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"center";this._titleArea.innerHTML=e,this._titleArea.style.textAlign=t}},{key:"titleAreaGetContents",value:function(){return this._titleArea.innerHTML}},{key:"inputAreaToggle",value:function(){"none"===this._inputArea.style.display?this.inputAreaShow():this.inputAreaHide()}},{key:"inputAreaShow",value:function(){this._inputArea.style.display=""}},{key:"inputAreaHide",value:function(){this._inputArea.style.display="none"}},{key:"inputAreaSetEnabled",value:function(e){this._textEntry.disabled=!e,this._sendButton.disabled=!e}},{key:"inputAreaSetButtonText",value:function(e){this._sendButton.textContent=e}},{key:"inputAreaGetButtonText",value:function(){return this._sendButton.textContent}},{key:"setDirection",value:function(e){var t="rtl"===e?"rtl":"ltr";this._chatWidget.setAttribute("dir",t),"rtl"===t?this._chatWidget.classList.add("quikchat-rtl"):this._chatWidget.classList.remove("quikchat-rtl")}},{key:"getDirection",value:function(){return this._chatWidget.getAttribute("dir")||"ltr"}},{key:"_handleContainerResize",value:function(){}},{key:"scrollToBottom",value:function(){this._messagesArea.scrollTop=this._messagesArea.scrollHeight,this.userScrolledUp=!1,this._updateScrollBottomBtn()}},{key:"_updateScrollBottomBtn",value:function(){this.userScrolledUp?this._scrollBottomBtn.classList.add("quikchat-scroll-bottom-visible"):this._scrollBottomBtn.classList.remove("quikchat-scroll-bottom-visible")}},{key:"_autoGrowTextarea",value:function(){var e=this._textEntry;e.style.height="auto";var t=parseInt(getComputedStyle(e).getPropertyValue("--quikchat-input-max-height"))||120;e.style.height=Math.min(e.scrollHeight,t)+"px",e.style.overflowY=e.scrollHeight>t?"auto":"hidden"}},{key:"_formatTimestamp",value:function(e){var t=new Date(e),n=t.getHours();return(n%12||12)+":"+String(t.getMinutes()).padStart(2,"0")+" "+(n>=12?"PM":"AM")}},{key:"messagesAreaShowTimestamps",value:function(e){e?this._messagesArea.classList.add("quikchat-show-timestamps"):this._messagesArea.classList.remove("quikchat-show-timestamps")}},{key:"messagesAreaShowTimestampsGet",value:function(){return this._messagesArea.classList.contains("quikchat-show-timestamps")}},{key:"messagesAreaShowTimestampsToggle",value:function(){this._messagesArea.classList.toggle("quikchat-show-timestamps")}},{key:"_escapeHTML",value:function(e){var t=document.createElement("div");return t.textContent=e,t.innerHTML}},{key:"_processContent",value:function(e){return!0===this._sanitize?e=this._escapeHTML(e):"function"==typeof this._sanitize&&(e=this._sanitize(e)),this._messageFormatter&&(e=this._messageFormatter(e)),e}},{key:"messagesAreaAlternateColors",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return e?this._messagesArea.classList.add("quikchat-messages-area-alt"):this._messagesArea.classList.remove("quikchat-messages-area-alt"),!0===e}},{key:"messagesAreaAlternateColorsToggle",value:function(){this._messagesArea.classList.toggle("quikchat-messages-area-alt")}},{key:"messagesAreaAlternateColorsGet",value:function(){return this._messagesArea.classList.contains("quikchat-messages-area-alt")}},{key:"messageAddFull",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{content:"",userString:"user",align:"right",role:"user",userID:-1},t=this.msgid,n=document.createElement("div"),s="quikchat-msgid-"+String(t).padStart(10,"0");n.classList.add("quikchat-message",s),n.classList.add("quikchat-role-"+(e.role||"user")),n.classList.add("quikchat-align-"+(e.align||"right")),this.msgid++,n.classList.add(this._messagesArea.children.length%2==1?"quikchat-message-1":"quikchat-message-2");var r=!1!==e.visible;r||(n.style.display="none");var i=Array.isArray(e.tags)?e.tags.slice():[],a=document.createElement("div");a.classList.add("quikchat-user-label"),a.style.textAlign=e.align,a.innerHTML=e.userString;var o=document.createElement("div");o.classList.add("quikchat-message-content"),o.style.textAlign=e.align,o.innerHTML=this._processContent(e.content);var l=(new Date).toISOString(),c=document.createElement("span");c.classList.add("quikchat-timestamp"),c.textContent=this._formatTimestamp(l),n.appendChild(a),n.appendChild(o),n.appendChild(c),this._messagesArea.appendChild(n),this.userScrolledUp||(this._messagesArea.scrollTop=this._messagesArea.scrollHeight),this._textEntry.value="",this._autoGrowTextarea();var h=l;return this.trackHistory&&(this._history.push(u(u({msgid:t},e),{},{visible:r,tags:i,timestamp:l,updatedtime:h,messageDiv:n})),this._history.length>this._historyLimit&&this._history.shift()),this._onMessageAdded&&this._onMessageAdded(this,t),t}},{key:"messageAddNew",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"user",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"right",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"user";return this.messageAddFull({content:e,userString:t,align:n,role:s})}},{key:"messageRemove",value:function(e){var t=!1;try{this._messagesArea.removeChild(this._messagesArea.querySelector(".quikchat-msgid-".concat(String(e).padStart(10,"0")))),t=!0}catch(e){}return t&&(this._history.splice(this._history.findIndex((function(t){return t.msgid===e})),1),this._onMessageDelete&&this._onMessageDelete(this,e)),t}},{key:"messageGetDOMObject",value:function(e){var t=null;try{t=this._messagesArea.querySelector(".quikchat-msgid-".concat(String(e).padStart(10,"0")))}catch(e){}return t}},{key:"messageGetContent",value:function(e){var t="";try{t=this._history.filter((function(t){return t.msgid===e}))[0].content}catch(e){}return t}},{key:"messageSetVisible",value:function(e,t){var n=this.messageGetDOMObject(e);if(!n)return!1;n.style.display=t?"":"none";var s=this._history.find((function(t){return t.msgid===e}));return s&&(s.visible=t),!0}},{key:"messageGetVisible",value:function(e){var t=this._history.find((function(t){return t.msgid===e}));return!!t&&!1!==t.visible}},{key:"messageToggleVisible",value:function(e){var t=this.messageGetVisible(e);return this.messageSetVisible(e,!t)}},{key:"messageSetVisibleByTag",value:function(e,t){var n,s=0,r=i(this._history);try{for(r.s();!(n=r.n()).done;){var a=n.value;a.tags&&a.tags.includes(e)&&(this.messageSetVisible(a.msgid,t),s++)}}catch(e){r.e(e)}finally{r.f()}return s}},{key:"messageGetTags",value:function(e){var t=this._history.find((function(t){return t.msgid===e}));return t&&t.tags?t.tags.slice():[]}},{key:"messageSetTags",value:function(e,t){var n=this._history.find((function(t){return t.msgid===e}));return!!n&&(n.tags=Array.isArray(t)?t.slice():[],!0)}},{key:"messageAppendContent",value:function(e,t){var n=!1;try{var s=this._messagesArea.querySelector(".quikchat-msgid-".concat(String(e).padStart(10,"0"))),r=this._history.filter((function(t){return t.msgid===e}))[0];r.content+=t,r.updatedtime=(new Date).toISOString(),s.querySelector(".quikchat-message-content").innerHTML=this._processContent(r.content),s.classList.remove("quikchat-typing"),n=!0,this.userScrolledUp||(this._messagesArea.scrollTop=this._messagesArea.scrollHeight),this._onMessageAppend&&this._onMessageAppend(this,e,t)}catch(e){}return n}},{key:"messageReplaceContent",value:function(e,t){var n=!1;try{var s=this._messagesArea.querySelector(".quikchat-msgid-".concat(String(e).padStart(10,"0"))),r=this._history.filter((function(t){return t.msgid===e}))[0];r.content=t,r.updatedtime=(new Date).toISOString(),s.querySelector(".quikchat-message-content").innerHTML=this._processContent(t),s.classList.remove("quikchat-typing"),n=!0,this.userScrolledUp||(this._messagesArea.scrollTop=this._messagesArea.scrollHeight),this._onMessageReplace&&this._onMessageReplace(this,e,t)}catch(e){}return n}},{key:"messageAddTypingIndicator",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"left",n=this.messageAddFull({content:"",userString:e,align:t,role:"assistant"}),s=this.messageGetDOMObject(n);return s.classList.add("quikchat-typing"),s.querySelector(".quikchat-message-content").innerHTML='<span class="quikchat-typing-dots"><span>.</span><span>.</span><span>.</span></span>',n}},{key:"setMessageFormatter",value:function(e){this._messageFormatter=e}},{key:"setSanitize",value:function(e){this._sanitize=e}},{key:"historyGet",value:function(e,t){return void 0===e?this._history.slice():void 0===t?e<0?this._history.slice(e):this._history.slice(e,e+1):this._history.slice(e,t)}},{key:"historyClear",value:function(){this.msgid=0,this._history=[]}},{key:"historyGetLength",value:function(){return this._history.length}},{key:"historyGetMessage",value:function(e){return e>=0&&e<this._history.length?this._history[e]:{}}},{key:"historyGetMessageContent",value:function(e){return e>=0&&e<this._history.length?this._history[e].content:""}},{key:"historyExport",value:function(){return this._history.map((function(e){return{msgid:e.msgid,content:e.content,userString:e.userString,align:e.align,role:e.role,userID:e.userID,visible:e.visible,tags:e.tags?e.tags.slice():[],timestamp:e.timestamp,updatedtime:e.updatedtime}}))}},{key:"historyImport",value:function(e){this._messagesArea.innerHTML="",this._history=[],this.msgid=0;var t,n=i(e);try{for(n.s();!(t=n.n()).done;){var s=t.value;this.messageAddFull({content:s.content||"",userString:s.userString||"user",align:s.align||"right",role:s.role||"user",userID:s.userID,visible:s.visible,tags:s.tags})}}catch(e){n.e(e)}finally{n.f()}}},{key:"changeTheme",value:function(e){this._chatWidget.classList.remove(this._theme),this._chatWidget.classList.add(e),this._theme=e}},{key:"theme",get:function(){return this._theme}}],[{key:"version",value:function(){return{version:"1.2.4",license:"BSD-2",url:"https://github/deftio/quikchat"}}},{key:"loremIpsum",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. ";for("number"!=typeof e&&(e=Math.floor(126*Math.random())+25),void 0===t&&(t=Math.floor(446*Math.random())),t%=446;" "===s[t]||/[.,:;!?]/.test(s[t]);)t=(t+1)%446;for(var r=s.substring(t)+s.substring(0,t),i="";e>0;)i+=e<r.length?r.substring(0,e):r,e-=r.length;return" "===i[i.length-1]&&(i=i.substring(0,i.length-1)+"."),n&&(i=i[0].toUpperCase()+i.substring(1)),i}}])}();
|
|
2
|
+
/**
|
|
3
|
+
* quikdown - Lightweight Markdown Parser
|
|
4
|
+
* @version 1.1.1
|
|
5
|
+
* @license BSD-2-Clause
|
|
6
|
+
* @copyright DeftIO 2025
|
|
7
|
+
*/const p="quikdown-",f="§CB",m={"&":"&","<":"<",">":">",'"':""","'":"'"},y={h1:"font-size:2em;font-weight:600;margin:.67em 0;text-align:left",h2:"font-size:1.5em;font-weight:600;margin:.83em 0",h3:"font-size:1.25em;font-weight:600;margin:1em 0",h4:"font-size:1em;font-weight:600;margin:1.33em 0",h5:"font-size:.875em;font-weight:600;margin:1.67em 0",h6:"font-size:.85em;font-weight:600;margin:2em 0",pre:"background:#f4f4f4;padding:10px;border-radius:4px;overflow-x:auto;margin:1em 0",code:"background:#f0f0f0;padding:2px 4px;border-radius:3px;font-family:monospace",blockquote:"border-left:4px solid #ddd;margin-left:0;padding-left:1em",table:"border-collapse:collapse;width:100%;margin:1em 0",th:"border:1px solid #ddd;padding:8px;background-color:#f2f2f2;font-weight:bold;text-align:left",td:"border:1px solid #ddd;padding:8px;text-align:left",hr:"border:none;border-top:1px solid #ddd;margin:1em 0",img:"max-width:100%;height:auto",a:"color:#06c;text-decoration:underline",strong:"font-weight:bold",em:"font-style:italic",del:"text-decoration:line-through",ul:"margin:.5em 0;padding-left:2em",ol:"margin:.5em 0;padding-left:2em",li:"margin:.25em 0","task-item":"list-style:none","task-checkbox":"margin-right:.5em"};function v(e,t={}){if(!e||"string"!=typeof e)return"";const{fence_plugin:n,inline_styles:s=!1,bidirectional:r=!1,lazy_linefeeds:i=!1}=t,a=function(e,t){return function(n,s=""){if(e){let e=t[n];return e||s?(s&&s.includes("text-align")&&e&&e.includes("text-align")&&(e=e.replace(/text-align:[^;]+;?/,"").trim(),e&&!e.endsWith(";")&&(e+=";")),` style="${s?e?`${e}${s}`:s:e}"`):""}{const e=` class="${p}${n}"`;return s?`${e} style="${s}"`:e}}}(s,y);function o(e){return e.replace(/[&<>"']/g,(e=>m[e]))}const l=r?e=>` data-qd="${o(e)}"`:()=>"";function c(e,t=!1){if(!e)return"";if(t)return e;const n=e.trim(),s=n.toLowerCase(),r=["javascript:","vbscript:","data:"];for(const e of r)if(s.startsWith(e))return"data:"===e&&s.startsWith("data:image/")?n:"#";return n}let u=e;const h=[],g=[];u=u.replace(/^(```|~~~)([^\n]*)\n([\s\S]*?)^\1$/gm,((e,t,s,r)=>{const i=`${f}${h.length}§`,a=s?s.trim():"";return n&&n.render&&"function"==typeof n.render?h.push({lang:a,code:r.trimEnd(),custom:!0,fence:t,hasReverse:!!n.reverse}):h.push({lang:a,code:o(r.trimEnd()),custom:!1,fence:t}),i})),u=u.replace(/`([^`]+)`/g,((e,t)=>{const n=`§IC${g.length}§`;return g.push(o(t)),n})),u=o(u),u=function(e,t){const n=e.split("\n"),s=[];let r=!1,i=[];for(let e=0;e<n.length;e++){const a=n[e].trim();if(a.includes("|")&&(a.startsWith("|")||/[^\\|]/.test(a)))r||(r=!0,i=[]),i.push(a);else{if(r){const e=b(i,t);e?s.push(e):s.push(...i),r=!1,i=[]}s.push(n[e])}}if(r&&i.length>0){const e=b(i,t);e?s.push(e):s.push(...i)}return s.join("\n")}(u,a),u=u.replace(/^(#{1,6})\s+(.+?)\s*#*$/gm,((e,t,n)=>{const s=t.length;return`<h${s}${a("h"+s)}${l(t)}>${n}</h${s}>`})),u=u.replace(/^>\s+(.+)$/gm,`<blockquote${a("blockquote")}>$1</blockquote>`),u=u.replace(/<\/blockquote>\n<blockquote>/g,"\n"),u=u.replace(/^---+\s*$/gm,`<hr${a("hr")}>`),u=function(e,t,n,s){const r=e.split("\n"),i=[];let a=[];const o=e=>e.replace(/[&<>"']/g,(e=>({"&":"&","<":"<",">":">",'"':""","'":"'"}[e]))),l=s?e=>` data-qd="${o(e)}"`:()=>"";for(let e=0;e<r.length;e++){const s=r[e],o=s.match(/^(\s*)([*\-+]|\d+\.)\s+(.+)$/);if(o){const[,e,s,r]=o,c=Math.floor(e.length/2),u=/^\d+\./.test(s),h=u?"ol":"ul";let g=r,d="";const f=r.match(/^\[([x ])\]\s+(.*)$/i);if(f&&!u){const[,e,t]=f,s="x"===e.toLowerCase();g=`<input type="checkbox"${n?' style="margin-right:.5em"':` class="${p}task-checkbox"`}${s?" checked":""} disabled> ${t}`,d=n?' style="list-style:none"':` class="${p}task-item"`}for(;a.length>c+1;){const e=a.pop();i.push(`</${e.type}>`)}if(a.length===c)a.push({type:h,level:c}),i.push(`<${h}${t(h)}>`);else if(a.length===c+1){const e=a[a.length-1];e.type!==h&&(i.push(`</${e.type}>`),a.pop(),a.push({type:h,level:c}),i.push(`<${h}${t(h)}>`))}const m=d||t("li");i.push(`<li${m}${l(s)}>${g}</li>`)}else{for(;a.length>0;){const e=a.pop();i.push(`</${e.type}>`)}i.push(s)}}for(;a.length>0;){const e=a.pop();i.push(`</${e.type}>`)}return i.join("\n")}(u,a,s,r),u=u.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,((e,n,s)=>{const i=c(s,t.allow_unsafe_urls),u=r&&n?` data-qd-alt="${o(n)}"`:"",h=r?` data-qd-src="${o(s)}"`:"";return`<img${a("img")} src="${i}" alt="${n}"${u}${h}${l("!")}>`})),u=u.replace(/\[([^\]]+)\]\(([^)]+)\)/g,((e,n,s)=>{const i=c(s,t.allow_unsafe_urls),u=/^https?:\/\//i.test(i)?' rel="noopener noreferrer"':"",h=r?` data-qd-text="${o(n)}"`:"";return`<a${a("a")} href="${i}"${u}${h}${l("[")}>${n}</a>`})),u=u.replace(/(^|\s)(https?:\/\/[^\s<]+)/g,((e,n,s)=>{const r=c(s,t.allow_unsafe_urls);return`${n}<a${a("a")} href="${r}" rel="noopener noreferrer">${s}</a>`}));if([[/\*\*(.+?)\*\*/g,"strong","**"],[/__(.+?)__/g,"strong","__"],[/(?<!\*)\*(?!\*)(.+?)(?<!\*)\*(?!\*)/g,"em","*"],[/(?<!_)_(?!_)(.+?)(?<!_)_(?!_)/g,"em","_"],[/~~(.+?)~~/g,"del","~~"]].forEach((([e,t,n])=>{u=u.replace(e,`<${t}${a(t)}${l(n)}>$1</${t}>`)})),i){const e=[];let t=0;u=u.replace(/<(table|[uo]l)[^>]*>[\s\S]*?<\/\1>/g,(n=>(e[t]=n,`§B${t++}§`))),u=u.replace(/\n\n+/g,"§P§").replace(/(<\/(?:h[1-6]|blockquote|pre)>)\n/g,"$1§N§").replace(/(<(?:h[1-6]|blockquote|pre|hr)[^>]*>)\n/g,"$1§N§").replace(/\n(<(?:h[1-6]|blockquote|pre|hr)[^>]*>)/g,"§N§$1").replace(/\n(§B\d+§)/g,"§N§$1").replace(/(§B\d+§)\n/g,"$1§N§").replace(/\n/g,`<br${a("br")}>`).replace(/§N§/g,"\n").replace(/§P§/g,"</p><p>"),e.forEach(((e,t)=>u=u.replace(`§B${t}§`,e))),u="<p>"+u+"</p>"}else u=u.replace(/ $/gm,`<br${a("br")}>`),u=u.replace(/\n\n+/g,((e,t)=>u.substring(0,t).match(/<\/(h[1-6]|blockquote|ul|ol|table|pre|hr)>$/)?"<p>":"</p><p>")),u="<p>"+u+"</p>";return[[/<p><\/p>/g,""],[/<p>(<h[1-6][^>]*>)/g,"$1"],[/(<\/h[1-6]>)<\/p>/g,"$1"],[/<p>(<blockquote[^>]*>)/g,"$1"],[/(<\/blockquote>)<\/p>/g,"$1"],[/<p>(<ul[^>]*>|<ol[^>]*>)/g,"$1"],[/(<\/ul>|<\/ol>)<\/p>/g,"$1"],[/<p>(<hr[^>]*>)<\/p>/g,"$1"],[/<p>(<table[^>]*>)/g,"$1"],[/(<\/table>)<\/p>/g,"$1"],[/<p>(<pre[^>]*>)/g,"$1"],[/(<\/pre>)<\/p>/g,"$1"],[new RegExp(`<p>(${f}\\d+§)</p>`,"g"),"$1"]].forEach((([e,t])=>{u=u.replace(e,t)})),u=u.replace(/(<\/(?:h[1-6]|blockquote|ul|ol|table|pre|hr)>)\n([^<])/g,"$1\n<p>$2"),h.forEach(((e,t)=>{let i;if(e.custom&&n&&n.render)if(i=n.render(e.code,e.lang),void 0===i){const t=!s&&e.lang?` class="language-${e.lang}"`:"",n=s?a("code"):t,l=r&&e.lang?` data-qd-lang="${o(e.lang)}"`:"",c=r?` data-qd-fence="${o(e.fence)}"`:"";i=`<pre${a("pre")}${c}${l}><code${n}>${o(e.code)}</code></pre>`}else r&&(i=i.replace(/^<(\w+)/,`<$1 data-qd-fence="${o(e.fence)}" data-qd-lang="${o(e.lang)}" data-qd-source="${o(e.code)}"`));else{const t=!s&&e.lang?` class="language-${e.lang}"`:"",n=s?a("code"):t,l=r&&e.lang?` data-qd-lang="${o(e.lang)}"`:"",c=r?` data-qd-fence="${o(e.fence)}"`:"";i=`<pre${a("pre")}${c}${l}><code${n}>${e.code}</code></pre>`}const l=`${f}${t}§`;u=u.replace(l,i)})),g.forEach(((e,t)=>{const n=`§IC${t}§`;u=u.replace(n,`<code${a("code")}${l("`")}>${e}</code>`)})),u.trim()}function _(e,t){return[[/\*\*(.+?)\*\*/g,"strong"],[/__(.+?)__/g,"strong"],[/(?<!\*)\*(?!\*)(.+?)(?<!\*)\*(?!\*)/g,"em"],[/(?<!_)_(?!_)(.+?)(?<!_)_(?!_)/g,"em"],[/~~(.+?)~~/g,"del"],[/`([^`]+)`/g,"code"]].forEach((([n,s])=>{e=e.replace(n,`<${s}${t(s)}>$1</${s}>`)})),e}function b(e,t){if(e.length<2)return null;let n=-1;for(let t=1;t<e.length;t++)if(/^\|?[\s\-:|]+\|?$/.test(e[t])&&e[t].includes("-")){n=t;break}if(-1===n)return null;const s=e.slice(0,n),r=e.slice(n+1),i=e[n].trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map((e=>{const t=e.trim();return t.startsWith(":")&&t.endsWith(":")?"center":t.endsWith(":")?"right":"left"}));let a=`<table${t("table")}>\n`;return a+=`<thead${t("thead")}>\n`,s.forEach((e=>{a+=`<tr${t("tr")}>\n`;e.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").forEach(((e,n)=>{const s=i[n]&&"left"!==i[n]?`text-align:${i[n]}`:"",r=_(e.trim(),t);a+=`<th${t("th",s)}>${r}</th>\n`})),a+="</tr>\n"})),a+="</thead>\n",r.length>0&&(a+=`<tbody${t("tbody")}>\n`,r.forEach((e=>{a+=`<tr${t("tr")}>\n`;e.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").forEach(((e,n)=>{const s=i[n]&&"left"!==i[n]?`text-align:${i[n]}`:"",r=_(e.trim(),t);a+=`<td${t("td",s)}>${r}</td>\n`})),a+="</tr>\n"})),a+="</tbody>\n"),a+="</table>",a}v.emitStyles=function(e="quikdown-",t="light"){const n=y,s={"#f4f4f4":"#2a2a2a","#f0f0f0":"#2a2a2a","#f2f2f2":"#2a2a2a","#ddd":"#3a3a3a","#06c":"#6db3f2",_textColor:"#e0e0e0"},r={_textColor:"#333"};let i="";for(const[a,o]of Object.entries(n)){let n=o;if("dark"===t&&s){for(const[e,t]of Object.entries(s))e.startsWith("_")||(n=n.replace(new RegExp(e,"g"),t));["h1","h2","h3","h4","h5","h6","td","li","blockquote"].includes(a)&&(n+=`;color:${s._textColor}`)}else if("light"===t&&r){["h1","h2","h3","h4","h5","h6","td","li","blockquote"].includes(a)&&(n+=`;color:${r._textColor}`)}i+=`.${e}${a} { ${n} }\n`}return i},v.configure=function(e){return function(t){return v(t,e)}},v.version="1.1.1","undefined"!=typeof module&&module.exports&&(module.exports=v),"undefined"!=typeof window&&(window.quikdown=v);var k=function(e){function s(e,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n(this,s),i.messageFormatter||(i.messageFormatter=function(e){return v(e)}),t(this,s,[e,r,i])}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&h(e,t)}(s,e),r(s)}(d);return k.quikdown=v,k}));
|
|
8
|
+
//# sourceMappingURL=quikchat-md.umd.min.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quikchat-md.umd.min.js","sources":["../src/quikchat.js","../node_modules/quikdown/dist/quikdown.esm.js","../src/quikchat-md.js"],"sourcesContent":["\nclass quikchat {\n /**\n *\n * @param string or DOM element parentElement\n * @param {*} meta\n */\n constructor(parentElement, onSend = () => { }, options = {}) {\n const defaultOpts = {\n theme: 'quikchat-theme-light',\n trackHistory: true,\n showTimestamps: false,\n titleArea: { title: \"Chat\", show: false, align: \"center\" },\n messagesArea: { alternating: true },\n };\n const meta = { ...defaultOpts, ...options }; // merge options with defaults\n\n if (typeof parentElement === 'string') {\n parentElement = document.querySelector(parentElement);\n }\n this._parentElement = parentElement;\n this._theme = meta.theme;\n this._onSend = onSend ? onSend : () => { }; // call back function for onSend\n this._messageFormatter = meta.messageFormatter || null;\n this._sanitize = meta.sanitize || false;\n this._createWidget();\n // title area\n if (meta.titleArea) {\n this.titleAreaSetContents(meta.titleArea.title, meta.titleArea.align);\n if (meta.titleArea.show === true) {\n this.titleAreaShow();\n } else {\n this.titleAreaHide();\n }\n }\n // messages area\n if (meta.messagesArea) {\n this.messagesAreaAlternateColors(meta.messagesArea.alternating);\n }\n // timestamps\n if (meta.showTimestamps) {\n this.messagesAreaShowTimestamps(true);\n }\n // direction (ltr/rtl)\n if (meta.direction) {\n this.setDirection(meta.direction);\n }\n // plumbing\n this._attachEventListeners();\n this.trackHistory = meta.trackHistory !== false;\n this._historyLimit = 10000000;\n this._history = [];\n }\n\n _createWidget() {\n const widgetHTML =\n `\n <div class=\"quikchat-base ${this.theme}\">\n <div class=\"quikchat-title-area\"></div>\n <div class=\"quikchat-messages-wrapper\"><div class=\"quikchat-messages-area\" role=\"log\" aria-live=\"polite\" aria-label=\"Chat messages\"></div><button class=\"quikchat-scroll-bottom\" aria-label=\"Scroll to bottom\"></button></div>\n <div class=\"quikchat-input-area\">\n <textarea class=\"quikchat-input-textbox\" rows=\"1\" aria-label=\"Type a message\"></textarea>\n <button class=\"quikchat-input-send-btn\">Send</button>\n </div>\n </div>\n `;\n\n this._parentElement.innerHTML = widgetHTML;\n this._chatWidget = this._parentElement.querySelector('.quikchat-base');\n this._titleArea = this._chatWidget.querySelector('.quikchat-title-area');\n this._messagesWrapper = this._chatWidget.querySelector('.quikchat-messages-wrapper');\n this._messagesArea = this._chatWidget.querySelector('.quikchat-messages-area');\n this._scrollBottomBtn = this._messagesWrapper.querySelector('.quikchat-scroll-bottom');\n this._inputArea = this._chatWidget.querySelector('.quikchat-input-area');\n this._textEntry = this._inputArea.querySelector('.quikchat-input-textbox');\n this._sendButton = this._inputArea.querySelector('.quikchat-input-send-btn');\n this.msgid = 0;\n }\n\n /**\n * Attach event listeners to the widget\n */\n _attachEventListeners() {\n this._sendButton.addEventListener('click', () => {\n const text = this._textEntry.value.trim();\n if (text === '') return;\n this._onSend(this, text);\n });\n this._textEntry.addEventListener('keydown', (event) => {\n // Check if Shift + Enter is pressed\n if (event.shiftKey && event.keyCode === 13) {\n event.preventDefault();\n const text = this._textEntry.value.trim();\n if (text === '') return;\n this._onSend(this, text);\n }\n });\n\n // Auto-grow textarea\n this._textEntry.addEventListener('input', () => this._autoGrowTextarea());\n\n this._messagesArea.addEventListener('scroll', () => {\n const { scrollTop, scrollHeight, clientHeight } = this._messagesArea;\n this.userScrolledUp = scrollTop + clientHeight < scrollHeight - 1;\n this._updateScrollBottomBtn();\n });\n\n // Scroll-to-bottom button\n this._scrollBottomBtn.addEventListener('click', () => this.scrollToBottom());\n\n // Ctrl+End to scroll to bottom\n this._chatWidget.addEventListener('keydown', (event) => {\n if (event.ctrlKey && event.key === 'End') {\n event.preventDefault();\n this.scrollToBottom();\n }\n });\n\n // Use ResizeObserver to detect parent container resize\n if (typeof ResizeObserver !== 'undefined') {\n this._resizeObserver = new ResizeObserver(() => this._handleContainerResize());\n this._resizeObserver.observe(this._parentElement);\n }\n }\n\n // set the onSend function callback.\n setCallbackOnSend(callback) {\n this._onSend = callback;\n }\n // set a callback for everytime a message is added (listener)\n setCallbackonMessageAdded(callback) {\n this._onMessageAdded = callback;\n }\n setCallbackonMessageAppend(callback) {\n this._onMessageAppend = callback;\n }\n setCallbackonMessageReplace(callback) {\n this._onMessageReplace = callback;\n }\n setCallbackonMessageDelete(callback) {\n this._onMessageDelete = callback;\n }\n\n // Public methods\n titleAreaToggle() {\n if (this._titleArea.style.display === 'none') {\n this.titleAreaShow();\n } else {\n this.titleAreaHide();\n }\n }\n\n titleAreaShow() {\n this._titleArea.style.display = '';\n }\n\n titleAreaHide() {\n this._titleArea.style.display = 'none';\n }\n\n titleAreaSetContents(title, align = 'center') {\n this._titleArea.innerHTML = title;\n this._titleArea.style.textAlign = align;\n }\n\n titleAreaGetContents() {\n return this._titleArea.innerHTML;\n }\n\n inputAreaToggle() {\n if (this._inputArea.style.display === 'none') {\n this.inputAreaShow();\n } else {\n this.inputAreaHide();\n }\n }\n\n inputAreaShow() {\n this._inputArea.style.display = '';\n }\n\n inputAreaHide() {\n this._inputArea.style.display = 'none';\n }\n\n inputAreaSetEnabled(enabled) {\n this._textEntry.disabled = !enabled;\n this._sendButton.disabled = !enabled;\n }\n\n inputAreaSetButtonText(text) {\n this._sendButton.textContent = text;\n }\n\n inputAreaGetButtonText() {\n return this._sendButton.textContent;\n }\n\n setDirection(dir) {\n const d = dir === 'rtl' ? 'rtl' : 'ltr';\n this._chatWidget.setAttribute('dir', d);\n if (d === 'rtl') {\n this._chatWidget.classList.add('quikchat-rtl');\n } else {\n this._chatWidget.classList.remove('quikchat-rtl');\n }\n }\n\n getDirection() {\n return this._chatWidget.getAttribute('dir') || 'ltr';\n }\n\n _handleContainerResize() {\n // Layout is handled by CSS flexbox — no JS height calculation needed.\n // This hook exists for future use or custom resize callbacks.\n }\n\n scrollToBottom() {\n this._messagesArea.scrollTop = this._messagesArea.scrollHeight;\n this.userScrolledUp = false;\n this._updateScrollBottomBtn();\n }\n\n _updateScrollBottomBtn() {\n if (this.userScrolledUp) {\n this._scrollBottomBtn.classList.add('quikchat-scroll-bottom-visible');\n } else {\n this._scrollBottomBtn.classList.remove('quikchat-scroll-bottom-visible');\n }\n }\n\n _autoGrowTextarea() {\n const el = this._textEntry;\n el.style.height = 'auto';\n const maxHeight = parseInt(getComputedStyle(el).getPropertyValue('--quikchat-input-max-height')) || 120;\n el.style.height = Math.min(el.scrollHeight, maxHeight) + 'px';\n el.style.overflowY = el.scrollHeight > maxHeight ? 'auto' : 'hidden';\n }\n\n _formatTimestamp(isoString) {\n const d = new Date(isoString);\n const h = d.getHours();\n const m = String(d.getMinutes()).padStart(2, '0');\n const ampm = h >= 12 ? 'PM' : 'AM';\n const h12 = h % 12 || 12;\n return h12 + ':' + m + ' ' + ampm;\n }\n\n messagesAreaShowTimestamps(show) {\n if (show) {\n this._messagesArea.classList.add('quikchat-show-timestamps');\n } else {\n this._messagesArea.classList.remove('quikchat-show-timestamps');\n }\n }\n\n messagesAreaShowTimestampsGet() {\n return this._messagesArea.classList.contains('quikchat-show-timestamps');\n }\n\n messagesAreaShowTimestampsToggle() {\n this._messagesArea.classList.toggle('quikchat-show-timestamps');\n }\n\n _escapeHTML(str) {\n const div = document.createElement('div');\n div.textContent = str;\n return div.innerHTML;\n }\n\n _processContent(content) {\n if (this._sanitize === true) {\n content = this._escapeHTML(content);\n } else if (typeof this._sanitize === 'function') {\n content = this._sanitize(content);\n }\n if (this._messageFormatter) {\n content = this._messageFormatter(content);\n }\n return content;\n }\n\n //messagesArea functions\n messagesAreaAlternateColors(alt = true) {\n if (alt) {\n this._messagesArea.classList.add('quikchat-messages-area-alt');\n }\n else {\n this._messagesArea.classList.remove('quikchat-messages-area-alt');\n }\n return alt === true;\n }\n messagesAreaAlternateColorsToggle() {\n this._messagesArea.classList.toggle('quikchat-messages-area-alt');\n }\n messagesAreaAlternateColorsGet() {\n return this._messagesArea.classList.contains('quikchat-messages-area-alt');\n }\n // message functions\n messageAddFull(input = { content: \"\", userString: \"user\", align: \"right\", role: \"user\", userID: -1 }) {\n const msgid = this.msgid;\n const messageDiv = document.createElement('div');\n const msgidClass = 'quikchat-msgid-' + String(msgid).padStart(10, '0');\n messageDiv.classList.add('quikchat-message', msgidClass);\n messageDiv.classList.add('quikchat-role-' + (input.role || 'user'));\n messageDiv.classList.add('quikchat-align-' + (input.align || 'right'));\n this.msgid++;\n messageDiv.classList.add(this._messagesArea.children.length % 2 === 1 ? 'quikchat-message-1' : 'quikchat-message-2');\n\n // Visibility: default true, hidden messages get display:none\n const visible = input.visible !== false;\n if (!visible) {\n messageDiv.style.display = 'none';\n }\n\n // Tags: array of strings for group-based visibility control\n const tags = Array.isArray(input.tags) ? input.tags.slice() : [];\n\n const userDiv = document.createElement('div');\n userDiv.classList.add('quikchat-user-label');\n userDiv.style.textAlign = input.align;\n userDiv.innerHTML = input.userString;\n\n const contentDiv = document.createElement('div');\n contentDiv.classList.add('quikchat-message-content');\n contentDiv.style.textAlign = input.align;\n contentDiv.innerHTML = this._processContent(input.content);\n\n const timestamp = new Date().toISOString();\n const timestampSpan = document.createElement('span');\n timestampSpan.classList.add('quikchat-timestamp');\n timestampSpan.textContent = this._formatTimestamp(timestamp);\n\n messageDiv.appendChild(userDiv);\n messageDiv.appendChild(contentDiv);\n messageDiv.appendChild(timestampSpan);\n this._messagesArea.appendChild(messageDiv);\n\n // Scroll to the last message only if the user is not actively scrolling up\n if (!this.userScrolledUp) {\n this._messagesArea.scrollTop = this._messagesArea.scrollHeight;\n }\n\n this._textEntry.value = '';\n this._autoGrowTextarea();\n const updatedtime = timestamp;\n\n if (this.trackHistory) {\n this._history.push({ msgid, ...input, visible, tags, timestamp, updatedtime, messageDiv });\n if (this._history.length > this._historyLimit) {\n this._history.shift();\n }\n }\n\n if (this._onMessageAdded) {\n this._onMessageAdded(this, msgid);\n }\n\n return msgid;\n }\n\n\n messageAddNew(content = \"\", userString = \"user\", align = \"right\", role = \"user\") {\n return this.messageAddFull(\n { content: content, userString: userString, align: align, role: role }\n );\n }\n messageRemove(n) {\n let success = false;\n try {\n this._messagesArea.removeChild(this._messagesArea.querySelector(`.quikchat-msgid-${String(n).padStart(10, '0')}`));\n success = true;\n }\n catch (_error) {\n // Message ID not found\n }\n if (success) {\n this._history.splice(this._history.findIndex((item) => item.msgid === n), 1);\n if (this._onMessageDelete) {\n this._onMessageDelete(this, n);\n }\n }\n return success;\n }\n /* returns the message html object from the DOM\n */\n messageGetDOMObject(n) {\n let msg = null;\n try {\n msg = this._messagesArea.querySelector(`.quikchat-msgid-${String(n).padStart(10, '0')}`);\n }\n catch (_error) {\n // Message ID not found\n }\n return msg;\n }\n /* returns the message content only\n */\n messageGetContent(n) {\n let content = \"\";\n try {\n content = this._history.filter((item) => item.msgid === n)[0].content;\n }\n catch (_error) {\n // Message ID not found\n }\n return content;\n }\n\n messageSetVisible(n, visible) {\n const msgEl = this.messageGetDOMObject(n);\n if (!msgEl) return false;\n msgEl.style.display = visible ? '' : 'none';\n const item = this._history.find((entry) => entry.msgid === n);\n if (item) item.visible = visible;\n return true;\n }\n\n messageGetVisible(n) {\n const item = this._history.find((entry) => entry.msgid === n);\n return item ? item.visible !== false : false;\n }\n\n messageToggleVisible(n) {\n const current = this.messageGetVisible(n);\n return this.messageSetVisible(n, !current);\n }\n\n messageSetVisibleByTag(tag, visible) {\n let count = 0;\n for (const item of this._history) {\n if (item.tags && item.tags.includes(tag)) {\n this.messageSetVisible(item.msgid, visible);\n count++;\n }\n }\n return count;\n }\n\n messageGetTags(n) {\n const item = this._history.find((entry) => entry.msgid === n);\n return item && item.tags ? item.tags.slice() : [];\n }\n\n messageSetTags(n, tags) {\n const item = this._history.find((entry) => entry.msgid === n);\n if (!item) return false;\n item.tags = Array.isArray(tags) ? tags.slice() : [];\n return true;\n }\n\n /* append message to the message content\n */\n messageAppendContent(n, content) {\n let success = false;\n try {\n const msgEl = this._messagesArea.querySelector(`.quikchat-msgid-${String(n).padStart(10, '0')}`);\n const item = this._history.filter((entry) => entry.msgid === n)[0];\n item.content += content;\n item.updatedtime = new Date().toISOString();\n msgEl.querySelector('.quikchat-message-content').innerHTML = this._processContent(item.content);\n msgEl.classList.remove('quikchat-typing');\n success = true;\n\n if (!this.userScrolledUp) {\n this._messagesArea.scrollTop = this._messagesArea.scrollHeight;\n }\n if (this._onMessageAppend) {\n this._onMessageAppend(this, n, content);\n }\n } catch (_error) {\n // Message ID not found\n }\n return success;\n }\n\n /* replace message content\n */\n messageReplaceContent(n, content) {\n let success = false;\n try {\n const msgEl = this._messagesArea.querySelector(`.quikchat-msgid-${String(n).padStart(10, '0')}`);\n const item = this._history.filter((entry) => entry.msgid === n)[0];\n item.content = content;\n item.updatedtime = new Date().toISOString();\n msgEl.querySelector('.quikchat-message-content').innerHTML = this._processContent(content);\n msgEl.classList.remove('quikchat-typing');\n success = true;\n\n if (!this.userScrolledUp) {\n this._messagesArea.scrollTop = this._messagesArea.scrollHeight;\n }\n if (this._onMessageReplace) {\n this._onMessageReplace(this, n, content);\n }\n } catch (_error) {\n // Message ID not found\n }\n return success;\n }\n\n messageAddTypingIndicator(userString = '', align = 'left') {\n const msgid = this.messageAddFull({\n content: '',\n userString: userString,\n align: align,\n role: 'assistant',\n });\n const msgEl = this.messageGetDOMObject(msgid);\n msgEl.classList.add('quikchat-typing');\n const contentDiv = msgEl.querySelector('.quikchat-message-content');\n contentDiv.innerHTML = '<span class=\"quikchat-typing-dots\"><span>.</span><span>.</span><span>.</span></span>';\n return msgid;\n }\n\n setMessageFormatter(formatter) {\n this._messageFormatter = formatter;\n }\n\n setSanitize(sanitize) {\n this._sanitize = sanitize;\n }\n\n // history functions\n /**\n *\n * @param {*} n\n * @param {*} m\n * @returns array of history messages\n */\n historyGet(n, m) {\n if (n === undefined) {\n return this._history.slice();\n }\n if (m === undefined) {\n if (n < 0) {\n return this._history.slice(n);\n }\n return this._history.slice(n, n + 1);\n }\n return this._history.slice(n, m);\n }\n\n historyClear() {\n this.msgid = 0;\n this._history = [];\n }\n\n historyGetLength() {\n return this._history.length;\n }\n\n historyGetMessage(n) {\n if (n >= 0 && n < this._history.length) {\n return this._history[n];\n }\n return {};\n }\n\n historyGetMessageContent(n) {\n if (n >= 0 && n < this._history.length) {\n return this._history[n].content;\n }\n return \"\";\n }\n\n historyExport() {\n return this._history.map((item) => ({\n msgid: item.msgid,\n content: item.content,\n userString: item.userString,\n align: item.align,\n role: item.role,\n userID: item.userID,\n visible: item.visible,\n tags: item.tags ? item.tags.slice() : [],\n timestamp: item.timestamp,\n updatedtime: item.updatedtime,\n }));\n }\n\n historyImport(data) {\n // Clear existing messages from DOM and history\n this._messagesArea.innerHTML = '';\n this._history = [];\n this.msgid = 0;\n\n for (const entry of data) {\n this.messageAddFull({\n content: entry.content || '',\n userString: entry.userString || 'user',\n align: entry.align || 'right',\n role: entry.role || 'user',\n userID: entry.userID,\n visible: entry.visible,\n tags: entry.tags,\n });\n }\n }\n\n changeTheme(newTheme) {\n this._chatWidget.classList.remove(this._theme);\n this._chatWidget.classList.add(newTheme);\n this._theme = newTheme;\n }\n\n get theme() {\n return this._theme;\n }\n\n static version() {\n return { \"version\": \"1.2.4\", \"license\": \"BSD-2\", \"url\": \"https://github/deftio/quikchat\" };\n }\n\n /**\n * quikchat.loremIpsum() - Generate a simple string of Lorem Ipsum text (sample typographer's text) of numChars in length.\n * borrowed from github.com/deftio/bitwrench.js\n * @param {number} numChars - The number of characters to generate (random btw 25 and 150 if undefined).\n * @param {number} [startSpot=0] - The starting index in the Lorem Ipsum text. If undefined, a random startSpot will be generated.\n * @param {boolean} [startWithCapitalLetter=true] - If true, capitalize the first character or inject a capital letter if the first character isn't a capital letter.\n *\n * @returns {string} A string of Lorem Ipsum text.\n *\n * @example\n * // Returns 200 characters of Lorem Ipsum starting from index 50\n * loremIpsum(200, 50);\n *\n * @example\n * //Returns a 200 Lorem Ipsum characters starting from a random index\n * loremIpsum(200);\n */\n\n static loremIpsum(numChars, startSpot = undefined, startWithCapitalLetter = true) {\n const loremText = \"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. \";\n\n if (typeof numChars !== \"number\") {\n numChars = Math.floor(Math.random() * 126) + 25;\n }\n\n if (startSpot === undefined) {\n startSpot = Math.floor(Math.random() * loremText.length);\n }\n\n startSpot = startSpot % loremText.length;\n\n // Move startSpot to the next non-whitespace and non-punctuation character\n while (loremText[startSpot] === ' ' || /[.,:;!?]/.test(loremText[startSpot])) {\n startSpot = (startSpot + 1) % loremText.length;\n }\n\n const l = loremText.substring(startSpot) + loremText.substring(0, startSpot);\n\n let s = \"\";\n while (numChars > 0) {\n s += numChars < l.length ? l.substring(0, numChars) : l;\n numChars -= l.length;\n }\n\n if (s[s.length - 1] === \" \") {\n s = s.substring(0, s.length - 1) + \".\"; // always end on non-whitespace. \".\" was chosen arbitrarily.\n }\n\n if (startWithCapitalLetter) {\n s = s[0].toUpperCase() + s.substring(1);\n }\n\n return s;\n };\n\n\n}\n\nexport default quikchat;\n","/**\n * quikdown - Lightweight Markdown Parser\n * @version 1.1.1\n * @license BSD-2-Clause\n * @copyright DeftIO 2025\n */\n/**\n * quikdown - A minimal markdown parser optimized for chat/LLM output\n * Supports tables, code blocks, lists, and common formatting\n * @param {string} markdown - The markdown source text\n * @param {Object} options - Optional configuration object\n * @param {Function} options.fence_plugin - Custom renderer for fenced code blocks\n * (content, fence_string) => html string\n * @param {boolean} options.inline_styles - If true, uses inline styles instead of classes\n * @param {boolean} options.bidirectional - If true, adds data-qd attributes for source tracking\n * @param {boolean} options.lazy_linefeeds - If true, single newlines become <br> tags\n * @returns {string} - The rendered HTML\n */\n\n// Version will be injected at build time \nconst quikdownVersion = '1.1.1';\n\n// Constants for reuse\nconst CLASS_PREFIX = 'quikdown-';\nconst PLACEHOLDER_CB = '§CB';\nconst PLACEHOLDER_IC = '§IC';\n\n// Escape map at module level\nconst ESC_MAP = {'&':'&','<':'<','>':'>','\"':'"',\"'\":'''};\n\n// Single source of truth for all style definitions - optimized\nconst QUIKDOWN_STYLES = {\n h1: 'font-size:2em;font-weight:600;margin:.67em 0;text-align:left',\n h2: 'font-size:1.5em;font-weight:600;margin:.83em 0',\n h3: 'font-size:1.25em;font-weight:600;margin:1em 0',\n h4: 'font-size:1em;font-weight:600;margin:1.33em 0',\n h5: 'font-size:.875em;font-weight:600;margin:1.67em 0',\n h6: 'font-size:.85em;font-weight:600;margin:2em 0',\n pre: 'background:#f4f4f4;padding:10px;border-radius:4px;overflow-x:auto;margin:1em 0',\n code: 'background:#f0f0f0;padding:2px 4px;border-radius:3px;font-family:monospace',\n blockquote: 'border-left:4px solid #ddd;margin-left:0;padding-left:1em',\n table: 'border-collapse:collapse;width:100%;margin:1em 0',\n th: 'border:1px solid #ddd;padding:8px;background-color:#f2f2f2;font-weight:bold;text-align:left',\n td: 'border:1px solid #ddd;padding:8px;text-align:left',\n hr: 'border:none;border-top:1px solid #ddd;margin:1em 0',\n img: 'max-width:100%;height:auto',\n a: 'color:#06c;text-decoration:underline',\n strong: 'font-weight:bold',\n em: 'font-style:italic',\n del: 'text-decoration:line-through',\n ul: 'margin:.5em 0;padding-left:2em',\n ol: 'margin:.5em 0;padding-left:2em',\n li: 'margin:.25em 0',\n // Task list specific styles\n 'task-item': 'list-style:none',\n 'task-checkbox': 'margin-right:.5em'\n};\n\n// Factory function to create getAttr for a given context\nfunction createGetAttr(inline_styles, styles) {\n return function(tag, additionalStyle = '') {\n if (inline_styles) {\n let style = styles[tag];\n if (!style && !additionalStyle) return '';\n \n // Remove default text-align if we're adding a different alignment\n if (additionalStyle && additionalStyle.includes('text-align') && style && style.includes('text-align')) {\n style = style.replace(/text-align:[^;]+;?/, '').trim();\n if (style && !style.endsWith(';')) style += ';';\n }\n \n /* istanbul ignore next - defensive: additionalStyle without style doesn't occur with current tags */\n const fullStyle = additionalStyle ? (style ? `${style}${additionalStyle}` : additionalStyle) : style;\n return ` style=\"${fullStyle}\"`;\n } else {\n const classAttr = ` class=\"${CLASS_PREFIX}${tag}\"`;\n // Apply inline styles for alignment even when using CSS classes\n if (additionalStyle) {\n return `${classAttr} style=\"${additionalStyle}\"`;\n }\n return classAttr;\n }\n };\n}\n\nfunction quikdown(markdown, options = {}) {\n if (!markdown || typeof markdown !== 'string') {\n return '';\n }\n \n const { fence_plugin, inline_styles = false, bidirectional = false, lazy_linefeeds = false } = options;\n const styles = QUIKDOWN_STYLES; // Use module-level styles\n const getAttr = createGetAttr(inline_styles, styles); // Create getAttr once\n\n // Escape HTML entities to prevent XSS\n function escapeHtml(text) {\n return text.replace(/[&<>\"']/g, m => ESC_MAP[m]);\n }\n \n // Helper to add data-qd attributes for bidirectional support\n const dataQd = bidirectional ? (marker) => ` data-qd=\"${escapeHtml(marker)}\"` : () => '';\n \n // Sanitize URLs to prevent XSS attacks\n function sanitizeUrl(url, allowUnsafe = false) {\n /* istanbul ignore next - defensive programming, regex ensures url is never empty */\n if (!url) return '';\n \n // If unsafe URLs are explicitly allowed, return as-is\n if (allowUnsafe) return url;\n \n const trimmedUrl = url.trim();\n const lowerUrl = trimmedUrl.toLowerCase();\n \n // Block dangerous protocols\n const dangerousProtocols = ['javascript:', 'vbscript:', 'data:'];\n \n for (const protocol of dangerousProtocols) {\n if (lowerUrl.startsWith(protocol)) {\n // Exception: Allow data:image/* for images\n if (protocol === 'data:' && lowerUrl.startsWith('data:image/')) {\n return trimmedUrl;\n }\n // Return safe empty link for dangerous protocols\n return '#';\n }\n }\n \n return trimmedUrl;\n }\n\n // Process the markdown in phases\n let html = markdown;\n \n // Phase 1: Extract and protect code blocks and inline code\n const codeBlocks = [];\n const inlineCodes = [];\n \n // Extract fenced code blocks first (supports both ``` and ~~~)\n // Match paired fences - ``` with ``` and ~~~ with ~~~\n // Fence must be at start of line\n html = html.replace(/^(```|~~~)([^\\n]*)\\n([\\s\\S]*?)^\\1$/gm, (match, fence, lang, code) => {\n const placeholder = `${PLACEHOLDER_CB}${codeBlocks.length}§`;\n \n // Trim the language specification\n const langTrimmed = lang ? lang.trim() : '';\n \n // If custom fence plugin is provided, use it (v1.1.0: object format required)\n if (fence_plugin && fence_plugin.render && typeof fence_plugin.render === 'function') {\n codeBlocks.push({\n lang: langTrimmed,\n code: code.trimEnd(),\n custom: true,\n fence: fence,\n hasReverse: !!fence_plugin.reverse\n });\n } else {\n codeBlocks.push({\n lang: langTrimmed,\n code: escapeHtml(code.trimEnd()),\n custom: false,\n fence: fence\n });\n }\n return placeholder;\n });\n \n // Extract inline code\n html = html.replace(/`([^`]+)`/g, (match, code) => {\n const placeholder = `${PLACEHOLDER_IC}${inlineCodes.length}§`;\n inlineCodes.push(escapeHtml(code));\n return placeholder;\n });\n \n // Now escape HTML in the rest of the content\n html = escapeHtml(html);\n \n // Phase 2: Process block elements\n \n // Process tables\n html = processTable(html, getAttr);\n \n // Process headings (supports optional trailing #'s)\n html = html.replace(/^(#{1,6})\\s+(.+?)\\s*#*$/gm, (match, hashes, content) => {\n const level = hashes.length;\n return `<h${level}${getAttr('h' + level)}${dataQd(hashes)}>${content}</h${level}>`;\n });\n \n // Process blockquotes (must handle escaped > since we already escaped HTML)\n html = html.replace(/^>\\s+(.+)$/gm, `<blockquote${getAttr('blockquote')}>$1</blockquote>`);\n // Merge consecutive blockquotes\n html = html.replace(/<\\/blockquote>\\n<blockquote>/g, '\\n');\n \n // Process horizontal rules (allow trailing spaces)\n html = html.replace(/^---+\\s*$/gm, `<hr${getAttr('hr')}>`);\n \n // Process lists\n html = processLists(html, getAttr, inline_styles, bidirectional);\n \n // Phase 3: Process inline elements\n \n // Images (must come before links, with URL sanitization)\n html = html.replace(/!\\[([^\\]]*)\\]\\(([^)]+)\\)/g, (match, alt, src) => {\n const sanitizedSrc = sanitizeUrl(src, options.allow_unsafe_urls);\n const altAttr = bidirectional && alt ? ` data-qd-alt=\"${escapeHtml(alt)}\"` : '';\n const srcAttr = bidirectional ? ` data-qd-src=\"${escapeHtml(src)}\"` : '';\n return `<img${getAttr('img')} src=\"${sanitizedSrc}\" alt=\"${alt}\"${altAttr}${srcAttr}${dataQd('!')}>`;\n });\n \n // Links (with URL sanitization)\n html = html.replace(/\\[([^\\]]+)\\]\\(([^)]+)\\)/g, (match, text, href) => {\n // Sanitize URL to prevent XSS\n const sanitizedHref = sanitizeUrl(href, options.allow_unsafe_urls);\n const isExternal = /^https?:\\/\\//i.test(sanitizedHref);\n const rel = isExternal ? ' rel=\"noopener noreferrer\"' : '';\n const textAttr = bidirectional ? ` data-qd-text=\"${escapeHtml(text)}\"` : '';\n return `<a${getAttr('a')} href=\"${sanitizedHref}\"${rel}${textAttr}${dataQd('[')}>${text}</a>`;\n });\n \n // Autolinks - convert bare URLs to clickable links\n html = html.replace(/(^|\\s)(https?:\\/\\/[^\\s<]+)/g, (match, prefix, url) => {\n const sanitizedUrl = sanitizeUrl(url, options.allow_unsafe_urls);\n return `${prefix}<a${getAttr('a')} href=\"${sanitizedUrl}\" rel=\"noopener noreferrer\">${url}</a>`;\n });\n \n // Process inline formatting (bold, italic, strikethrough)\n const inlinePatterns = [\n [/\\*\\*(.+?)\\*\\*/g, 'strong', '**'],\n [/__(.+?)__/g, 'strong', '__'],\n [/(?<!\\*)\\*(?!\\*)(.+?)(?<!\\*)\\*(?!\\*)/g, 'em', '*'],\n [/(?<!_)_(?!_)(.+?)(?<!_)_(?!_)/g, 'em', '_'],\n [/~~(.+?)~~/g, 'del', '~~']\n ];\n \n inlinePatterns.forEach(([pattern, tag, marker]) => {\n html = html.replace(pattern, `<${tag}${getAttr(tag)}${dataQd(marker)}>$1</${tag}>`);\n });\n \n // Line breaks\n if (lazy_linefeeds) {\n // Lazy linefeeds: single newline becomes <br> (except between paragraphs and after/before block elements)\n const blocks = [];\n let bi = 0;\n \n // Protect tables and lists \n html = html.replace(/<(table|[uo]l)[^>]*>[\\s\\S]*?<\\/\\1>/g, m => {\n blocks[bi] = m;\n return `§B${bi++}§`;\n });\n \n // Handle paragraphs and block elements\n html = html.replace(/\\n\\n+/g, '§P§')\n // After block elements\n .replace(/(<\\/(?:h[1-6]|blockquote|pre)>)\\n/g, '$1§N§')\n .replace(/(<(?:h[1-6]|blockquote|pre|hr)[^>]*>)\\n/g, '$1§N§')\n // Before block elements \n .replace(/\\n(<(?:h[1-6]|blockquote|pre|hr)[^>]*>)/g, '§N§$1')\n .replace(/\\n(§B\\d+§)/g, '§N§$1')\n .replace(/(§B\\d+§)\\n/g, '$1§N§')\n // Convert remaining newlines\n .replace(/\\n/g, `<br${getAttr('br')}>`)\n // Restore\n .replace(/§N§/g, '\\n')\n .replace(/§P§/g, '</p><p>');\n \n // Restore protected blocks\n blocks.forEach((b, i) => html = html.replace(`§B${i}§`, b));\n \n html = '<p>' + html + '</p>';\n } else {\n // Standard: two spaces at end of line for line breaks\n html = html.replace(/ $/gm, `<br${getAttr('br')}>`);\n \n // Paragraphs (double newlines)\n // Don't add </p> after block elements (they're not in paragraphs)\n html = html.replace(/\\n\\n+/g, (match, offset) => {\n // Check if we're after a block element closing tag\n const before = html.substring(0, offset);\n if (before.match(/<\\/(h[1-6]|blockquote|ul|ol|table|pre|hr)>$/)) {\n return '<p>'; // Just open a new paragraph\n }\n return '</p><p>'; // Normal paragraph break\n });\n html = '<p>' + html + '</p>';\n }\n \n // Clean up empty paragraphs and unwrap block elements\n const cleanupPatterns = [\n [/<p><\\/p>/g, ''],\n [/<p>(<h[1-6][^>]*>)/g, '$1'],\n [/(<\\/h[1-6]>)<\\/p>/g, '$1'],\n [/<p>(<blockquote[^>]*>)/g, '$1'],\n [/(<\\/blockquote>)<\\/p>/g, '$1'],\n [/<p>(<ul[^>]*>|<ol[^>]*>)/g, '$1'],\n [/(<\\/ul>|<\\/ol>)<\\/p>/g, '$1'],\n [/<p>(<hr[^>]*>)<\\/p>/g, '$1'],\n [/<p>(<table[^>]*>)/g, '$1'],\n [/(<\\/table>)<\\/p>/g, '$1'],\n [/<p>(<pre[^>]*>)/g, '$1'],\n [/(<\\/pre>)<\\/p>/g, '$1'],\n [new RegExp(`<p>(${PLACEHOLDER_CB}\\\\d+§)<\\/p>`, 'g'), '$1']\n ];\n \n cleanupPatterns.forEach(([pattern, replacement]) => {\n html = html.replace(pattern, replacement);\n });\n \n // Fix orphaned closing </p> tags after block elements\n // When a paragraph follows a block element, ensure it has opening <p>\n html = html.replace(/(<\\/(?:h[1-6]|blockquote|ul|ol|table|pre|hr)>)\\n([^<])/g, '$1\\n<p>$2');\n \n // Phase 4: Restore code blocks and inline code\n \n // Restore code blocks\n codeBlocks.forEach((block, i) => {\n let replacement;\n \n if (block.custom && fence_plugin && fence_plugin.render) {\n // Use custom fence plugin (v1.1.0: object format with render function)\n replacement = fence_plugin.render(block.code, block.lang);\n \n // If plugin returns undefined, fall back to default rendering\n if (replacement === undefined) {\n const langClass = !inline_styles && block.lang ? ` class=\"language-${block.lang}\"` : '';\n const codeAttr = inline_styles ? getAttr('code') : langClass;\n const langAttr = bidirectional && block.lang ? ` data-qd-lang=\"${escapeHtml(block.lang)}\"` : '';\n const fenceAttr = bidirectional ? ` data-qd-fence=\"${escapeHtml(block.fence)}\"` : '';\n replacement = `<pre${getAttr('pre')}${fenceAttr}${langAttr}><code${codeAttr}>${escapeHtml(block.code)}</code></pre>`;\n } else if (bidirectional) {\n // If bidirectional and plugin provided HTML, add data attributes for roundtrip\n replacement = replacement.replace(/^<(\\w+)/, \n `<$1 data-qd-fence=\"${escapeHtml(block.fence)}\" data-qd-lang=\"${escapeHtml(block.lang)}\" data-qd-source=\"${escapeHtml(block.code)}\"`);\n }\n } else {\n // Default rendering\n const langClass = !inline_styles && block.lang ? ` class=\"language-${block.lang}\"` : '';\n const codeAttr = inline_styles ? getAttr('code') : langClass;\n const langAttr = bidirectional && block.lang ? ` data-qd-lang=\"${escapeHtml(block.lang)}\"` : '';\n const fenceAttr = bidirectional ? ` data-qd-fence=\"${escapeHtml(block.fence)}\"` : '';\n replacement = `<pre${getAttr('pre')}${fenceAttr}${langAttr}><code${codeAttr}>${block.code}</code></pre>`;\n }\n \n const placeholder = `${PLACEHOLDER_CB}${i}§`;\n html = html.replace(placeholder, replacement);\n });\n \n // Restore inline code\n inlineCodes.forEach((code, i) => {\n const placeholder = `${PLACEHOLDER_IC}${i}§`;\n html = html.replace(placeholder, `<code${getAttr('code')}${dataQd('`')}>${code}</code>`);\n });\n \n return html.trim();\n}\n\n/**\n * Process inline markdown formatting\n */\nfunction processInlineMarkdown(text, getAttr) {\n \n // Process inline formatting patterns\n const patterns = [\n [/\\*\\*(.+?)\\*\\*/g, 'strong'],\n [/__(.+?)__/g, 'strong'],\n [/(?<!\\*)\\*(?!\\*)(.+?)(?<!\\*)\\*(?!\\*)/g, 'em'],\n [/(?<!_)_(?!_)(.+?)(?<!_)_(?!_)/g, 'em'],\n [/~~(.+?)~~/g, 'del'],\n [/`([^`]+)`/g, 'code']\n ];\n \n patterns.forEach(([pattern, tag]) => {\n text = text.replace(pattern, `<${tag}${getAttr(tag)}>$1</${tag}>`);\n });\n \n return text;\n}\n\n/**\n * Process markdown tables\n */\nfunction processTable(text, getAttr) {\n const lines = text.split('\\n');\n const result = [];\n let inTable = false;\n let tableLines = [];\n \n for (let i = 0; i < lines.length; i++) {\n const line = lines[i].trim();\n \n // Check if this line looks like a table row (with or without trailing |)\n if (line.includes('|') && (line.startsWith('|') || /[^\\\\|]/.test(line))) {\n if (!inTable) {\n inTable = true;\n tableLines = [];\n }\n tableLines.push(line);\n } else {\n // Not a table line\n if (inTable) {\n // Process the accumulated table\n const tableHtml = buildTable(tableLines, getAttr);\n if (tableHtml) {\n result.push(tableHtml);\n } else {\n // Not a valid table, restore original lines\n result.push(...tableLines);\n }\n inTable = false;\n tableLines = [];\n }\n result.push(lines[i]);\n }\n }\n \n // Handle table at end of text\n if (inTable && tableLines.length > 0) {\n const tableHtml = buildTable(tableLines, getAttr);\n if (tableHtml) {\n result.push(tableHtml);\n } else {\n result.push(...tableLines);\n }\n }\n \n return result.join('\\n');\n}\n\n/**\n * Build an HTML table from markdown table lines\n */\nfunction buildTable(lines, getAttr) {\n \n if (lines.length < 2) return null;\n \n // Check for separator line (second line should be the separator)\n let separatorIndex = -1;\n for (let i = 1; i < lines.length; i++) {\n // Support separator with or without leading/trailing pipes\n if (/^\\|?[\\s\\-:|]+\\|?$/.test(lines[i]) && lines[i].includes('-')) {\n separatorIndex = i;\n break;\n }\n }\n \n if (separatorIndex === -1) return null;\n \n const headerLines = lines.slice(0, separatorIndex);\n const bodyLines = lines.slice(separatorIndex + 1);\n \n // Parse alignment from separator\n const separator = lines[separatorIndex];\n // Handle pipes at start/end or not\n const separatorCells = separator.trim().replace(/^\\|/, '').replace(/\\|$/, '').split('|');\n const alignments = separatorCells.map(cell => {\n const trimmed = cell.trim();\n if (trimmed.startsWith(':') && trimmed.endsWith(':')) return 'center';\n if (trimmed.endsWith(':')) return 'right';\n return 'left';\n });\n \n let html = `<table${getAttr('table')}>\\n`;\n \n // Build header\n // Note: headerLines will always have length > 0 since separatorIndex starts from 1\n html += `<thead${getAttr('thead')}>\\n`;\n headerLines.forEach(line => {\n html += `<tr${getAttr('tr')}>\\n`;\n // Handle pipes at start/end or not\n const cells = line.trim().replace(/^\\|/, '').replace(/\\|$/, '').split('|');\n cells.forEach((cell, i) => {\n const alignStyle = alignments[i] && alignments[i] !== 'left' ? `text-align:${alignments[i]}` : '';\n const processedCell = processInlineMarkdown(cell.trim(), getAttr);\n html += `<th${getAttr('th', alignStyle)}>${processedCell}</th>\\n`;\n });\n html += '</tr>\\n';\n });\n html += '</thead>\\n';\n \n // Build body\n if (bodyLines.length > 0) {\n html += `<tbody${getAttr('tbody')}>\\n`;\n bodyLines.forEach(line => {\n html += `<tr${getAttr('tr')}>\\n`;\n // Handle pipes at start/end or not\n const cells = line.trim().replace(/^\\|/, '').replace(/\\|$/, '').split('|');\n cells.forEach((cell, i) => {\n const alignStyle = alignments[i] && alignments[i] !== 'left' ? `text-align:${alignments[i]}` : '';\n const processedCell = processInlineMarkdown(cell.trim(), getAttr);\n html += `<td${getAttr('td', alignStyle)}>${processedCell}</td>\\n`;\n });\n html += '</tr>\\n';\n });\n html += '</tbody>\\n';\n }\n \n html += '</table>';\n return html;\n}\n\n/**\n * Process markdown lists (ordered and unordered)\n */\nfunction processLists(text, getAttr, inline_styles, bidirectional) {\n \n const lines = text.split('\\n');\n const result = [];\n let listStack = []; // Track nested lists\n \n // Helper to escape HTML for data-qd attributes\n const escapeHtml = (text) => text.replace(/[&<>\"']/g, m => ({'&':'&','<':'<','>':'>','\"':'"',\"'\":'''})[m]);\n const dataQd = bidirectional ? (marker) => ` data-qd=\"${escapeHtml(marker)}\"` : () => '';\n \n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n const match = line.match(/^(\\s*)([*\\-+]|\\d+\\.)\\s+(.+)$/);\n \n if (match) {\n const [, indent, marker, content] = match;\n const level = Math.floor(indent.length / 2);\n const isOrdered = /^\\d+\\./.test(marker);\n const listType = isOrdered ? 'ol' : 'ul';\n \n // Check for task list items\n let listItemContent = content;\n let taskListClass = '';\n const taskMatch = content.match(/^\\[([x ])\\]\\s+(.*)$/i);\n if (taskMatch && !isOrdered) {\n const [, checked, taskContent] = taskMatch;\n const isChecked = checked.toLowerCase() === 'x';\n const checkboxAttr = inline_styles \n ? ' style=\"margin-right:.5em\"' \n : ` class=\"${CLASS_PREFIX}task-checkbox\"`;\n listItemContent = `<input type=\"checkbox\"${checkboxAttr}${isChecked ? ' checked' : ''} disabled> ${taskContent}`;\n taskListClass = inline_styles ? ' style=\"list-style:none\"' : ` class=\"${CLASS_PREFIX}task-item\"`;\n }\n \n // Close deeper levels\n while (listStack.length > level + 1) {\n const list = listStack.pop();\n result.push(`</${list.type}>`);\n }\n \n // Open new level if needed\n if (listStack.length === level) {\n // Need to open a new list\n listStack.push({ type: listType, level });\n result.push(`<${listType}${getAttr(listType)}>`);\n } else if (listStack.length === level + 1) {\n // Check if we need to switch list type\n const currentList = listStack[listStack.length - 1];\n if (currentList.type !== listType) {\n result.push(`</${currentList.type}>`);\n listStack.pop();\n listStack.push({ type: listType, level });\n result.push(`<${listType}${getAttr(listType)}>`);\n }\n }\n \n const liAttr = taskListClass || getAttr('li');\n result.push(`<li${liAttr}${dataQd(marker)}>${listItemContent}</li>`);\n } else {\n // Not a list item, close all lists\n while (listStack.length > 0) {\n const list = listStack.pop();\n result.push(`</${list.type}>`);\n }\n result.push(line);\n }\n }\n \n // Close any remaining lists\n while (listStack.length > 0) {\n const list = listStack.pop();\n result.push(`</${list.type}>`);\n }\n \n return result.join('\\n');\n}\n\n/**\n * Emit CSS styles for quikdown elements\n * @param {string} prefix - Optional class prefix (default: 'quikdown-')\n * @param {string} theme - Optional theme: 'light' (default) or 'dark'\n * @returns {string} CSS string with quikdown styles\n */\nquikdown.emitStyles = function(prefix = 'quikdown-', theme = 'light') {\n const styles = QUIKDOWN_STYLES;\n \n // Define theme color overrides\n const themeOverrides = {\n dark: {\n '#f4f4f4': '#2a2a2a', // pre background\n '#f0f0f0': '#2a2a2a', // code background\n '#f2f2f2': '#2a2a2a', // th background\n '#ddd': '#3a3a3a', // borders\n '#06c': '#6db3f2', // links\n _textColor: '#e0e0e0'\n },\n light: {\n _textColor: '#333' // Explicit text color for light theme\n }\n };\n \n let css = '';\n for (const [tag, style] of Object.entries(styles)) {\n let themedStyle = style;\n \n // Apply theme overrides if dark theme\n if (theme === 'dark' && themeOverrides.dark) {\n // Replace colors\n for (const [oldColor, newColor] of Object.entries(themeOverrides.dark)) {\n if (!oldColor.startsWith('_')) {\n themedStyle = themedStyle.replace(new RegExp(oldColor, 'g'), newColor);\n }\n }\n \n // Add text color for certain elements in dark theme\n const needsTextColor = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'td', 'li', 'blockquote'];\n if (needsTextColor.includes(tag)) {\n themedStyle += `;color:${themeOverrides.dark._textColor}`;\n }\n } else if (theme === 'light' && themeOverrides.light) {\n // Add explicit text color for light theme elements too\n const needsTextColor = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'td', 'li', 'blockquote'];\n if (needsTextColor.includes(tag)) {\n themedStyle += `;color:${themeOverrides.light._textColor}`;\n }\n }\n \n css += `.${prefix}${tag} { ${themedStyle} }\\n`;\n }\n \n return css;\n};\n\n/**\n * Configure quikdown with options and return a function\n * @param {Object} options - Configuration options\n * @returns {Function} Configured quikdown function\n */\nquikdown.configure = function(options) {\n return function(markdown) {\n return quikdown(markdown, options);\n };\n};\n\n/**\n * Version information\n */\nquikdown.version = quikdownVersion;\n\n// Export for both CommonJS and ES6\n/* istanbul ignore next */\nif (typeof module !== 'undefined' && module.exports) {\n module.exports = quikdown;\n}\n\n// For browser global\n/* istanbul ignore next */\nif (typeof window !== 'undefined') {\n window.quikdown = quikdown;\n}\n\nexport { quikdown as default };\n","import quikchat from './quikchat.js';\nimport quikdown from 'quikdown';\n\n// Subclass that pre-wires quikdown as the message formatter\nclass quikchatMD extends quikchat {\n constructor(parentElement, onSend, options = {}) {\n if (!options.messageFormatter) {\n options.messageFormatter = (content) => quikdown(content);\n }\n super(parentElement, onSend, options);\n }\n}\n\n// Expose quikdown on the class for direct access\nquikchatMD.quikdown = quikdown;\n\nexport default quikchatMD;\n"],"names":["quikchat","_createClass","parentElement","onSend","arguments","length","undefined","options","_classCallCheck","meta","_objectSpread","theme","trackHistory","showTimestamps","titleArea","title","show","align","messagesArea","alternating","document","querySelector","this","_parentElement","_theme","_onSend","_messageFormatter","messageFormatter","_sanitize","sanitize","_createWidget","titleAreaSetContents","titleAreaShow","titleAreaHide","messagesAreaAlternateColors","messagesAreaShowTimestamps","direction","setDirection","_attachEventListeners","_historyLimit","_history","key","value","widgetHTML","concat","innerHTML","_chatWidget","_titleArea","_messagesWrapper","_messagesArea","_scrollBottomBtn","_inputArea","_textEntry","_sendButton","msgid","_this","addEventListener","text","trim","event","shiftKey","keyCode","preventDefault","_autoGrowTextarea","_this$_messagesArea","scrollTop","scrollHeight","clientHeight","userScrolledUp","_updateScrollBottomBtn","scrollToBottom","ctrlKey","ResizeObserver","_resizeObserver","_handleContainerResize","observe","callback","_onMessageAdded","_onMessageAppend","_onMessageReplace","_onMessageDelete","style","display","textAlign","inputAreaShow","inputAreaHide","enabled","disabled","textContent","dir","d","setAttribute","classList","add","remove","getAttribute","el","height","maxHeight","parseInt","getComputedStyle","getPropertyValue","Math","min","overflowY","isoString","Date","h","getHours","String","getMinutes","padStart","contains","toggle","str","div","createElement","content","_escapeHTML","alt","input","userString","role","userID","messageDiv","msgidClass","children","visible","tags","Array","isArray","slice","userDiv","contentDiv","_processContent","timestamp","toISOString","timestampSpan","_formatTimestamp","appendChild","updatedtime","push","shift","messageAddFull","n","success","removeChild","_error","splice","findIndex","item","msg","filter","msgEl","messageGetDOMObject","find","entry","current","messageGetVisible","messageSetVisible","tag","_step","count","_iterator","_createForOfIteratorHelper","s","done","includes","err","e","f","formatter","m","map","data","_step2","_iterator2","newTheme","get","version","license","url","numChars","startSpot","startWithCapitalLetter","loremText","floor","random","test","l","substring","toUpperCase","CLASS_PREFIX","PLACEHOLDER_CB","ESC_MAP","QUIKDOWN_STYLES","h1","h2","h3","h4","h5","h6","pre","code","blockquote","table","th","td","hr","img","a","strong","em","del","ul","ol","li","quikdown","markdown","fence_plugin","inline_styles","bidirectional","lazy_linefeeds","getAttr","styles","additionalStyle","replace","endsWith","classAttr","createGetAttr","escapeHtml","dataQd","marker","sanitizeUrl","allowUnsafe","trimmedUrl","lowerUrl","toLowerCase","dangerousProtocols","protocol","startsWith","html","codeBlocks","inlineCodes","match","fence","lang","placeholder","langTrimmed","render","trimEnd","custom","hasReverse","reverse","lines","split","result","inTable","tableLines","i","line","tableHtml","buildTable","join","processTable","hashes","level","listStack","indent","isOrdered","listType","listItemContent","taskListClass","taskMatch","checked","taskContent","isChecked","list","pop","type","currentList","liAttr","processLists","src","sanitizedSrc","allow_unsafe_urls","altAttr","srcAttr","href","sanitizedHref","rel","textAttr","prefix","sanitizedUrl","forEach","pattern","blocks","bi","b","offset","RegExp","replacement","block","langClass","codeAttr","langAttr","fenceAttr","processInlineMarkdown","separatorIndex","headerLines","bodyLines","alignments","cell","trimmed","alignStyle","processedCell","emitStyles","themeOverrides","_textColor","css","Object","entries","themedStyle","oldColor","newColor","configure","module","exports","window","quikchatMD","_quikchat","_callSuper","_inherits"],"mappings":"y0GACMA,EAAQ,WAmDT,OAAAC,GA7CD,SAAAD,EAAYE,GAAiD,IAAlCC,EAAMC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,WAAQ,EAAGG,EAAOH,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,CAAA,EAAEI,OAAAR,GACvD,IAOMS,EAAIC,EAAAA,EAAA,CAAA,EAPU,CAChBC,MAAO,uBACPC,cAAc,EACdC,gBAAgB,EAChBC,UAAW,CAAEC,MAAO,OAAQC,MAAM,EAAOC,MAAO,UAChDC,aAAc,CAAEC,aAAa,KAECZ,GAEL,iBAAlBL,IACPA,EAAgBkB,SAASC,cAAcnB,IAE3CoB,KAAKC,eAAiBrB,EACtBoB,KAAKE,OA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