PageSourceSearch

https://www.homofaber.com/assets/DateStrip-Dmg36Var.js

js homofaber.com collected 2026-09-24 08:38:42 UTC 9,577 bytes, 1 lines download raw bytes

1import{r as i,u as X}from"./i18n-vendor-CgdUv56d.js";import{t as R}from"./triggerEvent-Cz4KJkb0.js";import{j as l}from"./ariakit-vendor-Rr0LjWYd.js";function Z(e){return e.eventType==="live-demo"?"live_demo":e.eventType==="workshop"?"workshop":"restaurant"}function Q(e){var r,s,a,f,u;const t=e.typeDetails[0];if(t.__component==="event.restaurant-details")return((r=t.venue)==null?void 0:r.name)??"";const n=(s=t.schedules)==null?void 0:s[0];return((a=n==null?void 0:n.venue)==null?void 0:a.name)??((u=(f=e.venues)==null?void 0:f[0])==null?void 0:u.name)??""}function z(e){var n,r;const t=e.typeDetails[0];return t.__component==="event.restaurant-details"?"":((r=(n=t.schedules)==null?void 0:n[0])==null?void 0:r.startTime)??""}function ee(e){var n,r,s;if(e.eventType!=="live-demo")return"";const t=(s=(r=(n=e.typeDetails[0])==null?void 0:n.experience)==null?void 0:r.event_rooms)==null?void 0:s[0];return(t==null?void 0:t.display_name)||(t==null?void 0:t.name)||""}function te(e){const t=e.typeDetails[0];return t.__component==="event.restaurant-details"?"":(t.exhibitors??[]).map(r=>r.name||r.title).filter(r=>!!(r!=null&&r.trim())).join(", ")}function ne(e){var n,r;const t=e.typeDetails[0];return t.__component==="event.restaurant-details"?"":((r=(n=t.schedules)==null?void 0:n[0])==null?void 0:r.date)??""}function T(e,t,n){return{item_type:Z(e),item_id:e.documentId,item_title:e.title,item_location:Q(e),item_list_name:t,index:n,item_tags:[te(e),ee(e),z(e)].filter(Boolean).join(", "),item_position:n,item_date:ne(e)}}function pe(e,t,n){const r=i.useRef(!1);i.useEffect(()=>{if(!e){r.current=!1;return}r.current||t.length===0||(R("view_item_list",{},{shouldClearEcommerce:!0,ecommerceItems:t.map((s,a)=>T(s,n,a))}),r.current=!0)},[e,t,n])}function ge(e,t){const n=i.useRef(null);i.useEffect(()=>{if(e.length===0)return;const r=e.map(s=>s.documentId).join(",");n.current!==r&&(n.current=r,R("view_item_list",{},{shouldClearEcommerce:!0,ecommerceItems:e.map((s,a)=>T(s,t,a))}))},[e,t])}function he(e,t,n){R("select_item",{},{shouldClearEcommerce:!0,ecommerceItems:[T(e,t,n)]})}const W=i.createContext(null);function ye({children:e}){const[t,n]=i.useState(null),r=i.useMemo(()=>({selectedDate:t,setSelectedDate:n}),[t]);return l.jsx(W.Provider,{value:r,children:e})}function xe(){const e=i.useContext(W);if(!e)throw new Error("useProgrammeDate must be used within a ProgrammeDateProvider");return e}function De(e){if(!e||e.startsWith("//"))return!1;if(e.startsWith("/"))return!0;try{return new URL(e).protocol==="https:"}catch{return!1}}const re=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],oe=["Jan.","Feb.","Mar.","Apr.","May","Jun.","Jul.","Aug.","Sept.","Oct.","Nov.","Dec."],se=["January","February","March","April","May","June","July","August","September","October","November","December"],$=["Jan.","Feb.","Mar.","Apr.","May","Jun.","Jul.","Aug.","Sept.","Oct.","Nov.","Dec."];function ve(e,t){const n=[],[r,s,a]=e.slice(0,10).split("-").map(Number),[f,u,y]=t.slice(0,10).split("-").map(Number),w=new Date(r,s-1,a),m=new Date(f,u-1,y),g=new Date(w);for(;g<=m;)n.push(new Date(g)),g.setDate(g.getDate()+1);return n}function be(e){if(e.length===0)return null;const t=new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate()),r=e.find(s=>new Date(s.getFullYear(),s.getMonth(),s.getDate()).getTime()===n.getTime());return r?ae(r):null}function Se(e){if(e.length===0)return new Date;const t=new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate());return e.find(r=>r.getTime()===n.getTime())??e[0]}function ae(e){const t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${t}-${n}-${r}`}function _e(e){const[t,n,r]=e.split("-").map(Number);return new Date(t,n-1,r)}function we(e){return`${re[e.getDay()]}, ${oe[e.getMonth()]} ${String(e.getDate()).padStart(2,"0")}`}function ke(e,t){const[n,r,s]=e.slice(0,10).split("-").map(Number),[a,f,u]=t.slice(0,10).split("-").map(Number);return r===f&&n===a?`${s}- ${u} ${se[r-1]} ${a}`:`${s} ${$[r-1]} — ${u} ${$[f-1]} ${a}`}const ie=/^#(?:[\da-fA-F]{3}|[\da-fA-F]{4}|[\da-fA-F]{6}|[\da-fA-F]{8})$/;function O(e){if(!e)return null;const t=e.trim();return ie.test(t)?t:null}const ce=5e3;function Ae(e,t,n){e.set(t,{data:n,expiresAt:Date.now()+ce})}function Fe(e,t){const n=e.get(t);if(n){if(Date.now()>n.expiresAt){e.delete(t);return}return n.data}}function le(e,t){if(!t)return e;const n=`${t} - `;return e.startsWith(n)?e.slice(n.length):e}function Me(e,t){const n=(e.exhibitors??[]).map(a=>a.name||a.title).filter(a=>!!(a!=null&&a.trim())).map(a=>a.trim());if(n.length===0)return null;const r=n.join(", "),s=t?t("With {{name}}",{name:r,interpolation:{escapeValue:!1}}):`With ${r}`;return s.charAt(0).toUpperCase()+s.slice(1)}function je(e){var r,s,a;
1const t=((s=(r=e.experience)==null?void 0:r.event_rooms)==null?void 0:s[0])??null;if(!t)return null;const n=t.display_name||t.name||t.slug;return n!=null&&n.trim()?le(n.trim(),(a=t.event)==null?void 0:a.title):null}const ue=10;function L(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function Le({dates:e,selectedDate:t,onSelect:n,onNavigate:r,onPreview:s,dateFontColor:a,dateFontHighlightColor:f,windowSize:u=ue,compact:y=!1,showMonth:w=!0,locale:m="en",hideFocusRing:g=!1}){const{t:k}=X("common"),[p,I]=i.useState(()=>{const o=e.findIndex(h=>L(h,t)),c=o<0?0:o;return Math.min(c,Math.max(0,e.length-u))}),E=e.findIndex(o=>L(o,t)),d=E<0?0:E,A=d>0,F=d<e.length-1,P=e.slice(p,p+u),B=i.useMemo(()=>new Intl.DateTimeFormat(m,{weekday:"short"}),[m]),H=i.useMemo(()=>new Intl.DateTimeFormat(m,{month:"short"}),[m]),J=i.useMemo(()=>new Intl.DateTimeFormat(m,{weekday:"long",year:"numeric",month:"long",day:"numeric"}),[m]),Y=e.length>0?H.format(t):"",M=O(a)??"#737373",N=O(f)??"#CF1624";i.useEffect(()=>{if(d<p){I(d);return}d>=p+u&&I(Math.max(0,d-u+1))},[d,p,u]);function x(o){const c=d+o;c<0||c>=e.length||(r??n)(e[c])}const D=i.useRef(null),v=i.useRef(!1),[U,q]=i.useState(!1),[G,K]=i.useState(!1),j=i.useCallback(()=>{const o=D.current;o&&(q(o.scrollLeft>3),K(o.scrollLeft+o.clientWidth<o.scrollWidth-3))},[]);i.useEffect(()=>{const o=requestAnimationFrame(j);return()=>cancelAnimationFrame(o)},[t,p,j]),i.useEffect(()=>{const o=D.current;if(!o)return;const c=o.querySelector('[aria-pressed="true"]');if(!c)return;const h=o.getBoundingClientRect(),b=c.getBoundingClientRect(),S=b.left-h.left,C=b.right-h.left,_=16;S<_?o.scrollTo({left:o.scrollLeft+S-_,behavior:"smooth"}):C>o.clientWidth-_&&o.scrollTo({left:o.scrollLeft+C-o.clientWidth+_,behavior:"smooth"})},[t]),i.useEffect(()=>{var c;if(!v.current)return;const o=(c=D.current)==null?void 0:c.querySelector('[aria-pressed="true"]');o&&(o.focus({preventScroll:!0}),v.current=!1)},[t,p]);function V(o){o.key!=="ArrowLeft"&&o.key!=="ArrowRight"||(o.preventDefault(),o.key==="ArrowLeft"&&A?(v.current=!0,x(-1)):o.key==="ArrowRight"&&F&&(v.current=!0,x(1)))}return l.jsxs("div",{role:"group",className:["flex flex-row items-end min-w-0",y?"gap-2":"gap-3"].join(" "),"aria-label":k("Select a date"),onKeyDown:V,children:[l.jsx("div",{ref:D,onScroll:j,className:"flex flex-row items-end flex-1 min-w-0 overflow-x-auto overflow-y-hidden no-scrollbar gap-7",style:{maskImage:`linear-gradient(to right, ${U?"transparent, black 20px":"black"}, black calc(100% - 20px), ${G?"transparent":"black"})`},children:P.map(o=>{const c=L(o,t),h=B.format(o),b=o.getDate().toString().padStart(2,"0"),S=J.format(o);return l.jsxs("button",{type:"button","aria-pressed":c,"aria-label":S,tabIndex:c?0:-1,onClick:()=>n(o),onFocus:()=>s==null?void 0:s(o),onPointerEnter:()=>s==null?void 0:s(o),className:["flex flex-col items-center shrink-0 gap-px hover:opacity-80 transition-opacity focus-visible:outline-none rounded-sm cursor-pointer",g?"":"focus-visible:ring-2 focus-visible:ring-current focus-visible:ring-offset-2",y?"w-8":"w-9"].join(" "),"data-testid":`date-strip-btn-${o.toISOString().slice(0,10)}`,children:[l.jsx("span",{className:"font-['Arial'] text-sm h-3 leading-none tracking-[0.1px]",style:{color:c?N:M},children:h}),l.jsx("span",{className:["font-['Arial'] leading-none inline-flex items-end","text-[28px] h-7"].join(" "),style:{color:c?N:M},children:b})]},o.toISOString())})}),l.jsxs("div",{className:"flex items-center shrink-0 self-center",children:[l.jsx("button",{type:"button",onClick:()=>x(-1),disabled:!A,className:["w-5 h-5 flex items-center justify-center transition-opacity",A?"opacity-100 cursor-pointer":"opacity-20 cursor-not-allowed"].join(" "),"aria-label":k("Previous dates"),children:l.jsx("svg",{width:"6",height:"10",viewBox:"0 0 10 16",fill:"none","aria-hidden":"true",children:l.jsx("path",{d:"M8 2L2 8L8 14",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})})}),l.jsx("button",{type:"button",onClick:()=>x(1),disabled:!F,className:["w-5 h-5 flex items-center justify-center transition-opacity",F?"opacity-100 cursor-pointer":"opacity-20 cursor-not-allowed"].join(" "),"aria-label":k("Next dates"),children:l.jsx("svg",{width:"6",height:"10",viewBox:"0 0 10 16",fill:"none","aria-hidden":"true",children:l.jsx("path",{d:"M2 2L8 8L2 14",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),w&&l.jsx("span",{className:"font-['Arial'] uppercase leading-none inline-flex items-end shrink-0 self-end text-[26px] h-7 tracking-tighter",style:{color:M},children:Y})]})}
1export{Le as D,ye as P,je as a,ve as b,Ae as c,ke as d,pe as e,ae as f,Me as g,O as h,De as i,he as j,be as k,_e as l,ge as m,we as n,Se as p,Fe as t,xe as u};

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.