vanilla-breeze 0.6.2 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +6768 -6425
- package/dist/cdn/components/accordion-wc.js +1 -1
- package/dist/cdn/components/activity-feed.js +1 -1
- package/dist/cdn/components/ai-chat.js +6 -6
- package/dist/cdn/components/ai-summary.js +2 -2
- package/dist/cdn/components/analytics-panel.js +2 -2
- package/dist/cdn/components/audio-player.js +4 -4
- package/dist/cdn/components/audio-visualizer.js +2 -2
- package/dist/cdn/components/author-index.js +2 -2
- package/dist/cdn/components/brand-mark.js +1 -1
- package/dist/cdn/components/bread-crumb.js +1 -1
- package/dist/cdn/components/calendar-wc.js +2 -2
- package/dist/cdn/components/card-list.js +1 -1
- package/dist/cdn/components/carousel-wc.js +1 -1
- package/dist/cdn/components/change-set.js +1 -1
- package/dist/cdn/components/chart-wc.js +13 -13
- package/dist/cdn/components/chat-input.js +1 -1
- package/dist/cdn/components/chat-window.js +1 -1
- package/dist/cdn/components/color-picker.js +1 -1
- package/dist/cdn/components/combo-box.js +1 -1
- package/dist/cdn/components/command-palette.js +1 -1
- package/dist/cdn/components/comment-box.js +35 -35
- package/dist/cdn/components/comment-thread.js +38 -38
- package/dist/cdn/components/comment-wc.js +1 -1
- package/dist/cdn/components/compare-surface.js +1 -1
- package/dist/cdn/components/consent-banner.js +1 -1
- package/dist/cdn/components/content-lens.js +1 -1
- package/dist/cdn/components/content-swap.js +1 -1
- package/dist/cdn/components/context-menu.js +1 -1
- package/dist/cdn/components/data-table.js +1 -1
- package/dist/cdn/components/date-picker.js +1 -1
- package/dist/cdn/components/day-view.js +1 -1
- package/dist/cdn/components/diagram-wc.js +2 -2
- package/dist/cdn/components/drag-surface.js +1 -1
- package/dist/cdn/components/drop-down.js +1 -1
- package/dist/cdn/components/emoji-picker.js +1 -1
- package/dist/cdn/components/flow-diagram.js +1 -1
- package/dist/cdn/components/foot-notes.js +1 -1
- package/dist/cdn/components/form-field.js +1 -1
- package/dist/cdn/components/geo-map.js +3 -3
- package/dist/cdn/components/glossary-index.js +1 -1
- package/dist/cdn/components/glossary-wc.js +1 -1
- package/dist/cdn/components/heading-links.js +1 -1
- package/dist/cdn/components/highlight-wc.js +2 -2
- package/dist/cdn/components/icon-wc.js +2 -2
- package/dist/cdn/components/image-gallery.js +1 -1
- package/dist/cdn/components/image-map.js +1 -1
- package/dist/cdn/components/include-file.js +1 -1
- package/dist/cdn/components/manifest.json +58 -54
- package/dist/cdn/components/markdown-editor.js +25 -25
- package/dist/cdn/components/markdown-viewer.js +27 -27
- package/dist/cdn/components/nav-bar.js +1 -1
- package/dist/cdn/components/note-wc.js +2 -2
- package/dist/cdn/components/notification-wc.js +23 -23
- package/dist/cdn/components/page-info.js +6 -6
- package/dist/cdn/components/page-stats.js +1 -1
- package/dist/cdn/components/page-toc.js +1 -1
- package/dist/cdn/components/page-tools.js +1 -1
- package/dist/cdn/components/page-tour.js +1 -1
- package/dist/cdn/components/pager-wc.js +1 -1
- package/dist/cdn/components/poll-wc.js +1 -1
- package/dist/cdn/components/pop-over.js +1 -1
- package/dist/cdn/components/popularity-index.js +1 -1
- package/dist/cdn/components/print-page.js +1 -1
- package/dist/cdn/components/progress-tracker.js +1 -1
- package/dist/cdn/components/qr-code.js +1 -1
- package/dist/cdn/components/reaction-bar.js +1 -1
- package/dist/cdn/components/reading-progress.js +1 -1
- package/dist/cdn/components/recently-visited.js +1 -1
- package/dist/cdn/components/score-card.js +2 -2
- package/dist/cdn/components/selection-menu.js +1 -1
- package/dist/cdn/components/settings-panel.js +6 -6
- package/dist/cdn/components/share-wc.js +2 -2
- package/dist/cdn/components/short-cuts.js +1 -1
- package/dist/cdn/components/site-index.js +1 -1
- package/dist/cdn/components/site-map.js +1 -1
- package/dist/cdn/components/site-search.js +1 -1
- package/dist/cdn/components/slide-accept.js +1 -1
- package/dist/cdn/components/social-embed.js +1 -1
- package/dist/cdn/components/social-links.js +2 -0
- package/dist/cdn/components/split-surface.js +1 -1
- package/dist/cdn/components/star-rating.js +1 -1
- package/dist/cdn/components/status-wc.js +1 -1
- package/dist/cdn/components/stepper-wc.js +1 -1
- package/dist/cdn/components/tab-set.js +1 -1
- package/dist/cdn/components/text-reader.js +2 -2
- package/dist/cdn/components/theme-picker.js +20 -20
- package/dist/cdn/components/time-index.js +1 -1
- package/dist/cdn/components/time-picker.js +1 -1
- package/dist/cdn/components/toast-msg.js +2 -2
- package/dist/cdn/components/tool-tip.js +1 -1
- package/dist/cdn/components/topic-map.js +4 -4
- package/dist/cdn/components/trust-filter.js +1 -1
- package/dist/cdn/components/version-switcher.js +6 -6
- package/dist/cdn/components/video-player.js +4 -4
- package/dist/cdn/components/watch-wc.js +2 -2
- package/dist/cdn/components/week-view.js +1 -1
- package/dist/cdn/components/youtube-player.js +1 -1
- package/dist/cdn/fonts/barlow-condensed-latin-400-italic.woff2 +0 -0
- package/dist/cdn/fonts/barlow-condensed-latin-700-italic.woff2 +0 -0
- package/dist/cdn/fonts/barlow-condensed-latin-ext-400-italic.woff2 +0 -0
- package/dist/cdn/fonts/barlow-condensed-latin-ext-700-italic.woff2 +0 -0
- package/dist/cdn/fonts/dm-sans-latin-ext-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/dm-sans-latin-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/dm-serif-display-latin-400-italic.woff2 +0 -0
- package/dist/cdn/fonts/dm-serif-display-latin-ext-400-italic.woff2 +0 -0
- package/dist/cdn/fonts/exo-2-latin-ext-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/exo-2-latin-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/inter-latin-ext-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/inter-latin-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/jetbrains-mono-latin-ext-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/jetbrains-mono-latin-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/josefin-sans-latin-ext-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/josefin-sans-latin-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/lora-latin-ext-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/lora-latin-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/merriweather-latin-ext-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/merriweather-latin-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/nunito-latin-ext-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/nunito-latin-wght-italic.woff2 +0 -0
- package/dist/cdn/packs/effects.full.js +1 -1
- package/dist/cdn/packs/kawaii/fonts/nunito-latin-ext-wght-italic.woff2 +0 -0
- package/dist/cdn/packs/kawaii/fonts/nunito-latin-wght-italic.woff2 +0 -0
- package/dist/cdn/packs/kawaii.full.css +1 -1
- package/dist/cdn/packs/kawaii.theme.css +1 -1
- package/dist/cdn/packs/manifest.json +4 -4
- package/dist/cdn/packs/prototype.full.js +1 -1
- package/dist/cdn/packs/ui.full.js +19 -19
- package/dist/cdn/themes/8bit.tokens.json +8 -37
- package/dist/cdn/themes/alpha1999-dark.tokens.json +1 -1
- package/dist/cdn/themes/alpha1999.css +1 -1
- package/dist/cdn/themes/alpha1999.tokens.json +3 -6
- package/dist/cdn/themes/art-deco-dark.tokens.json +3 -27
- package/dist/cdn/themes/art-deco.css +1 -1
- package/dist/cdn/themes/art-deco.tokens.json +5 -11
- 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 +13 -7
- package/dist/cdn/themes/brutalist-dark.tokens.json +3 -27
- package/dist/cdn/themes/brutalist.tokens.json +5 -11
- package/dist/cdn/themes/catppuccin-frappe.css +1 -1
- package/dist/cdn/themes/catppuccin-frappe.tokens.json +1 -1
- package/dist/cdn/themes/catppuccin-latte-dark.tokens.json +1 -1
- package/dist/cdn/themes/catppuccin-latte.css +1 -1
- package/dist/cdn/themes/catppuccin-latte.tokens.json +1 -1
- package/dist/cdn/themes/catppuccin-macchiato.css +1 -1
- package/dist/cdn/themes/catppuccin-macchiato.tokens.json +1 -1
- package/dist/cdn/themes/catppuccin-mocha.css +1 -1
- package/dist/cdn/themes/catppuccin-mocha.tokens.json +1 -1
- package/dist/cdn/themes/classic-dark.tokens.json +41 -41
- package/dist/cdn/themes/classic.tokens.json +25 -31
- package/dist/cdn/themes/claymorphism-dark.tokens.json +533 -161
- package/dist/cdn/themes/claymorphism.css +1 -1
- package/dist/cdn/themes/claymorphism.tokens.json +531 -135
- package/dist/cdn/themes/clinical-dark.tokens.json +1 -1
- package/dist/cdn/themes/clinical.tokens.json +1 -1
- package/dist/cdn/themes/cottagecore-dark.tokens.json +1 -1
- package/dist/cdn/themes/cottagecore.css +1 -1
- package/dist/cdn/themes/cottagecore.tokens.json +1 -1
- package/dist/cdn/themes/cyber.css +1 -1
- package/dist/cdn/themes/cyber.tokens.json +5 -11
- package/dist/cdn/themes/dawn-dark.tokens.json +3 -27
- package/dist/cdn/themes/dawn.css +1 -1
- package/dist/cdn/themes/dawn.tokens.json +1 -1
- package/dist/cdn/themes/dracula.tokens.json +1 -1
- package/dist/cdn/themes/dusk.tokens.json +1 -1
- package/dist/cdn/themes/editorial-dark.tokens.json +1 -1
- package/dist/cdn/themes/editorial.tokens.json +19 -16
- package/dist/cdn/themes/financial-dark.tokens.json +1 -1
- package/dist/cdn/themes/financial.css +1 -1
- package/dist/cdn/themes/financial.tokens.json +1 -1
- package/dist/cdn/themes/genai.css +1 -1
- package/dist/cdn/themes/genai.tokens.json +1 -1
- package/dist/cdn/themes/glassmorphism-dark.tokens.json +233 -116
- package/dist/cdn/themes/glassmorphism.css +1 -1
- package/dist/cdn/themes/glassmorphism.tokens.json +233 -116
- package/dist/cdn/themes/government-dark.tokens.json +1 -1
- package/dist/cdn/themes/government.tokens.json +1 -1
- package/dist/cdn/themes/gruvbox-dark.tokens.json +1 -1
- package/dist/cdn/themes/gruvbox.css +1 -1
- package/dist/cdn/themes/gruvbox.tokens.json +1 -1
- package/dist/cdn/themes/high-noon-dark.tokens.json +1 -1
- package/dist/cdn/themes/high-noon.tokens.json +1 -1
- package/dist/cdn/themes/journal-dark.tokens.json +3 -27
- package/dist/cdn/themes/journal.css +1 -1
- package/dist/cdn/themes/journal.tokens.json +21 -21
- package/dist/cdn/themes/kawaii-dark.tokens.json +1 -1
- package/dist/cdn/themes/kawaii.css +1 -1
- package/dist/cdn/themes/kawaii.tokens.json +1 -1
- package/dist/cdn/themes/magna-dark.tokens.json +1 -1
- package/dist/cdn/themes/magna.css +1 -1
- package/dist/cdn/themes/magna.tokens.json +2 -14
- package/dist/cdn/themes/manifest.json +25 -25
- package/dist/cdn/themes/midnight.tokens.json +1 -1
- package/dist/cdn/themes/minimal-dark.tokens.json +1 -1
- package/dist/cdn/themes/minimal.tokens.json +25 -27
- package/dist/cdn/themes/modern-dark.tokens.json +41 -41
- package/dist/cdn/themes/modern.css +1 -1
- package/dist/cdn/themes/modern.tokens.json +21 -21
- package/dist/cdn/themes/nes-dark.tokens.json +3 -27
- package/dist/cdn/themes/nes.tokens.json +10 -39
- package/dist/cdn/themes/neumorphism-dark.tokens.json +266 -134
- package/dist/cdn/themes/neumorphism.css +1 -1
- package/dist/cdn/themes/neumorphism.tokens.json +266 -134
- package/dist/cdn/themes/nord-dark.tokens.json +3 -27
- package/dist/cdn/themes/nord.css +1 -1
- package/dist/cdn/themes/nord.tokens.json +1 -1
- package/dist/cdn/themes/organic-dark.tokens.json +1 -1
- package/dist/cdn/themes/organic.tokens.json +5 -14
- package/dist/cdn/themes/rose-pine-dark.tokens.json +1 -1
- package/dist/cdn/themes/rose-pine.css +1 -1
- package/dist/cdn/themes/rose-pine.tokens.json +1 -1
- package/dist/cdn/themes/rough-dark.tokens.json +1 -1
- package/dist/cdn/themes/rough.tokens.json +1 -1
- package/dist/cdn/themes/solarized-dark.tokens.json +1 -1
- package/dist/cdn/themes/solarized.tokens.json +1 -1
- package/dist/cdn/themes/startup-dark.tokens.json +1 -1
- package/dist/cdn/themes/startup.css +1 -1
- package/dist/cdn/themes/startup.tokens.json +1 -1
- package/dist/cdn/themes/super2026-dark.tokens.json +6 -30
- package/dist/cdn/themes/super2026.css +1 -1
- package/dist/cdn/themes/super2026.tokens.json +1 -1
- package/dist/cdn/themes/swiss-dark.tokens.json +4 -40
- package/dist/cdn/themes/swiss.tokens.json +34 -68
- package/dist/cdn/themes/terminal.tokens.json +286 -120
- package/dist/cdn/themes/tokyo-night-dark.tokens.json +3 -27
- package/dist/cdn/themes/tokyo-night.css +1 -1
- package/dist/cdn/themes/tokyo-night.tokens.json +1 -1
- package/dist/cdn/themes/vaporwave-dark.tokens.json +3 -27
- package/dist/cdn/themes/vaporwave.tokens.json +1 -1
- package/dist/cdn/themes/win9x-dark.tokens.json +5 -29
- package/dist/cdn/themes/win9x.tokens.json +9 -9
- package/dist/cdn/vanilla-breeze-autoload.js +113 -108
- package/dist/cdn/vanilla-breeze-charts.js +13 -13
- package/dist/cdn/vanilla-breeze-core.css +1 -1
- package/dist/cdn/vanilla-breeze-core.js +80 -75
- package/dist/cdn/vanilla-breeze-extras.js +31 -31
- package/dist/cdn/vanilla-breeze.css +1 -1
- package/dist/cdn/vanilla-breeze.js +133 -133
- package/package.json +3 -3
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
2
|
-
`)}#s(t){let e=document.createElement("p");e.setAttribute("data-author-index-error",""),e.textContent=t,this.append(e)}#n(){let t=this.querySelector(":scope > [data-author-index-search]");if(!t){let r=this.getAttribute("placeholder")||"Filter authors\u2026";t=document.createElement("input"),t.type="search",t.placeholder=r,t.setAttribute("data-author-index-search",""),t.setAttribute("aria-label",r),this.prepend(t)}let e=this.querySelector(":scope > [data-author-index-status]");e||(e=document.createElement("p"),e.setAttribute("data-author-index-status",""),e.setAttribute("role","status"),e.className="visually-hidden",t.after(e));let s=t;this.listen(s,"input",()=>this.#o(s.value))}#o(t){let e=
|
|
1
|
+
var H=window.matchMedia("(prefers-reduced-motion: reduce)");var A=new Map;function S(o,t,e={}){let s=e.priority??10,r={impl:t,bundle:e.bundle,contract:e.contract,priority:s},n=A.get(o);if(customElements.get(o)){if(!n||n.priority>=s){n&&n.priority===s&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${o}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${o}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=s){n.priority===s&&console.warn(`[VB Bundle] Tag <${o}> already registered by "${n.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}A.set(o,r),customElements.define(o,t)}var m=class extends HTMLElement{#t=[];#e;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,s,r){t.addEventListener(e,s,r),this.#t.push(()=>t.removeEventListener(e,s,r))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#e||(this.#e=this.attachInternals());let s=this.#e.states;try{e?s.add(t):s.delete(t)}catch{let r=`--${t}`;e?s.add(r):s.delete(r)}}_adoptInternals(t){this.#e||(this.#e=t)}#r(){return this.constructor.formAssociated&&this.#e?this.#e:null}get validity(){return this.#r()?.validity}get validationMessage(){return this.#r()?.validationMessage??""}get willValidate(){return this.#r()?.willValidate??!1}get form(){return this.#r()?.form??null}checkValidity(){return this.#r()?.checkValidity()??!0}reportValidity(){return this.#r()?.reportValidity()??!0}};function y(o){return String(o??"").normalize("NFKD").replace(/\p{M}+/gu,"").toLowerCase()}function k(o){return y(o).replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/g,"")||"author"}function T(o,t,e=()=>!1){let s=k(o),r=s;for(let n=2;t.has(r)||e(r);n++)r=`${s}-${n}`;return t.add(r),r}function x(o){let t=String(o??"").trim();if(!t)return null;try{let{protocol:e}=new URL(t,"https://author-index.invalid/");return e==="http:"||e==="https:"?t:null}catch{return null}}function L(o){let t=Number.parseInt(o??"",10);return Number.isInteger(t)?Math.min(6,Math.max(1,t)):2}function q(o){let t=o.cloneNode(!0);return t.querySelectorAll('.visually-hidden, [aria-hidden="true"]').forEach(e=>e.remove()),y(t.textContent||"")}var g=class extends m{#t=null;setup(){if(this.querySelector(":scope > [data-author-index-search]")){this.#n();return}let t=this.getAttribute("data-lens-src")||this.getAttribute("src");t?(this.#t=new AbortController,this.#e(t,this.#t.signal)):this.#n()}teardown(){this.#t?.abort(),this.#t=null}async#e(t,e){let s;try{let r=await fetch(t,{signal:e});if(!r.ok)throw new Error(`status ${r.status}`);let n=await r.json();if(s=Array.isArray(n)?n:n?.pages||[],!Array.isArray(s))throw new Error("no pages array")}catch(r){if(e.aborted)return;this.children.length>0?this.#n():this.#s(`Could not load ${t}: ${r instanceof Error?r.message:r}`);return}e.aborted||(this.#r(s),this.#n())}#r(t){let e=new Map;for(let c of t){if(!c||typeof c!="object")continue;let i=typeof c.author=="string"&&c.author.trim()||"Unknown";e.has(i)||e.set(i,[]),e.get(i).push(c)}let s=this.getAttribute("sort")==="count"?"count":"alpha",r=[...e.entries()].sort(([c,i],[b,p])=>s==="count"&&p.length!==i.length?p.length-i.length:c.localeCompare(b)),n=L(this.getAttribute("heading-level")),l=new Set,f=c=>{let i=document.getElementById(`author-${c}`);return!!i&&!this.contains(i)},a=[`<h${n} class="author-index-heading">Authors <small>(${r.length})</small></h${n}>`];for(let[c,i]of r){let b=i[0],p=T(c,l,f),C=`${i.length} ${i.length===1?"page":"pages"}`;a.push(`<details data-author-group id="author-${h(p)}">`),a.push(`<summary><span class="author-name">${d(c)}</span><span class="author-count"><span aria-hidden="true">(${i.length})</span><span class="visually-hidden">, ${C}</span></span></summary>`);let $=x(b.authorUrl);$&&a.push(`<p class="author-link"><a href="${h($)}" rel="author">View ${d(c)}'s profile</a></p>`),a.push('<ul class="author-pages">');for(let u of i){let v=[u.modified?`<time datetime="${h(u.modified)}">${d(u.modified)}</time>`:"",u.provenance?`<span class="author-prov" data-provenance="${h(u.provenance)}">${d(u.provenance)}</span>`:"",u.signed?'<span class="author-signed" title="Cryptographically signed">signed</span>':""].filter(Boolean).join(" \xB7 "),w=x(u.url),E=d(u.title||u.url||"Untitled"),M=w?`<a href="${h(w)}">${E}</a>`:`<span>${E}</span>`;a.push(`<li>${M}${v?`<small>${v}</small>`:""}</li>`)}a.push("</ul></details>")}this.innerHTML=a.join(`
|
|
2
|
+
`)}#s(t){let e=document.createElement("p");e.setAttribute("data-author-index-error",""),e.textContent=t,this.append(e)}#n(){let t=this.querySelector(":scope > [data-author-index-search]");if(!t){let r=this.getAttribute("placeholder")||"Filter authors\u2026";t=document.createElement("input"),t.type="search",t.placeholder=r,t.setAttribute("data-author-index-search",""),t.setAttribute("aria-label",r),this.prepend(t)}let e=this.querySelector(":scope > [data-author-index-status]");e||(e=document.createElement("p"),e.setAttribute("data-author-index-status",""),e.setAttribute("role","status"),e.className="visually-hidden",t.after(e));let s=t;this.listen(s,"input",()=>this.#o(s.value))}#o(t){let e=y(t.trim()),s=[...this.querySelectorAll("[data-author-group]")],r=0;for(let a of s)a.hidden=!!e&&!q(a).includes(e),a.hidden||r++;let n=this.querySelector(":scope > [data-author-index-status]");if(!n)return;let l=s.length,f=a=>a===1?"author":"authors";e?r===0?n.textContent=`No authors match \u201C${t.trim()}\u201D`:n.textContent=`${r} of ${l} ${f(l)} match \u201C${t.trim()}\u201D`:n.textContent=`Showing all ${l} ${f(l)}`,n.classList.toggle("visually-hidden",!(e&&r===0)),n.toggleAttribute("data-empty",!!e&&r===0)}};function d(o){return String(o??"").replace(/[&<>]/g,t=>({"&":"&","<":"<",">":">"})[t])}function h(o){return String(o??"").replace(/[&<>"]/g,t=>({"&":"&","<":"<",">":">",'"':"""})[t])}S("author-index",g);export{g as AuthorIndex,x as safeHref,k as slugify,T as uniqueSlug};
|
|
3
3
|
//# sourceMappingURL=author-index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var c=class extends HTMLElement{#r=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}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.#r)t();this.#r=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,r,s){t.addEventListener(e,r,s),this.#r.push(()=>t.removeEventListener(e,r,s))}_reinit(){for(let t of this.#r)t();this.#r=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#t||(this.#t=this.attachInternals());let r=this.#t.states;try{e?r.add(t):r.delete(t)}catch{let s=`--${t}`;e?r.add(s):r.delete(s)}}_adoptInternals(t){this.#t||(this.#t=t)}#e(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#e()?.validity}get validationMessage(){return this.#e()?.validationMessage??""}get willValidate(){return this.#e()?.willValidate??!1}get form(){return this.#e()?.form??null}checkValidity(){return this.#e()?.checkValidity()??!0}reportValidity(){return this.#e()?.reportValidity()??!0}};var v=window.matchMedia("(prefers-reduced-motion: reduce)");var h=new Map;function f(i,t,e={}){let r=e.priority??10,s={impl:t,bundle:e.bundle,contract:e.contract,priority:r},n=h.get(i);if(customElements.get(i)){if(!n||n.priority>=r){n&&n.priority===r&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${i}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=r){n.priority===r&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${n.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}h.set(i,s),customElements.define(i,t)}var u="data-brand-mark-img",b="(width < 48rem)",l=class extends c{static observedAttributes=["src","src-dark","src-compact","compact-media","alt","wordmark","height"];#r=null;#t=null;#e=null;#s=!1;setup(){this.#a(),this.hasAttribute("src-dark")&&this.#o(),this.#i(),this.#t=new MutationObserver(()=>this.#d()),this.#t.observe(this,{childList:!0,characterData:!0,subtree:!0})}teardown(){this.#r?.disconnect(),this.#r=null,this.#t?.disconnect(),this.#t=null,this.#e=null,this.#s=!1}attributeChangedCallback(t,e,r){if(e!==r&&!(!this.isConnected||!this.hasAttribute("data-upgraded"))){if(t==="height"){this.#a();return}t==="src-dark"&&r!==null&&this.#o(),this.#i()}}#u(){let t=document.documentElement.getAttribute("data-mode");if(t==="dark")return!0;if(t==="light")return!1;let e=getComputedStyle(this).colorScheme||"";return/\bdark\b/.test(e)&&!/\blight\b/.test(e)?!0:/\blight\b/.test(e)&&!/\bdark\b/.test(e)?!1:(this.#e??matchMedia("(prefers-color-scheme: dark)")).matches}#o(){this.#s||(this.#s=!0,this.#e=matchMedia("(prefers-color-scheme: dark)"),this.listen(this.#e,"change",this.#n),this.listen(window,"vb:theme-change",this.#n),this.#r=new MutationObserver(this.#n),this.#r.observe(document.documentElement,{attributes:!0,attributeFilter:["data-mode","data-theme"]}))}#n=()=>{this.isConnected&&this.#i()};#a(){let t=this.getAttribute("height")?.trim();if(!t){this.style.removeProperty("--brand-mark-height"),this.getAttribute("style")||this.removeAttribute("style");return}this.style.setProperty("--brand-mark-height",/^\d+(\.\d+)?$/.test(t)?`${t}px`:t)}#c(){return this.querySelector(`:scope > [${u}]`)}#i(){let t=this.getAttribute("src"),e=this.#c();if(!t){e?.remove();return}let r=this.getAttribute("src-dark"),s=r&&this.#u()?r:t;if(!(e instanceof HTMLPictureElement)||!e.querySelector(":scope > img")){e?.remove(),e=document.createElement("picture"),e.setAttribute(u,"");let a=document.createElement("img");a.decoding="async",e.append(a),this.prepend(e)}let n=e.querySelector(":scope > img");n.getAttribute("src")!==s&&n.setAttribute("src",s);let d=this.getAttribute("src-compact"),o=e.querySelector(":scope > source");if(d){o||(o=document.createElement("source"),e.prepend(o));let a=this.getAttribute("compact-media")||b;o.getAttribute("media")!==a&&o.setAttribute("media",a),o.getAttribute("srcset")!==d&&o.setAttribute("srcset",d)}else o?.remove();this.#d()}#d(){let t=this.#c()?.querySelector(":scope > img");if(!t)return;let e=this.getAttribute("alt"),r=!this.hasAttribute("wordmark"),s;r&&e?s=e:this.#l()?s="":s=e??"",t.getAttribute("alt")!==s&&t.setAttribute("alt",s)}#l(){for(let t of this.childNodes)if(!(t instanceof Element&&t.hasAttribute(u))&&t.textContent?.trim())return!0;return!1}};f("brand-mark",l);
|
|
2
2
|
//# sourceMappingURL=brand-mark.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var M=window.matchMedia("(prefers-reduced-motion: reduce)");var E=new Map;function A(i,t,r={}){let e=r.priority??10,s={impl:t,bundle:r.bundle,contract:r.contract,priority:e},n=E.get(i);if(customElements.get(i)){if(!n||n.priority>=e){n&&n.priority===e&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${r.bundle}".`);return}console.warn(`[VB Bundle] Tag <${i}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${r.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=e){n.priority===e&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${n.bundle}". Skipping "${r.bundle}" (first wins at equal priority).`);return}E.set(i,s),customElements.define(i,t)}var u=class extends HTMLElement{#t=[];#e;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}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,r,e,s){t.addEventListener(r,e,s),this.#t.push(()=>t.removeEventListener(r,e,s))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,r){this.#e||(this.#e=this.attachInternals());let e=this.#e.states;try{r?e.add(t):e.delete(t)}catch{let s=`--${t}`;r?e.add(s):e.delete(s)}}_adoptInternals(t){this.#e||(this.#e=t)}#r(){return this.constructor.formAssociated&&this.#e?this.#e:null}get validity(){return this.#r()?.validity}get validationMessage(){return this.#r()?.validationMessage??""}get willValidate(){return this.#r()?.willValidate??!1}get form(){return this.#r()?.form??null}checkValidity(){return this.#r()?.checkValidity()??!0}reportValidity(){return this.#r()?.reportValidity()??!0}};var S="Home",C="Show full path",p=":scope > ol > li:not([data-crumb-toggle])",$=4;function v(i){try{return decodeURIComponent(i)}catch{return i}}var b=class extends u{#t={};#e=!1;#r=!1;static get observedAttributes(){return["data-collapsed"]}setup(){this.#a(),this.hasAttribute("data-from-pathname")?this.#s():this.#l(),this.#i(),this.#n(),this.#o(),this.listen(this,"click",t=>{let e=(t.target instanceof Element?t.target:null)?.closest("[data-crumb-toggle] > button");if(!e||!this.contains(e))return;let s=e.getAttribute("aria-expanded")!=="true";e.setAttribute("aria-expanded",String(s)),this.dispatchEvent(new CustomEvent("bread-crumb:toggle",{bubbles:!0,detail:{expanded:s}}))})}attributeChangedCallback(t,r,e){r===e||!this.hasAttribute("data-upgraded")||t==="data-collapsed"&&this.#n()}get labels(){return{...this.#t}}set labels(t){!t||typeof t!="object"||(this.#t={...t},this.isConnected&&this.hasAttribute("data-from-pathname")&&(this.#s(),this.#i(),this.#n(),this.#o()))}#a(){if(!!this.parentElement?.closest('nav, [role="navigation"]')){this.#e&&this.removeAttribute("role"),this.#r&&this.removeAttribute("aria-label"),this.#e=!1,this.#r=!1;return}this.hasAttribute("role")||(this.setAttribute("role","navigation"),this.#e=!0),!this.hasAttribute("aria-label")&&!this.hasAttribute("aria-labelledby")&&(this.setAttribute("aria-label","Breadcrumb"),this.#r=!0)}#s(){let r=window.location.pathname.split("/").filter(Boolean),e=document.createElement("ol"),s=document.createElement("li"),n=document.createElement("a");n.href="/",n.textContent=this.#t["/"]||this.#t.home||S,s.appendChild(n),e.appendChild(s);let o=this.dataset.currentLabel,a="";r.forEach((l,w)=>{a+=`/${l}`;let m=w===r.length-1,h=document.createElement("li"),f=`${a}/`,y=v(l),g=m&&o||this.#t[f]||this.#t[a]||this.#t[v(f)]||this.#t[y]||this.#t[l]||this.#c(y);if(m){let c=document.createElement("span");c.setAttribute("aria-current","page"),c.textContent=g,h.appendChild(c)}else{let c=document.createElement("a");c.href=f,c.textContent=g,h.appendChild(c)}e.appendChild(h)});let d=this.querySelector(":scope > ol");d?d.replaceWith(e):this.prepend(e)}#c(t){return t.replace(/[-_]+/g," ").replace(/\S+/g,r=>r[0].toUpperCase()+r.slice(1))}#l(){if(this.querySelector(":scope > ol"))return;let r=Array.from(this.querySelectorAll(":scope > a, :scope > span"));if(r.length===0)return;let e=document.createElement("ol");r.forEach(s=>{let n=document.createElement("li");n.appendChild(s),e.appendChild(n)}),this.prepend(e)}#i(){let t=this.querySelectorAll(p);t.length!==0&&t.forEach((r,e)=>{let s=e===t.length-1,n=r.querySelector("a, span");n&&(s?n.setAttribute("aria-current","page"):n.removeAttribute("aria-current"))})}#n(){let t=this.querySelector(":scope > ol"),r=t?.querySelector(":scope > li[data-crumb-toggle]"),e=this.querySelectorAll(p);if(!(!!t&&this.hasAttribute("data-collapsed")&&e.length>=$)){r?.remove();return}let n=r||document.createElement("li");if(!r){n.setAttribute("data-crumb-toggle","");let o=document.createElement("button");o.type="button",o.setAttribute("aria-expanded","false"),o.setAttribute("aria-label",C),o.textContent="\u2026",n.appendChild(o)}e[0].nextElementSibling!==n&&e[0].after(n)}#o(){if(this.dataset.jsonld==="off")return;let t=Array.from(this.querySelectorAll(p));if(t.length===0)return;let e={"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:t.map((n,o)=>{let a=n.querySelector("a, span"),d=a?.textContent?.trim()||"",l=a instanceof HTMLAnchorElement&&a.hasAttribute("href")?a.href:void 0;return{"@type":"ListItem",position:o+1,name:d,...l?{item:l}:{}}})},s=this.querySelector(':scope > script[type="application/ld+json"]');s||(s=document.createElement("script"),s.type="application/ld+json",this.appendChild(s)),s.textContent=JSON.stringify(e)}};A("bread-crumb",b);
|
|
2
2
|
//# sourceMappingURL=bread-crumb.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var et=window.matchMedia("(prefers-reduced-motion: reduce)");var j=new Map;function z(r,t,e={}){let s=e.priority??10,n={impl:t,bundle:e.bundle,contract:e.contract,priority:s},i=j.get(r);if(customElements.get(r)){if(!i||i.priority>=s){i&&i.priority===s&&i.impl!==t&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=s){i.priority===s&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${i.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}j.set(r,n),customElements.define(r,t)}var O=class extends HTMLElement{#c=[];#i;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}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,s,n){t.addEventListener(e,s,n),this.#c.push(()=>t.removeEventListener(e,s,n))}_reinit(){for(let t of this.#c)t();this.#c=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#i||(this.#i=this.attachInternals());let s=this.#i.states;try{e?s.add(t):s.delete(t)}catch{let n=`--${t}`;e?s.add(n):s.delete(n)}}_adoptInternals(t){this.#i||(this.#i=t)}#t(){return this.constructor.formAssociated&&this.#i?this.#i:null}get validity(){return this.#t()?.validity}get validationMessage(){return this.#t()?.validationMessage??""}get willValidate(){return this.#t()?.willValidate??!1}get form(){return this.#t()?.form??null}checkValidity(){return this.#t()?.checkValidity()??!0}reportValidity(){return this.#t()?.reportValidity()??!0}};function R(r,t="en-US"){try{if(r)return Intl.getCanonicalLocales(r),r}catch{}try{return Intl.getCanonicalLocales(t),t}catch{return"en-US"}}function x(r){let t=r.getFullYear(),e=String(r.getMonth()+1).padStart(2,"0"),s=String(r.getDate()).padStart(2,"0");return`${t}-${e}-${s}`}function $(r){if(!r)return null;let[t,e,s]=r.split("-").map(Number);return new Date(t,e-1,s)}function U(r,t){return new Date(r,t+1,0).getDate()}function N(r,t){return r&&t&&r.getFullYear()===t.getFullYear()&&r.getMonth()===t.getMonth()&&r.getDate()===t.getDate()}function Y(r,t){let e=new Date(r);return e.setDate(e.getDate()+t),e}function X(r,t){if(!t)return null;let e=$(t);if(!e)return null;let s=e;if(typeof r=="object"&&r)if(typeof r.end=="string"){let n=$(r.end);n&&n>=e&&(s=n)}else typeof r.days=="number"&&Number.isFinite(r.days)&&r.days>=1&&(s=Y(e,Math.floor(r.days)-1));return{start:e,end:s,startISO:t,endISO:x(s),days:Math.round((s.getTime()-e.getTime())/864e5)+1}}function Q(r){try{let t=new Intl.Locale(r),e=t.getWeekInfo?.()??t.weekInfo;if(e)return e.firstDay%7}catch{}return 0}var Z=0;function tt(r){return r?typeof r=="string"?[{label:r}]:Array.isArray(r)?r:typeof r=="object"?[r]:[]:[]}var _=new Map;function H(r,t="short"){let e=`${r}:${t}`;if(_.has(e))return _.get(e);let s=new Intl.DateTimeFormat(r,{weekday:t}),n=Array.from({length:7},(i,a)=>s.format(new Date(2026,0,4+a)));return _.set(e,n),n}var B=class extends O{static formAssociated=!0;#c;#i="en-US";#t=new Date().getMonth();#e=new Date().getFullYear();#F=0;#A={};#o=null;#l=null;#k=new Set;#M=new Map;#f=null;#h=new Set;#a=null;#r=null;#w=null;#s="none";#B="default";#L=1;#I=null;#T=!1;#O=!1;static get observedAttributes(){return["data-month","data-year","data-events"]}attributeChangedCallback(t,e,s){if(!this.#p||this.#O||e===s)return;if(t==="data-events"){let h={};if(s)try{h=JSON.parse(s)}catch{return}this.#T=!1,this.#A=h,this.#d(),this.dispatchEvent(new CustomEvent("calendar-wc:events-changed",{detail:{events:h,source:"attribute"},bubbles:!0}));return}let n=parseInt(this.getAttribute("data-month")??"",10)-1,i=parseInt(this.getAttribute("data-year")??"",10),a=n>=0&&n<=11?n:this.#t,o=Number.isFinite(i)?i:this.#e;a===this.#t&&o===this.#e||(this.#t=a,this.#e=o,this.#d())}#V=null;get isDateDisallowed(){return this.#V}set isDateDisallowed(t){this.#V=t,this.#p&&this.#d()}#j=null;get getDayParts(){return this.#j}set getDayParts(t){this.#j=t,this.#p&&this.#d()}get events(){return this.#A}set events(t){let e=this._normalizeEventsInput(t);this.#A!==e&&(this.#A=e,this.#T=!0,this.#p&&this.#d(),this.dispatchEvent(new CustomEvent("calendar-wc:events-changed",{detail:{events:e,source:"property"},bubbles:!0})))}_normalizeEventsInput(t){if(!t)return{};if(Array.isArray(t)){let e={};for(let s of t){let n=s?.date;n&&(e[n]||(e[n]=[]),e[n].push(s))}return e}return typeof t=="object"?t:{}}#p=!1;#E;#C;#b;#u;#m;#H;#n;#g;#y;#Y=null;#P=null;#v=null;_detailCleanup=null;#D={dayToEvents:new Map,spans:[]};constructor(){super(),typeof this.attachInternals=="function"&&(this.#c=this.attachInternals(),this._adoptInternals(this.#c))}setup(){this.#i=R(this.closest("[lang]")?.lang||navigator.language);let t=new Date;this.#t=parseInt(this.getAttribute("data-month")??"",10)-1,isNaN(this.#t)&&(this.#t=t.getMonth()),this.#e=parseInt(this.getAttribute("data-year")??"",10),isNaN(this.#e)&&(this.#e=t.getFullYear()),this.#F=Q(this.#i),this.#s=this.getAttribute("data-selection")||"none",this.#B=this.getAttribute("data-size")||"default",this.#L=Math.max(1,Math.min(12,parseInt(this.dataset.months??"",10)||1));let e=this.getAttribute("data-events");if(e&&!this.#T)try{this.#A=JSON.parse(e)}catch{}this.#o=$(this.dataset.minDate),this.#l=$(this.dataset.maxDate),this.#k.clear(),this.#M.clear();let s=this.getAttribute("data-disabled-dates");s&&s.split(",").forEach(i=>this.#k.add(i.trim()));let n=this.getAttribute("data-highlight-dates");n&&n.split(",").forEach(i=>{let[a,o]=i.trim().split(":");this.#M.set(a,o||"")}),this.#G(),this.#d(),this.#p=!0}refresh(){this.#p&&this.#d()}#S(t,e){return this.dataset[`label${t}`]||e}#G(){this.#E=document.createElement("header"),this.#g=document.createElement("button"),this.#g.type="button",this.#g.setAttribute("aria-label",this.#S("Prev","Previous month")),this.#g.textContent="\u2039",this.listen(this.#g,"click",()=>this.#z(-1)),this.#C=document.createElement("span"),this.#C.className="calendar-title",this.#C.setAttribute("aria-live","polite"),this.#b=document.createElement("span"),this.#b.className="calendar-month",this.#u=document.createElement("select"),this.#u.className="calendar-year",this.#u.setAttribute("aria-label",this.#S("Year","Year")),this.listen(this.#u,"change",()=>{this.#e=parseInt(this.#u.value,10),this.#d(),this.dispatchEvent(new CustomEvent("calendar:navigate",{bubbles:!0,detail:{year:this.#e,month:this.#t+1}}))}),this.#m=document.createElement("span"),this.#m.className="calendar-year-wrap",this.#m.appendChild(this.#u),this.#C.append(this.#b," ",this.#m),this.#y=document.createElement("button"),this.#y.type="button",this.#y.setAttribute("aria-label",this.#S("Next","Next month")),this.#y.textContent="\u203A",this.listen(this.#y,"click",()=>this.#z(1)),this.#E.append(this.#g,this.#C,this.#y),this.appendChild(this.#E);let t=document.createElement("div");t.className="calendar-banner",t.setAttribute("aria-hidden","true"),this.appendChild(t),this.#Y=t,this.#n=document.createElement("div"),this.#n.className="cal-months",this.appendChild(this.#n),this.listen(this.#n,"click",e=>{let n=e.target?.closest("button[data-date]");if(!n||n.disabled)return;let i=n.getAttribute("data-date");if(i)if(this.#s!=="none")this.#K(i);else{let a=this.#D.dayToEvents.get(i)||[];a.length&&this.#Z(i,a.map(o=>o.evt))}}),this.listen(this.#n,"keydown",e=>this.#tt(e)),this.listen(this.#n,"focusin",e=>{let n=e.target?.closest?.("button[data-date]");n&&(this.#I=n.getAttribute("data-date"),this.#_())}),this.listen(this,"keydown",e=>{e.key==="Escape"&&this.#v&&(e.stopPropagation(),this.#x(!0))}),this.#s==="range"&&this.listen(this.#n,"mouseover",e=>{let n=e.target?.closest("button[data-date]");n&&this.#a&&!this.#r&&(this.#w=$(n.getAttribute("data-date")),this.#N())})}#W(){let t=parseInt(this.getAttribute("data-year-range")??"",10);return Number.isFinite(t)&&t>=0?Math.min(t,200):10}#J(){this.#u.innerHTML="";let t=new Date().getFullYear(),e=this.#W(),s=Math.min(this.#e,this.#o?this.#o.getFullYear():t-e),n=Math.max(this.#e,this.#l?this.#l.getFullYear():t+e);for(let i=s;i<=n;i++){let a=document.createElement("option");a.value=String(i),a.textContent=String(i),i===this.#e&&(a.selected=!0),this.#u.appendChild(a)}}#z(t){this.#t+=t,this.#t<0&&(this.#t=11,this.#e--),this.#t>11&&(this.#t=0,this.#e++),this.#d(),this.dispatchEvent(new CustomEvent("calendar:navigate",{bubbles:!0,detail:{year:this.#e,month:this.#t+1}}))}#K(t){if(this.#s==="none")return;let e=$(t);if(e){if(this.#s==="single")this.#f=e,this.#N(),this.#q(),this.dispatchEvent(new CustomEvent("calendar:select",{bubbles:!0,detail:{value:t,date:e}}));else if(this.#s==="range"){if(!this.#a||this.#r)this.#a=e,this.#r=null,this.#w=null,this.setAttribute("data-tentative",x(this.#a));else{this.#r=e,this.#a&&this.#a>this.#r&&([this.#a,this.#r]=[this.#r,this.#a]),this.#w=null,this.removeAttribute("data-tentative");let s=x(this.#a),n=x(this.#r);this.dispatchEvent(new CustomEvent("calendar:select",{bubbles:!0,detail:{value:`${s}/${n}`,start:s,end:n,startDate:this.#a,endDate:this.#r}}))}this.#N(),this.#q()}else if(this.#s==="multi"){this.#h.has(t)?this.#h.delete(t):this.#h.add(t),this.#N(),this.#q();let s=[...this.#h].sort();this.dispatchEvent(new CustomEvent("calendar:select",{bubbles:!0,detail:{values:s,dates:s.map($)}}))}}}#q(){this.#c&&this.getAttribute("name")&&this.#c.setFormValue(this.value)}get value(){switch(this.#s){case"single":return this.#f?x(this.#f):null;case"range":return this.#a&&this.#r?`${x(this.#a)}/${x(this.#r)}`:this.#a?x(this.#a):null;case"multi":return this.#h.size?[...this.#h].sort().join(" "):null;default:return null}}#N(){if(!this.#n)return;let t=this.#a,e=this.#r||this.#w;for(let s of this.#n.querySelectorAll("td")){let n=s.querySelector("button[data-date]");if(!n)continue;let i=n.getAttribute("data-date"),a=$(i);if(!(!a||!i)){if(s.removeAttribute("data-selected"),s.removeAttribute("data-range-start"),s.removeAttribute("data-range-end"),s.removeAttribute("data-in-range"),this.#s==="single"&&N(a,this.#f)&&s.setAttribute("data-selected",""),this.#s==="multi"&&this.#h.has(i)&&s.setAttribute("data-selected",""),this.#s==="range"&&t)if(e){let o=t<e?t:e,h=t<e?e:t;N(a,o)&&s.setAttribute("data-range-start",""),N(a,h)&&s.setAttribute("data-range-end",""),a>=o&&a<=h&&s.setAttribute("data-in-range","")}else N(a,t)&&s.setAttribute("data-range-start","");this.#R(s)}}}#R(t){if(this.#s==="none"){t.removeAttribute("aria-selected");return}let e=t.hasAttribute("data-selected")||t.hasAttribute("data-in-range")||t.hasAttribute("data-range-start")||t.hasAttribute("data-range-end");t.setAttribute("aria-selected",String(e))}#_(){if(!this.#n)return;let t=[...this.#n.querySelectorAll("button[data-date]")],e=t.filter(a=>!a.disabled),s=a=>a?e.find(o=>o.getAttribute("data-date")===a):void 0,n=null;this.#s==="single"&&this.#f?n=x(this.#f):this.#s==="range"&&this.#a?n=x(this.#a):this.#s==="multi"&&this.#h.size&&(n=[...this.#h].sort()[0]);let i=s(this.#I)||s(n)||e.find(a=>a.getAttribute("aria-current")==="date")||e[0];for(let a of t)a.setAttribute("tabindex",a===i?"0":"-1")}#$(t){let e=new Date(this.#e,this.#t+t,1);return{year:e.getFullYear(),month:e.getMonth()}}#X(){let t=new Map,e=[];for(let[s,n]of Object.entries(this.#A||{})){let i=tt(n);for(let a of i){let o=X(a,s);if(!o)continue;let h=o.days>1;h&&e.push({evt:a,range:o});for(let w=new Date(o.start),b=0;b<o.days;w=Y(w,1),b++){let p=x(w),d={evt:a,range:o,isSpan:h,isStart:p===o.startISO,isEnd:p===o.endISO};t.has(p)||t.set(p,[]),t.get(p).push(d)}}}return{dayToEvents:t,spans:e}}#d(){let t=this.#L;this.#D=this.#X();let e=new Intl.DateTimeFormat(this.#i,{month:"long"}),s=new Intl.DateTimeFormat(this.#i,{month:"long",year:"numeric"});try{let i=new Date(this.#e,this.#t,1);if(t===1)this.#b.textContent=e.format(i),this.#m&&(this.#m.style.display="");else{let a=this.#$(t-1);i.getFullYear()===a.year?this.#b.textContent=String(this.#e):this.#b.textContent=`${i.getFullYear()} \u2013 ${a.year}`,this.#m&&(this.#m.style.display="none")}}catch{this.#b.textContent=String(this.#t+1)}this.#J(),this.#g.disabled=!!(this.#o&&(this.#e<this.#o.getFullYear()||this.#e===this.#o.getFullYear()&&this.#t<=this.#o.getMonth()));let n=this.#$(t-1);this.#y.disabled=!!(this.#l&&(n.year>this.#l.getFullYear()||n.year===this.#l.getFullYear()&&n.month>=this.#l.getMonth())),this.#O=!0,this.setAttribute("data-month",String(this.#t+1)),this.setAttribute("data-year",String(this.#e)),this.#O=!1,this.#n.innerHTML="";for(let i=0;i<t;i++){let{year:a,month:o}=this.#$(i);if(t>1){let h=document.createElement("div");h.className="cal-month-column";let w=parseInt(this.getAttribute("data-heading-level")??"",10),b=document.createElement(w>=1&&w<=6?`h${w}`:"span");b.className="cal-month-title",b.textContent=s.format(new Date(a,o,1)),h.appendChild(b);let p=this.#U(a,o);h.appendChild(p),this.#n.appendChild(h)}else{let h=this.#U(a,o);this.#n.appendChild(h)}}this.#H=this.#n.querySelector("table"),this.#_()}#U(t,e){let s=new Date,n=U(t,e),i=this.#B==="large",a=document.createElement("table");a.setAttribute("role","grid"),(this.#s==="multi"||this.#s==="range")&&a.setAttribute("aria-multiselectable","true");try{let g=new Date(t,e,1);a.setAttribute("aria-label",new Intl.DateTimeFormat(this.#i,{month:"long",year:"numeric"}).format(g))}catch{}let o=document.createElement("thead"),h=document.createElement("tr"),w=H(this.#i,"short"),b=H(this.#i,"long");for(let g=0;g<7;g++){let y=(this.#F+g)%7,A=document.createElement("th");A.setAttribute("scope","col"),A.setAttribute("abbr",b[y]),A.textContent=w[y],h.appendChild(A)}o.appendChild(h),a.appendChild(o);let p=document.createElement("tbody"),d=1,f=document.createElement("tr");f.setAttribute("data-week",String(d));let l=(new Date(t,e,1).getDay()-this.#F+7)%7,c=U(t,e-1);for(let g=0;g<l;g++){let y=c-l+1+g,A=document.createElement("td");A.setAttribute("data-outside-month","");let m=document.createElement("button");m.type="button",m.disabled=!0,m.setAttribute("tabindex","-1"),m.setAttribute("data-day",String(y));let S=document.createElement("span");S.className="day-number",S.textContent=String(y),m.appendChild(S),A.appendChild(m),f.appendChild(A)}let C=this.#a,u=this.#r||this.#w;for(let g=1;g<=n;g++){let y=new Date(t,e,g),A=x(y),m=document.createElement("td"),S=document.createElement("button");S.type="button",S.setAttribute("data-date",A);let P=document.createElement("span");if(P.className="day-number",P.textContent=String(g),S.appendChild(P),S.setAttribute("data-day",String(g)),N(y,s)&&(S.setAttribute("aria-current","date"),m.setAttribute("data-today","")),this.#s==="single"&&N(y,this.#f)&&m.setAttribute("data-selected",""),this.#s==="multi"&&this.#h.has(A)&&m.setAttribute("data-selected",""),this.#s==="range"&&C&&u){let M=C<u?C:u,T=C<u?u:C;N(y,M)&&m.setAttribute("data-range-start",""),N(y,T)&&m.setAttribute("data-range-end",""),y>=M&&y<=T&&m.setAttribute("data-in-range","")}else this.#s==="range"&&C&&N(y,C)&&m.setAttribute("data-range-start","");this.#R(m);let G=this.#o&&y<this.#o,W=this.#l&&y>this.#l,J=typeof this.isDateDisallowed=="function"&&this.isDateDisallowed(y);if((this.#k.has(A)||G||W||J)&&(S.setAttribute("aria-disabled","true"),S.disabled=!0),this.#M.has(A)&&S.setAttribute("data-highlight",this.#M.get(A)||""),typeof this.getDayParts=="function"){let M=this.getDayParts(y);M!=null&&(m.dataset.dayPart=Array.isArray(M)?M.join(" "):M)}let k=this.#D.dayToEvents.get(A)||[];if(k.length){m.setAttribute("data-events",""),m.setAttribute("data-event-count",String(k.length));let M=i?k.filter(v=>!v.isSpan):k,T=k.map(v=>v.evt);if(i){if(M.length){let v=document.createElement("span");v.className="event-list";let L=2;if(M.slice(0,L).forEach(({evt:D})=>{let F=document.createElement("span");if(F.className="event-item",D.color&&F.style.setProperty("--event-color",D.color),D.icon){let q=document.createElement("icon-wc");q.setAttribute("name",D.icon),q.setAttribute("size","xs"),F.appendChild(q)}let V=document.createElement("span");V.textContent=D.time?`${D.time} ${D.label}`:D.label,F.appendChild(V),v.appendChild(F)}),M.length>L){let D=document.createElement("span");D.className="event-more",D.textContent=this.#S("More","+{n} more").replace("{n}",String(M.length-L)),v.appendChild(D)}S.appendChild(v)}}else{let v=document.createElement("span");v.className="event-dots",v.setAttribute("aria-hidden","true");let L=Math.min(k.length,3);for(let D=0;D<L;D++){let F=document.createElement("span");F.setAttribute("data-event-dot",""),k[D].evt.color&&F.style.setProperty("--event-color",k[D].evt.color),v.appendChild(F)}m.appendChild(v)}let K=T.map(v=>v.time?`${v.time} \u2014 ${v.label}`:v.label);S.setAttribute("title",K.join(`
|
|
2
|
-
`))}
|
|
1
|
+
var it=window.matchMedia("(prefers-reduced-motion: reduce)");var z=new Map;function N(r,t,e={}){let s=e.priority??10,n={impl:t,bundle:e.bundle,contract:e.contract,priority:s},a=z.get(r);if(customElements.get(r)){if(!a||a.priority>=s){a&&a.priority===s&&a.impl!==t&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${a.bundle}" (priority ${a.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${a.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(a&&a.priority>=s){a.priority===s&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${a.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}z.set(r,n),customElements.define(r,t)}var Y=class extends HTMLElement{#c=[];#i;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}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,s,n){t.addEventListener(e,s,n),this.#c.push(()=>t.removeEventListener(e,s,n))}_reinit(){for(let t of this.#c)t();this.#c=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#i||(this.#i=this.attachInternals());let s=this.#i.states;try{e?s.add(t):s.delete(t)}catch{let n=`--${t}`;e?s.add(n):s.delete(n)}}_adoptInternals(t){this.#i||(this.#i=t)}#t(){return this.constructor.formAssociated&&this.#i?this.#i:null}get validity(){return this.#t()?.validity}get validationMessage(){return this.#t()?.validationMessage??""}get willValidate(){return this.#t()?.willValidate??!1}get form(){return this.#t()?.form??null}checkValidity(){return this.#t()?.checkValidity()??!0}reportValidity(){return this.#t()?.reportValidity()??!0}};function R(r,t="en-US"){try{if(r)return Intl.getCanonicalLocales(r),r}catch{}try{return Intl.getCanonicalLocales(t),t}catch{return"en-US"}}function x(r){let t=r.getFullYear(),e=String(r.getMonth()+1).padStart(2,"0"),s=String(r.getDate()).padStart(2,"0");return`${t}-${e}-${s}`}function I(r){if(!r)return null;let[t,e,s]=r.split("-").map(Number);return new Date(t,e-1,s)}function O(r,t){return new Date(r,t+1,0).getDate()}function k(r,t){return r&&t&&r.getFullYear()===t.getFullYear()&&r.getMonth()===t.getMonth()&&r.getDate()===t.getDate()}function _(r,t){let e=new Date(r);return e.setDate(e.getDate()+t),e}function X(r,t){if(!t)return null;let e=I(t);if(!e)return null;let s=e;if(typeof r=="object"&&r)if(typeof r.end=="string"){let n=I(r.end);n&&n>=e&&(s=n)}else typeof r.days=="number"&&Number.isFinite(r.days)&&r.days>=1&&(s=_(e,Math.floor(r.days)-1));return{start:e,end:s,startISO:t,endISO:x(s),days:Math.round((s.getTime()-e.getTime())/864e5)+1}}function Q(r){try{let t=new Intl.Locale(r),e=t.getWeekInfo?.()??t.weekInfo;if(e)return e.firstDay%7}catch{}return 0}var Z=0;function tt(r){return r?typeof r=="string"?[{label:r}]:Array.isArray(r)?r:typeof r=="object"?[r]:[]:[]}var j=new Map;function U(r,t="short"){let e=`${r}:${t}`;if(j.has(e))return j.get(e);let s=new Intl.DateTimeFormat(r,{weekday:t}),n=Array.from({length:7},(a,i)=>s.format(new Date(2026,0,4+i)));return j.set(e,n),n}var H=class extends Y{static formAssociated=!0;#c;#i="en-US";#t=new Date().getMonth();#e=new Date().getFullYear();#M=0;#A={};#o=null;#l=null;#T=new Set;#$=new Map;#m=null;#d=new Set;#a=null;#r=null;#w=null;#n="none";#j="default";#L=1;#k=null;#P=!1;#Y=!1;static get observedAttributes(){return["data-month","data-year","data-events"]}attributeChangedCallback(t,e,s){if(!this.#p||this.#Y||e===s)return;if(t==="data-events"){let c={};if(s)try{c=JSON.parse(s)}catch{return}this.#P=!1,this.#A=c,this.#h(),this.dispatchEvent(new CustomEvent("calendar-wc:events-changed",{detail:{events:c,source:"attribute"},bubbles:!0}));return}let n=parseInt(this.getAttribute("data-month")??"",10)-1,a=parseInt(this.getAttribute("data-year")??"",10),i=n>=0&&n<=11?n:this.#t,o=Number.isFinite(a)?a:this.#e;i===this.#t&&o===this.#e||(this.#t=i,this.#e=o,this.#h())}#H=null;get isDateDisallowed(){return this.#H}set isDateDisallowed(t){this.#H=t,this.#p&&this.#h()}#V=null;get getDayParts(){return this.#V}set getDayParts(t){this.#V=t,this.#p&&this.#h()}get events(){return this.#A}set events(t){let e=this._normalizeEventsInput(t);this.#A!==e&&(this.#A=e,this.#P=!0,this.#p&&this.#h(),this.dispatchEvent(new CustomEvent("calendar-wc:events-changed",{detail:{events:e,source:"property"},bubbles:!0})))}_normalizeEventsInput(t){if(!t)return{};if(Array.isArray(t)){let e={};for(let s of t){let n=s?.date;n&&(e[n]||(e[n]=[]),e[n].push(s))}return e}return typeof t=="object"?t:{}}#p=!1;#E;#v;#b;#u;#f;#U;#s;#g;#y;#O=null;#_=null;#C=null;_detailCleanup=null;#S={dayToEvents:new Map,spans:[]};constructor(){super(),typeof this.attachInternals=="function"&&(this.#c=this.attachInternals(),this._adoptInternals(this.#c))}setup(){this.#i=R(this.closest("[lang]")?.lang||navigator.language);let t=new Date;this.#t=parseInt(this.getAttribute("data-month")??"",10)-1,isNaN(this.#t)&&(this.#t=t.getMonth()),this.#e=parseInt(this.getAttribute("data-year")??"",10),isNaN(this.#e)&&(this.#e=t.getFullYear()),this.#M=Q(this.#i),this.#n=this.getAttribute("data-selection")||"none",this.#j=this.getAttribute("data-size")||"default",this.#L=Math.max(1,Math.min(12,parseInt(this.dataset.months??"",10)||1));let e=this.getAttribute("data-events");if(e&&!this.#P)try{this.#A=JSON.parse(e)}catch{}this.#o=I(this.dataset.minDate),this.#l=I(this.dataset.maxDate),this.#T.clear(),this.#$.clear();let s=this.getAttribute("data-disabled-dates");s&&s.split(",").forEach(a=>this.#T.add(a.trim()));let n=this.getAttribute("data-highlight-dates");n&&n.split(",").forEach(a=>{let[i,o]=a.trim().split(":");this.#$.set(i,o||"")}),this.#G(),this.#h(),this.#p=!0}refresh(){this.#p&&this.#h()}#D(t,e){return this.dataset[`label${t}`]||e}#G(){this.#E=document.createElement("header"),this.#g=document.createElement("button"),this.#g.type="button",this.#g.setAttribute("aria-label",this.#D("Prev","Previous month")),this.#g.textContent="\u2039",this.listen(this.#g,"click",()=>this.#z(-1)),this.#v=document.createElement("span"),this.#v.className="calendar-title",this.#v.setAttribute("aria-live","polite"),this.#b=document.createElement("span"),this.#b.className="calendar-month",this.#u=document.createElement("select"),this.#u.className="calendar-year",this.#u.setAttribute("aria-label",this.#D("Year","Year")),this.listen(this.#u,"change",()=>{this.#e=parseInt(this.#u.value,10),this.#h(),this.dispatchEvent(new CustomEvent("calendar:navigate",{bubbles:!0,detail:{year:this.#e,month:this.#t+1}}))}),this.#f=document.createElement("span"),this.#f.className="calendar-year-wrap",this.#f.appendChild(this.#u),this.#v.append(this.#b," ",this.#f),this.#y=document.createElement("button"),this.#y.type="button",this.#y.setAttribute("aria-label",this.#D("Next","Next month")),this.#y.textContent="\u203A",this.listen(this.#y,"click",()=>this.#z(1)),this.#E.append(this.#g,this.#v,this.#y),this.appendChild(this.#E);let t=document.createElement("div");t.className="calendar-banner",t.setAttribute("aria-hidden","true"),this.appendChild(t),this.#O=t,this.#s=document.createElement("div"),this.#s.className="cal-months",this.appendChild(this.#s),this.listen(this.#s,"click",e=>{let n=e.target?.closest("button[data-date]");if(!n||n.disabled)return;let a=n.getAttribute("data-date");if(a)if(this.#n!=="none")this.#J(a);else{let i=this.#S.dayToEvents.get(a)||[];i.length&&this.#Z(a,i.map(o=>o.evt))}}),this.listen(this.#s,"keydown",e=>this.#tt(e)),this.listen(this.#s,"focusin",e=>{let n=e.target?.closest?.("button[data-date]");n&&(this.#k=n.getAttribute("data-date"),this.#q())}),this.listen(this,"keydown",e=>{e.key==="Escape"&&this.#C&&(e.stopPropagation(),this.#x(!0))}),this.#n==="range"&&this.listen(this.#s,"mouseover",e=>{let n=e.target?.closest("button[data-date]");n&&this.#a&&!this.#r&&(this.#w=I(n.getAttribute("data-date")),this.#I())})}#K(){let t=parseInt(this.getAttribute("data-year-range")??"",10);return Number.isFinite(t)&&t>=0?Math.min(t,200):10}#W(){this.#u.innerHTML="";let t=new Date().getFullYear(),e=this.#K(),s=Math.min(this.#e,this.#o?this.#o.getFullYear():t-e),n=Math.max(this.#e,this.#l?this.#l.getFullYear():t+e);for(let a=s;a<=n;a++){let i=document.createElement("option");i.value=String(a),i.textContent=String(a),a===this.#e&&(i.selected=!0),this.#u.appendChild(i)}}#z(t){this.#t+=t,this.#t<0&&(this.#t=11,this.#e--),this.#t>11&&(this.#t=0,this.#e++),this.#h(),this.dispatchEvent(new CustomEvent("calendar:navigate",{bubbles:!0,detail:{year:this.#e,month:this.#t+1}}))}#J(t){if(this.#n==="none")return;let e=I(t);if(e){if(this.#n==="single")this.#m=e,this.#I(),this.#B(),this.dispatchEvent(new CustomEvent("calendar:select",{bubbles:!0,detail:{value:t,date:e}}));else if(this.#n==="range"){if(!this.#a||this.#r)this.#a=e,this.#r=null,this.#w=null,this.setAttribute("data-tentative",x(this.#a));else{this.#r=e,this.#a&&this.#a>this.#r&&([this.#a,this.#r]=[this.#r,this.#a]),this.#w=null,this.removeAttribute("data-tentative");let s=x(this.#a),n=x(this.#r);this.dispatchEvent(new CustomEvent("calendar:select",{bubbles:!0,detail:{value:`${s}/${n}`,start:s,end:n,startDate:this.#a,endDate:this.#r}}))}this.#I(),this.#B()}else if(this.#n==="multi"){this.#d.has(t)?this.#d.delete(t):this.#d.add(t),this.#I(),this.#B();let s=[...this.#d].sort();this.dispatchEvent(new CustomEvent("calendar:select",{bubbles:!0,detail:{values:s,dates:s.map(I)}}))}}}#B(){this.#c&&this.getAttribute("name")&&this.#c.setFormValue(this.value)}get value(){switch(this.#n){case"single":return this.#m?x(this.#m):null;case"range":return this.#a&&this.#r?`${x(this.#a)}/${x(this.#r)}`:this.#a?x(this.#a):null;case"multi":return this.#d.size?[...this.#d].sort().join(" "):null;default:return null}}#I(){if(!this.#s)return;let t=this.#a,e=this.#r||this.#w;for(let s of this.#s.querySelectorAll("td")){let n=s.querySelector("button[data-date]");if(!n)continue;let a=n.getAttribute("data-date"),i=I(a);if(!(!i||!a)){if(s.removeAttribute("data-selected"),s.removeAttribute("data-range-start"),s.removeAttribute("data-range-end"),s.removeAttribute("data-in-range"),this.#n==="single"&&k(i,this.#m)&&s.setAttribute("data-selected",""),this.#n==="multi"&&this.#d.has(a)&&s.setAttribute("data-selected",""),this.#n==="range"&&t)if(e){let o=t<e?t:e,c=t<e?e:t;k(i,o)&&s.setAttribute("data-range-start",""),k(i,c)&&s.setAttribute("data-range-end",""),i>=o&&i<=c&&s.setAttribute("data-in-range","")}else k(i,t)&&s.setAttribute("data-range-start","");this.#N(s)}}}#N(t){if(this.#n==="none"){t.removeAttribute("aria-selected");return}let e=t.hasAttribute("data-selected")||t.hasAttribute("data-in-range")||t.hasAttribute("data-range-start")||t.hasAttribute("data-range-end");t.setAttribute("aria-selected",String(e))}#q(){if(!this.#s)return;let t=[...this.#s.querySelectorAll("button[data-date]")],e=t.filter(i=>!i.disabled),s=i=>i?e.find(o=>o.getAttribute("data-date")===i):void 0,n=null;this.#n==="single"&&this.#m?n=x(this.#m):this.#n==="range"&&this.#a?n=x(this.#a):this.#n==="multi"&&this.#d.size&&(n=[...this.#d].sort()[0]);let a=s(this.#k)||s(n)||e.find(i=>i.getAttribute("aria-current")==="date")||e[0];for(let i of t)i.setAttribute("tabindex",i===a?"0":"-1")}#F(t){let e=new Date(this.#e,this.#t+t,1);return{year:e.getFullYear(),month:e.getMonth()}}#X(){let t=new Map,e=[];for(let[s,n]of Object.entries(this.#A||{})){let a=tt(n);for(let i of a){let o=X(i,s);if(!o)continue;let c=o.days>1;c&&e.push({evt:i,range:o});for(let b=new Date(o.start),f=0;f<o.days;b=_(b,1),f++){let u=x(b),h={evt:i,range:o,isSpan:c,isStart:u===o.startISO,isEnd:u===o.endISO};t.has(u)||t.set(u,[]),t.get(u).push(h)}}}return{dayToEvents:t,spans:e}}#h(){let t=this.#L;this.#S=this.#X();let e=new Intl.DateTimeFormat(this.#i,{month:"long"}),s=new Intl.DateTimeFormat(this.#i,{month:"long",year:"numeric"});try{let a=new Date(this.#e,this.#t,1);if(t===1)this.#b.textContent=e.format(a),this.#f&&(this.#f.style.display="");else{let i=this.#F(t-1);a.getFullYear()===i.year?this.#b.textContent=String(this.#e):this.#b.textContent=`${a.getFullYear()} \u2013 ${i.year}`,this.#f&&(this.#f.style.display="none")}}catch{this.#b.textContent=String(this.#t+1)}this.#W(),this.#g.disabled=!!(this.#o&&(this.#e<this.#o.getFullYear()||this.#e===this.#o.getFullYear()&&this.#t<=this.#o.getMonth()));let n=this.#F(t-1);this.#y.disabled=!!(this.#l&&(n.year>this.#l.getFullYear()||n.year===this.#l.getFullYear()&&n.month>=this.#l.getMonth())),this.#Y=!0,this.setAttribute("data-month",String(this.#t+1)),this.setAttribute("data-year",String(this.#e)),this.#Y=!1,this.#s.innerHTML="";for(let a=0;a<t;a++){let{year:i,month:o}=this.#F(a);if(t>1){let c=document.createElement("div");c.className="cal-month-column";let b=parseInt(this.getAttribute("data-heading-level")??"",10),f=document.createElement(b>=1&&b<=6?`h${b}`:"span");f.className="cal-month-title",f.textContent=s.format(new Date(i,o,1)),c.appendChild(f);let u=this.#R(i,o);c.appendChild(u),this.#s.appendChild(c)}else{let c=this.#R(i,o);this.#s.appendChild(c)}}this.#U=this.#s.querySelector("table"),this.#q()}#R(t,e){let s=new Date,n=O(t,e),a=this.#j==="large",i=document.createElement("table");i.setAttribute("role","grid"),(this.#n==="multi"||this.#n==="range")&&i.setAttribute("aria-multiselectable","true");try{let y=new Date(t,e,1);i.setAttribute("aria-label",new Intl.DateTimeFormat(this.#i,{month:"long",year:"numeric"}).format(y))}catch{}let o=document.createElement("thead"),c=document.createElement("tr"),b=U(this.#i,"short"),f=U(this.#i,"long");for(let y=0;y<7;y++){let A=(this.#M+y)%7,w=document.createElement("th");w.setAttribute("scope","col"),w.setAttribute("abbr",f[A]),w.textContent=b[A],c.appendChild(w)}o.appendChild(c),i.appendChild(o);let u=document.createElement("tbody"),h=1,g=document.createElement("tr");g.setAttribute("data-week",String(h));let l=(new Date(t,e,1).getDay()-this.#M+7)%7,d=O(t,e-1);for(let y=0;y<l;y++){let A=d-l+1+y,w=document.createElement("td");w.setAttribute("data-outside-month","");let p=document.createElement("button");p.type="button",p.disabled=!0,p.setAttribute("tabindex","-1"),p.setAttribute("data-day",String(A));let D=document.createElement("span");D.className="day-number",D.textContent=String(A),p.appendChild(D),w.appendChild(p),g.appendChild(w)}let v=this.#a,m=this.#r||this.#w;for(let y=1;y<=n;y++){let A=new Date(t,e,y),w=x(A),p=document.createElement("td"),D=document.createElement("button");D.type="button",D.setAttribute("data-date",w);let B=document.createElement("span");if(B.className="day-number",B.textContent=String(y),D.appendChild(B),D.setAttribute("data-day",String(y)),k(A,s)&&(D.setAttribute("aria-current","date"),p.setAttribute("data-today","")),this.#n==="single"&&k(A,this.#m)&&p.setAttribute("data-selected",""),this.#n==="multi"&&this.#d.has(w)&&p.setAttribute("data-selected",""),this.#n==="range"&&v&&m){let M=v<m?v:m,P=v<m?m:v;k(A,M)&&p.setAttribute("data-range-start",""),k(A,P)&&p.setAttribute("data-range-end",""),A>=M&&A<=P&&p.setAttribute("data-in-range","")}else this.#n==="range"&&v&&k(A,v)&&p.setAttribute("data-range-start","");this.#N(p);let G=this.#o&&A<this.#o,K=this.#l&&A>this.#l,W=typeof this.isDateDisallowed=="function"&&this.isDateDisallowed(A);if((this.#T.has(w)||G||K||W)&&(D.setAttribute("aria-disabled","true"),D.disabled=!0),this.#$.has(w)&&D.setAttribute("data-highlight",this.#$.get(w)||""),typeof this.getDayParts=="function"){let M=this.getDayParts(A);M!=null&&(p.dataset.dayPart=Array.isArray(M)?M.join(" "):M)}let T=this.#S.dayToEvents.get(w)||[];if(T.length){p.setAttribute("data-events",""),p.setAttribute("data-event-count",String(T.length));let M=a?T.filter(C=>!C.isSpan):T,P=T.map(C=>C.evt);if(a){if(M.length){let C=document.createElement("span");C.className="event-list";let L=2;if(M.slice(0,L).forEach(({evt:S})=>{let F=document.createElement("span");if(F.className="event-item",S.color&&F.style.setProperty("--event-color",S.color),S.icon){let q=document.createElement("icon-wc");q.setAttribute("name",S.icon),q.setAttribute("size","xs"),F.appendChild(q)}let V=document.createElement("span");V.textContent=S.time?`${S.time} ${S.label}`:S.label,F.appendChild(V),C.appendChild(F)}),M.length>L){let S=document.createElement("span");S.className="event-more",S.textContent=this.#D("More","+{n} more").replace("{n}",String(M.length-L)),C.appendChild(S)}D.appendChild(C)}}else{let C=document.createElement("span");C.className="event-dots",C.setAttribute("aria-hidden","true");let L=Math.min(T.length,3);for(let S=0;S<L;S++){let F=document.createElement("span");F.setAttribute("data-event-dot",""),T[S].evt.color&&F.style.setProperty("--event-color",T[S].evt.color),C.appendChild(F)}p.appendChild(C)}let J=P.map(C=>C.time?`${C.time} \u2014 ${C.label}`:C.label);D.setAttribute("title",J.join(`
|
|
2
|
+
`))}D.setAttribute("tabindex","-1"),p.insertBefore(D,p.firstChild),g.appendChild(p),(l+y)%7===0&&(u.appendChild(g),h++,g=document.createElement("tr"),g.setAttribute("data-week",String(h)))}let $=(l+n)%7;if($>0){for(let y=1;y<=7-$;y++){let A=document.createElement("td");A.setAttribute("data-outside-month","");let w=document.createElement("button");w.type="button",w.disabled=!0,w.setAttribute("tabindex","-1"),w.setAttribute("data-day",String(y));let p=document.createElement("span");p.className="day-number",p.textContent=String(y),w.appendChild(p),A.appendChild(w),g.appendChild(A)}u.appendChild(g)}return i.appendChild(u),a&&this.#S.spans.length&&this.#Q(u,t,e),i}#Q(t,e,s){let n=[...t.querySelectorAll("tr")],a=new Intl.DateTimeFormat(this.#i,{month:"short",day:"numeric"});for(let i of n){let o=[...i.querySelectorAll("td")];if(!o.length)continue;let c=o.findIndex(l=>l.querySelector("button[data-date]")),b=o.map((l,d)=>{let v=l.querySelector("button"),m=v?.getAttribute("data-date");if(m)return I(m);let $=parseInt(v?.getAttribute("data-day")||"0",10);return c>=0&&d<c?new Date(e,s-1,$):new Date(e,s+1,$)}),f=b[0],u=b[b.length-1];if(!f||!u)continue;let h=[];for(let{evt:l,range:d}of this.#S.spans){if(d.end<f||d.start>u)continue;let v=d.start<f?0:b.findIndex($=>k($,d.start)),m=d.end>u?b.length-1:b.findIndex($=>k($,d.end));v<0||m<0||h.push({evt:l,range:d,startCol:v,endCol:m,continuesLeft:d.start<f,continuesRight:d.end>u})}if(!h.length)continue;h.sort((l,d)=>l.startCol-d.startCol||d.endCol-d.startCol-(l.endCol-l.startCol));let g=[];for(let l of h){let d=0;for(;d<g.length&&g[d]>=l.startCol;)d++;l.lane=d,g[d]=l.endCol}let E=g.length;i.style.setProperty("--cal-row-lanes",String(E)),i.setAttribute("data-row-lanes",String(E));for(let l of h){let d=o[l.startCol],v=l.endCol-l.startCol+1,m=document.createElement("span");m.className="event-span",m.style.setProperty("--span-cells",String(v)),m.style.setProperty("--span-lane",String(l.lane)),l.evt.color&&m.style.setProperty("--event-color",l.evt.color),l.continuesLeft&&m.setAttribute("data-continues-start",""),l.continuesRight&&m.setAttribute("data-continues-end",""),m.textContent=l.evt.label||"",m.setAttribute("title",`${l.evt.label} \u2014 ${a.format(l.range.start)} to ${a.format(l.range.end)}`),d.appendChild(m)}}}#Z(t,e){this.#x();let s=I(t)??new Date,n=document.createElement("div");n.className="day-detail",n.setAttribute("role","dialog");let a=`calendar-wc-detail-${++Z}`;n.setAttribute("aria-labelledby",a);let i=document.createElement("header"),o=document.createElement("h3");o.id=a;try{o.textContent=new Intl.DateTimeFormat(this.#i,{weekday:"long",month:"long",day:"numeric",year:"numeric"}).format(s)}catch{o.textContent=t}let c=document.createElement("button");if(c.type="button",c.setAttribute("aria-label",this.#D("Close","Close")),c.textContent="\xD7",c.addEventListener("click",()=>this.#x(!0)),i.append(o,c),n.appendChild(i),e.some(h=>h.time)){let h=document.createElement("day-view");h.dataset.date=t,h.dataset.startHour="auto",h.dataset.compact="";let g=new Intl.DateTimeFormat(this.#i,{hour:"numeric",minute:"2-digit"});e.forEach(E=>{let l=document.createElement("calendar-event");if(E.color&&l.style.setProperty("--event-color",E.color),E.icon){let d=document.createElement("icon-wc");d.setAttribute("name",E.icon),d.setAttribute("size","sm"),l.appendChild(d)}if(E.time){let d=document.createElement("time");d.setAttribute("datetime",E.time);try{let[v,m]=E.time.split(":"),$=new Date(2026,0,1,parseInt(v,10),parseInt(m,10));d.textContent=g.format($)}catch{d.textContent=E.time}l.appendChild(d)}l.append(E.label||""),h.appendChild(l)}),n.appendChild(h)}else{let h=document.createElement("ul");h.className="detail-list",e.forEach(g=>{let E=document.createElement("li");g.color&&E.style.setProperty("--event-color",g.color);let l=document.createElement("span");l.className="detail-dot";let d=document.createElement("span");if(d.className="detail-content",g.icon){let m=document.createElement("icon-wc");m.setAttribute("name",g.icon),m.setAttribute("size","sm"),d.appendChild(m)}let v=document.createElement("span");v.className="detail-label",v.textContent=g.label||"",d.append(v),E.append(l,d),h.appendChild(E)}),n.appendChild(h)}this.#_=this.#s.querySelector(`button[data-date="${t}"]`),this.appendChild(n),this.#C=n,c.focus();let f=h=>{n.contains(h.target)||this.#x(!1)},u=0;this._detailCleanup=()=>{cancelAnimationFrame(u),document.removeEventListener("mousedown",f)},u=requestAnimationFrame(()=>{document.addEventListener("mousedown",f)}),this.dispatchEvent(new CustomEvent("calendar:day-open",{bubbles:!0,detail:{date:t,events:e}}))}#x(t=!1){if(this.#C){this._detailCleanup?.(),this._detailCleanup=null,this.#C.remove(),this.#C=null;let e=this.#_;this.#_=null,t&&e?.isConnected&&e.focus()}}teardown(){this.removeAttribute("data-tentative"),this.#x(),this.#E?.remove(),this.#O?.remove(),this.#s?.remove(),this.#E=this.#O=this.#s=null,this.#p=!1}#tt(t){let e={ArrowRight:1,ArrowLeft:-1,ArrowDown:7,ArrowUp:-7},s=["Home","End","PageUp","PageDown"],n=e[t.key];if(!n&&!s.includes(t.key))return;let i=t.target?.closest?.("button[data-date]");if(!i||!this.#s.contains(i))return;let o=I(i.getAttribute("data-date"));if(!o)return;t.preventDefault();let c;if(n)Math.abs(n)===1&&getComputedStyle(this).direction==="rtl"&&(n=-n),c=_(o,n);else if(t.key==="Home"||t.key==="End"){let b=(o.getDay()-this.#M+7)%7,f=O(o.getFullYear(),o.getMonth()),u=t.key==="Home"?Math.max(1,o.getDate()-b):Math.min(f,o.getDate()+6-b);c=new Date(o.getFullYear(),o.getMonth(),u),n=t.key==="Home"?1:-1}else{n=t.key==="PageDown"?1:-1;let b=n*(t.shiftKey?12:1),f=new Date(o.getFullYear(),o.getMonth()+b,1);c=new Date(f.getFullYear(),f.getMonth(),Math.min(o.getDate(),O(f.getFullYear(),f.getMonth())))}for(let b=0;b<366;b++,c=_(c,n)){if(this.#o&&c<this.#o||this.#l&&c>this.#l)return;let f=c.getMonth(),u=c.getFullYear(),h=this.#F(this.#L-1),g=(u>this.#e||u===this.#e&&f>=this.#t)&&(u<h.year||u===h.year&&f<=h.month),E=x(c);g||(this.#t=f,this.#e=u,this.#k=E,this.#h());let l=this.#s.querySelector(`button[data-date="${E}"]`);if(l&&!l.disabled){this.#k=E,this.#q(),l.focus();return}}}};N("calendar-wc",H);export{H as CalendarWc};
|
|
3
3
|
//# sourceMappingURL=calendar-wc.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var D="http://www.w3.org/1999/xhtml",A="http://www.w3.org/2000/svg",F="http://www.w3.org/1998/Math/MathML",U=new Set([D,A,F]),S="user-content-",q=new Set(["script","iframe","frame","frameset","object","embed","applet","portal","fencedframe","form","base","link","meta","noscript","foreignobject","style","xmp","noembed","noframes","plaintext","mglyph","malignmark","annotation-xml"]),k=new Set(["title","desc"]),B=new Set(["animate","set","animatemotion","animatetransform"]),H=new Set(["href","xlink:href","action","formaction","data","codebase","cite","background","longdesc","manifest","to","from","values","by"]),j=new Set(["src","poster","srcset"]),P=new Set(["srcdoc","form","formaction","formmethod","formtarget","formenctype","formnovalidate","action","method","ping"]),W=new Set(["popovertarget","popovertargetaction","commandfor","command","interestfor","autofocus"]),V=new Set(["for","headers","list","aria-labelledby","aria-describedby","aria-controls","aria-owns","aria-flowto","aria-details","aria-errormessage","aria-activedescendant"]),G={"include-file":["trusted","allow-scripts","allow-cross-origin"],"markdown-viewer":["src","sanitize","ping","allow-cross-origin"]},K=new Set(["social-embed","youtube-player","geo-map"]),Z=["src","src-dark","data-src","url","endpoint","tile-url","data-versions"],J=new Set(["audio-player","video-player","image-map","brand-mark"]);function X(r){return String(r).replace(/[\u0000- \u007f-\u009f]/g,"").toLowerCase()}function v(r,t=!1){let e=X(r);return t?/(^|,)(javascript|vbscript|livescript):/.test(e)?!0:/(^|,)data:/.test(e)?e.split(/(?=data:)/).filter(i=>i.startsWith("data:")).some(i=>!/^data:(image|audio|video|font)\//.test(i)):!1:/^(javascript|vbscript|livescript|data):/.test(e)}function M(r){let t=String(r).replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\/g,"").replace(/\s+/g,"").toLowerCase();return/expression\(|javascript:|vbscript:|-moz-binding|behavior:|@import|position:fixed/.test(t)}var Y=r=>String(r.localName||r.tagName||"").toLowerCase(),Q=r=>r.startsWith(S)?r:S+r;function tt(r,t){if(q.has(t))return!0;let e=r.namespaceURI;return!!(e&&!U.has(e)||t==="title"&&e!==A||k.has(t)&&e===A&&r.children?.length||B.has(t)&&(r.getAttribute("attributeName")||r.getAttribute("attributename")||"").toLowerCase().includes("href"))}function et(r,t){for(let e of[...r.attributes]){let n=e.name.toLowerCase();if(n.startsWith("on")||P.has(n)||!t.keepIds&&W.has(n)){r.removeAttribute(e.name);continue}if(n==="style"){(!t.keepStyle||M(e.value))&&r.removeAttribute(e.name);continue}if((n==="id"||n==="name")&&!t.keepIds){let i=Q(e.value);n==="id"?t.ids.set(e.value,i):t.ids.set(`name:${e.value}`,i),r.setAttribute(e.name,i);continue}if(H.has(n)||n.endsWith(":href")){v(e.value,!1)&&r.removeAttribute(e.name);continue}j.has(n)&&v(e.value,!0)&&r.removeAttribute(e.name)}}function rt(r,t){let e=(r.getAttribute("type")||"").toLowerCase();t==="button"&&e!=="button"&&r.setAttribute("type","button"),t==="input"&&/^(submit|reset|image)$/.test(e)&&r.setAttribute("type","button")}function nt(r,t){for(let e of r)for(let n of[...e.attributes]){let i=n.name.toLowerCase(),s=n.value;if((i==="href"||i.endsWith(":href"))&&s.startsWith("#")){let o=it(s.slice(1));t.has(o)&&e.setAttribute(n.name,`#${t.get(o)}`)}else if(i==="usemap"&&s.startsWith("#")){let o=t.get(`name:${s.slice(1)}`);o?e.setAttribute(n.name,`#${o}`):e.removeAttribute(n.name)}else if(V.has(i)){let o=s.split(/\s+/).filter(Boolean).map(a=>t.get(a)||(a.startsWith(S)?a:null)).filter(Boolean);o.length?e.setAttribute(n.name,o.join(" ")):e.removeAttribute(n.name)}else s.includes("url(#")&&e.setAttribute(n.name,s.replace(/url\(#([^)]+)\)/g,(o,a)=>t.has(a)?`url(#${t.get(a)})`:o))}}function it(r){try{return decodeURIComponent(r)}catch{return r}}function $(r){let t=r.childNodes;if(t)for(let e of[...t])e.nodeType===8?e.remove():(e.nodeType===1||e.nodeType===11)&&$(e)}function L(r,t){$(r);let e=[...r.querySelectorAll("*")];t.includeRoot&&e.unshift(r);let n=new Map,i=[],s={...t,ids:n};for(let o of e){if(!ot(o,r))continue;let a=Y(o);if(t.svgOnly&&(k.has(a)||a==="style")){if(a==="style"&&M(o.textContent||"")){o.remove();continue}}else if(tt(o,a)){o.remove();continue}if(!t.keepIds&&!t.svgOnly&&K.has(a)){st(o);continue}if(a==="template"){let l=o.content;l&&L(l,{...t,includeRoot:!1})}et(o,s),t.keepIds||rt(o,a);let u=G[a];if(u)for(let l of u)o.removeAttribute(l);if(a==="include-file"&&!t.allowIncludeFile&&o.removeAttribute("src"),!t.keepIds&&!t.svgOnly&&a.includes("-")&&a!=="include-file"&&!J.has(a))for(let l of Z)o.removeAttribute(l);i.push(o)}!t.keepIds&&n.size&&nt(i,n)}function st(r){let t=r.parentNode;if(t){for(let e of[...r.childNodes])t.insertBefore(e,r);r.remove()}}function ot(r,t){let e=r;for(;e;){if(e===t)return!0;e=e.parentNode??e.parent??null}return!1}function g(r,t={}){let e=document.createElement("template");return r&&typeof r=="string"&&(e.innerHTML=r,L(e.content,{allowIncludeFile:!!t.allowIncludeFile,keepIds:!!t.keepIds,keepStyle:!!t.keepStyle})),e.content}function T(r){let t=document.createElement("template");return t.content.append(r),t.innerHTML}function at(r,t={}){if(!r||typeof r!="string")return"";let e=T(g(r,t));for(let n=0;n<4;n++){let i=T(g(e,t));if(i===e)return e;e=i}return""}var bt=window.matchMedia("(prefers-reduced-motion: reduce)");var _=new Map;function C(r,t,e={}){let n=e.priority??10,i={impl:t,bundle:e.bundle,contract:e.contract,priority:n},s=_.get(r);if(customElements.get(r)){if(!s||s.priority>=n){s&&s.priority===n&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=n){s.priority===n&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}_.set(r,i),customElements.define(r,t)}var y=class extends HTMLElement{#e=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}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.#e)t();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,n,i){t.addEventListener(e,n,i),this.#e.push(()=>t.removeEventListener(e,n,i))}_reinit(){for(let t of this.#e)t();this.#e=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#t||(this.#t=this.attachInternals());let n=this.#t.states;try{e?n.add(t):n.delete(t)}catch{let i=`--${t}`;e?n.add(i):n.delete(i)}}_adoptInternals(t){this.#t||(this.#t=t)}#r(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#r()?.validity}get validationMessage(){return this.#r()?.validationMessage??""}get willValidate(){return this.#r()?.willValidate??!1}get form(){return this.#r()?.form??null}checkValidity(){return this.#r()?.checkValidity()??!0}reportValidity(){return this.#r()?.reportValidity()??!0}};function N({newItems:r,nodes:t,keyOf:e,renderItem:n,containerFor:i}){let s=[],o=[],a=[],u=new Set;for(let c of r)u.add(e(c));for(let[c,d]of[...t])u.has(c)||(d.remove(),t.delete(c),a.push(c));let l=new Map;for(let c of r){let d=e(c),f=t.get(d)||null,m=i(c,f);l.has(m)||l.set(m,[]),l.get(m)?.push({item:c,key:d,existing:f})}for(let[c,d]of l)for(let f=0;f<d.length;f++){let{item:m,key:b,existing:z}=d[f],h=z;h?(h.parentElement!==c||c.children[f]!==h)&&o.push(b):(h=n(m),t.set(b,h),s.push(b));let E=c.children[f];E!==h&&c.insertBefore(h,E||null)}return{added:s,moved:o,removed:a}}var ct=/^[a-zA-Z_$][a-zA-Z0-9_$]*(\.[a-zA-Z_$][a-zA-Z0-9_$]*|\[\d+\])*$/;function R(r){return!r||typeof r!="string"?!1:ct.test(r.trim())}function p(r,t){if(!R(t)){console.warn(`[card-list] Unsafe property path rejected: "${t}"`);return}let n=String(t).replace(/\[(\d+)\]/g,".$1").split("."),i=r;for(let s of n){if(i==null)return;i=i[s]}return i}function lt(r){return r?r.split(",").map(t=>{let[e,n]=t.split(":").map(i=>i.trim());return{attr:(e||"").toLowerCase(),path:n}}).filter(({attr:t,path:e})=>t&&e):[]}var ut=new Set(["href","src","action","formaction","xlink:href","poster","cite","background","ping","data","manifest","longdesc","codebase"]),I=new Set(["srcdoc","style","is"]),ft=new Set(["http:","https:","mailto:","tel:"]);function O(r){let t=String(r).replace(/[\u0000-\u0020\u007f]+/g,"");if(!t)return!0;let e=/^([a-z][a-z0-9+.-]*):/i.exec(t);return e?ft.has(`${e[1].toLowerCase()}:`):!0}function dt(r){return String(r).split(",").every(t=>O(t.trim().split(/\s+/)[0]||""))}function ht(r,t){return r.startsWith("on")||I.has(r)||!/^[a-z_][a-z0-9_.:-]*$/.test(r)?!1:r==="srcset"||r==="imagesrcset"?dt(t):ut.has(r)?O(t):!0}function mt(r,t){let e=new Set;return r.map((n,i)=>{let s=n!=null&&typeof n=="object"?n[t]:void 0,o=s==null?null:`k:${String(s)}`;return o==null||e.has(o)?`i:${i}`:(e.add(o),o)})}var x=":scope > [data-card-list-status]",w=class extends y{#e=null;#t=[];#r="id";#c=new Map;#o=!1;#a=null;#n=null;static get observedAttributes(){return["src","data-items","data-key"]}setup(){if(this.#e=this.querySelector(":scope > template")||this.querySelector("template"),!this.#e)return console.warn("[card-list] No template found"),!1;if(this.#r=this.getAttribute("data-key")||"id",this.#o)return this.#a&&this.#s(this.#a),this.#a=null,!0;let t=this.getAttribute("data-items");if(t)return this.#f(t),!0;let e=this.getAttribute("src");return e&&this.#h(e),!0}teardown(){this.#i()}attributeChangedCallback(t,e,n){e!==n&&this.hasAttribute("data-upgraded")&&(t==="data-items"?n&&this.#f(n):t==="src"?n?this.#h(n):this.#i():t==="data-key"&&(this.#r=n||"id",this.#s("attribute")))}#f(t){this.#i();try{let e=JSON.parse(t);this.#t=Array.isArray(e)?e:[],this.#o=!0,this.#s("attribute")}catch(e){console.error("[card-list] Invalid JSON in data-items:",e)}}#i(){this.#n&&(this.#n.abort(),this.#n=null,this.removeAttribute("data-loading"),this.removeAttribute("aria-busy"),this.#l(""))}#d(){let t=this.querySelector(x);return t||(t=document.createElement("p"),t.setAttribute("role","status"),t.setAttribute("data-card-list-status",""),this.append(t)),t}#l(t){let e=this.querySelector(x);!e&&!t||((e||this.#d()).textContent=t)}async#h(t){this.#i();let e=new AbortController;this.#n=e,this.removeAttribute("data-error"),this.setAttribute("data-loading",""),this.setAttribute("aria-busy","true"),this.#d().textContent="Loading\u2026";try{let n=await fetch(t,{signal:e.signal});if(!n.ok)throw new Error(`HTTP ${n.status}`);let i=await n.json();if(e.signal.aborted)return;this.#t=Array.isArray(i)?i:i?.items||i?.data||[],this.#o=!0,this.#l(""),this.#s("attribute")}catch(n){if(e.signal.aborted)return;let i=n instanceof Error?n.message:String(n);console.error("[card-list] Fetch error:",n),this.setAttribute("data-error",i),this.#l(`Error: ${i}`)}finally{this.#n===e&&(this.#n=null,this.removeAttribute("data-loading"),this.removeAttribute("aria-busy"))}}#s(t){if(!this.#e)return;this.querySelectorAll(":scope > [data-fallback]").forEach(i=>i.remove());let e=this.#e;if([...e.content.children].length!==1){this.querySelectorAll(":scope > :not(template, [data-card-list-status])").forEach(s=>s.remove()),this.#c.clear();let i=document.createDocumentFragment();for(let s of this.#t){let o=e.content.cloneNode(!0);this.#u(o,s),i.appendChild(o)}this.prepend(i)}else{let i=mt(this.#t,this.#r),s=this.#t.map((u,l)=>({item:u,key:i[l]})),o=N({newItems:s,nodes:this.#c,keyOf:u=>u.key,renderItem:u=>{let c=e.content.cloneNode(!0).firstElementChild;return this.#u(c,u.item),c},containerFor:()=>this}),a=new Set(o.added);for(let{item:u,key:l}of s){if(a.has(l))continue;let c=this.#c.get(l);c&&this.#u(c,u)}}this.dispatchEvent(new CustomEvent("card-list:rendered",{detail:{count:this.#t.length},bubbles:!0})),this.dispatchEvent(new CustomEvent("card-list:items-changed",{detail:{items:this.#t,source:t},bubbles:!0}))}#u(t,e){let n=i=>{let s=[...t.querySelectorAll(i)];return t instanceof Element&&t.matches(i)&&s.unshift(t),s};n("[data-field]").forEach(i=>{let s=p(e,i.getAttribute("data-field"));i.textContent=s??""}),n("[data-field-attr]").forEach(i=>{for(let{attr:s,path:o}of lt(i.getAttribute("data-field-attr"))){if(!R(o))continue;let a=p(e,o);if(s.startsWith("on")||I.has(s)){console.warn(`[card-list] Refusing to bind "${s}" from data`);continue}let u=s.startsWith("aria-");a==null||a===!1&&!u?i.removeAttribute(s):ht(s,a)?i.setAttribute(s,a===!0&&!u?"":String(a)):(console.warn(`[card-list] Unsafe value refused for "${s}"`),i.removeAttribute(s))}}),n("[data-field-html]").forEach(i=>{i.replaceChildren(g(p(e,i.getAttribute("data-field-html"))))}),n("[data-field-if]").forEach(i=>{i.hidden=!p(e,i.getAttribute("data-field-if"))}),n("[data-field-unless]").forEach(i=>{i.hidden=!!p(e,i.getAttribute("data-field-unless"))})}get items(){return this.#t}set items(t){this.#i(),this.#t=Array.isArray(t)?t:[],this.#o=!0,this.#e&&this.hasAttribute("data-upgraded")?this.#s("api"):this.#a="api"}};C("card-list",w);export{w as CardList,p as getValueByPath,ht as isSafeAttrBinding,O as isSafeUrl,R as isValidPath,at as sanitizeHTML};
|
|
1
|
+
var F="http://www.w3.org/1999/xhtml",A="http://www.w3.org/2000/svg",z="http://www.w3.org/1998/Math/MathML",H=new Set([F,A,z]),S="user-content-",q=new Set(["script","iframe","frame","frameset","object","embed","applet","portal","fencedframe","form","base","link","meta","noscript","foreignobject","style","xmp","noembed","noframes","plaintext","mglyph","malignmark","annotation-xml"]),$=new Set(["title","desc"]),D=new Set(["animate","set","animatemotion","animatetransform"]),j=new Set(["href","xlink:href","action","formaction","data","codebase","cite","background","longdesc","manifest","to","from","values","by"]),U=new Set(["src","poster","srcset"]),W=new Set(["srcdoc","form","formaction","formmethod","formtarget","formenctype","formnovalidate","action","method","ping"]),V=new Set(["popovertarget","popovertargetaction","commandfor","command","interestfor","autofocus"]),K=new Set(["for","headers","list","aria-labelledby","aria-describedby","aria-controls","aria-owns","aria-flowto","aria-details","aria-errormessage","aria-activedescendant"]),G={"include-file":["trusted","allow-scripts","allow-cross-origin"],"markdown-viewer":["src","sanitize","ping","allow-cross-origin"]},N=new Set(["social-embed","youtube-player","geo-map"]),Z=["src","src-dark","data-src","url","endpoint","tile-url","data-versions"],J=new Set(["audio-player","video-player","image-map","brand-mark"]);function X(r){return String(r).replace(/[\u0000- \u007f-\u009f]/g,"").toLowerCase()}function w(r,t=!1){let e=X(r);return t?/(^|,)(javascript|vbscript|livescript):/.test(e)?!0:/(^|,)data:/.test(e)?e.split(/(?=data:)/).filter(i=>i.startsWith("data:")).some(i=>!/^data:(image|audio|video|font)\//.test(i)):!1:/^(javascript|vbscript|livescript|data):/.test(e)}function k(r){let t=String(r).replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\/g,"").replace(/\s+/g,"").toLowerCase();return/expression\(|javascript:|vbscript:|-moz-binding|behavior:|@import|position:fixed/.test(t)}var Y=r=>String(r.localName||r.tagName||"").toLowerCase(),Q=r=>r.startsWith(S)?r:S+r;function tt(r,t){if(q.has(t))return!0;let e=r.namespaceURI;return!!(e&&!H.has(e)||t==="title"&&e!==A||$.has(t)&&e===A&&r.children?.length||D.has(t)&&(r.getAttribute("attributeName")||r.getAttribute("attributename")||"").toLowerCase().includes("href"))}function et(r,t){for(let e of[...r.attributes]){let n=e.name.toLowerCase();if(n.startsWith("on")||W.has(n)||!t.keepIds&&V.has(n)){r.removeAttribute(e.name);continue}if(n==="style"){(!t.keepStyle||k(e.value))&&r.removeAttribute(e.name);continue}if((n==="id"||n==="name")&&!t.keepIds){let i=Q(e.value);n==="id"?t.ids.set(e.value,i):t.ids.set(`name:${e.value}`,i),r.setAttribute(e.name,i);continue}if(j.has(n)||n.endsWith(":href")){w(e.value,!1)&&r.removeAttribute(e.name);continue}U.has(n)&&w(e.value,!0)&&r.removeAttribute(e.name)}}function rt(r,t){let e=(r.getAttribute("type")||"").toLowerCase();t==="button"&&e!=="button"&&r.setAttribute("type","button"),t==="input"&&/^(submit|reset|image)$/.test(e)&&r.setAttribute("type","button")}function nt(r,t){for(let e of r)for(let n of[...e.attributes]){let i=n.name.toLowerCase(),s=n.value;if((i==="href"||i.endsWith(":href"))&&s.startsWith("#")){let o=it(s.slice(1));t.has(o)&&e.setAttribute(n.name,`#${t.get(o)}`)}else if(i==="usemap"&&s.startsWith("#")){let o=t.get(`name:${s.slice(1)}`);o?e.setAttribute(n.name,`#${o}`):e.removeAttribute(n.name)}else if(K.has(i)){let o=s.split(/\s+/).filter(Boolean).map(a=>t.get(a)||(a.startsWith(S)?a:null)).filter(Boolean);o.length?e.setAttribute(n.name,o.join(" ")):e.removeAttribute(n.name)}else s.includes("url(#")&&e.setAttribute(n.name,s.replace(/url\(#([^)]+)\)/g,(o,a)=>t.has(a)?`url(#${t.get(a)})`:o))}}function it(r){try{return decodeURIComponent(r)}catch{return r}}function C(r){let t=r.childNodes;if(t)for(let e of[...t])e.nodeType===8?e.remove():(e.nodeType===1||e.nodeType===11)&&C(e)}function M(r,t){C(r);let e=[...r.querySelectorAll("*")];t.includeRoot&&e.unshift(r);let n=new Map,i=[],s={...t,ids:n};for(let o of e){if(!ot(o,r))continue;let a=Y(o);if(t.svgOnly&&($.has(a)||a==="style")){if(a==="style"&&k(o.textContent||"")){o.remove();continue}}else if(tt(o,a)){o.remove();continue}if(!t.keepIds&&!t.svgOnly&&N.has(a)){st(o);continue}if(a==="template"){let u=o.content;u&&M(u,{...t,includeRoot:!1})}et(o,s),t.keepIds||rt(o,a);let l=G[a];if(l)for(let u of l)o.removeAttribute(u);if(a==="include-file"&&!t.allowIncludeFile&&o.removeAttribute("src"),!t.keepIds&&!t.svgOnly&&a.includes("-")&&a!=="include-file"&&!J.has(a))for(let u of Z)o.removeAttribute(u);i.push(o)}!t.keepIds&&n.size&&nt(i,n)}function st(r){let t=r.parentNode;if(t){for(let e of[...r.childNodes])t.insertBefore(e,r);r.remove()}}function ot(r,t){let e=r;for(;e;){if(e===t)return!0;e=e.parentNode??e.parent??null}return!1}function y(r,t={}){let e=document.createElement("template");return r&&typeof r=="string"&&(e.innerHTML=r,M(e.content,{allowIncludeFile:!!t.allowIncludeFile,keepIds:!!t.keepIds,keepStyle:!!t.keepStyle})),e.content}function T(r){let t=document.createElement("template");return t.content.append(r),t.innerHTML}function at(r,t={}){if(!r||typeof r!="string")return"";let e=T(y(r,t));for(let n=0;n<4;n++){let i=T(y(e,t));if(i===e)return e;e=i}return""}var At=window.matchMedia("(prefers-reduced-motion: reduce)");var x=new Map;function _(r,t,e={}){let n=e.priority??10,i={impl:t,bundle:e.bundle,contract:e.contract,priority:n},s=x.get(r);if(customElements.get(r)){if(!s||s.priority>=n){s&&s.priority===n&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=n){s.priority===n&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}x.set(r,i),customElements.define(r,t)}var g=class extends HTMLElement{#e=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}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.#e)t();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,n,i){t.addEventListener(e,n,i),this.#e.push(()=>t.removeEventListener(e,n,i))}_reinit(){for(let t of this.#e)t();this.#e=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#t||(this.#t=this.attachInternals());let n=this.#t.states;try{e?n.add(t):n.delete(t)}catch{let i=`--${t}`;e?n.add(i):n.delete(i)}}_adoptInternals(t){this.#t||(this.#t=t)}#r(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#r()?.validity}get validationMessage(){return this.#r()?.validationMessage??""}get willValidate(){return this.#r()?.willValidate??!1}get form(){return this.#r()?.form??null}checkValidity(){return this.#r()?.checkValidity()??!0}reportValidity(){return this.#r()?.reportValidity()??!0}};function L({newItems:r,nodes:t,keyOf:e,renderItem:n,containerFor:i}){let s=[],o=[],a=[],l=new Set;for(let c of r)l.add(e(c));for(let[c,f]of[...t])l.has(c)||(f.remove(),t.delete(c),a.push(c));let u=new Map;for(let c of r){let f=e(c),d=t.get(f)||null,p=i(c,d);u.has(p)||u.set(p,[]),u.get(p)?.push({item:c,key:f,existing:d})}for(let[c,f]of u)for(let d=0;d<f.length;d++){let{item:p,key:b,existing:B}=f[d],h=B;h?(h.parentElement!==c||c.children[d]!==h)&&o.push(b):(h=n(p),t.set(b,h),s.push(b));let E=c.children[d];E!==h&&c.insertBefore(h,E||null)}return{added:s,moved:o,removed:a}}var ct=/^[a-zA-Z_$][a-zA-Z0-9_$]*(\.[a-zA-Z_$][a-zA-Z0-9_$]*|\[\d+\])*$/;function I(r){return!r||typeof r!="string"?!1:ct.test(r.trim())}function m(r,t){if(!I(t)){console.warn(`[card-list] Unsafe property path rejected: "${t}"`);return}let n=String(t).replace(/\[(\d+)\]/g,".$1").split("."),i=r;for(let s of n){if(i==null)return;i=i[s]}return i}function ut(r){return r?r.split(",").map(t=>{let[e,n]=t.split(":").map(i=>i.trim());return{attr:(e||"").toLowerCase(),path:n}}).filter(({attr:t,path:e})=>t&&e):[]}var lt=new Set(["href","src","action","formaction","xlink:href","poster","cite","background","ping","data","manifest","longdesc","codebase"]),P=new Set(["srcdoc","style","is"]),dt=new Set(["http:","https:","mailto:","tel:"]);function O(r){let t=String(r).replace(/[\u0000-\u0020\u007f]+/g,"");if(!t)return!0;let e=/^([a-z][a-z0-9+.-]*):/i.exec(t);return e?dt.has(`${e[1].toLowerCase()}:`):!0}function ft(r){return String(r).split(",").every(t=>O(t.trim().split(/\s+/)[0]||""))}function ht(r,t){return r.startsWith("on")||P.has(r)||!/^[a-z_][a-z0-9_.:-]*$/.test(r)?!1:r==="srcset"||r==="imagesrcset"?ft(t):lt.has(r)?O(t):!0}function pt(r,t){let e=new Set;return r.map((n,i)=>{let s=n!=null&&typeof n=="object"?n[t]:void 0,o=s==null?null:`k:${String(s)}`;return o==null||e.has(o)?`i:${i}`:(e.add(o),o)})}var R=":scope > [data-card-list-status]",v=class extends g{#e=null;#t=[];#r="id";#c=new Map;#o=!1;#a=null;#n=null;static get observedAttributes(){return["src","data-items","data-key"]}setup(){if(this.#e=this.querySelector(":scope > template")||this.querySelector("template"),!this.#e)return console.warn("[card-list] No template found"),!1;if(this.#r=this.getAttribute("data-key")||"id",this.#o)return this.#a&&this.#s(this.#a),this.#a=null,!0;let t=this.getAttribute("data-items");if(t)return this.#d(t),!0;let e=this.getAttribute("src");return e&&this.#h(e),!0}teardown(){this.#i()}attributeChangedCallback(t,e,n){e!==n&&this.hasAttribute("data-upgraded")&&(t==="data-items"?n&&this.#d(n):t==="src"?n?this.#h(n):this.#i():t==="data-key"&&(this.#r=n||"id",this.#s("attribute")))}#d(t){this.#i();try{let e=JSON.parse(t);this.#t=Array.isArray(e)?e:[],this.#o=!0,this.#s("attribute")}catch(e){console.error("[card-list] Invalid JSON in data-items:",e)}}#i(){this.#n&&(this.#n.abort(),this.#n=null,this.removeAttribute("data-loading"),this.removeAttribute("aria-busy"),this.#u(""))}#f(){let t=this.querySelector(R);return t||(t=document.createElement("p"),t.setAttribute("role","status"),t.setAttribute("data-card-list-status",""),this.append(t)),t}#u(t){let e=this.querySelector(R);!e&&!t||((e||this.#f()).textContent=t)}async#h(t){this.#i();let e=new AbortController;this.#n=e,this.removeAttribute("data-error"),this.setAttribute("data-loading",""),this.setAttribute("aria-busy","true"),this.#f().textContent="Loading\u2026";try{let n=await fetch(t,{signal:e.signal});if(!n.ok)throw new Error(`HTTP ${n.status}`);let i=await n.json();if(e.signal.aborted)return;this.#t=Array.isArray(i)?i:i?.items||i?.data||[],this.#o=!0,this.#u(""),this.#s("attribute")}catch(n){if(e.signal.aborted)return;let i=n instanceof Error?n.message:String(n);console.error("[card-list] Fetch error:",n),this.setAttribute("data-error",i),this.#u(`Error: ${i}`)}finally{this.#n===e&&(this.#n=null,this.removeAttribute("data-loading"),this.removeAttribute("aria-busy"))}}#s(t){if(!this.#e)return;this.querySelectorAll(":scope > [data-fallback]").forEach(i=>i.remove());let e=this.#e;if([...e.content.children].length!==1){this.querySelectorAll(":scope > :not(template, [data-card-list-status])").forEach(s=>s.remove()),this.#c.clear();let i=document.createDocumentFragment();for(let s of this.#t){let o=e.content.cloneNode(!0);this.#l(o,s),i.appendChild(o)}this.prepend(i)}else{let i=pt(this.#t,this.#r),s=this.#t.map((l,u)=>({item:l,key:i[u]})),o=L({newItems:s,nodes:this.#c,keyOf:l=>l.key,renderItem:l=>{let c=e.content.cloneNode(!0).firstElementChild;return this.#l(c,l.item),c},containerFor:()=>this}),a=new Set(o.added);for(let{item:l,key:u}of s){if(a.has(u))continue;let c=this.#c.get(u);c&&this.#l(c,l)}}this.dispatchEvent(new CustomEvent("card-list:rendered",{detail:{count:this.#t.length},bubbles:!0})),this.dispatchEvent(new CustomEvent("card-list:items-changed",{detail:{items:this.#t,source:t},bubbles:!0}))}#l(t,e){let n=i=>{let s=[...t.querySelectorAll(i)];return t instanceof Element&&t.matches(i)&&s.unshift(t),s};n("[data-field]").forEach(i=>{let s=m(e,i.getAttribute("data-field"));i.textContent=s??""}),n("[data-field-attr]").forEach(i=>{for(let{attr:s,path:o}of ut(i.getAttribute("data-field-attr"))){if(!I(o))continue;let a=m(e,o);if(s.startsWith("on")||P.has(s)){console.warn(`[card-list] Refusing to bind "${s}" from data`);continue}let l=s.startsWith("aria-");a==null||a===!1&&!l?i.removeAttribute(s):ht(s,a)?i.setAttribute(s,a===!0&&!l?"":String(a)):(console.warn(`[card-list] Unsafe value refused for "${s}"`),i.removeAttribute(s))}}),n("[data-field-html]").forEach(i=>{i.replaceChildren(y(m(e,i.getAttribute("data-field-html"))))}),n("[data-field-if]").forEach(i=>{i.hidden=!m(e,i.getAttribute("data-field-if"))}),n("[data-field-unless]").forEach(i=>{i.hidden=!!m(e,i.getAttribute("data-field-unless"))})}get items(){return this.#t}set items(t){this.#i(),this.#t=Array.isArray(t)?t:[],this.#o=!0,this.#e&&this.hasAttribute("data-upgraded")?this.#s("api"):this.#a="api"}};_("card-list",v);export{v as CardList,m as getValueByPath,ht as isSafeAttrBinding,O as isSafeUrl,I as isValidPath,at as sanitizeHTML};
|
|
2
2
|
//# sourceMappingURL=card-list.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var q=Object.defineProperty;var R=(e,t)=>()=>(e&&(t=e(e=0)),t);var F=(e,t)=>{for(var i in t)q(e,i,{get:t[i],enumerable:!0})};var Y={};F(Y,{addDialogDismiss:()=>I,addFlickListener:()=>D,addLongPress:()=>S,addPullToRefresh:()=>X,addSwipeListener:()=>$,haptic:()=>L,initGestures:()=>N,makeSwipeable:()=>P});function $(e,t={}){let i=t.threshold??50,r=t.restraint??100,a=t.timeout??300,s=t.velocity??.5,n=t.minFlickDistance??10,c,o,d;function p(u){u.isPrimary&&(c=u.clientX,o=u.clientY,d=Date.now())}function f(u){if(!u.isPrimary)return;let v=u.clientX-c,m=u.clientY-o,l=Date.now()-d;if(l>a)return;let h=Math.abs(v),b=Math.abs(m),E=Math.max(h,b),y=l>0?E/l:0,g=y>=s&&E>=n,w;if((h>=i||g&&h>b)&&b<=r?w=v<0?"left":"right":(b>=i||g&&b>h)&&h<=r&&(w=m<0?"up":"down"),w){let V=w==="left"||w==="right"?h:b;e.dispatchEvent(new CustomEvent(`swipe-${w}`,{bubbles:!0,detail:{distance:V,duration:l,velocity:y,flick:g}}))}}return e.addEventListener("pointerdown",p,{passive:!0}),e.addEventListener("pointerup",f,{passive:!0}),()=>{e.removeEventListener("pointerdown",p),e.removeEventListener("pointerup",f)}}function D(e,t={}){let i=t.minDistance??10,r=t.velocity??.6,a=t.timeout??250,s=t.restraint??80,n,c,o;function d(f){f.isPrimary&&(n=f.clientX,c=f.clientY,o=Date.now())}function p(f){if(!f.isPrimary)return;let u=f.clientX-n,v=f.clientY-c,m=Date.now()-o;if(m===0||m>a)return;let l=Math.abs(u),h=Math.abs(v),b=Math.max(l,h);if(b<i)return;let E=b/m;if(E<r)return;let y;if(l>h&&h<=s?y=u<0?"left":"right":h>l&&l<=s&&(y=v<0?"up":"down"),y){let g=y==="left"||y==="right"?l:h;e.dispatchEvent(new CustomEvent(`swipe-${y}`,{bubbles:!0,detail:{distance:g,duration:m,velocity:E,flick:!0}}))}}return e.addEventListener("pointerdown",d,{passive:!0}),e.addEventListener("pointerup",p,{passive:!0}),()=>{e.removeEventListener("pointerdown",d),e.removeEventListener("pointerup",p)}}function P(e,t={}){let i=t.threshold??100,r=t.direction??"horizontal",a=t.removeOnDismiss??!0,s=r==="horizontal",n=0,c=0,o=!1;function d(l){!l.isPrimary||e.hasAttribute("data-dismissed")||(l.preventDefault(),o=!0,n=s?l.clientX:l.clientY,c=0,e.setPointerCapture(l.pointerId),e.setAttribute("data-swiping",""))}function p(l){if(!o||!l.isPrimary)return;c=(s?l.clientX:l.clientY)-n;let b=1-Math.min(Math.abs(c)/i,1)*.5;s?e.style.transform=`translateX(${c}px)`:e.style.transform=`translateY(${c}px)`,e.style.opacity=String(b)}function f(l){!o||!l.isPrimary||(o=!1,e.releasePointerCapture(l.pointerId),e.removeAttribute("data-swiping"),Math.abs(c)>=i?v(c>0?"right":"left"):m())}function u(l){!o||!l.isPrimary||(o=!1,e.releasePointerCapture(l.pointerId),e.removeAttribute("data-swiping"),m())}function v(l){let h=l==="right"?"100%":"-100%";e.style.transition="transform 0.2s ease-out, opacity 0.2s ease-out",e.style.transform=s?`translateX(${h})`:`translateY(${h})`,e.style.opacity="0",e.setAttribute("data-dismissed",""),L.dismiss(),e.dispatchEvent(new CustomEvent("swipe-dismiss",{bubbles:!0,detail:{direction:l,distance:Math.abs(c)}})),a&&e.addEventListener("transitionend",()=>e.remove(),{once:!0})}function m(){e.style.transition="transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease",e.style.transform="",e.style.opacity="",e.addEventListener("transitionend",()=>{e.style.transition=""},{once:!0})}return e.addEventListener("pointerdown",d),e.addEventListener("pointermove",p),e.addEventListener("pointerup",f),e.addEventListener("pointercancel",u),()=>{e.removeEventListener("pointerdown",d),e.removeEventListener("pointermove",p),e.removeEventListener("pointerup",f),e.removeEventListener("pointercancel",u)}}function X(e,t,i={}){let r=i.threshold??70,a=i.maxPull??120,s=document.createElement("div");s.setAttribute("data-pull-indicator",""),s.setAttribute("aria-hidden","true");let n=document.createElement("div");n.setAttribute("data-pull-spinner",""),s.appendChild(n),e.prepend(s);let c=0,o=!1,d=!1;function p(h){!h.isPrimary||d||e.scrollTop<=0&&(c=h.clientY,o=!0)}function f(h){if(!o||!h.isPrimary||d)return;let b=h.clientY-c;if(b<=0){s.style.transform="",s.style.opacity="";return}let E=Math.min(b,a),y=E/r;s.style.transform=`translateY(${E}px)`,s.style.opacity=String(Math.min(y,1)),y>=1?s.setAttribute("data-pull-ready",""):s.removeAttribute("data-pull-ready")}function u(h){!o||!h.isPrimary||(o=!1,s.hasAttribute("data-pull-ready")&&!d?m():l())}function v(h){!o||!h.isPrimary||(o=!1,l())}async function m(){d=!0,s.removeAttribute("data-pull-ready"),s.setAttribute("data-pull-loading",""),s.style.transform=`translateY(${r}px)`,s.style.opacity="1";try{await t()}finally{d=!1,s.removeAttribute("data-pull-loading"),l()}}function l(){s.style.transition="transform 0.3s ease, opacity 0.3s ease",s.style.transform="",s.style.opacity="",s.removeAttribute("data-pull-ready"),s.addEventListener("transitionend",()=>{s.style.transition=""},{once:!0})}return e.addEventListener("pointerdown",p,{passive:!0}),e.addEventListener("pointermove",f,{passive:!0}),e.addEventListener("pointerup",u,{passive:!0}),e.addEventListener("pointercancel",v,{passive:!0}),()=>{e.removeEventListener("pointerdown",p),e.removeEventListener("pointermove",f),e.removeEventListener("pointerup",u),e.removeEventListener("pointercancel",v),s.remove()}}function S(e,t,i={}){let r=i.duration??500,a=i.hapticFeedback??!0,s=i.blockContextMenu??!0,n=null;function c(p){p.isPrimary&&(n=setTimeout(()=>{a&&L.tap(),t(p),n=null},r))}function o(){n&&(clearTimeout(n),n=null)}function d(p){s&&p.preventDefault()}return e.addEventListener("pointerdown",c,{passive:!0}),e.addEventListener("pointermove",o,{passive:!0}),e.addEventListener("pointerup",o,{passive:!0}),e.addEventListener("pointercancel",o,{passive:!0}),e.addEventListener("contextmenu",d),()=>{o(),e.removeEventListener("pointerdown",c),e.removeEventListener("pointermove",o),e.removeEventListener("pointerup",o),e.removeEventListener("pointercancel",o),e.removeEventListener("contextmenu",d)}}function I(e,t={}){let i=t.threshold??80,r=0,a=0,s=!1;function n(u){if(!u.isPrimary||!e.open)return;let v=u.target;v.closest("a, button, input, select, textarea, [contenteditable]")&&!v.closest("header")||(s=!0,r=u.clientY,a=0,e.setPointerCapture(u.pointerId),e.style.transition="none")}function c(u){if(!s||!u.isPrimary)return;if(a=u.clientY-r,a<=0){e.style.transform="",e.style.opacity="";return}let m=1-Math.min(a/i,1)*.4;e.style.transform=`translateY(${a}px)`,e.style.opacity=String(m)}function o(u){!s||!u.isPrimary||(s=!1,e.releasePointerCapture(u.pointerId),a>=i?p():f())}function d(u){!s||!u.isPrimary||(s=!1,e.releasePointerCapture(u.pointerId),f())}function p(){e.style.transition="transform 0.2s ease-out, opacity 0.2s ease-out",e.style.transform="translateY(100%)",e.style.opacity="0",L.dismiss(),e.addEventListener("transitionend",()=>{e.style.transition="",e.style.transform="",e.style.opacity="",e.close("dismiss")},{once:!0})}function f(){e.style.transition="transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease",e.style.transform="",e.style.opacity="",e.addEventListener("transitionend",()=>{e.style.transition=""},{once:!0})}return e.addEventListener("pointerdown",n),e.addEventListener("pointermove",c),e.addEventListener("pointerup",o),e.addEventListener("pointercancel",d),()=>{e.removeEventListener("pointerdown",n),e.removeEventListener("pointermove",c),e.removeEventListener("pointerup",o),e.removeEventListener("pointercancel",d)}}function N(e=document){let t=[];for(let i of e.querySelectorAll('[data-gesture="swipe"]'))t.push($(i));for(let i of e.querySelectorAll('[data-gesture="flick"]'))t.push(D(i));for(let i of e.querySelectorAll('[data-gesture="dismiss"]'))t.push(P(i));for(let i of e.querySelectorAll('[data-gesture="long-press"]'))t.push(S(i,()=>{i.dispatchEvent(new CustomEvent("long-press",{bubbles:!0}))}));for(let i of e.querySelectorAll('dialog[data-gesture="dismiss-down"]'))t.push(I(i));return()=>t.forEach(i=>i())}var L,x,B=R(()=>{L={tap:()=>navigator.vibrate?.(8),confirm:()=>navigator.vibrate?.([8,40,8]),error:()=>navigator.vibrate?.([30,60,30]),dismiss:()=>navigator.vibrate?.(15)};x=typeof document<"u"?document.documentElement:null;(!x||!x.hasAttribute("data-vb-gestures-init"))&&(x?.setAttribute("data-vb-gestures-init",""),N())});var O=window.matchMedia("(prefers-reduced-motion: reduce)");var k=new Map;function M(e,t,i={}){let r=i.priority??10,a={impl:t,bundle:i.bundle,contract:i.contract,priority:r},s=k.get(e);if(customElements.get(e)){if(!s||s.priority>=r){s&&s.priority===r&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${e}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${i.bundle}".`);return}console.warn(`[VB Bundle] Tag <${e}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${i.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=r){s.priority===r&&console.warn(`[VB Bundle] Tag <${e}> already registered by "${s.bundle}". Skipping "${i.bundle}" (first wins at equal priority).`);return}k.set(e,a),customElements.define(e,t)}var A=class extends HTMLElement{#t=[];#e;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}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,i,r,a){t.addEventListener(i,r,a),this.#t.push(()=>t.removeEventListener(i,r,a))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,i){this.#e||(this.#e=this.attachInternals());let r=this.#e.states;try{i?r.add(t):r.delete(t)}catch{let a=`--${t}`;i?r.add(a):r.delete(a)}}_adoptInternals(t){this.#e||(this.#e=t)}#s(){return this.constructor.formAssociated&&this.#e?this.#e:null}get validity(){return this.#s()?.validity}get validationMessage(){return this.#s()?.validationMessage??""}get willValidate(){return this.#s()?.willValidate??!1}get form(){return this.#s()?.form??null}checkValidity(){return this.#s()?.checkValidity()??!0}reportValidity(){return this.#s()?.reportValidity()??!0}};function T(e){return document.startViewTransition?document.startViewTransition(e):e()}var z=0,C=class extends A{#t;#e=[];#s;#o;#a;#r;#n;#p;#h=null;#i=0;#E=0;#m=!1;#d=!1;#c=!1;#b=null;#l=!1;#w=!1;#f=!1;#v=!1;#A=new WeakSet;get currentIndex(){return this.#i}get slideCount(){return this.#e.length}get playing(){return this.#h!==null}setup(){let t=[...this.children];if(t.length===0)return!1;this.#d=window.matchMedia("(prefers-reduced-motion: reduce)").matches||document.documentElement.hasAttribute("data-motion-reduced"),this.#c=this.hasAttribute("transition")&&!!document.startViewTransition,this.hasAttribute("transition")&&!this.#c&&this.removeAttribute("transition"),this.setAttribute("role","region"),this.setAttribute("aria-roledescription","carousel"),!this.hasAttribute("aria-label")&&!this.hasAttribute("aria-labelledby")&&this.setAttribute("aria-label","Carousel"),this.#t=document.createElement("div"),this.#t.className="carousel-track",this.#t.setAttribute("tabindex","0");let i=this.getAttribute("item-width");if(i&&i!=="auto"&&i!=="full"&&CSS.supports("inline-size",i)&&this.#t.style.setProperty("--_item-width",i),t.forEach((n,c)=>{n.setAttribute("role","group"),n.setAttribute("aria-roledescription","slide"),n.hasAttribute("aria-label")||(n.setAttribute("aria-label",`${c+1} of ${t.length}`),this.#A.add(n)),this.#t.appendChild(n)}),this.#e=[...this.#t.children],this.hasAttribute("autoplay")&&!this.#d&&this.#x(),this.#o=document.createElement("button"),this.#o.className="carousel-prev",this.#o.setAttribute("aria-label","Previous slide"),this.#o.innerHTML='<icon-wc name="chevron-left" size="sm"></icon-wc>',this.#a=document.createElement("button"),this.#a.className="carousel-next",this.#a.setAttribute("aria-label","Next slide"),this.#a.innerHTML='<icon-wc name="chevron-right" size="sm"></icon-wc>',this.getAttribute("indicators")!=="false"&&(this.#r=document.createElement("div"),this.#r.className="carousel-indicators",this.#r.setAttribute("role","group"),this.#r.setAttribute("aria-label","Slide indicators"),this.#e.forEach((n,c)=>{let o=document.createElement("button");o.className="carousel-dot",o.setAttribute("aria-label",`Go to slide ${c+1}`),o.setAttribute("aria-current",c===0?"true":"false"),this.listen(o,"click",()=>this.goTo(c)),this.#r.appendChild(o)})),this.#n=document.createElement("div"),this.#n.className="carousel-live",this.#n.setAttribute("aria-live","polite"),this.#n.setAttribute("aria-atomic","true"),this.#s&&this.appendChild(this.#s),this.appendChild(this.#o),this.appendChild(this.#t),this.appendChild(this.#a),this.#r&&this.appendChild(this.#r),this.appendChild(this.#n),this.listen(this.#o,"click",()=>this.prev()),this.listen(this.#a,"click",()=>this.next()),this.listen(this.#t,"keydown",this.#P),this.listen(this,"mouseenter",()=>{this.#f=!0,this.#u()}),this.listen(this,"mouseleave",()=>{this.#f=!1,this.#u()}),this.listen(this,"touchstart",()=>{this.#f=!0,this.#u()},{passive:!0}),this.listen(this,"focusin",()=>{this.#v=!0,this.#u()}),this.listen(this,"focusout",n=>{this.contains(n.relatedTarget)||(this.#v=!1,this.#u())}),this.#c){let n=++z,c=this.getAttribute("transition")||"fade",o=c==="slide"?"vt-carousel-slide":c==="scale"?"vt-carousel-scale":"vt-carousel";this.#t.style.viewTransitionName=`carousel-${n}`,this.#t.style.viewTransitionClass=o}if(this.#c){let n=this.#t;Promise.resolve().then(()=>(B(),Y)).then(({addSwipeListener:c})=>{!this.isConnected||this.#t!==n||(this.#b=c(n,{threshold:40}),this.listen(n,"swipe-left",()=>this.#y()?this.prev():this.next()),this.listen(n,"swipe-right",()=>this.#y()?this.next():this.prev()))})}this.#c||(this.#p=new IntersectionObserver(this.#D,{root:this.#t,threshold:.5}),this.#e.forEach(n=>this.#p.observe(n)),"onscrollend"in window&&this.listen(this.#t,"scrollend",()=>{this.#m=!1,this.#M()}));let s=this.#S()??(Number(this.getAttribute("start"))||0);if(this.#c){let n=s>0&&s<this.#e.length?s:0;this.#e.forEach((c,o)=>{c.hidden=o!==n}),this.#g(n)}else s>0&&s<this.#e.length&&this.goTo(s,!1);return this.#T(),this.#f=this.#v=!1,this.#l=this.hasAttribute("autoplay")&&!this.#d&&!this.#w,this.#u(),!0}teardown(){this.#l=!1,this.#k(),this.#p&&(this.#p.disconnect(),this.#p=null),this.#b&&(this.#b(),this.#b=null),this.#t?.parentElement===this&&[...this.#t.children].forEach(t=>this.appendChild(t)),this.#e.forEach(t=>{this.#A.has(t)&&t.removeAttribute("aria-label")}),this.#t?.remove(),this.#s?.remove(),this.#o?.remove(),this.#a?.remove(),this.#r?.remove(),this.#n?.remove(),this.#t=this.#s=this.#o=this.#a=this.#r=this.#n=null,this.#e=[],this.#c=!1,this.#i=0,this.#E=0,this.#m=!1}get slides(){return this.#e.map((t,i)=>({id:t.id||void 0,html:t.innerHTML,label:t.getAttribute("aria-label")||`${i+1} of ${this.#e.length}`}))}set slides(t){let i=Array.isArray(t)?t:[];for(;this.firstChild;)this.firstChild.remove();for(let r of i){let a=document.createElement("div");r.id&&(a.id=r.id),r.label&&a.setAttribute("aria-label",r.label),a.innerHTML=r.html||"",this.appendChild(a)}this._reinit(),this.dispatchEvent(new CustomEvent("carousel-wc:slides-changed",{detail:{slides:i,source:"property"},bubbles:!0}))}next(){let t=this.hasAttribute("loop");this.#i<this.#e.length-1?this.goTo(this.#i+1):t&&this.goTo(0)}prev(){let t=this.hasAttribute("loop");this.#i>0?this.goTo(this.#i-1):t&&this.goTo(this.#e.length-1)}goTo(t,i=!0){if(!(t<0||t>=this.#e.length)){if(this.#c)if(i&&t!==this.#i){let r=t>this.#i?"forward":"backward";document.documentElement.dataset.vtDirection=r,T(()=>{this.#L(t)}).finished?.then(()=>{delete document.documentElement.dataset.vtDirection})}else this.#L(t);else{let r=this.#e[t].getBoundingClientRect(),a=this.#t.getBoundingClientRect(),s=this.#y()?r.right-a.right:r.left-a.left,n=i&&!this.#d?"smooth":"instant";this.#t.scrollTo({left:this.#t.scrollLeft+s,behavior:n})}this.#g(t)}}#L(t){this.#e.forEach((i,r)=>{i.hidden=r!==t})}play(){this.#d||!this.#t||(this.#w=!1,this.#l=!0,this.#f=this.#v=!1,this.#s||(this.#x(),this.insertBefore(this.#s,this.firstChild)),this.#u())}pause(){this.#w=!0,this.#l=!1,this.#u()}#x(){let t=document.createElement("button");t.type="button",t.className="carousel-rotate",this.listen(t,"click",()=>{this.#l?this.pause():this.play()}),this.#s=t,this.#C()}#C(){let t=this.#s;if(!t)return;let i=this.#l?"Pause automatic slide show":"Start automatic slide show";t.getAttribute("aria-label")!==i&&(t.setAttribute("aria-label",i),t.innerHTML=`<icon-wc name="${this.#l?"pause":"play"}" size="sm"></icon-wc>`)}#u(){this.#l&&!this.#f&&!this.#v&&!this.#d&&this.isConnected&&!!this.#t?this.#$():this.#k(),this.#C()}#$(){if(this.#h)return;let t=Number(this.getAttribute("autoplay-delay"))||5e3;this.#h=setInterval(()=>this.next(),t),this.#n?.setAttribute("aria-live","off"),this.dispatchEvent(new CustomEvent("carousel-wc:play",{bubbles:!0}))}#k(){this.#n?.setAttribute("aria-live","polite"),this.#h&&(clearInterval(this.#h),this.#h=null,this.dispatchEvent(new CustomEvent("carousel-wc:pause",{bubbles:!0})))}#y(){return getComputedStyle(this).direction==="rtl"}reset(){let t=Number(this.getAttribute("start"))||0;this.goTo(t,!1),this.#N()}#g(t){this.#i=t,this.#T(),this.#I(),this.#n&&(this.#n.textContent=`Slide ${t+1} of ${this.#e.length}`),!this.#m&&(this.#M(),!this.#c&&"onscrollend"in window&&(this.#m=!0))}#M(){this.#i!==this.#E&&(this.#E=this.#i,this.dispatchEvent(new CustomEvent("carousel-wc:change",{detail:{index:this.#i,slide:this.#e[this.#i]},bubbles:!0})))}#T(){let t=this.hasAttribute("loop"),i=this.#i===0,r=this.#i===this.#e.length-1;if(this.#o&&(this.#o.disabled=!t&&i),this.#a&&(this.#a.disabled=!t&&r),this.#r){let a=this.#r.children;for(let s=0;s<a.length;s++){let n=s===this.#i;a[s].setAttribute("aria-current",n?"true":"false"),n?a[s].setAttribute("data-active",""):a[s].removeAttribute("data-active")}}}#D=t=>{for(let i of t)if(i.isIntersecting){let r=this.#e.indexOf(i.target);r!==-1&&r!==this.#i&&this.#g(r)}};#P=t=>{let i=(t.key==="ArrowLeft"||t.key==="ArrowRight")&&this.#y();switch(t.key){case"ArrowLeft":t.preventDefault(),i?this.next():this.prev();break;case"ArrowRight":t.preventDefault(),i?this.prev():this.next();break;case"Home":t.preventDefault(),this.goTo(0);break;case"End":t.preventDefault(),this.goTo(this.#e.length-1);break}};#S(){let t=this.getAttribute("persist");if(!t)return null;try{let i=localStorage.getItem(`carousel:${t}`);return i!==null?Number(i):null}catch{return null}}#I(){let t=this.getAttribute("persist");if(t)try{localStorage.setItem(`carousel:${t}`,String(this.#i))}catch{}}#N(){let t=this.getAttribute("persist");if(t)try{localStorage.removeItem(`carousel:${t}`)}catch{}}};M("carousel-wc",C);export{C as CarouselWc};
|
|
1
|
+
var q=Object.defineProperty;var F=(e,t)=>()=>(e&&(t=e(e=0)),t);var V=(e,t)=>{for(var i in t)q(e,i,{get:t[i],enumerable:!0})};var Y={};V(Y,{addDialogDismiss:()=>I,addFlickListener:()=>M,addLongPress:()=>D,addPullToRefresh:()=>R,addSwipeListener:()=>T,haptic:()=>L,initGestures:()=>B,makeSwipeable:()=>P});function T(e,t={}){let i=t.threshold??50,r=t.restraint??100,a=t.timeout??300,s=t.velocity??.5,n=t.minFlickDistance??10,c,o,h;function p(l){l.isPrimary&&(c=l.clientX,o=l.clientY,h=Date.now())}function f(l){if(!l.isPrimary)return;let v=l.clientX-c,b=l.clientY-o,u=Date.now()-h;if(u>a)return;let d=Math.abs(v),m=Math.abs(b),E=Math.max(d,m),y=u>0?E/u:0,g=y>=s&&E>=n,w;if((d>=i||g&&d>m)&&m<=r?w=v<0?"left":"right":(m>=i||g&&m>d)&&d<=r&&(w=b<0?"up":"down"),w){let _=w==="left"||w==="right"?d:m;e.dispatchEvent(new CustomEvent(`swipe-${w}`,{bubbles:!0,detail:{distance:_,duration:u,velocity:y,flick:g}}))}}return e.addEventListener("pointerdown",p,{passive:!0}),e.addEventListener("pointerup",f,{passive:!0}),()=>{e.removeEventListener("pointerdown",p),e.removeEventListener("pointerup",f)}}function M(e,t={}){let i=t.minDistance??10,r=t.velocity??.6,a=t.timeout??250,s=t.restraint??80,n,c,o;function h(f){f.isPrimary&&(n=f.clientX,c=f.clientY,o=Date.now())}function p(f){if(!f.isPrimary)return;let l=f.clientX-n,v=f.clientY-c,b=Date.now()-o;if(b===0||b>a)return;let u=Math.abs(l),d=Math.abs(v),m=Math.max(u,d);if(m<i)return;let E=m/b;if(E<r)return;let y;if(u>d&&d<=s?y=l<0?"left":"right":d>u&&u<=s&&(y=v<0?"up":"down"),y){let g=y==="left"||y==="right"?u:d;e.dispatchEvent(new CustomEvent(`swipe-${y}`,{bubbles:!0,detail:{distance:g,duration:b,velocity:E,flick:!0}}))}}return e.addEventListener("pointerdown",h,{passive:!0}),e.addEventListener("pointerup",p,{passive:!0}),()=>{e.removeEventListener("pointerdown",h),e.removeEventListener("pointerup",p)}}function P(e,t={}){let i=t.threshold??100,r=t.direction??"horizontal",a=t.removeOnDismiss??!0,s=r==="horizontal",n=0,c=0,o=!1;function h(u){!u.isPrimary||e.hasAttribute("data-dismissed")||(u.preventDefault(),o=!0,n=s?u.clientX:u.clientY,c=0,e.setPointerCapture(u.pointerId),e.setAttribute("data-swiping",""))}function p(u){if(!o||!u.isPrimary)return;c=(s?u.clientX:u.clientY)-n;let m=1-Math.min(Math.abs(c)/i,1)*.5;s?e.style.transform=`translateX(${c}px)`:e.style.transform=`translateY(${c}px)`,e.style.opacity=String(m)}function f(u){!o||!u.isPrimary||(o=!1,e.releasePointerCapture(u.pointerId),e.removeAttribute("data-swiping"),Math.abs(c)>=i?v(c>0?"right":"left"):b())}function l(u){!o||!u.isPrimary||(o=!1,e.releasePointerCapture(u.pointerId),e.removeAttribute("data-swiping"),b())}function v(u){let d=u==="right"?"100%":"-100%";e.style.transition="transform 0.2s ease-out, opacity 0.2s ease-out",e.style.transform=s?`translateX(${d})`:`translateY(${d})`,e.style.opacity="0",e.setAttribute("data-dismissed",""),L.dismiss(),e.dispatchEvent(new CustomEvent("swipe-dismiss",{bubbles:!0,detail:{direction:u,distance:Math.abs(c)}})),a&&e.addEventListener("transitionend",()=>e.remove(),{once:!0})}function b(){e.style.transition="transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease",e.style.transform="",e.style.opacity="",e.addEventListener("transitionend",()=>{e.style.transition=""},{once:!0})}return e.addEventListener("pointerdown",h),e.addEventListener("pointermove",p),e.addEventListener("pointerup",f),e.addEventListener("pointercancel",l),()=>{e.removeEventListener("pointerdown",h),e.removeEventListener("pointermove",p),e.removeEventListener("pointerup",f),e.removeEventListener("pointercancel",l)}}function R(e,t,i={}){let r=i.threshold??70,a=i.maxPull??120,s=document.createElement("div");s.setAttribute("data-pull-indicator",""),s.setAttribute("aria-hidden","true");let n=document.createElement("div");n.setAttribute("data-pull-spinner",""),s.appendChild(n),e.prepend(s);let c=0,o=!1,h=!1;function p(d){!d.isPrimary||h||e.scrollTop<=0&&(c=d.clientY,o=!0)}function f(d){if(!o||!d.isPrimary||h)return;let m=d.clientY-c;if(m<=0){s.style.transform="",s.style.opacity="";return}let E=Math.min(m,a),y=E/r;s.style.transform=`translateY(${E}px)`,s.style.opacity=String(Math.min(y,1)),y>=1?s.setAttribute("data-pull-ready",""):s.removeAttribute("data-pull-ready")}function l(d){!o||!d.isPrimary||(o=!1,s.hasAttribute("data-pull-ready")&&!h?b():u())}function v(d){!o||!d.isPrimary||(o=!1,u())}async function b(){h=!0,s.removeAttribute("data-pull-ready"),s.setAttribute("data-pull-loading",""),s.style.transform=`translateY(${r}px)`,s.style.opacity="1";try{await t()}finally{h=!1,s.removeAttribute("data-pull-loading"),u()}}function u(){s.style.transition="transform 0.3s ease, opacity 0.3s ease",s.style.transform="",s.style.opacity="",s.removeAttribute("data-pull-ready"),s.addEventListener("transitionend",()=>{s.style.transition=""},{once:!0})}return e.addEventListener("pointerdown",p,{passive:!0}),e.addEventListener("pointermove",f,{passive:!0}),e.addEventListener("pointerup",l,{passive:!0}),e.addEventListener("pointercancel",v,{passive:!0}),()=>{e.removeEventListener("pointerdown",p),e.removeEventListener("pointermove",f),e.removeEventListener("pointerup",l),e.removeEventListener("pointercancel",v),s.remove()}}function D(e,t,i={}){let r=i.duration??500,a=i.hapticFeedback??!0,s=i.blockContextMenu??!0,n=null;function c(p){p.isPrimary&&(n=setTimeout(()=>{a&&L.tap(),t(p),n=null},r))}function o(){n&&(clearTimeout(n),n=null)}function h(p){s&&p.preventDefault()}return e.addEventListener("pointerdown",c,{passive:!0}),e.addEventListener("pointermove",o,{passive:!0}),e.addEventListener("pointerup",o,{passive:!0}),e.addEventListener("pointercancel",o,{passive:!0}),e.addEventListener("contextmenu",h),()=>{o(),e.removeEventListener("pointerdown",c),e.removeEventListener("pointermove",o),e.removeEventListener("pointerup",o),e.removeEventListener("pointercancel",o),e.removeEventListener("contextmenu",h)}}function I(e,t={}){let i=t.threshold??80,r=0,a=0,s=!1;function n(l){if(!l.isPrimary||!e.open)return;let v=l.target;v.closest("a, button, input, select, textarea, [contenteditable]")&&!v.closest("header")||(s=!0,r=l.clientY,a=0,e.setPointerCapture(l.pointerId),e.style.transition="none")}function c(l){if(!s||!l.isPrimary)return;if(a=l.clientY-r,a<=0){e.style.transform="",e.style.opacity="";return}let b=1-Math.min(a/i,1)*.4;e.style.transform=`translateY(${a}px)`,e.style.opacity=String(b)}function o(l){!s||!l.isPrimary||(s=!1,e.releasePointerCapture(l.pointerId),a>=i?p():f())}function h(l){!s||!l.isPrimary||(s=!1,e.releasePointerCapture(l.pointerId),f())}function p(){e.style.transition="transform 0.2s ease-out, opacity 0.2s ease-out",e.style.transform="translateY(100%)",e.style.opacity="0",L.dismiss(),e.addEventListener("transitionend",()=>{e.style.transition="",e.style.transform="",e.style.opacity="",e.close("dismiss")},{once:!0})}function f(){e.style.transition="transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease",e.style.transform="",e.style.opacity="",e.addEventListener("transitionend",()=>{e.style.transition=""},{once:!0})}return e.addEventListener("pointerdown",n),e.addEventListener("pointermove",c),e.addEventListener("pointerup",o),e.addEventListener("pointercancel",h),()=>{e.removeEventListener("pointerdown",n),e.removeEventListener("pointermove",c),e.removeEventListener("pointerup",o),e.removeEventListener("pointercancel",h)}}function B(e=document){let t=[];for(let i of e.querySelectorAll('[data-gesture="swipe"]'))t.push(T(i));for(let i of e.querySelectorAll('[data-gesture="flick"]'))t.push(M(i));for(let i of e.querySelectorAll('[data-gesture="dismiss"]'))t.push(P(i));for(let i of e.querySelectorAll('[data-gesture="long-press"]'))t.push(D(i,()=>{i.dispatchEvent(new CustomEvent("long-press",{bubbles:!0}))}));for(let i of e.querySelectorAll('dialog[data-gesture="dismiss-down"]'))t.push(I(i));return()=>t.forEach(i=>i())}var L,C,H=F(()=>{L={tap:()=>navigator.vibrate?.(8),confirm:()=>navigator.vibrate?.([8,40,8]),error:()=>navigator.vibrate?.([30,60,30]),dismiss:()=>navigator.vibrate?.(15)};C=typeof document<"u"?document.documentElement:null;(!C||!C.hasAttribute("data-vb-gestures-init"))&&(C?.setAttribute("data-vb-gestures-init",""),B())});var G=window.matchMedia("(prefers-reduced-motion: reduce)");var S=new Map;function $(e,t,i={}){let r=i.priority??10,a={impl:t,bundle:i.bundle,contract:i.contract,priority:r},s=S.get(e);if(customElements.get(e)){if(!s||s.priority>=r){s&&s.priority===r&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${e}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${i.bundle}".`);return}console.warn(`[VB Bundle] Tag <${e}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${i.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=r){s.priority===r&&console.warn(`[VB Bundle] Tag <${e}> already registered by "${s.bundle}". Skipping "${i.bundle}" (first wins at equal priority).`);return}S.set(e,a),customElements.define(e,t)}var A=class extends HTMLElement{#t=[];#e;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}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,i,r,a){t.addEventListener(i,r,a),this.#t.push(()=>t.removeEventListener(i,r,a))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,i){this.#e||(this.#e=this.attachInternals());let r=this.#e.states;try{i?r.add(t):r.delete(t)}catch{let a=`--${t}`;i?r.add(a):r.delete(a)}}_adoptInternals(t){this.#e||(this.#e=t)}#s(){return this.constructor.formAssociated&&this.#e?this.#e:null}get validity(){return this.#s()?.validity}get validationMessage(){return this.#s()?.validationMessage??""}get willValidate(){return this.#s()?.willValidate??!1}get form(){return this.#s()?.form??null}checkValidity(){return this.#s()?.checkValidity()??!0}reportValidity(){return this.#s()?.reportValidity()??!0}};function k(e){return document.startViewTransition?document.startViewTransition(e):e()}var O=0,x=class extends A{#t;#e=[];#s;#r;#n;#o;#a;#p;#d=null;#i=0;#E=0;#b=!1;#h=!1;#c=!1;#m=null;#u=!1;#w=!1;#f=!1;#v=!1;#A=new WeakSet;get currentIndex(){return this.#i}get slideCount(){return this.#e.length}get playing(){return this.#d!==null}setup(){let t=[...this.children];if(t.length===0)return!1;this.#h=window.matchMedia("(prefers-reduced-motion: reduce)").matches||document.documentElement.hasAttribute("data-motion-reduced"),this.#c=this.hasAttribute("transition")&&!!document.startViewTransition,this.hasAttribute("transition")&&!this.#c&&this.removeAttribute("transition"),this.setAttribute("role","region"),this.setAttribute("aria-roledescription","carousel"),!this.hasAttribute("aria-label")&&!this.hasAttribute("aria-labelledby")&&this.setAttribute("aria-label","Carousel"),this.#t=document.createElement("div"),this.#t.className="carousel-track",this.#t.setAttribute("tabindex","0"),this.#t.setAttribute("role","group"),this.#t.setAttribute("aria-label",this.dataset.labelTrack||"Slides");let i=this.getAttribute("item-width");if(i&&i!=="auto"&&i!=="full"&&CSS.supports("inline-size",i)&&this.#t.style.setProperty("--_item-width",i),t.forEach((n,c)=>{n.setAttribute("role","group"),n.setAttribute("aria-roledescription","slide"),n.hasAttribute("aria-label")||(n.setAttribute("aria-label",`${c+1} of ${t.length}`),this.#A.add(n)),this.#t.appendChild(n)}),this.#e=[...this.#t.children],this.hasAttribute("autoplay")&&!this.#h&&this.#C(),this.#r=document.createElement("button"),this.#r.type="button",this.#r.className="carousel-prev",this.#r.setAttribute("aria-label","Previous slide"),this.#r.innerHTML='<icon-wc name="chevron-left" size="sm"></icon-wc>',this.#n=document.createElement("button"),this.#n.type="button",this.#n.className="carousel-next",this.#n.setAttribute("aria-label","Next slide"),this.#n.innerHTML='<icon-wc name="chevron-right" size="sm"></icon-wc>',this.getAttribute("indicators")!=="false"&&(this.#o=document.createElement("div"),this.#o.className="carousel-indicators",this.#o.setAttribute("role","group"),this.#o.setAttribute("aria-label","Slide indicators"),this.#e.forEach((n,c)=>{let o=document.createElement("button");o.type="button",o.className="carousel-dot",o.setAttribute("aria-label",`Go to slide ${c+1}`),c===0&&o.setAttribute("aria-current","true"),this.listen(o,"click",()=>this.goTo(c)),this.#o.appendChild(o)})),this.#a=document.createElement("div"),this.#a.className="carousel-live",this.#a.setAttribute("aria-live","polite"),this.#a.setAttribute("aria-atomic","true"),this.#s&&this.appendChild(this.#s),this.appendChild(this.#r),this.appendChild(this.#t),this.appendChild(this.#n),this.#o&&this.appendChild(this.#o),this.appendChild(this.#a),this.listen(this.#r,"click",()=>this.prev()),this.listen(this.#n,"click",()=>this.next()),this.listen(this.#t,"keydown",this.#P),this.listen(this,"mouseenter",()=>{this.#f=!0,this.#l()}),this.listen(this,"mouseleave",()=>{this.#f=!1,this.#l()}),this.listen(this,"touchstart",()=>{this.#f=!0,this.#l()},{passive:!0}),this.listen(this,"focusin",()=>{this.#v=!0,this.#l()}),this.listen(this,"focusout",n=>{this.contains(n.relatedTarget)||(this.#v=!1,this.#l())}),this.#c){let n=++O,c=this.getAttribute("transition")||"fade",o=c==="slide"?"vt-carousel-slide":c==="scale"?"vt-carousel-scale":"vt-carousel";this.#t.style.viewTransitionName=`carousel-${n}`,this.#t.style.viewTransitionClass=o}if(this.#c){let n=this.#t;Promise.resolve().then(()=>(H(),Y)).then(({addSwipeListener:c})=>{!this.isConnected||this.#t!==n||(this.#m=c(n,{threshold:40}),this.listen(n,"swipe-left",()=>this.#y()?this.prev():this.next()),this.listen(n,"swipe-right",()=>this.#y()?this.next():this.prev()))})}this.#c||(this.#p=new IntersectionObserver(this.#M,{root:this.#t,threshold:.5}),this.#e.forEach(n=>this.#p.observe(n)),"onscrollend"in window&&this.listen(this.#t,"scrollend",()=>{this.#b=!1,this.#$()}));let s=this.#D()??(Number(this.getAttribute("start"))||0);if(this.#c){let n=s>0&&s<this.#e.length?s:0;this.#e.forEach((c,o)=>{c.hidden=o!==n}),this.#g(n)}else s>0&&s<this.#e.length&&this.goTo(s,!1);return this.#k(),this.#f=this.#v=!1,this.#u=this.hasAttribute("autoplay")&&!this.#h&&!this.#w,this.#l(),!0}teardown(){this.#u=!1,this.#S(),this.#p&&(this.#p.disconnect(),this.#p=null),this.#m&&(this.#m(),this.#m=null),this.#t?.parentElement===this&&[...this.#t.children].forEach(t=>this.appendChild(t)),this.#e.forEach(t=>{this.#A.has(t)&&t.removeAttribute("aria-label")}),this.#t?.remove(),this.#s?.remove(),this.#r?.remove(),this.#n?.remove(),this.#o?.remove(),this.#a?.remove(),this.#t=this.#s=this.#r=this.#n=this.#o=this.#a=null,this.#e=[],this.#c=!1,this.#i=0,this.#E=0,this.#b=!1}get slides(){return this.#e.map((t,i)=>({id:t.id||void 0,html:t.innerHTML,label:t.getAttribute("aria-label")||`${i+1} of ${this.#e.length}`}))}set slides(t){let i=Array.isArray(t)?t:[];for(;this.firstChild;)this.firstChild.remove();for(let r of i){let a=document.createElement("div");r.id&&(a.id=r.id),r.label&&a.setAttribute("aria-label",r.label),a.innerHTML=r.html||"",this.appendChild(a)}this._reinit(),this.dispatchEvent(new CustomEvent("carousel-wc:slides-changed",{detail:{slides:i,source:"property"},bubbles:!0}))}next(){let t=this.hasAttribute("loop");this.#i<this.#e.length-1?this.goTo(this.#i+1):t&&this.goTo(0)}prev(){let t=this.hasAttribute("loop");this.#i>0?this.goTo(this.#i-1):t&&this.goTo(this.#e.length-1)}goTo(t,i=!0){if(!(t<0||t>=this.#e.length)){if(this.#c)if(i&&t!==this.#i){let r=t>this.#i?"forward":"backward";document.documentElement.dataset.vtDirection=r,k(()=>{this.#L(t)}).finished?.then(()=>{delete document.documentElement.dataset.vtDirection})}else this.#L(t);else{let r=this.#e[t].getBoundingClientRect(),a=this.#t.getBoundingClientRect(),s=this.#y()?r.right-a.right:r.left-a.left,n=i&&!this.#h?"smooth":"instant";this.#t.scrollTo({left:this.#t.scrollLeft+s,behavior:n})}this.#g(t)}}#L(t){this.#e.forEach((i,r)=>{i.hidden=r!==t})}play(){this.#h||!this.#t||(this.#w=!1,this.#u=!0,this.#f=this.#v=!1,this.#s||(this.#C(),this.insertBefore(this.#s,this.firstChild)),this.#l())}pause(){this.#w=!0,this.#u=!1,this.#l()}#C(){let t=document.createElement("button");t.type="button",t.className="carousel-rotate",this.listen(t,"click",()=>{this.#u?this.pause():this.play()}),this.#s=t,this.#x()}#x(){let t=this.#s;if(!t)return;let i=this.#u?"Pause automatic slide show":"Start automatic slide show";t.getAttribute("aria-label")!==i&&(t.setAttribute("aria-label",i),t.innerHTML=`<icon-wc name="${this.#u?"pause":"play"}" size="sm"></icon-wc>`)}#l(){this.#u&&!this.#f&&!this.#v&&!this.#h&&this.isConnected&&!!this.#t?this.#T():this.#S(),this.#x()}#T(){if(this.#d)return;let t=Number(this.getAttribute("autoplay-delay"))||5e3;this.#d=setInterval(()=>this.next(),t),this.#a?.setAttribute("aria-live","off"),this.dispatchEvent(new CustomEvent("carousel-wc:play",{bubbles:!0}))}#S(){this.#a?.setAttribute("aria-live","polite"),this.#d&&(clearInterval(this.#d),this.#d=null,this.dispatchEvent(new CustomEvent("carousel-wc:pause",{bubbles:!0})))}#y(){return getComputedStyle(this).direction==="rtl"}reset(){let t=Number(this.getAttribute("start"))||0;this.goTo(t,!1),this.#B()}#g(t){this.#i=t,this.#k(),this.#I(),this.#a&&(this.#a.textContent=`Slide ${t+1} of ${this.#e.length}`),!this.#b&&(this.#$(),!this.#c&&"onscrollend"in window&&(this.#b=!0))}#$(){this.#i!==this.#E&&(this.#E=this.#i,this.dispatchEvent(new CustomEvent("carousel-wc:change",{detail:{index:this.#i,slide:this.#e[this.#i]},bubbles:!0})))}#k(){let t=this.hasAttribute("loop"),i=this.#i===0,r=this.#i===this.#e.length-1;if(this.#r&&(this.#r.disabled=!t&&i),this.#n&&(this.#n.disabled=!t&&r),this.#o){let a=this.#o.children;for(let s=0;s<a.length;s++)s===this.#i?(a[s].setAttribute("aria-current","true"),a[s].setAttribute("data-active","")):(a[s].removeAttribute("aria-current"),a[s].removeAttribute("data-active"))}}#M=t=>{for(let i of t)if(i.isIntersecting){let r=this.#e.indexOf(i.target);r!==-1&&r!==this.#i&&this.#g(r)}};#P=t=>{let i=(t.key==="ArrowLeft"||t.key==="ArrowRight")&&this.#y();switch(t.key){case"ArrowLeft":t.preventDefault(),i?this.next():this.prev();break;case"ArrowRight":t.preventDefault(),i?this.prev():this.next();break;case"Home":t.preventDefault(),this.goTo(0);break;case"End":t.preventDefault(),this.goTo(this.#e.length-1);break}};#D(){let t=this.getAttribute("persist");if(!t)return null;try{let i=localStorage.getItem(`carousel:${t}`);return i!==null?Number(i):null}catch{return null}}#I(){let t=this.getAttribute("persist");if(t)try{localStorage.setItem(`carousel:${t}`,String(this.#i))}catch{}}#B(){let t=this.getAttribute("persist");if(t)try{localStorage.removeItem(`carousel:${t}`)}catch{}}};$("carousel-wc",x);export{x as CarouselWc};
|
|
2
2
|
//# sourceMappingURL=carousel-wc.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var b=window.matchMedia("(prefers-reduced-motion: reduce)");var d=new Map;function u(s,t,e={}){let r=e.priority??10,i={impl:t,bundle:e.bundle,contract:e.contract,priority:r},n=d.get(s);if(customElements.get(s)){if(!n||n.priority>=r){n&&n.priority===r&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=r){n.priority===r&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${n.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}d.set(s,i),customElements.define(s,t)}var o=class extends HTMLElement{#e=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}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.#e)t();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,r,i){t.addEventListener(e,r,i),this.#e.push(()=>t.removeEventListener(e,r,i))}_reinit(){for(let t of this.#e)t();this.#e=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#t||(this.#t=this.attachInternals());let r=this.#t.states;try{e?r.add(t):r.delete(t)}catch{let i=`--${t}`;e?r.add(i):r.delete(i)}}_adoptInternals(t){this.#t||(this.#t=t)}#r(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#r()?.validity}get validationMessage(){return this.#r()?.validationMessage??""}get willValidate(){return this.#r()?.willValidate??!1}get form(){return this.#r()?.form??null}checkValidity(){return this.#r()?.checkValidity()??!0}reportValidity(){return this.#r()?.reportValidity()??!0}};var a=["tracking","final","original"],l={tracking:"Tracking",final:"Final",original:"Original"},c=class extends o{static observedAttributes=["view","author","datetime","controls"];setup(){this.#e(),this.listen(this,"click",this.#o)}attributeChangedCallback(t,e,r){!this.hasAttribute("data-upgraded")||e===r||(t==="view"?this.#n():this.#e())}#e(){this.querySelector(":scope > [data-change-caption]")?.remove(),this.querySelector(":scope > [data-controls]")?.remove();let t=this.#t(),e=[];t&&e.push(t),this.getAttribute("controls")!=="none"&&e.push(this.#r(t)),this.prepend(...e),this.#n()}#t(){let t=this.getAttribute("author"),e=this.getAttribute("datetime");if(!t&&!e)return null;let r=document.createElement("p");if(r.setAttribute("data-change-caption",""),r.append(t?`Changes by ${t}`:"Changes"),e){r.append(t?", ":" from ");let i=document.createElement("time");i.setAttribute("datetime",e),i.textContent=this.#s(e),r.append(i)}return r}#r(t){let e=document.createElement("div");e.setAttribute("data-controls",""),e.setAttribute("role","group");let r=t?`, ${t.textContent}`:"";e.setAttribute("aria-label",`Change view${r}`);for(let i of a){let n=document.createElement("button");n.type="button",n.dataset.action=i,n.textContent=l[i],e.append(n)}return e}#s(t){let e=new Date(t);if(Number.isNaN(e.getTime()))return t;let r=this.closest("[lang]")?.lang||void 0,i=/^\d{4}-\d{2}-\d{2}$/.test(t);return new Intl.DateTimeFormat(r,{dateStyle:"medium",...i?{timeZone:"UTC"}:{timeStyle:"short"}}).format(e)}#n(){let t=this.view;for(let e of this.querySelectorAll(":scope > [data-controls] > button[data-action]"))e.setAttribute("aria-pressed",String(e.dataset.action===t))}#o=t=>{let e=t.target.closest?.("[data-action]");if(!e||e.parentElement?.parentElement!==this||!e.parentElement.hasAttribute("data-controls"))return;let r=e.dataset.action;!r||!a.includes(r)||r!==this.view&&(this.#i(r),this.dispatchEvent(new CustomEvent("change-set:view",{detail:{view:r},bubbles:!0})))};#i(t){t==="tracking"?this.removeAttribute("view"):this.setAttribute("view",t),this.#n()}get view(){let t=this.getAttribute("view");return t==="final"||t==="original"?t:"tracking"}set view(t){!a.includes(t)||this.view===t||(this.#i(t),this.dispatchEvent(new CustomEvent("change-set:view",{detail:{view:t,source:"api"},bubbles:!0})))}};u("change-set",c);export{c as ChangeSet};
|
|
2
2
|
//# sourceMappingURL=change-set.js.map
|