PageSourceSearch

https://dz.diesel.com/on/demandware.static/Sites-DieselWW-Site/-/e…/js/component-CustomDatePicker.chunks.js

js diesel.com collected 2026-09-24 08:41:55 UTC 20,124 bytes, 1 lines download raw bytes

1(self.webpackChunkapp_project=self.webpackChunkapp_project||[]).push([[3898],{51802:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>s});const a={en:{months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Su","Mo","Tu","We","Th","Fr","Sa"],prevDecade:"Previous decade",nextDecade:"Next decade",prevYear:"Previous year",nextYear:"Next year",prevMonth:"Previous month",nextMonth:"Next month",chooseDate:"Choose date",dateSelected:"Date selected",instructions:"Press Enter or Space to open the date picker."},it:{months:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"],monthsShort:["Gen","Feb","Mar","Apr","Mag","Giu","Lug","Ago","Set","Ott","Nov","Dic"],weekdays:["Domenica","Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato"],weekdaysShort:["Do","Lu","Ma","Me","Gi","Ve","Sa"],prevDecade:"Decade precedente",nextDecade:"Decade successiva",prevYear:"Anno precedente",nextYear:"Anno successivo",prevMonth:"Mese precedente",nextMonth:"Mese successivo",chooseDate:"Scegli una data",dateSelected:"Data selezionata",instructions:"Premi Invio o Spazio per aprire il selettore data."},fr:{months:["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"],monthsShort:["Jan","Fév","Mar","Avr","Mai","Jun","Jul","Aoû","Sep","Oct","Nov","Déc"],weekdays:["Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi"],weekdaysShort:["Di","Lu","Ma","Me","Je","Ve","Sa"],prevDecade:"Décennie précédente",nextDecade:"Décennie suivante",prevYear:"Année précédente",nextYear:"Année suivante",prevMonth:"Mois précédent",nextMonth:"Mois suivant",chooseDate:"Choisir une date",dateSelected:"Date sélectionnée",instructions:"Appuyez sur Entrée ou Espace pour ouvrir le sélecteur de date."},de:{months:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],monthsShort:["Jan","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"],weekdays:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],weekdaysShort:["So","Mo","Di","Mi","Do","Fr","Sa"],prevDecade:"Vorheriges Jahrzehnt",nextDecade:"Nächstes Jahrzehnt",prevYear:"Vorheriges Jahr",nextYear:"Nächstes Jahr",prevMonth:"Vorheriger Monat",nextMonth:"Nächster Monat",chooseDate:"Datum wählen",dateSelected:"Datum ausgewählt",instructions:"Drücken Sie Enter oder Leertaste, um den Datumsauswähler zu öffnen."},es:{months:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],monthsShort:["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"],weekdays:["Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado"],weekdaysShort:["Do","Lu","Ma","Mi","Ju","Vi","Sa"],prevDecade:"Década anterior",nextDecade:"Década siguiente",prevYear:"Año anterior",nextYear:"Año siguiente",prevMonth:"Mes anterior",nextMonth:"Mes siguiente",chooseDate:"Elegir fecha",dateSelected:"Fecha seleccionada",instructions:"Pulse Intro o Espacio para abrir el selector de fecha."}};class s{constructor(e,t,i,s,n){this.input=e,this.formEl=t,this.labelEl=i,this.errorEl=s,this.onSelect=n||(()=>{});const r=e.dataset.language||document.documentElement.lang||"en";this.i18n=a[r]||a.en,this.lang=r,this.format=e.dataset.format||"dd/mm/yyyy",this.minDate=new Date(1900,0,1),this.maxDate=null,this.baseAriaLabel=e.getAttribute("aria-label")||(i?i.textContent.trim():""),e.dataset.milliseconds&&(this.maxDate=new Date(Date.now()-Number(e.dataset.milliseconds)),delete e.dataset.milliseconds),this.isOpen=!1,this.view="decade",this.selectedDate=null,this.focusedDate=new Date,this.decadeStart=10*Math.floor(this.focusedDate.getFullYear()/10),this._focusTargetText=null,this._uid="dp-".concat(Math.random().toString(36).slice(2,7)),this._build(),this._setupProxyButton(),this._bindEvents()}_build(){this.liveRegion=document.createElement("div"),this.liveRegion.className="form-element__sr-only",this.liveRegion.setAttribute("aria-live","polite"),this.liveRegion.setAttribute("aria-atomic","true"),this.formEl.appendChild(this.liveRegion);const e="".concat(this._uid,"-hint"),t=document.createElement("span");t.id=e,t.className="form-element__sr-only",t.textContent=this.i18n.instructions,
1(this.errorEl||this.input).insertAdjacentElement("afterend",t),this._buildCalendar()}_buildCalendar(){this.calendar=document.createElement("div"),this.calendar.id="".concat(this._uid,"-cal"),this.calendar.className="dp-calendar",this.calendar.setAttribute("role","dialog"),this.calendar.setAttribute("aria-modal","false"),this.calendar.setAttribute("aria-label",this.baseAriaLabel||this.i18n.chooseDate),this.calendar.setAttribute("aria-hidden","true"),this.calendar.hidden=!0,this.calendar.addEventListener("mousedown",(e=>e.preventDefault()));const e=document.createElement("div");e.className="dp-nav",this.prevBtn=this._makeNavBtn("‹"),this.navLabel=document.createElement("span"),this.navLabel.className="dp-nav__label",this.navLabel.setAttribute("aria-live","polite"),this.navLabel.setAttribute("aria-atomic","true"),this.nextBtn=this._makeNavBtn("›"),e.appendChild(this.prevBtn),e.appendChild(this.navLabel),e.appendChild(this.nextBtn),this.gridWrapper=document.createElement("div"),this.gridWrapper.setAttribute("role","application"),this.gridWrapper.setAttribute("aria-label",this.baseAriaLabel||this.i18n.chooseDate),this.gridEl=document.createElement("table"),this.gridEl.className="dp-grid",this.gridEl.setAttribute("role","grid"),this.gridWrapper.appendChild(this.gridEl),this.calendar.appendChild(e),this.calendar.appendChild(this.gridWrapper),document.body.appendChild(this.calendar)}_makeNavBtn(e){const t=document.createElement("button");return t.type="button",t.className="dp-nav__btn",t.innerHTML=e,t.addEventListener("mousedown",(e=>e.preventDefault())),t}_setupProxyButton(){const e=this.input,t="".concat(this._uid,"-hint");this.proxyBtn=document.createElement("button"),this.proxyBtn.type="button",this.proxyBtn.className="form-element__sr-only",this.proxyBtn.setAttribute("role","button"),this.proxyBtn.setAttribute("aria-expanded","false"),this.proxyBtn.setAttribute("aria-haspopup","dialog"),this.proxyBtn.setAttribute("aria-controls","".concat(this._uid,"-cal")),this.proxyBtn.setAttribute("aria-label",this.baseAriaLabel||this.i18n.chooseDate);const i=e.getAttribute("aria-describedby")||"";this.proxyBtn.setAttribute("aria-describedby",[i,t].filter(Boolean).join(" ").trim()),e.parentNode.insertBefore(this.proxyBtn,e),e.setAttribute("aria-hidden","true"),e.setAttribute("tabindex","-1"),e.setAttribute("readonly",""),e.setAttribute("autocomplete","off"),e.removeAttribute("aria-label"),e.removeAttribute("aria-describedby"),this.proxyBtn.addEventListener("focus",(()=>{e.classList.add("dp-input-focused"),e.value||e.setAttribute("placeholder"," ")})),this.proxyBtn.addEventListener("blur",(()=>{e.classList.remove("dp-input-focused"),e.value||e.removeAttribute("placeholder")}))}_bindEvents(){this.input.addEventListener("mousedown",(e=>{e.preventDefault(),this.proxyBtn.focus(),this._toggle()})),this.labelEl&&this.labelEl.addEventListener("click",(e=>{e.preventDefault(),this.proxyBtn.focus(),this._open()})),this.proxyBtn.addEventListener("click",(()=>this._toggle())),this.proxyBtn.addEventListener("keydown",(e=>this._onProxyKeydown(e))),this._onDocClick=e=>{!this.isOpen||this.calendar.contains(e.target)||this.formEl.contains(e.target)||this._close()},document.addEventListener("click",this._onDocClick),this._onScrollResize=()=>{this.isOpen&&this._position()},window.addEventListener("scroll",this._onScrollResize,!0),window.addEventListener("resize",this._onScrollResize),this.prevBtn.addEventListener("click",(e=>{e.stopPropagation(),this._navigatePrev()})),this.nextBtn.addEventListener("click",(e=>{e.stopPropagation(),this._navigateNext()})),this.gridWrapper.addEventListener("keydown",(e=>this._onGridKeydown(e)))}_onProxyKeydown(e){return"Enter"!==e.key&&" "!==e.key&&"ArrowDown"!==e.key||this.isOpen?"Escape"===e.key&&this.isOpen?(e.preventDefault(),void this._close()):void 0:(e.preventDefault(),void this._open())}_onGridKeydown(e){const t=this.gridEl.getAttribute("aria-activedescendant"),i=t&&document.getElementById(t)||this.gridEl.querySelector('[tabindex="0"]');if(i)if("decade"===this.view)this._arrowNav(e,i,4);else if("month"===this.view){if("Backspace"===e.key)return e.preventDefault(),void this._setVie
1w("decade");this._arrowNav(e,i,4)}else if("day"===this.view){if("Backspace"===e.key)return e.preventDefault(),void this._setView("month");if("PageUp"===e.key)return e.preventDefault(),void this._navigatePrev();if("PageDown"===e.key)return e.preventDefault(),void this._navigateNext();this._arrowNav(e,i,7)}}_arrowNav(e,t,i){const a=[...this.gridEl.querySelectorAll(".dp-cell:not(.dp-cell--header)")],s=a.indexOf(t);let n=null,r=null;switch(e.key){case"ArrowRight":s+1<a.length?n=a[s+1]:r="next";break;case"ArrowLeft":s-1>=0?n=a[s-1]:r="prev";break;case"ArrowDown":s+i<a.length?n=a[s+i]:r="next";break;case"ArrowUp":s-i>=0?n=a[s-i]:r="prev";break;case"Enter":case" ":return e.preventDefault(),void(t.classList.contains("dp-cell--disabled")||t.click());case"Escape":return e.preventDefault(),void this._close();case"Tab":return void this._close();default:return}if(r)return e.preventDefault(),void("next"===r&&this._canNavigateNext()?(this._focusTargetText=t.textContent.trim(),this._navigateNext()):"prev"===r&&this._canNavigatePrev()&&(this._focusTargetText=t.textContent.trim(),this._navigatePrev()));n&&(e.preventDefault(),this._activateCell(t,n))}_activateCell(e,t){t.id||(t.id="".concat(this._uid,"-cell-").concat(Math.random().toString(36).slice(2,6))),e&&e.setAttribute("tabindex","-1"),t.setAttribute("tabindex","0"),this.gridEl.setAttribute("aria-activedescendant",t.id),document.activeElement!==this.gridEl&&(this.gridEl.setAttribute("tabindex","0"),this.gridEl.focus({preventScroll:!0}));const i=t.getAttribute("aria-label")||t.textContent.trim();this._announce(i)}_canNavigatePrev(){if(!this.minDate)return!0;const e=this.minDate.getFullYear();if("decade"===this.view)return this.decadeStart-1>=e;if("month"===this.view)return this.focusedDate.getFullYear()-1>=e;const t=new Date(this.focusedDate.getFullYear(),this.focusedDate.getMonth(),0);return this._startOfDay(t)>=this._startOfDay(this.minDate)}_canNavigateNext(){if(!this.maxDate)return!0;const e=this.maxDate.getFullYear();if("decade"===this.view)return this.decadeStart+10<=e;if("month"===this.view)return this.focusedDate.getFullYear()+1<=e;const t=new Date(this.focusedDate.getFullYear(),this.focusedDate.getMonth()+1,1);return this._startOfDay(t)<=this._startOfDay(this.maxDate)}_updateNavState(){this.prevBtn.disabled=!this._canNavigatePrev(),this.nextBtn.disabled=!this._canNavigateNext()}_toggle(){this.isOpen?this._close():this._open()}_open(){this.isOpen||(this.isOpen=!0,this.calendar.hidden=!1,this.calendar.setAttribute("aria-hidden","false"),this.proxyBtn.setAttribute("aria-expanded","true"),this.selectedDate?this.focusedDate=new Date(this.selectedDate):this.maxDate?this.focusedDate=new Date(this.maxDate):this.focusedDate=new Date,this.decadeStart=10*Math.floor(this.focusedDate.getFullYear()/10),this._position(),this._setView("decade"),this._announce(this.i18n.chooseDate))}_close(){this.isOpen&&(this.isOpen=!1,this.proxyBtn.focus(),this.calendar.hidden=!0,this.calendar.setAttribute("aria-hidden","true"),this.proxyBtn.setAttribute("aria-expanded","false"))}_position(){const e=this.input.getBoundingClientRect(),t=this.calendar.offsetHeight||300,i=window.scrollX,a=window.scrollY,s=window.innerHeight-e.bottom,n=s>=t||s>=e.top?e.bottom+a+4:e.top+a-t-4;let r=e.left+i;r=Math.min(r,window.innerWidth+i-280-8),r=Math.max(r,i+8),Object.assign(this.calendar.style,{position:"absolute",top:"".concat(n,"px"),left:"".concat(r,"px"),width:"".concat(280,"px"),zIndex:"9999"})}_setView(e){this.view=e,"decade"===e?this._renderDecade():"month"===e?this._renderMonth():"day"===e&&this._renderDay(),requestAnimationFrame((()=>{this._position(),this._initFocus()}))}_navigatePrev(){this._canNavigatePrev()&&("decade"===this.view?(this.decadeStart-=10,this._renderDecade()):"month"===this.view?(this.focusedDate.setFullYear(this.focusedDate.getFullYear()-1),this._renderMonth()):"day"===this.view&&(this.focusedDate.setMonth(this.focusedDate.getMonth()-1),this._renderDay()),requestAnimationFrame((()=>this._initFocus())))}_navigateNext(){this._canNavigateNext()&&("decade"===this.view?(this.decadeStart+=10,this._renderDecade()):"month"===this.view?(this.focusedDate.setFullYear(this.focusedDate.getFullYear()+1),this._renderMonth()):"day"===this.view&&(this.focusedDate.setMonth(this.focusedDate.getMonth()+1),this._renderDay()),requestAnimationFrame((()=>this._initFocus())))}_renderDecade(){this.prevBtn.setAttribute("aria-label",this.i18n.prevDecade),this.nextBtn.setAttribute("aria-label",this.i18n.nextDecade),this.navLabel.textContent="".concat(this.decadeStart,"–").concat(this.decadeStart+9),this.gridEl.innerHTML="";const e=document.createElement("tbody");this.gridEl.appendChild(e);const t=[];for(let e=this.decadeStart-1;e<=this.decadeStart+10;e++)t.push(e);let i;t.forEach(((t,a)=>{a%4==0&&(i=this._makeRow(),e.appendChild(i)),i.appendChild(this._makeCell(String(t),{isOutside:t<this.decadeStart||t>this.decadeStart+9,isSelected:this.selectedDate&&this.selectedDate.getFullYear()===t,isDisabled:this._yearDisabled(t),ariaLabel:String(t),onClick:()=>
1{this.focusedDate.setFullYear(t),this._setView("month"),this._announce(this.i18n.chooseDate)}}))})),this._updateNavState(),this._initFocus(),this._announce("".concat(this.navLabel.textContent))}_renderMonth(){const e=this.focusedDate.getFullYear();this.prevBtn.setAttribute("aria-label",this.i18n.prevYear),this.nextBtn.setAttribute("aria-label",this.i18n.nextYear),this.navLabel.textContent=String(e),this.gridEl.innerHTML="";const t=document.createElement("tbody");let i;this.gridEl.appendChild(t),this.i18n.monthsShort.forEach(((a,s)=>{s%4==0&&(i=this._makeRow(),t.appendChild(i)),i.appendChild(this._makeCell(a,{isSelected:this.selectedDate&&this.selectedDate.getFullYear()===e&&this.selectedDate.getMonth()===s,isDisabled:this._monthDisabled(e,s),ariaLabel:"".concat(this.i18n.months[s]," ").concat(e),onClick:()=>{this.focusedDate.setMonth(s),this._setView("day")}}))})),this._updateNavState(),this._initFocus(),this._announce("".concat(this.i18n.months[this.focusedDate.getMonth()]," ").concat(e))}_renderDay(){const e=this.focusedDate.getFullYear(),t=this.focusedDate.getMonth(),i=new Date;this.prevBtn.setAttribute("aria-label",this.i18n.prevMonth),this.nextBtn.setAttribute("aria-label",this.i18n.nextMonth),this.navLabel.textContent="".concat(this.i18n.months[t]," ").concat(e),this.gridEl.innerHTML="";const a=document.createElement("thead"),s=this._makeRow();this.i18n.weekdaysShort.forEach(((e,t)=>{s.appendChild(this._makeCell(e,{isHeader:!0,ariaLabel:this.i18n.weekdays[t]}))})),a.appendChild(s),this.gridEl.appendChild(a);const n=document.createElement("tbody");this.gridEl.appendChild(n);const r=new Date(e,t,1).getDay(),o=new Date(e,t+1,0).getDate(),d=new Date(e,t,0).getDate(),l=7*Math.ceil((r+o)/7);let h;for(let a=0;a<l;a++){let s,l,c,u;a%7==0&&(h=this._makeRow(),n.appendChild(h)),a<r?(s=d-r+a+1,l=t-1,c=0===t?e-1:e,u=!0):a>=r+o?(s=a-r-o+1,l=t+1,c=11===t?e+1:e,u=!0):(s=a-r+1,l=t,c=e,u=!1);const p=new Date(c,l<0?11:l>11?0:l,s),m=this._sameDay(p,i);h.appendChild(this._makeCell(String(s),{isOtherMonth:u,isToday:m,isSelected:this.selectedDate&&this._sameDay(p,this.selectedDate),isDisabled:this._dayDisabled(p),ariaCurrent:m?"date":null,ariaLabel:new Intl.DateTimeFormat(this.lang,{weekday:"long",day:"numeric",month:"long",year:"numeric"}).format(p),onClick:()=>this._selectDate(p)}))}this._updateNavState(),this._initFocus(),this._announce("".concat(this.i18n.months[t]," ").concat(e))}_makeRow(){const e=document.createElement("tr");return e.setAttribute("role","row"),e}_makeCell(e){let{isOutside:t,isOtherMonth:i,isSelected:a,isDisabled:s,isToday:n,ariaLabel:r,ariaCurrent:o,onClick:d,isHeader:l}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(l){const t=document.createElement("th");return t.setAttribute("role","columnheader"),t.setAttribute("aria-label",r),t.style.padding="0",t.style.border="none",t.innerHTML='<div class="dp-cell dp-cell--header" aria-hidden="true">'.concat(e,"</div>"),t}const h=document.createElement("td");h.setAttribute("role","gridcell"),h.style.padding="0",h.style.border="none";const c=document.createElement("button");return c.type="button",c.className="dp-cell",c.setAttribute("tabindex","-1"),c.innerHTML='<span aria-hidden="true">'.concat(e,"</span>"),c.setAttribute("aria-label",r||e),o&&c.setAttribute("aria-current",o),(t||i)&&c.classList.add("dp-cell--other-month"),n&&c.classList.add("dp-cell--today"),s?(c.classList.add("dp-cell--disabled"),c.setAttribute("aria-disabled","true")):(c.setAttribute("aria-selected",a?"true":"false"),a&&c.classList.add("dp-cell--selected"),d&&c.addEventListener("click",(e=>{e.stopPropagation(),d()}))),h.appendChild(c),h}_initFocus(){const e=[...this.gridEl.querySelectorAll(".dp-cell:not(.dp-cell--header):not(.dp-cell--disabled)")];if(!e.length)return this.gridEl.setAttribute("tabindex","0"),void this.gridEl.focus();e.forEach((e=>e.setAttribute("tabindex","-1")));let t=null;if(this._focusTargetText){if(t=e.find((e=>e.textContent.trim()===this._focusTargetText)),!t&&"day"===this.view&&!isNaN(this._focusTargetText)){const i=e.filter((e=>!isNaN(e.textContent.trim())));i.length&&(t=i[i.length-1])}this._focusTargetText=null}t||(t=e.find((e=>e.classList.contains("dp-cell--selected")))||e.find((e=>e.classList.contains("dp-cell--today")))||e[0]),t.id||(t.id="".concat(this._uid,"-cell-").concat(Math.random().toString(36).slice(2,6))),t.setAttribute("tabindex","0"),this.gridEl.setAttribute("tabindex","0"),this.gridEl.setAttribute("aria-activedescendant",t.id),this.gridEl.focus({preventScroll:!0})}_selectDate(e){this.selectedDate=new Date(e);const t=this._format(e);this.input.value=t,this.input.dispatchEvent(new Event("change",{bubbles:!0}));const i=new Intl.DateTimeFormat(this.lang,{weekday:"long",day:"numeric",month:"long",year:"numeric"}).format(e),a=this.baseAriaLabel?"".concat(this.baseAriaLabel,", ").concat(i):i;this.proxyBtn.setAttribute("aria-label",a),this.onSelect(t),this._close(),this._announce("".concat(this.i18n.dateSelected,": ").concat(i))}_format(e){const t=String(e.getDate()).padStart(2,"0"),i=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getFullYear());return this.format.replace(/dd/i,t).replace(/mm/i,i).replace(/yyyy/i,a)}_yearDisabled(e){return!!(this.minDate&&e<this.minDate.getFullYear())||!!(this.maxDate&&e>this.maxDate.getFullYear())}_monthDisabled(e,t){if(this.minDate){if(e<this.minDate.getFullYear())return!0;
1if(e===this.minDate.getFullYear()&&t<this.minDate.getMonth())return!0}if(this.maxDate){if(e>this.maxDate.getFullYear())return!0;if(e===this.maxDate.getFullYear()&&t>this.maxDate.getMonth())return!0}return!1}_dayDisabled(e){const t=this._startOfDay(e);return!!(this.minDate&&t<this._startOfDay(this.minDate))||!!(this.maxDate&&t>this._startOfDay(this.maxDate))}_startOfDay(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}_sameDay(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}_announce(e){this.liveRegion&&(this.liveRegion.textContent="",requestAnimationFrame((()=>requestAnimationFrame((()=>{this.liveRegion.textContent=e})))))}destroy(){document.removeEventListener("click",this._onDocClick),window.removeEventListener("scroll",this._onScrollResize,!0),window.removeEventListener("resize",this._onScrollResize),this.calendar&&this.calendar.remove(),this.liveRegion&&this.liveRegion.remove()}}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.