iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
1 lines • 25.3 kB
JavaScript
export const __rspack_esm_id=80827;export const __rspack_esm_ids=[80827];export const __webpack_modules__={69255(e,t,n){function o(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}n.d(t,{_:()=>o})},81787(e,t,n){n.d(t,{_:()=>r});var o=0;function r(e){return"__private_"+o+++"_"+e}},97686(e,t,n){n.a(e,async function(e,t){try{var o=n(74487),r=(n(44114),n(18111),n(7588),n(61701),n(18237),n(13579),n(69112),n(33110),n(45367),n(92731),n(17642),n(58004),n(33853),n(45876),n(32475),n(15024),n(31698),n(69255)),a=n(81787),s=e([o]);o=(s.then?(await s)():s)[0];var i=(0,a._)("_t"),c=(0,a._)("_e");class l{get current(){return(0,r._)(this,i)[i]}set current(e){(0,r._)(this,i)[i]!=e&&((0,r._)(this,i)[i]=e,(0,r._)(this,c)[c].forEach(t=>t(e)))}on(e){return(0,r._)(this,c)[c].add(e),()=>(0,r._)(this,c)[c].delete(e)}constructor(e){Object.defineProperty(this,i,{writable:!0,value:void 0}),Object.defineProperty(this,c,{writable:!0,value:void 0}),(0,r._)(this,c)[c]=new Set,(0,r._)(this,i)[i]=e}}const u=e=>new l(e),d=Symbol.for("atomico.hooks");globalThis[d]=globalThis[d]||{};let h=globalThis[d];const p=Symbol.for("Atomico.suspense"),f=Symbol.for("Atomico.effect"),m=Symbol.for("Atomico.layoutEffect"),y=Symbol.for("Atomico.insertionEffect"),b=(e,t,n)=>{const{i:o,hooks:r}=h.c,a=r[o]=r[o]||{};return a.value=e(a.value),a.effect=t,a.tag=n,h.c.i++,r[o].value},g=e=>b((t=u(e))=>t),v=()=>b((e=u(h.c.host))=>e),w=()=>h.c.update,k=(e,t,n=0)=>{let o={},r=!1;const a=(e,t)=>{for(const n in o){const r=o[n];r.effect&&r.tag===e&&(r.value=r.effect(r.value,t))}};return{load:a=>{let s;h.c={host:t,hooks:o,update:e,i:0,id:n};try{r=!1,s=a()}catch(e){if(e!==p)throw e;r=!0}finally{h.c=null}return s},cleanEffects:e=>(a(y,e),()=>(a(m,e),()=>{a(f,e)})),isSuspense:()=>r}},D=Symbol.for;function S(e,t){const n=e.length;if(n!==t.length)return!1;for(let o=0;o<n;o++){if(e[o]!==t[o])return!1}return!0}const x=e=>"function"==typeof e,C=e=>"object"==typeof e,{isArray:T}=Array,_=(e,t)=>(!t||e instanceof HTMLStyleElement)&&"hydrate"in(e?.dataset||{});function E(e,t){let n;const o=e=>{let{length:r}=e;for(let a=0;a<r;a++){const r=e[a];if(r&&Array.isArray(r))o(r);else{const e=typeof r;if(null==r||"function"===e||"boolean"===e)continue;"string"===e||"number"===e?(null==n&&(n=""),n+=r):(null!=n&&(t(n),n=null),t(r))}}};o(e),null!=n&&t(n)}const N=(e,t,n)=>(e.addEventListener(t,n),()=>e.removeEventListener(t,n));class M{constructor(e,t,n){this.message=t,this.target=e,this.value=n}}class P extends M{}class U extends M{}const $="Custom",A=null,O={true:1,"":1,1:1};function F(e,t,n,o,r){const{type:a,reflect:s,event:i,value:c,attr:l=j(t)}=n?.name!=$&&C(n)&&n!=A?n:{type:n},u=a?.name===$&&a.map,d=null!=c?a!=Function&&x(c)?c:()=>c:null;Object.defineProperty(e,t,{configurable:!0,set(e){const n=this[t];d&&a!=Boolean&&null==e&&(e=d());const{error:o,value:r}=(u?B:L)(a,e);if(o&&null!=r)throw new P(this,`The value defined for prop '${t}' must be of type '${a.name}'`,r);n!=r&&(this._props[t]=r??void 0,this.update(),i&&Y(this,i),this.updated.then(()=>{s&&(this._ignoreAttr=l,q(this,a,l,this[t]),this._ignoreAttr=null)}))},get(){return this._props[t]}}),d&&(r[t]=d()),o[l]={prop:t,type:a}}const Y=(e,{type:t,base:n=CustomEvent,...o})=>e.dispatchEvent(new n(t,o)),j=e=>e.replace(/([A-Z])/g,"-$1").toLowerCase(),q=(e,t,n,o)=>null==o||t==Boolean&&!o?e.removeAttribute(n):e.setAttribute(n,t?.name===$&&t?.serialize?t?.serialize(o):C(o)?JSON.stringify(o):t==Boolean?"":o),z=(e,t)=>e==Boolean?!!O[t]:e==Number?Number(t):e==String?t:e==Array||e==Object?JSON.parse(t):e.name==$?t:new e(t),B=({map:e},t)=>{try{return{value:e(t),error:!1}}catch{return{value:t,error:!0}}},L=(e,t)=>null==e||null==t?{value:t,error:!1}:e!=String&&""===t?{value:void 0,error:!1}:e==Object||e==Array||e==Symbol?{value:t,error:{}.toString.call(t)!==`[object ${e.name}]`}:t instanceof e?{value:t,error:e==Number&&Number.isNaN(t.valueOf())}:e==String||e==Number||e==Boolean?{value:t,error:e==Number?"number"!=typeof t||Number.isNaN(t):e==String?"string"!=typeof t:"boolean"!=typeof t}:{value:t,error:!0};let I=0;const W=e=>(e?.dataset||{})?.hydrate||""||"c"+I++,H=(e,t=HTMLElement)=>{const n={},o={},r="prototype"in t&&t.prototype instanceof Element,a=r?t:"base"in t?t.base:HTMLElement,{props:s,styles:i}=r?e:t;return class extends a{static get styles(){return[super.styles,i]}async _setup(){if(this._props)return;let e,t;this._props={},this.mounted=new Promise(n=>this.mount=()=>{n(),e!=this.parentNode&&(t!=e?this.unmounted.then(this.update):this.update()),e=this.parentNode}),this.unmounted=new Promise(o=>this.unmount=()=>{o(),(e!=this.parentNode||!this.isConnected)&&(n.cleanEffects(!0)()(),t=this.parentNode,e=null)}),this.symbolId=this.symbolId||Symbol(),this.symbolIdParent=Symbol();const n=k(()=>this.update(),this,W(this));let o,r=!0;const a=_(this);this.update=()=>(o||(o=!0,this.updated=(this.updated||this.mounted).then(()=>{try{const e=n.load(this._render),t=n.cleanEffects();return e&&e.render(this,this.symbolId,a),o=!1,r&&!n.isSuspense()&&(r=!1,!a&&R(this)),t()}finally{o=!1}}).then(e=>{e&&e()})),this.updated),this.update()}connectedCallback(){this.mount(),super.connectedCallback&&super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),this.unmount()}attributeChangedCallback(e,t,o){if(n[e]){if(e===this._ignoreAttr||t===o)return;const{prop:r,type:a}=n[e];try{this[r]=z(a,o)}catch{throw new U(this,`The value defined as attr '${e}' cannot be parsed by type '${a.name}'`,o)}}else super.attributeChangedCallback(e,t,o)}static get props(){return{...super.props,...s}}static get observedAttributes(){const e=super.observedAttributes||[];for(const e in s)F(this.prototype,e,s[e],n,o);return Object.keys(n).concat(e)}constructor(){super(),this._setup(),this._render=()=>e({...this._props});for(const e in o)this[e]=o[e]}}};function R(e){const{styles:t}=e.constructor,{shadowRoot:n}=e;if(n&&t.length){const e=[];E(t,t=>{t&&(t instanceof Element?n.appendChild(t.cloneNode(!0)):e.push(t))}),e.length&&(n.adoptedStyleSheets=e)}}const V=e=>(t,n)=>{b(([e,t]=[])=>((t||!t)&&(t&&S(t,n)?e=e||!0:(x(e)&&e(),e=null)),[e,n]),([e,n],o)=>o?(x(e)&&e(),[]):[e||t(),n],e)},J=V(f),K=V(y);class Z extends Array{constructor(e,t){let n=!0;const o=e=>{try{t(e,this,n)}finally{n=!1}};super(void 0,o,t),o(e)}}const G=e=>{const t=w();return b((n=new Z(e,(e,n,o)=>{(e=x(e)?e(n[0]):e)!==n[0]&&(n[0]=e,o||t())}))=>n)},Q=(e,t)=>{const[n]=b(([n,o,r=0]=[])=>((!o||o&&!S(o,t))&&(n=e()),[n,t,r]));return n},X=e=>{const{current:t}=v();if(!(e in t))throw new P(t,`For useProp("${e}"), the prop does not exist on the host.`,e);return b((n=new Z(t[e],(n,o)=>{n=x(n)?n(t[e]):n,t[e]=n}))=>(n[0]=t[e],n))},ee=(e,t={})=>{const n=v();return n[e]||(n[e]=(o=t.detail)=>Y(n.current,{type:e,...t,detail:o})),n[e]},te=D("atomico/options");globalThis[te]=globalThis[te]||{sheet:!!document.adoptedStyleSheets};const ne=globalThis[te],oe=new Promise(e=>{ne.ssr||("loading"===document.readyState?N(document,"DOMContentLoaded",e):e())}),re={checked:1,value:1,selected:1},ae={list:1,type:1,size:1,form:1,width:1,height:1,src:1,href:1,slot:1},se={shadowDom:1,staticNode:1,cloneNode:1,children:1,key:1},ie={},ce=[];class le extends Text{}const ue=D("atomico/id"),de=D("atomico/type"),he=D("atomico/ref"),pe=D("atomico/vnode"),fe=()=>{};function me(e,t,n){return be(this,e,t,n)}const ye=(e,t,...n)=>{const o=t||ie;let{children:r}=o;if(r=r??(n.length?n:ce),e===fe)return r;const a=e?e instanceof Node?1:e.prototype instanceof HTMLElement&&2:0;if(!1===a&&e instanceof Function)return e(r!=ce?{children:r,...o}:o);const s=ne.render||me;return{[de]:pe,type:e,props:o,children:r,key:o.key,shadow:o.shadowDom,static:o.staticNode,raw:a,is:o.is,clone:o.cloneNode,render:s}};function be(e,t,n=ue,o,r){let a;if(t&&t[n]&&t[n].vnode==e||e[de]!=pe)return t;(e||!t)&&(r=r||"svg"==e.type,a="host"!=e.type&&(1==e.raw?(t&&e.clone?t[he]:t)!=e.type:2==e.raw?!(t instanceof e.type):t?t[he]||t.localName!=e.type:!t),a&&null!=e.type&&(1==e.raw&&e.clone?(o=!0,(t=e.type.cloneNode(!0))[he]=e.type):t=1==e.raw?e.type:2==e.raw?new e.type:r?document.createElementNS("http://www.w3.org/2000/svg",e.type):document.createElement(e.type,e.is?{is:e.is}:void 0)));const s=t[n]?t[n]:ie,{vnode:i=ie,cycle:c=0}=s;let{fragment:l,handlers:u}=s;const{children:d=ce,props:h=ie}=i;if(u=a?{}:u||{},e.static&&!a)return t;if(e.shadow&&!t.shadowRoot&&t.attachShadow({mode:"open",...e.shadow}),e.props!=h&&we(t,h,e.props,u,r),e.children!==d){const a=e.shadow?t.shadowRoot:t;l=ve(e.children,l,a,n,!c&&o,(!r||"foreignObject"!=e.type)&&r)}return t[n]={vnode:e,handlers:u,fragment:l,cycle:c+1},t}function ge(e,t){const n=new le(""),o=new le("");let r;if(e[t?"prepend":"append"](n),t){let{lastElementChild:t}=e;for(;t;){const{previousElementSibling:e}=t;if(_(t,!0)&&!_(e,!0)){r=t;break}t=e}}return r?r.before(o):e.append(o),{markStart:n,markEnd:o}}function ve(e,t,n,o,r,a){e=null==e?null:T(e)?e:[e];const s=t||ge(n,r),{markStart:i,markEnd:c,keyes:l}=s;let u;const d=l&&new Set;let h=i;if(e&&E(e,e=>{if("object"==typeof e&&!e[de])return;const t=e[de]&&e.key,s=l&&null!=t&&l.get(t);h!=c&&h===s?d.delete(h):h=h==c?c:h.nextSibling;const i=l?s:h;let p=i;if(e[de])p=be(e,i,o,r,a);else{const t=e+"";!(p instanceof Text)||p instanceof le?p=new Text(t):p.data!=t&&(p.data=t)}p!=h&&(l&&d.delete(p),!i||l?(n.insertBefore(p,h),l&&h!=c&&d.add(h)):i==c?n.insertBefore(p,c):(n.replaceChild(p,i),h=p)),null!=t&&(u=u||new Map,u.set(t,p))}),h=h==c?c:h.nextSibling,t&&h!=c)for(;h!=c;){const e=h;h=h.nextSibling,e.remove()}return d&&d.forEach(e=>e.remove()),s.keyes=u,s}function we(e,t,n,o,r){for(const a in t)!(a in n)&&ke(e,a,t[a],null,r,o);for(const a in n)ke(e,a,t[a],n[a],r,o)}function ke(e,t,n,o,r,a){if(n=n??null,o=o??null,(t="class"!=t||r?t:"className")in e&&re[t]&&(n=e[t]),o!==n&&!se[t]&&"_"!=t[0])if("slot"===e.localName&&"assignNode"===t&&"assign"in e)e.assign(o);else if("o"==t[0]&&"n"==t[1]&&(x(o)||x(n)))De(e,t.slice(2),o,a);else if("ref"==t)o&&(x(o)?o(e):o.current=e);else if("style"==t){const{style:t}=e;o=o||"";const r=C(n=n||""),a=C(o);if(r)for(const e in n){if(!a)break;!(e in o)&&Se(t,e,null)}if(a)for(const e in o){const a=o[e];r&&n[e]===a||Se(t,e,a)}else t.cssText=o}else{const a="$"==t[0]?t.slice(1):t;a===t&&(!r&&!ae[t]&&t in e||x(o)||x(n))?e[t]=o??"":null==o?e.removeAttribute(a):e.setAttribute(a,C(o)?JSON.stringify(o):o)}}function De(e,t,n,o){if(o.handleEvent||(o.handleEvent=t=>o[t.type].call(e,t)),n){if(!o[t]){const r=n.capture||n.once||n.passive?Object.assign({},n):null;e.addEventListener(t,o,r)}o[t]=n}else o[t]&&(e.removeEventListener(t,o),delete o[t])}function Se(e,t,n){let o="setProperty";null==n&&(o="removeProperty",n=null),~t.indexOf("-")?e[o](t,n):e[t]=n}const xe=ye("host",{style:"display: contents"}),Ce="value",Te=(e,t)=>{const n=v(),o=g();K(()=>N(n.current,"ConnectContext",t=>{t.composedPath().at(0)!==t.currentTarget&&e===t.detail.id&&(t.stopPropagation(),t.detail.connect(o))}),[e]),o.current=t},_e=e=>{const t=ee("ConnectContext",{bubbles:!0,composed:!0}),[n,o]=G(()=>{if(ne.ssr)return;let n;return t({id:e,connect(e){n=e}}),n}),r=w();return J(()=>{oe.then(()=>t({id:e,connect:o}))},[e]),J(()=>{if(n)return n.on(r)},[n]),n?.current||e[Ce]},Ee=e=>{const t=H(({value:e})=>(Te(t,e),xe),{props:{value:{type:Object,value:()=>e}}});return t[Ce]=e,t};Ee({dispatch(e,t){}});const Ne={};function Me(e,...t){const n=(e.raw||e).reduce((e,n,o)=>e+n+(t[o]||""),"");return Ne[n]=Ne[n]||Pe(n)}function Pe(e){if(ne.sheet){const t=new CSSStyleSheet;return t.replaceSync(e),t}{const t=document.createElement("style");return t.textContent=e,t}}const Ue=(e,t,n)=>(null==t?t={key:n}:t.key=n,ye(e,t)),$e=Ue,Ae=Me`*,*:before,*:after{box-sizing:border-box}button{padding:0;touch-action:manipulation;cursor:pointer;user-select:none}`,Oe=Me`.vh{position:absolute;transform:scale(0)}`;function Fe(){const e=new Date;return new Je(e.getFullYear(),e.getMonth()+1,e.getDate())}const Ye=864e5;function je(e){const t=He(e);t.setUTCDate(t.getUTCDate()+3-(t.getUTCDay()+6)%7);const n=new Date(Date.UTC(t.getUTCFullYear(),0,4));return 1+Math.round(((t.getTime()-n.getTime())/Ye-3+(n.getUTCDay()+6)%7)/7)}function qe(e,t=0){const n=He(e),o=n.getUTCDay(),r=(o<t?7:0)+o-t;return n.setUTCDate(n.getUTCDate()-r),Je.from(n)}function ze(e,t=0){return qe(e,t).add({days:6})}function Be(e){return Je.from(new Date(Date.UTC(e.year,e.month,0)))}function Le(e,t,n){return t&&Je.compare(e,t)<0?t:n&&Je.compare(e,n)>0?n:e}const Ie={days:1};function We(e,t=0){let n=qe(e.toPlainDate(),t);const o=ze(Be(e),t),r=[];for(;Je.compare(n,o)<0;){const e=[];for(let t=0;t<7;t++)e.push(n),n=n.add(Ie);r.push(e)}return r}function He(e){return new Date(Date.UTC(e.year,e.month-1,e.day??1))}const Re=/^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[0-1])$/,Ve=(e,t)=>e.toString().padStart(t,"0");class Je{add(e){const t=He(this);if("days"in e)return t.setUTCDate(this.day+e.days),Je.from(t);let{year:n,month:o}=this;"months"in e?(o=this.month+e.months,t.setUTCMonth(o-1)):(n=this.year+e.years,t.setUTCFullYear(n));const r=Je.from(He({year:n,month:o,day:1}));return Le(Je.from(t),r,Be(r))}toString(){return`${Ve(this.year,4)}-${Ve(this.month,2)}-${Ve(this.day,2)}`}toPlainYearMonth(){return new Ke(this.year,this.month)}equals(e){return 0===Je.compare(this,e)}static compare(e,t){return e.year<t.year?-1:e.year>t.year?1:e.month<t.month?-1:e.month>t.month?1:e.day<t.day?-1:e.day>t.day?1:0}static from(e){if("string"==typeof e){const t=e.match(Re);if(!t)throw new TypeError(e);const[,n,o,r]=t;return new Je(parseInt(n,10),parseInt(o,10),parseInt(r,10))}return new Je(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate())}constructor(e,t,n){this.year=e,this.month=t,this.day=n}}class Ke{add(e){const t=He(this),n=(e.months??0)+12*(e.years??0);return t.setUTCMonth(t.getUTCMonth()+n),new Ke(t.getUTCFullYear(),t.getUTCMonth()+1)}equals(e){return this.year===e.year&&this.month===e.month}toPlainDate(){return new Je(this.year,this.month,1)}static compare(e,t){return e.year<t.year?-1:e.year>t.year?1:e.month<t.month?-1:e.month>t.month?1:0}constructor(e,t){this.year=e,this.month=t}}function Ze(e,t){if(t)try{return e.from(t)}catch{}}function Ge(e){const[t,n]=X(e);return[Q(()=>Ze(Je,t),[t]),e=>n(e?.toString())]}function Qe(e){const[t="",n]=X(e);return[Q(()=>{const[e,n]=t.split("/"),o=Ze(Je,e),r=Ze(Je,n);return o&&r?[o,r]:[]},[t]),e=>n(`${e[0]}/${e[1]}`)]}function Xe(e){const[t="",n]=X(e);return[Q(()=>{const e=[];for(const n of t.trim().split(/\s+/)){const t=Ze(Je,n);t&&e.push(t)}return e},[t]),e=>n(e.join(" "))]}function et(e,t){return Q(()=>new Intl.DateTimeFormat(t,{timeZone:"UTC",...e}),[t,e])}function tt(e,t,n){const o=et(e,n);return Q(()=>{const e=[],n=new Date;for(var r=0;r<7;r++){e[(n.getUTCDay()-t+7)%7]=o.format(n),n.setUTCDate(n.getUTCDate()+1)}return e},[t,o])}const nt=(e,t,n)=>Le(e,t,n)===e,ot=e=>e.target.matches(":dir(ltr)"),rt={month:"long",day:"numeric"},at={month:"long"},st={weekday:"long"},it={bubbles:!0};function ct({props:e,context:t}){const{offset:n}=e,{firstDayOfWeek:o,isDateDisallowed:r,min:a,max:s,today:i,page:c,locale:l,focusedDate:u,formatWeekday:d}=t,h=i??Fe(),p=tt(st,o,l),f=tt(Q(()=>({weekday:d}),[d]),o,l),m=et(rt,l),y=et(at,l),b=Q(()=>c.start.add({months:n}),[c,n]),g=Q(()=>We(b,o),[b,o]),v=ee("focusday",it),w=ee("selectday",it),k=ee("hoverday",it);function D(e){v(Le(e,a,s))}function S(e){let t;switch(e.key){case"ArrowRight":t=u.add({days:ot(e)?1:-1});break;case"ArrowLeft":t=u.add({days:ot(e)?-1:1});break;case"ArrowDown":t=u.add({days:7});break;case"ArrowUp":t=u.add({days:-7});break;case"PageUp":t=u.add(e.shiftKey?{years:-1}:{months:-1});break;case"PageDown":t=u.add(e.shiftKey?{years:1}:{months:1});break;case"Home":t=qe(u,o);break;case"End":t=ze(u,o);break;default:return}D(t),e.preventDefault()}return{weeks:g,yearMonth:b,daysLong:p,daysVisible:f,formatter:y,getDayProps:function(e){const n=b.equals(e);if(!t.showOutsideDays&&!n)return;const o=e.equals(u),i=e.equals(h),c=He(e),l=r?.(c),d=!nt(e,a,s);let p,f="";if("range"===t.type){const[n,o]=t.value,r=n?.equals(e),a=o?.equals(e);p=n&&o&&nt(e,n,o),f=`${r?"range-start":""} ${a?"range-end":""} ${!p||r||a?"":"range-inner"}`}else p="multi"===t.type?t.value.some(t=>t.equals(e)):t.value?.equals(e);return{part:`button day day-${c.getUTCDay()} ${n?p?"selected":"":"outside"} ${l?"disallowed":""} ${i?"today":""} ${t.getDayParts?.(c)??""} ${f}`,tabindex:n&&o?0:-1,disabled:d,"aria-disabled":l?"true":void 0,"aria-pressed":n&&p,"aria-current":i?"date":void 0,"aria-label":m.format(c),onkeydown:S,onclick(){l||w(e),D(e)},onmouseover(){!l&&!d&&k(e)}}}}}const lt=Fe(),ut=Ee({type:"date",firstDayOfWeek:1,focusedDate:lt,page:{start:lt.toPlainYearMonth(),end:lt.toPlainYearMonth()}});customElements.define("calendar-ctx",ut);const dt=(e,t)=>(t+e)%7,ht=H(e=>{const t=_e(ut),n=g(),o=ct({props:e,context:t});return $e("host",{shadowDom:!0,focus:function(){n.current.querySelector("button[tabindex='0']")?.focus()},children:[Ue("div",{id:"h",part:"heading",children:o.formatter.format(He(o.yearMonth))}),$e("table",{ref:n,"aria-labelledby":"h",part:"table",children:[$e("colgroup",{children:[t.showWeekNumbers&&Ue("col",{part:"col-weeknumber"}),Ue("col",{part:"col-1"}),Ue("col",{part:"col-2"}),Ue("col",{part:"col-3"}),Ue("col",{part:"col-4"}),Ue("col",{part:"col-5"}),Ue("col",{part:"col-6"}),Ue("col",{part:"col-7"})]}),Ue("thead",{children:$e("tr",{part:"tr head",children:[t.showWeekNumbers&&Ue("th",{part:"th weeknumber",children:$e("slot",{name:"weeknumber",children:[Ue("span",{class:"vh",children:"Week"}),Ue("span",{"aria-hidden":"true",children:"#"})]})}),o.daysLong.map((e,n)=>$e("th",{part:`th day day-${dt(t.firstDayOfWeek,n)}`,scope:"col",children:[Ue("span",{class:"vh",children:e}),Ue("span",{"aria-hidden":"true",children:o.daysVisible[n]})]}))]})}),Ue("tbody",{children:o.weeks.map((e,n)=>$e("tr",{part:"tr week",children:[t.showWeekNumbers&&Ue("th",{class:"num",part:"th weeknumber",scope:"row",children:je(e[0])}),e.map((e,t)=>{const n=o.getDayProps(e);return Ue("td",{part:"td",children:n&&Ue("button",{class:"num",...n,children:e.day})},t)})]},n))})]})]})},{props:{offset:{type:Number,value:0}},styles:[Ae,Oe,Me`:host{--color-accent: black;--color-text-on-accent: white;display:flex;flex-direction:column;gap:.25rem;text-align:center;inline-size:fit-content}table{border-collapse:collapse;font-size:.875rem}th{inline-size:2.25rem;block-size:2.25rem}td{padding-inline:0}.num{font-variant-numeric:tabular-nums}button{color:inherit;font-size:inherit;background:transparent;border:0;block-size:2.25rem;inline-size:2.25rem}button:hover:where(:not(:disabled,[aria-disabled])){background:#0000000d}button:is([aria-pressed=true],:focus-visible){background:var(--color-accent);color:var(--color-text-on-accent)}button:focus-visible{outline:1px solid var(--color-text-on-accent);outline-offset:-2px}button:disabled,:host::part(outside),:host::part(disallowed){cursor:default;opacity:.5}`]});function pt(e){return Ue("button",{part:`button ${e.name} ${e.onclick?"":"disabled"}`,onclick:e.onclick,"aria-disabled":e.onclick?null:"true",children:Ue("slot",{name:e.name,children:e.children})})}function ft(e){const t=He(e.page.start),n=He(e.page.end);return Ue(ut,{value:e,onselectday:e.onSelect,onfocusday:e.onFocus,onhoverday:e.onHover,children:$e("div",{role:"group","aria-labelledby":"h",part:"container",children:[Ue("div",{id:"h",class:"vh","aria-live":"polite","aria-atomic":"true",children:e.formatVerbose.formatRange(t,n)}),$e("div",{part:"header",children:[Ue(pt,{name:"previous",onclick:e.previous,children:"Previous"}),Ue("slot",{part:"heading",name:"heading",children:Ue("div",{"aria-hidden":"true",children:e.format.formatRange(t,n)})}),Ue(pt,{name:"next",onclick:e.next,children:"Next"})]}),Ue("slot",{part:"months"})]})})}customElements.define("calendar-month",ht);const mt={value:{type:String,value:""},min:{type:String,value:""},max:{type:String,value:""},today:{type:String,value:""},isDateDisallowed:{type:Function,value:e=>!1},formatWeekday:{type:String,value:()=>"narrow"},getDayParts:{type:Function,value:e=>""},firstDayOfWeek:{type:Number,value:()=>1},showOutsideDays:{type:Boolean,value:!1},locale:{type:String,value:()=>{}},months:{type:Number,value:1},focusedDate:{type:String,value:()=>{}},pageBy:{type:String,value:()=>"months"},showWeekNumbers:{type:Boolean,value:!1}},yt=[Ae,Oe,Me`:host{display:block;inline-size:fit-content}:host::part(container){display:flex;flex-direction:column;gap:1em}:host::part(header){display:flex;align-items:center;justify-content:space-between}:host::part(heading){font-weight:700;font-size:1.25em}:host::part(button){display:flex;align-items:center;justify-content:center}:host::part(button disabled){cursor:default;opacity:.5}`],bt={year:"numeric"},gt={year:"numeric",month:"long"};function vt(e,t){return 12*(t.year-e.year)+t.month-e.month}const wt=(e,t)=>({start:e=12===t?new Ke(e.year,1):e,end:e.add({months:t-1})});function kt({pageBy:e,focusedDate:t,months:n,max:o,min:r,goto:a}){const s="single"===e?1:n,[i,c]=G(()=>wt(t.toPlainYearMonth(),n)),l=e=>c(wt(i.start.add({months:e}),n)),u=e=>{const t=vt(i.start,e.toPlainYearMonth());return t>=0&&t<n};return J(()=>{if(u(t))return;const e=vt(t.toPlainYearMonth(),i.start);a(t.add({months:e}))},[i.start]),J(()=>{if(u(t))return;const e=vt(i.start,t.toPlainYearMonth());l(-1===e?-s:e===n?s:Math.floor(e/n)*n)},[t,s,n]),{page:i,previous:r&&u(r)?void 0:()=>l(-s),next:o&&u(o)?void 0:()=>l(s)}}function Dt({months:e,pageBy:t,locale:n,focusedDate:o,setFocusedDate:r}){const[a]=Ge("min"),[s]=Ge("max"),[i]=Ge("today"),c=ee("focusday"),l=ee("change"),u=Q(()=>Le(o??i??Fe(),a,s),[o,i,a,s]);function d(e){r(e),c(He(e))}const{next:h,previous:p,page:f}=kt({pageBy:t,focusedDate:u,months:e,min:a,max:s,goto:d}),m=v();function y(e){const t=e?.target??"day";"day"===t?m.current.querySelectorAll("calendar-month").forEach(t=>t.focus(e)):m.current.shadowRoot.querySelector(`[part~='${t}']`).focus(e)}return{format:et(bt,n),formatVerbose:et(gt,n),page:f,focusedDate:u,dispatch:l,onFocus(e){e.stopPropagation(),d(e.detail),setTimeout(y)},min:a,max:s,today:i,next:h,previous:p,focus:y}}const St=H(e=>{const[t,n]=Ge("value"),[o=t,r]=Ge("focusedDate"),a=Dt({...e,focusedDate:o,setFocusedDate:r});return Ue("host",{shadowDom:!0,focus:a.focus,children:Ue(ft,{...e,...a,type:"date",value:t,onSelect:function(e){n(e.detail),a.dispatch()}})})},{props:mt,styles:yt});function xt(e){return $e(fe,{children:[Ue("label",{part:"label",for:"s",children:Ue("slot",{name:"label",children:e.label})}),Ue("select",{id:"s",part:"select",onchange:e.onChange,children:e.options.map(e=>Ue("option",{part:"option",...e}))})]})}customElements.define("calendar-date",St);const Ct=[Ae,Oe];function Tt(e,t){return Array.from({length:e},(e,n)=>t(n))}function _t(e){const{min:t,max:n,focusedDate:o}=_e(ut),r=ee("focusday",{bubbles:!0}),a=o.toPlainYearMonth(),s=a.year,i=Math.floor(e.maxYears/2),c=s-i,l=s+(e.maxYears-i-1),u=Math.max(c,t?.year??-1/0);return{options:Tt(Math.min(l,n?.year??1/0)-u+1,e=>{const t=u+e;return{label:`${t}`,value:`${t}`,selected:t===a.year}}),onChange:function(e){const t=parseInt(e.currentTarget.value)-a.year;r(o.add({years:t}))}}}const Et=H(e=>{const t=_t(e);return Ue("host",{shadowDom:!0,children:Ue(xt,{label:"Year",...t})})},{props:{maxYears:{type:Number,value:20}},styles:Ct});function Nt(e){const{min:t,max:n,focusedDate:o,locale:r}=_e(ut),a=ee("focusday",{bubbles:!0}),s=et(Q(()=>({month:e.formatMonth}),[e.formatMonth]),r),i=Q(()=>{const e=[],t=new Date;t.setUTCDate(1);for(var n=0;n<12;n++){e[(t.getUTCMonth()+12)%12]=s.format(t),t.setUTCMonth(t.getUTCMonth()+1)}return e},[s]),c=o.toPlainYearMonth();return{options:i.map((e,o)=>{const r=o+1,a=c.add({months:r-c.month});return{label:e,value:`${r}`,disabled:null!=t&&Ke.compare(a,t)<0||null!=n&&Ke.compare(a,n)>0,selected:r===c.month}}),onChange:function(e){const t=parseInt(e.currentTarget.value)-c.month;a(o.add({months:t}))}}}customElements.define("calendar-select-year",Et);const Mt=H(e=>{const t=Nt(e);return Ue("host",{shadowDom:!0,children:Ue(xt,{label:"Month",...t})})},{props:{formatMonth:{type:String,value:()=>"long"}},styles:Ct});customElements.define("calendar-select-month",Mt);const Pt=(e,t)=>Je.compare(e,t)<0?[e,t]:[t,e],Ut=H(e=>{const[t,n]=Qe("value"),[o=t[0],r]=Ge("focusedDate"),a=Dt({...e,focusedDate:o,setFocusedDate:r}),s=ee("rangestart"),i=ee("rangeend"),[c,l]=Ge("tentative"),[u,d]=G();function h(e){e.stopPropagation(),c&&d(e.detail)}J(()=>d(void 0),[c]);const p=c?Pt(c,u??c):t;return Ue("host",{shadowDom:!0,focus:a.focus,children:Ue(ft,{...e,...a,type:"range",value:p,onFocus:function(e){a.onFocus(e),h(e)},onHover:h,onSelect:function(e){const t=e.detail;e.stopPropagation(),c?(n(Pt(c,t)),l(void 0),i(He(t)),a.dispatch()):(l(t),s(He(t)))}})})},{props:{...mt,tentative:{type:String,value:""}},styles:yt});customElements.define("calendar-range",Ut);const $t=H(e=>{const[t,n]=Xe("value"),[o=t[0],r]=Ge("focusedDate"),a=Dt({...e,focusedDate:o,setFocusedDate:r});return Ue("host",{shadowDom:!0,focus:a.focus,children:Ue(ft,{...e,...a,type:"multi",value:t,onSelect:function(e){const o=[...t],r=t.findIndex(t=>t.equals(e.detail));r<0?o.push(e.detail):o.splice(r,1),n(o),a.dispatch()}})})},{props:mt,styles:yt});customElements.define("calendar-multi",$t),t()}catch(At){t(At)}})}};