vanilla-breeze 0.4.0 → 0.5.0
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/custom-elements.json +13966 -11505
- package/dist/cdn/components/accordion-wc.js +1 -1
- package/dist/cdn/components/activity-feed.js +1 -1
- package/dist/cdn/components/ai-chat.js +9 -6
- package/dist/cdn/components/ai-summary.js +4 -2
- package/dist/cdn/components/analytics-panel.js +19 -21
- package/dist/cdn/components/audio-player.js +17 -7
- package/dist/cdn/components/audio-visualizer.js +3 -3
- package/dist/cdn/components/author-index.js +2 -2
- package/dist/cdn/components/brand-mark.js +1 -1
- package/dist/cdn/components/bread-crumb.js +1 -1
- package/dist/cdn/components/calendar-wc.js +2 -2
- package/dist/cdn/components/card-list.js +1 -1
- package/dist/cdn/components/carousel-wc.js +1 -1
- package/dist/cdn/components/change-set.js +1 -11
- package/dist/cdn/components/chart-wc.js +32 -32
- package/dist/cdn/components/chat-input.js +1 -1
- package/dist/cdn/components/chat-window.js +1 -1
- package/dist/cdn/components/color-picker.js +1 -1
- package/dist/cdn/components/combo-box.js +1 -1
- package/dist/cdn/components/command-palette.js +1 -1
- package/dist/cdn/components/comment-box.js +49 -49
- package/dist/cdn/components/comment-thread.js +32 -32
- package/dist/cdn/components/comment-wc.js +1 -1
- package/dist/cdn/components/compare-surface.js +1 -1
- package/dist/cdn/components/consent-banner.js +1 -1
- package/dist/cdn/components/content-lens.js +1 -1
- package/dist/cdn/components/content-swap.js +1 -1
- package/dist/cdn/components/context-menu.js +1 -1
- package/dist/cdn/components/data-table.js +1 -1
- package/dist/cdn/components/date-picker.js +1 -1
- package/dist/cdn/components/day-view.js +1 -1
- package/dist/cdn/components/diagram-wc.js +2 -2
- package/dist/cdn/components/drag-surface.js +1 -1
- package/dist/cdn/components/drop-down.js +1 -1
- package/dist/cdn/components/emoji-picker.js +1 -1
- package/dist/cdn/components/flow-diagram.js +1 -1
- package/dist/cdn/components/foot-notes.js +1 -1
- package/dist/cdn/components/form-field.js +1 -1
- package/dist/cdn/components/geo-map.js +4 -4
- package/dist/cdn/components/glossary-index.js +1 -1
- package/dist/cdn/components/glossary-wc.js +1 -1
- package/dist/cdn/components/heading-links.js +1 -1
- package/dist/cdn/components/highlight-wc.js +2 -2
- package/dist/cdn/components/image-gallery.js +1 -1
- package/dist/cdn/components/image-map.js +1 -1
- package/dist/cdn/components/include-file.js +1 -1
- package/dist/cdn/components/manifest.json +100 -100
- package/dist/cdn/components/markdown-editor.js +1 -1
- package/dist/cdn/components/markdown-viewer.js +11 -11
- package/dist/cdn/components/nav-bar.js +1 -1
- package/dist/cdn/components/note-wc.js +2 -2
- package/dist/cdn/components/notification-wc.js +4 -4
- package/dist/cdn/components/page-info.js +2 -2
- package/dist/cdn/components/page-stats.js +1 -1
- package/dist/cdn/components/page-toc.js +1 -1
- package/dist/cdn/components/page-tools.js +1 -1
- package/dist/cdn/components/page-tour.js +5 -5
- package/dist/cdn/components/pager-wc.js +1 -1
- package/dist/cdn/components/poll-wc.js +1 -1
- package/dist/cdn/components/pop-over.js +1 -1
- package/dist/cdn/components/popularity-index.js +4 -4
- package/dist/cdn/components/print-page.js +1 -1
- package/dist/cdn/components/progress-tracker.js +1 -1
- package/dist/cdn/components/qr-code.js +1 -1
- package/dist/cdn/components/reaction-bar.js +1 -1
- package/dist/cdn/components/reader-view.js +3 -3
- package/dist/cdn/components/reading-progress.js +1 -1
- package/dist/cdn/components/recently-visited.js +7 -7
- package/dist/cdn/components/score-card.js +2 -2
- package/dist/cdn/components/selection-menu.js +1 -1
- package/dist/cdn/components/settings-panel.js +4 -4
- package/dist/cdn/components/share-wc.js +2 -2
- package/dist/cdn/components/short-cuts.js +1 -1
- package/dist/cdn/components/site-index.js +6 -6
- package/dist/cdn/components/site-map.js +1 -1
- package/dist/cdn/components/site-search.js +3 -3
- package/dist/cdn/components/slide-accept.js +1 -1
- package/dist/cdn/components/social-embed.js +1 -1
- package/dist/cdn/components/split-surface.js +1 -1
- package/dist/cdn/components/star-rating.js +1 -1
- package/dist/cdn/components/status-wc.js +1 -1
- package/dist/cdn/components/stepper-wc.js +1 -1
- package/dist/cdn/components/tab-set.js +1 -1
- package/dist/cdn/components/text-reader.js +2 -2
- package/dist/cdn/components/theme-picker.js +44 -44
- package/dist/cdn/components/time-index.js +2 -2
- package/dist/cdn/components/time-picker.js +1 -1
- package/dist/cdn/components/toast-msg.js +1 -1
- package/dist/cdn/components/tool-tip.js +1 -1
- package/dist/cdn/components/topic-map.js +3 -3
- package/dist/cdn/components/trust-filter.js +3 -3
- package/dist/cdn/components/version-switcher.js +3 -13
- package/dist/cdn/components/video-player.js +1 -1
- package/dist/cdn/components/watch-wc.js +2 -2
- package/dist/cdn/components/week-view.js +1 -1
- package/dist/cdn/components/youtube-player.js +1 -1
- package/dist/cdn/packs/effects.full.js +1 -1
- package/dist/cdn/packs/kawaii.effects.css +1 -1
- package/dist/cdn/packs/kawaii.full.css +1 -1
- package/dist/cdn/packs/kawaii.full.js +4 -4
- package/dist/cdn/packs/manifest.json +7 -7
- package/dist/cdn/packs/memphis.full.css +1 -1
- package/dist/cdn/packs/memphis.theme.css +1 -1
- package/dist/cdn/packs/ui.full.js +46 -46
- package/dist/cdn/themes/8bit.css +1 -1
- package/dist/cdn/themes/8bit.tokens.json +1 -1
- package/dist/cdn/themes/alpha1999-dark.tokens.json +1 -1
- package/dist/cdn/themes/alpha1999.tokens.json +1 -1
- package/dist/cdn/themes/art-deco-dark.tokens.json +33 -1
- package/dist/cdn/themes/art-deco.css +1 -1
- package/dist/cdn/themes/art-deco.tokens.json +23 -1
- package/dist/cdn/themes/bauhaus-dark.tokens.json +23 -1
- package/dist/cdn/themes/bauhaus.css +1 -1
- package/dist/cdn/themes/bauhaus.tokens.json +1 -1
- package/dist/cdn/themes/brutalist-dark.tokens.json +33 -1
- package/dist/cdn/themes/brutalist.css +1 -1
- package/dist/cdn/themes/brutalist.tokens.json +23 -1
- package/dist/cdn/themes/catppuccin-frappe.tokens.json +1 -1
- package/dist/cdn/themes/catppuccin-latte-dark.tokens.json +1 -1
- package/dist/cdn/themes/catppuccin-latte.tokens.json +1 -1
- package/dist/cdn/themes/catppuccin-macchiato.tokens.json +1 -1
- package/dist/cdn/themes/catppuccin-mocha.tokens.json +1 -1
- package/dist/cdn/themes/classic-dark.tokens.json +1 -1
- package/dist/cdn/themes/classic.tokens.json +1 -1
- package/dist/cdn/themes/claymorphism-dark.tokens.json +33 -1
- package/dist/cdn/themes/claymorphism.css +1 -1
- package/dist/cdn/themes/claymorphism.tokens.json +23 -1
- package/dist/cdn/themes/clinical-dark.tokens.json +1 -1
- package/dist/cdn/themes/clinical.tokens.json +1 -1
- package/dist/cdn/themes/cottagecore-dark.tokens.json +1 -1
- package/dist/cdn/themes/cottagecore.css +1 -1
- package/dist/cdn/themes/cottagecore.tokens.json +1 -1
- package/dist/cdn/themes/cyber.css +1 -1
- package/dist/cdn/themes/cyber.tokens.json +1 -1
- package/dist/cdn/themes/dawn-dark.tokens.json +33 -1
- package/dist/cdn/themes/dawn.css +1 -1
- package/dist/cdn/themes/dawn.tokens.json +23 -1
- package/dist/cdn/themes/dracula.tokens.json +1 -1
- package/dist/cdn/themes/dusk.css +1 -1
- package/dist/cdn/themes/dusk.tokens.json +1 -1
- package/dist/cdn/themes/editorial-dark.tokens.json +1 -1
- package/dist/cdn/themes/editorial.css +1 -1
- package/dist/cdn/themes/editorial.tokens.json +1 -1
- package/dist/cdn/themes/financial-dark.tokens.json +1 -1
- package/dist/cdn/themes/financial.tokens.json +1 -1
- package/dist/cdn/themes/genai.css +1 -1
- package/dist/cdn/themes/genai.tokens.json +1 -1
- package/dist/cdn/themes/glassmorphism-dark.tokens.json +1 -1
- package/dist/cdn/themes/glassmorphism.tokens.json +1 -1
- package/dist/cdn/themes/government-dark.tokens.json +1 -1
- package/dist/cdn/themes/government.tokens.json +1 -1
- package/dist/cdn/themes/gruvbox-dark.tokens.json +1 -1
- package/dist/cdn/themes/gruvbox.tokens.json +1 -1
- package/dist/cdn/themes/high-noon-dark.tokens.json +23 -1
- package/dist/cdn/themes/high-noon.css +1 -1
- package/dist/cdn/themes/high-noon.tokens.json +1 -1
- package/dist/cdn/themes/journal-dark.tokens.json +33 -1
- package/dist/cdn/themes/journal.css +1 -1
- package/dist/cdn/themes/journal.tokens.json +23 -1
- package/dist/cdn/themes/kawaii-dark.tokens.json +1 -1
- package/dist/cdn/themes/kawaii.css +1 -1
- package/dist/cdn/themes/kawaii.tokens.json +1 -1
- package/dist/cdn/themes/magna-dark.tokens.json +1 -1
- package/dist/cdn/themes/magna.tokens.json +1 -1
- package/dist/cdn/themes/manifest.json +26 -50
- package/dist/cdn/themes/midnight.tokens.json +1 -1
- package/dist/cdn/themes/minimal-dark.tokens.json +1 -1
- package/dist/cdn/themes/minimal.tokens.json +1 -1
- package/dist/cdn/themes/modern-dark.tokens.json +1 -1
- package/dist/cdn/themes/modern.tokens.json +1 -1
- package/dist/cdn/themes/nes-dark.tokens.json +1 -1
- package/dist/cdn/themes/nes.css +1 -1
- package/dist/cdn/themes/nes.tokens.json +1 -1
- package/dist/cdn/themes/neumorphism-dark.tokens.json +1 -1
- package/dist/cdn/themes/neumorphism.css +1 -1
- package/dist/cdn/themes/neumorphism.tokens.json +1 -1
- package/dist/cdn/themes/nord-dark.tokens.json +33 -1
- package/dist/cdn/themes/nord.css +1 -1
- package/dist/cdn/themes/nord.tokens.json +23 -1
- package/dist/cdn/themes/organic-dark.tokens.json +1 -1
- package/dist/cdn/themes/organic.css +1 -1
- package/dist/cdn/themes/organic.tokens.json +1 -1
- package/dist/cdn/themes/rose-pine-dark.tokens.json +1 -1
- package/dist/cdn/themes/rose-pine.tokens.json +1 -1
- package/dist/cdn/themes/rough-dark.tokens.json +1 -1
- package/dist/cdn/themes/rough.css +1 -1
- package/dist/cdn/themes/rough.tokens.json +1 -1
- package/dist/cdn/themes/solarized-dark.tokens.json +23 -1
- package/dist/cdn/themes/solarized.css +1 -1
- package/dist/cdn/themes/solarized.tokens.json +23 -1
- package/dist/cdn/themes/startup-dark.tokens.json +1 -1
- package/dist/cdn/themes/startup.tokens.json +1 -1
- package/dist/cdn/themes/super2026-dark.tokens.json +33 -1
- package/dist/cdn/themes/super2026.css +1 -1
- package/dist/cdn/themes/super2026.tokens.json +23 -1
- package/dist/cdn/themes/swiss-dark.tokens.json +1 -1
- package/dist/cdn/themes/swiss.css +1 -1
- package/dist/cdn/themes/swiss.tokens.json +1 -1
- package/dist/cdn/themes/terminal.css +1 -1
- package/dist/cdn/themes/terminal.tokens.json +1 -1
- package/dist/cdn/themes/tokyo-night-dark.tokens.json +33 -1
- package/dist/cdn/themes/tokyo-night.css +1 -1
- package/dist/cdn/themes/tokyo-night.tokens.json +23 -1
- package/dist/cdn/themes/vaporwave-dark.tokens.json +33 -1
- package/dist/cdn/themes/vaporwave.css +1 -1
- package/dist/cdn/themes/vaporwave.tokens.json +23 -1
- package/dist/cdn/themes/win9x-dark.tokens.json +15 -4
- package/dist/cdn/themes/win9x.css +1 -1
- package/dist/cdn/themes/win9x.tokens.json +1 -1
- package/dist/cdn/vanilla-breeze-autoload.js +663 -0
- package/dist/cdn/vanilla-breeze-charts.css +1 -1
- package/dist/cdn/vanilla-breeze-charts.js +32 -32
- package/dist/cdn/vanilla-breeze-core.css +1 -1
- package/dist/cdn/vanilla-breeze-core.js +78 -80
- package/dist/cdn/vanilla-breeze-dev.css +1 -1
- package/dist/cdn/vanilla-breeze-extras.js +47 -37
- package/dist/cdn/vanilla-breeze.css +1 -1
- package/dist/cdn/vanilla-breeze.js +180 -177
- package/package.json +12 -7
- package/dist/cdn/themes/amber.css +0 -2
- package/dist/cdn/themes/anthropic.css +0 -2
- package/dist/cdn/themes/anthropic.tokens.json +0 -564
- package/dist/cdn/themes/coral.css +0 -2
- package/dist/cdn/themes/emerald.css +0 -2
- package/dist/cdn/themes/forest.css +0 -2
- package/dist/cdn/themes/ibm.css +0 -2
- package/dist/cdn/themes/ibm.tokens.json +0 -568
- package/dist/cdn/themes/indigo.css +0 -2
- package/dist/cdn/themes/lavender.css +0 -2
- package/dist/cdn/themes/mcdonalds.css +0 -2
- package/dist/cdn/themes/mcdonalds.tokens.json +0 -533
- package/dist/cdn/themes/ocean.css +0 -2
- package/dist/cdn/themes/rose.css +0 -2
- package/dist/cdn/themes/slate.css +0 -2
- package/dist/cdn/themes/starbucks.css +0 -2
- package/dist/cdn/themes/starbucks.tokens.json +0 -593
- package/dist/cdn/themes/sunset.css +0 -2
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
var
|
|
2
|
-
`).map(i=>{let
|
|
3
|
-
`)}function
|
|
4
|
-
]`).replace("lheading",
|
|
5
|
-
`)}}}fences(n){let e=this.rules.block.fences.exec(n);if(e){let t=e[0],s=
|
|
1
|
+
var _e=Object.defineProperty;var C=(n,e)=>()=>(n&&(e=n(n=0)),e);var he=(n,e)=>{for(var t in e)_e(n,t,{get:e[t],enumerable:!0})};function A(n,e,t={}){let s=t.priority??10,r={impl:e,bundle:t.bundle,contract:t.contract,priority:s},i=ue.get(n);if(customElements.get(n)){if(!i||i.priority>=s){i&&i.priority===s&&i.impl!==e&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${n}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${t.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=s){i.priority===s&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${i.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}ue.set(n,r),customElements.define(n,e)}var Tt,ue,z=C(()=>{Tt=window.matchMedia("(prefers-reduced-motion: reduce)"),ue=new Map});var w,q=C(()=>{w=class extends HTMLElement{#e=[];#t;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#e)e();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,t,s,r){e.addEventListener(t,s,r),this.#e.push(()=>e.removeEventListener(t,s,r))}_reinit(){for(let e of this.#e)e();this.#e=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(e,t){this.#t||(this.#t=this.attachInternals());let s=this.#t.states;try{t?s.add(e):s.delete(e)}catch{let r=`--${e}`;t?s.add(r):s.delete(r)}}_adoptInternals(e){this.#t||(this.#t=e)}}});function B(n){if(!n||typeof n!="string")return"";let e=document.createElement("template");return e.innerHTML=n,e.content.querySelectorAll("script, iframe, object, embed, form, base, link, meta, noscript").forEach(r=>r.remove()),e.content.querySelectorAll("*").forEach(r=>{for(let i of[...r.attributes]){if(i.name.startsWith("on")){r.removeAttribute(i.name);continue}if(["href","src","action","formaction","xlink:href"].includes(i.name)){let l=i.value.trim().toLowerCase();(l.startsWith("javascript:")||l.startsWith("data:text/html"))&&r.removeAttribute(i.name);continue}(i.name==="srcdoc"||i.name==="data"&&r.tagName==="OBJECT")&&r.removeAttribute(i.name)}}),e.innerHTML}var V=C(()=>{});function K(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}function ke(n){E=n}function u(n,e=""){let t=typeof n=="string"?n:n.source,s={replace:(r,i)=>{let l=typeof i=="string"?i:i.source;return l=l.replace(b.caret,"$1"),t=t.replace(r,l),s},getRegex:()=>new RegExp(t,e)};return s}function y(n,e){if(e){if(b.escapeTest.test(n))return n.replace(b.escapeReplace,me)}else if(b.escapeTestNoEncode.test(n))return n.replace(b.escapeReplaceNoEncode,me);return n}function fe(n){try{n=encodeURI(n).replace(b.percentDecode,"%")}catch{return null}return n}function ge(n,e){let t=n.replace(b.findPipe,(i,l,o)=>{let a=!1,h=l;for(;--h>=0&&o[h]==="\\";)a=!a;return a?"|":" |"}),s=t.split(b.splitPipe),r=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;r<s.length;r++)s[r]=s[r].trim().replace(b.slashPipe,"|");return s}function L(n,e,t){let s=n.length;if(s===0)return"";let r=0;for(;r<s;){let i=n.charAt(s-r-1);if(i===e&&!t)r++;else if(i!==e&&t)r++;else break}return n.slice(0,s-r)}function xt(n,e){if(n.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<n.length;s++)if(n[s]==="\\")s++;else if(n[s]===e[0])t++;else if(n[s]===e[1]&&(t--,t<0))return s;return t>0?-2:-1}function wt(n,e=0){let t=e,s="";for(let r of n)if(r===" "){let i=4-t%4;s+=" ".repeat(i),t+=i}else s+=r,t++;return s}function be(n,e,t,s,r){let i=e.href,l=e.title||null,o=n[1].replace(r.other.outputLinkReplace,"$1");s.state.inLink=!0;let a={type:n[0].charAt(0)==="!"?"image":"link",raw:t,href:i,title:l,text:o,tokens:s.inlineTokens(o)};return s.state.inLink=!1,a}function yt(n,e,t){let s=n.match(t.other.indentCodeCompensation);if(s===null)return e;let r=s[1];return e.split(`
|
|
2
|
+
`).map(i=>{let l=i.match(t.other.beginningSpace);if(l===null)return i;let[o]=l;return o.length>=r.length?i.slice(r.length):i}).join(`
|
|
3
|
+
`)}function m(n,e){return $.parse(n,e)}var E,S,Be,b,Ne,Me,De,_,He,X,xe,we,Oe,J,Ze,Y,Fe,je,O,ee,Qe,ye,Ve,te,pe,Ue,We,Ge,Ke,ve,Xe,T,Z,re,Je,Ae,Ye,et,tt,Se,rt,st,$e,nt,it,lt,at,ot,ct,ht,ut,pt,dt,M,mt,Ee,Ce,ft,de,se,gt,U,bt,N,I,kt,me,D,k,H,ne,x,P,vt,$,It,Lt,Pt,_t,Bt,Nt,Mt,Te=C(()=>{E=K();S={exec:()=>null};Be=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),b={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}#`),htmlBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}>`)},Ne=/^(?:[ \t]*(?:\n|$))+/,Me=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,De=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,_=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,He=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,X=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,xe=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,we=u(xe).replace(/bull/g,X).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Oe=u(xe).replace(/bull/g,X).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),J=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Ze=/^[^\n]+/,Y=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Fe=u(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Y).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),je=u(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,X).getRegex(),O="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ee=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Qe=u("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ee).replace("tag",O).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ye=u(J).replace("hr",_).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",O).getRegex(),Ve=u(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ye).getRegex(),te={blockquote:Ve,code:Me,def:Fe,fences:De,heading:He,hr:_,html:Qe,lheading:we,list:je,newline:Ne,paragraph:ye,table:S,text:Ze},pe=u("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",_).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",O).getRegex(),Ue={...te,lheading:Oe,table:pe,paragraph:u(J).replace("hr",_).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",pe).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",O).getRegex()},We={...te,html:u(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ee).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:S,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:u(J).replace("hr",_).replace("heading",` *#{1,6} *[^
|
|
4
|
+
]`).replace("lheading",we).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Ge=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ke=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ve=/^( {2,}|\\)\n(?!\s*$)/,Xe=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,T=/[\p{P}\p{S}]/u,Z=/[\s\p{P}\p{S}]/u,re=/[^\s\p{P}\p{S}]/u,Je=u(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Z).getRegex(),Ae=/(?!~)[\p{P}\p{S}]/u,Ye=/(?!~)[\s\p{P}\p{S}]/u,et=/(?:[^\s\p{P}\p{S}]|~)/u,tt=u(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Be?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Se=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,rt=u(Se,"u").replace(/punct/g,T).getRegex(),st=u(Se,"u").replace(/punct/g,Ae).getRegex(),$e="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",nt=u($e,"gu").replace(/notPunctSpace/g,re).replace(/punctSpace/g,Z).replace(/punct/g,T).getRegex(),it=u($e,"gu").replace(/notPunctSpace/g,et).replace(/punctSpace/g,Ye).replace(/punct/g,Ae).getRegex(),lt=u("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,re).replace(/punctSpace/g,Z).replace(/punct/g,T).getRegex(),at=u(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,T).getRegex(),ot="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",ct=u(ot,"gu").replace(/notPunctSpace/g,re).replace(/punctSpace/g,Z).replace(/punct/g,T).getRegex(),ht=u(/\\(punct)/,"gu").replace(/punct/g,T).getRegex(),ut=u(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),pt=u(ee).replace("(?:-->|$)","-->").getRegex(),dt=u("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",pt).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),M=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,mt=u(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",M).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ee=u(/^!?\[(label)\]\[(ref)\]/).replace("label",M).replace("ref",Y).getRegex(),Ce=u(/^!?\[(ref)\](?:\[\])?/).replace("ref",Y).getRegex(),ft=u("reflink|nolink(?!\\()","g").replace("reflink",Ee).replace("nolink",Ce).getRegex(),de=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,se={_backpedal:S,anyPunctuation:ht,autolink:ut,blockSkip:tt,br:ve,code:Ke,del:S,delLDelim:S,delRDelim:S,emStrongLDelim:rt,emStrongRDelimAst:nt,emStrongRDelimUnd:lt,escape:Ge,link:mt,nolink:Ce,punctuation:Je,reflink:Ee,reflinkSearch:ft,tag:dt,text:Xe,url:S},gt={...se,link:u(/^!?\[(label)\]\((.*?)\)/).replace("label",M).getRegex(),reflink:u(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",M).getRegex()},U={...se,emStrongRDelimAst:it,emStrongLDelim:st,delLDelim:at,delRDelim:ct,url:u(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",de).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:u(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",de).getRegex()},bt={...U,br:u(ve).replace("{2,}","*").getRegex(),text:u(U.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},N={normal:te,gfm:Ue,pedantic:We},I={normal:se,gfm:U,breaks:bt,pedantic:gt},kt={"&":"&","<":"<",">":">",'"':""","'":"'"},me=n=>kt[n];D=class{options;rules;lexer;constructor(n){this.options=n||E}space(n){let e=this.rules.block.newline.exec(n);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(n){let e=this.rules.block.code.exec(n);if(e){let t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:L(t,`
|
|
5
|
+
`)}}}fences(n){let e=this.rules.block.fences.exec(n);if(e){let t=e[0],s=yt(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:s}}}heading(n){let e=this.rules.block.heading.exec(n);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let s=L(t,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(t=s.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(n){let e=this.rules.block.hr.exec(n);if(e)return{type:"hr",raw:L(e[0],`
|
|
6
6
|
`)}}blockquote(n){let e=this.rules.block.blockquote.exec(n);if(e){let t=L(e[0],`
|
|
7
7
|
`).split(`
|
|
8
|
-
`),s="",r="",i=[];for(;t.length>0;){let
|
|
8
|
+
`),s="",r="",i=[];for(;t.length>0;){let l=!1,o=[],a;for(a=0;a<t.length;a++)if(this.rules.other.blockquoteStart.test(t[a]))o.push(t[a]),l=!0;else if(!l)o.push(t[a]);else break;t=t.slice(a);let h=o.join(`
|
|
9
9
|
`),c=h.replace(this.rules.other.blockquoteSetextReplace,`
|
|
10
10
|
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
|
|
11
11
|
${h}`:h,r=r?`${r}
|
|
12
|
-
${c}`:c;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=d,t.length===0)break;let p=i.at(-1);if(p?.type==="code")break;if(p?.type==="blockquote"){let
|
|
12
|
+
${c}`:c;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=d,t.length===0)break;let p=i.at(-1);if(p?.type==="code")break;if(p?.type==="blockquote"){let g=p,f=g.raw+`
|
|
13
13
|
`+t.join(`
|
|
14
|
-
`),v=this.blockquote(
|
|
14
|
+
`),v=this.blockquote(f);i[i.length-1]=v,s=s.substring(0,s.length-g.raw.length)+v.raw,r=r.substring(0,r.length-g.text.length)+v.text;break}else if(p?.type==="list"){let g=p,f=g.raw+`
|
|
15
15
|
`+t.join(`
|
|
16
|
-
`),v=this.list(
|
|
17
|
-
`);continue}}return{type:"blockquote",raw:s,tokens:i,text:r}}}list(n){let e=this.rules.block.list.exec(n);if(e){let t=e[1].trim(),s=t.length>1,r={type:"list",raw:"",ordered:s,start:s?+t.slice(0,-1):"",loose:!1,items:[]};t=s?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=s?t:"[*+-]");let i=this.rules.other.listItemRegex(t),
|
|
16
|
+
`),v=this.list(f);i[i.length-1]=v,s=s.substring(0,s.length-p.raw.length)+v.raw,r=r.substring(0,r.length-g.raw.length)+v.raw,t=f.substring(i.at(-1).raw.length).split(`
|
|
17
|
+
`);continue}}return{type:"blockquote",raw:s,tokens:i,text:r}}}list(n){let e=this.rules.block.list.exec(n);if(e){let t=e[1].trim(),s=t.length>1,r={type:"list",raw:"",ordered:s,start:s?+t.slice(0,-1):"",loose:!1,items:[]};t=s?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=s?t:"[*+-]");let i=this.rules.other.listItemRegex(t),l=!1;for(;n;){let a=!1,h="",c="";if(!(e=i.exec(n))||this.rules.block.hr.test(n))break;h=e[0],n=n.substring(h.length);let d=wt(e[2].split(`
|
|
18
18
|
`,1)[0],e[1].length),p=n.split(`
|
|
19
|
-
`,1)[0],
|
|
20
|
-
`,n=n.substring(p.length+1),
|
|
21
|
-
`,1)[0],
|
|
22
|
-
`+
|
|
23
|
-
`+p}
|
|
24
|
-
`,n=n.substring(
|
|
25
|
-
`):[],i={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===s.length){for(let
|
|
26
|
-
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(n){let e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){let e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(n){let e=this.rules.inline.tag.exec(n);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(n){let e=this.rules.inline.link.exec(n);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let i=L(t.slice(0,-1),"\\");if((t.length-i.length)%2===0)return}else{let i=
|
|
27
|
-
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let s=this.inlineQueue[t];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],s=!1){for(this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(b.tabCharGlobal," ").replace(b.spaceLine,""));e;){let r;if(this.options.extensions?.block?.some(
|
|
28
|
-
`:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let
|
|
19
|
+
`,1)[0],g=!d.trim(),f=0;if(this.options.pedantic?(f=2,c=d.trimStart()):g?f=e[1].length+1:(f=d.search(this.rules.other.nonSpaceChar),f=f>4?1:f,c=d.slice(f),f+=e[1].length),g&&this.rules.other.blankLine.test(p)&&(h+=p+`
|
|
20
|
+
`,n=n.substring(p.length+1),a=!0),!a){let v=this.rules.other.nextBulletRegex(f),ae=this.rules.other.hrRegex(f),oe=this.rules.other.fencesBeginRegex(f),ce=this.rules.other.headingBeginRegex(f),Le=this.rules.other.htmlBeginRegex(f),Pe=this.rules.other.blockquoteBeginRegex(f);for(;n;){let Q=n.split(`
|
|
21
|
+
`,1)[0],R;if(p=Q,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),R=p):R=p.replace(this.rules.other.tabCharGlobal," "),oe.test(p)||ce.test(p)||Le.test(p)||Pe.test(p)||v.test(p)||ae.test(p))break;if(R.search(this.rules.other.nonSpaceChar)>=f||!p.trim())c+=`
|
|
22
|
+
`+R.slice(f);else{if(g||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||oe.test(d)||ce.test(d)||ae.test(d))break;c+=`
|
|
23
|
+
`+p}g=!p.trim(),h+=Q+`
|
|
24
|
+
`,n=n.substring(Q.length+1),d=R.slice(f)}}r.loose||(l?r.loose=!0:this.rules.other.doubleBlankLine.test(h)&&(l=!0)),r.items.push({type:"list_item",raw:h,task:!!this.options.gfm&&this.rules.other.listIsTask.test(c),loose:!1,text:c,tokens:[]}),r.raw+=h}let o=r.items.at(-1);if(o)o.raw=o.raw.trimEnd(),o.text=o.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let a of r.items){if(this.lexer.state.top=!1,a.tokens=this.lexer.blockTokens(a.text,[]),a.task){if(a.text=a.text.replace(this.rules.other.listReplaceTask,""),a.tokens[0]?.type==="text"||a.tokens[0]?.type==="paragraph"){a.tokens[0].raw=a.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),a.tokens[0].text=a.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let c=this.lexer.inlineQueue.length-1;c>=0;c--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[c].src)){this.lexer.inlineQueue[c].src=this.lexer.inlineQueue[c].src.replace(this.rules.other.listReplaceTask,"");break}}let h=this.rules.other.listTaskCheckbox.exec(a.raw);if(h){let c={type:"checkbox",raw:h[0]+" ",checked:h[0]!=="[ ]"};a.checked=c.checked,r.loose?a.tokens[0]&&["paragraph","text"].includes(a.tokens[0].type)&&"tokens"in a.tokens[0]&&a.tokens[0].tokens?(a.tokens[0].raw=c.raw+a.tokens[0].raw,a.tokens[0].text=c.raw+a.tokens[0].text,a.tokens[0].tokens.unshift(c)):a.tokens.unshift({type:"paragraph",raw:c.raw,text:c.raw,tokens:[c]}):a.tokens.unshift(c)}}if(!r.loose){let h=a.tokens.filter(d=>d.type==="space"),c=h.length>0&&h.some(d=>this.rules.other.anyLine.test(d.raw));r.loose=c}}if(r.loose)for(let a of r.items){a.loose=!0;for(let h of a.tokens)h.type==="text"&&(h.type="paragraph")}return r}}html(n){let e=this.rules.block.html.exec(n);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(n){let e=this.rules.block.def.exec(n);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:s,title:r}}}table(n){let e=this.rules.block.table.exec(n);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=ge(e[1]),s=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
25
|
+
`):[],i={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===s.length){for(let l of s)this.rules.other.tableAlignRight.test(l)?i.align.push("right"):this.rules.other.tableAlignCenter.test(l)?i.align.push("center"):this.rules.other.tableAlignLeft.test(l)?i.align.push("left"):i.align.push(null);for(let l=0;l<t.length;l++)i.header.push({text:t[l],tokens:this.lexer.inline(t[l]),header:!0,align:i.align[l]});for(let l of r)i.rows.push(ge(l,i.header.length).map((o,a)=>({text:o,tokens:this.lexer.inline(o),header:!1,align:i.align[a]})));return i}}lheading(n){let e=this.rules.block.lheading.exec(n);if(e){let t=e[1].trim();return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(n){let e=this.rules.block.paragraph.exec(n);if(e){let t=e[1].charAt(e[1].length-1)===`
|
|
26
|
+
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(n){let e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){let e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(n){let e=this.rules.inline.tag.exec(n);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(n){let e=this.rules.inline.link.exec(n);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let i=L(t.slice(0,-1),"\\");if((t.length-i.length)%2===0)return}else{let i=xt(e[2],"()");if(i===-2)return;if(i>-1){let l=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,l).trim(),e[3]=""}}let s=e[2],r="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(s);i&&(s=i[1],r=i[3])}else r=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?s=s.slice(1):s=s.slice(1,-1)),be(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(n,e){let t;if((t=this.rules.inline.reflink.exec(n))||(t=this.rules.inline.nolink.exec(n))){let s=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),r=e[s.toLowerCase()];if(!r){let i=t[0].charAt(0);return{type:"text",raw:i,text:i}}return be(t,r,t[0],this.lexer,this.rules)}}emStrong(n,e,t=""){let s=this.rules.inline.emStrongLDelim.exec(n);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!t||this.rules.inline.punctuation.exec(t))){let r=[...s[0]].length-1,i,l,o=r,a=0,h=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*n.length+r);(s=h.exec(e))!==null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i)continue;if(l=[...i].length,s[3]||s[4]){o+=l;continue}else if((s[5]||s[6])&&r%3&&!((r+l)%3)){a+=l;continue}if(o-=l,o>0)continue;l=Math.min(l,l+o+a);let c=[...s[0]][0].length,d=n.slice(0,r+s.index+c+l);if(Math.min(r,l)%2){let g=d.slice(1,-1);return{type:"em",raw:d,text:g,tokens:this.lexer.inlineTokens(g)}}let p=d.slice(2,-2);return{type:"strong",raw:d,text:p,tokens:this.lexer.inlineTokens(p)}}}}codespan(n){let e=this.rules.inline.code.exec(n);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(t),r=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return s&&r&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(n){let e=this.rules.inline.br.exec(n);if(e)return{type:"br",raw:e[0]}}del(n,e,t=""){let s=this.rules.inline.delLDelim.exec(n);if(s&&(!s[1]||!t||this.rules.inline.punctuation.exec(t))){let r=[...s[0]].length-1,i,l,o=r,a=this.rules.inline.delRDelim;for(a.lastIndex=0,e=e.slice(-1*n.length+r);(s=a.exec(e))!==null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i||(l=[...i].length,l!==r))continue;if(s[3]||s[4]){o+=l;continue}if(o-=l,o>0)continue;l=Math.min(l,l+o);let h=[...s[0]][0].length,c=n.slice(0,r+s.index+h+l),d=c.slice(r,-r);return{type:"del",raw:c,text:d,tokens:this.lexer.inlineTokens(d)}}}}autolink(n){let e=this.rules.inline.autolink.exec(n);if(e){let t,s;return e[2]==="@"?(t=e[1],s="mailto:"+t):(t=e[1],s=t),{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}url(n){let e;if(e=this.rules.inline.url.exec(n)){let t,s;if(e[2]==="@")t=e[0],s="mailto:"+t;else{let r;do r=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(r!==e[0]);t=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(n){let e=this.rules.inline.text.exec(n);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},k=class W{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||E,this.options.tokenizer=this.options.tokenizer||new D,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:b,block:N.normal,inline:I.normal};this.options.pedantic?(t.block=N.pedantic,t.inline=I.pedantic):this.options.gfm&&(t.block=N.gfm,this.options.breaks?t.inline=I.breaks:t.inline=I.gfm),this.tokenizer.rules=t}static get rules(){return{block:N,inline:I}}static lex(e,t){return new W(t).lex(e)}static lexInline(e,t){return new W(t).inlineTokens(e)}lex(e){e=e.replace(b.carriageReturn,`
|
|
27
|
+
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let s=this.inlineQueue[t];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],s=!1){for(this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(b.tabCharGlobal," ").replace(b.spaceLine,""));e;){let r;if(this.options.extensions?.block?.some(l=>(r=l.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let l=t.at(-1);r.raw.length===1&&l!==void 0?l.raw+=`
|
|
28
|
+
`:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let l=t.at(-1);l?.type==="paragraph"||l?.type==="text"?(l.raw+=(l.raw.endsWith(`
|
|
29
29
|
`)?"":`
|
|
30
|
-
`)+r.raw,
|
|
31
|
-
`+r.text,this.inlineQueue.at(-1).src=
|
|
30
|
+
`)+r.raw,l.text+=`
|
|
31
|
+
`+r.text,this.inlineQueue.at(-1).src=l.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let l=t.at(-1);l?.type==="paragraph"||l?.type==="text"?(l.raw+=(l.raw.endsWith(`
|
|
32
32
|
`)?"":`
|
|
33
|
-
`)+r.raw,
|
|
34
|
-
`+r.raw,this.inlineQueue.at(-1).src=
|
|
33
|
+
`)+r.raw,l.text+=`
|
|
34
|
+
`+r.raw,this.inlineQueue.at(-1).src=l.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let l=1/0,o=e.slice(1),a;this.options.extensions.startBlock.forEach(h=>{a=h.call({lexer:this},o),typeof a=="number"&&a>=0&&(l=Math.min(l,a))}),l<1/0&&l>=0&&(i=e.substring(0,l+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let l=t.at(-1);s&&l?.type==="paragraph"?(l.raw+=(l.raw.endsWith(`
|
|
35
35
|
`)?"":`
|
|
36
|
-
`)+r.raw,
|
|
37
|
-
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=
|
|
36
|
+
`)+r.raw,l.text+=`
|
|
37
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):t.push(r),s=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let l=t.at(-1);l?.type==="text"?(l.raw+=(l.raw.endsWith(`
|
|
38
38
|
`)?"":`
|
|
39
|
-
`)+r.raw,
|
|
40
|
-
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=
|
|
39
|
+
`)+r.raw,l.text+=`
|
|
40
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):t.push(r);continue}if(e){let l="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(l);break}else throw new Error(l)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let s=e,r=null;if(this.tokens.links){let a=Object.keys(this.tokens.links);if(a.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(s))!==null;)a.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(s))!==null;)s=s.slice(0,r.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(s))!==null;)i=r[2]?r[2].length:0,s=s.slice(0,r.index+i)+"["+"a".repeat(r[0].length-i-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let l=!1,o="";for(;e;){l||(o=""),l=!1;let a;if(this.options.extensions?.inline?.some(c=>(a=c.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);let c=t.at(-1);a.type==="text"&&c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):t.push(a);continue}if(a=this.tokenizer.emStrong(e,s,o)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.del(e,s,o)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),t.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),t.push(a);continue}let h=e;if(this.options.extensions?.startInline){let c=1/0,d=e.slice(1),p;this.options.extensions.startInline.forEach(g=>{p=g.call({lexer:this},d),typeof p=="number"&&p>=0&&(c=Math.min(c,p))}),c<1/0&&c>=0&&(h=e.substring(0,c+1))}if(a=this.tokenizer.inlineText(h)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(o=a.raw.slice(-1)),l=!0;let c=t.at(-1);c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):t.push(a);continue}if(e){let c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return t}},H=class{options;parser;constructor(n){this.options=n||E}space(n){return""}code({text:n,lang:e,escaped:t}){let s=(e||"").match(b.notSpaceStart)?.[0],r=n.replace(b.endingNewline,"")+`
|
|
41
41
|
`;return s?'<pre><code class="language-'+y(s)+'">'+(t?r:y(r,!0))+`</code></pre>
|
|
42
42
|
`:"<pre><code>"+(t?r:y(r,!0))+`</code></pre>
|
|
43
43
|
`}blockquote({tokens:n}){return`<blockquote>
|
|
44
44
|
${this.parser.parse(n)}</blockquote>
|
|
45
45
|
`}html({text:n}){return n}def(n){return""}heading({tokens:n,depth:e}){return`<h${e}>${this.parser.parseInline(n)}</h${e}>
|
|
46
46
|
`}hr(n){return`<hr>
|
|
47
|
-
`}list(n){let e=n.ordered,t=n.start,s="";for(let
|
|
47
|
+
`}list(n){let e=n.ordered,t=n.start,s="";for(let l=0;l<n.items.length;l++){let o=n.items[l];s+=this.listitem(o)}let r=e?"ol":"ul",i=e&&t!==1?' start="'+t+'"':"";return"<"+r+i+`>
|
|
48
48
|
`+s+"</"+r+`>
|
|
49
49
|
`}listitem(n){return`<li>${this.parser.parse(n.tokens)}</li>
|
|
50
50
|
`}checkbox({checked:n}){return"<input "+(n?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:n}){return`<p>${this.parser.parseInline(n)}</p>
|
|
51
|
-
`}table(n){let e="",t="";for(let r=0;r<n.header.length;r++)t+=this.tablecell(n.header[r]);e+=this.tablerow({text:t});let s="";for(let r=0;r<n.rows.length;r++){let i=n.rows[r];t="";for(let
|
|
51
|
+
`}table(n){let e="",t="";for(let r=0;r<n.header.length;r++)t+=this.tablecell(n.header[r]);e+=this.tablerow({text:t});let s="";for(let r=0;r<n.rows.length;r++){let i=n.rows[r];t="";for(let l=0;l<i.length;l++)t+=this.tablecell(i[l]);s+=this.tablerow({text:t})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
|
|
52
52
|
<thead>
|
|
53
53
|
`+e+`</thead>
|
|
54
54
|
`+s+`</table>
|
|
55
55
|
`}tablerow({text:n}){return`<tr>
|
|
56
56
|
${n}</tr>
|
|
57
57
|
`}tablecell(n){let e=this.parser.parseInline(n.tokens),t=n.header?"th":"td";return(n.align?`<${t} align="${n.align}">`:`<${t}>`)+e+`</${t}>
|
|
58
|
-
`}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${y(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:e,tokens:t}){let s=this.parser.parseInline(t),r=
|
|
59
|
-
Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error occurred:</p><pre>"+y(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},$=new $t;f.options=f.setOptions=function(n){return $.setOptions(n),f.defaults=$.defaults,ye(f.defaults),f};f.getDefaults=W;f.defaults=E;f.use=function(...n){return $.use(...n),f.defaults=$.defaults,ye(f.defaults),f};f.walkTokens=function(n,e){return $.walkTokens(n,e)};f.parseInline=$.parseInline;f.Parser=x;f.parser=x.parse;f.Renderer=H;f.TextRenderer=ne;f.Lexer=k;f.lexer=k.lex;f.Tokenizer=D;f.Hooks=P;f.parse=f;qt=f.options,It=f.setOptions,Lt=f.use,Pt=f.walkTokens,_t=f.parseInline,Bt=x.parse,Nt=k.lex});var Ie={};he(Ie,{MarkdownViewer:()=>Q});var Q,Le=T(()=>{z();q();qe();Q=class extends w{#e=null;#t=null;#s=null;#n=null;#i=null;static get observedAttributes(){return["src"]}setup(){this.#a()}teardown(){this.#t?.abort(),this.removeAttribute("data-rendered"),this.removeAttribute("data-loading")}attributeChangedCallback(e,t,s){e==="src"&&s&&t!==s&&this.isConnected&&this.#a()}get parser(){return this.#e}set parser(e){this.#e=typeof e=="function"?e:null}get markdown(){return this.#n??this.#i??""}set markdown(e){let t=e==null?null:String(e);this.#n!==t&&(this.#n=t,this.#a())}async render(){await this.#a()}async reload(){this.getAttribute("src")&&await this.#a()}#r(){if(this.getAttribute("src"))return null;let e=this.querySelector('script[type="text/markdown"]');if(e)return e.textContent;let t=this.querySelector("template[data-md]");if(t)return t.content.textContent;let s=this.querySelector(":scope > pre");return s?s.textContent:null}async#a(){let e=this.getAttribute("src"),t;if(this.removeAttribute("data-rendered"),this.removeAttribute("data-error"),e){this.#t?.abort(),this.#t=new AbortController,this.setAttribute("data-loading",""),this.#l("markdown-viewer:fetch",{src:e});try{let i=await fetch(e,{signal:this.#t.signal});if(!i.ok)throw new Error(`HTTP ${i.status}: ${i.statusText}`);t=await i.text()}catch(i){if(i.name==="AbortError")return;this.removeAttribute("data-loading"),this.setAttribute("data-error",""),this.#l("markdown-viewer:error",{error:i.message});return}this.removeAttribute("data-loading")}else this.#n!=null?t=this.#n:t=this.#r();if(t==null)return;this.#i=t;let s;try{s=await(await this.#c())(t)}catch(i){this.setAttribute("data-error",""),this.#l("markdown-viewer:error",{error:i.message});return}this.#s||(this.#s=document.createElement("div"),this.#s.className="md-content",this.#s.setAttribute("part","content"),this.appendChild(this.#s)),this.#s.innerHTML=s,this.#o(),this.setAttribute("data-rendered","");let r=this.getAttribute("ping");if(r&&navigator.sendBeacon?.(r,JSON.stringify({src:e||"inline"})),this.#l("markdown-viewer:rendered",{src:e,node:this.#s}),this.hasAttribute("highlight"))for(let i of this.#s.querySelectorAll('pre > code[class*="language-"]')){let a=i.className.match(/language-(\S+)/)?.[1]||"";this.#l("markdown-viewer:highlight",{node:i,language:a})}}async#c(){return this.#e?this.#e:e=>f.parse(e,{gfm:!0})}#o(){if(!this.#s)return;let e=this.dataset.theme??this.closest("[data-theme]")?.dataset.theme;e&&(this.#s.dataset.theme=e)}#l(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}};A("markdown-viewer",Q)});var Pe={};he(Pe,{MarkdownEditor:()=>V});var V,_e=T(()=>{z();q();V=class extends w{#e=null;#t=null;#s=null;#n=null;#i="";#r=null;static get observedAttributes(){return["name","placeholder","rows"]}setup(){this.#a(),this.#c(),this.#l()}teardown(){this.#r!==null&&clearTimeout(this.#r),this.removeAttribute("data-editing")}attributeChangedCallback(e,t,s){!this.#e||t===s||(e==="name"&&(this.#e.name=s||""),e==="placeholder"&&(this.#e.placeholder=s||""),e==="rows"&&(this.#e.rows=parseInt(s,10)||10))}get value(){return this.#e?.value??""}set value(e){if(!this.#e)return;let t=e==null?"":String(e);this.#e.value!==t&&(this.#e.value=t,this.#l(),this.dispatchEvent(new CustomEvent("markdown-editor:change",{detail:{value:t,source:"api"},bubbles:!0})))}get textarea(){return this.#e}#a(){let t=this.querySelector("textarea")?.value||"";this.#s=document.createElement("section"),this.#s.className="md-editor-pane",this.#s.setAttribute("aria-label","Markdown source"),this.#n=document.createElement("section"),this.#n.className="md-preview-pane",this.#n.setAttribute("aria-label","Rendered preview"),this.#n.setAttribute("aria-live","polite"),this.#e=document.createElement("textarea"),this.#e.className="md-editor-input",this.#e.value=t,this.#e.name=this.getAttribute("name")||"",this.#e.placeholder=this.getAttribute("placeholder")||"Write markdown here...",this.#e.rows=parseInt(this.getAttribute("rows")??"",10)||10,this.#e.setAttribute("spellcheck","true"),this.#t=document.createElement("markdown-viewer"),this.hasAttribute("highlight")&&this.#t.setAttribute("highlight","");let s=this.dataset.theme??this.closest("[data-theme]")?.dataset.theme;s&&(this.#t.dataset.theme=s),this.#s.appendChild(this.#e),this.#n.appendChild(this.#t),this.innerHTML="",this.appendChild(this.#s),this.appendChild(this.#n),this.#i=t}#c(){let e=this.#e;e&&(this.listen(e,"input",()=>{this.#h("markdown-editor:input",{value:e.value}),this.#o()}),this.listen(e,"focus",()=>{this.setAttribute("data-editing","")}),this.listen(e,"blur",()=>{this.removeAttribute("data-editing"),e.value!==this.#i&&(this.#i=e.value,this.#h("markdown-editor:change",{value:e.value}))}),this.hasAttribute("data-tab-indent")&&this.listen(e,"keydown",t=>{let s=t;if(s.key==="Tab"&&!s.shiftKey&&!s.ctrlKey&&!s.metaKey){s.preventDefault();let{selectionStart:r,selectionEnd:i}=e;e.setRangeText(" ",r,i,"end"),e.dispatchEvent(new Event("input",{bubbles:!0}))}}))}#o(){this.#r!==null&&clearTimeout(this.#r),this.#r=setTimeout(()=>this.#l(),150)}#l(){if(!this.#t)return;let e=this.#e?.value||"";if(!e.trim()){let s=this.#t.querySelector(".md-content");s&&(s.innerHTML="");return}let t=this.#t.querySelector('script[type="text/markdown"]');t||(t=document.createElement("script"),t.type="text/markdown",this.#t.prepend(t)),t.textContent=e,this.#t.removeAttribute("data-rendered"),this.#t.render?.()}#h(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}};A("markdown-editor",V)});z();q();function B(n){let e=(Date.now()-n.getTime())/1e3;if(e<0)return null;if(e<60)return"just now";if(e<3600){let s=Math.floor(e/60);return`${s} minute${s!==1?"s":""} ago`}if(e<86400){let s=Math.floor(e/3600);return`${s} hour${s!==1?"s":""} ago`}if(e<2592e3){let s=Math.floor(e/86400);return`${s} day${s!==1?"s":""} ago`}if(e<31536e3){let s=Math.floor(e/2592e3);return`${s} month${s!==1?"s":""} ago`}let t=Math.floor(e/31536e3);return`${t} year${t!==1?"s":""} ago`}function pe(n=document){for(let e of n.querySelectorAll("time[data-relative]")){let t=e.getAttribute("datetime");if(!t)continue;let s=B(new Date(t));s&&(e.textContent=s)}}var F=typeof document<"u"?document.documentElement:null,de;function fe(){pe(),de||(de=setInterval(()=>pe(),6e4))}F&&!F.hasAttribute("data-vb-time-relative-init")&&(F.setAttribute("data-vb-time-relative-init",""),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",fe,{once:!0}):fe());z();q();var ie=class extends w{static formAssociated=!0;static observedAttributes=["value","disabled","placeholder","submit-label","cancel-label","data-show-cancel"];#e;#t;#s;#n;#i;#r;#a;#c=null;constructor(){super(),this.#e=this.attachInternals(),this._adoptInternals(this.#e)}setup(){Promise.resolve().then(()=>(Le(),Ie)).catch(()=>console.warn('[VB] comment-box: markdown-viewer failed to load (missing importmap for "marked"?)')),Promise.resolve().then(()=>(_e(),Pe)).catch(()=>console.warn("[VB] comment-box: markdown-editor failed to load"));let e=[...this.querySelectorAll(':scope > [slot="toolbar"]')],t=this.querySelector(":scope > markdown-editor");if(!t){t=document.createElement("markdown-editor");let r=document.createElement("textarea");this.hasAttribute("placeholder")&&(r.placeholder=this.getAttribute("placeholder")||""),this.hasAttribute("value")&&(r.value=this.getAttribute("value")||""),t.appendChild(r)}this.#t=t,this.#s=document.createElement("div"),this.#s.className="comment-box-actions",this.#n=document.createElement("div"),this.#n.className="comment-box-toolbar",this.#n.setAttribute("role","toolbar"),e.forEach(r=>this.#n.appendChild(r)),this.#s.appendChild(this.#n);let s=document.createElement("div");s.className="comment-box-buttons",this.hasAttribute("data-show-cancel")&&(this.#r=document.createElement("button"),this.#r.type="button",this.#r.className="comment-box-cancel",this.#r.textContent=this.getAttribute("cancel-label")||"Cancel",s.appendChild(this.#r)),this.#i=document.createElement("button"),this.#i.type="button",this.#i.className="comment-box-submit",this.#i.textContent=this.getAttribute("submit-label")||"Comment",s.appendChild(this.#i),this.#s.appendChild(s),this.hasAttribute("data-max-length")&&(this.#a=document.createElement("span"),this.#a.className="comment-box-counter",this.#a.setAttribute("aria-live","polite"),this.#s.appendChild(this.#a)),this.replaceChildren(this.#t,this.#s),this.listen(this.#i,"click",this.#p),this.#r&&this.listen(this.#r,"click",this.#u),this.#l(),this.#t.hasAttribute("data-upgraded")||this.listen(this.#t,"markdown-editor:upgraded",()=>this.#l(),{once:!0}),this.#b(),this.#f(),this.#g(),this.#m()}get#o(){return this.#t?.textarea??this.#t?.querySelector("textarea")??null}#l(){let e=this.#o;!e||e===this.#c||(this.#c=e,this.listen(e,"input",this.#h),this.listen(e,"keydown",this.#d))}attributeChangedCallback(e,t,s){if(!(!this.isConnected||!this.#t))if(e==="value")this.value=s??"";else if(e==="placeholder"){let r=this.#o;r&&(r.placeholder=s??"")}else e==="disabled"?this.#b():e==="submit-label"?this.#i.textContent=s||"Comment":e==="cancel-label"?this.#r&&(this.#r.textContent=s||"Cancel"):e==="data-show-cancel"&&(this.hasAttribute("data-show-cancel")&&!this.#r?(this.#r=document.createElement("button"),this.#r.type="button",this.#r.className="comment-box-cancel",this.#r.textContent=this.getAttribute("cancel-label")||"Cancel",this.#i.parentNode.insertBefore(this.#r,this.#i),this.listen(this.#r,"click",this.#u)):!this.hasAttribute("data-show-cancel")&&this.#r&&(this.#r.remove(),this.#r=null))}#h=()=>{this.#f(),this.#g(),this.#m(),this.dispatchEvent(new CustomEvent("comment-box:input",{bubbles:!0,detail:{value:this.value,length:this.value.length}}))};#d=e=>{e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),this.#p())};#p=()=>{if(this.#k())return;let e=this.value,t=new CustomEvent("comment-box:submit",{bubbles:!0,cancelable:!0,detail:{value:e}});this.dispatchEvent(t)&&this.clear()};#u=()=>{let e=this.value;this.dispatchEvent(new CustomEvent("comment-box:cancel",{bubbles:!0,detail:{value:e}}))};#k(){return this.hasAttribute("disabled")?!0:!this.#e.checkValidity()}#b(){let e=this.hasAttribute("disabled"),t=this.#o;t&&(t.disabled=e),this.#i.disabled=e,this.#r&&(this.#r.disabled=e)}#f(){this.#e.setFormValue(this.value)}#g(){let e=this.value,t=Number(this.getAttribute("data-min-length"))||0,s=Number(this.getAttribute("data-max-length"))||1/0,r=this.hasAttribute("required"),i=this.#o&&this.contains(this.#o)?this.#o:null;if(r&&e.length===0){this.#e.setValidity({valueMissing:!0},"Please add a comment.",i||void 0);return}if(e.length<t){this.#e.setValidity({tooShort:!0},`At least ${t} characters required.`,i||void 0);return}if(e.length>s){this.#e.setValidity({tooLong:!0},`No more than ${s} characters.`,i||void 0);return}this.#e.setValidity({})}#m(){if(!this.#a)return;let e=Number(this.getAttribute("data-max-length"))||0,t=this.value.length;this.#a.textContent=e?`${t} / ${e}`:String(t),this.#a.classList.toggle("is-over",e>0&&t>e)}get value(){return this.#t?.value??""}set value(e){this.#t&&(this.#t.value=e==null?"":String(e),this.#f(),this.#g(),this.#m())}clear(){this.value="",this.dispatchEvent(new CustomEvent("comment-box:input",{bubbles:!0,detail:{value:"",length:0}}))}focus(){this.#o?.focus()}formResetCallback(){this.value=this.getAttribute("value")??""}formStateRestoreCallback(e){e!=null&&(this.value=e)}get form(){return this.#e.form}get name(){return this.getAttribute("name")}get type(){return this.localName}get validity(){return this.#e.validity}get validationMessage(){return this.#e.validationMessage}checkValidity(){return this.#e.checkValidity()}reportValidity(){return this.#e.reportValidity()}};A("comment-box",ie);var ae=class extends w{#e=null;#t=null;#s=0;setup(){this.hasAttribute("role")||this.setAttribute("role","region"),this.hasAttribute("aria-label")||this.setAttribute("aria-label","Comments"),this.#e=this.querySelector(":scope > template[data-reply-form]"),this.#n().forEach(e=>this.#i(e)),this.#s=setInterval(()=>this.#p(),6e4)}teardown(){clearInterval(this.#s)}#n(){return[...this.querySelectorAll(":scope > article[data-comment]")]}#i(e){if(e.dataset.decorated==="")return;e.dataset.decorated="";let t=this.#r(e);e.style.setProperty("--comment-depth",String(t)),t>0&&e.setAttribute("aria-level",String(t+1));let s=this.#a(e),r=e.querySelector(":scope > [data-comment-body]");r?e.insertBefore(s,r):e.prepend(s);let i=this.#c(e);e.appendChild(i)}#r(e){let t=0,s=e.dataset.parent,r=new Set;for(;s&&!r.has(s);){r.add(s);let i=this.querySelector(`:scope > article[data-comment][id="${CSS.escape(s)}"]`);if(!i)break;t+=1,s=i.dataset.parent}return t}#a(e){let t=document.createElement("header");t.className="comment-header";let s=e.dataset.author||"Unknown",r=e.dataset.authorHref,i=e.dataset.authorAvatar;if(i){let l=document.createElement("user-avatar");l.setAttribute("src",i),l.setAttribute("name",s),t.appendChild(l)}let a=document.createElement(r?"a":"span");a.className="comment-author",a.textContent=s,r&&(a.href=r),t.appendChild(a);let o=e.dataset.time;if(o){let l=document.createElement("time");l.className="comment-time",l.setAttribute("datetime",o),l.setAttribute("title",this.#u(o)),l.textContent=B(new Date(o))||o,t.appendChild(l)}if(e.dataset.edited){let l=document.createElement("span");l.className="comment-edited",l.title=`Edited ${this.#u(e.dataset.edited)}`,l.textContent="(edited)",t.appendChild(l)}return t}#c(e){let t=document.createElement("footer");if(t.className="comment-footer",t.setAttribute("role","toolbar"),this.hasAttribute("data-disabled"))return t;let s=document.createElement("button");if(s.type="button",s.className="comment-action comment-reply",s.textContent="Reply",s.setAttribute("aria-label",`Reply to ${e.dataset.author||"comment"}`),this.listen(s,"click",()=>this.#o(e)),t.appendChild(s),e.hasAttribute("data-mine")){let r=document.createElement("button");r.type="button",r.className="comment-action comment-edit",r.textContent="Edit",r.setAttribute("aria-label","Edit your comment"),this.listen(r,"click",()=>this.#h(e)),t.appendChild(r);let i=document.createElement("button");i.type="button",i.className="comment-action comment-delete",i.textContent="Delete",i.setAttribute("aria-label","Delete your comment"),this.listen(i,"click",()=>this.#d(e)),t.appendChild(i)}return t}#o(e){if(this.#t&&this.#l(),!this.#e)return;let t=this.#e.content.cloneNode(!0),s=t.firstElementChild?.cloneNode?t.firstElementChild:document.createElement("comment-box");s.hasAttribute("data-show-cancel")||s.setAttribute("data-show-cancel","");let r=document.createElement("div");r.className="comment-reply-form",r.setAttribute("data-parent",e.id||""),r.appendChild(s),e.appendChild(r),this.#t=r,requestAnimationFrame(()=>s.focus?.()),s.addEventListener("comment-box:submit",i=>{this.dispatchEvent(new CustomEvent("comment-thread:reply",{bubbles:!0,detail:{parentId:e.id,value:i.detail.value}})),this.#l()}),s.addEventListener("comment-box:cancel",()=>this.#l())}#l(){this.#t&&(this.#t.remove(),this.#t=null)}#h(e){let s=e.querySelector(":scope > [data-comment-body]")?.textContent.trim()??"";this.dispatchEvent(new CustomEvent("comment-thread:edit-request",{bubbles:!0,detail:{commentId:e.id,value:s}}))}#d(e){this.dispatchEvent(new CustomEvent("comment-thread:delete-request",{bubbles:!0,detail:{commentId:e.id}}))}#p(){for(let e of this.querySelectorAll(":scope > article[data-comment] > .comment-header > time")){let t=e.getAttribute("datetime");if(!t)continue;let s=B(new Date(t));s&&(e.textContent=s)}}#u(e){try{return new Date(e).toLocaleString()}catch{return e}}addComment(e){let t=document.createElement("article");t.setAttribute("data-comment",""),t.id=e.id,t.dataset.author=e.author,e.authorHref&&(t.dataset.authorHref=e.authorHref),e.authorAvatar&&(t.dataset.authorAvatar=e.authorAvatar),t.dataset.time=e.time,e.parentId&&(t.dataset.parent=e.parentId),e.mine&&t.setAttribute("data-mine",""),e.edited&&(t.dataset.edited=e.edited);let s=document.createElement("div");return s.setAttribute("data-comment-body",""),s.innerHTML=e.body,t.appendChild(s),this.#e?this.insertBefore(t,this.#e):this.appendChild(t),this.#i(t),t}updateComment(e,t={}){let s=this.querySelector(`:scope > article[data-comment][id="${CSS.escape(e)}"]`);if(!s)return;if(t.body!=null){let a=s.querySelector(":scope > [data-comment-body]");a&&(a.innerHTML=t.body)}t.author!=null&&(s.dataset.author=t.author),t.edited!=null&&(s.dataset.edited=t.edited),s.querySelector(":scope > .comment-header")?.remove();let r=s.querySelector(":scope > [data-comment-body]"),i=this.#a(s);r?s.insertBefore(i,r):s.prepend(i)}removeComment(e){let t=this.querySelector(`:scope > article[data-comment][id="${CSS.escape(e)}"]`);t&&t.remove()}};A("comment-thread",ae);export{ae as CommentThread};
|
|
58
|
+
`}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${y(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:e,tokens:t}){let s=this.parser.parseInline(t),r=fe(n);if(r===null)return s;n=r;let i='<a href="'+n+'"';return e&&(i+=' title="'+y(e)+'"'),i+=">"+s+"</a>",i}image({href:n,title:e,text:t,tokens:s}){s&&(t=this.parser.parseInline(s,this.parser.textRenderer));let r=fe(n);if(r===null)return y(t);n=r;let i=`<img src="${n}" alt="${y(t)}"`;return e&&(i+=` title="${y(e)}"`),i+=">",i}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:y(n.text)}},ne=class{strong({text:n}){return n}em({text:n}){return n}codespan({text:n}){return n}del({text:n}){return n}html({text:n}){return n}text({text:n}){return n}link({text:n}){return""+n}image({text:n}){return""+n}br(){return""}checkbox({raw:n}){return n}},x=class G{options;renderer;textRenderer;constructor(e){this.options=e||E,this.options.renderer=this.options.renderer||new H,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ne}static parse(e,t){return new G(t).parse(e)}static parseInline(e,t){return new G(t).parseInline(e)}parse(e){this.renderer.parser=this;let t="";for(let s=0;s<e.length;s++){let r=e[s];if(this.options.extensions?.renderers?.[r.type]){let l=r,o=this.options.extensions.renderers[l.type].call({parser:this},l);if(o!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(l.type)){t+=o||"";continue}}let i=r;switch(i.type){case"space":{t+=this.renderer.space(i);break}case"hr":{t+=this.renderer.hr(i);break}case"heading":{t+=this.renderer.heading(i);break}case"code":{t+=this.renderer.code(i);break}case"table":{t+=this.renderer.table(i);break}case"blockquote":{t+=this.renderer.blockquote(i);break}case"list":{t+=this.renderer.list(i);break}case"checkbox":{t+=this.renderer.checkbox(i);break}case"html":{t+=this.renderer.html(i);break}case"def":{t+=this.renderer.def(i);break}case"paragraph":{t+=this.renderer.paragraph(i);break}case"text":{t+=this.renderer.text(i);break}default:{let l='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let s="";for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let o=this.options.extensions.renderers[i.type].call({parser:this},i);if(o!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){s+=o||"";continue}}let l=i;switch(l.type){case"escape":{s+=t.text(l);break}case"html":{s+=t.html(l);break}case"link":{s+=t.link(l);break}case"image":{s+=t.image(l);break}case"checkbox":{s+=t.checkbox(l);break}case"strong":{s+=t.strong(l);break}case"em":{s+=t.em(l);break}case"codespan":{s+=t.codespan(l);break}case"br":{s+=t.br(l);break}case"del":{s+=t.del(l);break}case"text":{s+=t.text(l);break}default:{let o='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return s}},P=class{options;block;constructor(n){this.options=n||E}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(n=this.block){return n?k.lex:k.lexInline}provideParser(n=this.block){return n?x.parse:x.parseInline}},vt=class{defaults=K();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=x;Renderer=H;TextRenderer=ne;Lexer=k;Tokenizer=D;Hooks=P;constructor(...n){this.use(...n)}walkTokens(n,e){let t=[];for(let s of n)switch(t=t.concat(e.call(this,s)),s.type){case"table":{let r=s;for(let i of r.header)t=t.concat(this.walkTokens(i.tokens,e));for(let i of r.rows)for(let l of i)t=t.concat(this.walkTokens(l.tokens,e));break}case"list":{let r=s;t=t.concat(this.walkTokens(r.items,e));break}default:{let r=s;this.defaults.extensions?.childTokens?.[r.type]?this.defaults.extensions.childTokens[r.type].forEach(i=>{let l=r[i].flat(1/0);t=t.concat(this.walkTokens(l,e))}):r.tokens&&(t=t.concat(this.walkTokens(r.tokens,e)))}}return t}use(...n){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(t=>{let s={...t};if(s.async=this.defaults.async||s.async||!1,t.extensions&&(t.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let i=e.renderers[r.name];i?e.renderers[r.name]=function(...l){let o=r.renderer.apply(this,l);return o===!1&&(o=i.apply(this,l)),o}:e.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=e[r.level];i?i.unshift(r.tokenizer):e[r.level]=[r.tokenizer],r.start&&(r.level==="block"?e.startBlock?e.startBlock.push(r.start):e.startBlock=[r.start]:r.level==="inline"&&(e.startInline?e.startInline.push(r.start):e.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(e.childTokens[r.name]=r.childTokens)}),s.extensions=e),t.renderer){let r=this.defaults.renderer||new H(this.defaults);for(let i in t.renderer){if(!(i in r))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let l=i,o=t.renderer[l],a=r[l];r[l]=(...h)=>{let c=o.apply(r,h);return c===!1&&(c=a.apply(r,h)),c||""}}s.renderer=r}if(t.tokenizer){let r=this.defaults.tokenizer||new D(this.defaults);for(let i in t.tokenizer){if(!(i in r))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let l=i,o=t.tokenizer[l],a=r[l];r[l]=(...h)=>{let c=o.apply(r,h);return c===!1&&(c=a.apply(r,h)),c}}s.tokenizer=r}if(t.hooks){let r=this.defaults.hooks||new P;for(let i in t.hooks){if(!(i in r))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let l=i,o=t.hooks[l],a=r[l];P.passThroughHooks.has(i)?r[l]=h=>{if(this.defaults.async&&P.passThroughHooksRespectAsync.has(i))return(async()=>{let d=await o.call(r,h);return a.call(r,d)})();let c=o.call(r,h);return a.call(r,c)}:r[l]=(...h)=>{if(this.defaults.async)return(async()=>{let d=await o.apply(r,h);return d===!1&&(d=await a.apply(r,h)),d})();let c=o.apply(r,h);return c===!1&&(c=a.apply(r,h)),c}}s.hooks=r}if(t.walkTokens){let r=this.defaults.walkTokens,i=t.walkTokens;s.walkTokens=function(l){let o=[];return o.push(i.call(this,l)),r&&(o=o.concat(r.call(this,l))),o}}this.defaults={...this.defaults,...s}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,e){return k.lex(n,e??this.defaults)}parser(n,e){return x.parse(n,e??this.defaults)}parseMarkdown(n){return(e,t)=>{let s={...t},r={...this.defaults,...s},i=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&s.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(r.hooks&&(r.hooks.options=r,r.hooks.block=n),r.async)return(async()=>{let l=r.hooks?await r.hooks.preprocess(e):e,o=await(r.hooks?await r.hooks.provideLexer(n):n?k.lex:k.lexInline)(l,r),a=r.hooks?await r.hooks.processAllTokens(o):o;r.walkTokens&&await Promise.all(this.walkTokens(a,r.walkTokens));let h=await(r.hooks?await r.hooks.provideParser(n):n?x.parse:x.parseInline)(a,r);return r.hooks?await r.hooks.postprocess(h):h})().catch(i);try{r.hooks&&(e=r.hooks.preprocess(e));let l=(r.hooks?r.hooks.provideLexer(n):n?k.lex:k.lexInline)(e,r);r.hooks&&(l=r.hooks.processAllTokens(l)),r.walkTokens&&this.walkTokens(l,r.walkTokens);let o=(r.hooks?r.hooks.provideParser(n):n?x.parse:x.parseInline)(l,r);return r.hooks&&(o=r.hooks.postprocess(o)),o}catch(l){return i(l)}}}onError(n,e){return t=>{if(t.message+=`
|
|
59
|
+
Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error occurred:</p><pre>"+y(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},$=new vt;m.options=m.setOptions=function(n){return $.setOptions(n),m.defaults=$.defaults,ke(m.defaults),m};m.getDefaults=K;m.defaults=E;m.use=function(...n){return $.use(...n),m.defaults=$.defaults,ke(m.defaults),m};m.walkTokens=function(n,e){return $.walkTokens(n,e)};m.parseInline=$.parseInline;m.Parser=x;m.parser=x.parse;m.Renderer=H;m.TextRenderer=ne;m.Lexer=k;m.lexer=k.lex;m.Tokenizer=D;m.Hooks=P;m.parse=m;It=m.options,Lt=m.setOptions,Pt=m.use,_t=m.walkTokens,Bt=m.parseInline,Nt=x.parse,Mt=k.lex});var Re={};he(Re,{MarkdownViewer:()=>F});var F,ze=C(()=>{z();q();Te();V();F=class extends w{#e=null;#t=null;#r=null;#i=null;#n=null;static get observedAttributes(){return["src"]}setup(){this.#l()}teardown(){this.#t?.abort(),this.removeAttribute("data-rendered"),this.removeAttribute("data-loading")}attributeChangedCallback(e,t,s){e==="src"&&s&&t!==s&&this.isConnected&&this.#l()}get parser(){return this.#e}set parser(e){this.#e=typeof e=="function"?e:null}get markdown(){return this.#i??this.#n??""}set markdown(e){let t=e==null?null:String(e);this.#i!==t&&(this.#i=t,this.#l())}async render(){await this.#l()}async reload(){this.getAttribute("src")&&await this.#l()}#s(){if(this.getAttribute("src"))return null;let e=this.querySelector('script[type="text/markdown"]');if(e)return e.textContent;let t=this.querySelector("template[data-md]");if(t)return t.content.textContent;let s=this.querySelector(":scope > pre");return s?s.textContent:null}async#l(){let e=this.getAttribute("src"),t;if(this.removeAttribute("data-rendered"),this.removeAttribute("data-error"),e){this.#t?.abort(),this.#t=new AbortController,this.setAttribute("data-loading",""),this.#o("markdown-viewer:fetch",{src:e});try{let i=await fetch(e,{signal:this.#t.signal});if(!i.ok)throw new Error(`HTTP ${i.status}: ${i.statusText}`);t=await i.text()}catch(i){if(i.name==="AbortError")return;this.removeAttribute("data-loading"),this.setAttribute("data-error",""),this.#o("markdown-viewer:error",{error:i.message});return}this.removeAttribute("data-loading")}else this.#i!=null?t=this.#i:t=this.#s();if(t==null)return;this.#n=t;let s;try{s=await(await this.#a())(t)}catch(i){this.setAttribute("data-error",""),this.#o("markdown-viewer:error",{error:i.message});return}this.#r||(this.#r=document.createElement("div"),this.#r.className="md-content",this.#r.setAttribute("part","content"),this.appendChild(this.#r)),this.#r.innerHTML=this.#u()?B(String(s??"")):s,this.#c(),this.setAttribute("data-rendered","");let r=this.getAttribute("ping");if(r&&navigator.sendBeacon?.(r,JSON.stringify({src:e||"inline"})),this.#o("markdown-viewer:rendered",{src:e,node:this.#r}),this.hasAttribute("highlight"))for(let i of this.#r.querySelectorAll('pre > code[class*="language-"]')){let l=i.className.match(/language-(\S+)/)?.[1]||"";this.#o("markdown-viewer:highlight",{node:i,language:l})}}async#a(){return this.#e?this.#e:e=>m.parse(e,{gfm:!0})}#u(){let e=this.getAttribute("sanitize");return e==null?!0:!/^(off|false)$/i.test(e.trim())}#c(){if(!this.#r)return;let e=this.dataset.theme??this.closest("[data-theme]")?.dataset.theme;e&&(this.#r.dataset.theme=e)}#o(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}};A("markdown-viewer",F)});var qe={};he(qe,{MarkdownEditor:()=>j});var j,Ie=C(()=>{z();q();j=class extends w{#e=null;#t=null;#r=null;#i=null;#n="";#s=null;static get observedAttributes(){return["name","placeholder","rows"]}setup(){this.#l(),this.#a(),this.#c()}teardown(){this.#s!==null&&clearTimeout(this.#s),this.removeAttribute("data-editing")}attributeChangedCallback(e,t,s){!this.#e||t===s||(e==="name"&&(this.#e.name=s||""),e==="placeholder"&&(this.#e.placeholder=s||""),e==="rows"&&(this.#e.rows=parseInt(s,10)||10))}get value(){return this.#e?.value??""}set value(e){if(!this.#e)return;let t=e==null?"":String(e);this.#e.value!==t&&(this.#e.value=t,this.#c(),this.dispatchEvent(new CustomEvent("markdown-editor:change",{detail:{value:t,source:"api"},bubbles:!0})))}get textarea(){return this.#e}#l(){let t=this.querySelector("textarea")?.value||"";this.#r=document.createElement("section"),this.#r.className="md-editor-pane",this.#r.setAttribute("aria-label","Markdown source"),this.#i=document.createElement("section"),this.#i.className="md-preview-pane",this.#i.setAttribute("aria-label","Rendered preview"),this.#i.setAttribute("aria-live","polite"),this.#e=document.createElement("textarea"),this.#e.className="md-editor-input",this.#e.value=t,this.#e.name=this.getAttribute("name")||"",this.#e.placeholder=this.getAttribute("placeholder")||"Write markdown here...",this.#e.rows=parseInt(this.getAttribute("rows")??"",10)||10,this.#e.setAttribute("spellcheck","true"),this.#t=document.createElement("markdown-viewer"),this.hasAttribute("highlight")&&this.#t.setAttribute("highlight","");let s=this.dataset.theme??this.closest("[data-theme]")?.dataset.theme;s&&(this.#t.dataset.theme=s),this.#r.appendChild(this.#e),this.#i.appendChild(this.#t),this.innerHTML="",this.appendChild(this.#r),this.appendChild(this.#i),this.#n=t}#a(){let e=this.#e;e&&(this.listen(e,"input",()=>{this.#o("markdown-editor:input",{value:e.value}),this.#u()}),this.listen(e,"focus",()=>{this.setAttribute("data-editing","")}),this.listen(e,"blur",()=>{this.removeAttribute("data-editing"),e.value!==this.#n&&(this.#n=e.value,this.#o("markdown-editor:change",{value:e.value}))}),this.hasAttribute("data-tab-indent")&&this.listen(e,"keydown",t=>{let s=t;if(s.key==="Tab"&&!s.shiftKey&&!s.ctrlKey&&!s.metaKey){s.preventDefault();let{selectionStart:r,selectionEnd:i}=e;e.setRangeText(" ",r,i,"end"),e.dispatchEvent(new Event("input",{bubbles:!0}))}}))}#u(){this.#s!==null&&clearTimeout(this.#s),this.#s=setTimeout(()=>this.#c(),150)}#c(){if(!this.#t)return;let e=this.#e?.value||"";if(!e.trim()){let s=this.#t.querySelector(".md-content");s&&(s.innerHTML="");return}let t=this.#t.querySelector('script[type="text/markdown"]');t||(t=document.createElement("script"),t.type="text/markdown",this.#t.prepend(t)),t.textContent=e,this.#t.removeAttribute("data-rendered"),this.#t.render?.()}#o(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}};A("markdown-editor",j)});z();q();V();z();q();var At=n=>Math.max(10,Math.ceil(n*.1)),ie=class extends w{static formAssociated=!0;static observedAttributes=["value","disabled","placeholder","label","submit-label","cancel-label","data-show-cancel"];#e;#t=null;#r=null;#i=null;#n=null;#s=null;#l=null;#a=null;#u=null;#c=!1;#o=!1;constructor(){super(),this.#e=this.attachInternals(),this._adoptInternals(this.#e)}setup(){Promise.resolve().then(()=>(ze(),Re)).catch(()=>console.warn('[VB] comment-box: markdown-viewer failed to load (missing importmap for "marked"?)')),Promise.resolve().then(()=>(Ie(),qe)).catch(()=>console.warn("[VB] comment-box: markdown-editor failed to load"));let e=[...this.querySelectorAll(':scope > [slot="toolbar"]'),...this.querySelectorAll(":scope > .comment-box-actions > .comment-box-toolbar > *")],t=this.querySelector(":scope > markdown-editor");if(!t){t=document.createElement("markdown-editor");let r=document.createElement("textarea");this.hasAttribute("value")&&(r.value=this.getAttribute("value")||""),t.appendChild(r)}this.#t=t,this.hasAttribute("placeholder")&&this.#t.setAttribute("placeholder",this.getAttribute("placeholder")||""),this.#r=document.createElement("div"),this.#r.className="comment-box-actions",this.#i=document.createElement("div"),this.#i.className="comment-box-toolbar",e.forEach(r=>this.#i?.appendChild(r)),e.length&&(this.#i.setAttribute("role","group"),this.#i.setAttribute("aria-label","Comment tools")),this.#r.appendChild(this.#i);let s=document.createElement("div");s.className="comment-box-buttons",this.#s=null,this.hasAttribute("data-show-cancel")&&(this.#s=this.#w(),s.appendChild(this.#s)),this.#n=document.createElement("button"),this.#n.type="button",this.#n.className="comment-box-submit",this.#n.textContent=this.getAttribute("submit-label")||"Comment",s.appendChild(this.#n),this.#r.appendChild(s),this.#l=null,this.#a=null,this.hasAttribute("data-max-length")&&(this.#l=document.createElement("span"),this.#l.className="comment-box-counter",this.#l.setAttribute("aria-hidden","true"),this.#r.appendChild(this.#l),this.#a=document.createElement("span"),this.#a.className="comment-box-status visually-hidden",this.#a.setAttribute("role","status"),this.#r.appendChild(this.#a)),this.replaceChildren(this.#t,this.#r),this.listen(this.#n,"click",this.#v),this.#s&&this.listen(this.#s,"click",this.#A),this.#b(),this.listen(this.#t,"markdown-editor:upgraded",()=>this.#b()),this.#p(),this.#d(),this.#m(),this.#x()}teardown(){this.#u=null}get#h(){return this.#t?.textarea??this.#t?.querySelector("textarea")??null}#w(){let e=document.createElement("button");return e.type="button",e.className="comment-box-cancel",e.textContent=this.getAttribute("cancel-label")||"Cancel",e}#b(){let e=this.#h;e&&(this.#y(e),this.#p(),this.#m(),e!==this.#u&&(this.#u=e,this.listen(e,"input",this.#S),this.listen(e,"keydown",this.#f)))}#y(e=this.#h){if(!e)return;let t=this.#e.labels?.[0],s=this.getAttribute("label")||t?.textContent?.trim()||"Comment";e.setAttribute("aria-label",s)}attributeChangedCallback(e,t,s){!this.isConnected||!this.#t||(e==="value"?this.value=s??"":e==="placeholder"?s==null?this.#t.removeAttribute("placeholder"):this.#t.setAttribute("placeholder",s):e==="label"?this.#y():e==="disabled"?this.#p():e==="submit-label"?this.#n&&(this.#n.textContent=s||"Comment"):e==="cancel-label"?this.#s&&(this.#s.textContent=s||"Cancel"):e==="data-show-cancel"&&(this.hasAttribute("data-show-cancel")&&!this.#s&&this.#n?(this.#s=this.#w(),this.#n.before(this.#s),this.listen(this.#s,"click",this.#A),this.#p()):!this.hasAttribute("data-show-cancel")&&this.#s&&(this.#s.remove(),this.#s=null)))}#S=()=>{this.#d(),this.#m(),this.#x(),this.dispatchEvent(new CustomEvent("comment-box:input",{bubbles:!0,detail:{value:this.value,length:this.value.length}}))};#f=e=>{e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),this.#v())};#v=()=>{if(this.#c||this.#k())return;if(!this.#e.validity.valid){this.#e.reportValidity(),this.#h?.focus();return}let e=this.value,t=[],s=!0,r=new CustomEvent("comment-box:submit",{bubbles:!0,cancelable:!0,detail:{value:e,waitUntil(l){if(!s)throw new DOMException("waitUntil() must be called while comment-box:submit is dispatching","InvalidStateError");t.push(Promise.resolve(l))}}}),i=this.dispatchEvent(r);if(s=!1,!!i){if(!t.length){this.clear();return}this.#g(!0),Promise.all(t).then(()=>{this.#g(!1),this.clear()},()=>{this.#g(!1),this.#h?.focus()})}};#A=()=>{let e=this.value;this.dispatchEvent(new CustomEvent("comment-box:cancel",{bubbles:!0,detail:{value:e}}))};#k(){return this.hasAttribute("disabled")||this.#o}#g(e){this.#c=e,e?this.setAttribute("aria-busy","true"):this.removeAttribute("aria-busy"),this.#p()}#p(){let e=this.#k(),t=this.#h;t&&(t.disabled=e,t.readOnly=this.#c),this.#n&&(this.#n.disabled=e,this.#c?this.#n.setAttribute("aria-disabled","true"):this.#n.removeAttribute("aria-disabled")),this.#s&&(this.#s.disabled=e)}#d(){this.#e.setFormValue(this.value)}#m(){let e=this.value,t=Number(this.getAttribute("data-min-length"))||0,s=Number(this.getAttribute("data-max-length"))||1/0,r=this.hasAttribute("required"),i=this.#h&&this.contains(this.#h)?this.#h:null;if(r&&e.length===0){this.#e.setValidity({valueMissing:!0},"Please add a comment.",i||void 0);return}if(e.length<t){this.#e.setValidity({tooShort:!0},`At least ${t} characters required.`,i||void 0);return}if(e.length>s){this.#e.setValidity({tooLong:!0},`No more than ${s} characters.`,i||void 0);return}this.#e.setValidity({})}#x(){if(!this.#l)return;let e=Number(this.getAttribute("data-max-length"))||0,t=this.value.length;if(this.#l.textContent=e?`${t} / ${e}`:String(t),this.#l.classList.toggle("is-over",e>0&&t>e),!this.#a)return;let s=e-t,r="";e&&s<0?r=`${-s} characters over the limit`:e&&s<=At(e)&&(r=`${s} characters remaining`),this.#a.textContent!==r&&(this.#a.textContent=r)}get value(){return this.#t?.value??""}set value(e){this.#t&&(this.#t.value=e==null?"":String(e),this.#d(),this.#m(),this.#x())}get busy(){return this.#c}clear(){this.value="",this.dispatchEvent(new CustomEvent("comment-box:input",{bubbles:!0,detail:{value:"",length:0}}))}focus(){this.#h?.focus()}formResetCallback(){this.value=this.getAttribute("value")??""}formStateRestoreCallback(e){e!=null&&(this.value=e)}formDisabledCallback(e){this.#o=e,this.#p()}get form(){return this.#e.form}get name(){return this.getAttribute("name")}get type(){return this.localName}get validity(){return this.#e.validity}get validationMessage(){return this.#e.validationMessage}checkValidity(){return this.#e.checkValidity()}reportValidity(){return this.#e.reportValidity()}};A("comment-box",ie);var St=[["year",31536e3],["month",2592e3],["week",604800],["day",86400],["hour",3600],["minute",60]];function $t(n){if(!n)return null;try{let e=new URL(n,document.baseURI);return e.protocol==="http:"||e.protocol==="https:"?n:null}catch{return null}}var Et=0,le=class extends w{#e=null;#t=null;#r=0;setup(){this.hasAttribute("role")||this.setAttribute("role","region"),this.hasAttribute("aria-label")||this.setAttribute("aria-label","Comments"),this.#e=this.querySelector(":scope > template[data-reply-form]"),this.#i().forEach(e=>this.#s(e)),this.listen(this,"click",this.#h),this.listen(this,"comment-box:submit",this.#y),this.listen(this,"comment-box:cancel",this.#S),this.#p(),this.#r=setInterval(()=>this.#p(),6e4)}teardown(){clearInterval(this.#r)}#i(){return[...this.querySelectorAll(":scope > article[data-comment]")]}#n(e){return this.querySelector(`:scope > article[data-comment][id="${CSS.escape(e)}"]`)}#s(e){if(e.dataset.decorated==="")return;e.dataset.decorated="";let t=this.#l(e);e.style.setProperty("--comment-depth",String(t)),this.#a(e),e.appendChild(this.#c(e))}#l(e){let t=0,s=e.dataset.parent,r=new Set;for(;s&&!r.has(s);){r.add(s);let i=this.#n(s);if(!i)break;t+=1,s=i.dataset.parent}return t}#a(e){e.querySelector(":scope > .comment-header")?.remove();let t=this.#u(e),s=e.querySelector(":scope > [data-comment-body]");s?e.insertBefore(t,s):e.prepend(t);let r=[...t.querySelectorAll(".comment-author, .comment-time")].map(i=>i.id);e.setAttribute("aria-labelledby",r.join(" "))}#u(e){let t=document.createElement("header");t.className="comment-header";let s=e.id||`comment-thread-${++Et}`,r=e.dataset.author||"Unknown",i=$t(e.dataset.authorHref),l=e.dataset.authorAvatar;if(l){let h=document.createElement("user-avatar");h.setAttribute("name",r);let c=document.createElement("img");c.src=l,c.alt="",c.loading="lazy",c.decoding="async",h.appendChild(c),t.appendChild(h)}let o=document.createElement(i?"a":"span");o.className="comment-author",o.id=`${s}-author`,o.textContent=r,i&&(o.href=i),t.appendChild(o);let a=e.dataset.time;if(a){let h=document.createElement("time");h.className="comment-time",h.id=`${s}-time`,h.setAttribute("datetime",a);let c=this.#d(a);c&&h.setAttribute("title",c),h.textContent=this.#g(a)||a,t.appendChild(h)}if(e.dataset.edited){let h=document.createElement("span");h.className="comment-edited";let c=this.#d(e.dataset.edited);c&&(h.title=`Edited ${c}`),h.textContent="(edited)",t.appendChild(h)}return t}#c(e){let t=document.createElement("footer");if(t.className="comment-footer",this.hasAttribute("data-disabled"))return t;t.setAttribute("role","group"),t.setAttribute("aria-label","Comment actions");let s=document.createElement("button");if(s.type="button",s.className="comment-action comment-reply",s.textContent="Reply",t.appendChild(s),e.hasAttribute("data-mine")){let r=document.createElement("button");r.type="button",r.className="comment-action comment-edit",r.textContent="Edit",t.appendChild(r);let i=document.createElement("button");i.type="button",i.className="comment-action comment-delete",i.textContent="Delete",t.appendChild(i)}return this.#o(e,t),t}#o(e,t=e.querySelector(":scope > .comment-footer")){if(!t)return;let s=e.dataset.author||"Unknown",r=e.dataset.time?this.#d(e.dataset.time):"",i=r?` from ${r}`:"";t.querySelector(".comment-reply")?.setAttribute("aria-label",`Reply to ${s}${i}`),t.querySelector(".comment-edit")?.setAttribute("aria-label",`Edit your comment${i}`),t.querySelector(".comment-delete")?.setAttribute("aria-label",`Delete your comment${i}`)}#h=e=>{let t=e.target.closest?.("button.comment-action");if(!t)return;let s=t.closest("article[data-comment]");!s||s.parentElement!==this||(t.classList.contains("comment-reply")?this.#w(s):t.classList.contains("comment-edit")?this.#v(s):t.classList.contains("comment-delete")&&this.#A(s))};#w(e){if(this.#t&&this.#f(!1),!this.#e)return;let s=this.#e.content.cloneNode(!0).firstElementChild??document.createElement("comment-box");s.hasAttribute("data-show-cancel")||s.setAttribute("data-show-cancel",""),s.localName==="comment-box"&&!s.hasAttribute("label")&&s.setAttribute("label",`Reply to ${e.dataset.author||"comment"}`);let r=document.createElement("div");r.className="comment-reply-form",r.setAttribute("data-parent",e.id||""),r.appendChild(s),e.appendChild(r),this.#t=r,requestAnimationFrame(()=>s.focus?.())}#b(e){let t=e.target.closest?.(".comment-reply-form");return t&&t===this.#t?t:null}#y=e=>{let t=this.#b(e);if(!t)return;let s=e,r=t.parentElement,i=[],l=!0,o=this.dispatchEvent(new CustomEvent("comment-thread:reply",{bubbles:!0,cancelable:!0,detail:{parentId:r.id,value:s.detail.value,waitUntil(h){if(!l)throw new DOMException("waitUntil() must be called while comment-thread:reply is dispatching","InvalidStateError");i.push(Promise.resolve(h))}}}));if(l=!1,!o){s.preventDefault();return}if(!i.length){this.#f(!0);return}let a=Promise.all(i);s.detail.waitUntil?.(a),a.then(()=>{this.#t===t&&this.#f(!0)},()=>{})};#S=e=>{this.#b(e)&&this.#f(!0)};#f(e){let t=this.#t;if(!t)return;let s=t.parentElement,r=t.contains(document.activeElement);t.remove(),this.#t=null,(e||r)&&s?.querySelector(":scope > .comment-footer > .comment-reply")?.focus()}#v(e){let s=e.querySelector(":scope > [data-comment-body]")?.textContent.trim()??"";this.dispatchEvent(new CustomEvent("comment-thread:edit-request",{bubbles:!0,detail:{commentId:e.id,value:s}}))}#A(e){this.dispatchEvent(new CustomEvent("comment-thread:delete-request",{bubbles:!0,detail:{commentId:e.id}}))}#k(){return this.closest("[lang]")?.lang||void 0}#g(e){let t=new Date(e).getTime();if(Number.isNaN(t))return"";let s=(t-Date.now())/1e3,r=new Intl.RelativeTimeFormat(this.#k(),{numeric:"auto"});for(let[i,l]of St)if(Math.abs(s)>=l)return r.format(Math.trunc(s/l),i);return r.format(0,"second")}#p(){for(let e of this.querySelectorAll(":scope > article[data-comment] > .comment-header > time")){let t=e.getAttribute("datetime");if(!t)continue;let s=this.#g(t);s&&(e.textContent=s)}}#d(e){let t=new Date(e);return Number.isNaN(t.getTime())?"":new Intl.DateTimeFormat(this.#k(),{dateStyle:"medium",timeStyle:"short"}).format(t)}#m(e,t){t.bodyText!=null?e.textContent=String(t.bodyText):t.bodyHtml!=null&&(e.innerHTML=B(String(t.bodyHtml))),"body"in t&&console.warn("[VB] comment-thread: `body` was removed \u2014 pass `bodyText` (plain text) or `bodyHtml` (sanitized HTML).")}addComment(e){let t=document.createElement("article");t.setAttribute("data-comment",""),t.id=e.id,t.dataset.author=e.author,e.authorHref&&(t.dataset.authorHref=e.authorHref),e.authorAvatar&&(t.dataset.authorAvatar=e.authorAvatar),t.dataset.time=e.time,e.parentId&&(t.dataset.parent=e.parentId),e.mine&&t.setAttribute("data-mine",""),e.edited&&(t.dataset.edited=e.edited);let s=document.createElement("div");s.setAttribute("data-comment-body",""),this.#m(s,e),t.appendChild(s);let r=e.parentId?this.#x(e.parentId):null;if(r)r.after(t);else if(this.#e?.parentNode===this)this.insertBefore(t,this.#e);else{let i=this.#i(),l=i[i.length-1];l?l.after(t):this.appendChild(t)}return this.#s(t),t}#x(e){let t=this.#n(e);if(!t)return null;let s=new Set([e]),r=t,i=t.nextElementSibling;for(;i instanceof HTMLElement&&i.matches("article[data-comment]")&&s.has(i.dataset.parent??"");)i.id&&s.add(i.id),r=i,i=i.nextElementSibling;return r}updateComment(e,t={}){let s=this.#n(e);if(!s)return;let r=s.querySelector(":scope > [data-comment-body]");r&&this.#m(r,t),t.author!=null&&(s.dataset.author=t.author),t.edited!=null&&(s.dataset.edited=t.edited),this.#a(s),this.#o(s)}removeComment(e){this.#n(e)?.remove()}};A("comment-thread",le);export{le as CommentThread};
|
|
60
60
|
//# sourceMappingURL=comment-thread.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var c=class extends HTMLElement{#e=[];#t;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#e)e();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,t,n,i){e.addEventListener(t,n,i),this.#e.push(()=>e.removeEventListener(t,n,i))}_reinit(){for(let e of this.#e)e();this.#e=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(e,t){this.#t||(this.#t=this.attachInternals());let n=this.#t.states;try{t?n.add(e):n.delete(e)}catch{let i=`--${e}`;t?n.add(i):n.delete(i)}}_adoptInternals(e){this.#t||(this.#t=e)}};var b=window.matchMedia("(prefers-reduced-motion: reduce)");var l=new Map;function f(r,e,t={}){let n=t.priority??10,i={impl:e,bundle:t.bundle,contract:t.contract,priority:n},s=l.get(r);if(customElements.get(r)){if(!s||s.priority>=n){s&&s.priority===n&&s.impl!==e&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${t.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=n){s.priority===n&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${s.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}l.set(r,i),customElements.define(r,e)}var h=0,a=class extends c{#e=null;#t=null;setup(){if(this.#e=this.querySelector(":scope > button"),this.#t=this.querySelector(":scope > .comment-wc-reason"),!this.#e){let t=document.createElement("button");t.type="button";let n=document.createElement("icon-wc");n.setAttribute("name","message-circle"),n.setAttribute("size","sm"),n.setAttribute("aria-hidden","true"),t.appendChild(n);let i=document.createElement("span");i.className="comment-wc-reason visually-hidden",i.id=`comment-wc-reason-${++h}`,i.textContent="Comments are unavailable: this content has no review surface.",this.append(t,i),this.#e=t,this.#t=i}this.#n(),this.listen(this,"click",this.#s);let e=this.closest("selection-menu");e&&this.listen(e,"toggle",()=>this.#n())}#i(){let e=this.closest("review-surface");if(e)return e;let t=this.closest("selection-menu")?.getAttribute("for");return t?document.querySelector(`review-surface[for="${CSS.escape(t)}"]`):null}#n(){let e=this.#e;if(!e)return;!!this.#i()?(e.removeAttribute("aria-disabled"),e.removeAttribute("aria-describedby"),e.setAttribute("aria-label","Add comment")):(e.setAttribute("aria-disabled","true"),e.setAttribute("aria-label","Add comment"),this.#t&&e.setAttribute("aria-describedby",this.#t.id))}#s=e=>{if(!this.#e?.contains(e.target))return;this.#n();let t=this.#i();if(!t)return;let n=this.closest("selection-menu");if(!n)return;let i=n.getSelection();if(!i)return;let s=i.range.getBoundingClientRect(),o=t.getBoundingClientRect(),d=(s.left+s.width/2-o.left)/o.width*100,u=(s.top-o.top)/o.height*100;typeof t.addPin=="function"&&t.addPin({x:d,y:u,text:i.text}),this.dispatchEvent(new CustomEvent("comment-wc:created",{detail:{text:i.text,x:d,y:u},bubbles:!0})),n.dismiss()}};f("comment-wc",a);
|
|
2
2
|
//# sourceMappingURL=comment-wc.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var d=window.matchMedia("(prefers-reduced-motion: reduce)");var l=new Map;function h(n,t,e={}){let i=e.priority??10,r={impl:t,bundle:e.bundle,contract:e.contract,priority:i},s=l.get(n);if(customElements.get(n)){if(!s||s.priority>=i){s&&s.priority===i&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${n}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=i){s.priority===i&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}l.set(n,r),customElements.define(n,t)}var o=class extends HTMLElement{#t=[];#e;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,r){t.addEventListener(e,i,r),this.#t.push(()=>t.removeEventListener(e,i,r))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#e||(this.#e=this.attachInternals());let i=this.#e.states;try{e?i.add(t):i.delete(t)}catch{let r=`--${t}`;e?i.add(r):i.delete(r)}}_adoptInternals(t){this.#e||(this.#e=t)}};var u="Comparison slider";function a(n){if(n===null||n.trim()==="")return 50;let t=Number(n);return Number.isNaN(t)?50:Math.min(100,Math.max(0,t))}var c=class extends o{static observedAttributes=["position","label","aria-label"];#t=null;#e=!1;#s=!1;#i=50;setup(){let t=[...this.children].filter(e=>!e.classList.contains("comparison-divider"));return t.length<2?!1:(t.length>2&&console.warn("[compare-surface] Expected exactly 2 children; extra children are hidden."),this.#t=document.createElement("div"),this.#t.className="comparison-divider",this.#t.setAttribute("role","slider"),this.#t.setAttribute("aria-valuemin","0"),this.#t.setAttribute("aria-valuemax","100"),this.#t.setAttribute("aria-orientation","horizontal"),this.#t.setAttribute("tabindex","0"),this.#o(),this.appendChild(this.#t),this.#n(a(this.getAttribute("position"))),this.listen(this.#t,"pointerdown",this.#l),this.listen(this.#t,"pointermove",this.#h),this.listen(this.#t,"pointerup",this.#r),this.listen(this.#t,"pointercancel",this.#r),this.listen(this.#t,"lostpointercapture",this.#r),this.listen(this.#t,"keydown",this.#u),!0)}teardown(){this.#t?.remove(),this.#t=null,this.#e=!1}attributeChangedCallback(t,e,i){if(!(!this.#t||e===i))if(t==="position"){if(this.#s)return;this.#n(a(i))}else this.#o()}#o(){if(!this.#t)return;let t=this.getAttribute("label")||this.getAttribute("aria-label")||u;this.#t.setAttribute("aria-label",t)}get#a(){return getComputedStyle(this).direction==="rtl"}#l=t=>{t.preventDefault(),this.#e=!0,this.#t?.setPointerCapture(t.pointerId)};#h=t=>{if(!this.#e)return;let e=this.getBoundingClientRect();if(!e.width)return;let i=this.#a?e.right-t.clientX:t.clientX-e.left;this.#c(i/e.width*100)};#r=t=>{this.#e&&(this.#e=!1,this.#t?.hasPointerCapture(t.pointerId)&&this.#t.releasePointerCapture(t.pointerId))};#u=t=>{let e=t.shiftKey?10:1,i=this.#a?-1:1,r=this.#i,s;switch(t.key){case"ArrowRight":s=r+e*i;break;case"ArrowLeft":s=r-e*i;break;case"ArrowUp":s=r+e;break;case"ArrowDown":s=r-e;break;case"PageUp":s=r+10;break;case"PageDown":s=r-10;break;case"Home":s=0;break;case"End":s=100;break;default:return}t.preventDefault(),this.#c(s)};#c(t){let e=this.#i;if(this.#n(Math.min(100,Math.max(0,t))),this.#i!==e){this.#s=!0;try{this.setAttribute("position",String(this.#i))}finally{this.#s=!1}this.dispatchEvent(new CustomEvent("compare-surface:change",{detail:{position:this.#i},bubbles:!0}))}}#n(t){this.#i=Math.round(t),this.style.setProperty("--_position",`${t}%`),this.#t&&(this.#t.setAttribute("aria-valuenow",String(this.#i)),this.#t.setAttribute("aria-valuetext",`${this.#i}%`))}get position(){return this.#t?this.#i:Math.round(a(this.getAttribute("position")))}set position(t){let e=Number(t),i=Math.round(Math.min(100,Math.max(0,Number.isNaN(e)?0:e)));this.setAttribute("position",String(i))}};h("compare-surface",c);export{c as CompareSurface};
|
|
2
2
|
//# sourceMappingURL=compare-surface.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var x=window.matchMedia("(prefers-reduced-motion: reduce)");var m=new Map;function y(t,e,n={}){let r=n.priority??10,i={impl:e,bundle:n.bundle,contract:n.contract,priority:r},s=m.get(t);if(customElements.get(t)){if(!s||s.priority>=r){s&&s.priority===r&&s.impl!==e&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${n.bundle}".`);return}console.warn(`[VB Bundle] Tag <${t}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${n.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=r){s.priority===r&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${s.bundle}". Skipping "${n.bundle}" (first wins at equal priority).`);return}m.set(t,i),customElements.define(t,e)}var u=class extends HTMLElement{#e=[];#t;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#e)e();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,n,r,i){e.addEventListener(n,r,i),this.#e.push(()=>e.removeEventListener(n,r,i))}_reinit(){for(let e of this.#e)e();this.#e=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(e,n){this.#t||(this.#t=this.attachInternals());let r=this.#t.states;try{n?r.add(e):r.delete(e)}catch{let i=`--${e}`;n?r.add(i):r.delete(i)}}_adoptInternals(e){this.#t||(this.#t=e)}};function A(){let t=globalThis.localStorage;if(!t)throw new Error("VBStore: localStorage is not available in this environment");return{async getRaw(e){return t.getItem(e)},async setRaw(e,n){t.setItem(e,n)},async removeRaw(e){t.removeItem(e)},async keys(e){let n=[];for(let r=0;r<t.length;r++){let i=t.key(r);i&&i.startsWith(e)&&n.push(i)}return n}}}var l="__vbStoreBackend",d=globalThis;function a(){return d[l]||(d[l]=A()),d[l]}function p(t,e){if(typeof t!="string"||!t)throw new TypeError("VBStore: namespace must be a non-empty string");if(typeof e!="string"||!e)throw new TypeError("VBStore: key must be a non-empty string");return`vb:${t}:${e}`}function g(t){if(typeof t!="string"||!t)throw new TypeError("VBStore: namespace must be a non-empty string");return`vb:${t}:`}function w(t){try{let e=JSON.parse(t);if(e&&typeof e=="object"&&typeof e.timestamp=="number")return e}catch{}return null}var c={configure(t={}){d[l]=t.backend??null},async set(t,e,n){let r={data:n,timestamp:Date.now()};await a().setRaw(p(t,e),JSON.stringify(r))},async get(t,e,n){let r=await a().getRaw(p(t,e));if(r==null)return null;let i=w(r);return!i||n?.maxAge!=null&&Date.now()-i.timestamp>n.maxAge?null:i.data},async remove(t,e){await a().removeRaw(p(t,e))},async list(t){let e=g(t),n=await a().keys(e),r=[];for(let i of n){let s=await a().getRaw(i);if(s==null)continue;let o=w(s);o&&r.push({key:i.slice(e.length),data:o.data,timestamp:o.timestamp})}return r},async clear(t){let e=g(t),n=await a().keys(e);for(let r of n)await a().removeRaw(r)},async clearAll(){let t=await a().keys("vb:");for(let e of t)await a().removeRaw(e)},async setMany(t,e){for(let[n,r]of e)await c.set(t,n,r)}};if(typeof window<"u"){let t=window.VB??(window.VB={});t.store??=c}var f="banner",E=365,k=864e5;function v(t){if(t===0||t==="0"||t==="never")return;let e=t==null||t===""?E:Number.parseFloat(String(t));return Number.isFinite(e)?e>0?e*k:void 0:E*k}var S=0,b=class extends u{#e=null;static get observedAttributes(){return["position"]}get#t(){return this.getAttribute("persist")||f}get#o(){return v(this.getAttribute("expires"))}get#n(){return this.getAttribute("position")==="center"}setup(){return this.#e=this.querySelector("dialog"),this.#e?(this.#a(),this.getAttribute("trigger")&&this.listen(document,"click",this.#f),this.listen(this,"click",this.#d),this.listen(this.#e,"cancel",this.#l),this.#c(),!0):!1}attributeChangedCallback(e,n,r){n===r||!this.#e?.open||(this.#e.close(),this.#r())}#a(){let e=this.#e;if(e.hasAttribute("aria-label")||e.hasAttribute("aria-labelledby"))return;let n=e.querySelector("h1, h2, h3, h4, h5, h6");n?(n.id||(n.id=`consent-banner-title-${++S}`),e.setAttribute("aria-labelledby",n.id)):e.setAttribute("aria-label","Cookie consent")}async#c(){if(await this.#s()){this.getAttribute("trigger")?this.hidden=!0:this.remove();return}this.#i()}#r(){this.#n?this.#e.showModal():this.#e.show()}#i(){!this.isConnected||this.#e.open||this.#r()}#u(){this.#e.close(),this.getAttribute("trigger")?this.hidden=!0:this.remove()}#l=e=>{this.#n&&e.preventDefault()};#d=async e=>{if(!this.#e.open)return;let n=e.target.closest("button[value]");if(!n||!this.#e.contains(n))return;let r=n.value;if(!["accept","reject","save"].includes(r))return;let i=[...this.querySelectorAll('input[type="checkbox"]')],s={};r==="accept"?i.forEach(o=>{s[o.name]=!0}):r==="reject"?i.forEach(o=>{s[o.name]=!!o.disabled}):i.forEach(o=>{s[o.name]=o.checked}),await this.#h({preferences:s,action:r}),this.dispatchEvent(new CustomEvent("consent-banner:change",{bubbles:!0,detail:{preferences:s,action:r}})),this.#u()};#f=async e=>{let n=this.getAttribute("trigger");if(!n||!e.target.closest(n))return;e.preventDefault();let i=await this.#s();if(i?.preferences)for(let[s,o]of Object.entries(i.preferences)){let h=this.querySelector(`input[type="checkbox"][name="${CSS.escape(s)}"]`);h&&!h.disabled&&(h.checked=o)}this.hidden=!1,this.#i()};async#s(){let e=this.#o;try{return await c.get("consent",this.#t,e?{maxAge:e}:void 0)}catch{return null}}async#h(e){try{await c.set("consent",this.#t,e)}catch{}}static async reset(e=f){try{await c.remove("consent",e)}catch{}}static async getConsent(e=f,n={}){let r=n.expires;r===void 0&&typeof document<"u"&&(r=[...document.querySelectorAll("consent-banner")].find(o=>(o.getAttribute("persist")||f)===e)?.getAttribute("expires")??void 0);let i=v(r);try{return await c.get("consent",e,i?{maxAge:i}:void 0)}catch{return null}}};y("consent-banner",b);export{b as ConsentBanner};
|
|
2
2
|
//# sourceMappingURL=consent-banner.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var h=window.matchMedia("(prefers-reduced-motion: reduce)");var u=new Map;function f(r,e,t={}){let n=t.priority??10,i={impl:e,bundle:t.bundle,contract:t.contract,priority:n},s=u.get(r);if(customElements.get(r)){if(!s||s.priority>=n){s&&s.priority===n&&s.impl!==e&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${t.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=n){s.priority===n&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${s.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}u.set(r,i),customElements.define(r,e)}var c=class extends HTMLElement{#e=[];#t;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#e)e();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,t,n,i){e.addEventListener(t,n,i),this.#e.push(()=>e.removeEventListener(t,n,i))}_reinit(){for(let e of this.#e)e();this.#e=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(e,t){this.#t||(this.#t=this.attachInternals());let n=this.#t.states;try{t?n.add(e):n.delete(e)}catch{let i=`--${e}`;t?n.add(i):n.delete(i)}}_adoptInternals(e){this.#t||(this.#t=e)}};var d=class extends c{#e=new Map;#t="";#n=null;setup(){if(this.#r(),this.#e.size===0)return!1;this.#o(),this.#a();let e=this.#d();return this.#s(e,{persist:!1,notify:!1}),!0}#r(){for(let e of this.children){let t=e.getAttribute("data-lens-name");t&&this.#e.set(t,e)}}#o(){let e=this.getAttribute("data-lens-src");if(e)for(let t of this.#e.values()){if(t.hasAttribute("data-lens-src")||t.hasAttribute("src"))continue;t.setAttribute("data-lens-src",e);let n=t;t.hasAttribute("data-upgraded")&&typeof n._reinit=="function"&&n._reinit()}}#a(){if(this.getAttribute("data-lens-controls")==="off"||this.#n?.parentNode===this)return;let e=document.createElement("fieldset");e.setAttribute("data-content-lens-controls","");let t=document.createElement("legend");t.textContent="View",e.append(t);let n=`content-lens-${Math.random().toString(36).slice(2,8)}`;for(let[i,s]of this.#e){let a=document.createElement("label"),o=document.createElement("input");o.type="radio",o.name=n,o.value=i,o.addEventListener("change",()=>{o.checked&&this.#s(i,{persist:!0,notify:!0})});let l=document.createElement("span");l.textContent=s.getAttribute("data-lens-label")||this.#c(i),a.append(o,l),e.append(a)}this.prepend(e),this.#n=e}#c(e){return e.replace(/-/g," ").replace(/\b\w/g,t=>t.toUpperCase())}#i(){return`vb:content-lens:${this.getAttribute("data-lens-storage")||(typeof location<"u"?location.pathname:"default")}`}#d(){let e=(()=>{try{return typeof sessionStorage<"u"?sessionStorage.getItem(this.#i()):null}catch{return null}})();if(e&&this.#e.has(e))return e;let t=this.getAttribute("data-lens-default");return t&&this.#e.has(t)?t:[...this.#e.keys()][0]}#s(e,{persist:t,notify:n}){if(!this.#e.has(e))return;let i=e!==this.#t;for(let[s,a]of this.#e){let o=s===e;a.toggleAttribute("hidden",!o),a.setAttribute("aria-hidden",o?"false":"true")}if(this.#n){let s=this.#n.querySelector(`input[value="${CSS.escape(e)}"]`);s&&(s.checked=!0)}if(this.#t=e,this.setAttribute("data-active-lens",e),t)try{sessionStorage.setItem(this.#i(),e)}catch{}n&&i&&this.dispatchEvent(new CustomEvent("content-lens:change",{detail:{lens:e},bubbles:!0}))}get activeLens(){return this.#t}setLens(e){this.#s(e,{persist:!0,notify:!0})}};f("content-lens",d);export{d as ContentLens};
|
|
2
2
|
//# sourceMappingURL=content-lens.js.map
|