"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t,n=require("@emotion/react"),i=e(require("@emotion/styled/base")),r=require("react"),o=e(r),a=require("date-fns"),s=require("date-fns-tz"),l=require("use-debounce");function u(){u=function(){return t};var e,t={},n=Object.prototype,i=n.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function d(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{d({},"")}catch(e){d=function(e,t,n){return e[t]=n}}function c(e,t,n,i){var o=Object.create((t&&t.prototype instanceof v?t:v).prototype),a=new E(i||[]);return r(o,"_invoke",{value:H(e,n,a)}),o}function h(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=c;var f="suspendedStart",p="executing",m="completed",g={};function v(){}function y(){}function b(){}var x={};d(x,a,(function(){return this}));var w=Object.getPrototypeOf,D=w&&w(w(I([])));D&&D!==n&&i.call(D,a)&&(x=D);var M=b.prototype=v.prototype=Object.create(x);function T(e){["next","throw","return"].forEach((function(t){d(e,t,(function(e){return this._invoke(t,e)}))}))}function W(e,t){function n(r,o,a,s){var l=h(e[r],e,o);if("throw"!==l.type){var u=l.arg,d=u.value;return d&&"object"==typeof d&&i.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(d).then((function(e){u.value=e,a(u)}),(function(e){return n("throw",e,a,s)}))}s(l.arg)}var o;r(this,"_invoke",{value:function(e,i){function r(){return new t((function(t,r){n(e,i,t,r)}))}return o=o?o.then(r,r):r()}})}function H(t,n,i){var r=f;return function(o,a){if(r===p)throw Error("Generator is already running");if(r===m){if("throw"===o)throw a;return{value:e,done:!0}}for(i.method=o,i.arg=a;;){var s=i.delegate;if(s){var l=L(s,i);if(l){if(l===g)continue;return l}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(r===f)throw r=m,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);r=p;var u=h(t,n,i);if("normal"===u.type){if(r=i.done?m:"suspendedYield",u.arg===g)continue;return{value:u.arg,done:i.done}}"throw"===u.type&&(r=m,i.method="throw",i.arg=u.arg)}}}function L(t,n){var i=n.method,r=t.iterator[i];if(r===e)return n.delegate=null,"throw"===i&&t.iterator.return&&(n.method="return",n.arg=e,L(t,n),"throw"===n.method)||"return"!==i&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+i+"' method")),g;var o=h(r,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,g;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function O(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function E(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(O,this),this.reset(!0)}function I(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function n(){for(;++r=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var l=i.call(a,"catchLoc"),u=i.call(a,"finallyLoc");if(l&&u){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),k(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var r=i.arg;k(n)}return r}}throw Error("illegal catch attempt")},delegateYield:function(t,n,i){return this.delegate={iterator:I(t),resultName:n,nextLoc:i},"next"===this.method&&(this.arg=e),g}},t}function d(e,t,n,i,r,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(i,r)}function c(e){return function(){var t=this,n=arguments;return new Promise((function(i,r){var o=e.apply(t,n);function a(e){d(o,i,r,a,s,"next",e)}function s(e){d(o,i,r,a,s,"throw",e)}a(void 0)}))}}function h(){return(h=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0||(r[n]=e[n]);return r}function p(e,t){return t||(t=e.slice(0)),e.raw=t,e}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var v,y=n.css(t||(t=p(['\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=9]="Sidebar",e[e.EpgCornerBox=10]="EpgCornerBox",e[e.Line=9]="Line",e[e.Loader=12]="Loader",e[e.Program=1]="Program",e[e.Timeline=9]="Timeline",e[e.Area=2]="Area"}(v||(v={}));var b=["isVerticalMode","program","overlap"],x=function(e){return new Array(e).fill("")},w=function(){return"undefined"!=typeof window?r.useLayoutEffect:r.useEffect},D=function(e){return new Date(e)},M=function(e){return Math.abs(e)},T=function(e){var t=e.replace(/T.*/,"");return s.toDate(t)},W=function(e){return h({},e,{top:e.left,left:e.top,width:e.height,height:e.width})},H={},L=function(e){return H[e.data.channelUuid]||(H[e.data.channelUuid]={}),H},O=function(e){return H=e},k={},E=function(e){var t=e.uuid,n=e.first,i=e.last;k[t]={first:void 0===n?0:n,last:void 0===i?0:i,uuid:t}},I=function(e){return k[e]},C={},S=function(){return C},R={enabled:!1,zone:"",mode:""},V=function(){return R},z=function(e){var t=V(),n=new Date(e);return t.enabled&&"utc"===t.mode?s.utcToZonedTime(n,t.zone).getTime():n.getTime()},P=function(e){var t=V(),n=e?new Date(e):new Date;return t.enabled&&"utc"===t.mode?s.utcToZonedTime(n,t.zone):n},N=function(e,t){void 0===t&&(t="yyyy-MM-dd HH:mm:ss");var n=V();if(n.enabled&&"utc"===n.mode){var i=s.utcToZonedTime(e,n.zone);return s.format(i,t,{timeZone:n.zone})}return a.format(e,t)},U=function(e){var t=V();return t.enabled&&"utc"===t.mode?s.zonedTimeToUtc(e,t.zone):e},j=function(e,t){return e*t/60},X=function(e,t,n,i,r){var o=a.getTime(D(t))>a.getTime(D(i)),s=a.getTime(D(e))=i&&r>n},F=function(e){return a.format(new Date(e),"yyyy-MM-dd HH:mm:ss").replace(/\s/g,"T")},G=function(e){return N(new Date(e),"yyyy-MM-dd HH:mm:ss").replace(/\s/g,"T")},A=function(e){return a.roundToNearestMinutes(new Date(e))},_=function(e){return e.filter((function(e){return a.isWithinInterval(new Date,{start:new Date(e.startTimeHour),end:new Date(e.endTimeHour)})})).length>0},J=function(e){var t=e.hourWidth,n=e.sidebarWidth,i=e.cb,r=e.hoursInDays.filter((function(e){return a.isWithinInterval(new Date,{start:new Date(e.startTimeHour),end:new Date(e.endTimeHour)})}));if(0===r.length)return null==i||i(!1),0;var o=r[0];return X(a.startOfDay(new Date(o.startTimeHour)),new Date,o.startTimeHour,o.endTimeHour,t)+n+o.prevItemDiffInHours*t},q=["hoursInDays"],Z=function(e,t,n){return Array.from({length:24},(function(i,r){if(0===r){var o=e?"MM/dd":"dd.MM",s=a.parse(n[t],"yyyy-MM-dd",new Date);return 0===t?r:a.format(s,o)}return r}))},K=function(e,t){var n=t.hoursInDays,i=f(t,q);return"week"===e?ee(i):"month"===e?te(i):n.length>0?$(t):Q(i)},$=function(e){var t=e.isBaseTimeFormat,n=e.days,i=e.hoursInDays;return x(e.numberOfDays).reduce((function(e,r,o){var a=Z(t,o,n),s=i[o],l=a.slice(s.startTime,s.endTime);return o>0&&(l[0]=a[0]),[].concat(e,l)}),[])},Q=function(e){var t=e.isBaseTimeFormat,n=e.days,i=e.numberOfHoursInDay,r=e.offsetStartHoursRange;return x(e.numberOfDays).reduce((function(e,i,o){var a=Z(t,o,n);return[].concat(e,0===o?a.slice(r):a)}),[]).slice(0,i)},ee=function(e){var t=e.days;return x(e.numberOfDays).map((function(e,n){var i=a.parse(t[n],"yyyy-MM-dd",new Date);return a.format(i,"yyyy-MM-dd")}))},te=function(e){var t=e.months;return x(e.numberOfMonths).map((function(e,n){var i=a.parse(t[n],"yyyy-MM-dd",new Date);return a.format(i,"yyyy-MM-dd")}))},ne=function(e){var t=e.weekDayWidth;return e.months.reduce((function(e,n,i){var r=a.getDaysInMonth(s.toDate(n))*t;if(0===i)return e.data.push({width:r,left:0}),e.offsetLeft=0,e;var o=e.offsetLeft+e.data[i-1].width;return e.data.push({width:r,left:o}),e.offsetLeft=o,e}),{data:[],offsetLeft:0}).data};function ie(e,t){for(var n,i=new Date(e.data.since),r=new Date(e.data.till),o=0,a=g(t);!(n=a()).done;){var s=n.value;if(e.data.id!==s.data.id){var l=new Date(s.data.since),u=new Date(s.data.till);(i<=u&&r>=l||l<=r&&u>=i)&&o++}}return o}var re=function(e,t,n){var i=h({},e),r=i.data,o=i.position,a=r.channelPosition,s=r.overlapTimes,l=o.height,u=h({},e,{position:{width:o.width,height:l,top:a.top+(null!=s?s:t.length+1)*l,left:o.left}}),d=function(e,t,n){for(var i=new Date(e.data.since),r=new Date(e.data.till),o=n,a=0;a0?e.data.channelPosition.top:0)+e.position.height*a,u=!1,d=!1,c=g(t);!(s=c()).done;){var h=s.value;if(e.data.id!==h.data.id&&l===h.position.top){var f=new Date(h.data.since),p=new Date(h.data.till);if(if||fi){(i<=p&&r>=f||f<=r&&p>=i)&&(d=!0),u=!0;break}}}if(!u)return d?a+4:a}return o}(u,t,n);return u.position=h({},u.position,{top:a.top+u.position.height*d}),[u,d+1]},oe=function(e,t,n){return t>n[e.data.channelUuid]?t:n[e.data.channelUuid]};function ae(e,t,n){for(var i,r=h({},t),o={},a=g(n);!(i=a()).done;)r[i.value.data.channelUuid]=[];for(var s=function(){var t,i=h({},n[l]),a=new Date(i.data.since),s=new Date(i.data.till);if(null!=i&&null!=(t=i.data)&&t.parentChannelUuid){var u,d=S()[null==i||null==(u=i.data)?void 0:u.parentChannelUuid];if(null==d||!d.isOpen)return 1}e&&(i.position=W(i.position));for(var c=function(){var t=h({},n[f]);if(i.data.channelUuid!==t.data.channelUuid)return 1;e&&(t.position=W(t.position));var l=new Date(t.data.since),u=new Date(t.data.till);if(al||la){if(r[i.data.channelUuid]&&r[t.data.channelUuid]&&i.data.channelUuid===t.data.channelUuid){t.data.overlapLinkedId=i.data.overlapLinkedId;var d=r[i.data.channelUuid],c=d.some((function(e){return e.data.id===i.data.id})),p=d.some((function(e){return e.data.id===t.data.id})),m=r[i.data.channelUuid].length;if(p||0!==m)if(!p&&m>1){var g=0;if(!c){g=ie(t,d),t.data.overlapTimes=g;var v=re(i,d,o[i.data.channelUuid]),y=v[1];d.push(v[0]),o[i.data.channelUuid]=oe(i,y,o)}g=ie(t,d),t.data.overlapTimes=g;var b=re(t,d,o[i.data.channelUuid]),x=b[1];d.push(b[0]),o[i.data.channelUuid]=oe(i,x,o)}else if(p&&m>1){var w=ie(t,d);t.data.overlapTimes=w;var D=re(t,d,o[i.data.channelUuid]);o[i.data.channelUuid]=oe(i,D[1],o)}else m>1&&d.push(t);else t.position.top=i.data.channelPosition.top+i.position.height,r[i.data.channelUuid]=[i,t],o[i.data.channelUuid]=o[i.data.channelUuid]?o[i.data.channelUuid]:2}}else r[i.data.channelUuid]&&0===r[i.data.channelUuid].length&&(o[i.data.channelUuid]=0,r[i.data.channelUuid]=[])},f=l+1;f div { transform: scale(-1,1) }",t&&n.css(le||(le=p(["\n top: 0;\n left: ","px;\n height: ","px;\n width: ","px;\n "])),i?a:0,o,s),!t&&n.css(ue||(ue=p(["\n left: 0;\n bottom: ","px;\n float: left;\n width: ","px;\n "])),l,o))})," z-index:",v.Sidebar,";"),Ze=i("div",{target:"eqmxcnp1"})((function(e){var t=e.isVerticalMode,i=e.top,r=e.height,o=e.groupTree,a=e.theme;return n.css(de||(de=p(["\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: ",";\n cursor: ",";\n\n ","\n ",";\n "])),a.primary[900],o?"pointer":"default",t&&n.css(ce||(ce=p(["\n top: 0;\n left: ","px;\n width: ","px;\n height: 100%;\n "])),i,r),!t&&n.css(he||(he=p(["\n top: ","px;\n height: ","px;\n width: 100%;\n "])),i,r))}),";"),Ke=i("img",{target:"eqmxcnp0"})({name:"vfop22",styles:"max-height:60px;max-width:60px;position:relative"}),$e=i("div",{target:"e1cx08bt7"})("border:1px solid #171923;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:",v.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 "+(e.isVerticalMode?"bottom":"right")+", "+t.blue[900]+", "+t.blue[600]+","+t.blue[300]+")"}),";"),Qe=i("div",{target:"e1cx08bt6"})("width:100%;display:flex;justify-content:flex-start;",(function(e){return e.isVerticalMode&&"flex-direction: column;"}),";"),et="\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n",tt=i("p",{target:"e1cx08bt5"})("font-size:14px;text-align:left;margin-top:0;margin-bottom:5px;font-weight:500;color:",(function(e){return e.theme.grey[300]}),";",et,";"),nt=i("span",{target:"e1cx08bt4"})("display:block;font-size:12.5px;font-weight:400;color:",(function(e){return e.theme.text.grey[500]}),";text-align:left;",et,";"),it=i("img",{target:"e1cx08bt3"})("margin-right:15px;border-radius:6px;width:100px;",(function(e){return e.isVerticalMode&&"width: 100%; margin-bottom: 10px"}),";"),rt=i("div",{target:"e1cx08bt2"})("overflow:hidden;",(function(e){return e.isRTL&&"transform: scale(-1,1); \n display: flex; \n flex-direction: column; \n align-items: flex-end"}),";"),ot=i("div",{target:"e1cx08bt1"})("position:absolute;padding:",(function(e){return 0===e.width?0:4}),"px;z-index:",(function(e){return e.isDragging||e.isResizing?3*v.Program:v.Program}),";overflow:hidden;",(function(e){return(!e.isDragging||!e.isResizing)&&" &:hover {\n z-index: "+2*v.Program+";\n\n "+at+" {\n opacity: 1;\n }\n }"})," ",(function(e){return(e.isDragging||e.isResizing)&&" \n border-radius: 10px;\n background: "+e.theme.green[200]+";\n \n "+$e+"{\n user-select: none;\n cursor: move;\n }\n "}),";"),at=i("div",{target:"e1cx08bt0"})("position:absolute;opacity:0;",(function(e){return!e.isResize&&"display: none;"})," ",(function(e){var t=e.left;return e.isVerticalMode&&"\n "+(t?"top: 0;":"bottom: 0;")+"\n left:0;\n height:25px;\n width: 100%;\n cursor: "+(t?"n-resize":"s-resize")+";\n "})," ",(function(e){var t=e.left;return!e.isVerticalMode&&"\n top: 0;\n bottom: 0;\n "+(t?"left: 0;":"right: 0;")+"\n width: 25px;\n cursor: "+(t?"w-resize":"e-resize")+";\n "}),' &:after{content:"";position:absolute;margin:auto;border-radius:8px;background:',(function(e){return e.theme.green[200]}),";",(function(e){return!e.isVerticalMode&&" top: 0;\n bottom: 0;\n height: 50%;\n width: 4px;\n "+(e.left?"left: 9px;":"right: 9px;")+"\n "})," ",(function(e){return e.isVerticalMode&&"\n "+(e.left?"top: 9px;":"bottom: 9px;")+"\n left:50%;\n height: 4px;\n width: 50%;\n transform: translateX(-50%);\n \n "}),";}"),st=i("span",{target:"e1bnz7pf6"})("position:absolute;top:13px;left:",(function(e){var t=e.isRTL,n=e.isBaseTimeFormat;return e.isVerticalMode?t?n?9:17:n?9:14:e.isWeekMonthMode?0:t&&n?"-32":"-18"}),"px;color:",(function(e){return e.theme.text.grey[300]}),";",(function(e){return e.isRTL&&"\n transform: scale(-1, 1);\n "})," ",(function(e){return e.isNewDay&&"color: "+e.theme.teal[100]+"; font-weight: 600"}),";",(function(e){var t=e.isRTL;return e.isVerticalMode&&n.css(fe||(fe=p(["\n top: -10px;\n left: 50%;\n transform: translate(-50%, 0%) ",";\n "])),t?"scale(-1,1)":"")}),";"),lt=i("div",{target:"e1bnz7pf5"})("display:flex;justify-content:center;align-items:center;flex-direction:column;height:100%;transform:",(function(e){return e.isRTL?"scale(-1,1)":"scale(1,1)"}),";span{color:",(function(e){return e.theme.text.grey[300]}),";font-size:16px;}",(function(e){var t=e.theme;return"modern"===e.styleType&&n.css(pe||(pe=p(["\n span:first-of-type {\n font-weight: 500;\n color: ",";\n font-size: 18px;\n }\n span {\n font-weight: 500;\n color: ",";\n font-size: 24px;\n }\n "])),t.teal[100],t.text.grey[300])})," ",(function(e){var t=e.isRTL;return e.isVerticalMode&&n.css(me||(me=p(["\n margin-top: 0px;\n transform: ",";\n "])),t?"scale(-1,1)":"scale(1,1)")}),";"),ut=i("div",{target:"e1bnz7pf4"})("position:relative;height:100%;width:100%;padding-bottom:6px;",(function(e){return e.isVerticalMode&&n.css(ge||(ge=p(["\n grid-template-columns: 1fr;\n align-items: start;\n "])))}),";"),dt=i("div",{target:"e1bnz7pf3"})("position:absolute;bottom:6px;background:",(function(e){return e.theme.timeline.divider.bg}),";height:10px;width:1px;left:",(function(e){return e.left}),"px;",(function(e){var t=e.left;return e.isVerticalMode&&n.css(ve||(ve=p(["\n top: ","px;\n left: 50%;\n height: 1px;\n width: 15px;\n transform: translate(-50%, -50%);\n &:first-of-type {\n opacity: 0;\n visibility: hidden;\n }\n "])),t)})," ",(function(e){return e.isNewDay&&"&:first-of-type {\n width:2px;\n background: "+e.theme.teal[100]+";\n }"}),";"),ct=i("div",{target:"e1bnz7pf2"})((function(e){var t=e.isVerticalMode,i=e.isSidebar,r=e.sidebarWidth,o=e.timelineHeight,a=e.dayWidth,s=e.theme;return n.css(ye||(ye=p(["\n position: sticky;\n background: ",";\n z-index: ",";\n\n ","\n\n ","\n "])),s.primary[900],v.Timeline,t&&n.css(be||(be=p(["\n left: 0;\n bottom: 0px;\n float: left;\n width: ","px;\n margin-top: ","px;\n "])),o,i?r:0),!t&&n.css(xe||(xe=p(["\n top: 0;\n left: ","px;\n height: ","px;\n width: ","px;\n "])),i?r:0,o,a))}),";"),ht=i("div",{target:"e1bnz7pf1"})((function(e){var t=e.isVerticalMode,i=e.left,r=e.width,o=e.timelineHeight,a=e.theme;return n.css(we||(we=p(["\n position: absolute;\n font-size: 14px;\n background-color: ",";\n\n ","\n ","\n "])),a.primary[900],!t&&n.css(De||(De=p(["\n left: ","px;\n width: ","px;\n height: 100%;\n "])),i,r),t&&n.css(Me||(Me=p(["\n top: ","px;\n height: ","px;\n width: ","px;\n "])),i,r,o))})," ",(function(e){var t=e.isCurrentTime,n=e.areHoursInDays;return e.isWeekMonthMode?"":"&:nth-of-type("+(n?n&&e.isTodayInHoursInDays&&t?2:1:e.isToday&&t?2:1)+") {\n "+st+" {\n "+(e.isVerticalMode?"top":"left")+": 0px;\n }\n }"}),";"),ft=i(ht,{target:"e1bnz7pf0"})((function(e){var t=e.isVerticalMode,i=e.styleType,r=e.theme;return n.css(Te||(Te=p(['\n &:not(:last-of-type) {\n &:after {\n content: "";\n position: absolute;\n background: ',";\n transform: translate(-50%, -50%);\n\n ","\n }\n }\n "])),r.timeline.divider.bg,t?n.css(We||(We=p(["\n bottom: 0;\n height: 1px;\n width: 80%;\n "]))):n.css(He||(He=p(["\n top: 50%;\n right: 0;\n height: 100%;\n height: ",";\n width: 1px;\n "])),"modern"===i?"35%":"70%"))}),";"),pt={position:"absolute",top:64,width:3},mt=i("div",{target:"ef4is9g0"})("position:",pt.position,";top:",(function(e){return e.isTimeline?pt.top:0}),"px;left:",(function(e){return e.left}),"px;height:",(function(e){return e.height}),"px;width:",pt.width,"px;background:",(function(e){return e.theme.green[300]}),";pointer-events:none;z-index:",(function(e){return e.zIndex}),";",(function(e){return e.isVerticalMode&&" \n top: "+e.left+"px;\n left: "+(e.isTimeline?pt.top:0)+"px;\n height: "+pt.width+"px;\n width: "+e.height+"px;\n "}),";"),gt=[0,50,0],vt=i("div",{target:"e8ysujy1"})("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:",v.Loader,";"),yt=i("div",{target:"e8ysujy0"})("width:",(function(e){return.42*e.width}),"px;background:",(function(e){return e.theme.loader[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,n.keyframes(Le||(Le=p(["\n","\n"])),gt.map((function(e,n){return e+"% {\n transform: translateX(-"+t.right[n]+");\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;"),bt=function(e){var t=(void 0===e?{}:e).width;return{position:"absolute",top:0,width:null!=t?t:70,height:20}},xt=i("div",{target:"e1b7bm21"})("position:",bt().position,";top:",(function(e){return e.top}),"px;left:",(function(e){return e.left}),"px;width:",(function(e){var t=e.width;return"string"==typeof t?"auto":t+"px"}),";height:",bt().height,"px;background-color:",(function(e){return e.theme.primary[900]}),";z-index:2;"),wt=i("span",{target:"e1b7bm20"})((function(e){var t=e.isVerticalMode,i=e.isBaseTimeFormat,r=e.isRTL,o=e.isNewDay,a=e.theme;return n.css(Oe||(Oe=p(["\n position: absolute;\n font-size: 13px;\n font-weight: 500;\n color: ",";\n background-color: ",";\n ",";\n\n ","\n\n ","\n "])),a.green[200],a.primary[900],o&&"color: "+a.teal[100]+"; font-weight: 600",t&&n.css(ke||(ke=p(["\n left: 50%;\n transform: translate(-50%, -50%) ",";\n "])),r?"scale(-1,1)":""),!t&&n.css(Ee||(Ee=p(["\n top: 4px;\n left: ","px;\n ","\n "])),r&&i?"-32":"-16",r&&"transform: scale(-1,1);"))}),";"),Dt=i("div",{target:"euzzuzq2"})("position:absolute;pointer-events:",(function(e){return e.isClickable?"auto":"none"}),";cursor:",(function(e){return e.isClickable?"pointer":"none"}),";z-index:",v.Area,";",(function(e){var t=e.positionX,i=e.height,r=e.width,o=e.timelineHeight;return e.isVerticalMode?n.css(Ie||(Ie=p(["\n top: ","px;\n left: ","px;\n height: ","px;\n width: ","px;\n "])),t,o,r,i):n.css(Ce||(Ce=p(["\n top: ","px;\n left: ","px;\n height: ","px;\n width: ","px;\n "])),o,t,i,r)}),";"),Mt=i("div",{target:"euzzuzq1"})({name:"1b4920d",styles:"position:absolute;top:0;left:0;width:100%;height:100%"}),Tt=i("div",{target:"euzzuzq0"})("padding:4px 6px;font-size:15px;width:max-content;",(function(e){var t=e.isVerticalMode,i=e.isLeft,r=void 0!==i&&i,o=e.width,a=e.timelineHeight;return n.css(Se||(Se=p(["\n ","\n "])),t?n.css(Ve||(Ve=p(["\n position: sticky;\n left: ","px;\n border-top-right-radius: 4px;\n border-bottom-right-radius: 4px;\n ","\n "])),a,r&&n.css(ze||(ze=p([""])))?"top: 0; ":"margin-top:"+(o-60)+"px;"):n.css(Re||(Re=p(["\n position: sticky;\n top: ","px;\n ","\n "])),a,r?"float:left; border-top-right-radius: 4px; border-bottom-right-radius:4px;":"float:right; border-top-left-radius: 4px; border-bottom-left-radius: 4px;"))}),";"),Wt=i("div",{target:"eopf81a3"})({name:"1jykxby",styles:"position:absolute;top:0;left:0;height:100%;width:100%;z-index:1"}),Ht=i("div",{target:"eopf81a1"})("position:absolute;top:",(function(e){return e.top}),"px;left:",(function(e){return e.left}),"px;height:",(function(e){return e.height}),"px;width:",(function(e){return e.width}),"px;border:1px solid transparent;border-right-color:",(function(e){return e.theme.grid.item}),";border-bottom-color:",(function(e){return e.theme.grid.item}),";z-index:1;",(function(e){var t=e.theme;return!e.isDayMode&&e.isHoverHighlight&&"\n &:hover {\n border: 1px solid "+t.grid.highlight+";\n } \n\n "+(e.isDragOver&&"border: 1px solid "+t.grid.highlight+";")+"\n "})," ",(function(e){return e.isItemClickable&&n.css(Pe||(Pe=p(["\n cursor: pointer;\n "])))}),";"),Lt=i("div",{target:"eopf81a0"})("position:absolute;top:0;left:",(function(e){return e.left}),"px;border:1px solid transparent;border-right-color:",(function(e){return e.theme.grid.divider}),";height:100%;width:",(function(e){return e.width}),"px;",(function(e){return e.isHoverHighlight&&"\n &:hover {\n border: 1px solid "+e.theme.grid.highlight+";\n } \n\n\n "})," ",(function(e){return e.isDragOver&&"\n border: 1px solid "+e.theme.grid.highlight+"; \n\n "})," ",(function(e){var t=e.left,i=e.width,r=e.theme;return e.isVerticalMode&&n.css(Ne||(Ne=p(["\n top: ","px;\n left: 0;\n width: 100%;\n height: ","px;\n border-bottom-color: ",";\n "])),t,i,r.grid.divider)})," ",(function(e){return e.isItemClickable&&n.css(Ue||(Ue=p(["\n cursor: pointer;\n "])))}),";"),Ot={primary:{600:"#1a202c",900:"#171923"},grey:{300:"#d1d1d1"},white:"#fff",teal:{100:"#38B2AC"},green:{200:"#389493",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"}},grid:{item:"#7180961a",divider:"#7180961a",highlight:"#38B2AC"}},kt=["isToday","currentDate"],Et=["hourWidth","dayWidth"],It=["isLayoutBottom","isLayoutRight","containerRef","scrollBoxRef"],Ct=F(a.startOfToday()),St={type:"day",style:"default"},Rt={enabled:!1,zone:"",mode:"formatInTimeZone"},Vt={enabled:!1,mode:"stack",layerOverlapLevel:.4},zt={enabled:!1,hoverHighlight:!1},Pt={enabled:!1,mode:"row"};function Nt(e,t){var n=w(),i=o.useRef(e);n((function(){i.current=e}),[e]),o.useEffect((function(){if(t||0===t){var e=setInterval((function(){return i.current()}),t);return function(){return clearInterval(e)}}}),[t])}function Ut(){var e=o.useState(!1),t=e[0],n=e[1];return o.useEffect((function(){function e(){var e=/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.userAgent.includes("Mac")&&"ontouchend"in document,t=/Android|webOS/.test(navigator.userAgent),i=e||t,r="ontouchstart"in window||navigator.maxTouchPoints>0||window.matchMedia&&window.matchMedia("(any-pointer: coarse)").matches;n(i||r)}return e(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[]),t}function jt(e){var t=e.isVerticalMode,n=void 0!==t&&t,i=e.isRTL,s=void 0!==i&&i,l=e.isResize,d=void 0!==l&&l,f=e.isBaseTimeFormat,p=e.startDate,m=e.contentHeight,g=e.dayWidth,v=e.itemHeight,y=e.hourWidth,b=e.minWidth,x=void 0===b?200:b,w=e.program,D=e.liveRefreshTime,M=e.mode,T=e.snap,W=e.dnd,H=e.dragMouseUp,L=e.resizeMouseUp,O=r.useRef(null),k=w.data,E=w.position,I=E.width,C=E.height,S=k.since,R=k.till,V=o.useState((function(){return Y(S,R)})),z=V[0],P=V[1],N={isVerticalMode:n,initialPosition:E,data:k,dayWidth:g,contentHeight:m,elementRef:O},U=function(e){var t=e.isResize,n=e.isVerticalMode,i=e.data,o=e.dayWidth,a=e.contentHeight,s=e.initialPosition,l=e.snapX,u=e.elementRef,d=e.mouseUpCb,c=r.useRef(!1),f=r.useRef(!1),p=Ut(),m=r.useState(!1),g=m[0],v=m[1],y=r.useState(!1),b=y[0],x=y[1],w=r.useState(!1),D=w[0],M=w[1],T=r.useState(!1),W=T[0],H=T[1],L=r.useState(0),O=L[0],k=L[1],E=r.useState({x:s.left,y:s.top,width:n?s.height:s.width}),I=E[0],C=E[1],S=r.useState({startY:s.top,lastY:s.top,startX:s.left,lastX:s.left}),R=S[0],V=S[1],z=i.id,P=i.index,N=i.since,U=i.till,j=r.useMemo((function(){return n?s.height:s.width}),[n,s.height,s.width]),X=r.useCallback((function(e){return void 0===e&&(e=!1),function(t){if(t.stopPropagation(),c.current=!0,p&&v(!0),x(!0),u.current){var i=p?t.touches[0]:t;k(n?i.pageY:i.pageX),R.startY=i.clientY,R.startX=i.clientX,e?(M(!0),H(!1)):(M(!1),H(!0))}}}),[p,n,R,u]),B=r.useCallback((function(e){f.current&&(e.stopPropagation(),e.preventDefault())}),[]),Y=r.useCallback((function(){var e,t,i,r,o,a;n?(R.lastY=null==(e=u.current)?void 0:e.offsetTop,R.lastX=null==(t=u.current)?void 0:t.offsetLeft,I.width=null==(i=u.current)?void 0:i.offsetHeight):(R.lastY=null==(r=u.current)?void 0:r.offsetTop,R.lastX=null==(o=u.current)?void 0:o.offsetLeft,I.width=null==(a=u.current)?void 0:a.offsetWidth);var l={id:z,index:P,since:N,till:U};n||!c.current||s.left===R.lastX&&s.width===I.width||d(h({},l,{top:R.lastY,left:R.lastX,width:I.width,initialPositionTop:s.top,initialPositionLeft:s.left,initialWidth:s.width})),n&&c.current&&(s.top!==R.lastY||s.width!==I.width)&&d(h({},l,{top:R.lastX,left:R.lastY,width:I.width,initialPositionTop:s.left,initialPositionLeft:s.top,initialWidth:s.height})),x(!1),c.current=!1,p&&v(!1),setTimeout((function(){return f.current=!1}),0)}),[p,n,z,P,N,U,j,s.left,s.width,d]),F=JSON.stringify(s);if(r.useEffect((function(){V({startY:s.top,lastY:s.top,startX:s.left,lastX:s.left}),C({x:s.left,y:s.top,width:n?s.height:s.width})}),[n,F]),r.useEffect((function(){function e(e){if(g&&e.preventDefault(),b&&c.current&&u.current){f.current=!0;var t=p?e.touches[0]:e,i=u.current,r=i.getBoundingClientRect();if(n){var a,d=null==(a=u.current)?void 0:a.offsetHeight,m=t.clientY-R.startY+R.lastY,v=l?Math.round((t.pageY-O)/l)*l:t.pageY-O,y=j-v,x=l?Math.round((t.clientY-r.top+14)/l)*l:t.clientY-r.top+14,w=R.lastY+x<=o;if(D&&m>=0&&m<=o-d&&y>=50){var M=s.top+v;i.style.height=y+"px",i.style.top=M+"px",C((function(e){return h({},e,{y:M,width:y})}))}else W&&w&&x>=50&&(i.style.height=x+"px",i.style.top=s.top+"px",C((function(e){return h({},e,{y:s.top,width:x})})))}else{var T,H=null==(T=u.current)?void 0:T.offsetWidth,L=t.clientX-R.startX+R.lastX,k=l?Math.round((t.pageX-O)/l)*l:t.pageX-O,E=j-k,I=l?Math.round((t.clientX-r.left+14)/l)*l:t.clientX-r.left+14,S=R.lastX+I<=o;if(D&&L>=0&&L<=o-H&&E>=50){var V=s.left+k;i.style.width=E+"px",i.style.left=V+"px",C((function(e){return h({},e,{x:V,width:E})}))}else W&&S&&I>=50&&(i.style.width=I+"px",C((function(e){return h({},e,{width:I})})))}}}var i=p?"touchmove":"mousemove",r=p?"touchend":"mouseup";return t&&(document.addEventListener(i,e,p?{passive:!1}:void 0),document.addEventListener(r,Y)),function(){document.removeEventListener(i,e),document.removeEventListener(r,Y)}}),[p,g,t,n,b,D,W,o,a,j,s.top,s.left,R,l,O,u,Y]),t){var G=function(e){return p?{onTouchStart:X(e),onTouchEnd:Y}:{onMouseDown:X(e),onMouseUp:Y}};return{width:I.width,initialWidth:n?s.height:s.width,currentPositionX:n?I.y:I.x,resizeEvents:{isResizing:b,resources:{ref:u,isResizing:b},eventsLeft:h({isResize:t,isVerticalMode:n,left:!0,onClick:B},G(!0)),eventsRight:h({isResize:t,isVerticalMode:n,onClick:B},G())}}}return{currentPositionX:n?s.top:s.left,width:n?s.height:s.width,resizeEvents:{isResizing:!1,resources:{},eventsLeft:{},eventsRight:{}}}}(h({},N,{isResize:d,snapX:null==T?void 0:T.x,mouseUpCb:L})),j=U.currentPositionX,X=U.width,B=U.resizeEvents,F=o.useCallback((function(e,t){var n,i=je(h({},e,{hourWidth:y,startDate:p})),r=h({},i,{id:e.id,data:t});return null==(n=null==W||null==W.onDnDMouseUp?void 0:W.onDnDMouseUp(r))||n}),[]),G=function(e){var t=e.isDndEnabled,n=e.isDndMutlirows,i=e.isVerticalMode,o=e.initialPosition,a=e.data,s=e.dayWidth,l=e.itemHeight,d=e.contentHeight,f=e.dndSnapX,p=e.dndSnapY,m=void 0===p?l:p,g=e.elementRef,v=e.mouseUpCb,y=e.dndMouseUpCb,b=r.useRef(!1),x=r.useRef(!1),w=Ut(),D=r.useState(!1),M=D[0],T=D[1],W=r.useState(!1),H=W[0],L=W[1],O=r.useState({x:o.left,y:o.top}),k=O[0],E=O[1],I=r.useState({startY:o.top,lastY:o.top,startX:o.left,lastX:o.left}),C=I[0],S=I[1],R=a.id,V=a.index,z=a.since,P=a.till,N=a.channelPosition,U=r.useCallback((function(e){e.stopPropagation(),b.current=!0,w&&L(!0),T(!0);var t=w?e.touches[0]:e;C.startY=t.clientY,C.startX=t.clientX}),[w,C]),j=r.useCallback((function(e){x.current&&(e.stopPropagation(),e.preventDefault())}),[]),X=r.useCallback(c(u().mark((function e(){var t,n,r,s,l,d,c;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i?(C.lastY=null==(t=g.current)?void 0:t.offsetTop,C.lastX=null==(n=g.current)?void 0:n.offsetLeft):(C.lastY=null==(r=g.current)?void 0:r.offsetTop,C.lastX=null==(s=g.current)?void 0:s.offsetLeft),l={id:R,index:V,since:z,till:P},i||!b.current||o.left===C.lastX&&o.top===C.lastY){e.next=8;break}return d=h({},l,{top:C.lastY,left:C.lastX,initialPositionLeft:o.left,initialPositionTop:o.top}),e.next=6,null==y?void 0:y(d,a);case 6:e.sent?v(d):(g.current.style.left=o.left+"px",g.current.style.top=o.top+"px",E((function(e){return h({},e,{x:o.left,y:o.top})})));case 8:if(!i||!b.current||o.left===C.lastX&&o.top===C.lastY){e.next=14;break}return c=h({},l,{top:C.lastX,left:C.lastY,initialPositionLeft:o.top,initialPositionTop:o.left}),e.next=12,null==y?void 0:y(c,a);case 12:e.sent?v(c):(g.current.style.left=o.left+"px",g.current.style.top=o.top+"px",E((function(e){return h({},e,{x:o.left,y:o.top})})));case 14:b.current=!1,T(!1),w&&L(!1),setTimeout((function(){return x.current=!1}),0);case 18:case"end":return e.stop()}}),e)}))),[i,o.top,o.left,C,R,V,z,P,v]),B=JSON.stringify(o);return r.useEffect((function(){S({startY:o.top,lastY:o.top,startX:o.left,lastX:o.left}),E({x:o.left,y:o.top})}),[i,B]),r.useEffect((function(){function e(e){var r,a,l,u;if(H&&e.preventDefault(),t&&b.current&&g.current){x.current=!0;var c=w?e.touches[0]:e,p=i?null==(r=g.current)?void 0:r.offsetHeight:null==(a=g.current)?void 0:a.offsetWidth,v=i?null==(l=g.current)?void 0:l.offsetWidth:null==(u=g.current)?void 0:u.offsetHeight,y=N;if(i){var D=c.clientY-C.startY+C.lastY,M=f?Math.round(D/f)*f:D;if(n){var T=Math.round((c.clientX-C.startX+C.lastX)/m)*m;T>=0&&T<=d-v&&M>=0&&M<=s-p&&(T>y.top+y.height-1||T=0&&M<=s-p&&(g.current.style.top=M+"px",E((function(e){return h({},e,{y:M})})))}else{var W=c.clientX-C.startX+C.lastX,L=f?Math.round(W/f)*f:W;if(n){var O=Math.round((c.clientY-C.startY+C.lastY)/m)*m;O>=0&&O<=d-v&&L>=0&&L<=s-p&&(O>y.top+y.height-1||O=0&&L<=s-p&&(g.current.style.left=L+"px",E((function(e){return h({},e,{x:L})})))}}}var r=w?"touchmove":"mousemove",a=w?"touchend":"mouseup";return t&&(document.addEventListener(r,e,w?{passive:!1}:void 0),document.addEventListener(a,X)),function(){document.removeEventListener(r,e),document.removeEventListener(a,X)}}),[w,H,t,i,M,n,o.top,o.left,N,f,m,C,s,l,d,g,X]),t?{dndEvents:h({isDragging:M,ref:g,onClick:j},w?{onTouchStart:U,onTouchEnd:X}:{onMouseDown:U,onMouseUp:X}),currentPositionX:i?k.y:k.x}:{currentPositionX:o.left,dndEvents:{isDragging:!1}}}(h({},N,{isDndEnabled:!!W.enabled&&!B.resources.isResizing,isDndMutlirows:"multi-rows"===W.mode,dndSnapX:null==T?void 0:T.x,dndSnapY:null==T?void 0:T.y,itemHeight:v,dndMouseUpCb:F,mouseUpCb:H})),A=G.currentPositionX,_=G.dndEvents,J=h({},function(e){for(var t=h({},e),n=arguments.length,i=new Array(n>1?n-1:0),r=1;rx:I>x,ee=r.useCallback((function(){return h({},B.resources,_)}),[_,B.resources]);return{isMouseEvent:_.isDragging||B.resources.isResizing||!1,isLive:z,isMinWidth:Q,isRTL:s,resizeEvents:B,formatTime:Z,set12HoursTimeFormat:K,getMouseEvents:ee,getMouseEventTempTime:function(){var e={id:k.id,index:k.index,since:k.since,till:k.till,top:0,left:B.isResizing?j:A,initialPositionTop:E.top,initialPositionLeft:E.left,initialWidth:I,width:X,hourWidth:y};n&&(e.initialPositionLeft=E.top,e.initialPositionTop=E.left,e.initialWidth=C);var t=je(e),i=t.till,r=function(e){return Z($(e),K()).toLowerCase()};return{since:r(t.since),till:r(i)}},getRTLSinceTime:$,getRTLTillTime:function(e){return s?S:e},styles:q}}function Xt(e){var t=e.isBaseTimeFormat,n=e.isRTL,i=e.isSidebar,o=e.isVerticalMode,l=e.timezone,u=e.dayWidth,d=e.hourWidth,c=e.sidebarWidth,h=e.timelineHeight,f=e.mode,p=e.startDate,m=e.endDate,g=e.hoursInDays,v=e.days,y=e.liveRefreshTime,b=e.months,w=e.numberOfDays,D=e.numberOfHoursInDay,M=e.numberOfMonths,T=e.offsetStartHoursRange,W=e.timelineDividers,H=e.renderCurrentTime,L=r.useMemo((function(){return K(f.type,{isBaseTimeFormat:t,days:v,hoursInDays:g,months:b,numberOfDays:w,numberOfHoursInDay:D,numberOfMonths:M,offsetStartHoursRange:T})}),[f.type,t,v,g,b,w,D,M,T]),O="month"===f.type,k="week"===f.type||O,E=_(g),I=g.length>0,C=24*d,S=r.useMemo((function(){return ne({months:b,weekDayWidth:C})}),[b,C]),R=x(W);return{isWeekMonthMode:k,isMonthMode:O,isTodayInHoursInDays:E,areHoursInDays:I,time:L,weekDayWidth:C,monthsWidth:S,timelineHeight:h,dividers:R,timelineDividers:W,formatWeekMonthDate:function(e){return function(e){var t=e.date,n=e.mode,i=e.isBaseTimeFormat;if("week"===n.type){if("modern"===n.style)return a.format(s.toDate(t),"dd");var r=i?"MM/dd":"dd.MM";return a.format(s.toDate(t),r)}return a.format(s.toDate(t),"LLL")}({date:e,mode:f,isBaseTimeFormat:t})},getTime:function(e){if("string"==typeof e)return{time:e,isNewDay:!0};var n=new Date,i=a.format(n,"yyyy-MM-dd"),r=e<10?"0"+e:e;if(t){var o=new Date(i+"T"+r+":00:00");return{time:a.format(o,"h:mm a").toLowerCase().replace(/\s/g,""),isNewDay:!1}}return{time:r+":00",isNewDay:!1}},getDayMonthName:function(e){var t="week"===f.type?"EEE":"yyyy";return a.format(s.toDate(e),t)},getTimelineProps:function(){return{isSidebar:i,isVerticalMode:o,dayWidth:u,sidebarWidth:c,timelineHeight:h}},getCurrentTimeProps:function(){return{isBaseTimeFormat:t,isVerticalMode:o,isRTL:n,timezone:l,mode:f,startDate:p,endDate:m,hoursInDays:g,dayWidth:u,timelineHeight:h,hourWidth:d,sidebarWidth:c,liveRefreshTime:y,renderCurrentTime:H}}}}function Bt(e){var t=e.timezone,n=e.startDate,i=e.endDate,r=e.hoursInDays,s=e.dayWidth,l=e.hourWidth,u=e.sidebarWidth,d=e.liveRefreshTime,c=o.useState(!0),h=c[0],f=c[1],p=o.useState((function(){return r.length>0?J({hoursInDays:r,hourWidth:l,sidebarWidth:u,cb:f}):X(a.startOfDay(new Date(n)),new Date,n,i,l)+u})),m=p[0],g=p[1],v=JSON.stringify(t),y=JSON.stringify(r),b=1e3*d,x=m<=s;return Nt((function(){var e=l/60/60*d;r.length>0?_(r)?(f(!0),g((function(t){return t+e}))):f(!1):g((function(t){return t+e}))}),o.useMemo((function(){return x?b:null}),[x,b])),o.useEffect((function(){if(r.length>0){var e=J({hoursInDays:r,hourWidth:l,sidebarWidth:u,cb:f});g(e)}else{var t=new Date(n),o=X(a.startOfDay(t),P(),n,i,l);g(o+u)}}),[n,i,u,l,y,v]),{showLine:h,positionX:m}}var Yt=["mode","grid","timelineHeight","sidebarWidth","hourWidth","dayWidth"];function Ft(e){var t=(void 0===e?{}:e).onItemDrop,n=o.useRef(null),i=o.useState(!1),a=i[0],s=i[1],l=r.useCallback((function(e,i){return function(r){if(r.preventDefault(),n.current){s(!1);var o=r.dataTransfer.getData("text/plain"),a=document.getElementById(o);if(a){for(var l=a.attributes,u={},d=0;d0?function(e){return e.reduce((function(e,t){return e+t.position.height}),0)}(u):xe*V}),[xe,we,V,De]),Te=v.length>0,We=B(new Date(r))>B(new Date);return o.createElement(Qt,{ref:t,id:"planby-layout-scrollbox",className:"planby-layout",isRTL:A,onScroll:de},y.enabled&&o.createElement($t,{isVerticalMode:F,isProgramVisible:ce,channelOverlapsCount:d,isBaseTimeFormat:te,hourWidth:I,dayWidth:E,days:z,hoursInDays:a,months:P,numberOfDays:U,numberOfHoursInDay:N,numberOfMonths:j,offsetStartHoursRange:X,grid:y,gridItems:x,mode:w,sidebarWidth:S,timelineHeight:R,timelineDividers:k,renderGridCell:be}),ue&&o.createElement(Je,{className:"planby-layout-bg",isSidebar:J,isVerticalMode:F,isTimeline:Z,dayWidth:E,contentHeight:Me,sidebarWidth:S,timelineHeight:R,onClick:ue}),$&&Q&&We&&o.createElement(Cn,{isVerticalMode:F,isTimeline:Z,dayWidth:E,hourWidth:I,sidebarWidth:S,startDate:i,endDate:r,height:Me,liveRefreshTime:s,hoursInDays:a,timezone:g,renderLine:ve}),Te&&o.createElement(Xn,{isVerticalMode:F,sidebarWidth:S,hourWidth:I,areas:v,startDate:i,endDate:r,height:Me,timelineHeight:R}),Z&&(n={isVerticalMode:F,isSidebar:J,isRTL:A,isTimelineVisible:fe,isToday:Q,isBaseTimeFormat:te,isCurrentTime:ie,timezone:g,startDate:i,endDate:r,dayWidth:E,sidebarWidth:S,timelineHeight:R,offsetStartHoursRange:X,monthWidth:C,numberOfHoursInDay:N,numberOfMonths:j,numberOfDays:U,hourWidth:I,days:z,months:P,hoursInDays:a,liveRefreshTime:s,mode:w,timelineDividers:k,renderCurrentTime:ye},ge?ge(n):o.createElement(On,Object.assign({},n))),J&&o.createElement(pn,{isVerticalMode:F,isRTL:A,isTimeline:Z,isChannelVisible:he,timelineHeight:R,sidebarWidth:S,contentHeight:Me,channels:u,scrollY:l,openChannelGroupTree:le,renderChannel:me}),o.createElement(en,{className:"planby-content",isVerticalMode:F,isSidebar:J,isTimeline:Z,dayWidth:E,sidebarWidth:S,timelineHeight:R,contentHeight:Me},c.map((function(e,t){return function(e,t){var n,r,a=null!=(n=d[e.data.channelUuid])?n:1;if(null!=(r=e.data.fixedVisibility)?r:ce(e.position,a)){!function(e,t){var n=L(e);n[e.data.channelUuid][e.data.id]||(e.data.index=t,n[e.data.channelUuid][e.data.id]=e),O(n)}(e,t);var l=function(e){var t=e.isVerticalMode,n=e.program,i=e.overlap,r=f(e,b);if(i.enabled)return function(e){var t=e.isVerticalMode,n=e.program,i=e.layerOverlapLevel,r=e.overlapMode,o=n.data,a=n.position,s=e.programOverlaps[o.channelUuid];if(s){var l=s.findIndex((function(e){return e.data.id===o.id})),u=s[l];if(u){if("layer"===r&&u.data.channelPosition.top0){var m=i.reduce((function(e,t){return e+t.diffInHours}),0),g=t/m,v=g*m;return h({},o,{hourWidth:M(g),dayWidth:M(v),numberOfHoursInDay:M(m)})}var y=a.differenceInHours(s,a.startOfDay(s)),b=a.differenceInHours(l,s),x=Math.floor(t/b),w=x*b;return h({},o,{hourWidth:M(x),dayWidth:M(w),numberOfHoursInDay:M(b),offsetStartHoursRange:M(y)})}({dayWidth:We,startDate:Ge,endDate:Ae,hoursInDays:Je,modeType:Ue.type})}),[We,Ge,Ae,Je,Ue.type]),et=Qe.hourWidth,tt=Qe.dayWidth,nt=f(Qe,Et),it=o.useReducer((function(e){return e+1}),0),rt=it[0],ot=it[1],at=o.useReducer((function(e){return e+1}),0),st=at[0],lt=at[1],ut=o.useState({index:-1,uuid:""}),dt=ut[0],ct=ut[1],ht=o.useState((function(){return 0})),ft=ht[0],pt=ht[1],mt=o.useState({}),gt=mt[0],vt=mt[1],yt=o.useState({}),bt=yt[0],xt=yt[1],wt=JSON.stringify(Ne);o.useMemo((function(){Ne.enabled&&function(e){R=e}(Ne)}),[wt]),o.useEffect((function(){ot(),ct({index:-1,uuid:""})}),[n]);var Dt=function(e){var t,n=e.isVerticalMode,i=e.isToday,r=e.isInitialScrollToNow,s=e.initialScrollPositions,u=e.height,d=e.width,c=e.channelsNumber,h=e.startDate,f=e.endDate,p=e.hourWidth,m=e.sidebarWidth,g=e.hoursInDays,v=w(),y=o.useRef(null),b=o.useRef(null),x=o.useState(0),D=x[0],M=x[1],T=o.useState(0),W=T[0],H=T[1],L=o.useState(d),O=L[0],k=L[1],E=o.useState(u),I=E[0],C=E[1],S=null==b||null==(t=b.current)?void 0:t.scrollHeight,R=JSON.stringify(s),V=l.useDebouncedCallback((function(e){M(e.y),H(e.x)}),100,{maxWait:100}),z=o.useCallback((function(e){V({y:e.target.scrollTop,x:e.target.scrollLeft})}),[V]),N=JSON.stringify(g),U=o.useMemo((function(){return g.length>0}),[N]),j=o.useCallback((function(){if(null!=b&&b.current&&i){var e,t=null!=d?d:null==(e=y.current)?void 0:e.clientWidth,r=new Date(h),o=X(a.startOfDay(r),P(),h,f,p);U&&(o=J({hoursInDays:g,hourWidth:p,sidebarWidth:m}));var s=o-t/2+m;n?b.current.scrollTop=s+p:b.current.scrollLeft=s}}),[n,i,U,d,p,m,h,f]),B=o.useCallback((function(){var e=Object.keys(s).length;if(null!=b&&b.current&&e){var t=s.top,n=s.left;b.current.scrollTo({behavior:"smooth",top:void 0===t?0:t,left:void 0===n?0:n})}}),[R,S]),Y=o.useCallback((function(e){void 0===e&&(e=p),null!=b&&b.current&&(b.current.scrollTop=b.current.scrollTop+e)}),[p]),F=o.useCallback((function(e){void 0===e&&(e=p),null!=b&&b.current&&(b.current.scrollLeft=b.current.scrollLeft+e)}),[p]),G=o.useCallback((function(e){void 0===e&&(e=p),null!=b&&b.current&&(b.current.scrollLeft=b.current.scrollLeft-e)}),[p]),A=l.useDebouncedCallback((function(){null!=y&&y.current&&!d&&k(y.current.clientWidth)}),400,{maxWait:400}),_=o.useCallback((function(e){if(void 0===e&&(e=0),null!=b&&b.current){if(n){var t=b.current,i=t.scrollLeft;return 0!==i&&t.scrollWidth-i-e<=t.clientWidth}var r=b.current,o=r.scrollTop;return 0!==o&&r.scrollHeight-o-e<=r.clientHeight}return!1}),[n,W,D,c]),q=o.useCallback((function(e){if(void 0===e&&(e=0),null!=b&&b.current){if(n){var t=b.current,i=t.scrollTop;return 0!==i&&t.scrollHeight-i-e<=t.clientHeight}var r=b.current,o=r.scrollLeft;return 0!==o&&r.scrollWidth-o-e<=r.clientWidth}return!1}),[W,D,c]);return v((function(){if(null!=y&&y.current){var e=y.current;d||k(e.clientWidth),u||C(e.clientHeight)}}),[u,d,h]),v((function(){var e=Object.keys(s).length;null!=b&&b.current&&(e?B():r&&j())}),[i,r,R]),v((function(){return window.addEventListener("resize",A),function(){window.removeEventListener("resize",A)}}),[d]),{containerRef:y,scrollBoxRef:b,scrollX:W,scrollY:D,layoutWidth:O,layoutHeight:I,isLayoutBottom:_,isLayoutRight:q,onScroll:z,onScrollToNow:j,onScrollTop:Y,onScrollLeft:G,onScrollRight:F}}({isVerticalMode:n,isToday:Ze,isInitialScrollToNow:j,initialScrollPositions:re,startDate:Ge,endDate:Ae,sidebarWidth:Le,width:Y,height:A,hourWidth:et,currentDate:Ke,hoursInDays:Je,channelsNumber:_.length}),Mt=Dt.isLayoutBottom,Tt=Dt.isLayoutRight,Wt=Dt.containerRef,Ht=Dt.scrollBoxRef,Lt=f(Dt,It);o.useEffect((function(){return function(){H={}}}),[]);var Nt=Lt.scrollX,Ut=Lt.scrollY,jt=Lt.layoutWidth,Xt=Lt.layoutHeight,Bt=Lt.onScroll,Yt=Lt.onScrollToNow,Ft=Lt.onScrollTop,Gt=Lt.onScrollLeft,At=Lt.onScrollRight,_t=function(e,t){return"week"!==t.type&&"month"!==t.type||"modern"!==t.style?e:80}(ke,Ue),Jt=o.useMemo((function(){return JSON.stringify(_)}),[_]),qt=o.useMemo((function(){return bt}),[JSON.stringify(bt)]),Zt=o.useMemo((function(){return function(e,t,n,i,r,o,a){var s=0,l="stack"===t,u="layer"===t;return i.reduce((function(t,i,d){var c=a[i[o]];i.groupTree&&i.uuid&&function(e){C[e.uuid]={uuid:e.uuid,isOpen:e.isOpen,groupTree:e.groupTree}}(i);var f=S()[i.parentChannelUuid];if(f&&i.parentChannelUuid){if(function(e,t){var n,i=C[e];C[e]=h({},i,{nestedChildren:[].concat(null!=(n=i.nestedChildren)?n:[],[t])})}(f.uuid,i.uuid),i.isNestedChild=!0,null==f||!f.isOpen)return t}else i.isNestedChild=!1;var p=1,m=null!=c?c:0;e&&(l||u)&&m>0&&(p=c);var g=function(e,t){return{top:t*e,height:t}}(d,r*p);e&&l&&(g.top=s,s+=g.height),e&&u&&(m>0?(g.top=s,g.height=m<=1?g.height:r*n*(m-1)+r,s+=g.height):(g.top=s,s+=g.height));var v=h({},i,{uuid:i[o],index:d,position:g});return t.push(v),t}),[])}(Be,Xe.mode,Xe.layerOverlapLevel,_,Ie,Ve,bt)}),[Be,Xe.mode,Xe.layerOverlapLevel,Jt,qt,Ie,Ve,ft,st]),Kt=F(Ge),$t=F(Ae),Qt=o.useMemo((function(){return JSON.stringify(Zt)}),[Zt]),en=o.useMemo((function(){return gt}),[JSON.stringify(gt)]),tn=o.useMemo((function(){var e=function(e){var t=e.isVerticalMode,n=e.isOverlapEnabled,i=e.programChannelMapKey,r=e.channels,o=e.startDate,a=e.endDate,s=e.itemHeight,l=e.hourWidth,u=e.hoursInDays,d=0;return e.data.map((function(e,c,f){var p,m,g;e.channelUuid=e[i],(null==(p=f[c-1])?void 0:p[i])!==e[i]&&E({uuid:e[i],first:d=c}),E({uuid:e[i],first:d,last:c});var v,y=r.findIndex((function(t){return t.uuid===e.channelUuid}));e.channelIndex=y,e.channelPosition=null==(m=r[y])?void 0:m.position,e.index=c,null!=(g=r[y])&&g.parentChannelUuid&&(e.parentChannelUuid=null==(v=r[y])?void 0:v.parentChannelUuid);var b=function(e,t,n,i,r,o,a){var s=h({},e,{since:G(e.since),till:G(e.till)}),l=function(e,t){var n=B(new Date(e));return B(new Date(t))>n}(s.since,r),u=X(s.since,s.till,r,o,i),d=n*t,c=X(r,s.since,r,o,i);l&&(c=0),d<0&&(u=0);var f={width:u,height:n,top:d,left:c,edgeEnd:X(r,s.till,r,o,i)};return a&&(f=h({},f,{top:c,left:d,width:n,height:u})),{position:f,data:s}}(e,y,s,l,o,a,t);if(n&&y>0){var x=r[y-1].position,w=x.top+x.height;t?b.position.left=w:b.position.top=w}if(0===u.length)return b;var D=function(e){var t=e.isVerticalMode,n=e.position,i=e.since,r=e.hourWidth,o=e.hoursInDays.find((function(e){return i.includes(e.date)}));if(!o)return{position:n};if(t){var a=o.diffLeft*r;return h({},n,{top:n.top-a,edgeEnd:n.edgeEnd-a})}var s=o.diffLeft*r;return h({},n,{left:n.left-s,edgeEnd:n.edgeEnd-s})}({isVerticalMode:t,hoursInDays:u,position:b.position,since:b.data.since,hourWidth:l});return b.position=D,b}),[])}({isVerticalMode:n,isOverlapEnabled:Be,programChannelMapKey:Pe,data:q,channels:Zt,startDate:Kt,endDate:$t,hoursInDays:Je,itemHeight:Ie,hourWidth:et});if(Be){var t=function(e,t,n,i,r){var o=h({},i),a={},s={},l=I(n.uuid);if(!e&&l){var u,d=function(e,t,n){for(var i={},r=0,o=Object.keys(t);rn){var c=I(l),h=e.slice(c.first,c.last+1);i[d]=h}}return i}(r,o,n.index);s=h(((u={})[n.uuid]=r.slice(l.first,l.last+1),u),d)}else s=function(e){for(var t,n=new Map,i=g(e);!(t=i()).done;){var r=t.value,o=r.data.channelUuid;n.has(o)||n.set(o,[]),n.get(o).push(r)}return Object.fromEntries(n)}(r);for(var c in s){var f=ae(t,i,s[c]);o[c]=f.overlaps[c],a[c]=f.channelOverlaps[c]}for(var p in o){var m;null!=o&&o[p]&&0===(null==(m=Object.keys(null==o?void 0:o[p]))?void 0:m.length)&&delete o[p]}return{overlaps:o,channelOverlaps:a}}(Ye,n,dt,gt,e),i=t.overlaps;return xt(h({},bt,t.channelOverlaps)),pt((function(e){return e+1})),vt(i),{programs:e,programOverlaps:i}}return{programs:e,programOverlaps:{}}}),[Ye,Be,n,q,Qt,en,Kt,$t,Ie,et,Je,Pe,wt,rt]),nn=tn.programs,rn=tn.programOverlaps,on=o.useMemo((function(){return be.enabled?function(e){var t=e.isVerticalMode,n=e.dayWidth,i=e.hourWidth,r=e.timelineHeight,o=e.sidebarWidth,a=e.mode,s=e.dayWidthResources,l=e.daysResources,u="month"===a.type,d=function(){return"day"===a.type?s.numberOfHoursInDay:"week"===a.type?l.numberOfDays:s.numberOfMonths},c=function(){return ne({months:l.months,weekDayWidth:24*i})};return e.channels.flatMap((function(e){return x(d()).map((function(i,a){return function(e,i){var a=0,s=0;u?(a=c()[i].width,s=c()[i].left):s=(a=n/d())*i;var l={top:e.position.top,left:s,width:a,height:e.position.height,edgeEnd:s+a};return{position:l=h({},l,t?{left:l.top+r,top:l.left+o,width:l.height,height:l.width}:{top:l.top+r,left:s+o,width:a,height:l.height}),channel:e}}(e,a)}))}))}({isVerticalMode:n,channels:Zt,dayWidth:tt,hourWidth:et,timelineHeight:_t,sidebarWidth:Le,mode:Ue,dayWidthResources:nt,daysResources:$e}):[]}),[be.enabled,Qt,Ue.type,nt.numberOfHoursInDay,nt.numberOfMonths,$e.numberOfDays,tt,et,Le,_t,n]),an=h({},Ot,De),sn=o.useCallback((function(e,t){return function(e){var t=e.position,n=e.scrollY,i=e.scrollX,r=e.containerHeight,o=e.containerWidth,a=e.overlapsCount,s=0===a?1:a;if(e.isVerticalMode){if(t.height<=0)return!1;if(i>t.left+2*t.width*s)return!1;if(i+o<=t.left)return!1;if(n+r>=t.top&&n<=t.edgeEnd)return!0}else{if(t.width<=0)return!1;if(n>t.top+3*e.itemOverscan*s)return!1;if(n+r<=t.top)return!1;if(i+o>=t.left&&i<=t.edgeEnd)return!0}return!1}({isVerticalMode:n,itemOverscan:Se,overlapsCount:t,position:e,scrollY:Ut,scrollX:Nt,containerHeight:Xt,containerWidth:jt})}),[n,Se,Xt,jt,Ut,Nt]),ln=o.useCallback((function(e){return function(e){var t=e.position,n=e.scrollX,i=e.scrollY,r=e.itemOverscan;if(e.isVerticalMode){var o=t.left+t.height;if(n>o+3*r)return!1;if(n+e.containerWidth<=o-t.height)return!1}else{if(i>t.top+t.height+3*r)return!1;if(i+e.containerHeight<=t.top)return!1}return!0}({isVerticalMode:n,itemOverscan:Se,position:e,scrollX:Nt,scrollY:Ut,containerHeight:Xt,containerWidth:jt})}),[n,Se,Ut,Nt,Xt,jt]),un=o.useCallback((function(e){return function(e){var t=e.position,n=e.scrollY,i=e.scrollX;if(e.isVerticalMode){if(n>t.left+2*t.width)return!1;if(n+e.containerHeight<=t.left)return!1}else{if(i>t.left+2*t.width)return!1;if(i+e.containerWidth<=t.left)return!1}return!0}({position:e,scrollY:Ut,scrollX:Nt,containerHeight:Xt,containerWidth:jt,isVerticalMode:n})}),[Ut,Nt,Xt,jt,n]),dn=o.useCallback((function(e){return null==we||null==we.onDnDSuccess?void 0:we.onDnDSuccess(e)}),[]),cn=o.useCallback((function(e){var t=je(h({},e,{hourWidth:et,startDate:Ge}));q[e.index].since=t.since,q[e.index].till=t.till,ct({index:q[e.index].channelIndex,uuid:q[e.index][Pe]}),dn(q[e.index]),ot()}),[n,Ge,et,nn]),hn=o.useCallback(function(){var e=c(u().mark((function e(t){var n,i,r,o,a,s,l;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=je(h({},t,{hourWidth:et,startDate:Ge})),i=h({},q[t.index]),r=function(){var e=i.channelPosition;return t.top>e.top+e.height-1||t.top