dhtmlx-scheduler
Version:
JavaScript event calendar. Allows to manage events and appointments in different views
12 lines (8 loc) • 534 kB
JavaScript
(function(ve,Z){typeof exports=="object"&&typeof module<"u"?Z(exports):typeof define=="function"&&define.amd?define(["exports"],Z):Z((ve=typeof globalThis<"u"?globalThis:ve||self).dhtmlxscheduler={})})(this,function(ve){"use strict";/** @license
dhtmlxScheduler v.7.2.3 Standard
To use dhtmlxScheduler in non-GPL projects (and get Pro version of the product), please obtain Commercial/Enterprise or Ultimate license on our site https://dhtmlx.com/docs/products/dhtmlxScheduler/#licensing or contact us at sales@dhtmlx.com
(c) XB Software Ltd.
*/const Z=typeof window<"u"?window:global;function Mt(e){let i=[],t=!1,r=null,s=null;function n(){return e.config.drag_highlight&&e.markTimespan}function o(d){const l=e.getView(d);return l?l.layout:d}function _(d){const{event:l,layout:c,viewName:f,sectionId:m,eventNode:p}=d;(function(v,y){switch(y){case"month":v.style.top="",v.style.left="";break;case"timeline":v.style.left="",v.style.marginLeft="1px";break;default:v.style.top=""}})(p,c);const h={};let u={start_date:l.start_date,end_date:l.end_date,css:"dhx_scheduler_dnd_marker",html:p};if(c=="timeline"){const v=e.getView(f);if(v.round_position){const y=e._get_date_index(v,l.start_date),x=v._trace_x[y];u.start_date=x}}return c!="timeline"&&c!="month"||(u={...u,end_date:e.date.add(l.start_date,1,"minute")}),m&&(h[f]=m,u.sections=h),u}function a(d){const{layout:l}=d;let c;switch(l){case"month":c=function(f){let m=[];const{event:p,layout:h,viewName:u,sectionId:v}=f,y=[];let x=new Date(p.start_date);for(;x.valueOf()<p.end_date.valueOf();){let k={start_date:x};y.push(k),x=e.date.week_start(e.date.add(x,1,"week"))}let D=e.$container.querySelectorAll(`[${e.config.event_attribute}='${p.id}']`);for(let k=0;k<D.length;k++){const S={event:y[k],layout:h,viewName:u,sectionId:v,eventNode:D[k].cloneNode(!0)};m.push(_(S))}return m}(d);break;case"timeline":case"units":c=function(f){let m=[];const{event:p,layout:h,viewName:u,eventNode:v}=f;let y=function(x){const D=e.getView(x);return D.y_property?D.y_property:D.map_to?D.map_to:void 0}(u);if(y){const x=String(p[y]).split(e.config.section_delimiter).map(k=>String(k)),D=[];for(let k=0;k<x.length;k++){D[k]=v.cloneNode(!0);const S={event:p,layout:h,viewName:u,sectionId:x[k],eventNode:D[k]};m.push(_(S))}}return m}(d);break;default:c=function(f){const{event:m,layout:p,viewName:h,sectionId:u}=f;let v=[],y=e.$container.querySelectorAll(`[${e.config.event_attribute}='${m.id}']:not(.dhx_cal_select_menu):not(.dhx_drag_marker)`);if(y)for(let x=0;x<y.length;x++){let D=y[x].cloneNode(!0);const k={event:{start_date:new Date(+D.getAttribute("data-bar-start")),end_date:new Date(+D.getAttribute("data-bar-end"))},layout:p,viewName:h,sectionId:u,eventNode:D};v.push(_(k))}return v}(d)}c.forEach(f=>{i.push(e.markTimespan(f))})}e.attachEvent("onBeforeDrag",function(d,l,c){return n()&&(t=!0,s=e.getEvent(d),r=c.target.closest(`[${e.config.event_attribute}]`),o(e.getState().mode)=="units"&&e.config.cascade_event_display&&(e.unselect(d),r=c.target.closest(`[${e.config.event_attribute}]`))),!0}),e.attachEvent("onEventDrag",function(d,l,c){if(t&&n()){t=!1;const f=e.getState().mode,m=o(f),p=e.getActionData(c).section;s&&a({event:s,layout:m,viewName:f,sectionId:p,eventNode:r})}}),e.attachEvent("onDragEnd",function(d,l,c){for(let f=0;f<i.length;f++)e.unmarkTimespan(i[f]);i=[],r=null,s=null})}function Nt(e){e.config.mark_now=!0,e.config.display_marked_timespans=!0,e.config.overwrite_marked_timespans=!0;var i="dhx_time_block",t="default",r=function(n,o,_){var a=typeof n=="object"?n:{days:n};return a.type=i,a.css="",o&&(_&&(a.sections=_),a=function(d,l,c){return l instanceof Date&&c instanceof Date?(d.start_date=l,d.end_date=c):(d.days=l,d.zones=c),d}(a,n,o)),a};function s(n,o,_,a,d){var l=e,c=[],f={_props:"map_to",matrix:"y_property"};for(var m in f){var p=f[m];if(l[m])for(var h in l[m]){var u=l[m][h][p];n[u]&&(c=l._add_timespan_zones(c,e._get_blocked_zones(o[h],n[u],_,a,d)))}}return c=l._add_timespan_zones(c,e._get_blocked_zones(o,"global",_,a,d))}e.blockTime=function(n,o,_){var a=r(n,o,_);return e.addMarkedTimespan(a)},e.unblockTime=function(n,o,_){var a=r(n,o=o||"fullday",_);return e.deleteMarkedTimespan(a)},e.checkInMarkedTimespan=function(n,o,_){o=o||t;for(var a=!0,d=new Date(n.start_date.valueOf()),l=e.date.add(d,1,"day"),c=e._marked_timespans;d<n.end_date;d=e.date.date_part(l),l=e.date.add(d,1,"day")){var f=+e.date.date_part(new Date(d)),m=s(n,c,d.getDay(),f,o);if(m)for(var p=0;p<m.length;p+=2){var h=e._get_zone_minutes(d),u=n.end_date>l||n.end_date.getDate()!=d.getDate()?1440:e._get_zone_minutes(n.end_date),v=m[p],y=m[p+1];if(v<u&&y>h&&!(a=typeof _=="function"&&_(n,h,u,v,y)))break}}return!a},e.checkLimitViolation=function(n){if(!n||!e.config.check_limits)return!0;var o=e,_=o.config,a=[];if(n.rec_type&&n._end_date||n.rrule){const m=n._end_date||n.end_date;return!_.limit_start||!_.limit_end||m.valueOf()>=_.limit_start.valueOf()&&n.start_date.valueOf()<=_.limit_end.valueOf()}a=[n];for(var d=!0,l=0;l<a.length;l++){var c=!0,f=a[l];f._timed=e.isOneDayEvent(f),(c=!_.limit_start||!_.limit_end||f.start_date.valueOf()>=_.limit_start.valueOf()&&f.end_date.valueOf()<=_.limit_end.valueOf())&&(c=!e.checkInMarkedTimespan(f,i,function(m,p,h,u,v){var y=!0;return p<=v&&p>=u&&((v==1440||h<=v)&&(y=!1),m._timed&&o._drag_id&&o._drag_mode=="new-size"?(m.start_date.setHours(0),m.start_date.setMinutes(v)):y=!1),(h>=u&&h<=v||p<u&&h>v)&&(m._timed&&o._drag_id&&o._drag_mode=="new-size"?(m.end_date.setHours(0),m.end_date.setMinutes(u)):y=!1),y})),c||(c=o.checkEvent("onLimitViolation")?o.callEvent("onLimitViolation",[f.id,f]):c),d=d&&c}return d||(o._drag_id=null,o._drag_mode=null),d},e._get_blocked_zones=function(n,o,_,a,d){var l=[];if(n&&n[o])for(var c=n[o],f=this._get_relevant_blocked_zones(_,a,c,d),m=0;m<f.length;m++)l=this._add_timespan_zones(l,f[m].zones);return l},e._get_relevant_blocked_zones=function(n,o,_,a){var d;return e.config.overwrite_marked_timespans?d=_[o]&&_[o][a]?_[o][a]:_[n]&&_[n][a]?_[n][a]:[]:(d=[],_[o]&&_[o][a]&&(d=d.concat(_[o][a])),_[n]&&_[n][a]&&(d=d.concat(_[n][a]))),d},e._mark_now=function(n){var o="dhx_now_time";this._els[o]||(this._els[o]=[]);var _=e._currentDate(),a=this.config;if(e._remove_mark_now(),!n&&a.mark_now&&_<this._max_date&&_>this._min_date&&_.getHours()>=a.first_hour&&_.getHours()<a.last_hour){var d=this.locate_holder_day(_);this._els[o]=e._append_mark_now(d,_)}},e._append_mark_now=function(n,o){var _="dhx_now_time",a=e._get_zone_minutes(o),d={zones:[a,a+1],css:_,type:_};if(!this._table_view){if(this._props&&this._props[this._mode]){var l,c,f=this._props[this._mode],m=f.size||f.options.length;f.days>1?(f.size&&f.options.length&&(n=(f.position+n)/f.options.length*f.size),l=n,c=n+m):c=(l=0)+m;for(var p=[],h=l;h<c;h++){var u=h;d.days=u;var v=e._render_marked_timespan(d,null,u)[0];p.push(v)}return p}return d.days=n,e._render_marked_timespan(d,null,n)}if(this._mode=="month")return d.days=+e.date.date_part(o),e._render_marked_timespan(d,null,null)},e._remove_mark_now=function(){for(var n="dhx_now_time",o=this._els[n],_=0;_<o.length;_++){var a=o[_],d=a.parentNode;d&&d.removeChild(a)}this._els[n]=[]},e._marked_timespans={global:{}},e._get_zone_minutes=function(n){return 60*n.getHours()+n.getMinutes()},e._prepare_timespan_options=function(n){var o=[],_=[];if(n.days=="fullweek"&&(n.days=[0,1,2,3,4,5,6]),n.days instanceof Array){for(var a=n.days.slice(),d=0;d<a.length;d++){var l=e._lame_clone(n);l.days=a[d],o.push.apply(o,e._prepare_timespan_options(l))}return o}if(!n||!(n.start_date&&n.end_date&&n.end_date>n.start_date||n.days!==void 0&&n.zones)&&!n.type)return o;n.zones=="fullday"&&(n.zones=[0,1440]),n.zones&&n.invert_zones&&(n.zones=e.invertZones(n.zones)),n.id=e.uid(),n.css=n.css||"",n.type=n.type||t;var c=n.sections;if(c){for(var f in c)if(c.hasOwnProperty(f)){var m=c[f];for(m instanceof Array||(m=[m]),d=0;d<m.length;d++)(D=e._lame_copy({},n)).sections={},D.sections[f]=m[d],_.push(D)}}else _.push(n);for(var p=0;p<_.length;p++){var h=_[p],u=h.start_date,v=h.end_date;if(u&&v)for(var y=e.date.date_part(new Date(u)),x=e.date.add(y,1,"day");y<v;){var D;delete(D=e._lame_copy({},h)).start_date,delete D.end_date,D.days=y.valueOf();var k=u>y?e._get_zone_minutes(u):0,S=v>x||v.getDate()!=y.getDate()?1440:e._get_zone_minutes(v);D.zones=[k,S],o.push(D),y=x,x=e.date.add(x,1,"day")}else h.days instanceof Date&&(h.days=e.date.date_part(h.days).valueOf()),h.zones=n.zones.slice(),o.push(h)}return o},e._get_dates_by_index=function(n,o,_){var a=[];o=e.date.date_part(new Date(o||e._min_date)),_=new Date(_||e._max_date);for(var d=o.getDay(),l=n-d>=0?n-d:7-o.getDay()+n,c=e.date.add(o,l,"day");c<_;c=e.date.add(c,1,"week"))a.push(c);return a},e._get_css_classes_by_config=function(n){var o=[];return n.type==i&&(o.push(i),n.css&&o.push(i+"_reset")),o.push("dhx_marked_timespan",n.css),o.join(" ")},e._get_block_by_config=function(n){var o=document.createElement("div");return n.html&&(typeof n.html=="string"?o.innerHTML=n.html:o.appendChild(n.html)),o},e._render_marked_timespan=function(n,o,_){var a=[],d=e.config,l=this._min_date,c=this._max_date,f=!1;if(!d.display_marked_timespans)return a;if(!_&&_!==0){if(n.days<7)_=n.days;else{var m=new Date(n.days);if(f=+m,!(+c>+m&&+l<=+m))return a;_=m.getDay()}var p=l.getDay();p>_?_=7-(p-_):_-=p}var h=n.zones,u=e._get_css_classes_by_config(n);if(e._table_view&&e._mode=="month"){var v=[],y=[];if(o)v.push(o),y.push(_);else{y=f?[f]:e._get_dates_by_index(_);for(var x=0;x<y.length;x++)v.push(this._scales[y[x]])}for(x=0;x<v.length;x++){o=v[x],_=y[x];var D=this.locate_holder_day(_,!1)%this._cols.length;if(!this._ignores[D]){var k=e._get_block_by_config(n);k.className=u,k.style.top="0px",k.style.height="100%";for(var S=0;S<h.length;S+=2){var M=h[x];if((E=h[x+1])<=M)return[];(N=k.cloneNode(!0)).style.left="0px",N.style.width="100%",o.appendChild(N),a.push(N)}}}}else{var g=_;if(this._ignores[this.locate_holder_day(_,!1)])return a;if(this._props&&this._props[this._mode]&&n.sections&&n.sections[this._mode]){var b=this._props[this._mode];g=b.order[n.sections[this._mode]];var w=b.order[n.sections[this._mode]];b.days>1?g=g*(b.size||b.options.length)+w:(g=w,b.size&&g>b.position+b.size&&(g=0))}for(o=o||e.locate_holder(g),x=0;x<h.length;x+=2){var E,N;if(M=Math.max(h[x],60*d.first_hour),(E=Math.min(h[x+1],60*d.last_hour))<=M){if(x+2<h.length)continue;return[]}(N=e._get_block_by_config(n)).className=u;var T=24*this.config.hour_size_px+1,A=36e5;N.style.top=Math.round((60*M*1e3-this.config.first_hour*A)*this.config.hour_size_px/A)%T+"px",N.style.height=Math.max(Math.round(60*(E-M)*1e3*this.config.hour_size_px/A)%T,1)+"px",o.appendChild(N),a.push(N)}}return a},e._mark_timespans=function(){var n=this._els.dhx_cal_data[0],o=[];if(e._table_view&&e._mode=="month")for(var _ in this._scales){var a=new Date(+_);o.push.apply(o,e._on_scale_add_marker(this._scales[_],a))}else{a=new Date(e._min_date);for(var d=0,l=n.childNodes.length;d<l;d++){var c=n.childNodes[d];c.firstChild&&e._getClassName(c.firstChild).indexOf("dhx_scale_hour")>-1||(o.push.apply(o,e._on_scale_add_marker(c,a)),a=e.date.add(a,1,"day"))}}return o},e.markTimespan=function(n){if(!this._els)throw new Error("`scheduler.markTimespan` can't be used before scheduler initialization. Place `scheduler.markTimespan` call after `scheduler.init`.");var o=!1;this._els.dhx_cal_data||(e.get_elements(),o=!0);var _=e._marked_timespans_ids,a=e._marked_timespans_types,d=e._marked_timespans;e.deleteMarkedTimespan(),e.addMarkedTimespan(n);var l=e._mark_timespans();return o&&(e._els=[]),e._marked_timespans_ids=_,e._marked_timespans_types=a,e._marked_timespans=d,l},e.unmarkTimespan=function(n){if(n)for(var o=0;o<n.length;o++){var _=n[o];_.parentNode&&_.parentNode.removeChild(_)}},e._addMarkerTimespanConfig=function(n){var o="global",_=e._marked_timespans,a=n.id,d=e._marked_timespans_ids;d[a]||(d[a]=[]);var l=n.days,c=n.sections,f=n.type;if(n.id=a,c){for(var m in c)if(c.hasOwnProperty(m)){_[m]||(_[m]={});var p=c[m],h=_[m];h[p]||(h[p]={}),h[p][l]||(h[p][l]={}),h[p][l][f]||(h[p][l][f]=[],e._marked_timespans_types||(e._marked_timespans_types={}),e._marked_timespans_types[f]||(e._marked_timespans_types[f]=!0));var u=h[p][l][f];n._array=u,u.push(n),d[a].push(n)}}else _[o][l]||(_[o][l]={}),_[o][l][f]||(_[o][l][f]=[]),e._marked_timespans_types||(e._marked_timespans_types={}),e._marked_timespans_types[f]||(e._marked_timespans_types[f]=!0),u=_[o][l][f],n._array=u,u.push(n),d[a].push(n)},e._marked_timespans_ids={},e.addMarkedTimespan=function(n){var o=e._prepare_timespan_options(n);if(o.length){for(var _=o[0].id,a=0;a<o.length;a++)e._addMarkerTimespanConfig(o[a]);return _}},e._add_timespan_zones=function(n,o){var _=n.slice();if(o=o.slice(),!_.length)return o;for(var a=0;a<_.length;a+=2)for(var d=_[a],l=_[a+1],c=a+2==_.length,f=0;f<o.length;f+=2){var m=o[f],p=o[f+1];if(p>l&&m<=l||m<d&&p>=d)_[a]=Math.min(d,m),_[a+1]=Math.max(l,p),a-=2;else{if(!c)continue;var h=d>m?0:2;_.splice(a+h,0,m,p)}o.splice(f--,2);break}return _},e._subtract_timespan_zones=function(n,o){for(var _=n.slice(),a=0;a<_.length;a+=2)for(var d=_[a],l=_[a+1],c=0;c<o.length;c+=2){var f=o[c],m=o[c+1];if(m>d&&f<l){var p=!1;d>=f&&l<=m&&_.splice(a,2),d<f&&(_.splice(a,2,d,f),p=!0),l>m&&_.splice(p?a+2:a,p?0:2,m,l),a-=2;break}}return _},e.invertZones=function(n){return e._subtract_timespan_zones([0,1440],n.slice())},e._delete_marked_timespan_by_id=function(n){var o=e._marked_timespans_ids[n];if(o){for(var _=0;_<o.length;_++)for(var a=o[_],d=a._array,l=0;l<d.length;l++)if(d[l]==a){d.splice(l,1);break}}},e._delete_marked_timespan_by_config=function(n){var o,_=e._marked_timespans,a=n.sections,d=n.days,l=n.type||t;if(a){for(var c in a)if(a.hasOwnProperty(c)&&_[c]){var f=a[c];_[c][f]&&(o=_[c][f])}}else o=_.global;if(o){if(d!==void 0)o[d]&&o[d][l]&&(e._addMarkerTimespanConfig(n),e._delete_marked_timespans_list(o[d][l],n));else for(var m in o)if(o[m][l]){var p=e._lame_clone(n);n.days=m,e._addMarkerTimespanConfig(p),e._delete_marked_timespans_list(o[m][l],n)}}},e._delete_marked_timespans_list=function(n,o){for(var _=0;_<n.length;_++){var a=n[_],d=e._subtract_timespan_zones(a.zones,o.zones);if(d.length)a.zones=d;else{n.splice(_,1),_--;for(var l=e._marked_timespans_ids[a.id],c=0;c<l.length;c++)if(l[c]==a){l.splice(c,1);break}}}},e.deleteMarkedTimespan=function(n){if(arguments.length||(e._marked_timespans={global:{}},e._marked_timespans_ids={},e._marked_timespans_types={}),typeof n!="object")e._delete_marked_timespan_by_id(n);else{n.start_date&&n.end_date||(n.days!==void 0||n.type||(n.days="fullweek"),n.zones||(n.zones="fullday"));var o=[];if(n.type)o.push(n.type);else for(var _ in e._marked_timespans_types)o.push(_);for(var a=e._prepare_timespan_options(n),d=0;d<a.length;d++)for(var l=a[d],c=0;c<o.length;c++){var f=e._lame_clone(l);f.type=o[c],e._delete_marked_timespan_by_config(f)}}},e._get_types_to_render=function(n,o){var _=n?e._lame_copy({},n):{};for(var a in o||{})o.hasOwnProperty(a)&&(_[a]=o[a]);return _},e._get_configs_to_render=function(n){var o=[];for(var _ in n)n.hasOwnProperty(_)&&o.push.apply(o,n[_]);return o},e._on_scale_add_marker=function(n,o){if(!e._table_view||e._mode=="month"){var _=o.getDay(),a=o.valueOf(),d=this._mode,l=e._marked_timespans,c=[],f=[];if(this._props&&this._props[d]){var m=this._props[d],p=m.options,h=p[e._get_unit_index(m,o)];if(m.days>1){var u=Math.round((o-e._min_date)/864e5),v=m.size||p.length;o=e.date.add(e._min_date,Math.floor(u/v),"day"),o=e.date.date_part(o)}else o=e.date.date_part(new Date(this._date));if(_=o.getDay(),a=o.valueOf(),l[d]&&l[d][h.key]){var y=l[d][h.key],x=e._get_types_to_render(y[_],y[a]);c.push.apply(c,e._get_configs_to_render(x))}}var D=l.global;if(e.config.overwrite_marked_timespans){var k=D[a]||D[_];c.push.apply(c,e._get_configs_to_render(k))}else D[a]&&c.push.apply(c,e._get_configs_to_render(D[a])),D[_]&&c.push.apply(c,e._get_configs_to_render(D[_]));for(var S=0;S<c.length;S++)f.push.apply(f,e._render_marked_timespan(c[S],n,o));return f}},e.attachEvent("onScaleAdd",function(){e._on_scale_add_marker.apply(e,arguments)}),e.dblclick_dhx_marked_timespan=function(n,o){e.callEvent("onScaleDblClick",[e.getActionData(n).date,o,n]),e.config.dblclick_create&&e.addEventNow(e.getActionData(n).date,null,n)}}function Tt(e){var i={},t=!1;function r(a,d){d=typeof d=="function"?d:function(){},i[a]||(i[a]=this[a],this[a]=d)}function s(a){i[a]&&(this[a]=i[a],i[a]=null)}function n(a){for(var d in a)r.call(this,d,a[d])}function o(){for(var a in i)s.call(this,a)}function _(a){try{a()}catch(d){window.console.error(d)}}return e.$stateProvider.registerProvider("batchUpdate",function(){return{batch_update:t}},!1),function(a,d){if(t)return void _(a);var l,c=this._dp&&this._dp.updateMode!="off";c&&(l=this._dp.updateMode,this._dp.setUpdateMode("off"));const f={setModeDate:{date:null,mode:null},needRender:!1,needUpdateView:!1,repaintEvents:{}},m=(h,u)=>{h&&(f.setModeDate.date=h),u&&(f.setModeDate.mode=u)};var p={render:(h,u)=>{f.needRender=!0,m(h,u)},setCurrentView:(h,u)=>{f.needRender=!0,m(h,u)},updateView:(h,u)=>{f.needUpdateView=!0,m(h,u)},render_data:()=>f.needRender=!0,render_view_data:h=>{h&&h.length?h.forEach(u=>f.repaintEvents[u.id]=!0):f.needRender=!0}};if(n.call(this,p),t=!0,this.callEvent("onBeforeBatchUpdate",[]),_(a),this.callEvent("onAfterBatchUpdate",[]),o.call(this),t=!1,!d)if(f.needRender)e.render(f.setModeDate.date,f.setModeDate.mode);else if(f.needUpdateView)e.updateView(f.setModeDate.date,f.setModeDate.mode);else for(const h in f.repaintEvents)e.updateEvent(h);c&&(this._dp.setUpdateMode(l),this._dp.sendData())}}class At{constructor(i){const{url:t,token:r}=i;this._url=t,this._token=r,this._mode=1,this._seed=1,this._queue=[],this.data={},this.api={},this._events={}}headers(){return{Accept:"application/json","Content-Type":"application/json","Remote-Token":this._token}}fetch(i,t){const r={credentials:"include",headers:this.headers()};return t&&(r.method="POST",r.body=t),fetch(i,r).then(s=>s.json())}load(i){return i&&(this._url=i),this.fetch(this._url).then(t=>this.parse(t))}parse(i){const{key:t,websocket:r}=i;t&&(this._token=i.key);for(const s in i.data)this.data[s]=i.data[s];for(const s in i.api){const n=this.api[s]={},o=i.api[s];for(const _ in o)n[_]=this._wrapper(s+"."+_)}return r&&this.connect(),this}connect(){const i=this._socket;i&&(this._socket=null,i.onclose=function(){},i.close()),this._mode=2,this._socket=function(t,r,s,n){let o=r;o[0]==="/"&&(o=document.location.protocol+"//"+document.location.host+r),o=o.replace(/^http(s|):/,"ws$1:");const _=o.indexOf("?")!=-1?"&":"?";o=`${o}${_}token=${s}&ws=1`;const a=new WebSocket(o);return a.onclose=()=>setTimeout(()=>t.connect(),2e3),a.onmessage=d=>{const l=JSON.parse(d.data);switch(l.action){case"result":t.result(l.body,[]);break;case"event":t.fire(l.body.name,l.body.value);break;case"start":n();break;default:t.onError(l.data)}},a}(this,this._url,this._token,()=>(this._mode=3,this._send(),this._resubscribe(),this))}_wrapper(i){return(function(){const t=[].slice.call(arguments);let r=null;const s=new Promise((n,o)=>{r={data:{id:this._uid(),name:i,args:t},status:1,resolve:n,reject:o},this._queue.push(r)});return this.onCall(r,s),this._mode===3?this._send(r):setTimeout(()=>this._send(),1),s}).bind(this)}_uid(){return(this._seed++).toString()}_send(i){if(this._mode==2)return void setTimeout(()=>this._send(),100);const t=i?[i]:this._queue.filter(s=>s.status===1);if(!t.length)return;const r=t.map(s=>(s.status=2,s.data));this._mode!==3?this.fetch(this._url,JSON.stringify(r)).catch(s=>this.onError(s)).then(s=>this.result(s,r)):this._socket.send(JSON.stringify({action:"call",body:r}))}result(i,t){const r={};if(i)for(let s=0;s<i.length;s++)r[i[s].id]=i[s];else for(let s=0;s<t.length;s++)r[t[s].id]={id:t[s].id,error:"Network Error",data:null};for(let s=this._queue.length-1;s>=0;s--){const n=this._queue[s],o=r[n.data.id];o&&(this.onResponse(n,o),o.error?n.reject(o.error):n.resolve(o.data),this._queue.splice(s,1))}}on(i,t){const r=this._uid();let s=this._events[i];const n=!!s;return n||(s=this._events[i]=[]),s.push({id:r,handler:t}),n||this._mode!=3||this._socket.send(JSON.stringify({action:"subscribe",name:i})),{name:i,id:r}}_resubscribe(){if(this._mode==3)for(const i in this._events)this._socket.send(JSON.stringify({action:"subscribe",name:i}))}detach(i){if(!i){if(this._mode==3)for(const n in this._events)this._socket.send(JSON.stringify({action:"unsubscribe",key:n}));return void(this._events={})}const{id:t,name:r}=i,s=this._events[r];if(s){const n=s.filter(o=>o.id!=t);n.length?this._events[r]=n:(delete this._events[r],this._mode==3&&this._socket.send(JSON.stringify({action:"unsubscribe",name:r})))}}fire(i,t){const r=this._events[i];if(r)for(let s=0;s<r.length;s++)r[s].handler(t)}onError(i){return null}onCall(i,t){}onResponse(i,t){}}class Ct{constructor(i,t){const r=new At({url:i,token:t});r.fetch=function(s,n){const o={headers:this.headers()};return n&&(o.method="POST",o.body=n),fetch(s,o).then(_=>_.json())},this._ready=r.load().then(s=>this._remote=s)}ready(){return this._ready}on(i,t){this.ready().then(r=>{if(typeof i=="string")r.on(i,t);else for(const s in i)r.on(s,i[s])})}}function Ot(e){function i(r,s){switch(r){case"add-event":(function(n){if(e.getEvent(n.id))return void console.warn(`Event with ID ${n.id} already exists. Skipping add.`);n.start_date=e.templates.parse_date(n.start_date),n.end_date=e.templates.parse_date(n.end_date),n.original_start&&(n.original_start=e.templates.parse_date(n.original_start)),t(()=>{e.addEvent(n)})})(s);break;case"update-event":(function(n){const o=n.id;if(!e.getEvent(o))return void console.warn(`Event with ID ${o} does not exist. Skipping update.`);const _=e.getEvent(o);t(()=>{for(let a in n)a!=="start_date"&&a!=="end_date"&&(_[a]=n[a]);_.start_date=e.templates.parse_date(n.start_date),_.end_date=e.templates.parse_date(n.end_date),n.original_start&&(n.original_start=e.templates.parse_date(n.original_start)),e.callEvent("onEventChanged",[o,_]),e.updateEvent(o),o!==n.id&&e.changeEventId(o,n.id)})})(s);break;case"delete-event":(function(n){const o=n.id;if(!e.getEvent(o))return void(n.event_pid&&t(()=>{e.addEvent(n)}));t(()=>{const _=e.getEvent(o);if(_){if(_.rec_type||_.rrule){e._roll_back_dates(_);const a=e._get_rec_markers(o);for(const d in a)e.getEvent(d)&&e.deleteEvent(d,!0)}if(e.getState().lightbox_id==o&&(this._new_event=this._lightbox_id,n.id=this._lightbox_id,this._events[this._lightbox_id]=n,e.callEvent("onLiveUpdateCollision",[o,null,"delete",n])===!1))return void e.endLightbox(!1,e._lightbox);e.deleteEvent(o,!0)}})})(s)}}function t(r){e._dp?e._dp.ignore(r):r()}return{events:function(r){if(!r||!r.event||!r.event.id)return void console.error("Invalid message format:",r);const{type:s,event:n}=r;if(!e._dp._in_progress[n.id]){if(s==="add-event"){for(const o in e._dp._in_progress)if(e._dp.getState(o)==="inserted")return void e._dp.attachEvent("onFullSync",function(){e.getEvent(n.id)||i(s,n)},{once:!0})}i(s,n)}}}}function Lt(e){(function(i){const t={};i.attachEvent("onConfirmedBeforeEventDelete",function(r){return t[r]=!0,!0}),i.attachEvent("onEventDeleted",function(r,s){if(!t[r])return;delete t[r];let n=i.copy(s);i.config.undo_deleted&&!i.getState().new_event&&i.message({text:`<div class="dhx_info_message">
<span class="undo_popup_text">Event deleted</span>
<button class="undo_button" data-deleted-event-id="${s.id}">Undo</button>
</div>`,expire:1e4,type:"popup_after_delete",callback:function(o){o.target.closest(`[data-deleted-event-id="${s.id}"]`)&&(n.rrule&&n.duration&&(n.end_date=new Date(n.start_date.valueOf()+1e3*n.duration),i.addEvent(n)),i.addEvent(n),i.render())}})})})(e),Mt(e),Nt(e),function(i){i.batchUpdate=Tt(i)}(e),function(i){i.ext||(i.ext={}),i.ext.liveUpdates={RemoteEvents:Ct,remoteUpdates:Ot(i)}}(e)}var $t=Date.now();function Ce(e){return!(!e||typeof e!="object")&&!!(e.getFullYear&&e.getMonth&&e.getDate)}const ne={uid:function(){return $t++},mixin:function(e,i,t){for(var r in i)(e[r]===void 0||t)&&(e[r]=i[r]);return e},copy:function e(i){var t,r,s;if(i&&typeof i=="object")switch(!0){case Ce(i):r=new Date(i);break;case(s=i,Array.isArray?Array.isArray(s):s&&s.length!==void 0&&s.pop&&s.push):for(r=new Array(i.length),t=0;t<i.length;t++)r[t]=e(i[t]);break;case function(n){return n&&typeof n=="object"&&Function.prototype.toString.call(n.constructor)==="function String() { [native code] }"}(i):r=new String(i);break;case function(n){return n&&typeof n=="object"&&Function.prototype.toString.call(n.constructor)==="function Number() { [native code] }"}(i):r=new Number(i);break;case function(n){return n&&typeof n=="object"&&Function.prototype.toString.call(n.constructor)==="function Boolean() { [native code] }"}(i):r=new Boolean(i);break;default:for(t in r={},i){const n=typeof i[t];n==="string"||n==="number"||n==="boolean"?r[t]=i[t]:Ce(i[t])?r[t]=new Date(i[t]):Object.prototype.hasOwnProperty.apply(i,[t])&&(r[t]=e(i[t]))}}return r||i},defined:function(e){return e!==void 0},isDate:Ce,delay:function(e,i){var t,r=function(){r.$cancelTimeout(),r.$pending=!0;var s=Array.prototype.slice.call(arguments);t=setTimeout(function(){e.apply(this,s),r.$pending=!1},i)};return r.$pending=!1,r.$cancelTimeout=function(){clearTimeout(t),r.$pending=!1},r.$execute=function(){var s=Array.prototype.slice.call(arguments);e.apply(this,s),r.$cancelTimeout()},r}};function Ht(e){function i(p){var h=document.createElement("div");return(p||"").split(" ").forEach(function(u){h.classList.add(u)}),h}var t=function(){return i("dhx_cal_navbar_rows_container")},r=function(){return i("dhx_cal_navbar_row")},s=function(p){var h=i("dhx_cal_tab");return h.setAttribute("name",p.view+"_tab"),h.setAttribute("data-tab",p.view),e.config.fix_tab_position&&(p.$firstTab?h.classList.add("dhx_cal_tab_first"):p.$lastTab?h.classList.add("dhx_cal_tab_last"):p.view!=="week"&&h.classList.add("dhx_cal_tab_standalone"),p.$segmentedTab&&h.classList.add("dhx_cal_tab_segmented")),h},n=function(){return i("dhx_cal_date")},o=function(p){return i("dhx_cal_nav_button dhx_cal_nav_button_custom dhx_cal_tab")},_=function(p){return i("dhx_cal_"+p.view+"_button dhx_cal_nav_button")},a=function(){return i("dhx_cal_line_spacer")},d=function(p){var h=i("dhx_minical_icon");return p.click||h.$_eventAttached||e.event(h,"click",function(){e.isCalendarVisible()?e.destroyCalendar():e.renderCalendar({position:this,date:e.getState().date,navigation:!0,handler:function(u,v){e.setCurrentView(u),e.destroyCalendar()}})}),h};function l(p){var h=function(y){var x;if(y.view)switch(y.view){case"today":case"next":case"prev":x=_;break;case"date":x=n;break;case"spacer":x=a;break;case"button":x=o;break;case"minicalendar":x=d;break;default:x=s}else y.rows?x=t:y.cols&&(x=r);return x}(p);if(h){var u=h(p);if(p.css&&u.classList.add(p.css),p.width&&((v=p.width)===1*v&&(v+="px"),u.style.width=v),p.height&&((v=p.height)===1*v&&(v+="px"),u.style.height=v),p.click&&e.event(u,"click",p.click),p.html&&(u.innerHTML=p.html),p.align){var v="";p.align=="right"?v="flex-end":p.align=="left"&&(v="flex-start"),u.style.justifyContent=v}return u}}function c(p){return typeof p=="string"&&(p={view:p}),p.view||p.rows||p.cols||(p.view="button"),p}function f(p){var h,u=document.createDocumentFragment();h=Array.isArray(p)?p:[p];for(var v=0;v<h.length;v++){var y,x=c(h[v]);x.view==="day"&&h[v+1]&&((y=c(h[v+1])).view!=="week"&&y.view!=="month"||(x.$firstTab=!0,x.$segmentedTab=!0)),x.view==="week"&&h[v-1]&&((y=c(h[v+1])).view!=="week"&&y.view!=="month"||(x.$segmentedTab=!0)),x.view==="month"&&h[v-1]&&((y=c(h[v-1])).view!=="week"&&y.view!=="day"||(x.$lastTab=!0,x.$segmentedTab=!0));var D=l(x);u.appendChild(D),(x.cols||x.rows)&&D.appendChild(f(x.cols||x.rows))}return u}e._init_nav_bar=function(p){var h=this.$container.querySelector(".dhx_cal_navline");return h||((h=document.createElement("div")).className="dhx_cal_navline dhx_cal_navline_flex",e._update_nav_bar(p,h),h)};var m=null;e._update_nav_bar=function(p,h){if(p){var u=!1,v=p.height||e.xy.nav_height;m!==null&&m===v||(u=!0),u&&(e.xy.nav_height=v),h.innerHTML="",h.appendChild(f(p)),e.unset_actions(),e._els=[],e.get_elements(),e.set_actions(),h.style.display=v===0?"none":"",m=v}}}function zt(e){function i(n){return n.isConnected!==void 0?n.isConnected:document.body.contains(n)}function t(n){return{w:n.innerWidth||document.documentElement.clientWidth,h:n.innerHeight||document.documentElement.clientHeight}}function r(n,o){var _,a=t(o);n.event(o,"resize",function(){clearTimeout(_),_=setTimeout(function(){if(i(n.$container)&&!n.$destroyed){var d,l,c=t(o);l=c,((d=a).w!=l.w||d.h!=l.h)&&(a=c,s(n))}},150)})}function s(n){n.$initialized&&!n.$destroyed&&n.$root&&i(n.$root)&&n.callEvent("onSchedulerResize",[])&&(n.updateView(),n.callEvent("onAfterSchedulerResize",[]))}(function(n){var o=n.$container;if(window.getComputedStyle(o).getPropertyValue("position")=="static"&&(o.style.position="relative"),window.ResizeObserver){let a=!0;const d=new ResizeObserver(function(l){a?a=!1:s(n)});d.observe(o),n.attachEvent("onDestroy",function(){d.unobserve(o)})}else{var _=document.createElement("iframe");_.className="scheduler_container_resize_watcher",_.tabIndex=-1,n.config.wai_aria_attributes&&(_.setAttribute("role","none"),_.setAttribute("aria-hidden",!0)),window.Sfdc||window.$A||window.Aura?function(a){var d=a.$root.offsetHeight,l=a.$root.offsetWidth;(function c(){a.$destroyed||(a.$root&&(a.$root.offsetHeight==d&&a.$root.offsetWidth==l||s(a),d=a.$root.offsetHeight,l=a.$root.offsetWidth),setTimeout(c,200))})()}(n):(o.appendChild(_),_.contentWindow?r(n,_.contentWindow):(o.removeChild(_),r(n,window)))}})(e)}class qt{constructor(){this._silent_mode=!1,this.listeners={}}_silentStart(){this._silent_mode=!0}_silentEnd(){this._silent_mode=!1}}function Oe(e){const i=new qt;e.attachEvent=function(t,r,s){t="ev_"+t.toLowerCase(),i.listeners[t]||(i.listeners[t]=function(o){let _={},a=0;const d=function(){let l=!0;for(const c in _){const f=_[c].apply(o,arguments);l=l&&f}return l};return d.addEvent=function(l,c){if(typeof l=="function"){let f;if(c&&c.id?f=c.id:(f=a,a++),c&&c.once){const m=l;l=function(){m(),d.removeEvent(f)}}return _[f]=l,f}return!1},d.removeEvent=function(l){delete _[l]},d.clear=function(){_={}},d}(this)),s&&s.thisObject&&(r=r.bind(s.thisObject));let n=t+":"+i.listeners[t].addEvent(r,s);return s&&s.id&&(n=s.id),n},e.attachAll=function(t){this.attachEvent("listen_all",t)},e.callEvent=function(t,r){if(i._silent_mode)return!0;const s="ev_"+t.toLowerCase(),n=i.listeners;return n.ev_listen_all&&n.ev_listen_all.apply(this,[t].concat(r)),!n[s]||n[s].apply(this,r)},e.checkEvent=function(t){return!!i.listeners["ev_"+t.toLowerCase()]},e.detachEvent=function(t){if(t){let r=i.listeners;for(const n in r)r[n].removeEvent(t);const s=t.split(":");if(r=i.listeners,s.length===2){const n=s[0],o=s[1];r[n]&&r[n].removeEvent(o)}}},e.detachAllEvents=function(){for(const t in i.listeners)i.listeners[t].clear()}}const Xe={event:function(e,i,t){e.addEventListener?e.addEventListener(i,t,!1):e.attachEvent&&e.attachEvent("on"+i,t)},eventRemove:function(e,i,t){e.removeEventListener?e.removeEventListener(i,t,!1):e.detachEvent&&e.detachEvent("on"+i,t)}};function jt(e){var i=function(){var t=function(r,s){r=r||Xe.event,s=s||Xe.eventRemove;var n=[],o={attach:function(_,a,d,l){n.push({element:_,event:a,callback:d,capture:l}),r(_,a,d,l)},detach:function(_,a,d,l){s(_,a,d,l);for(var c=0;c<n.length;c++){var f=n[c];f.element===_&&f.event===a&&f.callback===d&&f.capture===l&&(n.splice(c,1),c--)}},detachAll:function(){for(var _=n.slice(),a=0;a<_.length;a++){var d=_[a];o.detach(d.element,d.event,d.callback,d.capture),o.detach(d.element,d.event,d.callback,void 0),o.detach(d.element,d.event,d.callback,!1),o.detach(d.element,d.event,d.callback,!0)}n.splice(0,n.length)},extend:function(){return t(this.event,this.eventRemove)}};return o};return t()}();e.event=i.attach,e.eventRemove=i.detach,e._eventRemoveAll=i.detachAll,e._createDomEventScope=i.extend,e._trim=function(t){return(String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")}).apply(t)},e._isDate=function(t){return!(!t||typeof t!="object")&&!!(t.getFullYear&&t.getMonth&&t.getDate)},e._isObject=function(t){return t&&typeof t=="object"}}function Ze(e){if(!e)return"";var i=e.className||"";return i.baseVal&&(i=i.baseVal),i.indexOf||(i=""),i||""}function Qe(e,i,t){t===void 0&&(t=!0);for(var r=e.target||e.srcElement,s="";r;){if(s=Ze(r)){var n=s.indexOf(i);if(n>=0){if(!t)return r;var o=n===0||!(s.charAt(n-1)||"").trim(),_=n+i.length>=s.length||!s.charAt(n+i.length).trim();if(o&&_)return r}}r=r.parentNode}return null}function Rt(e){var i=!1,t=!1;if(window.getComputedStyle){var r=window.getComputedStyle(e,null);i=r.display,t=r.visibility}else e.currentStyle&&(i=e.currentStyle.display,t=e.currentStyle.visibility);var s=!1,n=Qe({target:e},"dhx_form_repeat",!1);return n&&(s=n.style.height=="0px"),s=s||!e.offsetHeight,i!="none"&&t!="hidden"&&!s}function It(e){return!isNaN(e.getAttribute("tabindex"))&&1*e.getAttribute("tabindex")>=0}function Pt(e){return!{a:!0,area:!0}[e.nodeName.loLowerCase()]||!!e.getAttribute("href")}function Ut(e){return!{input:!0,select:!0,textarea:!0,button:!0,object:!0}[e.nodeName.toLowerCase()]||!e.hasAttribute("disabled")}function et(){return document.head.createShadowRoot||document.head.attachShadow}function tt(e){if(!e||!et())return document.body;for(;e.parentNode&&(e=e.parentNode);)if(e instanceof ShadowRoot)return e.host;return document.body}const ce={getAbsoluteLeft:function(e){return this.getOffset(e).left},getAbsoluteTop:function(e){return this.getOffset(e).top},getOffsetSum:function(e){for(var i=0,t=0;e;)i+=parseInt(e.offsetTop),t+=parseInt(e.offsetLeft),e=e.offsetParent;return{top:i,left:t}},getOffsetRect:function(e){var i=e.getBoundingClientRect(),t=0,r=0;if(/Mobi/.test(navigator.userAgent)){var s=document.createElement("div");s.style.position="absolute",s.style.left="0px",s.style.top="0px",s.style.width="1px",s.style.height="1px",document.body.appendChild(s);var n=s.getBoundingClientRect();t=i.top-n.top,r=i.left-n.left,s.parentNode.removeChild(s)}else{var o=document.body,_=document.documentElement,a=window.pageYOffset||_.scrollTop||o.scrollTop,d=window.pageXOffset||_.scrollLeft||o.scrollLeft,l=_.clientTop||o.clientTop||0,c=_.clientLeft||o.clientLeft||0;t=i.top+a-l,r=i.left+d-c}return{top:Math.round(t),left:Math.round(r)}},getOffset:function(e){return e.getBoundingClientRect?this.getOffsetRect(e):this.getOffsetSum(e)},closest:function(e,i){return e&&i?Le(e,i):null},insertAfter:function(e,i){i.nextSibling?i.parentNode.insertBefore(e,i.nextSibling):i.parentNode.appendChild(e)},remove:function(e){e&&e.parentNode&&e.parentNode.removeChild(e)},isChildOf:function(e,i){return i.contains(e)},getFocusableNodes:function(e){for(var i=e.querySelectorAll(["a[href]","area[href]","input","select","textarea","button","iframe","object","embed","[tabindex]","[contenteditable]"].join(", ")),t=Array.prototype.slice.call(i,0),r=0;r<t.length;r++)t[r].$position=r;for(t.sort(function(n,o){return n.tabIndex===0&&o.tabIndex!==0?1:n.tabIndex!==0&&o.tabIndex===0?-1:n.tabIndex===o.tabIndex?n.$position-o.$position:n.tabIndex<o.tabIndex?-1:1}),r=0;r<t.length;r++){var s=t[r];(It(s)||Ut(s)||Pt(s))&&Rt(s)||(t.splice(r,1),r--)}return t},getClassName:Ze,locateCss:Qe,getRootNode:tt,hasShadowParent:function(e){return!!tt(e)},isShadowDomSupported:et,getActiveElement:function(){var e=document.activeElement;return e.shadowRoot&&(e=e.shadowRoot.activeElement),e===document.body&&document.getSelection&&(e=document.getSelection().focusNode||document.body),e},getRelativeEventPosition:function(e,i){var t=document.documentElement,r=function(s){var n=0,o=0,_=0,a=0;if(s.getBoundingClientRect){var d=s.getBoundingClientRect(),l=document.body,c=document.documentElement||document.body.parentNode||document.body,f=window.pageYOffset||c.scrollTop||l.scrollTop,m=window.pageXOffset||c.scrollLeft||l.scrollLeft,p=c.clientTop||l.clientTop||0,h=c.clientLeft||l.clientLeft||0;n=d.top+f-p,o=d.left+m-h,_=document.body.offsetWidth-d.right,a=document.body.offsetHeight-d.bottom}else{for(;s;)n+=parseInt(s.offsetTop,10),o+=parseInt(s.offsetLeft,10),s=s.offsetParent;_=document.body.offsetWidth-s.offsetWidth-o,a=document.body.offsetHeight-s.offsetHeight-n}return{y:Math.round(n),x:Math.round(o),width:s.offsetWidth,height:s.offsetHeight,right:Math.round(_),bottom:Math.round(a)}}(i);return{x:e.clientX-t.clientLeft-r.x+i.scrollLeft,y:e.clientY-t.clientTop-r.y+i.scrollTop}},getTargetNode:function(e){var i;return e.tagName?i=e:(i=(e=e||window.event).target||e.srcElement).shadowRoot&&e.composedPath&&(i=e.composedPath()[0]),i},getNodePosition:function(e){var i=0,t=0,r=0,s=0;if(e.getBoundingClientRect){var n=e.getBoundingClientRect(),o=document.body,_=document.documentElement||document.body.parentNode||document.body,a=window.pageYOffset||_.scrollTop||o.scrollTop,d=window.pageXOffset||_.scrollLeft||o.scrollLeft,l=_.clientTop||o.clientTop||0,c=_.clientLeft||o.clientLeft||0;i=n.top+a-l,t=n.left+d-c,r=document.body.offsetWidth-n.right,s=document.body.offsetHeight-n.bottom}else{for(;e;)i+=parseInt(e.offsetTop,10),t+=parseInt(e.offsetLeft,10),e=e.offsetParent;r=document.body.offsetWidth-e.offsetWidth-t,s=document.body.offsetHeight-e.offsetHeight-i}return{y:Math.round(i),x:Math.round(t),width:e.offsetWidth,height:e.offsetHeight,right:Math.round(r),bottom:Math.round(s)}}};var Le;if(Element.prototype.closest)Le=function(e,i){return e.closest(i)};else{var Yt=Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector;Le=function(e,i){var t=e;do{if(Yt.call(t,i))return t;t=t.parentElement||t.parentNode}while(t!==null&&t.nodeType===1);return null}}var he=typeof window<"u";const Vt={isIE:he&&(navigator.userAgent.indexOf("MSIE")>=0||navigator.userAgent.indexOf("Trident")>=0),isOpera:he&&navigator.userAgent.indexOf("Opera")>=0,isChrome:he&&navigator.userAgent.indexOf("Chrome")>=0,isKHTML:he&&(navigator.userAgent.indexOf("Safari")>=0||navigator.userAgent.indexOf("Konqueror")>=0),isFF:he&&navigator.userAgent.indexOf("Firefox")>=0,isIPad:he&&navigator.userAgent.search(/iPad/gi)>=0,isEdge:he&&navigator.userAgent.indexOf("Edge")!=-1,isNode:!he||typeof navigator>"u"};function $e(e){if(typeof e=="string"||typeof e=="number")return e;var i="";for(var t in e){var r="";e.hasOwnProperty(t)&&(r=t+"="+(r=typeof e[t]=="string"?encodeURIComponent(e[t]):typeof e[t]=="number"?e[t]:encodeURIComponent(JSON.stringify(e[t]))),i.length&&(r="&"+r),i+=r)}return i}function Ft(e){var i=function(n,o){for(var _="var temp=date.match(/[a-zA-Z]+|[0-9]+/g);",a=n.match(/%[a-zA-Z]/g),d=0;d<a.length;d++)switch(a[d]){case"%j":case"%d":_+="set[2]=temp["+d+"]||1;";break;case"%n":case"%m":_+="set[1]=(temp["+d+"]||1)-1;";break;case"%y":_+="set[0]=temp["+d+"]*1+(temp["+d+"]>50?1900:2000);";break;case"%g":case"%G":case"%h":case"%H":_+="set[3]=temp["+d+"]||0;";break;case"%i":_+="set[4]=temp["+d+"]||0;";break;case"%Y":_+="set[0]=temp["+d+"]||0;";break;case"%a":case"%A":_+="set[3]=set[3]%12+((temp["+d+"]||'').toLowerCase()=='am'?0:12);";break;case"%s":_+="set[5]=temp["+d+"]||0;";break;case"%M":_+="set[1]=this.locale.date.month_short_hash[temp["+d+"]]||0;";break;case"%F":_+="set[1]=this.locale.date.month_full_hash[temp["+d+"]]||0;"}var l="set[0],set[1],set[2],set[3],set[4],set[5]";return o&&(l=" Date.UTC("+l+")"),new Function("date","var set=[0,0,1,0,0,0]; "+_+" return new Date("+l+");")},t=function(n,o){const _=n.match(/%[a-zA-Z]/g);return function(a){for(var d=[0,0,1,0,0,0],l=a.match(/[a-zA-Z]+|[0-9]+/g),c=0;c<_.length;c++)switch(_[c]){case"%j":case"%d":d[2]=l[c]||1;break;case"%n":case"%m":d[1]=(l[c]||1)-1;break;case"%y":d[0]=1*l[c]+(l[c]>50?1900:2e3);break;case"%g":case"%G":case"%h":case"%H":d[3]=l[c]||0;break;case"%i":d[4]=l[c]||0;break;case"%Y":d[0]=l[c]||0;break;case"%a":case"%A":d[3]=d[3]%12+((l[c]||"").toLowerCase()=="am"?0:12);break;case"%s":d[5]=l[c]||0;break;case"%M":d[1]=e.locale.date.month_short_hash[l[c]]||0;break;case"%F":d[1]=e.locale.date.month_full_hash[l[c]]||0}return o?new Date(Date.UTC(d[0],d[1],d[2],d[3],d[4],d[5])):new Date(d[0],d[1],d[2],d[3],d[4],d[5])}};let r;function s(){var n=!1;return e.config.csp==="auto"?(r===void 0&&(r=function(){try{new Function("cspEnabled = false;"),r=!1}catch{r=!0}return r}()),n=r):n=e.config.csp,n}e.date={init:function(){for(var n=e.locale.date.month_short,o=e.locale.date.month_short_hash={},_=0;_<n.length;_++)o[n[_]]=_;for(n=e.locale.date.month_full,o=e.locale.date.month_full_hash={},_=0;_<n.length;_++)o[n[_]]=_},date_part:function(n){const o=new Date(n);var _=new Date(o);return o.setHours(0),o.setMinutes(0),o.setSeconds(0),o.setMilliseconds(0),o.getHours()&&(o.getDate()<_.getDate()||o.getMonth()<_.getMonth()||o.getFullYear()<_.getFullYear())&&o.setTime(o.getTime()+36e5*(24-o.getHours())),o},time_part:function(n){return(n.valueOf()/1e3-60*n.getTimezoneOffset())%86400},week_start:function(n){var o=n.getDay();return e.config.start_on_monday&&(o===0?o=6:o--),this.date_part(this.add(n,-1*o,"day"))},month_start:function(n){const o=new Date(n);return o.setDate(1),this.date_part(o)},year_start:function(n){const o=new Date(n);return o.setMonth(0),this.month_start(o)},day_start:function(n){const o=new Date(n);return this.date_part(o)},_add_days:function(n,o){var _=new Date(n.valueOf());if(_.setDate(_.getDate()+o),o==Math.round(o)&&o>0){var a=(+_-+n)%864e5;if(a&&n.getTimezoneOffset()==_.getTimezoneOffset()){var d=a/36e5;_.setTime(_.getTime()+60*(24-d)*60*1e3)}}return o>=0&&!n.getHours()&&_.getHours()&&(_.getDate()<n.getDate()||_.getMonth()<n.getMonth()||_.getFullYear()<n.getFullYear())&&_.setTime(_.getTime()+36e5*(24-_.getHours())),_},add:function(n,o,_){var a=new Date(n.valueOf());switch(_){case"day":a=e.date._add_days(a,o);break;case"week":a=e.date._add_days(a,7*o);break;case"month":a.setMonth(a.getMonth()+o);break;case"year":a.setYear(a.getFullYear()+o);break;case"hour":a.setTime(a.getTime()+60*o*60*1e3);break;case"minute":a.setTime(a.getTime()+60*o*1e3);break;default:return e.date["add_"+_](n,o,_)}return a},to_fixed:function(n){return n<10?"0"+n:n},copy:function(n){return new Date(n.valueOf())},date_to_str:function(n,o){return s()?function(_,a){return function(d){return _.replace(/%[a-zA-Z]/g,function(l){switch(l){case"%d":return a?e.date.to_fixed(d.getUTCDate()):e.date.to_fixed(d.getDate());case"%m":return a?e.date.to_fixed(d.getUTCMonth()+1):e.date.to_fixed(d.getMonth()+1);case"%j":return a?d.getUTCDate():d.getDate();case"%n":return a?d.getUTCMonth()+1:d.getMonth()+1;case"%y":return a?e.date.to_fixed(d.getUTCFullYear()%100):e.date.to_fixed(d.getFullYear()%100);case"%Y":return a?d.getUTCFullYear():d.getFullYear();case"%D":return a?e.locale.date.day_short[d.getUTCDay()]:e.locale.date.day_short[d.getDay()];case"%l":return a?e.locale.date.day_full[d.getUTCDay()]:e.locale.date.day_full[d.getDay()];case"%M":return a?e.locale.date.month_short[d.getUTCMonth()]:e.locale.date.month_short[d.getMonth()];case"%F":return a?e.locale.date.month_full[d.getUTCMonth()]:e.locale.date.month_full[d.getMonth()];case"%h":return a?e.date.to_fixed((d.getUTCHours()+11)%12+1):e.date.to_fixed((d.getHours()+11)%12+1);case"%g":return a?(d.getUTCHours()+11)%12+1:(d.getHours()+11)%12+1;case"%G":return a?d.getUTCHours():d.getHours();case"%H":return a?e.date.to_fixed(d.getUTCHours()):e.date.to_fixed(d.getHours());case"%i":return a?e.date.to_fixed(d.getUTCMinutes()):e.date.to_fixed(d.getMinutes());case"%a":return a?d.getUTCHours()>11?"pm":"am":d.getHours()>11?"pm":"am";case"%A":return a?d.getUTCHours()>11?"PM":"AM":d.getHours()>11?"PM":"AM";case"%s":return a?e.date.to_fixed(d.getUTCSeconds()):e.date.to_fixed(d.getSeconds());case"%W":return a?e.date.to_fixed(e.date.getUTCISOWeek(d)):e.date.to_fixed(e.date.getISOWeek(d));default:return l}})}}(n,o):(n=n.replace(/%[a-zA-Z]/g,function(_){switch(_){case"%d":return'"+this.date.to_fixed(date.getDate())+"';case"%m":return'"+this.date.to_fixed((date.getMonth()+1))+"';case"%j":return'"+date.getDate()+"';case"%n":return'"+(date.getMonth()+1)+"';case"%y":return'"+this.date.to_fixed(date.getFullYear()%100)+"';case"%Y":return'"+date.getFullYear()+"';case"%D":return'"+this.locale.date.day_short[date.getDay()]+"';case"%l":return'"+this.locale.date.day_full[date.getDay()]+"';case"%M":return'"+this.locale.date.month_short[date.getMonth()]+"';case"%F":return'"+this.locale.date.month_full[date.getMonth()]+"';case"%h":return'"+this.date.to_fixed((date.getHours()+11)%12+1)+"';case"%g":return'"+((date.getHours()+11)%12+1)+"';case"%G":return'"+date.getHours()+"';case"%H":return'"+this.date.to_fixed(date.getHours())+"';case"%i":return'"+this.date.to_fixed(date.getMinutes())+"';case"%a":return'"+(date.getHours()>11?"pm":"am")+"';case"%A":return'"+(date.getHours()>11?"PM":"AM")+"';case"%s":return'"+this.date.to_fixed(date.getSeconds())+"';case"%W":return'"+this.date.to_fixed(this.date.getISOWeek(date))+"';default:return _}}),o&&(n=n.replace(/date\.get/g,"date.getUTC")),new Function("date",'return "'+n+'";').bind(e))},str_to_date:function(n,o,_){var a=s()?t:i,d=a(n,o),l=/^[0-9]{4}(\-|\/)[0-9]{2}(\-|\/)[0-9]{2} ?(([0-9]{1,2}:[0-9]{1,2})(:[0-9]{1,2})?)?$/,c=/^[0-9]{2}\/[0-9]{2}\/[0-9]{4} ?(([0-9]{1,2}:[0-9]{2})(:[0-9]{1,2})?)?$/,f=/^[0-9]{2}\-[0-9]{2}\-[0-9]{4} ?(([0-9]{1,2}:[0-9]{1,2})(:[0-9]{1,2})?)?$/,m=/^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/,p=a("%Y-%m-%d %H:%i:%s",o),h=a("%m/%d/%Y %H:%i:%s",o),u=a("%d-%m-%Y %H:%i:%s",o);return function(v){if(!_&&!e.config.parse_exact_format){if(v&&v.getISOWeek)return new Date(v);if(typeof v=="number")return new Date(v);if(y=v,l.test(String(y)))return p(v);if(function(x){return c.test(String(x))}(v))return h(v);if(function(x){return f.test(String(x))}(v))return u(v);if(function(x){return m.test(x)}(v))return new Date(v)}var y;return d.call(e,v)}},getISOWeek:function(n){if(!n)return!1;var o=(n=this.date_part(new Date(n))).getDay();o===0&&(o=7);var _=new Date(n.valueOf());_.setDate(n.getDate()+(4-o));var a=_.getFullYear(),d=Math.round((_.getTime()-new Date(a,0,1).getTime())/864e5);return 1+Math.floor(d/7)},getUTCISOWeek:function(n){return this.getISOWeek(this.convert_to_utc(n))},convert_to_utc:function(n){return new Date(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds())}}}function at(e){return(function(){var i={};for(var t in this._events){var r=this._events[t];r.id.toString().indexOf("#")==-1&&(i[r.id]=r)}return i}).bind(e)}function Bt(e){e._loaded={},e._load=function(t,r){if(t=t||this._load_url){var s;if(t+=(t.indexOf("?")==-1?"?":"&")+"timeshift="+new Date().getTimezoneOffset(),this.config.prevent_cache&&(t+="&uid="+this.uid()),r=r||this._date,this._load_mode){var n=this.templates.load_format;for(r=this.date[this._load_mode+"_start"](new Date(r.valueOf()));r>this._min_date;)r=this.date.add(r,-1,this._load_mode);s=r;for(var o=!0;s<this._max_date;)s=this.date.add(s,1,this._load_mode),this._loaded[n(r)]&&o?r=this.date.add(r,1,this._load_mode):o=!1;var _=s;do s=_,_=this.date.add(s,-1,this._load_mode);while(_>r&&this._loaded[n(_)]);if(s<=r)return!1;for(e.ajax.get(t+"&from="+n(r)+"&to="+n(s),a);r<s;)this._loaded[n(r)]=!0,r=this.date.add(r,1,this._load_mode)}else e.ajax.get(t,a);return this.callEvent("onXLS",[]),this.callEvent("onLoadStart",[]),!0}function a(d){e.on_load(d),e.callEvent("onLoadEnd",[])}},e._parsers={},function(t){t._parsers.xml={canParse:function(r,s){if(s.responseXML&&s.responseXML.firstChild)return!0;try{var n=t.ajax.parse(s.responseText),o=t.ajax.xmltop("data",n);if(o&&o.tagName==="data")return!0}catch{}return!1},parse:function(r){var s;if(r.xmlDoc.responseXML||(r.xmlDoc.responseXML=t.ajax.parse(r.xmlDoc.responseText)),(s=t.ajax.xmltop("data",r.xmlDoc)).tagName!="data")return null;var n=s.getAttribute("dhx_security");n&&(window.dhtmlx&&(window.dhtmlx.security_key=n),t.security_key=n);for(var o=t.ajax.xpath("//coll_options",r.xmlDoc),_=0;_<o.length;_++){var a=o[_].getAttribute("for"),d=t.serverList[a];d||(t.serverList[a]=d=[]),d.splice(0,d.length);for(var l=t.ajax.xpath(".//item",o[_]),c=0;c<l.length;c++){for(var f=l[c].attributes,m={key:l[c].getAttribute("value"),label:l[c].getAttribute("label")},p=0;p<f.length;p++){var h=f[p];h.nodeName!="value"&&h.nodeName!="label"&&(m[h.nodeName]=h.nodeValue)}d.push(m)}}o.length&&t.callEvent("onOptionsLoad",[]);var u=t.ajax.xpath("//userdata",r.xmlDoc);for(_=0;_<u.length;_++){var v=t._xmlNodeToJSON(u[_]);t._userdata[v.name]=v.text}var y=[];for(s=t.ajax.xpath("//event",r.xmlDoc),_=0;_<s.length;_++){var x=y[_]=t._xmlNodeToJSON(s[_]);t._init_event(x)}return y}}}(e),function(t){t.json=t._parsers.json={canParse:function(r){if(r&&typeof r=="object")return!0;if(typeof r=="string")try{var s=JSON.parse(r);return Object.prototype.toString.call(s)==="[object Object]"||Object.prototype.toString.call(s)==="[object Array]"}catch{return!1}return!1},parse:function(r){var s=[];typeof r=="string"&&(r=JSON.parse(r)),Object.prototype.toString.call(r)==="[object Array]"?s=r:r&&(r.events?s=r.events:r.data&&(s=r.data)),s=s||[],r.dhx_security&&(window.dhtmlx&&(window.dhtmlx.security_key=r.dhx_security),t.security_key=r.dhx_security);var n=r&&r.collections?r.collections:{},o=!1;for(var _ in n)if(n.hasOwnProperty(_)){o=!0;var a=n[_],d=t.serverList[_];d||(t.serverList[_]=d=[]),d.splice(0,d.length);for(var l=0;l<a.length;l++){var c=a[l],f={key:c.value,label:c.label};for(var m in c)if(c.hasOwnProperty(m)){if(m=="value"||m=="label")continue;f[m]=c[m]}d.push(f)}}o&&t.callEvent("onOptionsLoad",[]);for(var p=[],h=0;h<s.length;h++){var u=s[h];t._init_event(u),p.push(u)}return p}}}(e),function(t){t.ical=t._parsers.ical={canParse:function(r){return typeof r=="string"&&new RegExp("^BEGIN:VCALENDAR").test(r)},parse:function(r){