@duetds/date-picker
Version:
Duet Date Picker is an open source version of Duet Design System’s accessible date picker.
1 lines • 10.3 kB
JavaScript
const e="duet";let t=!1;const l="undefined"!=typeof window?window:{},n=l.CSS,s=l.document||{head:{}},o={t:0,l:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,l,n)=>e.addEventListener(t,l,n),rel:(e,t,l,n)=>e.removeEventListener(t,l,n),ce:(e,t)=>new CustomEvent(e,t)},i=e=>Promise.resolve(e),r=(()=>{try{return new CSSStyleSheet,!0}catch(e){}return!1})(),c=(e,t,l)=>{l&&l.map((([l,n,s])=>{const i=a(e,l),r=u(t,s),c=f(l);o.ael(i,n,r,c),(t.o=t.o||[]).push((()=>o.rel(i,n,r,c)))}))},u=(e,t)=>l=>{try{256&e.t?e.i[t](l):(e.u=e.u||[]).push([t,l])}catch(e){te(e)}},a=(e,t)=>4&t?s:e,f=e=>0!=(2&e),$=new WeakMap,d=e=>"sc-"+e.$,h={},y=e=>"object"==(e=typeof e)||"function"===e,p=(e,t,...l)=>{let n=null,s=null,o=!1,i=!1,r=[];const c=t=>{for(let l=0;l<t.length;l++)n=t[l],Array.isArray(n)?c(n):null!=n&&"boolean"!=typeof n&&((o="function"!=typeof e&&!y(n))&&(n+=""),o&&i?r[r.length-1].h+=n:r.push(o?m(null,n):n),i=o)};if(c(l),t){t.key&&(s=t.key);{const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}}if("function"==typeof e)return e(null===t?{}:t,r,b);const u=m(e,null);return u.p=t,r.length>0&&(u.m=r),u.g=s,u},m=(e,t)=>({t:0,v:e,h:t,j:null,m:null,p:null,g:null}),w={},b={forEach:(e,t)=>e.map(g).forEach(t),map:(e,t)=>e.map(g).map(t).map(v)},g=e=>({vattrs:e.p,vchildren:e.m,vkey:e.g,vname:e.k,vtag:e.v,vtext:e.h}),v=e=>{if("function"==typeof e.vtag){const t=Object.assign({},e.vattrs);return e.vkey&&(t.key=e.vkey),e.vname&&(t.name=e.vname),p(e.vtag,t,...e.vchildren||[])}const t=m(e.vtag,e.vtext);return t.p=e.vattrs,t.m=e.vchildren,t.g=e.vkey,t.k=e.vname,t},j=(e,t,n,s,i,r)=>{if(n!==s){let c=ee(e,t),u=t.toLowerCase();if("class"===t){const t=e.classList,l=O(n),o=O(s);t.remove(...l.filter((e=>e&&!o.includes(e)))),t.add(...o.filter((e=>e&&!l.includes(e))))}else if("key"===t);else if("ref"===t)s&&s(e);else if(c||"o"!==t[0]||"n"!==t[1]){const l=y(s);if((c||l&&null!==s)&&!i)try{if(e.tagName.includes("-"))e[t]=s;else{let l=null==s?"":s;"list"===t?c=!1:null!=n&&e[t]==l||(e[t]=l)}}catch(e){}null==s||!1===s?!1===s&&""!==e.getAttribute(t)||e.removeAttribute(t):(!c||4&r||i)&&!l&&e.setAttribute(t,s=!0===s?"":s)}else t="-"===t[2]?t.slice(3):ee(l,u)?u.slice(2):u[2]+t.slice(3),n&&o.rel(e,t,n,!1),s&&o.ael(e,t,s,!1)}},k=/\s/,O=e=>e?e.split(k):[],x=(e,t,l,n)=>{const s=11===t.j.nodeType&&t.j.host?t.j.host:t.j,o=e&&e.p||h,i=t.p||h;for(n in o)n in i||j(s,n,o[n],void 0,l,t.t);for(n in i)j(s,n,o[n],i[n],l,t.t)},M=(e,l,n)=>{let o,i,r=l.m[n],c=0;if(null!==r.h)o=r.j=s.createTextNode(r.h);else{if(t||(t="svg"===r.v),o=r.j=s.createElementNS(t?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",r.v),t&&"foreignObject"===r.v&&(t=!1),x(null,r,t),r.m)for(c=0;c<r.m.length;++c)i=M(e,r,c),i&&o.appendChild(i);"svg"===r.v?t=!1:"foreignObject"===o.tagName&&(t=!0)}return o},S=(e,t,l,n,s,o)=>{let i,r=e;for(;s<=o;++s)n[s]&&(i=M(null,l,s),i&&(n[s].j=i,r.insertBefore(i,t)))},C=(e,t,l,n,s)=>{for(;t<=l;++t)(n=e[t])&&(s=n.j,E(n),s.remove())},P=(e,t)=>e.v===t.v&&e.g===t.g,_=(e,l)=>{const n=l.j=e.j,s=e.m,o=l.m,i=l.v,r=l.h;null===r?(t="svg"===i||"foreignObject"!==i&&t,x(e,l,t),null!==s&&null!==o?((e,t,l,n)=>{let s,o,i=0,r=0,c=0,u=0,a=t.length-1,f=t[0],$=t[a],d=n.length-1,h=n[0],y=n[d];for(;i<=a&&r<=d;)if(null==f)f=t[++i];else if(null==$)$=t[--a];else if(null==h)h=n[++r];else if(null==y)y=n[--d];else if(P(f,h))_(f,h),f=t[++i],h=n[++r];else if(P($,y))_($,y),$=t[--a],y=n[--d];else if(P(f,y))_(f,y),e.insertBefore(f.j,$.j.nextSibling),f=t[++i],y=n[--d];else if(P($,h))_($,h),e.insertBefore($.j,f.j),$=t[--a],h=n[++r];else{for(c=-1,u=i;u<=a;++u)if(t[u]&&null!==t[u].g&&t[u].g===h.g){c=u;break}c>=0?(o=t[c],o.v!==h.v?s=M(t&&t[r],l,c):(_(o,h),t[c]=void 0,s=o.j),h=n[++r]):(s=M(t&&t[r],l,r),h=n[++r]),s&&f.j.parentNode.insertBefore(s,f.j)}i>a?S(e,null==n[d+1]?null:n[d+1].j,l,n,r,d):r>d&&C(t,i,a)})(n,s,l,o):null!==o?(null!==e.h&&(n.textContent=""),S(n,null,l,o,0,o.length-1)):null!==s&&C(s,0,s.length-1),t&&"svg"===i&&(t=!1)):e.h!==r&&(n.data=r)},E=e=>{e.p&&e.p.ref&&e.p.ref(null),e.m&&e.m.map(E)},I=e=>X(e).O,T=(e,t,l)=>{const n=I(e);return{emit:e=>A(n,t,{bubbles:!!(4&l),composed:!!(2&l),cancelable:!!(1&l),detail:e})}},A=(e,t,l)=>{const n=o.ce(t,l);return e.dispatchEvent(n),n},F=(e,t)=>{t&&!e.M&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.M=t)))},H=(e,t)=>{if(!(4&e.t))return F(e,e.S),L(e,t);e.t|=512},L=(e,t)=>{const l=e.i;return t&&(e.t|=256,e.u&&(e.u.map((([e,t])=>q(l,e,t))),e.u=null)),V(void 0,(()=>N(e,l,t)))},N=async(e,t,l)=>{const n=e.O,o=n["s-rc"];l&&(e=>{const t=e.C;((e,t)=>{let l=d(t),n=se.get(l);if(e=11===e.nodeType?e:s,n)if("string"==typeof n){let t,o=$.get(e=e.head||e);o||$.set(e,o=new Set),o.has(l)||(e.host&&(t=e.querySelector(`[sty-id="${l}"]`))?t.innerHTML=n:(t=s.createElement("style"),t.innerHTML=n,e.insertBefore(t,e.querySelector("link"))),o&&o.add(l))}else e.adoptedStyleSheets.includes(n)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,n])})(e.O.getRootNode(),t)})(e);((e,t)=>{const l=e.O,n=e.C,s=e.P||m(null,null),o=(e=>e&&e.v===w)(t)?t:p(null,null,t);n._&&(o.p=o.p||{},n._.map((([e,t])=>o.p[t]=l[e]))),o.v=null,o.t|=4,e.P=o,o.j=s.j=l,_(s,o)})(e,R(e,t)),o&&(o.map((e=>e())),n["s-rc"]=void 0);{const t=n["s-p"],l=()=>U(e);0===t.length?l():(Promise.all(t).then(l),e.t|=4,t.length=0)}},R=(e,t)=>{try{t=t.render(),e.t|=2}catch(t){te(t,e.O)}return t},U=e=>{const t=e.O,l=e.S;64&e.t||(e.t|=64,z(t),e.I(t),l||W()),e.T(t),e.M&&(e.M(),e.M=void 0),512&e.t&&oe((()=>H(e,!1))),e.t&=-517},W=()=>{z(s.documentElement),oe((()=>A(l,"appload",{detail:{namespace:"duet"}})))},q=(e,t,l)=>{if(e&&e[t])try{return e[t](l)}catch(e){te(e)}},V=(e,t)=>e&&e.then?e.then(t):t(),z=e=>e.classList.add("hydrated"),B=(e,t,l,n,s,o,i)=>{let r,c,u,a;if(1===o.nodeType){for(r=o.getAttribute("c-id"),r&&(c=r.split("."),c[0]!==i&&"0"!==c[0]||(u={t:0,A:c[0],F:c[1],H:c[2],L:c[3],v:o.tagName.toLowerCase(),j:o,p:null,m:null,g:null,k:null,h:null},t.push(u),o.removeAttribute("c-id"),e.m||(e.m=[]),e.m[u.L]=u,e=u,n&&"0"===u.H&&(n[u.L]=u.j))),a=o.childNodes.length-1;a>=0;a--)B(e,t,l,n,s,o.childNodes[a],i);if(o.shadowRoot)for(a=o.shadowRoot.childNodes.length-1;a>=0;a--)B(e,t,l,n,s,o.shadowRoot.childNodes[a],i)}else if(8===o.nodeType)c=o.nodeValue.split("."),c[1]!==i&&"0"!==c[1]||(r=c[0],u={t:0,A:c[1],F:c[2],H:c[3],L:c[4],j:o,p:null,m:null,g:null,k:null,v:null,h:null},"t"===r?(u.j=o.nextSibling,u.j&&3===u.j.nodeType&&(u.h=u.j.textContent,t.push(u),o.remove(),e.m||(e.m=[]),e.m[u.L]=u,n&&"0"===u.H&&(n[u.L]=u.j))):u.A===i&&"s"===r&&(u.v="slot",o["s-sn"]=c[5]?u.k=c[5]:"",o["s-sr"]=!0,l.push(u),e.m||(e.m=[]),e.m[u.L]=u));else if(e&&"style"===e.v){const t=m(null,o.textContent);t.j=o,t.L="0",e.m=[t]}},D=(e,t)=>{if(1===e.nodeType){let l=0;for(;l<e.childNodes.length;l++)D(e.childNodes[l],t);if(e.shadowRoot)for(l=0;l<e.shadowRoot.childNodes.length;l++)D(e.shadowRoot.childNodes[l],t)}else if(8===e.nodeType){const l=e.nodeValue.split(".");"o"===l[0]&&(t.set(l[1]+"."+l[2],e),e.nodeValue="",e["s-en"]=l[3])}},G=(e,t,l)=>{if(t.N){const n=Object.entries(t.N),s=e.prototype;if(n.map((([e,[n]])=>{31&n||2&l&&32&n?Object.defineProperty(s,e,{get(){return((e,t)=>X(this).R.get(t))(0,e)},set(l){((e,t,l,n)=>{const s=X(e),o=s.R.get(t),i=s.t,r=s.i;l=((e,t)=>null==e||y(e)?e:4&t?"false"!==e&&(""===e||!!e):2&t?parseFloat(e):1&t?e+"":e)(l,n.N[t][0]),8&i&&void 0!==o||l===o||(s.R.set(t,l),r&&2==(18&i)&&H(s,!1))})(this,e,l,t)},configurable:!0,enumerable:!0}):1&l&&64&n&&Object.defineProperty(s,e,{value(...t){const l=X(this);return l.U.then((()=>l.i[e](...t)))}})})),1&l){const l=new Map;s.attributeChangedCallback=function(e,t,n){o.jmp((()=>{const t=l.get(e);this[t]=(null!==n||"boolean"!=typeof this[t])&&n}))},e.observedAttributes=n.filter((([e,t])=>15&t[0])).map((([e,n])=>{const s=n[1]||e;return l.set(s,e),512&n[0]&&t._.push([e,s]),s}))}}return e},J=e=>{if(0==(1&o.t)){const t=X(e),l=t.C,n=()=>{};if(1&t.t)c(e,t,l.W);else{let n;t.t|=1,n=e.getAttribute("s-id"),n&&((e,t,l,n)=>{const i=e.shadowRoot,r=[],c=n.P=m(t,null);o.q||D(s.body,o.q=new Map),e["s-id"]=l,e.removeAttribute("s-id"),B(c,r,[],null,e,e,l),r.map((e=>{const l=e.A+"."+e.F,n=o.q.get(l),s=e.j;n&&""===n["s-en"]&&n.parentNode.insertBefore(s,n.nextSibling),i||(s["s-hn"]=t,n&&(s["s-ol"]=n,s["s-ol"]["s-nr"]=s)),o.q.delete(l)}))})(e,l.$,n,t);{let l=e;for(;l=l.parentNode||l.host;)if(1===l.nodeType&&l.hasAttribute("s-id")&&l["s-p"]||l["s-p"]){F(t,t.S=l);break}}l.N&&Object.entries(l.N).map((([t,[l]])=>{if(31&l&&e.hasOwnProperty(t)){const l=e[t];delete e[t],e[t]=l}})),oe((()=>(async(e,t,l,n,s)=>{if(0==(32&t.t)){{if(t.t|=32,(s=ne(l)).then){const e=()=>{};s=await s,e()}s.isProxied||(G(s,l,2),s.isProxied=!0);const e=()=>{};t.t|=8;try{new s(t)}catch(e){te(e)}t.t&=-9,e()}if(s.style){let e=s.style;const t=d(l);if(!se.has(t)){const n=()=>{};((e,t,l)=>{let n=se.get(e);r&&l?(n=n||new CSSStyleSheet,n.replace(t)):n=t,se.set(e,n)})(t,e,!!(1&l.t)),n()}}}const o=t.S,i=()=>H(t,!0);o&&o["s-rc"]?o["s-rc"].push(i):i()})(0,t,l)))}n()}},K=(e,t={})=>{const n=[],i=t.exclude||[],r=l.customElements,c=s.head,u=c.querySelector("meta[charset]"),a=s.createElement("style"),f=[];let $,d=!0;Object.assign(o,t),o.l=new URL(t.resourcesUrl||"./",s.baseURI).href,o.t|=2,e.map((e=>e[1].map((t=>{const l={t:t[0],$:t[1],N:t[2],W:t[3]};l.N=t[2],l.W=t[3],l._=[];const s=l.$,c=class extends HTMLElement{constructor(e){super(e),Z(e=this,l)}connectedCallback(){$&&(clearTimeout($),$=null),d?f.push(this):o.jmp((()=>J(this)))}disconnectedCallback(){o.jmp((()=>(()=>{if(0==(1&o.t)){const e=X(this);e.o&&(e.o.map((e=>e())),e.o=void 0)}})()))}componentOnReady(){return X(this).V}};l.B=e[0],i.includes(s)||r.get(s)||(n.push(s),r.define(s,G(c,l,1)))})))),a.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",a.setAttribute("data-styles",""),c.insertBefore(a,u?u.nextSibling:c.firstChild),d=!1,f.length?f.map((e=>e.connectedCallback())):o.jmp((()=>$=setTimeout(W,30)))},Q=new WeakMap,X=e=>Q.get(e),Y=(e,t)=>Q.set(t.i=e,t),Z=(e,t)=>{const l={t:0,O:e,C:t,R:new Map};return l.U=new Promise((e=>l.T=e)),l.V=new Promise((e=>l.I=e)),e["s-p"]=[],e["s-rc"]=[],c(e,l,t.W),Q.set(e,l)},ee=(e,t)=>t in e,te=(e,t)=>(0,console.error)(e,t),le=new Map,ne=e=>{const t=e.$.replace(/-/g,"_"),l=e.B,n=le.get(l);return n?n[t]:__sc_import_duet(`./${l}.entry.js`).then((e=>(le.set(l,e),e[t])),te)},se=new Map,oe=e=>i().then(e);export{n as C,w as H,e as N,i as a,K as b,T as c,s as d,I as g,p as h,o as p,Y as r,l as w}