UNPKG

planby

Version:

<div align="center" style="margin-bottom: 10px"> <a href="https://www.npmjs.com/package/planby"> <img src="https://i.postimg.cc/J0XMPHNQ/planby-logo.png" alt="Planby logo" /> </a> </div>

3 lines (2 loc) 20.9 kB
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t,r=require("@emotion/react"),n=e(require("@emotion/styled/base")),i=require("react"),a=e(i),o=require("date-fns"),l=require("use-debounce");function u(){return(u=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function s(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)t.indexOf(r=a[n])>=0||(i[r]=e[r]);return i}function d(e,t){return t||(t=e.slice(0)),e.raw=t,e}var c,f=r.css(t||(t=d(['\n @import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap");\n\n .planby {\n font-family: "Inter", system-ui, -apple-system,\n /* Firefox supports this but not yet system-ui */ "Segoe UI", Roboto,\n Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"; /* 2 */\n }\n'])));!function(e){e[e.Sidebar=10]="Sidebar",e[e.EpgCornerBox=90]="EpgCornerBox",e[e.Line=10]="Line",e[e.Loader=100]="Loader",e[e.Program=1]="Program",e[e.Timeline=10]="Timeline"}(c||(c={}));var h,m=function(e){return new Array(e).fill("")},p=function(){return"undefined"!=typeof window?i.useLayoutEffect:i.useEffect},g=function(e){return new Date(e)},b=function(e){return Math.abs(e)},v=function(e){return new Date(e).getTime()},x=function(e,t){var r=v(new Date),n=v(e),i=v(t);return r>=n&&i>r},y=function(e){return o.format(new Date(e),"yyyy-MM-dd HH:mm:ss").replace(/\s/g,"T")},w=function(e){return o.roundToNearestMinutes(new Date(e))},T=function(e,t){return e*t/60},D=function(e,t,r,n,i){var a=o.getTime(g(t))>o.getTime(g(n)),l=o.getTime(g(e))<o.getTime(g(r));if(l&&a){var u=o.differenceInMinutes(w(g(n)),g(r));return T(u,i)}if(l){var s=o.differenceInMinutes(w(g(t)),g(r));return T(s,i)}if(a){var d=o.differenceInMinutes(g(n),w(g(e)));return d<0?0:T(d,i)}var c=o.differenceInMinutes(w(g(t)),w(g(e)));return T(c,i)},L=function(e,t){return{top:t*e,height:t}},W=n("div",{target:"e1ra9c6c4"})("padding:5px;height:",(function(e){var t=e.height;return t?t+"px":"100%"}),";width:",(function(e){var t=e.width;return t?t+"px":"100%"}),";*,::before,::after{box-sizing:border-box;}"),E=n("div",{target:"e1ra9c6c3"})({name:"qjsha7",styles:"height:100%;width:100%;display:flex;flex-direction:column;position:relative;border-radius:6px;overflow:hidden"}),k=n("div",{target:"e1ra9c6c2"})("height:100%;width:100%;position:relative;overflow:auto;scroll-behavior:smooth;background:",(function(e){return e.theme.primary[900]}),";",(function(e){return e.isRTL&&"transform: scale(-1,1)"}),";::-webkit-scrollbar{width:10px;height:10px;}::-webkit-scrollbar-thumb{background:",(function(e){return e.theme.scrollbar.thumb.bg}),";border:10px none ",(function(e){return e.theme.white}),";border-radius:20px;}::-webkit-scrollbar-thumb:hover{background:",(function(e){return e.theme.white}),";}::-webkit-scrollbar-track{background:",(function(e){return e.theme.primary[900]}),";border:22px none ",(function(e){return e.theme.white}),";border-radius:0px;}::-webkit-scrollbar-corner{background:",(function(e){return e.theme.primary[900]}),";}"),R=n("div",{target:"e1ra9c6c1"})("position:absolute;height:",(function(e){return e.height}),"px;width:",(function(e){return e.width}),"px;top:",(function(e){var t=e.top;return void 0===t?0:t}),"px;background:",(function(e){return e.theme.primary[900]}),";z-index:",c.EpgCornerBox,";",(function(e){var t=e.left;return e.isRTL?"right:0px;":" left: "+(void 0===t?0:t)+"px"}),";"),S=n("div",{target:"e1ra9c6c0"})("background:",(function(e){return e.theme.primary[900]}),";height:",(function(e){return e.height}),"px;width:",(function(e){return e.width}),"px;position:relative;left:",(function(e){return e.isSidebar?e.sidebarWidth:0}),"px;"),C=n("div",{target:"e1dhe7bi0"})("position:sticky;width:",(function(e){return e.width}),"px;float:left;bottom:",(function(e){return e.bottom}),"px;left:0;z-index:",c.Sidebar,";background-color:",(function(e){return e.theme.primary[900]}),";",(function(e){return e.isRTL&&"transform: scale(-1,1)"}),";"),H=n("div",{target:"edhgbii1"})("position:absolute;top:",(function(e){return e.top}),"px;height:",(function(e){return e.height}),"px;width:100%;display:flex;align-items:center;justify-content:center;background-color:",(function(e){return e.theme.primary[900]}),";"),j=n("img",{target:"edhgbii0"})({name:"vfop22",styles:"max-height:60px;max-width:60px;position:relative"}),B=n("div",{target:"e1f8qikj6"})("position:absolute;padding:",(function(e){return 0===e.width?0:4}),"px;overflow:hidden;"),O=n("div",{target:"e1f8qikj5"})("position:relative;display:flex;font-size:11px;height:100%;border-radius:8px;padding:10px ",(function(e){return e.width<30?4:20}),"px;overflow:hidden;cursor:pointer;transition:all 0.4s ease-in-out;background:",(function(e){var t=e.theme.primary;return"linear-gradient(to right, "+t[600]+", "+t[600]+")"}),";z-index:",c.Program,";&:hover{background:",(function(e){var t=e.theme.gradient;return"linear-gradient(to right, "+t.blue[900]+", "+t.blue[600]+")"}),";}",(function(e){var t=e.theme.gradient;return e.isLive&&"background: linear-gradient(to right, "+t.blue[900]+", "+t.blue[600]+","+t.blue[300]+")"}),";"),P=n("div",{target:"e1f8qikj4"})({name:"6wjsds",styles:"width:100%;display:flex;justify-content:flex-start"}),I="\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n",M=n("p",{target:"e1f8qikj3"})("font-size:14px;text-align:left;margin-top:0;margin-bottom:5px;font-weight:500;color:",(function(e){return e.theme.grey[300]}),";",I,";"),z=n("span",{target:"e1f8qikj2"})("display:block;font-size:12.5px;font-weight:400;color:",(function(e){return e.theme.text.grey[500]}),";text-align:left;",I,";"),F=n("img",{target:"e1f8qikj1"})({name:"1azmhcm",styles:"margin-right:15px;border-radius:6px;width:100px"}),q=n("div",{target:"e1f8qikj0"})("overflow:hidden;",(function(e){return e.isRTL&&"transform: scale(-1,1); \n display: flex; \n flex-direction: column; \n align-items: flex-end"}),";"),A=n("span",{target:"ebfc5084"})("color:",(function(e){return e.theme.text.grey[300]}),";position:absolute;top:18px;left:",(function(e){return e.isRTL&&e.isBaseTimeFormat?"-32":"-18"}),"px;",(function(e){return e.isRTL&&"transform: scale(-1,1)"}),";"),V=n("div",{target:"ebfc5083"})({name:"16adccg",styles:"height:100%;width:100%;display:grid;grid-template-columns:repeat(4, 1fr);align-items:end;padding-bottom:6px"}),Y=n("div",{target:"ebfc5082"})("background:",(function(e){return e.theme.timeline.divider.bg}),";height:10px;width:1px;margin-right:",(function(e){return e.width/4}),"px;"),N=n("div",{target:"ebfc5081"})("position:sticky;top:0;left:",(function(e){return e.isSidebar?e.sidebarWidth:0}),"px;display:flex;height:",60,"px;width:",(function(e){return e.dayWidth}),"px;background:",(function(e){return e.theme.primary[900]}),";z-index:",c.Timeline,";"),X=n("div",{target:"ebfc5080"})("width:",(function(e){return e.width}),"px;font-size:14px;position:relative;&:first-of-type{",A,"{left:0px;}}"),U=n("div",{target:"ec9jzma0"})("position:absolute;top:64px;left:",(function(e){return e.left}),"px;height:",(function(e){return e.height}),"px;width:3px;background:",(function(e){return e.theme.green[300]}),";pointer-events:none;z-index:",c.Line,";"),_=[0,50,0],G=n("div",{target:"ezp5axu1"})("position:absolute;top:0;left:0;bottom:0;width:100%;background:",(function(e){return e.theme.loader.bg}),";display:flex;justify-content:center;align-items:center;z-index:",c.Loader,";"),J=n("div",{target:"ezp5axu0"})("width:",(function(e){return.42*e.width}),"px;background:",(function(e){return e.color}),";height:18px;border-radius:45px;margin-right:",(function(e){var t=e.marginRight;return null!=t?t:0}),"px;animation-name:",(function(e){return t=e.animate,r.keyframes(h||(h=d(["\n","\n"])),_.map((function(e,r){return e+"% {\n transform: translateX(-"+t.right[r]+");\n}"})));var t}),";animation-duration:",(function(e){return e.transition.duration}),"s;animation-timing-function:",(function(e){var t;return null!=(t=e.transition.ease)?t:"ease-in-out"}),";animation-delay:",(function(e){var t;return null!=(t=e.transition.delay)?t:0}),"s;animation-iteration-count:infinite;"),K=["ref"],Q=k,Z=S,$={primary:{600:"#1a202c",900:"#171923"},grey:{300:"#d1d1d1"},white:"#fff",green:{300:"#2C7A7B"},loader:{teal:"#5DDADB",purple:"#3437A2",pink:"#F78EB6",bg:"#171923db"},scrollbar:{border:"#ffffff",thumb:{bg:"#e1e1e1"}},gradient:{blue:{300:"#002eb3",600:"#002360",900:"#051937"}},text:{grey:{300:"#a0aec0",500:"#718096"}},timeline:{divider:{bg:"#718096"}}},ee=["hourWidth","dayWidth"],te=["containerRef","scrollBoxRef"],re=y(o.startOfToday());function ne(e,t){var r=p(),n=a.useRef(e);r((function(){n.current=e}),[e]),a.useEffect((function(){if(t||0===t){var e=setInterval((function(){return n.current()}),t);return function(){return clearInterval(e)}}}),[t])}function ie(e){var t=e.isRTL,r=void 0!==t&&t,n=e.isBaseTimeFormat,i=e.program,l=e.minWidth,s=void 0===l?200:l,d=i.data,c=i.position,f=c.width,h=d.since,m=d.till,p=a.useState((function(){return x(h,m)})),g=p[0],b=p[1],v=function(e){for(var t=u({},e),r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(var a=0,o=n;a<o.length;a++){var l=o[a];delete t[l]}return t}(c,"egdeEnd");return ne((function(){var e=x(h,m);b(e)}),12e4),{isLive:g,isMinWidth:f>s,isRTL:r,formatTime:function(e,t){return void 0===t&&(t="HH:mm"),o.format(new Date(e),t).replace(/\s/g,"")},set12HoursTimeFormat:function(){return n?"h:mm a":"HH:mm"},getRTLSinceTime:function(e){return r?m:e},getRTLTillTime:function(e){return r?h:e},styles:{width:f,position:v}}}function ae(e,t){return{time:m(e),dividers:m(4),formatTime:function(e){var r=new Date,n=o.format(r,"yyyy-MM-dd"),i=e<10?"0"+e:e;if(t&&e<=24){var a=new Date(n+"T"+i+":00:00");return o.format(a,"h:mm a").toLowerCase().replace(/\s/g,"")}return i+":00"}}}var oe=["program","onClick"],le=B,ue=O,se=P,de=q,ce=M,fe=z,he=F;function me(e){var t=e.program,r=e.onClick,n=s(e,oe),a=ie(u({program:t},n)),o=a.isRTL,l=a.isLive,d=a.isMinWidth,c=a.styles,f=a.formatTime,h=a.set12HoursTimeFormat,m=a.getRTLTillTime,p=t.data,g=p.image,b=p.title,v=p.till,x=f((0,a.getRTLSinceTime)(p.since),h()).toLowerCase(),y=f(m(v),h()).toLowerCase();return i.createElement(le,{"data-testid":"program-item",width:c.width,style:c.position},i.createElement(ue,Object.assign({"data-testid":"program-content",width:c.width,isLive:l,onClick:function(){return null==r?void 0:r(p)}},n),i.createElement(se,null,l&&d&&i.createElement(he,{src:g,alt:"Preview"}),i.createElement(de,{isRTL:o},i.createElement(ce,null,b),i.createElement(fe,{"aria-label":"program time"},x," - ",y)))))}var pe=C;function ge(e){var t=e.renderChannel,r=e.isChannelVisible;return i.createElement(pe,{"data-testid":"sidebar",isRTL:e.isRTL,isTimeline:e.isTimeline,width:e.sidebarWidth,bottom:e.scrollY},e.channels.map((function(e){return r(e.position)?t?t({channel:e}):i.createElement(ye,{key:e.uuid,channel:e}):null})))}var be=["channel","onClick"],ve=H,xe=j;function ye(e){var t=e.channel,r=e.onClick,n=s(e,be),a=t.logo;return i.createElement(ve,Object.assign({"data-testid":"sidebar-item",onClick:function(){return null==r?void 0:r(t)}},t.position,n),i.createElement(xe,{src:a,alt:"Logo"}))}var we=N,Te=X,De=A,Le=V,We=Y;function Ee(e){var t=e.isRTL,r=e.isBaseTimeFormat,n=e.isSidebar,a=e.dayWidth,o=e.hourWidth,l=e.offsetStartHoursRange,u=e.sidebarWidth,s=ae(e.numberOfHoursInDay,r),d=s.dividers,c=s.formatTime;return i.createElement(we,{"data-testid":"timeline",dayWidth:a,sidebarWidth:u,isSidebar:n},s.time.map((function(e,n){return function(e){return i.createElement(Te,{"data-testid":"timeline-item",key:e,width:o},i.createElement(De,{isBaseTimeFormat:r,isRTL:t},c(e+l)),i.createElement(Le,null,d.map((function(e,t){return i.createElement(We,{key:t,width:o})}))))}(n)})))}var ke=U;function Re(e){var t=e.height,r=e.startDate,n=function(e){var t=e.startDate,r=e.endDate,n=e.dayWidth,i=e.hourWidth,l=e.sidebarWidth,u=D(o.startOfDay(new Date(t)),new Date,t,r,i)+l,s=a.useState((function(){return u})),d=s[0],c=s[1],f=d<=n;return ne((function(){var e=i/60*2;c((function(t){return t+e}))}),a.useMemo((function(){return f?12e4:null}),[f])),a.useEffect((function(){var e=new Date(t),n=D(o.startOfDay(e),new Date,t,r,i);c(n+l)}),[t,r,l,i]),{positionX:d}}({startDate:r,endDate:e.endDate,dayWidth:e.dayWidth,hourWidth:e.hourWidth,sidebarWidth:e.sidebarWidth}).positionX,l=new Date(r);return o.isToday(l)?i.createElement(ke,{height:t,left:n}):null}var Se=G,Ce=J,He=function(e){return i.createElement(Ce,{className:"SHAPE",width:e.width,color:e.color,animate:e.animate,transition:e.transition,marginRight:e.marginRight})};function je(){return i.createElement(Se,{"aria-label":"loading"},i.createElement("div",null,i.createElement("div",{style:{display:"flex",justifyContent:"end",marginBottom:16}},i.createElement(He,{animate:{right:["0px","75px","0px"]},transition:{duration:1},width:217,color:$.loader.teal,marginRight:10}),i.createElement(He,{width:122,color:$.loader.purple,animate:{right:["0px","50px","0px"]},transition:{duration:1,delay:.02}})),i.createElement("div",{style:{display:"flex",justifyContent:"end",marginBottom:16}},i.createElement(He,{width:267,color:$.loader.pink,animate:{right:["0px","70px","0px"]},transition:{delay:.5,duration:1}})),i.createElement("div",{style:{display:"flex",justifyContent:"end"}},i.createElement(He,{width:217,color:$.loader.purple,marginRight:10,animate:{right:["0px","95px","0px"]},transition:{delay:.3,duration:1}}),i.createElement(He,{width:80,color:$.loader.teal,animate:{right:["0px","70px","0px"]},transition:{duration:1,delay:.33}}))))}var Be=["children","width","height","sidebarWidth","theme","globalStyles","isRTL","isSidebar","isTimeline","isLoading","loader","ref"],Oe=W,Pe=E,Ie=R,Me=j,ze=B,Fe=O,qe=P,Ae=q,Ve=M,Ye=z,Ne=F,Xe=N,Ue=X,_e=A,Ge=Y,Je=V;exports.ChannelBox=H,exports.ChannelLogo=Me,exports.Epg=function(e){var t=e.children,n=e.width,i=e.height,o=e.sidebarWidth,l=e.theme,u=e.globalStyles,d=e.isRTL,c=void 0!==d&&d,h=e.isSidebar,m=void 0===h||h,p=e.isTimeline,g=void 0===p||p,b=e.isLoading,v=void 0!==b&&b,x=e.loader,y=e.ref,w=s(e,Be);return a.createElement(r.ThemeProvider,{theme:l},a.createElement(r.Global,{styles:null!=u?u:f}),a.createElement(Oe,Object.assign({className:"planby","data-testid":"container",width:n,height:i,ref:y},w),a.createElement(Pe,null,m&&g&&a.createElement(Ie,{isRTL:c,width:o,height:60,left:0,top:0}),v&&(null!=x?x:a.createElement(je,null)),t)))},exports.Layout=function(e){var t=e.ref,r=s(e,K),n=r.channels,i=r.programs,o=r.startDate,l=r.endDate,d=r.scrollY,c=r.dayWidth,f=r.hourWidth,h=r.sidebarWidth,m=r.itemHeight,p=r.numberOfHoursInDay,g=r.offsetStartHoursRange,b=r.isSidebar,x=void 0===b||b,y=r.isTimeline,w=void 0===y||y,T=r.isLine,D=void 0===T||T,L=r.isBaseTimeFormat,W=void 0!==L&&L,E=r.isRTL,k=void 0!==E&&E,R=r.onScroll,S=r.isProgramVisible,C=r.isChannelVisible,H=r.renderProgram,j=r.renderChannel,B=r.renderTimeline,O=n.length,P=a.useMemo((function(){return O*m}),[O,m]),I=v(new Date(l))>v(new Date);return a.createElement(Q,{isRTL:k,ref:t,onScroll:R},D&&I&&a.createElement(Re,{dayWidth:c,hourWidth:f,sidebarWidth:h,startDate:o,endDate:l,height:P}),w&&function(){var e={sidebarWidth:h,isSidebar:x,isRTL:k,dayWidth:c,numberOfHoursInDay:p},t={offsetStartHoursRange:g,numberOfHoursInDay:p,isBaseTimeFormat:W,hourWidth:f};return B?B(u({},t,e)):a.createElement(Ee,Object.assign({},t,e))}(),x&&a.createElement(ge,{isRTL:k,isTimeline:w,isChannelVisible:C,sidebarWidth:h,channels:n,scrollY:d,renderChannel:j}),a.createElement(Z,{"data-testid":"content",sidebarWidth:h,isSidebar:x,width:c,height:P},i.map((function(e){return function(e){if(S(e.position)){var t=function(e){var t=e.position;return u({},e,{position:{width:t.width,height:t.height,top:t.top,left:t.left}})}(e);return H?H({program:t,isRTL:k,isBaseTimeFormat:W}):a.createElement(me,{key:e.data.id,isRTL:k,isBaseTimeFormat:W,program:t})}return null}(e)}))))},exports.ProgramBox=ze,exports.ProgramContent=Fe,exports.ProgramFlex=qe,exports.ProgramImage=Ne,exports.ProgramStack=Ae,exports.ProgramText=Ye,exports.ProgramTitle=Ve,exports.TimelineBox=Ue,exports.TimelineDivider=Ge,exports.TimelineDividers=Je,exports.TimelineTime=_e,exports.TimelineWrapper=Xe,exports.useEpg=function(e){var t=e.channels,r=e.epg,n=e.startDate,i=e.endDate,d=e.isRTL,c=void 0!==d&&d,f=e.isBaseTimeFormat,h=void 0!==f&&f,m=e.isSidebar,x=void 0===m||m,w=e.isTimeline,T=void 0===w||w,W=e.isLine,E=void 0===W||W,k=e.theme,R=e.globalStyles,S=e.dayWidth,C=void 0===S?7200:S,H=e.sidebarWidth,j=void 0===H?100:H,B=e.itemHeight,O=void 0===B?80:B,P=e.itemOverscan,I=void 0===P?80:P,M=e.width,z=e.height,F=function(e,t){var r=t;return""===t&&(r=y(o.startOfDay(o.addDays(new Date(e),1)))),{startDate:e,endDate:r}}(void 0===n?re:n,void 0===i?"":i),q=F.startDate,A=F.endDate,V=a.useMemo((function(){return function(e){var t=e.dayWidth,r=e.endDate,n=g(e.startDate),i=g(r);i<n&&console.error("Invalid endDate property. Value of endDate must be greater than startDate. Props: startDateTime: "+n+", endDateTime: "+i);var a=o.differenceInHours(n,o.startOfDay(n)),l=o.differenceInHours(i,n),u=Math.floor(t/l),s=u*l;return{hourWidth:b(u),dayWidth:b(s),numberOfHoursInDay:b(l),offsetStartHoursRange:b(a)}}({dayWidth:C,startDate:q,endDate:A})}),[C,q,A]),Y=V.hourWidth,N=V.dayWidth,X=s(V,ee),U=function(e){var t=e.height,r=e.width,n=e.startDate,i=e.endDate,u=e.hourWidth,s=e.sidebarWidth,d=p(),c=a.useRef(null),f=a.useRef(null),h=a.useState(0),m=h[0],g=h[1],b=a.useState(0),v=b[0],x=b[1],y=a.useState(r),w=y[0],T=y[1],L=a.useState(t),W=L[0],E=L[1],k=o.isToday(new Date(n)),R=l.useDebouncedCallback((function(e){g(e.y),x(e.x)}),100,{maxWait:100}),S=a.useCallback((function(e){R({y:e.target.scrollTop,x:e.target.scrollLeft})}),[R]),C=a.useCallback((function(){if(null!=f&&f.current&&k){var e,t=null!=r?r:null==(e=c.current)?void 0:e.clientWidth,a=new Date,l=D(o.startOfToday(),a,n,i,u);f.current.scrollLeft=l-t/2+s}}),[k,n,i,r,s,u]),H=a.useCallback((function(e){void 0===e&&(e=u),null!=f&&f.current&&(f.current.scrollTop=f.current.scrollTop+e)}),[u]),j=a.useCallback((function(e){void 0===e&&(e=u),null!=f&&f.current&&(f.current.scrollLeft=f.current.scrollLeft+e)}),[u]),B=a.useCallback((function(e){void 0===e&&(e=u),null!=f&&f.current&&(f.current.scrollLeft=f.current.scrollLeft-e)}),[u]),O=l.useDebouncedCallback((function(){null!=c&&c.current&&!r&&T(c.current.clientWidth)}),400,{maxWait:400});return d((function(){if(null!=c&&c.current){var e=c.current;r||T(e.clientWidth),t||E(e.clientHeight)}null!=f&&f.current&&k&&C()}),[t,r,n,k,C]),d((function(){return window.addEventListener("resize",O),function(){window.removeEventListener("resize",O)}}),[r]),{containerRef:c,scrollBoxRef:f,scrollX:v,scrollY:m,layoutWidth:w,layoutHeight:W,onScroll:S,onScrollToNow:C,onScrollTop:H,onScrollLeft:B,onScrollRight:j}}({startDate:q,endDate:A,sidebarWidth:j,width:M,height:z,hourWidth:Y}),_=U.containerRef,G=U.scrollBoxRef,J=s(U,te),K=J.scrollX,Q=J.scrollY,Z=J.layoutWidth,ne=J.layoutHeight,ie=J.onScroll,ae=J.onScrollToNow,oe=J.onScrollTop,le=J.onScrollLeft,ue=J.onScrollRight,se=a.useMemo((function(){return function(e,t){return e.map((function(e,r){return u({},e,{position:L(r,t)})}))}(t,O)}),[t,O]),de=y(q),ce=y(A),fe=a.useMemo((function(){return function(e){var t=e.channels,r=e.startDate,n=e.endDate,i=e.itemHeight,a=e.hourWidth;return e.data.map((function(e){var o=t.findIndex((function(t){return t.uuid===e.channelUuid}));return function(e,t,r,n,i,a){var o=u({},e,{since:y(e.since),till:y(e.till)}),l=function(e,t){var r=v(new Date(e));return v(new Date(t))>r}(o.since,i),s=D(o.since,o.till,i,a,n),d=r*t,c=D(i,o.since,i,a,n);return l&&(c=0),d<0&&(s=0),{position:{width:s,height:r,top:d,left:c,edgeEnd:D(i,o.till,i,a,n)},data:o}}(e,o,i,a,r,n)}),[])}({data:r,channels:se,startDate:de,endDate:ce,itemHeight:O,hourWidth:Y})}),[r,se,de,ce,O,Y]),he=k||$,me=a.useCallback((function(e){return function(e,t,r,n,i,a){return!(e.width<=0)&&!(t>e.top+3*a)&&!(t+n<=e.top)&&r+i>=e.left&&r<=e.edgeEnd}(e,Q,K,ne,Z,I)}),[Q,K,ne,Z,I]),pe=a.useCallback((function(e){return function(e,t,r,n){return!(t>e.top+3*n||t+r<=e.top)}(e,Q,ne,I)}),[Q,ne,I]);return{getEpgProps:function(){return{isRTL:c,isSidebar:x,isLine:E,isTimeline:T,width:M,height:z,sidebarWidth:j,ref:_,theme:he,globalStyles:R}},getLayoutProps:function(){return u({programs:fe,channels:se,startDate:q,endDate:A,scrollY:Q,onScroll:ie,isRTL:c,isBaseTimeFormat:h,isSidebar:x,isTimeline:T,isLine:E,isProgramVisible:me,isChannelVisible:pe,dayWidth:N,hourWidth:Y,sidebarWidth:j,itemHeight:O},X,{ref:G})},onScrollToNow:ae,onScrollTop:oe,onScrollLeft:le,onScrollRight:ue,scrollY:Q,scrollX:K}},exports.useProgram=ie,exports.useTimeline=ae; //# sourceMappingURL=planby.cjs.production.min.js.map