vanilla-breeze 0.3.0 → 0.4.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/README.md +33 -4
- package/dist/cdn/components/activity-feed.js +1 -1
- package/dist/cdn/components/audio-player.js +2 -2
- package/dist/cdn/components/carousel-wc.js +1 -1
- package/dist/cdn/components/comment-box.js +16 -16
- package/dist/cdn/components/comment-thread.js +20 -20
- package/dist/cdn/components/comment-wc.js +1 -1
- package/dist/cdn/components/content-lens.js +1 -1
- package/dist/cdn/components/context-menu.js +1 -1
- package/dist/cdn/components/diagram-wc.js +1 -1
- package/dist/cdn/components/drop-down.js +1 -1
- package/dist/cdn/components/image-gallery.js +1 -1
- package/dist/cdn/components/manifest.json +44 -20
- package/dist/cdn/components/reaction-bar.js +1 -1
- package/dist/cdn/components/score-card.js +2 -2
- package/dist/cdn/components/settings-panel.js +15 -15
- package/dist/cdn/components/site-search.js +1 -1
- package/dist/cdn/components/social-embed.js +1 -1
- package/dist/cdn/components/tab-set.js +1 -1
- package/dist/cdn/components/theme-picker.js +45 -45
- package/dist/cdn/components/time-index.js +2 -2
- package/dist/cdn/components/time-picker.js +1 -1
- package/dist/cdn/components/version-switcher.js +1 -1
- package/dist/cdn/packs/effects.full.js +1 -1
- package/dist/cdn/packs/journal.effects.css +1 -1
- package/dist/cdn/packs/journal.full.css +1 -1
- package/dist/cdn/packs/kawaii.effects.css +1 -1
- package/dist/cdn/packs/kawaii.full.css +2 -2
- package/dist/cdn/packs/kawaii.full.js +4 -4
- package/dist/cdn/packs/kawaii.theme.css +1 -1
- package/dist/cdn/packs/manifest.json +11 -11
- package/dist/cdn/packs/memphis.full.css +1 -1
- package/dist/cdn/packs/memphis.theme.css +1 -1
- package/dist/cdn/packs/ui.full.css +1 -1
- package/dist/cdn/packs/ui.full.js +52 -52
- package/dist/cdn/themes/8bit.css +1 -1
- package/dist/cdn/themes/8bit.tokens.json +4 -4
- package/dist/cdn/themes/alpha1999-dark.tokens.json +4 -4
- package/dist/cdn/themes/alpha1999.css +1 -1
- package/dist/cdn/themes/alpha1999.tokens.json +4 -4
- package/dist/cdn/themes/anthropic.css +1 -1
- package/dist/cdn/themes/anthropic.tokens.json +4 -4
- package/dist/cdn/themes/art-deco-dark.tokens.json +4 -4
- package/dist/cdn/themes/art-deco.css +1 -1
- package/dist/cdn/themes/art-deco.tokens.json +4 -4
- package/dist/cdn/themes/bauhaus-dark.tokens.json +1 -1
- package/dist/cdn/themes/bauhaus.css +1 -1
- package/dist/cdn/themes/bauhaus.tokens.json +4 -4
- package/dist/cdn/themes/brutalist-dark.tokens.json +4 -4
- package/dist/cdn/themes/brutalist.css +1 -1
- package/dist/cdn/themes/brutalist.tokens.json +4 -4
- package/dist/cdn/themes/catalog/atlassian.tokens.json +2 -2
- package/dist/cdn/themes/catalog/bootstrap.tokens.json +2 -2
- package/dist/cdn/themes/catalog/carbon.tokens.json +2 -2
- package/dist/cdn/themes/catalog/catppuccin-mocha.tokens.json +2 -2
- package/dist/cdn/themes/catalog/govuk.tokens.json +2 -2
- package/dist/cdn/themes/catalog/manifest.json +1 -1
- package/dist/cdn/themes/catalog/material.tokens.json +2 -2
- package/dist/cdn/themes/catalog/salesforce.tokens.json +2 -2
- package/dist/cdn/themes/catalog/tailwind.tokens.json +2 -2
- package/dist/cdn/themes/catppuccin-frappe.css +1 -1
- package/dist/cdn/themes/catppuccin-frappe.tokens.json +4 -4
- package/dist/cdn/themes/catppuccin-latte-dark.tokens.json +4 -4
- package/dist/cdn/themes/catppuccin-latte.css +1 -1
- package/dist/cdn/themes/catppuccin-latte.tokens.json +4 -4
- package/dist/cdn/themes/catppuccin-macchiato.css +1 -1
- package/dist/cdn/themes/catppuccin-macchiato.tokens.json +4 -4
- package/dist/cdn/themes/catppuccin-mocha.css +1 -1
- package/dist/cdn/themes/catppuccin-mocha.tokens.json +4 -4
- package/dist/cdn/themes/classic-dark.tokens.json +4 -4
- package/dist/cdn/themes/classic.css +1 -1
- package/dist/cdn/themes/classic.tokens.json +4 -4
- package/dist/cdn/themes/claymorphism-dark.tokens.json +10 -10
- package/dist/cdn/themes/claymorphism.css +1 -1
- package/dist/cdn/themes/claymorphism.tokens.json +10 -10
- package/dist/cdn/themes/clinical-dark.tokens.json +4 -4
- package/dist/cdn/themes/clinical.css +1 -1
- package/dist/cdn/themes/clinical.tokens.json +4 -4
- package/dist/cdn/themes/cottagecore-dark.tokens.json +4 -4
- package/dist/cdn/themes/cottagecore.css +1 -1
- package/dist/cdn/themes/cottagecore.tokens.json +4 -4
- package/dist/cdn/themes/cyber.css +1 -1
- package/dist/cdn/themes/cyber.tokens.json +4 -5
- package/dist/cdn/themes/dawn-dark.tokens.json +4 -4
- package/dist/cdn/themes/dawn.css +1 -1
- package/dist/cdn/themes/dawn.tokens.json +4 -4
- package/dist/cdn/themes/dracula.css +1 -1
- package/dist/cdn/themes/dracula.tokens.json +4 -4
- package/dist/cdn/themes/dusk.css +1 -1
- package/dist/cdn/themes/dusk.tokens.json +4 -4
- package/dist/cdn/themes/editorial-dark.tokens.json +3 -3
- package/dist/cdn/themes/editorial.css +1 -1
- package/dist/cdn/themes/editorial.tokens.json +4 -4
- package/dist/cdn/themes/financial-dark.tokens.json +4 -4
- package/dist/cdn/themes/financial.css +1 -1
- package/dist/cdn/themes/financial.tokens.json +4 -4
- package/dist/cdn/themes/genai.css +1 -1
- package/dist/cdn/themes/genai.tokens.json +4 -4
- package/dist/cdn/themes/glassmorphism-dark.tokens.json +4 -4
- package/dist/cdn/themes/glassmorphism.css +1 -1
- package/dist/cdn/themes/glassmorphism.tokens.json +4 -4
- package/dist/cdn/themes/government-dark.tokens.json +4 -4
- package/dist/cdn/themes/government.css +1 -1
- package/dist/cdn/themes/government.tokens.json +4 -4
- package/dist/cdn/themes/gruvbox-dark.tokens.json +4 -4
- package/dist/cdn/themes/gruvbox.css +1 -1
- package/dist/cdn/themes/gruvbox.tokens.json +4 -4
- package/dist/cdn/themes/high-noon-dark.tokens.json +4 -4
- package/dist/cdn/themes/high-noon.css +1 -1
- package/dist/cdn/themes/high-noon.tokens.json +4 -4
- package/dist/cdn/themes/ibm.css +1 -1
- package/dist/cdn/themes/ibm.tokens.json +6 -6
- package/dist/cdn/themes/journal-dark.tokens.json +4 -4
- package/dist/cdn/themes/journal.css +1 -1
- package/dist/cdn/themes/journal.tokens.json +4 -4
- package/dist/cdn/themes/kawaii-dark.tokens.json +4 -4
- package/dist/cdn/themes/kawaii.css +1 -1
- package/dist/cdn/themes/kawaii.tokens.json +4 -4
- package/dist/cdn/themes/magna-dark.tokens.json +4 -4
- package/dist/cdn/themes/magna.css +1 -1
- package/dist/cdn/themes/magna.tokens.json +4 -4
- package/dist/cdn/themes/manifest.json +48 -48
- package/dist/cdn/themes/mcdonalds.css +1 -1
- package/dist/cdn/themes/mcdonalds.tokens.json +4 -4
- package/dist/cdn/themes/midnight.css +1 -1
- package/dist/cdn/themes/midnight.tokens.json +4 -4
- package/dist/cdn/themes/minimal-dark.tokens.json +4 -4
- package/dist/cdn/themes/minimal.css +1 -1
- package/dist/cdn/themes/minimal.tokens.json +4 -4
- package/dist/cdn/themes/modern-dark.tokens.json +4 -4
- package/dist/cdn/themes/modern.css +1 -1
- package/dist/cdn/themes/modern.tokens.json +4 -4
- package/dist/cdn/themes/nes-dark.tokens.json +4 -4
- package/dist/cdn/themes/nes.css +1 -1
- package/dist/cdn/themes/nes.tokens.json +4 -4
- package/dist/cdn/themes/neumorphism-dark.tokens.json +10 -10
- package/dist/cdn/themes/neumorphism.css +1 -1
- package/dist/cdn/themes/neumorphism.tokens.json +10 -10
- package/dist/cdn/themes/nord-dark.tokens.json +4 -4
- package/dist/cdn/themes/nord.css +1 -1
- package/dist/cdn/themes/nord.tokens.json +4 -4
- package/dist/cdn/themes/organic-dark.tokens.json +4 -4
- package/dist/cdn/themes/organic.css +1 -1
- package/dist/cdn/themes/organic.tokens.json +4 -4
- package/dist/cdn/themes/rose-pine-dark.tokens.json +4 -4
- package/dist/cdn/themes/rose-pine.css +1 -1
- package/dist/cdn/themes/rose-pine.tokens.json +4 -4
- package/dist/cdn/themes/rough-dark.tokens.json +4 -5
- package/dist/cdn/themes/rough.css +1 -1
- package/dist/cdn/themes/rough.tokens.json +5 -6
- package/dist/cdn/themes/solarized-dark.tokens.json +4 -4
- package/dist/cdn/themes/solarized.css +1 -1
- package/dist/cdn/themes/solarized.tokens.json +4 -4
- package/dist/cdn/themes/starbucks.css +1 -1
- package/dist/cdn/themes/starbucks.tokens.json +4 -4
- package/dist/cdn/themes/startup-dark.tokens.json +4 -4
- package/dist/cdn/themes/startup.css +1 -1
- package/dist/cdn/themes/startup.tokens.json +4 -4
- package/dist/cdn/themes/super2026-dark.tokens.json +4 -4
- package/dist/cdn/themes/super2026.css +1 -1
- package/dist/cdn/themes/super2026.tokens.json +4 -4
- 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 +4 -4
- package/dist/cdn/themes/terminal.css +1 -1
- package/dist/cdn/themes/terminal.tokens.json +4 -4
- package/dist/cdn/themes/tokyo-night-dark.tokens.json +4 -4
- package/dist/cdn/themes/tokyo-night.css +1 -1
- package/dist/cdn/themes/tokyo-night.tokens.json +4 -4
- package/dist/cdn/themes/vaporwave-dark.tokens.json +4 -4
- package/dist/cdn/themes/vaporwave.css +1 -1
- package/dist/cdn/themes/vaporwave.tokens.json +4 -4
- package/dist/cdn/themes/win9x-dark.tokens.json +4 -4
- package/dist/cdn/themes/win9x.css +1 -1
- package/dist/cdn/themes/win9x.tokens.json +4 -4
- package/dist/cdn/vanilla-breeze-charts.css +1 -1
- package/dist/cdn/vanilla-breeze-core.css +1 -1
- package/dist/cdn/vanilla-breeze-core.js +62 -62
- package/dist/cdn/vanilla-breeze-dev.css +1 -1
- package/dist/cdn/vanilla-breeze-extras.js +19 -19
- package/dist/cdn/vanilla-breeze-labs.css +1 -1
- package/dist/cdn/vanilla-breeze.css +1 -1
- package/dist/cdn/vanilla-breeze.js +170 -170
- package/package.json +5 -8
- package/dist/cdn/components/accessibility-specimen.js +0 -11
- package/dist/cdn/components/adr-wc.js +0 -403
- package/dist/cdn/components/breakpoint-specimen.js +0 -26
- package/dist/cdn/components/burndown-chart.js +0 -2
- package/dist/cdn/components/capacity-plan.js +0 -25
- package/dist/cdn/components/color-palette.js +0 -16
- package/dist/cdn/components/component-sampler.js +0 -45
- package/dist/cdn/components/empathy-map.js +0 -582
- package/dist/cdn/components/font-pairer.js +0 -108
- package/dist/cdn/components/gantt-chart.js +0 -2
- package/dist/cdn/components/gradient-builder.js +0 -52
- package/dist/cdn/components/impact-effort.js +0 -2
- package/dist/cdn/components/iron-triangle.js +0 -2
- package/dist/cdn/components/kanban-board.js +0 -2
- package/dist/cdn/components/layout-specimen.js +0 -35
- package/dist/cdn/components/motion-specimen.js +0 -21
- package/dist/cdn/components/palette-generator.js +0 -15
- package/dist/cdn/components/product-roadmap.js +0 -3
- package/dist/cdn/components/quadrant-grid.js +0 -3
- package/dist/cdn/components/quality-target.js +0 -12
- package/dist/cdn/components/requirement-card.js +0 -122
- package/dist/cdn/components/review-surface.js +0 -535
- package/dist/cdn/components/risk-register.js +0 -25
- package/dist/cdn/components/semantic-palette.js +0 -30
- package/dist/cdn/components/spacing-specimen.js +0 -6
- package/dist/cdn/components/story-map.js +0 -2
- package/dist/cdn/components/theme-catalog.js +0 -28
- package/dist/cdn/components/theme-export.js +0 -26
- package/dist/cdn/components/theme-import.js +0 -44
- package/dist/cdn/components/token-specimen.js +0 -26
- package/dist/cdn/components/traceability-matrix.js +0 -3
- package/dist/cdn/components/type-specimen.js +0 -19
- package/dist/cdn/components/user-journey.js +0 -366
- package/dist/cdn/components/user-persona.js +0 -402
- package/dist/cdn/components/user-story.js +0 -411
- package/dist/cdn/components/work-item.js +0 -447
- package/dist/cdn/packs/design-system.full.css +0 -2
- package/dist/cdn/packs/design-system.full.js +0 -175
- package/dist/cdn/packs/ux-planning.full.css +0 -2
- package/dist/cdn/packs/ux-planning.full.js +0 -3160
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
var
|
|
2
|
-
]`).replace("lheading",ke).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Oe=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ze=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,we=/^( {2,}|\\)\n(?!\s*$)/,Qe=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,R=/[\p{P}\p{S}]/u,D=/[\s\p{P}\p{S}]/u,W=/[^\s\p{P}\p{S}]/u,je=u(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,D).getRegex(),ye=/(?!~)[\p{P}\p{S}]/u,Fe=/(?!~)[\s\p{P}\p{S}]/u,Ve=/(?:[^\s\p{P}\p{S}]|~)/u,Ue=u(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Ce?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),ve=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Ge=u(ve,"u").replace(/punct/g,R).getRegex(),Ke=u(ve,"u").replace(/punct/g,ye).getRegex(),Ae="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",We=u(Ae,"gu").replace(/notPunctSpace/g,W).replace(/punctSpace/g,D).replace(/punct/g,R).getRegex(),Xe=u(Ae,"gu").replace(/notPunctSpace/g,Ve).replace(/punctSpace/g,Fe).replace(/punct/g,ye).getRegex(),Ye=u("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,W).replace(/punctSpace/g,D).replace(/punct/g,R).getRegex(),Je=u(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,R).getRegex(),et="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",tt=u(et,"gu").replace(/notPunctSpace/g,W).replace(/punctSpace/g,D).replace(/punct/g,R).getRegex(),rt=u(/\\(punct)/,"gu").replace(/punct/g,R).getRegex(),st=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(),nt=u(G).replace("(?:-->|$)","-->").getRegex(),it=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",nt).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),_=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,at=u(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",_).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Se=u(/^!?\[(label)\]\[(ref)\]/).replace("label",_).replace("ref",U).getRegex(),$e=u(/^!?\[(ref)\](?:\[\])?/).replace("ref",U).getRegex(),lt=u("reflink|nolink(?!\\()","g").replace("reflink",Se).replace("nolink",$e).getRegex(),ue=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,X={_backpedal:S,anyPunctuation:rt,autolink:st,blockSkip:Ue,br:we,code:Ze,del:S,delLDelim:S,delRDelim:S,emStrongLDelim:Ge,emStrongRDelimAst:We,emStrongRDelimUnd:Ye,escape:Oe,link:at,nolink:$e,punctuation:je,reflink:Se,reflinkSearch:lt,tag:it,text:Qe,url:S},ot={...X,link:u(/^!?\[(label)\]\((.*?)\)/).replace("label",_).getRegex(),reflink:u(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",_).getRegex()},O={...X,emStrongRDelimAst:Xe,emStrongLDelim:Ke,delLDelim:Je,delRDelim:tt,url:u(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",ue).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",ue).getRegex()},ct={...O,br:u(we).replace("{2,}","*").getRegex(),text:u(O.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},P={normal:K,gfm:De,pedantic:He},T={normal:X,gfm:O,breaks:ct,pedantic:ot},ht={"&":"&","<":"<",">":">",'"':""","'":"'"},pe=n=>ht[n];function y(n,e){if(e){if(b.escapeTest.test(n))return n.replace(b.escapeReplace,pe)}else if(b.escapeTestNoEncode.test(n))return n.replace(b.escapeReplaceNoEncode,pe);return n}function de(n){try{n=encodeURI(n).replace(b.percentDecode,"%")}catch{return null}return n}function ge(n,e){let t=n.replace(b.findPipe,(i,a,o)=>{let l=!1,h=a;for(;--h>=0&&o[h]==="\\";)l=!l;return l?"|":" |"}),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 z(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 ut(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 pt(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 fe(n,e,t,s,r){let i=e.href,a=e.title||null,o=n[1].replace(r.other.outputLinkReplace,"$1");s.state.inLink=!0;let l={type:n[0].charAt(0)==="!"?"image":"link",raw:t,href:i,title:a,text:o,tokens:s.inlineTokens(o)};return s.state.inLink=!1,l}function dt(n,e,t){let s=n.match(t.other.indentCodeCompensation);if(s===null)return e;let r=s[1];return e.split(`
|
|
1
|
+
var Me=Object.defineProperty;var T=(n,e)=>()=>(n&&(e=n(n=0)),e);var he=(n,e)=>{for(var t in e)Me(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 Rt,ue,z=T(()=>{Rt=window.matchMedia("(prefers-reduced-motion: reduce)"),ue=new Map});var w,q=T(()=>{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))}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 W(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}function ye(n){E=n}function u(n,e=""){let t=typeof n=="string"?n:n.source,s={replace:(r,i)=>{let a=typeof i=="string"?i:i.source;return a=a.replace(b.caret,"$1"),t=t.replace(r,a),s},getRegex:()=>new RegExp(t,e)};return s}function y(n,e){if(e){if(b.escapeTest.test(n))return n.replace(b.escapeReplace,be)}else if(b.escapeTestNoEncode.test(n))return n.replace(b.escapeReplaceNoEncode,be);return n}function ke(n){try{n=encodeURI(n).replace(b.percentDecode,"%")}catch{return null}return n}function xe(n,e){let t=n.replace(b.findPipe,(i,a,o)=>{let l=!1,h=a;for(;--h>=0&&o[h]==="\\";)l=!l;return l?"|":" |"}),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 vt(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 At(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 we(n,e,t,s,r){let i=e.href,a=e.title||null,o=n[1].replace(r.other.outputLinkReplace,"$1");s.state.inLink=!0;let l={type:n[0].charAt(0)==="!"?"image":"link",raw:t,href:i,title:a,text:o,tokens:s.inlineTokens(o)};return s.state.inLink=!1,l}function St(n,e,t){let s=n.match(t.other.indentCodeCompensation);if(s===null)return e;let r=s[1];return e.split(`
|
|
3
2
|
`).map(i=>{let a=i.match(t.other.beginningSpace);if(a===null)return i;let[o]=a;return o.length>=r.length?i.slice(r.length):i}).join(`
|
|
4
|
-
`)}var
|
|
5
|
-
`)}}}
|
|
6
|
-
`)}}
|
|
3
|
+
`)}function f(n,e){return $.parse(n,e)}var E,S,De,b,He,Oe,Ze,_,Qe,X,ve,Ae,Ve,Y,je,J,Fe,Ue,O,ee,Ge,Se,Ke,te,ge,We,Xe,Ye,Je,$e,et,R,Z,re,tt,Ee,rt,st,nt,Re,it,at,Ce,lt,ot,ct,ht,ut,pt,dt,ft,gt,mt,M,bt,Te,ze,kt,me,se,xt,U,wt,N,I,yt,be,D,k,H,ne,x,P,$t,$,qt,It,Lt,Pt,_t,Bt,Nt,qe=T(()=>{E=W();S={exec:()=>null};De=(()=>{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)}}>`)},He=/^(?:[ \t]*(?:\n|$))+/,Oe=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ze=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,_=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Qe=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,X=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,ve=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Ae=u(ve).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(),Ve=u(ve).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(),Y=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,je=/^[^\n]+/,J=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Fe=u(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",J).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ue=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]*?(?:-->|$))/,Ge=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(),Se=u(Y).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(),Ke=u(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Se).getRegex(),te={blockquote:Ke,code:Oe,def:Fe,fences:Ze,heading:Qe,hr:_,html:Ge,lheading:Ae,list:Ue,newline:He,paragraph:Se,table:S,text:je},ge=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(),We={...te,lheading:Ve,table:ge,paragraph:u(Y).replace("hr",_).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ge).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()},Xe={...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(Y).replace("hr",_).replace("heading",` *#{1,6} *[^
|
|
4
|
+
]`).replace("lheading",Ae).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Ye=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Je=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,$e=/^( {2,}|\\)\n(?!\s*$)/,et=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,R=/[\p{P}\p{S}]/u,Z=/[\s\p{P}\p{S}]/u,re=/[^\s\p{P}\p{S}]/u,tt=u(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Z).getRegex(),Ee=/(?!~)[\p{P}\p{S}]/u,rt=/(?!~)[\s\p{P}\p{S}]/u,st=/(?:[^\s\p{P}\p{S}]|~)/u,nt=u(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",De?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Re=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,it=u(Re,"u").replace(/punct/g,R).getRegex(),at=u(Re,"u").replace(/punct/g,Ee).getRegex(),Ce="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",lt=u(Ce,"gu").replace(/notPunctSpace/g,re).replace(/punctSpace/g,Z).replace(/punct/g,R).getRegex(),ot=u(Ce,"gu").replace(/notPunctSpace/g,st).replace(/punctSpace/g,rt).replace(/punct/g,Ee).getRegex(),ct=u("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,re).replace(/punctSpace/g,Z).replace(/punct/g,R).getRegex(),ht=u(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,R).getRegex(),ut="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",pt=u(ut,"gu").replace(/notPunctSpace/g,re).replace(/punctSpace/g,Z).replace(/punct/g,R).getRegex(),dt=u(/\\(punct)/,"gu").replace(/punct/g,R).getRegex(),ft=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(),gt=u(ee).replace("(?:-->|$)","-->").getRegex(),mt=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",gt).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),M=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,bt=u(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",M).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Te=u(/^!?\[(label)\]\[(ref)\]/).replace("label",M).replace("ref",J).getRegex(),ze=u(/^!?\[(ref)\](?:\[\])?/).replace("ref",J).getRegex(),kt=u("reflink|nolink(?!\\()","g").replace("reflink",Te).replace("nolink",ze).getRegex(),me=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,se={_backpedal:S,anyPunctuation:dt,autolink:ft,blockSkip:nt,br:$e,code:Je,del:S,delLDelim:S,delRDelim:S,emStrongLDelim:it,emStrongRDelimAst:lt,emStrongRDelimUnd:ct,escape:Ye,link:bt,nolink:ze,punctuation:tt,reflink:Te,reflinkSearch:kt,tag:mt,text:et,url:S},xt={...se,link:u(/^!?\[(label)\]\((.*?)\)/).replace("label",M).getRegex(),reflink:u(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",M).getRegex()},U={...se,emStrongRDelimAst:ot,emStrongLDelim:at,delLDelim:ht,delRDelim:pt,url:u(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",me).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",me).getRegex()},wt={...U,br:u($e).replace("{2,}","*").getRegex(),text:u(U.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},N={normal:te,gfm:We,pedantic:Xe},I={normal:se,gfm:U,breaks:wt,pedantic:xt},yt={"&":"&","<":"<",">":">",'"':""","'":"'"},be=n=>yt[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=St(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
|
+
`)}}blockquote(n){let e=this.rules.block.blockquote.exec(n);if(e){let t=L(e[0],`
|
|
7
7
|
`).split(`
|
|
8
8
|
`),s="",r="",i=[];for(;t.length>0;){let a=!1,o=[],l;for(l=0;l<t.length;l++)if(this.rules.other.blockquoteStart.test(t[l]))o.push(t[l]),a=!0;else if(!a)o.push(t[l]);else break;t=t.slice(l);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 m=p,
|
|
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 m=p,g=m.raw+`
|
|
13
13
|
`+t.join(`
|
|
14
|
-
`),v=this.blockquote(
|
|
14
|
+
`),v=this.blockquote(g);i[i.length-1]=v,s=s.substring(0,s.length-m.raw.length)+v.raw,r=r.substring(0,r.length-m.text.length)+v.text;break}else if(p?.type==="list"){let m=p,g=m.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),a=!1;for(;n;){let l=!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=
|
|
16
|
+
`),v=this.list(g);i[i.length-1]=v,s=s.substring(0,s.length-p.raw.length)+v.raw,r=r.substring(0,r.length-m.raw.length)+v.raw,t=g.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),a=!1;for(;n;){let l=!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=At(e[2].split(`
|
|
18
18
|
`,1)[0],e[1].length),p=n.split(`
|
|
19
|
-
`,1)[0],m=!d.trim(),
|
|
20
|
-
`,n=n.substring(p.length+1),l=!0),!l){let v=this.rules.other.nextBulletRegex(
|
|
21
|
-
`,1)[0],C;if(p=
|
|
22
|
-
`+C.slice(
|
|
23
|
-
`+p}m=!p.trim(),h+=
|
|
24
|
-
`,n=n.substring(
|
|
25
|
-
`):[],i={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===s.length){for(let a of s)this.rules.other.tableAlignRight.test(a)?i.align.push("right"):this.rules.other.tableAlignCenter.test(a)?i.align.push("center"):this.rules.other.tableAlignLeft.test(a)?i.align.push("left"):i.align.push(null);for(let a=0;a<t.length;a++)i.header.push({text:t[a],tokens:this.lexer.inline(t[a]),header:!0,align:i.align[a]});for(let a of r)i.rows.push(
|
|
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=
|
|
19
|
+
`,1)[0],m=!d.trim(),g=0;if(this.options.pedantic?(g=2,c=d.trimStart()):m?g=e[1].length+1:(g=d.search(this.rules.other.nonSpaceChar),g=g>4?1:g,c=d.slice(g),g+=e[1].length),m&&this.rules.other.blankLine.test(p)&&(h+=p+`
|
|
20
|
+
`,n=n.substring(p.length+1),l=!0),!l){let v=this.rules.other.nextBulletRegex(g),le=this.rules.other.hrRegex(g),oe=this.rules.other.fencesBeginRegex(g),ce=this.rules.other.headingBeginRegex(g),Be=this.rules.other.htmlBeginRegex(g),Ne=this.rules.other.blockquoteBeginRegex(g);for(;n;){let j=n.split(`
|
|
21
|
+
`,1)[0],C;if(p=j,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),C=p):C=p.replace(this.rules.other.tabCharGlobal," "),oe.test(p)||ce.test(p)||Be.test(p)||Ne.test(p)||v.test(p)||le.test(p))break;if(C.search(this.rules.other.nonSpaceChar)>=g||!p.trim())c+=`
|
|
22
|
+
`+C.slice(g);else{if(m||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||oe.test(d)||ce.test(d)||le.test(d))break;c+=`
|
|
23
|
+
`+p}m=!p.trim(),h+=j+`
|
|
24
|
+
`,n=n.substring(j.length+1),d=C.slice(g)}}r.loose||(a?r.loose=!0:this.rules.other.doubleBlankLine.test(h)&&(a=!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 l of r.items){if(this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]),l.task){if(l.text=l.text.replace(this.rules.other.listReplaceTask,""),l.tokens[0]?.type==="text"||l.tokens[0]?.type==="paragraph"){l.tokens[0].raw=l.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),l.tokens[0].text=l.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(l.raw);if(h){let c={type:"checkbox",raw:h[0]+" ",checked:h[0]!=="[ ]"};l.checked=c.checked,r.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=c.raw+l.tokens[0].raw,l.tokens[0].text=c.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(c)):l.tokens.unshift({type:"paragraph",raw:c.raw,text:c.raw,tokens:[c]}):l.tokens.unshift(c)}}if(!r.loose){let h=l.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 l of r.items){l.loose=!0;for(let h of l.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=xe(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 a of s)this.rules.other.tableAlignRight.test(a)?i.align.push("right"):this.rules.other.tableAlignCenter.test(a)?i.align.push("center"):this.rules.other.tableAlignLeft.test(a)?i.align.push("left"):i.align.push(null);for(let a=0;a<t.length;a++)i.header.push({text:t[a],tokens:this.lexer.inline(t[a]),header:!0,align:i.align[a]});for(let a of r)i.rows.push(xe(a,i.header.length).map((o,l)=>({text:o,tokens:this.lexer.inline(o),header:!1,align:i.align[l]})));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=vt(e[2],"()");if(i===-2)return;if(i>-1){let a=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,a).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)),we(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 we(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,a,o=r,l=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(a=[...i].length,s[3]||s[4]){o+=a;continue}else if((s[5]||s[6])&&r%3&&!((r+a)%3)){l+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+l);let c=[...s[0]][0].length,d=n.slice(0,r+s.index+c+a);if(Math.min(r,a)%2){let m=d.slice(1,-1);return{type:"em",raw:d,text:m,tokens:this.lexer.inlineTokens(m)}}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,a,o=r,l=this.rules.inline.delRDelim;for(l.lastIndex=0,e=e.slice(-1*n.length+r);(s=l.exec(e))!==null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i||(a=[...i].length,a!==r))continue;if(s[3]||s[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let h=[...s[0]][0].length,c=n.slice(0,r+s.index+h+a),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 G{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 G(t).lex(e)}static lexInline(e,t){return new G(t).inlineTokens(e)}lex(e){e=e.replace(b.carriageReturn,`
|
|
27
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(a=>(r=a.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 a=t.at(-1);r.raw.length===1&&a!==void 0?a.raw+=`
|
|
28
28
|
`:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let a=t.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
|
|
29
29
|
`)?"":`
|
|
@@ -37,7 +37,7 @@ ${c}`:c;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
37
37
|
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.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 a=t.at(-1);a?.type==="text"?(a.raw+=(a.raw.endsWith(`
|
|
38
38
|
`)?"":`
|
|
39
39
|
`)+r.raw,a.text+=`
|
|
40
|
-
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r);continue}if(e){let a="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(a);break}else throw new Error(a)}}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 l=Object.keys(this.tokens.links);if(l.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(s))!==null;)l.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 a=!1,o="";for(;e;){a||(o=""),a=!1;let l;if(this.options.extensions?.inline?.some(c=>(l=c.call({lexer:this},e,t))?(e=e.substring(l.raw.length),t.push(l),!0):!1))continue;if(l=this.tokenizer.escape(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.tag(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.link(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(l.raw.length);let c=t.at(-1);l.type==="text"&&c?.type==="text"?(c.raw+=l.raw,c.text+=l.text):t.push(l);continue}if(l=this.tokenizer.emStrong(e,s,o)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.codespan(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.br(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.del(e,s,o)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.autolink(e)){e=e.substring(l.raw.length),t.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(e))){e=e.substring(l.raw.length),t.push(l);continue}let h=e;if(this.options.extensions?.startInline){let c=1/0,d=e.slice(1),p;this.options.extensions.startInline.forEach(m=>{p=m.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(l=this.tokenizer.inlineText(h)){e=e.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(o=l.raw.slice(-1)),a=!0;let c=t.at(-1);c?.type==="text"?(c.raw+=l.raw,c.text+=l.text):t.push(l);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}},
|
|
40
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r);continue}if(e){let a="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(a);break}else throw new Error(a)}}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 l=Object.keys(this.tokens.links);if(l.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(s))!==null;)l.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 a=!1,o="";for(;e;){a||(o=""),a=!1;let l;if(this.options.extensions?.inline?.some(c=>(l=c.call({lexer:this},e,t))?(e=e.substring(l.raw.length),t.push(l),!0):!1))continue;if(l=this.tokenizer.escape(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.tag(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.link(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(l.raw.length);let c=t.at(-1);l.type==="text"&&c?.type==="text"?(c.raw+=l.raw,c.text+=l.text):t.push(l);continue}if(l=this.tokenizer.emStrong(e,s,o)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.codespan(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.br(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.del(e,s,o)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.autolink(e)){e=e.substring(l.raw.length),t.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(e))){e=e.substring(l.raw.length),t.push(l);continue}let h=e;if(this.options.extensions?.startInline){let c=1/0,d=e.slice(1),p;this.options.extensions.startInline.forEach(m=>{p=m.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(l=this.tokenizer.inlineText(h)){e=e.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(o=l.raw.slice(-1)),a=!0;let c=t.at(-1);c?.type==="text"?(c.raw+=l.raw,c.text+=l.text):t.push(l);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>
|
|
@@ -55,6 +55,6 @@ ${this.parser.parse(n)}</blockquote>
|
|
|
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 gt;function g(n,e){return $.parse(n,e)}g.options=g.setOptions=function(n){return $.setOptions(n),g.defaults=$.defaults,me(g.defaults),g};g.getDefaults=j;g.defaults=E;g.use=function(...n){return $.use(...n),g.defaults=$.defaults,me(g.defaults),g};g.walkTokens=function(n,e){return $.walkTokens(n,e)};g.parseInline=$.parseInline;g.Parser=x;g.parser=x.parse;g.Renderer=N;g.TextRenderer=Y;g.Lexer=k;g.lexer=k.lex;g.Tokenizer=B;g.Hooks=q;g.parse=g;var xt=g.options,wt=g.setOptions,yt=g.use,vt=g.walkTokens,At=g.parseInline;var St=x.parse,$t=k.lex;var J=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=>g.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",J);var ee=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",ee);var te=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(){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.#g(),this.#f(),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.#g(),this.#f(),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)}#g(){this.#e.setFormValue(this.value)}#f(){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.#g(),this.#f(),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",te);var re=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=L(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=L(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",re);export{re 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=ke(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=ke(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 K{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 K(t).parse(e)}static parseInline(e,t){return new K(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 a=r,o=this.options.extensions.renderers[a.type].call({parser:this},a);if(o!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(a.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 a='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}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 a=i;switch(a.type){case"escape":{s+=t.text(a);break}case"html":{s+=t.html(a);break}case"link":{s+=t.link(a);break}case"image":{s+=t.image(a);break}case"checkbox":{s+=t.checkbox(a);break}case"strong":{s+=t.strong(a);break}case"em":{s+=t.em(a);break}case"codespan":{s+=t.codespan(a);break}case"br":{s+=t.br(a);break}case"del":{s+=t.del(a);break}case"text":{s+=t.text(a);break}default:{let o='Token with "'+a.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}},$t=class{defaults=W();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 a of i)t=t.concat(this.walkTokens(a.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 a=r[i].flat(1/0);t=t.concat(this.walkTokens(a,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(...a){let o=r.renderer.apply(this,a);return o===!1&&(o=i.apply(this,a)),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 a=i,o=t.renderer[a],l=r[a];r[a]=(...h)=>{let c=o.apply(r,h);return c===!1&&(c=l.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 a=i,o=t.tokenizer[a],l=r[a];r[a]=(...h)=>{let c=o.apply(r,h);return c===!1&&(c=l.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 a=i,o=t.hooks[a],l=r[a];P.passThroughHooks.has(i)?r[a]=h=>{if(this.defaults.async&&P.passThroughHooksRespectAsync.has(i))return(async()=>{let d=await o.call(r,h);return l.call(r,d)})();let c=o.call(r,h);return l.call(r,c)}:r[a]=(...h)=>{if(this.defaults.async)return(async()=>{let d=await o.apply(r,h);return d===!1&&(d=await l.apply(r,h)),d})();let c=o.apply(r,h);return c===!1&&(c=l.apply(r,h)),c}}s.hooks=r}if(t.walkTokens){let r=this.defaults.walkTokens,i=t.walkTokens;s.walkTokens=function(a){let o=[];return o.push(i.call(this,a)),r&&(o=o.concat(r.call(this,a))),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 a=r.hooks?await r.hooks.preprocess(e):e,o=await(r.hooks?await r.hooks.provideLexer(n):n?k.lex:k.lexInline)(a,r),l=r.hooks?await r.hooks.processAllTokens(o):o;r.walkTokens&&await Promise.all(this.walkTokens(l,r.walkTokens));let h=await(r.hooks?await r.hooks.provideParser(n):n?x.parse:x.parseInline)(l,r);return r.hooks?await r.hooks.postprocess(h):h})().catch(i);try{r.hooks&&(e=r.hooks.preprocess(e));let a=(r.hooks?r.hooks.provideLexer(n):n?k.lex:k.lexInline)(e,r);r.hooks&&(a=r.hooks.processAllTokens(a)),r.walkTokens&&this.walkTokens(a,r.walkTokens);let o=(r.hooks?r.hooks.provideParser(n):n?x.parse:x.parseInline)(a,r);return r.hooks&&(o=r.hooks.postprocess(o)),o}catch(a){return i(a)}}}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 $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};
|
|
60
60
|
//# sourceMappingURL=comment-thread.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var s=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,
|
|
1
|
+
var s=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,r){e.addEventListener(t,n,r),this.#e.push(()=>e.removeEventListener(t,n,r))}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 r=`--${e}`;t?n.add(r):n.delete(r)}}_adoptInternals(e){this.#t||(this.#t=e)}};var m=window.matchMedia("(prefers-reduced-motion: reduce)");var l=new Map;function u(i,e,t={}){let n=t.priority??10,r={impl:e,bundle:t.bundle,contract:t.contract,priority:n},o=l.get(i);if(customElements.get(i)){if(!o||o.priority>=n){o&&o.priority===n&&o.impl!==e&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${o.bundle}" (priority ${o.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${i}> defined by "${o.bundle}" cannot be replaced (customElements.define is permanent). "${t.bundle}" has higher priority but arrived late.`);return}if(o&&o.priority>=n){o.priority===n&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${o.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}l.set(i,r),customElements.define(i,e)}var c=class extends s{setup(){if(this.querySelector(":scope > button"))return;let e=document.createElement("button");e.type="button";let t=document.createElement("icon-wc");t.setAttribute("name","message-circle"),t.setAttribute("size","sm"),t.setAttribute("aria-hidden","true"),e.appendChild(t);let n=this.closest("selection-menu")?.getAttribute("for"),r=this.closest("review-surface")||(n?document.querySelector(`review-surface[for="${n}"]`):null);r?(e.setAttribute("aria-label","Add comment"),e.addEventListener("click",()=>this.#e(r))):(e.setAttribute("aria-label","Comments not available"),e.style.opacity="0.4",e.setAttribute("title","Wrap content in <review-surface> to enable comments")),this.appendChild(e)}#e(e){let t=this.closest("selection-menu");if(!t)return;let n=t.getSelection();if(!n)return;let r=n.range.getBoundingClientRect(),o=e.getBoundingClientRect(),a=(r.left+r.width/2-o.left)/o.width*100,d=(r.top-o.top)/o.height*100;typeof e.addPin=="function"&&e.addPin({x:a,y:d,text:n.text}),this.dispatchEvent(new CustomEvent("comment-wc:created",{detail:{text:n.text,x:a,y:d},bubbles:!0})),t.dismiss()}};u("comment-wc",c);
|
|
2
2
|
//# sourceMappingURL=comment-wc.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var p=window.matchMedia("(prefers-reduced-motion: reduce)");var u=new Map;function f(i,e,t={}){let n=t.priority??10,r={impl:e,bundle:t.bundle,contract:t.contract,priority:n},s=u.get(i);if(customElements.get(i)){if(!s||s.priority>=n){s&&s.priority===n&&s.impl!==e&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${i}> 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 <${i}> already registered by "${s.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}u.set(i,r),customElements.define(i,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,r){e.addEventListener(t,n,r),this.#e.push(()=>e.removeEventListener(t,n,r))}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 r=`--${e}`;t?n.add(r):n.delete(r)}}_adoptInternals(e){this.#t||(this.#t=e)}};var a=class extends c{#e=new Map;#t="";#n=null;setup(){if(this.#i(),this.#e.size===0)return!1;this.#o(),this.#c();let e=this.#l();return this.#s(e,!1),!0}#i(){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())!t.hasAttribute("data-lens-src")&&!t.hasAttribute("src")&&t.setAttribute("data-lens-src",e)}#c(){if(this.getAttribute("data-lens-controls")==="off")return;let e=document.createElement("nav");e.setAttribute("data-content-lens-controls",""),e.setAttribute("aria-label","Switch lens");let t=document.createElement("fieldset"),n=document.createElement("legend");n.textContent="View",t.append(n);let r=`content-lens-${Math.random().toString(36).slice(2,8)}`;for(let[s,h]of this.#e){let l=document.createElement("label"),o=document.createElement("input");o.type="radio",o.name=r,o.value=s,o.addEventListener("change",()=>{o.checked&&this.#s(s,!0)});let d=document.createElement("span");d.textContent=h.getAttribute("data-lens-label")||this.#a(s),l.append(o,d),t.append(l)}e.append(t),this.prepend(e),this.#n=e}#a(e){return e.replace(/-/g," ").replace(/\b\w/g,t=>t.toUpperCase())}#r(){return`vb:content-lens:${this.getAttribute("data-lens-storage")||(typeof location<"u"?location.pathname:"default")}`}#l(){let e=(()=>{try{return typeof sessionStorage<"u"?sessionStorage.getItem(this.#r()):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,t){if(this.#e.has(e)){for(let[n,r]of this.#e){let s=n===e;r.toggleAttribute("hidden",!s),r.setAttribute("aria-hidden",s?"false":"true")}if(this.#n){let n=this.#n.querySelector(`input[value="${e}"]`);n&&(n.checked=!0)}if(this.#t=e,this.setAttribute("data-active-lens",e),t)try{sessionStorage.setItem(this.#r(),e)}catch{}this.dispatchEvent(new CustomEvent("content-lens:change",{detail:{lens:e},bubbles:!0}))}}get activeLens(){return this.#t}setLens(e){this.#s(e,!0)}};f("content-lens",a);export{a as ContentLens};
|
|
1
|
+
var p=window.matchMedia("(prefers-reduced-motion: reduce)");var u=new Map;function f(i,e,t={}){let n=t.priority??10,r={impl:e,bundle:t.bundle,contract:t.contract,priority:n},s=u.get(i);if(customElements.get(i)){if(!s||s.priority>=n){s&&s.priority===n&&s.impl!==e&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${i}> 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 <${i}> already registered by "${s.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}u.set(i,r),customElements.define(i,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,r){e.addEventListener(t,n,r),this.#e.push(()=>e.removeEventListener(t,n,r))}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 r=`--${e}`;t?n.add(r):n.delete(r)}}_adoptInternals(e){this.#t||(this.#t=e)}};var a=class extends c{#e=new Map;#t="";#n=null;setup(){if(this.#i(),this.#e.size===0)return!1;this.#o(),this.#c();let e=this.#l();return this.#s(e,!1),!0}#i(){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())!t.hasAttribute("data-lens-src")&&!t.hasAttribute("src")&&t.setAttribute("data-lens-src",e)}#c(){if(this.getAttribute("data-lens-controls")==="off"||this.#n?.parentNode===this)return;let e=document.createElement("nav");e.setAttribute("data-content-lens-controls",""),e.setAttribute("aria-label","Switch lens");let t=document.createElement("fieldset"),n=document.createElement("legend");n.textContent="View",t.append(n);let r=`content-lens-${Math.random().toString(36).slice(2,8)}`;for(let[s,h]of this.#e){let l=document.createElement("label"),o=document.createElement("input");o.type="radio",o.name=r,o.value=s,o.addEventListener("change",()=>{o.checked&&this.#s(s,!0)});let d=document.createElement("span");d.textContent=h.getAttribute("data-lens-label")||this.#a(s),l.append(o,d),t.append(l)}e.append(t),this.prepend(e),this.#n=e}#a(e){return e.replace(/-/g," ").replace(/\b\w/g,t=>t.toUpperCase())}#r(){return`vb:content-lens:${this.getAttribute("data-lens-storage")||(typeof location<"u"?location.pathname:"default")}`}#l(){let e=(()=>{try{return typeof sessionStorage<"u"?sessionStorage.getItem(this.#r()):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,t){if(this.#e.has(e)){for(let[n,r]of this.#e){let s=n===e;r.toggleAttribute("hidden",!s),r.setAttribute("aria-hidden",s?"false":"true")}if(this.#n){let n=this.#n.querySelector(`input[value="${e}"]`);n&&(n.checked=!0)}if(this.#t=e,this.setAttribute("data-active-lens",e),t)try{sessionStorage.setItem(this.#r(),e)}catch{}this.dispatchEvent(new CustomEvent("content-lens:change",{detail:{lens:e},bubbles:!0}))}}get activeLens(){return this.#t}setLens(e){this.#s(e,!0)}};f("content-lens",a);export{a as ContentLens};
|
|
2
2
|
//# sourceMappingURL=content-lens.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var u=/Mac|iPhone|iPad|iPod/.test(navigator.platform??""),m={mac:{meta:"\u2318",cmd:"\u2318",alt:"\u2325",shift:"\u21E7",ctrl:"\u2303"},other:{meta:"Ctrl",cmd:"Ctrl",alt:"Alt",shift:"Shift",ctrl:"Ctrl"}};function b(n){let t=u?m.mac:m.other;return n.split("+").map(s=>{let e=s.trim().toLowerCase();return t[e]??e.toUpperCase()}).join(u?"":"+")}function y(n){let t=n.toLowerCase().split("+").map(e=>e.trim());return{key:t.pop()??"",meta:t.includes("meta")||t.includes("cmd"),ctrl:t.includes("ctrl"),shift:t.includes("shift"),alt:t.includes("alt")}}function g(n,t){if(n.key.toLowerCase()!==t.key)return!1;let s,e;return u?(s=t.meta,e=t.ctrl):(s=!1,e=t.meta||t.ctrl),!(s!==n.metaKey||e!==n.ctrlKey||t.shift!==n.shiftKey||t.alt!==n.altKey)}var x=new Set(["INPUT","TEXTAREA","SELECT"]),h=[],w=!1;function k(n){let t=x.has(n.target.tagName)||n.target.isContentEditable;for(let s of h)if(!(t&&!s.global)&&g(n,s.descriptor)){n.preventDefault(),s.callback(n);return}}function C(){w||(document.addEventListener("keydown",k),w=!0)}function E(n,t,s={}){C();let e=y(n),i={combo:n,descriptor:e,callback:t,global:s.global===!0};return h.find(r=>r.combo===n)&&console.warn(`[hotkey-bind] Shortcut "${n}" already bound. Last-connected-wins.`),h.unshift(i),function(){let a=h.indexOf(i);a!==-1&&h.splice(a,1)}}var L=window.matchMedia("(prefers-reduced-motion: reduce)");var v=new Map;function l(n,t,s={}){let e=s.priority??10,i={impl:t,bundle:s.bundle,contract:s.contract,priority:e},o=v.get(n);if(customElements.get(n)){if(!o||o.priority>=e){o&&o.priority===e&&o.impl!==t&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${o.bundle}" (priority ${o.priority}). Skipping "${s.bundle}".`);return}console.warn(`[VB Bundle] Tag <${n}> defined by "${o.bundle}" cannot be replaced (customElements.define is permanent). "${s.bundle}" has higher priority but arrived late.`);return}if(o&&o.priority>=e){o.priority===e&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${o.bundle}". Skipping "${s.bundle}" (first wins at equal priority).`);return}v.set(n,i),customElements.define(n,t)}var c=class extends HTMLElement{#s=[];#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 t of this.#s)t();this.#s=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,s,e,i){t.addEventListener(s,e,i),this.#s.push(()=>t.removeEventListener(s,e,i))}setup(){}teardown(){}setState(t,s){this.#t||(this.#t=this.attachInternals());let e=this.#t.states;try{s?e.add(t):e.delete(t)}catch{let i=`--${t}`;s?e.add(i):e.delete(i)}}_adoptInternals(t){this.#t||(this.#t=t)}};var d=CSS.supports("anchor-name","--x"),S=CSS.supports("position-area","bottom"),$=0,p=class extends c{#s=null;#t=null;#e=null;#i=null;setup(){this.id||(this.id=`pop-over-${++$}`);let t=this.dataset.mode||"auto";this.hasAttribute("popover")||this.setAttribute("popover",t),this.#o(),this.#n(),this.#e=s=>{let e=s.newState==="open"?"show":"hide";this.dispatchEvent(new CustomEvent(`pop-over:${e}`,{detail:{state:s.newState},bubbles:!0,composed:!0})),!d&&s.newState==="open"&&this.#s&&this.#c()},this.listen(this,"beforetoggle",this.#e),d||(this.#i=()=>{this.matches(":popover-open")&&this.#s&&this.#c()},this.listen(window,"resize",this.#i),this.listen(window,"scroll",this.#i,{capture:!0,passive:!0}))}show(){this.matches(":popover-open")||this.showPopover()}hide(){this.matches(":popover-open")&&this.hidePopover()}toggle(){this.matches(":popover-open")?this.hide():this.show()}get open(){return this.matches(":popover-open")}#o(){let t=this.dataset.anchor;t?this.#s=document.getElementById(t)||document.querySelector(t):this.#s=document.querySelector(`[popovertarget="${CSS.escape(this.id)}"]`)}#n(){if(!(!this.#s||!d)&&(this.#t=`--pop-over-anchor-${this.id}`,this.#s.style.setProperty("anchor-name",this.#t),this.style.setProperty("position-anchor",this.#t),this.setAttribute("data-anchor-name",this.#t||""),!S)){let t=this.dataset.position||"bottom";this.#r(t)}}#r(t){let s="var(--_pop-over-offset, var(--size-xs))",e={top:{bottom:`calc(anchor(top) + ${s})`,left:"anchor(left)"},bottom:{top:`calc(anchor(bottom) + ${s})`,left:"anchor(left)"},left:{right:`calc(anchor(left) + ${s})`,top:"anchor(top)"},right:{left:`calc(anchor(right) + ${s})`,top:"anchor(top)"}},i=t.split("-")[0],o=e[i]||e.bottom;Object.entries(o).forEach(([r,a])=>this.style.setProperty(r,a))}#c(){if(!this.#s)return;let t=this.#s.getBoundingClientRect(),s=this.dataset.position||"bottom",e=this.#h(),i,o;switch(s.split("-")[0]){case"top":i=t.top-this.offsetHeight-e,o=t.left;break;case"left":i=t.top,o=t.left-this.offsetWidth-e;break;case"right":i=t.top,o=t.right+e;break;default:i=t.bottom+e,o=t.left;break}s.endsWith("-end")&&(s.startsWith("top")||s.startsWith("bottom")?o=t.right-this.offsetWidth:i=t.bottom-this.offsetHeight),this.style.position="fixed",this.style.top=`${Math.round(i)}px`,this.style.left=`${Math.round(o)}px`,this.style.margin="0"}#h(){let t={none:0,xs:4,s:8,m:16,l:24};return t[this.dataset.offset]??t.xs}};l("pop-over",p);var A=0,f=class extends c{#s;#t;#e;#i=[];#o=-1;#n=!1;#r=[];setup(){let t=this.querySelector(":scope > [data-trigger]"),s=this.querySelector('menu, ul[role="menu"]');if(!t||!s)return!1;this.#s=t,this.#t=s;let e=this.querySelector(":scope > pop-over[data-context-menu-host]");return e?this.#e=e:(this.#e=document.createElement("pop-over"),this.#e.setAttribute("data-context-menu-host",""),this.#e.id=`ctx-menu-${++A}`,this.#e.dataset.mode="auto",this.#e.appendChild(this.#t),this.appendChild(this.#e)),this.#t.parentElement!==this.#e&&this.#e.appendChild(this.#t),this.#s?.setAttribute("aria-expanded","false"),this.#t.setAttribute("role","menu"),this.#t.id||(this.#t.id=`ctx-menu-list-${++A}`),this.#t.querySelectorAll(":scope > li[data-group]").forEach(i=>{i.setAttribute("role","presentation"),i.classList.add("ctx-group-label")}),this.#i=Array.from(this.#t.querySelectorAll('button, a, [role="menuitem"]')).filter(i=>!i.disabled&&!i.hasAttribute("data-disabled")),this.#i.forEach(i=>{i.setAttribute("role","menuitem"),i.setAttribute("tabindex","-1"),i.style.cssText+=";border:none;box-shadow:none;transform:none;border-radius:0;",this.listen(i,"click",this.#u);let o=i.getAttribute("data-shortcut");if(o){let r=document.createElement("kbd");r.className="ctx-kbd",r.textContent=b(o),i.appendChild(r);let a=E(o,()=>i.click());this.#r.push(a)}}),this.#t.querySelectorAll('li:empty:not([data-group]), [role="separator"], hr').forEach(i=>{i.setAttribute("role","separator")}),this.listen(this.#s,"contextmenu",this.#c),this.listen(this.#t,"keydown",this.#l),this.listen(window,"scroll",this.#p,{capture:!0}),this.listen(this.#e,"pop-over:hide",this.#d),!0}teardown(){this.#r.forEach(t=>t()),this.#r=[]}get items(){if(!this.#t)return[];let t=[];for(let s of this.#t.querySelectorAll(":scope > li")){if(s.hasAttribute("data-group")){t.push({group:s.textContent.trim()});continue}if(s.matches(':empty, [role="separator"]')||s.querySelector("hr")){t.push({separator:!0});continue}let e=s.querySelector('button, a, [role="menuitem"]');e&&t.push({label:e.textContent.trim().replace(/\s+/g," "),value:e.getAttribute("data-value")||void 0,href:e.tagName==="A"?e.getAttribute("href"):void 0,shortcut:e.getAttribute("data-shortcut")||void 0,disabled:e.disabled||e.hasAttribute("data-disabled")||void 0})}return t}set items(t){let s=Array.isArray(t)?t:[],e=this.querySelector('menu, ul[role="menu"]');for(e||(e=document.createElement("menu"),this.appendChild(e));e.firstChild;)e.firstChild.remove();for(let i of s){let o=document.createElement("li");if(i.separator)o.setAttribute("role","separator");else if(i.group!=null)o.setAttribute("data-group",""),o.textContent=i.group;else{let r=i.href?document.createElement("a"):document.createElement("button");i.href&&r.setAttribute("href",i.href),i.value&&r.setAttribute("data-value",i.value),i.shortcut&&r.setAttribute("data-shortcut",i.shortcut),i.disabled&&(r.tagName==="BUTTON"?r.disabled=!0:r.setAttribute("data-disabled","")),r.textContent=i.label||"",o.appendChild(r)}e.appendChild(o)}this.teardown(),this.removeAttribute("data-upgraded"),this.setup(),this.dispatchEvent(new CustomEvent("context-menu:items-changed",{detail:{items:s,source:"property"},bubbles:!0}))}#c=t=>{t.preventDefault(),this.#h(t.clientX,t.clientY)};#h(t,s){this.#n=!0,this.setAttribute("data-open",""),this.#s?.setAttribute("aria-expanded","true"),this.#e.style.top=`${s}px`,this.#e.style.left=`${t}px`,this.#e.show(),requestAnimationFrame(()=>{let e=this.#e.getBoundingClientRect(),i=t+e.width>window.innerWidth?t-e.width:t,o=s+e.height>window.innerHeight?s-e.height:s;this.#e.style.top=`${Math.max(0,o)}px`,this.#e.style.left=`${Math.max(0,i)}px`}),this.#o=-1,this.#a(0),this.dispatchEvent(new CustomEvent("context-menu:open",{bubbles:!0}))}close(){this.#n&&(this.#n=!1,this.removeAttribute("data-open"),this.#s?.setAttribute("aria-expanded","false"),this.#o=-1,this.#e?.hide(),this.dispatchEvent(new CustomEvent("context-menu:close",{bubbles:!0})))}#l=t=>{switch(t.key){case"ArrowDown":case"Down":t.preventDefault(),this.#a(this.#o+1);break;case"ArrowUp":case"Up":t.preventDefault(),this.#a(this.#o-1);break;case"Home":t.preventDefault(),this.#a(0);break;case"End":t.preventDefault(),this.#a(this.#i.length-1);break;case"Enter":case" ":t.preventDefault(),this.#o>=0&&this.#i[this.#o].click();break;case"Tab":this.close();break}};#u=()=>{this.close(),this.dispatchEvent(new CustomEvent("context-menu:select",{bubbles:!0,detail:{item:this.#i[this.#o]}}))};#d=()=>{this.#n&&(this.#n=!1,this.removeAttribute("data-open"),this.#s?.setAttribute("aria-expanded","false"),this.#o=-1,this.dispatchEvent(new CustomEvent("context-menu:close",{bubbles:!0})))};#p=()=>{this.#n&&this.close()};#a(t){this.#i.length!==0&&(t<0&&(t=this.#i.length-1),t>=this.#i.length&&(t=0),this.#o=t,this.#i[t].focus())}get isOpen(){return this.#n}};l("context-menu",f);export{f as ContextMenuWc};
|
|
1
|
+
var u=/Mac|iPhone|iPad|iPod/.test(navigator.platform??""),m={mac:{meta:"\u2318",cmd:"\u2318",alt:"\u2325",shift:"\u21E7",ctrl:"\u2303"},other:{meta:"Ctrl",cmd:"Ctrl",alt:"Alt",shift:"Shift",ctrl:"Ctrl"}};function b(n){let t=u?m.mac:m.other;return n.split("+").map(s=>{let e=s.trim().toLowerCase();return t[e]??e.toUpperCase()}).join(u?"":"+")}function y(n){let t=n.toLowerCase().split("+").map(e=>e.trim());return{key:t.pop()??"",meta:t.includes("meta")||t.includes("cmd"),ctrl:t.includes("ctrl"),shift:t.includes("shift"),alt:t.includes("alt")}}function g(n,t){if(n.key.toLowerCase()!==t.key)return!1;let s,e;return u?(s=t.meta,e=t.ctrl):(s=!1,e=t.meta||t.ctrl),!(s!==n.metaKey||e!==n.ctrlKey||t.shift!==n.shiftKey||t.alt!==n.altKey)}var k=new Set(["INPUT","TEXTAREA","SELECT"]),h=[],w=!1;function x(n){let t=k.has(n.target.tagName)||n.target.isContentEditable;for(let s of h)if(!(t&&!s.global)&&g(n,s.descriptor)){n.preventDefault(),s.callback(n);return}}function C(){w||(document.addEventListener("keydown",x),w=!0)}function E(n,t,s={}){C();let e=y(n),i={combo:n,descriptor:e,callback:t,global:s.global===!0};return h.find(r=>r.combo===n)&&console.warn(`[hotkey-bind] Shortcut "${n}" already bound. Last-connected-wins.`),h.unshift(i),function(){let a=h.indexOf(i);a!==-1&&h.splice(a,1)}}var L=window.matchMedia("(prefers-reduced-motion: reduce)");var v=new Map;function l(n,t,s={}){let e=s.priority??10,i={impl:t,bundle:s.bundle,contract:s.contract,priority:e},o=v.get(n);if(customElements.get(n)){if(!o||o.priority>=e){o&&o.priority===e&&o.impl!==t&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${o.bundle}" (priority ${o.priority}). Skipping "${s.bundle}".`);return}console.warn(`[VB Bundle] Tag <${n}> defined by "${o.bundle}" cannot be replaced (customElements.define is permanent). "${s.bundle}" has higher priority but arrived late.`);return}if(o&&o.priority>=e){o.priority===e&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${o.bundle}". Skipping "${s.bundle}" (first wins at equal priority).`);return}v.set(n,i),customElements.define(n,t)}var c=class extends HTMLElement{#s=[];#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 t of this.#s)t();this.#s=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,s,e,i){t.addEventListener(s,e,i),this.#s.push(()=>t.removeEventListener(s,e,i))}setup(){}teardown(){}setState(t,s){this.#t||(this.#t=this.attachInternals());let e=this.#t.states;try{s?e.add(t):e.delete(t)}catch{let i=`--${t}`;s?e.add(i):e.delete(i)}}_adoptInternals(t){this.#t||(this.#t=t)}};var d=CSS.supports("anchor-name","--x"),S=CSS.supports("position-area","bottom"),$=0,p=class extends c{#s=null;#t=null;#e=null;#i=null;setup(){this.id||(this.id=`pop-over-${++$}`);let t=this.dataset.mode||"auto";this.hasAttribute("popover")||this.setAttribute("popover",t),this.#o(),this.#n(),this.#e=s=>{let e=s.newState==="open"?"show":"hide";this.dispatchEvent(new CustomEvent(`pop-over:${e}`,{detail:{state:s.newState},bubbles:!0,composed:!0})),!d&&s.newState==="open"&&this.#s&&this.#c()},this.listen(this,"beforetoggle",this.#e),d||(this.#i=()=>{this.matches(":popover-open")&&this.#s&&this.#c()},this.listen(window,"resize",this.#i),this.listen(window,"scroll",this.#i,{capture:!0,passive:!0}))}show(){this.matches(":popover-open")||this.showPopover()}hide(){this.matches(":popover-open")&&this.hidePopover()}toggle(){this.matches(":popover-open")?this.hide():this.show()}get open(){return this.matches(":popover-open")}#o(){let t=this.dataset.anchor;t?this.#s=document.getElementById(t)||document.querySelector(t):this.#s=document.querySelector(`[popovertarget="${CSS.escape(this.id)}"]`)}#n(){if(!(!this.#s||!d)&&(this.#t=`--pop-over-anchor-${this.id}`,this.#s.style.setProperty("anchor-name",this.#t),this.style.setProperty("position-anchor",this.#t),this.setAttribute("data-anchor-name",this.#t||""),!S)){let t=this.dataset.position||"bottom";this.#r(t)}}#r(t){let s="var(--_pop-over-offset, var(--size-xs))",e={top:{bottom:`calc(anchor(top) + ${s})`,left:"anchor(left)"},bottom:{top:`calc(anchor(bottom) + ${s})`,left:"anchor(left)"},left:{right:`calc(anchor(left) + ${s})`,top:"anchor(top)"},right:{left:`calc(anchor(right) + ${s})`,top:"anchor(top)"}},i=t.split("-")[0],o=e[i]||e.bottom;Object.entries(o).forEach(([r,a])=>this.style.setProperty(r,a))}#c(){if(!this.#s)return;let t=this.#s.getBoundingClientRect(),s=this.dataset.position||"bottom",e=this.#h(),i,o;switch(s.split("-")[0]){case"top":i=t.top-this.offsetHeight-e,o=t.left;break;case"left":i=t.top,o=t.left-this.offsetWidth-e;break;case"right":i=t.top,o=t.right+e;break;default:i=t.bottom+e,o=t.left;break}s.endsWith("-end")&&(s.startsWith("top")||s.startsWith("bottom")?o=t.right-this.offsetWidth:i=t.bottom-this.offsetHeight),this.style.position="fixed",this.style.top=`${Math.round(i)}px`,this.style.left=`${Math.round(o)}px`,this.style.margin="0"}#h(){let t={none:0,xs:4,s:8,m:16,l:24};return t[this.dataset.offset]??t.xs}};l("pop-over",p);var A=0,f=class extends c{#s;#t;#e;#i=[];#o=-1;#n=!1;#r=[];setup(){let t=this.querySelector(":scope > [data-trigger]"),s=this.querySelector('menu, ul[role="menu"]');if(!t||!s)return!1;this.#s=t,this.#t=s;let e=this.querySelector(":scope > pop-over[data-context-menu-host]");return e?this.#e=e:(this.#e=document.createElement("pop-over"),this.#e.setAttribute("data-context-menu-host",""),this.#e.id=`ctx-menu-${++A}`,this.#e.dataset.mode="auto",this.#e.appendChild(this.#t),this.appendChild(this.#e)),this.#t.parentElement!==this.#e&&this.#e.appendChild(this.#t),this.#s?.setAttribute("aria-expanded","false"),this.#t.setAttribute("role","menu"),this.#t.id||(this.#t.id=`ctx-menu-list-${++A}`),this.#t.querySelectorAll(":scope > li[data-group]").forEach(i=>{i.setAttribute("role","presentation"),i.classList.add("ctx-group-label")}),this.#i=Array.from(this.#t.querySelectorAll('button, a, [role="menuitem"]')).filter(i=>!i.disabled&&!i.hasAttribute("data-disabled")),this.#i.forEach(i=>{i.setAttribute("role","menuitem"),i.setAttribute("tabindex","-1"),this.listen(i,"click",this.#u);let o=i.getAttribute("data-shortcut");if(o){let r=document.createElement("kbd");r.className="ctx-kbd",r.textContent=b(o),i.appendChild(r);let a=E(o,()=>i.click());this.#r.push(a)}}),this.#t.querySelectorAll('li:empty:not([data-group]), [role="separator"], hr').forEach(i=>{i.setAttribute("role","separator")}),this.listen(this.#s,"contextmenu",this.#c),this.listen(this.#t,"keydown",this.#l),this.listen(window,"scroll",this.#p,{capture:!0}),this.listen(this.#e,"pop-over:hide",this.#d),!0}teardown(){this.#r.forEach(t=>t()),this.#r=[]}get items(){if(!this.#t)return[];let t=[];for(let s of this.#t.querySelectorAll(":scope > li")){if(s.hasAttribute("data-group")){t.push({group:s.textContent.trim()});continue}if(s.matches(':empty, [role="separator"]')||s.querySelector("hr")){t.push({separator:!0});continue}let e=s.querySelector('button, a, [role="menuitem"]');e&&t.push({label:e.textContent.trim().replace(/\s+/g," "),value:e.getAttribute("data-value")||void 0,href:e.tagName==="A"?e.getAttribute("href"):void 0,shortcut:e.getAttribute("data-shortcut")||void 0,disabled:e.disabled||e.hasAttribute("data-disabled")||void 0})}return t}set items(t){let s=Array.isArray(t)?t:[],e=this.querySelector('menu, ul[role="menu"]');for(e||(e=document.createElement("menu"),this.appendChild(e));e.firstChild;)e.firstChild.remove();for(let i of s){let o=document.createElement("li");if(i.separator)o.setAttribute("role","separator");else if(i.group!=null)o.setAttribute("data-group",""),o.textContent=i.group;else{let r=i.href?document.createElement("a"):document.createElement("button");i.href&&r.setAttribute("href",i.href),i.value&&r.setAttribute("data-value",i.value),i.shortcut&&r.setAttribute("data-shortcut",i.shortcut),i.disabled&&(r.tagName==="BUTTON"?r.disabled=!0:r.setAttribute("data-disabled","")),r.textContent=i.label||"",o.appendChild(r)}e.appendChild(o)}this.teardown(),this.removeAttribute("data-upgraded"),this.setup(),this.dispatchEvent(new CustomEvent("context-menu:items-changed",{detail:{items:s,source:"property"},bubbles:!0}))}#c=t=>{t.preventDefault(),t.buttons!==0?this.listen(window,"pointerup",()=>{setTimeout(()=>this.#h(t.clientX,t.clientY),0)},{once:!0,capture:!0}):this.#h(t.clientX,t.clientY)};#h(t,s){this.#n=!0,this.setAttribute("data-open",""),this.#s?.setAttribute("aria-expanded","true"),this.#e.style.top=`${s}px`,this.#e.style.left=`${t}px`,this.#e.show(),requestAnimationFrame(()=>{let e=this.#e.getBoundingClientRect(),i=t+e.width>window.innerWidth?t-e.width:t,o=s+e.height>window.innerHeight?s-e.height:s;this.#e.style.top=`${Math.max(0,o)}px`,this.#e.style.left=`${Math.max(0,i)}px`}),this.#o=-1,this.#a(0),this.dispatchEvent(new CustomEvent("context-menu:open",{bubbles:!0}))}close(){this.#n&&(this.#n=!1,this.removeAttribute("data-open"),this.#s?.setAttribute("aria-expanded","false"),this.#o=-1,this.#e?.hide(),this.dispatchEvent(new CustomEvent("context-menu:close",{bubbles:!0})))}#l=t=>{switch(t.key){case"ArrowDown":case"Down":t.preventDefault(),this.#a(this.#o+1);break;case"ArrowUp":case"Up":t.preventDefault(),this.#a(this.#o-1);break;case"Home":t.preventDefault(),this.#a(0);break;case"End":t.preventDefault(),this.#a(this.#i.length-1);break;case"Enter":case" ":t.preventDefault(),this.#o>=0&&this.#i[this.#o].click();break;case"Tab":this.close();break}};#u=()=>{this.close(),this.dispatchEvent(new CustomEvent("context-menu:select",{bubbles:!0,detail:{item:this.#i[this.#o]}}))};#d=()=>{this.#n&&(this.#n=!1,this.removeAttribute("data-open"),this.#s?.setAttribute("aria-expanded","false"),this.#o=-1,this.dispatchEvent(new CustomEvent("context-menu:close",{bubbles:!0})))};#p=()=>{this.#n&&this.close()};#a(t){this.#i.length!==0&&(t<0&&(t=this.#i.length-1),t>=this.#i.length&&(t=0),this.#o=t,this.#i[t].focus())}get isOpen(){return this.#n}};l("context-menu",f);export{f as ContextMenuWc};
|
|
2
2
|
//# sourceMappingURL=context-menu.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var B=window.matchMedia("(prefers-reduced-motion: reduce)");var w=new Map;function C(i,t,e={}){let o=e.priority??10,s={impl:t,bundle:e.bundle,contract:e.contract,priority:o},r=w.get(i);if(customElements.get(i)){if(!r||r.priority>=o){r&&r.priority===o&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${i}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=o){r.priority===o&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${r.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}w.set(i,s),customElements.define(i,t)}var g=class extends HTMLElement{#c=[];#r;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.#c)t();this.#c=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,o,s){t.addEventListener(e,o,s),this.#c.push(()=>t.removeEventListener(e,o,s))}setup(){}teardown(){}setState(t,e){this.#r||(this.#r=this.attachInternals());let o=this.#r.states;try{e?o.add(t):o.delete(t)}catch{let s=`--${t}`;e?o.add(s):o.delete(s)}}_adoptInternals(t){this.#r||(this.#r=t)}};function n(i,t,e){return i.getPropertyValue(t).trim()||e}function d(i,t){if(!t)return t;let e=document.createElement("span");e.style.color=t,e.style.position="absolute",e.style.visibility="hidden",e.style.pointerEvents="none",(i.parentElement||document.body).appendChild(e);let o=getComputedStyle(e).color;if(e.remove(),!o)return t;let s=d,r=s._canvas||(s._canvas=document.createElement("canvas"));r.width=r.height=1;let l=s._ctx||(s._ctx=r.getContext("2d",{willReadFrequently:!0}));l.clearRect(0,0,1,1),l.fillStyle=o,l.fillRect(0,0,1,1);let[a,u,f,m]=l.getImageData(0,0,1,1).data;return m===255?`rgb(${a},${u},${f})`:`rgba(${a},${u},${f},${(m/255).toFixed(3)})`}function S(i){let t=getComputedStyle(i),e=d(i,n(t,"--color-text","#1a1a1a")),o=d(i,n(t,"--color-surface","#ffffff")),s=d(i,n(t,"--color-surface-raised",n(t,"--color-surface","#ffffff"))),r=d(i,n(t,"--color-border","#e0e0e0")),l=d(i,n(t,"--color-primary",n(t,"--color-interactive","#3b82f6"))),a=d(i,n(t,"--color-secondary",n(t,"--color-surface-raised","#f8f9fa"))),u=d(i,n(t,"--color-accent",n(t,"--color-primary","#3b82f6"))),f=d(i,n(t,"--color-text-muted",n(t,"--color-text","#1a1a1a"))),m=n(t,"--font-sans",'system-ui, -apple-system, "Segoe UI", sans-serif'),x=n(t,"--font-size-
|
|
1
|
+
var B=window.matchMedia("(prefers-reduced-motion: reduce)");var w=new Map;function C(i,t,e={}){let o=e.priority??10,s={impl:t,bundle:e.bundle,contract:e.contract,priority:o},r=w.get(i);if(customElements.get(i)){if(!r||r.priority>=o){r&&r.priority===o&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${i}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=o){r.priority===o&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${r.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}w.set(i,s),customElements.define(i,t)}var g=class extends HTMLElement{#c=[];#r;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.#c)t();this.#c=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,o,s){t.addEventListener(e,o,s),this.#c.push(()=>t.removeEventListener(e,o,s))}setup(){}teardown(){}setState(t,e){this.#r||(this.#r=this.attachInternals());let o=this.#r.states;try{e?o.add(t):o.delete(t)}catch{let s=`--${t}`;e?o.add(s):o.delete(s)}}_adoptInternals(t){this.#r||(this.#r=t)}};function n(i,t,e){return i.getPropertyValue(t).trim()||e}function d(i,t){if(!t)return t;let e=document.createElement("span");e.style.color=t,e.style.position="absolute",e.style.visibility="hidden",e.style.pointerEvents="none",(i.parentElement||document.body).appendChild(e);let o=getComputedStyle(e).color;if(e.remove(),!o)return t;let s=d,r=s._canvas||(s._canvas=document.createElement("canvas"));r.width=r.height=1;let l=s._ctx||(s._ctx=r.getContext("2d",{willReadFrequently:!0}));l.clearRect(0,0,1,1),l.fillStyle=o,l.fillRect(0,0,1,1);let[a,u,f,m]=l.getImageData(0,0,1,1).data;return m===255?`rgb(${a},${u},${f})`:`rgba(${a},${u},${f},${(m/255).toFixed(3)})`}function S(i){let t=getComputedStyle(i),e=d(i,n(t,"--color-text","#1a1a1a")),o=d(i,n(t,"--color-surface","#ffffff")),s=d(i,n(t,"--color-surface-raised",n(t,"--color-surface","#ffffff"))),r=d(i,n(t,"--color-border","#e0e0e0")),l=d(i,n(t,"--color-primary",n(t,"--color-interactive","#3b82f6"))),a=d(i,n(t,"--color-secondary",n(t,"--color-surface-raised","#f8f9fa"))),u=d(i,n(t,"--color-accent",n(t,"--color-primary","#3b82f6"))),f=d(i,n(t,"--color-text-muted",n(t,"--color-text","#1a1a1a"))),m=n(t,"--font-sans",'system-ui, -apple-system, "Segoe UI", sans-serif'),x=n(t,"--font-size-m","14px"),p=[l,u,a],h={};for(let c=0;c<12;c++)h[`cScale${c}`]=p[c%p.length],h[`cScaleLabel${c}`]=e,h[`cScalePeer${c}`]=r,h[`cScaleInv${c}`]=o;let b={};for(let c=0;c<8;c++)b[`git${c}`]=p[c%p.length],b[`gitInv${c}`]=o,b[`gitBranchLabel${c}`]=e;return{primaryColor:l,primaryBorderColor:r,primaryTextColor:e,nodeTextColor:e,secondaryColor:a,secondaryBorderColor:r,secondaryTextColor:e,tertiaryColor:u,tertiaryBorderColor:r,tertiaryTextColor:e,background:o,mainBkg:o,secondBkg:s,tertiaryBkg:s,lineColor:r,nodeBorder:r,gridColor:r,defaultLinkColor:f,clusterBkg:s,clusterBorder:r,actorBkg:o,actorBorder:r,actorTextColor:e,actorLineColor:r,signalColor:e,signalTextColor:e,labelBoxBkgColor:s,labelBoxBorderColor:r,labelTextColor:e,loopTextColor:e,noteBkgColor:s,noteBorderColor:r,noteTextColor:e,edgeLabelBackground:o,titleColor:e,fontFamily:m,fontSize:x,...h,...b}}function v(i,t={}){return{startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,theme:t.themeBase||"base",themeVariables:S(i)}}var $="https://cdn.jsdelivr.net/npm/mermaid@11.14.0/dist/mermaid.esm.min.mjs",E=new Map;function T(i){let t=i||typeof window<"u"&&window.VB_MERMAID_URL||$,e=E.get(t);return e||(e=import(t).then(o=>o.default||o),E.set(t,e)),e}var y=class i extends g{static#c=0;static#r=0;#t=null;#i=null;#e=null;#o=null;#s=null;#n=!1;setup(){this.hasAttribute("type")||this.setAttribute("type","mermaid");let t=this.getAttribute("min-height");t&&(this.style.minBlockSize=t);let e=this.querySelector(":scope > pre");e&&(this.#i=document.createElement("template"),this.#i.appendChild(e.cloneNode(!0)),this.#t=this.#h(e),this.setAttribute("data-rendering",""));let o=this.querySelector(":scope > .dwc-figure");o&&(this.#e=o,this.#n=!0,this.removeAttribute("data-rendering")),this.listen(window,"vb:theme-change",()=>{this.#s&&clearTimeout(this.#s),this.#s=setTimeout(()=>{this.#n&&this.#a()},50)});let s=this.getAttribute("src");s?this.#f(s).then(()=>this.#d()):this.#t&&this.#d()}teardown(){if(this.#o&&(this.#o.disconnect(),this.#o=null),this.#s&&(clearTimeout(this.#s),this.#s=null),this.#e&&(this.#e.remove(),this.#e=null),this.#i){let t=this.#i.content.firstElementChild;t&&!this.querySelector(":scope > pre")&&this.appendChild(t.cloneNode(!0))}this.#n=!1}#d(){if(this.getAttribute("loading")!=="lazy"){this.#a();return}if(!("IntersectionObserver"in window)){this.#a();return}this.#o=new IntersectionObserver(t=>{for(let e of t)if(e.isIntersecting){this.#o?.disconnect(),this.#o=null,this.#a();break}},{rootMargin:"200px"}),this.#o.observe(this)}async#a(){if(!this.#t)return;let t=this.getAttribute("type")||"mermaid";if(t!=="mermaid"){this.#l(new Error(`Unsupported diagram type "${t}". v1 supports "mermaid" only.`));return}try{let e=await T(this.dataset.mermaidSrc),o=v(this,{themeBase:this.dataset.themeBase||"base"});e.initialize(o);let s=`diagram-wc-${++i.#c}`,{svg:r}=await e.render(s,this.#t);this.#u(r),this.#n=!0,this.removeAttribute("data-rendering"),this.removeAttribute("data-error"),this.querySelector(":scope > .dwc-error")?.remove(),this.dispatchEvent(new CustomEvent("diagram-wc:ready",{bubbles:!0,detail:{svg:r,type:t,source:this.#t}}))}catch(e){this.removeAttribute("data-rendering"),this.#n||this.setAttribute("data-error",""),this.#l(e)}}#u(t){let e=document.createElement("figure");e.className="dwc-figure",e.setAttribute("role","img");let o=this.getAttribute("caption")||`${this.getAttribute("type")||"diagram"} diagram`;e.setAttribute("aria-label",o),e.innerHTML=t;let s=this.getAttribute("caption");if(s){let a=document.createElement("figcaption");a.className="dwc-caption",a.textContent=s,e.appendChild(a)}let r=this.#e,l=()=>{r&&r.isConnected?r.replaceWith(e):this.appendChild(e),this.querySelector(":scope > pre")?.remove(),this.#e=e};if(r?.isConnected&&"startViewTransition"in document&&!matchMedia("(prefers-reduced-motion: reduce)").matches){let a=`dwc-vt-${++i.#r}`;r.style.viewTransitionName=a,e.style.viewTransitionName=a,document.startViewTransition(l).finished.finally(()=>{e.style.viewTransitionName=""})}else l()}#l(t){if(!this.#n){if(!this.querySelector(":scope > pre")&&this.#i){let s=this.#i.content.firstElementChild;s&&this.appendChild(s.cloneNode(!0))}this.#e&&(this.#e.remove(),this.#e=null)}this.querySelector(":scope > .dwc-error")?.remove();let e=document.createElement("p");e.className="dwc-error",e.setAttribute("role","status");let o=(t.message||String(t)).split(`
|
|
2
2
|
`)[0].slice(0,240);e.textContent=`Diagram syntax error: ${o}`,this.appendChild(e),this.dispatchEvent(new CustomEvent("diagram-wc:error",{bubbles:!0,detail:{error:t,source:this.#t,type:this.getAttribute("type")}}))}#h(t){let e=t.querySelector("code");return(e?e.textContent:t.textContent)||""}async#f(t){try{let e=await fetch(t);if(!e.ok)throw new Error(`HTTP ${e.status}`);this.#t=await e.text()}catch(e){this.#l(e)}}get source(){return this.#t||""}set source(t){let e=String(t||"");e!==this.#t&&(this.#t=e,this.#e&&(this.#e.remove(),this.#e=null),this.querySelector(":scope > .dwc-error")?.remove(),this.dispatchEvent(new CustomEvent("diagram-wc:source-changed",{bubbles:!0,detail:{source:e}})),this.#a())}get svg(){return this.#e?.querySelector("svg")?.outerHTML||""}};C("diagram-wc",y);export{y as DiagramWc};
|
|
3
3
|
//# sourceMappingURL=diagram-wc.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var a=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,s,e,i){t.addEventListener(s,e,i),this.#t.push(()=>t.removeEventListener(s,e,i))}setup(){}teardown(){}setState(t,s){this.#e||(this.#e=this.attachInternals());let e=this.#e.states;try{s?e.add(t):e.delete(t)}catch{let i=`--${t}`;s?e.add(i):e.delete(i)}}_adoptInternals(t){this.#e||(this.#e=t)}};var v=window.matchMedia("(prefers-reduced-motion: reduce)");var p=new Map;function h(r,t,s={}){let e=s.priority??10,i={impl:t,bundle:s.bundle,contract:s.contract,priority:e},o=p.get(r);if(customElements.get(r)){if(!o||o.priority>=e){o&&o.priority===e&&o.impl!==t&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${o.bundle}" (priority ${o.priority}). Skipping "${s.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${o.bundle}" cannot be replaced (customElements.define is permanent). "${s.bundle}" has higher priority but arrived late.`);return}if(o&&o.priority>=e){o.priority===e&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${o.bundle}". Skipping "${s.bundle}" (first wins at equal priority).`);return}p.set(r,i),customElements.define(r,t)}var l=CSS.supports("anchor-name","--x"),m=CSS.supports("position-area","bottom"),b=0,c=class extends a{#t=null;#e=null;#s=null;#i=null;setup(){this.id||(this.id=`pop-over-${++b}`);let t=this.dataset.mode||"auto";this.hasAttribute("popover")||this.setAttribute("popover",t),this.#n(),this.#r(),this.#s=s=>{let e=s.newState==="open"?"show":"hide";this.dispatchEvent(new CustomEvent(`pop-over:${e}`,{detail:{state:s.newState},bubbles:!0,composed:!0})),!l&&s.newState==="open"&&this.#t&&this.#o()},this.listen(this,"beforetoggle",this.#s),l||(this.#i=()=>{this.matches(":popover-open")&&this.#t&&this.#o()},this.listen(window,"resize",this.#i),this.listen(window,"scroll",this.#i,{capture:!0,passive:!0}))}show(){this.matches(":popover-open")||this.showPopover()}hide(){this.matches(":popover-open")&&this.hidePopover()}toggle(){this.matches(":popover-open")?this.hide():this.show()}get open(){return this.matches(":popover-open")}#n(){let t=this.dataset.anchor;t?this.#t=document.getElementById(t)||document.querySelector(t):this.#t=document.querySelector(`[popovertarget="${CSS.escape(this.id)}"]`)}#r(){if(!(!this.#t||!l)&&(this.#e=`--pop-over-anchor-${this.id}`,this.#t.style.setProperty("anchor-name",this.#e),this.style.setProperty("position-anchor",this.#e),this.setAttribute("data-anchor-name",this.#e||""),!m)){let t=this.dataset.position||"bottom";this.#a(t)}}#a(t){let s="var(--_pop-over-offset, var(--size-xs))",e={top:{bottom:`calc(anchor(top) + ${s})`,left:"anchor(left)"},bottom:{top:`calc(anchor(bottom) + ${s})`,left:"anchor(left)"},left:{right:`calc(anchor(left) + ${s})`,top:"anchor(top)"},right:{left:`calc(anchor(right) + ${s})`,top:"anchor(top)"}},i=t.split("-")[0],o=e[i]||e.bottom;Object.entries(o).forEach(([n,f])=>this.style.setProperty(n,f))}#o(){if(!this.#t)return;let t=this.#t.getBoundingClientRect(),s=this.dataset.position||"bottom",e=this.#l(),i,o;switch(s.split("-")[0]){case"top":i=t.top-this.offsetHeight-e,o=t.left;break;case"left":i=t.top,o=t.left-this.offsetWidth-e;break;case"right":i=t.top,o=t.right+e;break;default:i=t.bottom+e,o=t.left;break}s.endsWith("-end")&&(s.startsWith("top")||s.startsWith("bottom")?o=t.right-this.offsetWidth:i=t.bottom-this.offsetHeight),this.style.position="fixed",this.style.top=`${Math.round(i)}px`,this.style.left=`${Math.round(o)}px`,this.style.margin="0"}#l(){let t={none:0,xs:4,s:8,m:16,l:24};return t[this.dataset.offset]??t.xs}};h("pop-over",c);var d=0,u=class extends a{#t;#e;#s;#i=[];#n=-1;#r=!1;#a=!1;#o=null;setup(){let t=this.querySelector(":scope > [data-trigger]")||this.querySelector(":scope > button");if(!t)return!1;this.#t=t;let s=this.querySelector('menu, ul[role="menu"]');if(!s)return!1;this.#e=s,this.#a=this.hasAttribute("hover"),this.#t.id||(this.#t.id=`dropdown-trigger-${++d}`);let e=this.querySelector(":scope > pop-over[data-dropdown-host]");return e?this.#s=e:(this.#s=document.createElement("pop-over"),this.#s.setAttribute("data-dropdown-host",""),this.#s.id=`dropdown-${++d}`,this.#s.dataset.mode=this.#a?"manual":"auto",this.#s.dataset.position=this.getAttribute("position")||"bottom-start",this.#s.dataset.anchor=this.#t.id,this.#s.appendChild(this.#e),this.appendChild(this.#s)),this.#s.dataset.mode=this.#a?"manual":"auto",this.#s.dataset.position=this.getAttribute("position")||"bottom-start",this.#s.dataset.anchor=this.#t.id,this.#e.parentElement!==this.#s&&this.#s.appendChild(this.#e),this.#t.setAttribute("aria-haspopup","menu"),this.#t.setAttribute("aria-expanded","false"),this.#e.id||(this.#e.id=`dropdown-menu-${++d}`),this.#t.setAttribute("aria-controls",this.#e.id),this.#e.setAttribute("role","menu"),this.#l(),this.#a?(this.listen(this,"mouseenter",this.#d),this.listen(this,"mouseleave",this.#u),this.listen(this.#t,"focus",this.#p),this.listen(this.#t,"blur",this.#f)):this.listen(this.#t,"click",this.#c),this.listen(this.#t,"keydown",this.#m),this.listen(this.#e,"keydown",this.#b),this.listen(this.#s,"pop-over:hide",this.#w),this.listen(this.#s,"pop-over:show",this.#y),this.#a&&this.listen(document,"keydown",this.#g),!0}teardown(){this.#o&&clearTimeout(this.#o)}get items(){if(!this.#e)return[];let t=[];for(let s of this.#e.querySelectorAll(":scope > li")){if(s.matches('[role="separator"]')||s.querySelector("hr")){t.push({separator:!0});continue}let e=s.querySelector('button, a, [role="menuitem"]');e&&t.push({label:e.textContent.trim().replace(/\s+/g," "),value:e.getAttribute("data-value")||void 0,href:e.tagName==="A"?e.getAttribute("href"):void 0,disabled:e.disabled||e.hasAttribute("data-disabled")||void 0})}return t}set items(t){let s=Array.isArray(t)?t:[],e=this.querySelector('menu, ul[role="menu"]');for(e||(e=document.createElement("menu"),this.appendChild(e));e.firstChild;)e.firstChild.remove();for(let i of s){let o=document.createElement("li");if(i.separator)o.setAttribute("role","separator");else{let n=i.href?document.createElement("a"):document.createElement("button");i.href&&n.setAttribute("href",i.href),i.value&&n.setAttribute("data-value",i.value),i.disabled&&(n.tagName==="BUTTON"?n.disabled=!0:n.setAttribute("data-disabled","")),n.textContent=i.label||"",o.appendChild(n)}e.appendChild(o)}this.teardown(),this.removeAttribute("data-upgraded"),this.setup(),this.dispatchEvent(new CustomEvent("drop-down:items-changed",{detail:{items:s,source:"property"},bubbles:!0}))}#l(){this.#i=Array.from(this.#e.querySelectorAll('button, a, [role="menuitem"]')).filter(t=>!t.disabled&&!t.closest('[role="separator"]')),this.#i.forEach(t=>{t.setAttribute("role","menuitem"),t.setAttribute("tabindex","-1"),t.
|
|
1
|
+
var a=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,s,e,i){t.addEventListener(s,e,i),this.#t.push(()=>t.removeEventListener(s,e,i))}setup(){}teardown(){}setState(t,s){this.#e||(this.#e=this.attachInternals());let e=this.#e.states;try{s?e.add(t):e.delete(t)}catch{let i=`--${t}`;s?e.add(i):e.delete(i)}}_adoptInternals(t){this.#e||(this.#e=t)}};var v=window.matchMedia("(prefers-reduced-motion: reduce)");var p=new Map;function h(r,t,s={}){let e=s.priority??10,i={impl:t,bundle:s.bundle,contract:s.contract,priority:e},o=p.get(r);if(customElements.get(r)){if(!o||o.priority>=e){o&&o.priority===e&&o.impl!==t&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${o.bundle}" (priority ${o.priority}). Skipping "${s.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${o.bundle}" cannot be replaced (customElements.define is permanent). "${s.bundle}" has higher priority but arrived late.`);return}if(o&&o.priority>=e){o.priority===e&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${o.bundle}". Skipping "${s.bundle}" (first wins at equal priority).`);return}p.set(r,i),customElements.define(r,t)}var l=CSS.supports("anchor-name","--x"),m=CSS.supports("position-area","bottom"),b=0,c=class extends a{#t=null;#e=null;#s=null;#i=null;setup(){this.id||(this.id=`pop-over-${++b}`);let t=this.dataset.mode||"auto";this.hasAttribute("popover")||this.setAttribute("popover",t),this.#n(),this.#r(),this.#s=s=>{let e=s.newState==="open"?"show":"hide";this.dispatchEvent(new CustomEvent(`pop-over:${e}`,{detail:{state:s.newState},bubbles:!0,composed:!0})),!l&&s.newState==="open"&&this.#t&&this.#o()},this.listen(this,"beforetoggle",this.#s),l||(this.#i=()=>{this.matches(":popover-open")&&this.#t&&this.#o()},this.listen(window,"resize",this.#i),this.listen(window,"scroll",this.#i,{capture:!0,passive:!0}))}show(){this.matches(":popover-open")||this.showPopover()}hide(){this.matches(":popover-open")&&this.hidePopover()}toggle(){this.matches(":popover-open")?this.hide():this.show()}get open(){return this.matches(":popover-open")}#n(){let t=this.dataset.anchor;t?this.#t=document.getElementById(t)||document.querySelector(t):this.#t=document.querySelector(`[popovertarget="${CSS.escape(this.id)}"]`)}#r(){if(!(!this.#t||!l)&&(this.#e=`--pop-over-anchor-${this.id}`,this.#t.style.setProperty("anchor-name",this.#e),this.style.setProperty("position-anchor",this.#e),this.setAttribute("data-anchor-name",this.#e||""),!m)){let t=this.dataset.position||"bottom";this.#a(t)}}#a(t){let s="var(--_pop-over-offset, var(--size-xs))",e={top:{bottom:`calc(anchor(top) + ${s})`,left:"anchor(left)"},bottom:{top:`calc(anchor(bottom) + ${s})`,left:"anchor(left)"},left:{right:`calc(anchor(left) + ${s})`,top:"anchor(top)"},right:{left:`calc(anchor(right) + ${s})`,top:"anchor(top)"}},i=t.split("-")[0],o=e[i]||e.bottom;Object.entries(o).forEach(([n,f])=>this.style.setProperty(n,f))}#o(){if(!this.#t)return;let t=this.#t.getBoundingClientRect(),s=this.dataset.position||"bottom",e=this.#l(),i,o;switch(s.split("-")[0]){case"top":i=t.top-this.offsetHeight-e,o=t.left;break;case"left":i=t.top,o=t.left-this.offsetWidth-e;break;case"right":i=t.top,o=t.right+e;break;default:i=t.bottom+e,o=t.left;break}s.endsWith("-end")&&(s.startsWith("top")||s.startsWith("bottom")?o=t.right-this.offsetWidth:i=t.bottom-this.offsetHeight),this.style.position="fixed",this.style.top=`${Math.round(i)}px`,this.style.left=`${Math.round(o)}px`,this.style.margin="0"}#l(){let t={none:0,xs:4,s:8,m:16,l:24};return t[this.dataset.offset]??t.xs}};h("pop-over",c);var d=0,u=class extends a{#t;#e;#s;#i=[];#n=-1;#r=!1;#a=!1;#o=null;setup(){let t=this.querySelector(":scope > [data-trigger]")||this.querySelector(":scope > button");if(!t)return!1;this.#t=t;let s=this.querySelector('menu, ul[role="menu"]');if(!s)return!1;this.#e=s,this.#a=this.hasAttribute("hover"),this.#t.id||(this.#t.id=`dropdown-trigger-${++d}`);let e=this.querySelector(":scope > pop-over[data-dropdown-host]");return e?this.#s=e:(this.#s=document.createElement("pop-over"),this.#s.setAttribute("data-dropdown-host",""),this.#s.id=`dropdown-${++d}`,this.#s.dataset.mode=this.#a?"manual":"auto",this.#s.dataset.position=this.getAttribute("position")||"bottom-start",this.#s.dataset.anchor=this.#t.id,this.#s.appendChild(this.#e),this.appendChild(this.#s)),this.#s.dataset.mode=this.#a?"manual":"auto",this.#s.dataset.position=this.getAttribute("position")||"bottom-start",this.#s.dataset.anchor=this.#t.id,this.#e.parentElement!==this.#s&&this.#s.appendChild(this.#e),this.#t.setAttribute("aria-haspopup","menu"),this.#t.setAttribute("aria-expanded","false"),this.#e.id||(this.#e.id=`dropdown-menu-${++d}`),this.#t.setAttribute("aria-controls",this.#e.id),this.#e.setAttribute("role","menu"),this.#l(),this.#a?(this.listen(this,"mouseenter",this.#d),this.listen(this,"mouseleave",this.#u),this.listen(this.#t,"focus",this.#p),this.listen(this.#t,"blur",this.#f)):this.listen(this.#t,"click",this.#c),this.listen(this.#t,"keydown",this.#m),this.listen(this.#e,"keydown",this.#b),this.listen(this.#s,"pop-over:hide",this.#w),this.listen(this.#s,"pop-over:show",this.#y),this.#a&&this.listen(document,"keydown",this.#g),!0}teardown(){this.#o&&clearTimeout(this.#o)}get items(){if(!this.#e)return[];let t=[];for(let s of this.#e.querySelectorAll(":scope > li")){if(s.matches('[role="separator"]')||s.querySelector("hr")){t.push({separator:!0});continue}let e=s.querySelector('button, a, [role="menuitem"]');e&&t.push({label:e.textContent.trim().replace(/\s+/g," "),value:e.getAttribute("data-value")||void 0,href:e.tagName==="A"?e.getAttribute("href"):void 0,disabled:e.disabled||e.hasAttribute("data-disabled")||void 0})}return t}set items(t){let s=Array.isArray(t)?t:[],e=this.querySelector('menu, ul[role="menu"]');for(e||(e=document.createElement("menu"),this.appendChild(e));e.firstChild;)e.firstChild.remove();for(let i of s){let o=document.createElement("li");if(i.separator)o.setAttribute("role","separator");else{let n=i.href?document.createElement("a"):document.createElement("button");i.href&&n.setAttribute("href",i.href),i.value&&n.setAttribute("data-value",i.value),i.disabled&&(n.tagName==="BUTTON"?n.disabled=!0:n.setAttribute("data-disabled","")),n.textContent=i.label||"",o.appendChild(n)}e.appendChild(o)}this.teardown(),this.removeAttribute("data-upgraded"),this.setup(),this.dispatchEvent(new CustomEvent("drop-down:items-changed",{detail:{items:s,source:"property"},bubbles:!0}))}#l(){this.#i=Array.from(this.#e.querySelectorAll('button, a, [role="menuitem"]')).filter(t=>!t.disabled&&!t.closest('[role="separator"]')),this.#i.forEach(t=>{t.setAttribute("role","menuitem"),t.setAttribute("tabindex","-1"),t.addEventListener("click",this.#v)}),this.#e.querySelectorAll('li:empty, [role="separator"], hr').forEach(t=>{t.setAttribute("role","separator")})}#c=t=>{t.stopPropagation(),this.toggle()};#d=()=>{this.#o&&(clearTimeout(this.#o),this.#o=null,this.setState("hover-grace-pending",!1)),this.open()};#u=()=>{this.setState("hover-grace-pending",!0),this.#o=setTimeout(()=>{this.setState("hover-grace-pending",!1),this.close()},100)};#p=()=>{this.#o&&(clearTimeout(this.#o),this.#o=null,this.setState("hover-grace-pending",!1)),this.open()};#f=t=>{this.#e?.contains(t.relatedTarget)||(this.setState("hover-grace-pending",!0),this.#o=setTimeout(()=>{this.setState("hover-grace-pending",!1),this.contains(document.activeElement)||this.close()},100))};#m=t=>{switch(t.key){case"ArrowDown":case"Down":t.preventDefault(),this.open(),this.#h(0);break;case"ArrowUp":case"Up":t.preventDefault(),this.open(),this.#h(this.#i.length-1);break}};#b=t=>{switch(t.key){case"ArrowDown":case"Down":t.preventDefault(),this.#h(this.#n+1);break;case"ArrowUp":case"Up":t.preventDefault(),this.#h(this.#n-1);break;case"Home":t.preventDefault(),this.#h(0);break;case"End":t.preventDefault(),this.#h(this.#i.length-1);break;case"Tab":this.close();break;case"Enter":case" ":t.preventDefault(),this.#n>=0&&this.#i[this.#n].click();break}};#g=t=>{t.key==="Escape"&&this.#r&&(t.preventDefault(),this.close(),this.#t?.focus())};#v=t=>{t.defaultPrevented||(this.close(),this.#t?.focus())};#y=()=>{this.#r||(this.#r=!0,this.setAttribute("open",""),this.#t?.setAttribute("aria-expanded","true"),this.#n=-1,this.dispatchEvent(new CustomEvent("drop-down:open",{bubbles:!0})))};#w=()=>{this.#r&&(this.#r=!1,this.removeAttribute("open"),this.#t?.setAttribute("aria-expanded","false"),this.#n=-1,this.dispatchEvent(new CustomEvent("drop-down:close",{bubbles:!0})))};#h(t){this.#i.length!==0&&(t<0&&(t=this.#i.length-1),t>=this.#i.length&&(t=0),this.#n=t,this.#i[t].focus())}open(){this.#r||!this.#s||this.#s.show()}close(){!this.#r||!this.#s||this.#s.hide()}toggle(){this.#r?this.close():this.open()}get isOpen(){return this.#r}};h("drop-down",u);export{u as DropDown};
|
|
2
2
|
//# sourceMappingURL=drop-down.js.map
|