From 0a247a3d563d9e6002eb0e48ff2b6e35f9f25fb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20H=C3=A4ttasch?= <benjamin.haettasch@fachschaft.informatik.tu-darmstadt.de> Date: Wed, 4 Jan 2023 18:54:54 +0100 Subject: [PATCH] Upgrade JS Libraries Upgrade Fullcalendar to v6 (implements #186) Upgrade jQuery to v3.6 (implements #185) Upgrade Select2 to v4.0.13 Remove tag information leftover in track manager --- .../templates/AKModel/load_fullcalendar.html | 3 +- .../load_fullcalendar_availabilities.html | 3 +- .../admin/AKModel/default_slot_editor.html | 2 +- .../admin/AKModel/room_change_form.html | 2 +- AKPlan/templates/AKPlan/plan_wall.html | 2 +- .../admin/AKScheduling/manage_tracks.html | 5 - .../admin/AKScheduling/scheduling.html | 2 +- .../fullcalendar-6.0.2.js | 18949 +++++++++++++++ .../fullcalendar-6.0.2.min.js | 6 + .../fullcalendar-scheduler/locales/de.js | 93 +- .../fullcalendar-scheduler/locales/de.min.js | 6 + .../vendor/fullcalendar-scheduler/main.css | 1756 -- .../vendor/fullcalendar-scheduler/main.js | 19554 ---------------- .../fullcalendar-scheduler/main.min.css | 1 - .../common/vendor/jquery/jquery-3.3.1.min.js | 2 - .../vendor/jquery/jquery-3.3.1.slim.min.js | 2 - .../common/vendor/jquery/jquery-3.6.3.js | 10993 +++++++++ .../common/vendor/jquery/jquery-3.6.3.min.js | 2 + .../common/vendor/select2/select2.css | 481 + .../common/vendor/select2/select2.js | 6108 +++++ .../common/vendor/select2/select2.min.js | 2 +- templates/admin/base_site.html | 2 +- templates/base.html | 2 +- 23 files changed, 36620 insertions(+), 21358 deletions(-) create mode 100644 static_common/common/vendor/fullcalendar-scheduler/fullcalendar-6.0.2.js create mode 100644 static_common/common/vendor/fullcalendar-scheduler/fullcalendar-6.0.2.min.js create mode 100644 static_common/common/vendor/fullcalendar-scheduler/locales/de.min.js delete mode 100644 static_common/common/vendor/fullcalendar-scheduler/main.css delete mode 100644 static_common/common/vendor/fullcalendar-scheduler/main.js delete mode 100644 static_common/common/vendor/fullcalendar-scheduler/main.min.css delete mode 100644 static_common/common/vendor/jquery/jquery-3.3.1.min.js delete mode 100644 static_common/common/vendor/jquery/jquery-3.3.1.slim.min.js create mode 100644 static_common/common/vendor/jquery/jquery-3.6.3.js create mode 100644 static_common/common/vendor/jquery/jquery-3.6.3.min.js create mode 100644 static_common/common/vendor/select2/select2.css create mode 100644 static_common/common/vendor/select2/select2.js diff --git a/AKModel/templates/AKModel/load_fullcalendar.html b/AKModel/templates/AKModel/load_fullcalendar.html index f75749b5..e00f5038 100644 --- a/AKModel/templates/AKModel/load_fullcalendar.html +++ b/AKModel/templates/AKModel/load_fullcalendar.html @@ -2,8 +2,7 @@ {% load i18n %} {% get_current_language as LANGUAGE_CODE %} -<link href='{% static 'common/vendor/fullcalendar-scheduler/main.css' %}' rel='stylesheet'/> -<script src='{% static 'common/vendor/fullcalendar-scheduler/main.js' %}'></script> +<script src='{% static 'common/vendor/fullcalendar-scheduler/fullcalendar-6.0.2.js' %}'></script> {% with 'common/vendor/fullcalendar-scheduler/locales/'|add:LANGUAGE_CODE|add:'.js' as locale_file %} {% if LANGUAGE_CODE != "en" %} diff --git a/AKModel/templates/AKModel/load_fullcalendar_availabilities.html b/AKModel/templates/AKModel/load_fullcalendar_availabilities.html index 287946c9..74c34f72 100644 --- a/AKModel/templates/AKModel/load_fullcalendar_availabilities.html +++ b/AKModel/templates/AKModel/load_fullcalendar_availabilities.html @@ -2,8 +2,7 @@ {% load i18n %} {% get_current_language as LANGUAGE_CODE %} -<link href='{% static 'common/vendor/fullcalendar-scheduler/main.css' %}' rel='stylesheet'/> -<script src='{% static 'common/vendor/fullcalendar-scheduler/main.js' %}'></script> +<script src='{% static 'common/vendor/fullcalendar-scheduler/fullcalendar-6.0.2.js' %}'></script> <script src="{% static "common/vendor/moment/moment-with-locales.js" %}"></script> <script src="{% static "common/js/availabilities.js" %}"></script> diff --git a/AKModel/templates/admin/AKModel/default_slot_editor.html b/AKModel/templates/admin/AKModel/default_slot_editor.html index f2bb9f82..58cc71a8 100644 --- a/AKModel/templates/admin/AKModel/default_slot_editor.html +++ b/AKModel/templates/admin/AKModel/default_slot_editor.html @@ -8,7 +8,7 @@ {% block extrahead %} {{ block.super }} {% bootstrap_javascript %} - <script src="{% static 'common/vendor/jquery/jquery-3.3.1.min.js' %}"></script> + <script src="{% static 'common/vendor/jquery/jquery-3.6.3.min.js' %}"></script> {% include "AKModel/load_fullcalendar_availabilities.html" %} <script> diff --git a/AKModel/templates/admin/AKModel/room_change_form.html b/AKModel/templates/admin/AKModel/room_change_form.html index 44aafc57..7e43205f 100644 --- a/AKModel/templates/admin/AKModel/room_change_form.html +++ b/AKModel/templates/admin/AKModel/room_change_form.html @@ -7,7 +7,7 @@ {% block extrahead %} {{ block.super }} {% bootstrap_javascript %} - <script src="{% static 'common/vendor/jquery/jquery-3.3.1.min.js' %}"></script> + <script src="{% static 'common/vendor/jquery/jquery-3.6.3.min.js' %}"></script> {% if original.event %} {% include "AKModel/load_fullcalendar_availabilities.html" %} diff --git a/AKPlan/templates/AKPlan/plan_wall.html b/AKPlan/templates/AKPlan/plan_wall.html index 0659317b..717c7ffd 100644 --- a/AKPlan/templates/AKPlan/plan_wall.html +++ b/AKPlan/templates/AKPlan/plan_wall.html @@ -16,7 +16,7 @@ {# Load Bootstrap CSS and JavaScript as well as font awesome #} {% bootstrap_css %} {% bootstrap_javascript %} - <script src="{% static 'common/vendor/jquery/jquery-3.3.1.min.js' %}"></script> + <script src="{% static 'common/vendor/jquery/jquery-3.6.3.min.js' %}"></script> {% fontawesome_6_static %} <link rel="stylesheet" href="{% static 'common/css/custom.css' %}"> diff --git a/AKScheduling/templates/admin/AKScheduling/manage_tracks.html b/AKScheduling/templates/admin/AKScheduling/manage_tracks.html index cf542e5e..a1a1a380 100644 --- a/AKScheduling/templates/admin/AKScheduling/manage_tracks.html +++ b/AKScheduling/templates/admin/AKScheduling/manage_tracks.html @@ -119,11 +119,6 @@ $('.ak-list').sortable(sortable_options); - // Display tooltips containing the tags for each list item (if available) - $('.ak-list li').each(function() { - $(this).tooltip({title: $(this).attr('data-title'), trigger: 'hover'}); - }); - // Add a new track container (and make usable for dragging) $('#btn-add-track').click(function () { var new_track_name = prompt("{% trans 'Name of new ak track' %}"); diff --git a/AKScheduling/templates/admin/AKScheduling/scheduling.html b/AKScheduling/templates/admin/AKScheduling/scheduling.html index 6e34087f..b9bbad4c 100644 --- a/AKScheduling/templates/admin/AKScheduling/scheduling.html +++ b/AKScheduling/templates/admin/AKScheduling/scheduling.html @@ -21,7 +21,7 @@ {# Load Bootstrap CSS and JavaScript as well as font awesome #} {% bootstrap_css %} {% bootstrap_javascript %} - <script src="{% static 'common/vendor/jquery/jquery-3.3.1.min.js' %}"></script> + <script src="{% static 'common/vendor/jquery/jquery-3.6.3.min.js' %}"></script> {% fontawesome_6_static %} {% include "AKModel/load_fullcalendar.html" %} diff --git a/static_common/common/vendor/fullcalendar-scheduler/fullcalendar-6.0.2.js b/static_common/common/vendor/fullcalendar-scheduler/fullcalendar-6.0.2.js new file mode 100644 index 00000000..2b022b3c --- /dev/null +++ b/static_common/common/vendor/fullcalendar-scheduler/fullcalendar-6.0.2.js @@ -0,0 +1,18949 @@ +/*! +FullCalendar Premium Bundle v6.0.2 +Docs & License: https://fullcalendar.io/docs/initialize-globals +(c) 2022 Adam Shaw +*/ +var FullCalendar = (function (exports) { + 'use strict'; + + var n,l$1,u$1,i$1,t,o,r$1,f$1={},e$1=[],c$1=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function s(n,l){for(var u in l)n[u]=l[u];return n}function a$1(n){var l=n.parentNode;l&&l.removeChild(n);}function h(l,u,i){var t,o,r,f={};for(r in u)"key"==r?t=u[r]:"ref"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):i),"function"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return v$1(l,f,t,o,null)}function v$1(n,i,t,o,r){var f={type:n,props:i,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++u$1:r};return null==r&&null!=l$1.vnode&&l$1.vnode(f),f}function y(){return {current:null}}function p(n){return n.children}function d(n,l){this.props=n,this.context=l;}function _(n,l){if(null==l)return n.__?_(n.__,n.__.__k.indexOf(n)+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return "function"==typeof n.type?_(n):null}function k$1(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return k$1(n)}}function b$1(n){(!n.__d&&(n.__d=!0)&&t.push(n)&&!g$2.__r++||o!==l$1.debounceRendering)&&((o=l$1.debounceRendering)||setTimeout)(g$2);}function g$2(){for(var n;g$2.__r=t.length;)n=t.sort(function(n,l){return n.__v.__b-l.__v.__b}),t=[],n.some(function(n){var l,u,i,t,o,r;n.__d&&(o=(t=(l=n).__v).__e,(r=l.__P)&&(u=[],(i=s({},t)).__v=t.__v+1,j$2(r,t,i,l.__n,void 0!==r.ownerSVGElement,null!=t.__h?[o]:null,u,null==o?_(t):o,t.__h),z$1(u,t),t.__e!=o&&k$1(t)));});}function w$2(n,l,u,i,t,o,r,c,s,a){var h,y,d,k,b,g,w,x=i&&i.__k||e$1,C=x.length;for(u.__k=[],h=0;h<l.length;h++)if(null!=(k=u.__k[h]=null==(k=l[h])||"boolean"==typeof k?null:"string"==typeof k||"number"==typeof k||"bigint"==typeof k?v$1(null,k,null,null,k):Array.isArray(k)?v$1(p,{children:k},null,null,null):k.__b>0?v$1(k.type,k.props,k.key,k.ref?k.ref:null,k.__v):k)){if(k.__=u,k.__b=u.__b+1,null===(d=x[h])||d&&k.key==d.key&&k.type===d.type)x[h]=void 0;else for(y=0;y<C;y++){if((d=x[y])&&k.key==d.key&&k.type===d.type){x[y]=void 0;break}d=null;}j$2(n,k,d=d||f$1,t,o,r,c,s,a),b=k.__e,(y=k.ref)&&d.ref!=y&&(w||(w=[]),d.ref&&w.push(d.ref,null,k),w.push(y,k.__c||b,k)),null!=b?(null==g&&(g=b),"function"==typeof k.type&&k.__k===d.__k?k.__d=s=m$1(k,s,n):s=A(n,k,d,x,b,s),"function"==typeof u.type&&(u.__d=s)):s&&d.__e==s&&s.parentNode!=n&&(s=_(d));}for(u.__e=g,h=C;h--;)null!=x[h]&&N(x[h],x[h]);if(w)for(h=0;h<w.length;h++)M(w[h],w[++h],w[++h]);}function m$1(n,l,u){for(var i,t=n.__k,o=0;t&&o<t.length;o++)(i=t[o])&&(i.__=n,l="function"==typeof i.type?m$1(i,l,u):A(u,i,i,t,i.__e,l));return l}function x$1(n,l){return l=l||[],null==n||"boolean"==typeof n||(Array.isArray(n)?n.some(function(n){x$1(n,l);}):l.push(n)),l}function A(n,l,u,i,t,o){var r,f,e;if(void 0!==l.__d)r=l.__d,l.__d=void 0;else if(null==u||t!=o||null==t.parentNode)n:if(null==o||o.parentNode!==n)n.appendChild(t),r=null;else {for(f=o,e=0;(f=f.nextSibling)&&e<i.length;e+=1)if(f==t)break n;n.insertBefore(t,o),r=o;}return void 0!==r?r:t.nextSibling}function C$1(n,l,u,i,t){var o;for(o in u)"children"===o||"key"===o||o in l||H$1(n,o,null,u[o],i);for(o in l)t&&"function"!=typeof l[o]||"children"===o||"key"===o||"value"===o||"checked"===o||u[o]===l[o]||H$1(n,o,l[o],u[o],i);}function $$1(n,l,u){"-"===l[0]?n.setProperty(l,u):n[l]=null==u?"":"number"!=typeof u||c$1.test(l)?u:u+"px";}function H$1(n,l,u,i,t){var o;n:if("style"===l)if("string"==typeof u)n.style.cssText=u;else {if("string"==typeof i&&(n.style.cssText=i=""),i)for(l in i)u&&l in u||$$1(n.style,l,"");if(u)for(l in u)i&&u[l]===i[l]||$$1(n.style,l,u[l]);}else if("o"===l[0]&&"n"===l[1])o=l!==(l=l.replace(/Capture$/,"")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?i||n.addEventListener(l,o?T$1:I$1,o):n.removeEventListener(l,o?T$1:I$1,o);else if("dangerouslySetInnerHTML"!==l){if(t)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("href"!==l&&"list"!==l&&"form"!==l&&"tabIndex"!==l&&"download"!==l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null==u||!1===u&&-1==l.indexOf("-")?n.removeAttribute(l):n.setAttribute(l,u));}}function I$1(n){this.l[n.type+!1](l$1.event?l$1.event(n):n);}function T$1(n){this.l[n.type+!0](l$1.event?l$1.event(n):n);}function j$2(n,u,i,t,o,r,f,e,c){var a,h,v,y,_,k,b,g,m,x,A,C,$,H,I,T=u.type;if(void 0!==u.constructor)return null;null!=i.__h&&(c=i.__h,e=u.__e=i.__e,u.__h=null,r=[e]),(a=l$1.__b)&&a(u);try{n:if("function"==typeof T){if(g=u.props,m=(a=T.contextType)&&t[a.__c],x=a?m?m.props.value:a.__:t,i.__c?b=(h=u.__c=i.__c).__=h.__E:("prototype"in T&&T.prototype.render?u.__c=h=new T(g,x):(u.__c=h=new d(g,x),h.constructor=T,h.render=O),m&&m.sub(h),h.props=g,h.state||(h.state={}),h.context=x,h.__n=t,v=h.__d=!0,h.__h=[],h._sb=[]),null==h.__s&&(h.__s=h.state),null!=T.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=s({},h.__s)),s(h.__s,T.getDerivedStateFromProps(g,h.__s))),y=h.props,_=h.state,v)null==T.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else {if(null==T.getDerivedStateFromProps&&g!==y&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(g,x),!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(g,h.__s,x)||u.__v===i.__v){for(h.props=g,h.state=h.__s,u.__v!==i.__v&&(h.__d=!1),h.__v=u,u.__e=i.__e,u.__k=i.__k,u.__k.forEach(function(n){n&&(n.__=u);}),A=0;A<h._sb.length;A++)h.__h.push(h._sb[A]);h._sb=[],h.__h.length&&f.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(g,h.__s,x),null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(y,_,k);});}if(h.context=x,h.props=g,h.__v=u,h.__P=n,C=l$1.__r,$=0,"prototype"in T&&T.prototype.render){for(h.state=h.__s,h.__d=!1,C&&C(u),a=h.render(h.props,h.state,h.context),H=0;H<h._sb.length;H++)h.__h.push(h._sb[H]);h._sb=[];}else do{h.__d=!1,C&&C(u),a=h.render(h.props,h.state,h.context),h.state=h.__s;}while(h.__d&&++$<25);h.state=h.__s,null!=h.getChildContext&&(t=s(s({},t),h.getChildContext())),v||null==h.getSnapshotBeforeUpdate||(k=h.getSnapshotBeforeUpdate(y,_)),I=null!=a&&a.type===p&&null==a.key?a.props.children:a,w$2(n,Array.isArray(I)?I:[I],u,i,t,o,r,f,e,c),h.base=u.__e,u.__h=null,h.__h.length&&f.push(h),b&&(h.__E=h.__=null),h.__e=!1;}else null==r&&u.__v===i.__v?(u.__k=i.__k,u.__e=i.__e):u.__e=L$1(i.__e,u,i,t,o,r,f,c);(a=l$1.diffed)&&a(u);}catch(n){u.__v=null,(c||null!=r)&&(u.__e=e,u.__h=!!c,r[r.indexOf(e)]=null),l$1.__e(n,u,i);}}function z$1(n,u){l$1.__c&&l$1.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u);});}catch(n){l$1.__e(n,u.__v);}});}function L$1(l,u,i,t,o,r,e,c){var s,h,v,y=i.props,p=u.props,d=u.type,k=0;if("svg"===d&&(o=!0),null!=r)for(;k<r.length;k++)if((s=r[k])&&"setAttribute"in s==!!d&&(d?s.localName===d:3===s.nodeType)){l=s,r[k]=null;break}if(null==l){if(null===d)return document.createTextNode(p);l=o?document.createElementNS("http://www.w3.org/2000/svg",d):document.createElement(d,p.is&&p),r=null,c=!1;}if(null===d)y===p||c&&l.data===p||(l.data=p);else {if(r=r&&n.call(l.childNodes),h=(y=i.props||f$1).dangerouslySetInnerHTML,v=p.dangerouslySetInnerHTML,!c){if(null!=r)for(y={},k=0;k<l.attributes.length;k++)y[l.attributes[k].name]=l.attributes[k].value;(v||h)&&(v&&(h&&v.__html==h.__html||v.__html===l.innerHTML)||(l.innerHTML=v&&v.__html||""));}if(C$1(l,p,y,o,c),v)u.__k=[];else if(k=u.props.children,w$2(l,Array.isArray(k)?k:[k],u,i,t,o&&"foreignObject"!==d,r,e,r?r[0]:i.__k&&_(i,0),c),null!=r)for(k=r.length;k--;)null!=r[k]&&a$1(r[k]);c||("value"in p&&void 0!==(k=p.value)&&(k!==l.value||"progress"===d&&!k||"option"===d&&k!==y.value)&&H$1(l,"value",k,y.value,!1),"checked"in p&&void 0!==(k=p.checked)&&k!==l.checked&&H$1(l,"checked",k,y.checked,!1));}return l}function M(n,u,i){try{"function"==typeof n?n(u):n.current=u;}catch(n){l$1.__e(n,i);}}function N(n,u,i){var t,o;if(l$1.unmount&&l$1.unmount(n),(t=n.ref)&&(t.current&&t.current!==n.__e||M(t,null,u)),null!=(t=n.__c)){if(t.componentWillUnmount)try{t.componentWillUnmount();}catch(n){l$1.__e(n,u);}t.base=t.__P=null,n.__c=void 0;}if(t=n.__k)for(o=0;o<t.length;o++)t[o]&&N(t[o],u,i||"function"!=typeof n.type);i||null==n.__e||a$1(n.__e),n.__=n.__e=n.__d=void 0;}function O(n,l,u){return this.constructor(n,u)}function P$1(u,i,t){var o,r,e;l$1.__&&l$1.__(u,i),r=(o="function"==typeof t)?null:t&&t.__k||i.__k,e=[],j$2(i,u=(!o&&t||i).__k=h(p,null,[u]),r||f$1,f$1,void 0!==i.ownerSVGElement,!o&&t?[t]:r?null:i.firstChild?n.call(i.childNodes):null,e,!o&&t?t:r?r.__e:i.firstChild,o),z$1(e,u);}function B$1(n,l){var u={__c:l="__cC"+r$1++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n){var u,i;return this.getChildContext||(u=[],(i={})[l]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(n){this.props.value!==n.value&&u.some(b$1);},this.sub=function(n){u.push(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u.splice(u.indexOf(n),1),l&&l.call(n);};}),n.children}};return u.Provider.__=u.Consumer.contextType=u}n=e$1.slice,l$1={__e:function(n,l,u,i){for(var t,o,r;l=l.__;)if((t=l.__c)&&!t.__)try{if((o=t.constructor)&&null!=o.getDerivedStateFromError&&(t.setState(o.getDerivedStateFromError(n)),r=t.__d),null!=t.componentDidCatch&&(t.componentDidCatch(n,i||{}),r=t.__d),r)return t.__E=t}catch(l){n=l;}throw n}},u$1=0,i$1=function(n){return null!=n&&void 0===n.constructor},d.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=s({},this.state),"function"==typeof n&&(n=n(s({},u),this.props)),n&&s(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),b$1(this));},d.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),b$1(this));},d.prototype.render=p,t=[],g$2.__r=0,r$1=0; + + var r,u,i,f=[],c=[],e=l$1.__b,a=l$1.__r,v=l$1.diffed,l=l$1.__c,m=l$1.unmount;function b(){for(var t;t=f.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(k),t.__H.__h.forEach(w$1),t.__H.__h=[];}catch(r){t.__H.__h=[],l$1.__e(r,t.__v);}}l$1.__b=function(n){r=null,e&&e(n);},l$1.__r=function(n){a&&a(n);var i=(r=n.__c).__H;i&&(u===r?(i.__h=[],r.__h=[],i.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=c,n.__N=n.i=void 0;})):(i.__h.forEach(k),i.__h.forEach(w$1),i.__h=[])),u=r;},l$1.diffed=function(t){v&&v(t);var o=t.__c;o&&o.__H&&(o.__H.__h.length&&(1!==f.push(o)&&i===l$1.requestAnimationFrame||((i=l$1.requestAnimationFrame)||j$1)(b)),o.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==c&&(n.__=n.__V),n.i=void 0,n.__V=c;})),u=r=null;},l$1.__c=function(t,r){r.some(function(t){try{t.__h.forEach(k),t.__h=t.__h.filter(function(n){return !n.__||w$1(n)});}catch(u){r.some(function(n){n.__h&&(n.__h=[]);}),r=[],l$1.__e(u,t.__v);}}),l&&l(t,r);},l$1.unmount=function(t){m&&m(t);var r,u=t.__c;u&&u.__H&&(u.__H.__.forEach(function(n){try{k(n);}catch(n){r=n;}}),u.__H=void 0,r&&l$1.__e(r,u.__v));};var g$1="function"==typeof requestAnimationFrame;function j$1(n){var t,r=function(){clearTimeout(u),g$1&&cancelAnimationFrame(t),setTimeout(n);},u=setTimeout(r,100);g$1&&(t=requestAnimationFrame(r));}function k(n){var t=r,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),r=t;}function w$1(n){var t=r;n.__c=n.__(),r=t;} + + function g(n,t){for(var e in t)n[e]=t[e];return n}function C(n,t){for(var e in n)if("__source"!==e&&!(e in t))return !0;for(var r in t)if("__source"!==r&&n[r]!==t[r])return !0;return !1}function w(n){this.props=n;}(w.prototype=new d).isPureReactComponent=!0,w.prototype.shouldComponentUpdate=function(n,t){return C(this.props,n)||C(this.state,t)};var x=l$1.__b;l$1.__b=function(n){n.type&&n.type.__f&&n.ref&&(n.props.ref=n.ref,n.ref=null),x&&x(n);};var T=l$1.__e;l$1.__e=function(n,t,e,r){if(n.then)for(var u,o=t;o=o.__;)if((u=o.__c)&&u.__c)return null==t.__e&&(t.__e=e.__e,t.__k=e.__k),u.__c(n,t);T(n,t,e,r);};var I=l$1.unmount;function L(n,t,e){return n&&(n.__c&&n.__c.__H&&(n.__c.__H.__.forEach(function(n){"function"==typeof n.__c&&n.__c();}),n.__c.__H=null),null!=(n=g({},n)).__c&&(n.__c.__P===e&&(n.__c.__P=t),n.__c=null),n.__k=n.__k&&n.__k.map(function(n){return L(n,t,e)})),n}function U(n,t,e){return n&&(n.__v=null,n.__k=n.__k&&n.__k.map(function(n){return U(n,t,e)}),n.__c&&n.__c.__P===t&&(n.__e&&e.insertBefore(n.__e,n.__d),n.__c.__e=!0,n.__c.__P=e)),n}function D(){this.__u=0,this.t=null,this.__b=null;}function F(n){var t=n.__.__c;return t&&t.__a&&t.__a(n)}function V(){this.u=null,this.o=null;}l$1.unmount=function(n){var t=n.__c;t&&t.__R&&t.__R(),t&&!0===n.__h&&(n.type=null),I&&I(n);},(D.prototype=new d).__c=function(n,t){var e=t.__c,r=this;null==r.t&&(r.t=[]),r.t.push(e);var u=F(r.__v),o=!1,i=function(){o||(o=!0,e.__R=null,u?u(l):l());};e.__R=i;var l=function(){if(!--r.__u){if(r.state.__a){var n=r.state.__a;r.__v.__k[0]=U(n,n.__c.__P,n.__c.__O);}var t;for(r.setState({__a:r.__b=null});t=r.t.pop();)t.forceUpdate();}},c=!0===t.__h;r.__u++||c||r.setState({__a:r.__b=r.__v.__k[0]}),n.then(i,i);},D.prototype.componentWillUnmount=function(){this.t=[];},D.prototype.render=function(n,e){if(this.__b){if(this.__v.__k){var r=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=L(this.__b,r,o.__O=o.__P);}this.__b=null;}var i=e.__a&&h(p,null,n.fallback);return i&&(i.__h=null),[h(p,null,e.__a?null:n.children),i]};var W=function(n,t,e){if(++e[1]===e[0]&&n.o.delete(t),n.props.revealOrder&&("t"!==n.props.revealOrder[0]||!n.o.size))for(e=n.u;e;){for(;e.length>3;)e.pop()();if(e[1]<e[0])break;n.u=e=e[2];}};function P(n){return this.getChildContext=function(){return n.context},n.children}function $(n){var e=this,r=n.i;e.componentWillUnmount=function(){P$1(null,e.l),e.l=null,e.i=null;},e.i&&e.i!==r&&e.componentWillUnmount(),n.__v?(e.l||(e.i=r,e.l={nodeType:1,parentNode:r,childNodes:[],appendChild:function(n){this.childNodes.push(n),e.i.appendChild(n);},insertBefore:function(n,t){this.childNodes.push(n),e.i.appendChild(n);},removeChild:function(n){this.childNodes.splice(this.childNodes.indexOf(n)>>>1,1),e.i.removeChild(n);}}),P$1(h(P,{context:e.context},n.__v),e.l)):e.l&&e.componentWillUnmount();}function j(n,e){var r=h($,{__v:n,i:e});return r.containerInfo=e,r}(V.prototype=new d).__a=function(n){var t=this,e=F(t.__v),r=t.o.get(n);return r[0]++,function(u){var o=function(){t.props.revealOrder?(r.push(u),W(t,n,r)):u();};e?e(o):o();}},V.prototype.render=function(n){this.u=null,this.o=new Map;var t=x$1(n.children);n.revealOrder&&"b"===n.revealOrder[0]&&t.reverse();for(var e=t.length;e--;)this.o.set(t[e],this.u=[1,0,this.u]);return n.children},V.prototype.componentDidUpdate=V.prototype.componentDidMount=function(){var n=this;this.o.forEach(function(t,e){W(n,e,t);});};var z="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,B=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,H="undefined"!=typeof document,Z=function(n){return ("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/i:/fil|che|ra/i).test(n)};d.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(t){Object.defineProperty(d.prototype,t,{configurable:!0,get:function(){return this["UNSAFE_"+t]},set:function(n){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:n});}});});var G=l$1.event;function J(){}function K(){return this.cancelBubble}function Q(){return this.defaultPrevented}l$1.event=function(n){return G&&(n=G(n)),n.persist=J,n.isPropagationStopped=K,n.isDefaultPrevented=Q,n.nativeEvent=n};var nn={configurable:!0,get:function(){return this.class}},tn=l$1.vnode;l$1.vnode=function(n){var t=n.type,e=n.props,u=e;if("string"==typeof t){var o=-1===t.indexOf("-");for(var i in u={},e){var l=e[i];H&&"children"===i&&"noscript"===t||"value"===i&&"defaultValue"in e&&null==l||("defaultValue"===i&&"value"in e&&null==e.value?i="value":"download"===i&&!0===l?l="":/ondoubleclick/i.test(i)?i="ondblclick":/^onchange(textarea|input)/i.test(i+t)&&!Z(e.type)?i="oninput":/^onfocus$/i.test(i)?i="onfocusin":/^onblur$/i.test(i)?i="onfocusout":/^on(Ani|Tra|Tou|BeforeInp|Compo)/.test(i)?i=i.toLowerCase():o&&B.test(i)?i=i.replace(/[A-Z0-9]/g,"-$&").toLowerCase():null===l&&(l=void 0),/^oninput$/i.test(i)&&(i=i.toLowerCase(),u[i]&&(i="oninputCapture")),u[i]=l);}"select"==t&&u.multiple&&Array.isArray(u.value)&&(u.value=x$1(e.children).forEach(function(n){n.props.selected=-1!=u.value.indexOf(n.props.value);})),"select"==t&&null!=u.defaultValue&&(u.value=x$1(e.children).forEach(function(n){n.props.selected=u.multiple?-1!=u.defaultValue.indexOf(n.props.value):u.defaultValue==n.props.value;})),n.props=u,e.class!=e.className&&(nn.enumerable="className"in e,null!=e.className&&(u.class=e.className),Object.defineProperty(u,"className",nn));}n.$$typeof=z,tn&&tn(n);};var en=l$1.__r;l$1.__r=function(n){en&&en(n),n.__c;}; + + function injectStyles(css) { + if (!css || typeof document === 'undefined') { + return; + } + const head = document.head || document.getElementsByTagName('head')[0]; + const style = document.createElement('style'); + style.type = 'text/css'; + head.appendChild(style); + if (style.styleSheet) { + style.styleSheet.cssText = css; + } + else { + style.appendChild(document.createTextNode(css)); + } + } + + class DelayedRunner { + constructor(drainedOption) { + this.drainedOption = drainedOption; + this.isRunning = false; + this.isDirty = false; + this.pauseDepths = {}; + this.timeoutId = 0; + } + request(delay) { + this.isDirty = true; + if (!this.isPaused()) { + this.clearTimeout(); + if (delay == null) { + this.tryDrain(); + } + else { + this.timeoutId = setTimeout(// NOT OPTIMAL! TODO: look at debounce + this.tryDrain.bind(this), delay); + } + } + } + pause(scope = '') { + let { pauseDepths } = this; + pauseDepths[scope] = (pauseDepths[scope] || 0) + 1; + this.clearTimeout(); + } + resume(scope = '', force) { + let { pauseDepths } = this; + if (scope in pauseDepths) { + if (force) { + delete pauseDepths[scope]; + } + else { + pauseDepths[scope] -= 1; + let depth = pauseDepths[scope]; + if (depth <= 0) { + delete pauseDepths[scope]; + } + } + this.tryDrain(); + } + } + isPaused() { + return Object.keys(this.pauseDepths).length; + } + tryDrain() { + if (!this.isRunning && !this.isPaused()) { + this.isRunning = true; + while (this.isDirty) { + this.isDirty = false; + this.drained(); // might set isDirty to true again + } + this.isRunning = false; + } + } + clear() { + this.clearTimeout(); + this.isDirty = false; + this.pauseDepths = {}; + } + clearTimeout() { + if (this.timeoutId) { + clearTimeout(this.timeoutId); + this.timeoutId = 0; + } + } + drained() { + if (this.drainedOption) { + this.drainedOption(); + } + } + } + + const { hasOwnProperty } = Object.prototype; + // Merges an array of objects into a single object. + // The second argument allows for an array of property names who's object values will be merged together. + function mergeProps(propObjs, complexPropsMap) { + let dest = {}; + if (complexPropsMap) { + for (let name in complexPropsMap) { + let complexObjs = []; + // collect the trailing object values, stopping when a non-object is discovered + for (let i = propObjs.length - 1; i >= 0; i -= 1) { + let val = propObjs[i][name]; + if (typeof val === 'object' && val) { // non-null object + complexObjs.unshift(val); + } + else if (val !== undefined) { + dest[name] = val; // if there were no objects, this value will be used + break; + } + } + // if the trailing values were objects, use the merged value + if (complexObjs.length) { + dest[name] = mergeProps(complexObjs); + } + } + } + // copy values into the destination, going from last to first + for (let i = propObjs.length - 1; i >= 0; i -= 1) { + let props = propObjs[i]; + for (let name in props) { + if (!(name in dest)) { // if already assigned by previous props or complex props, don't reassign + dest[name] = props[name]; + } + } + } + return dest; + } + function filterHash(hash, func) { + let filtered = {}; + for (let key in hash) { + if (func(hash[key], key)) { + filtered[key] = hash[key]; + } + } + return filtered; + } + function mapHash(hash, func) { + let newHash = {}; + for (let key in hash) { + newHash[key] = func(hash[key], key); + } + return newHash; + } + function arrayToHash(a) { + let hash = {}; + for (let item of a) { + hash[item] = true; + } + return hash; + } + // TODO: reassess browser support + // https://caniuse.com/?search=object.values + function hashValuesToArray(obj) { + let a = []; + for (let key in obj) { + a.push(obj[key]); + } + return a; + } + function isPropsEqual(obj0, obj1) { + if (obj0 === obj1) { + return true; + } + for (let key in obj0) { + if (hasOwnProperty.call(obj0, key)) { + if (!(key in obj1)) { + return false; + } + } + } + for (let key in obj1) { + if (hasOwnProperty.call(obj1, key)) { + if (obj0[key] !== obj1[key]) { + return false; + } + } + } + return true; + } + const HANDLER_RE = /^on[A-Z]/; + function isNonHandlerPropsEqual(obj0, obj1) { + const keys = getUnequalProps(obj0, obj1); + for (let key of keys) { + if (!HANDLER_RE.test(key)) { + return false; + } + } + return true; + } + function getUnequalProps(obj0, obj1) { + let keys = []; + for (let key in obj0) { + if (hasOwnProperty.call(obj0, key)) { + if (!(key in obj1)) { + keys.push(key); + } + } + } + for (let key in obj1) { + if (hasOwnProperty.call(obj1, key)) { + if (obj0[key] !== obj1[key]) { + keys.push(key); + } + } + } + return keys; + } + function compareObjs(oldProps, newProps, equalityFuncs = {}) { + if (oldProps === newProps) { + return true; + } + for (let key in newProps) { + if (key in oldProps && isObjValsEqual(oldProps[key], newProps[key], equalityFuncs[key])) ; + else { + return false; + } + } + // check for props that were omitted in the new + for (let key in oldProps) { + if (!(key in newProps)) { + return false; + } + } + return true; + } + /* + assumed "true" equality for handler names like "onReceiveSomething" + */ + function isObjValsEqual(val0, val1, comparator) { + if (val0 === val1 || comparator === true) { + return true; + } + if (comparator) { + return comparator(val0, val1); + } + return false; + } + function collectFromHash(hash, startIndex = 0, endIndex, step = 1) { + let res = []; + if (endIndex == null) { + endIndex = Object.keys(hash).length; + } + for (let i = startIndex; i < endIndex; i += step) { + let val = hash[i]; + if (val !== undefined) { // will disregard undefined for sparse arrays + res.push(val); + } + } + return res; + } + + // TODO: new util arrayify? + function removeExact(array, exactVal) { + let removeCnt = 0; + let i = 0; + while (i < array.length) { + if (array[i] === exactVal) { + array.splice(i, 1); + removeCnt += 1; + } + else { + i += 1; + } + } + return removeCnt; + } + function isArraysEqual(a0, a1, equalityFunc) { + if (a0 === a1) { + return true; + } + let len = a0.length; + let i; + if (len !== a1.length) { // not array? or not same length? + return false; + } + for (i = 0; i < len; i += 1) { + if (!(equalityFunc ? equalityFunc(a0[i], a1[i]) : a0[i] === a1[i])) { + return false; + } + } + return true; + } + + function memoize(workerFunc, resEquality, teardownFunc) { + let currentArgs; + let currentRes; + return function (...newArgs) { + if (!currentArgs) { + currentRes = workerFunc.apply(this, newArgs); + } + else if (!isArraysEqual(currentArgs, newArgs)) { + if (teardownFunc) { + teardownFunc(currentRes); + } + let res = workerFunc.apply(this, newArgs); + if (!resEquality || !resEquality(res, currentRes)) { + currentRes = res; + } + } + currentArgs = newArgs; + return currentRes; + }; + } + function memoizeObjArg(workerFunc, resEquality, teardownFunc) { + let currentArg; + let currentRes; + return (newArg) => { + if (!currentArg) { + currentRes = workerFunc.call(this, newArg); + } + else if (!isPropsEqual(currentArg, newArg)) { + if (teardownFunc) { + teardownFunc(currentRes); + } + let res = workerFunc.call(this, newArg); + if (!resEquality || !resEquality(res, currentRes)) { + currentRes = res; + } + } + currentArg = newArg; + return currentRes; + }; + } + function memoizeArraylike(// used at all? + workerFunc, resEquality, teardownFunc) { + let currentArgSets = []; + let currentResults = []; + return (newArgSets) => { + let currentLen = currentArgSets.length; + let newLen = newArgSets.length; + let i = 0; + for (; i < currentLen; i += 1) { + if (!newArgSets[i]) { // one of the old sets no longer exists + if (teardownFunc) { + teardownFunc(currentResults[i]); + } + } + else if (!isArraysEqual(currentArgSets[i], newArgSets[i])) { + if (teardownFunc) { + teardownFunc(currentResults[i]); + } + let res = workerFunc.apply(this, newArgSets[i]); + if (!resEquality || !resEquality(res, currentResults[i])) { + currentResults[i] = res; + } + } + } + for (; i < newLen; i += 1) { + currentResults[i] = workerFunc.apply(this, newArgSets[i]); + } + currentArgSets = newArgSets; + currentResults.splice(newLen); // remove excess + return currentResults; + }; + } + function memoizeHashlike(workerFunc, resEquality, teardownFunc) { + let currentArgHash = {}; + let currentResHash = {}; + return (newArgHash) => { + let newResHash = {}; + for (let key in newArgHash) { + if (!currentResHash[key]) { + newResHash[key] = workerFunc.apply(this, newArgHash[key]); + } + else if (!isArraysEqual(currentArgHash[key], newArgHash[key])) { + if (teardownFunc) { + teardownFunc(currentResHash[key]); + } + let res = workerFunc.apply(this, newArgHash[key]); + newResHash[key] = (resEquality && resEquality(res, currentResHash[key])) + ? currentResHash[key] + : res; + } + else { + newResHash[key] = currentResHash[key]; + } + } + currentArgHash = newArgHash; + currentResHash = newResHash; + return newResHash; + }; + } + + function removeElement(el) { + if (el.parentNode) { + el.parentNode.removeChild(el); + } + } + // Querying + // ---------------------------------------------------------------------------------------------------------------- + function elementClosest(el, selector) { + if (el.closest) { + return el.closest(selector); + // really bad fallback for IE + // from https://developer.mozilla.org/en-US/docs/Web/API/Element/closest + } + if (!document.documentElement.contains(el)) { + return null; + } + do { + if (elementMatches(el, selector)) { + return el; + } + el = (el.parentElement || el.parentNode); + } while (el !== null && el.nodeType === 1); + return null; + } + function elementMatches(el, selector) { + let method = el.matches || el.matchesSelector || el.msMatchesSelector; + return method.call(el, selector); + } + // accepts multiple subject els + // returns a real array. good for methods like forEach + // TODO: accept the document + function findElements(container, selector) { + let containers = container instanceof HTMLElement ? [container] : container; + let allMatches = []; + for (let i = 0; i < containers.length; i += 1) { + let matches = containers[i].querySelectorAll(selector); + for (let j = 0; j < matches.length; j += 1) { + allMatches.push(matches[j]); + } + } + return allMatches; + } + // accepts multiple subject els + // only queries direct child elements // TODO: rename to findDirectChildren! + function findDirectChildren(parent, selector) { + let parents = parent instanceof HTMLElement ? [parent] : parent; + let allMatches = []; + for (let i = 0; i < parents.length; i += 1) { + let childNodes = parents[i].children; // only ever elements + for (let j = 0; j < childNodes.length; j += 1) { + let childNode = childNodes[j]; + if (!selector || elementMatches(childNode, selector)) { + allMatches.push(childNode); + } + } + } + return allMatches; + } + // Style + // ---------------------------------------------------------------------------------------------------------------- + const PIXEL_PROP_RE = /(top|left|right|bottom|width|height)$/i; + function applyStyle(el, props) { + for (let propName in props) { + applyStyleProp(el, propName, props[propName]); + } + } + function applyStyleProp(el, name, val) { + if (val == null) { + el.style[name] = ''; + } + else if (typeof val === 'number' && PIXEL_PROP_RE.test(name)) { + el.style[name] = `${val}px`; + } + else { + el.style[name] = val; + } + } + // Event Handling + // ---------------------------------------------------------------------------------------------------------------- + // if intercepting bubbled events at the document/window/body level, + // and want to see originating element (the 'target'), use this util instead + // of `ev.target` because it goes within web-component boundaries. + function getEventTargetViaRoot(ev) { + var _a, _b; + return (_b = (_a = ev.composedPath) === null || _a === void 0 ? void 0 : _a.call(ev)[0]) !== null && _b !== void 0 ? _b : ev.target; + } + // Shadow DOM consuderations + // ---------------------------------------------------------------------------------------------------------------- + function getElRoot(el) { + return el.getRootNode ? el.getRootNode() : document; + } + // Unique ID for DOM attribute + let guid$1 = 0; + function getUniqueDomId() { + guid$1 += 1; + return 'fc-dom-' + guid$1; + } + + // Stops a mouse/touch event from doing it's native browser action + function preventDefault(ev) { + ev.preventDefault(); + } + // Event Delegation + // ---------------------------------------------------------------------------------------------------------------- + function buildDelegationHandler(selector, handler) { + return (ev) => { + let matchedChild = elementClosest(ev.target, selector); + if (matchedChild) { + handler.call(matchedChild, ev, matchedChild); + } + }; + } + function listenBySelector(container, eventType, selector, handler) { + let attachedHandler = buildDelegationHandler(selector, handler); + container.addEventListener(eventType, attachedHandler); + return () => { + container.removeEventListener(eventType, attachedHandler); + }; + } + function listenToHoverBySelector(container, selector, onMouseEnter, onMouseLeave) { + let currentMatchedChild; + return listenBySelector(container, 'mouseover', selector, (mouseOverEv, matchedChild) => { + if (matchedChild !== currentMatchedChild) { + currentMatchedChild = matchedChild; + onMouseEnter(mouseOverEv, matchedChild); + let realOnMouseLeave = (mouseLeaveEv) => { + currentMatchedChild = null; + onMouseLeave(mouseLeaveEv, matchedChild); + matchedChild.removeEventListener('mouseleave', realOnMouseLeave); + }; + // listen to the next mouseleave, and then unattach + matchedChild.addEventListener('mouseleave', realOnMouseLeave); + } + }); + } + // Animation + // ---------------------------------------------------------------------------------------------------------------- + const transitionEventNames = [ + 'webkitTransitionEnd', + 'otransitionend', + 'oTransitionEnd', + 'msTransitionEnd', + 'transitionend', + ]; + // triggered only when the next single subsequent transition finishes + function whenTransitionDone(el, callback) { + let realCallback = (ev) => { + callback(ev); + transitionEventNames.forEach((eventName) => { + el.removeEventListener(eventName, realCallback); + }); + }; + transitionEventNames.forEach((eventName) => { + el.addEventListener(eventName, realCallback); // cross-browser way to determine when the transition finishes + }); + } + // ARIA workarounds + // ---------------------------------------------------------------------------------------------------------------- + function createAriaClickAttrs(handler) { + return Object.assign({ onClick: handler }, createAriaKeyboardAttrs(handler)); + } + function createAriaKeyboardAttrs(handler) { + return { + tabIndex: 0, + onKeyDown(ev) { + if (ev.key === 'Enter' || ev.key === ' ') { + handler(ev); + ev.preventDefault(); // if space, don't scroll down page + } + }, + }; + } + + let guidNumber = 0; + function guid() { + guidNumber += 1; + return String(guidNumber); + } + /* FullCalendar-specific DOM Utilities + ----------------------------------------------------------------------------------------------------------------------*/ + // Make the mouse cursor express that an event is not allowed in the current area + function disableCursor() { + document.body.classList.add('fc-not-allowed'); + } + // Returns the mouse cursor to its original look + function enableCursor() { + document.body.classList.remove('fc-not-allowed'); + } + /* Selection + ----------------------------------------------------------------------------------------------------------------------*/ + function preventSelection(el) { + el.classList.add('fc-unselectable'); + el.addEventListener('selectstart', preventDefault); + } + function allowSelection(el) { + el.classList.remove('fc-unselectable'); + el.removeEventListener('selectstart', preventDefault); + } + /* Context Menu + ----------------------------------------------------------------------------------------------------------------------*/ + function preventContextMenu(el) { + el.addEventListener('contextmenu', preventDefault); + } + function allowContextMenu(el) { + el.removeEventListener('contextmenu', preventDefault); + } + function parseFieldSpecs(input) { + let specs = []; + let tokens = []; + let i; + let token; + if (typeof input === 'string') { + tokens = input.split(/\s*,\s*/); + } + else if (typeof input === 'function') { + tokens = [input]; + } + else if (Array.isArray(input)) { + tokens = input; + } + for (i = 0; i < tokens.length; i += 1) { + token = tokens[i]; + if (typeof token === 'string') { + specs.push(token.charAt(0) === '-' ? + { field: token.substring(1), order: -1 } : + { field: token, order: 1 }); + } + else if (typeof token === 'function') { + specs.push({ func: token }); + } + } + return specs; + } + function compareByFieldSpecs(obj0, obj1, fieldSpecs) { + let i; + let cmp; + for (i = 0; i < fieldSpecs.length; i += 1) { + cmp = compareByFieldSpec(obj0, obj1, fieldSpecs[i]); + if (cmp) { + return cmp; + } + } + return 0; + } + function compareByFieldSpec(obj0, obj1, fieldSpec) { + if (fieldSpec.func) { + return fieldSpec.func(obj0, obj1); + } + return flexibleCompare(obj0[fieldSpec.field], obj1[fieldSpec.field]) + * (fieldSpec.order || 1); + } + function flexibleCompare(a, b) { + if (!a && !b) { + return 0; + } + if (b == null) { + return -1; + } + if (a == null) { + return 1; + } + if (typeof a === 'string' || typeof b === 'string') { + return String(a).localeCompare(String(b)); + } + return a - b; + } + /* String Utilities + ----------------------------------------------------------------------------------------------------------------------*/ + function padStart(val, len) { + let s = String(val); + return '000'.substr(0, len - s.length) + s; + } + function formatWithOrdinals(formatter, args, fallbackText) { + if (typeof formatter === 'function') { + return formatter(...args); + } + if (typeof formatter === 'string') { // non-blank string + return args.reduce((str, arg, index) => (str.replace('$' + index, arg || '')), formatter); + } + return fallbackText; + } + /* Number Utilities + ----------------------------------------------------------------------------------------------------------------------*/ + function compareNumbers(a, b) { + return a - b; + } + function isInt(n) { + return n % 1 === 0; + } + /* FC-specific DOM dimension stuff + ----------------------------------------------------------------------------------------------------------------------*/ + function computeSmallestCellWidth(cellEl) { + let allWidthEl = cellEl.querySelector('.fc-scrollgrid-shrink-frame'); + let contentWidthEl = cellEl.querySelector('.fc-scrollgrid-shrink-cushion'); + if (!allWidthEl) { + throw new Error('needs fc-scrollgrid-shrink-frame className'); // TODO: use const + } + if (!contentWidthEl) { + throw new Error('needs fc-scrollgrid-shrink-cushion className'); + } + return cellEl.getBoundingClientRect().width - allWidthEl.getBoundingClientRect().width + // the cell padding+border + contentWidthEl.getBoundingClientRect().width; + } + + const DAY_IDS = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat']; + // Adding + function addWeeks(m, n) { + let a = dateToUtcArray(m); + a[2] += n * 7; + return arrayToUtcDate(a); + } + function addDays(m, n) { + let a = dateToUtcArray(m); + a[2] += n; + return arrayToUtcDate(a); + } + function addMs(m, n) { + let a = dateToUtcArray(m); + a[6] += n; + return arrayToUtcDate(a); + } + // Diffing (all return floats) + // TODO: why not use ranges? + function diffWeeks(m0, m1) { + return diffDays(m0, m1) / 7; + } + function diffDays(m0, m1) { + return (m1.valueOf() - m0.valueOf()) / (1000 * 60 * 60 * 24); + } + function diffHours(m0, m1) { + return (m1.valueOf() - m0.valueOf()) / (1000 * 60 * 60); + } + function diffMinutes(m0, m1) { + return (m1.valueOf() - m0.valueOf()) / (1000 * 60); + } + function diffSeconds(m0, m1) { + return (m1.valueOf() - m0.valueOf()) / 1000; + } + function diffDayAndTime(m0, m1) { + let m0day = startOfDay(m0); + let m1day = startOfDay(m1); + return { + years: 0, + months: 0, + days: Math.round(diffDays(m0day, m1day)), + milliseconds: (m1.valueOf() - m1day.valueOf()) - (m0.valueOf() - m0day.valueOf()), + }; + } + // Diffing Whole Units + function diffWholeWeeks(m0, m1) { + let d = diffWholeDays(m0, m1); + if (d !== null && d % 7 === 0) { + return d / 7; + } + return null; + } + function diffWholeDays(m0, m1) { + if (timeAsMs(m0) === timeAsMs(m1)) { + return Math.round(diffDays(m0, m1)); + } + return null; + } + // Start-Of + function startOfDay(m) { + return arrayToUtcDate([ + m.getUTCFullYear(), + m.getUTCMonth(), + m.getUTCDate(), + ]); + } + function startOfHour(m) { + return arrayToUtcDate([ + m.getUTCFullYear(), + m.getUTCMonth(), + m.getUTCDate(), + m.getUTCHours(), + ]); + } + function startOfMinute(m) { + return arrayToUtcDate([ + m.getUTCFullYear(), + m.getUTCMonth(), + m.getUTCDate(), + m.getUTCHours(), + m.getUTCMinutes(), + ]); + } + function startOfSecond(m) { + return arrayToUtcDate([ + m.getUTCFullYear(), + m.getUTCMonth(), + m.getUTCDate(), + m.getUTCHours(), + m.getUTCMinutes(), + m.getUTCSeconds(), + ]); + } + // Week Computation + function weekOfYear(marker, dow, doy) { + let y = marker.getUTCFullYear(); + let w = weekOfGivenYear(marker, y, dow, doy); + if (w < 1) { + return weekOfGivenYear(marker, y - 1, dow, doy); + } + let nextW = weekOfGivenYear(marker, y + 1, dow, doy); + if (nextW >= 1) { + return Math.min(w, nextW); + } + return w; + } + function weekOfGivenYear(marker, year, dow, doy) { + let firstWeekStart = arrayToUtcDate([year, 0, 1 + firstWeekOffset(year, dow, doy)]); + let dayStart = startOfDay(marker); + let days = Math.round(diffDays(firstWeekStart, dayStart)); + return Math.floor(days / 7) + 1; // zero-indexed + } + // start-of-first-week - start-of-year + function firstWeekOffset(year, dow, doy) { + // first-week day -- which january is always in the first week (4 for iso, 1 for other) + let fwd = 7 + dow - doy; + // first-week day local weekday -- which local weekday is fwd + let fwdlw = (7 + arrayToUtcDate([year, 0, fwd]).getUTCDay() - dow) % 7; + return -fwdlw + fwd - 1; + } + // Array Conversion + function dateToLocalArray(date) { + return [ + date.getFullYear(), + date.getMonth(), + date.getDate(), + date.getHours(), + date.getMinutes(), + date.getSeconds(), + date.getMilliseconds(), + ]; + } + function arrayToLocalDate(a) { + return new Date(a[0], a[1] || 0, a[2] == null ? 1 : a[2], // day of month + a[3] || 0, a[4] || 0, a[5] || 0); + } + function dateToUtcArray(date) { + return [ + date.getUTCFullYear(), + date.getUTCMonth(), + date.getUTCDate(), + date.getUTCHours(), + date.getUTCMinutes(), + date.getUTCSeconds(), + date.getUTCMilliseconds(), + ]; + } + function arrayToUtcDate(a) { + // according to web standards (and Safari), a month index is required. + // massage if only given a year. + if (a.length === 1) { + a = a.concat([0]); + } + return new Date(Date.UTC(...a)); + } + // Other Utils + function isValidDate$1(m) { + return !isNaN(m.valueOf()); + } + function timeAsMs(m) { + return m.getUTCHours() * 1000 * 60 * 60 + + m.getUTCMinutes() * 1000 * 60 + + m.getUTCSeconds() * 1000 + + m.getUTCMilliseconds(); + } + + let calendarSystemClassMap = {}; + function registerCalendarSystem(name, theClass) { + calendarSystemClassMap[name] = theClass; + } + function createCalendarSystem(name) { + return new calendarSystemClassMap[name](); + } + class GregorianCalendarSystem { + getMarkerYear(d) { + return d.getUTCFullYear(); + } + getMarkerMonth(d) { + return d.getUTCMonth(); + } + getMarkerDay(d) { + return d.getUTCDate(); + } + arrayToMarker(arr) { + return arrayToUtcDate(arr); + } + markerToArray(marker) { + return dateToUtcArray(marker); + } + } + registerCalendarSystem('gregory', GregorianCalendarSystem); + + const INTERNAL_UNITS = ['years', 'months', 'days', 'milliseconds']; + const PARSE_RE = /^(-?)(?:(\d+)\.)?(\d+):(\d\d)(?::(\d\d)(?:\.(\d\d\d))?)?/; + // Parsing and Creation + function createDuration(input, unit) { + if (typeof input === 'string') { + return parseString(input); + } + if (typeof input === 'object' && input) { // non-null object + return parseObject(input); + } + if (typeof input === 'number') { + return parseObject({ [unit || 'milliseconds']: input }); + } + return null; + } + function parseString(s) { + let m = PARSE_RE.exec(s); + if (m) { + let sign = m[1] ? -1 : 1; + return { + years: 0, + months: 0, + days: sign * (m[2] ? parseInt(m[2], 10) : 0), + milliseconds: sign * ((m[3] ? parseInt(m[3], 10) : 0) * 60 * 60 * 1000 + // hours + (m[4] ? parseInt(m[4], 10) : 0) * 60 * 1000 + // minutes + (m[5] ? parseInt(m[5], 10) : 0) * 1000 + // seconds + (m[6] ? parseInt(m[6], 10) : 0) // ms + ), + }; + } + return null; + } + function parseObject(obj) { + let duration = { + years: obj.years || obj.year || 0, + months: obj.months || obj.month || 0, + days: obj.days || obj.day || 0, + milliseconds: (obj.hours || obj.hour || 0) * 60 * 60 * 1000 + // hours + (obj.minutes || obj.minute || 0) * 60 * 1000 + // minutes + (obj.seconds || obj.second || 0) * 1000 + // seconds + (obj.milliseconds || obj.millisecond || obj.ms || 0), // ms + }; + let weeks = obj.weeks || obj.week; + if (weeks) { + duration.days += weeks * 7; + duration.specifiedWeeks = true; + } + return duration; + } + // Equality + function durationsEqual(d0, d1) { + return d0.years === d1.years && + d0.months === d1.months && + d0.days === d1.days && + d0.milliseconds === d1.milliseconds; + } + function asCleanDays(dur) { + if (!dur.years && !dur.months && !dur.milliseconds) { + return dur.days; + } + return 0; + } + // Simple Math + function addDurations(d0, d1) { + return { + years: d0.years + d1.years, + months: d0.months + d1.months, + days: d0.days + d1.days, + milliseconds: d0.milliseconds + d1.milliseconds, + }; + } + function subtractDurations(d1, d0) { + return { + years: d1.years - d0.years, + months: d1.months - d0.months, + days: d1.days - d0.days, + milliseconds: d1.milliseconds - d0.milliseconds, + }; + } + function multiplyDuration(d, n) { + return { + years: d.years * n, + months: d.months * n, + days: d.days * n, + milliseconds: d.milliseconds * n, + }; + } + // Conversions + // "Rough" because they are based on average-case Gregorian months/years + function asRoughYears(dur) { + return asRoughDays(dur) / 365; + } + function asRoughMonths(dur) { + return asRoughDays(dur) / 30; + } + function asRoughDays(dur) { + return asRoughMs(dur) / 864e5; + } + function asRoughMinutes(dur) { + return asRoughMs(dur) / (1000 * 60); + } + function asRoughSeconds(dur) { + return asRoughMs(dur) / 1000; + } + function asRoughMs(dur) { + return dur.years * (365 * 864e5) + + dur.months * (30 * 864e5) + + dur.days * 864e5 + + dur.milliseconds; + } + // Advanced Math + function wholeDivideDurations(numerator, denominator) { + let res = null; + for (let i = 0; i < INTERNAL_UNITS.length; i += 1) { + let unit = INTERNAL_UNITS[i]; + if (denominator[unit]) { + let localRes = numerator[unit] / denominator[unit]; + if (!isInt(localRes) || (res !== null && res !== localRes)) { + return null; + } + res = localRes; + } + else if (numerator[unit]) { + // needs to divide by something but can't! + return null; + } + } + return res; + } + function greatestDurationDenominator(dur) { + let ms = dur.milliseconds; + if (ms) { + if (ms % 1000 !== 0) { + return { unit: 'millisecond', value: ms }; + } + if (ms % (1000 * 60) !== 0) { + return { unit: 'second', value: ms / 1000 }; + } + if (ms % (1000 * 60 * 60) !== 0) { + return { unit: 'minute', value: ms / (1000 * 60) }; + } + if (ms) { + return { unit: 'hour', value: ms / (1000 * 60 * 60) }; + } + } + if (dur.days) { + if (dur.specifiedWeeks && dur.days % 7 === 0) { + return { unit: 'week', value: dur.days / 7 }; + } + return { unit: 'day', value: dur.days }; + } + if (dur.months) { + return { unit: 'month', value: dur.months }; + } + if (dur.years) { + return { unit: 'year', value: dur.years }; + } + return { unit: 'millisecond', value: 0 }; + } + + // timeZoneOffset is in minutes + function buildIsoString(marker, timeZoneOffset, stripZeroTime = false) { + let s = marker.toISOString(); + s = s.replace('.000', ''); + if (stripZeroTime) { + s = s.replace('T00:00:00Z', ''); + } + if (s.length > 10) { // time part wasn't stripped, can add timezone info + if (timeZoneOffset == null) { + s = s.replace('Z', ''); + } + else if (timeZoneOffset !== 0) { + s = s.replace('Z', formatTimeZoneOffset(timeZoneOffset, true)); + } + // otherwise, its UTC-0 and we want to keep the Z + } + return s; + } + // formats the date, but with no time part + // TODO: somehow merge with buildIsoString and stripZeroTime + // TODO: rename. omit "string" + function formatDayString(marker) { + return marker.toISOString().replace(/T.*$/, ''); + } + // TODO: use Date::toISOString and use everything after the T? + function formatIsoTimeString(marker) { + return padStart(marker.getUTCHours(), 2) + ':' + + padStart(marker.getUTCMinutes(), 2) + ':' + + padStart(marker.getUTCSeconds(), 2); + } + function formatTimeZoneOffset(minutes, doIso = false) { + let sign = minutes < 0 ? '-' : '+'; + let abs = Math.abs(minutes); + let hours = Math.floor(abs / 60); + let mins = Math.round(abs % 60); + if (doIso) { + return `${sign + padStart(hours, 2)}:${padStart(mins, 2)}`; + } + return `GMT${sign}${hours}${mins ? `:${padStart(mins, 2)}` : ''}`; + } + + const ISO_RE = /^\s*(\d{4})(-?(\d{2})(-?(\d{2})([T ](\d{2}):?(\d{2})(:?(\d{2})(\.(\d+))?)?(Z|(([-+])(\d{2})(:?(\d{2}))?))?)?)?)?$/; + function parse(str) { + let m = ISO_RE.exec(str); + if (m) { + let marker = new Date(Date.UTC(Number(m[1]), m[3] ? Number(m[3]) - 1 : 0, Number(m[5] || 1), Number(m[7] || 0), Number(m[8] || 0), Number(m[10] || 0), m[12] ? Number(`0.${m[12]}`) * 1000 : 0)); + if (isValidDate$1(marker)) { + let timeZoneOffset = null; + if (m[13]) { + timeZoneOffset = (m[15] === '-' ? -1 : 1) * (Number(m[16] || 0) * 60 + + Number(m[18] || 0)); + } + return { + marker, + isTimeUnspecified: !m[6], + timeZoneOffset, + }; + } + } + return null; + } + + class DateEnv { + constructor(settings) { + let timeZone = this.timeZone = settings.timeZone; + let isNamedTimeZone = timeZone !== 'local' && timeZone !== 'UTC'; + if (settings.namedTimeZoneImpl && isNamedTimeZone) { + this.namedTimeZoneImpl = new settings.namedTimeZoneImpl(timeZone); + } + this.canComputeOffset = Boolean(!isNamedTimeZone || this.namedTimeZoneImpl); + this.calendarSystem = createCalendarSystem(settings.calendarSystem); + this.locale = settings.locale; + this.weekDow = settings.locale.week.dow; + this.weekDoy = settings.locale.week.doy; + if (settings.weekNumberCalculation === 'ISO') { + this.weekDow = 1; + this.weekDoy = 4; + } + if (typeof settings.firstDay === 'number') { + this.weekDow = settings.firstDay; + } + if (typeof settings.weekNumberCalculation === 'function') { + this.weekNumberFunc = settings.weekNumberCalculation; + } + this.weekText = settings.weekText != null ? settings.weekText : settings.locale.options.weekText; + this.weekTextLong = (settings.weekTextLong != null ? settings.weekTextLong : settings.locale.options.weekTextLong) || this.weekText; + this.cmdFormatter = settings.cmdFormatter; + this.defaultSeparator = settings.defaultSeparator; + } + // Creating / Parsing + createMarker(input) { + let meta = this.createMarkerMeta(input); + if (meta === null) { + return null; + } + return meta.marker; + } + createNowMarker() { + if (this.canComputeOffset) { + return this.timestampToMarker(new Date().valueOf()); + } + // if we can't compute the current date val for a timezone, + // better to give the current local date vals than UTC + return arrayToUtcDate(dateToLocalArray(new Date())); + } + createMarkerMeta(input) { + if (typeof input === 'string') { + return this.parse(input); + } + let marker = null; + if (typeof input === 'number') { + marker = this.timestampToMarker(input); + } + else if (input instanceof Date) { + input = input.valueOf(); + if (!isNaN(input)) { + marker = this.timestampToMarker(input); + } + } + else if (Array.isArray(input)) { + marker = arrayToUtcDate(input); + } + if (marker === null || !isValidDate$1(marker)) { + return null; + } + return { marker, isTimeUnspecified: false, forcedTzo: null }; + } + parse(s) { + let parts = parse(s); + if (parts === null) { + return null; + } + let { marker } = parts; + let forcedTzo = null; + if (parts.timeZoneOffset !== null) { + if (this.canComputeOffset) { + marker = this.timestampToMarker(marker.valueOf() - parts.timeZoneOffset * 60 * 1000); + } + else { + forcedTzo = parts.timeZoneOffset; + } + } + return { marker, isTimeUnspecified: parts.isTimeUnspecified, forcedTzo }; + } + // Accessors + getYear(marker) { + return this.calendarSystem.getMarkerYear(marker); + } + getMonth(marker) { + return this.calendarSystem.getMarkerMonth(marker); + } + // Adding / Subtracting + add(marker, dur) { + let a = this.calendarSystem.markerToArray(marker); + a[0] += dur.years; + a[1] += dur.months; + a[2] += dur.days; + a[6] += dur.milliseconds; + return this.calendarSystem.arrayToMarker(a); + } + subtract(marker, dur) { + let a = this.calendarSystem.markerToArray(marker); + a[0] -= dur.years; + a[1] -= dur.months; + a[2] -= dur.days; + a[6] -= dur.milliseconds; + return this.calendarSystem.arrayToMarker(a); + } + addYears(marker, n) { + let a = this.calendarSystem.markerToArray(marker); + a[0] += n; + return this.calendarSystem.arrayToMarker(a); + } + addMonths(marker, n) { + let a = this.calendarSystem.markerToArray(marker); + a[1] += n; + return this.calendarSystem.arrayToMarker(a); + } + // Diffing Whole Units + diffWholeYears(m0, m1) { + let { calendarSystem } = this; + if (timeAsMs(m0) === timeAsMs(m1) && + calendarSystem.getMarkerDay(m0) === calendarSystem.getMarkerDay(m1) && + calendarSystem.getMarkerMonth(m0) === calendarSystem.getMarkerMonth(m1)) { + return calendarSystem.getMarkerYear(m1) - calendarSystem.getMarkerYear(m0); + } + return null; + } + diffWholeMonths(m0, m1) { + let { calendarSystem } = this; + if (timeAsMs(m0) === timeAsMs(m1) && + calendarSystem.getMarkerDay(m0) === calendarSystem.getMarkerDay(m1)) { + return (calendarSystem.getMarkerMonth(m1) - calendarSystem.getMarkerMonth(m0)) + + (calendarSystem.getMarkerYear(m1) - calendarSystem.getMarkerYear(m0)) * 12; + } + return null; + } + // Range / Duration + greatestWholeUnit(m0, m1) { + let n = this.diffWholeYears(m0, m1); + if (n !== null) { + return { unit: 'year', value: n }; + } + n = this.diffWholeMonths(m0, m1); + if (n !== null) { + return { unit: 'month', value: n }; + } + n = diffWholeWeeks(m0, m1); + if (n !== null) { + return { unit: 'week', value: n }; + } + n = diffWholeDays(m0, m1); + if (n !== null) { + return { unit: 'day', value: n }; + } + n = diffHours(m0, m1); + if (isInt(n)) { + return { unit: 'hour', value: n }; + } + n = diffMinutes(m0, m1); + if (isInt(n)) { + return { unit: 'minute', value: n }; + } + n = diffSeconds(m0, m1); + if (isInt(n)) { + return { unit: 'second', value: n }; + } + return { unit: 'millisecond', value: m1.valueOf() - m0.valueOf() }; + } + countDurationsBetween(m0, m1, d) { + // TODO: can use greatestWholeUnit + let diff; + if (d.years) { + diff = this.diffWholeYears(m0, m1); + if (diff !== null) { + return diff / asRoughYears(d); + } + } + if (d.months) { + diff = this.diffWholeMonths(m0, m1); + if (diff !== null) { + return diff / asRoughMonths(d); + } + } + if (d.days) { + diff = diffWholeDays(m0, m1); + if (diff !== null) { + return diff / asRoughDays(d); + } + } + return (m1.valueOf() - m0.valueOf()) / asRoughMs(d); + } + // Start-Of + // these DON'T return zoned-dates. only UTC start-of dates + startOf(m, unit) { + if (unit === 'year') { + return this.startOfYear(m); + } + if (unit === 'month') { + return this.startOfMonth(m); + } + if (unit === 'week') { + return this.startOfWeek(m); + } + if (unit === 'day') { + return startOfDay(m); + } + if (unit === 'hour') { + return startOfHour(m); + } + if (unit === 'minute') { + return startOfMinute(m); + } + if (unit === 'second') { + return startOfSecond(m); + } + return null; + } + startOfYear(m) { + return this.calendarSystem.arrayToMarker([ + this.calendarSystem.getMarkerYear(m), + ]); + } + startOfMonth(m) { + return this.calendarSystem.arrayToMarker([ + this.calendarSystem.getMarkerYear(m), + this.calendarSystem.getMarkerMonth(m), + ]); + } + startOfWeek(m) { + return this.calendarSystem.arrayToMarker([ + this.calendarSystem.getMarkerYear(m), + this.calendarSystem.getMarkerMonth(m), + m.getUTCDate() - ((m.getUTCDay() - this.weekDow + 7) % 7), + ]); + } + // Week Number + computeWeekNumber(marker) { + if (this.weekNumberFunc) { + return this.weekNumberFunc(this.toDate(marker)); + } + return weekOfYear(marker, this.weekDow, this.weekDoy); + } + // TODO: choke on timeZoneName: long + format(marker, formatter, dateOptions = {}) { + return formatter.format({ + marker, + timeZoneOffset: dateOptions.forcedTzo != null ? + dateOptions.forcedTzo : + this.offsetForMarker(marker), + }, this); + } + formatRange(start, end, formatter, dateOptions = {}) { + if (dateOptions.isEndExclusive) { + end = addMs(end, -1); + } + return formatter.formatRange({ + marker: start, + timeZoneOffset: dateOptions.forcedStartTzo != null ? + dateOptions.forcedStartTzo : + this.offsetForMarker(start), + }, { + marker: end, + timeZoneOffset: dateOptions.forcedEndTzo != null ? + dateOptions.forcedEndTzo : + this.offsetForMarker(end), + }, this, dateOptions.defaultSeparator); + } + /* + DUMB: the omitTime arg is dumb. if we omit the time, we want to omit the timezone offset. and if we do that, + might as well use buildIsoString or some other util directly + */ + formatIso(marker, extraOptions = {}) { + let timeZoneOffset = null; + if (!extraOptions.omitTimeZoneOffset) { + if (extraOptions.forcedTzo != null) { + timeZoneOffset = extraOptions.forcedTzo; + } + else { + timeZoneOffset = this.offsetForMarker(marker); + } + } + return buildIsoString(marker, timeZoneOffset, extraOptions.omitTime); + } + // TimeZone + timestampToMarker(ms) { + if (this.timeZone === 'local') { + return arrayToUtcDate(dateToLocalArray(new Date(ms))); + } + if (this.timeZone === 'UTC' || !this.namedTimeZoneImpl) { + return new Date(ms); + } + return arrayToUtcDate(this.namedTimeZoneImpl.timestampToArray(ms)); + } + offsetForMarker(m) { + if (this.timeZone === 'local') { + return -arrayToLocalDate(dateToUtcArray(m)).getTimezoneOffset(); // convert "inverse" offset to "normal" offset + } + if (this.timeZone === 'UTC') { + return 0; + } + if (this.namedTimeZoneImpl) { + return this.namedTimeZoneImpl.offsetForArray(dateToUtcArray(m)); + } + return null; + } + // Conversion + toDate(m, forcedTzo) { + if (this.timeZone === 'local') { + return arrayToLocalDate(dateToUtcArray(m)); + } + if (this.timeZone === 'UTC') { + return new Date(m.valueOf()); // make sure it's a copy + } + if (!this.namedTimeZoneImpl) { + return new Date(m.valueOf() - (forcedTzo || 0)); + } + return new Date(m.valueOf() - + this.namedTimeZoneImpl.offsetForArray(dateToUtcArray(m)) * 1000 * 60); + } + } + + class Theme { + constructor(calendarOptions) { + if (this.iconOverrideOption) { + this.setIconOverride(calendarOptions[this.iconOverrideOption]); + } + } + setIconOverride(iconOverrideHash) { + let iconClassesCopy; + let buttonName; + if (typeof iconOverrideHash === 'object' && iconOverrideHash) { // non-null object + iconClassesCopy = Object.assign({}, this.iconClasses); + for (buttonName in iconOverrideHash) { + iconClassesCopy[buttonName] = this.applyIconOverridePrefix(iconOverrideHash[buttonName]); + } + this.iconClasses = iconClassesCopy; + } + else if (iconOverrideHash === false) { + this.iconClasses = {}; + } + } + applyIconOverridePrefix(className) { + let prefix = this.iconOverridePrefix; + if (prefix && className.indexOf(prefix) !== 0) { // if not already present + className = prefix + className; + } + return className; + } + getClass(key) { + return this.classes[key] || ''; + } + getIconClass(buttonName, isRtl) { + let className; + if (isRtl && this.rtlIconClasses) { + className = this.rtlIconClasses[buttonName] || this.iconClasses[buttonName]; + } + else { + className = this.iconClasses[buttonName]; + } + if (className) { + return `${this.baseIconClass} ${className}`; + } + return ''; + } + getCustomButtonIconClass(customButtonProps) { + let className; + if (this.iconOverrideCustomButtonOption) { + className = customButtonProps[this.iconOverrideCustomButtonOption]; + if (className) { + return `${this.baseIconClass} ${this.applyIconOverridePrefix(className)}`; + } + } + return ''; + } + } + Theme.prototype.classes = {}; + Theme.prototype.iconClasses = {}; + Theme.prototype.baseIconClass = ''; + Theme.prototype.iconOverridePrefix = ''; + + const EXTENDED_SETTINGS_AND_SEVERITIES = { + week: 3, + separator: 0, + omitZeroMinute: 0, + meridiem: 0, + omitCommas: 0, + }; + const STANDARD_DATE_PROP_SEVERITIES = { + timeZoneName: 7, + era: 6, + year: 5, + month: 4, + day: 2, + weekday: 2, + hour: 1, + minute: 1, + second: 1, + }; + const MERIDIEM_RE = /\s*([ap])\.?m\.?/i; // eats up leading spaces too + const COMMA_RE = /,/g; // we need re for globalness + const MULTI_SPACE_RE = /\s+/g; + const LTR_RE = /\u200e/g; // control character + const UTC_RE = /UTC|GMT/; + class NativeFormatter { + constructor(formatSettings) { + let standardDateProps = {}; + let extendedSettings = {}; + let severity = 0; + for (let name in formatSettings) { + if (name in EXTENDED_SETTINGS_AND_SEVERITIES) { + extendedSettings[name] = formatSettings[name]; + severity = Math.max(EXTENDED_SETTINGS_AND_SEVERITIES[name], severity); + } + else { + standardDateProps[name] = formatSettings[name]; + if (name in STANDARD_DATE_PROP_SEVERITIES) { // TODO: what about hour12? no severity + severity = Math.max(STANDARD_DATE_PROP_SEVERITIES[name], severity); + } + } + } + this.standardDateProps = standardDateProps; + this.extendedSettings = extendedSettings; + this.severity = severity; + this.buildFormattingFunc = memoize(buildFormattingFunc); + } + format(date, context) { + return this.buildFormattingFunc(this.standardDateProps, this.extendedSettings, context)(date); + } + formatRange(start, end, context, betterDefaultSeparator) { + let { standardDateProps, extendedSettings } = this; + let diffSeverity = computeMarkerDiffSeverity(start.marker, end.marker, context.calendarSystem); + if (!diffSeverity) { + return this.format(start, context); + } + let biggestUnitForPartial = diffSeverity; + if (biggestUnitForPartial > 1 && // the two dates are different in a way that's larger scale than time + (standardDateProps.year === 'numeric' || standardDateProps.year === '2-digit') && + (standardDateProps.month === 'numeric' || standardDateProps.month === '2-digit') && + (standardDateProps.day === 'numeric' || standardDateProps.day === '2-digit')) { + biggestUnitForPartial = 1; // make it look like the dates are only different in terms of time + } + let full0 = this.format(start, context); + let full1 = this.format(end, context); + if (full0 === full1) { + return full0; + } + let partialDateProps = computePartialFormattingOptions(standardDateProps, biggestUnitForPartial); + let partialFormattingFunc = buildFormattingFunc(partialDateProps, extendedSettings, context); + let partial0 = partialFormattingFunc(start); + let partial1 = partialFormattingFunc(end); + let insertion = findCommonInsertion(full0, partial0, full1, partial1); + let separator = extendedSettings.separator || betterDefaultSeparator || context.defaultSeparator || ''; + if (insertion) { + return insertion.before + partial0 + separator + partial1 + insertion.after; + } + return full0 + separator + full1; + } + getLargestUnit() { + switch (this.severity) { + case 7: + case 6: + case 5: + return 'year'; + case 4: + return 'month'; + case 3: + return 'week'; + case 2: + return 'day'; + default: + return 'time'; // really? + } + } + } + function buildFormattingFunc(standardDateProps, extendedSettings, context) { + let standardDatePropCnt = Object.keys(standardDateProps).length; + if (standardDatePropCnt === 1 && standardDateProps.timeZoneName === 'short') { + return (date) => (formatTimeZoneOffset(date.timeZoneOffset)); + } + if (standardDatePropCnt === 0 && extendedSettings.week) { + return (date) => (formatWeekNumber(context.computeWeekNumber(date.marker), context.weekText, context.weekTextLong, context.locale, extendedSettings.week)); + } + return buildNativeFormattingFunc(standardDateProps, extendedSettings, context); + } + function buildNativeFormattingFunc(standardDateProps, extendedSettings, context) { + standardDateProps = Object.assign({}, standardDateProps); // copy + extendedSettings = Object.assign({}, extendedSettings); // copy + sanitizeSettings(standardDateProps, extendedSettings); + standardDateProps.timeZone = 'UTC'; // we leverage the only guaranteed timeZone for our UTC markers + let normalFormat = new Intl.DateTimeFormat(context.locale.codes, standardDateProps); + let zeroFormat; // needed? + if (extendedSettings.omitZeroMinute) { + let zeroProps = Object.assign({}, standardDateProps); + delete zeroProps.minute; // seconds and ms were already considered in sanitizeSettings + zeroFormat = new Intl.DateTimeFormat(context.locale.codes, zeroProps); + } + return (date) => { + let { marker } = date; + let format; + if (zeroFormat && !marker.getUTCMinutes()) { + format = zeroFormat; + } + else { + format = normalFormat; + } + let s = format.format(marker); + return postProcess(s, date, standardDateProps, extendedSettings, context); + }; + } + function sanitizeSettings(standardDateProps, extendedSettings) { + // deal with a browser inconsistency where formatting the timezone + // requires that the hour/minute be present. + if (standardDateProps.timeZoneName) { + if (!standardDateProps.hour) { + standardDateProps.hour = '2-digit'; + } + if (!standardDateProps.minute) { + standardDateProps.minute = '2-digit'; + } + } + // only support short timezone names + if (standardDateProps.timeZoneName === 'long') { + standardDateProps.timeZoneName = 'short'; + } + // if requesting to display seconds, MUST display minutes + if (extendedSettings.omitZeroMinute && (standardDateProps.second || standardDateProps.millisecond)) { + delete extendedSettings.omitZeroMinute; + } + } + function postProcess(s, date, standardDateProps, extendedSettings, context) { + s = s.replace(LTR_RE, ''); // remove left-to-right control chars. do first. good for other regexes + if (standardDateProps.timeZoneName === 'short') { + s = injectTzoStr(s, (context.timeZone === 'UTC' || date.timeZoneOffset == null) ? + 'UTC' : // important to normalize for IE, which does "GMT" + formatTimeZoneOffset(date.timeZoneOffset)); + } + if (extendedSettings.omitCommas) { + s = s.replace(COMMA_RE, '').trim(); + } + if (extendedSettings.omitZeroMinute) { + s = s.replace(':00', ''); // zeroFormat doesn't always achieve this + } + // ^ do anything that might create adjacent spaces before this point, + // because MERIDIEM_RE likes to eat up loading spaces + if (extendedSettings.meridiem === false) { + s = s.replace(MERIDIEM_RE, '').trim(); + } + else if (extendedSettings.meridiem === 'narrow') { // a/p + s = s.replace(MERIDIEM_RE, (m0, m1) => m1.toLocaleLowerCase()); + } + else if (extendedSettings.meridiem === 'short') { // am/pm + s = s.replace(MERIDIEM_RE, (m0, m1) => `${m1.toLocaleLowerCase()}m`); + } + else if (extendedSettings.meridiem === 'lowercase') { // other meridiem transformers already converted to lowercase + s = s.replace(MERIDIEM_RE, (m0) => m0.toLocaleLowerCase()); + } + s = s.replace(MULTI_SPACE_RE, ' '); + s = s.trim(); + return s; + } + function injectTzoStr(s, tzoStr) { + let replaced = false; + s = s.replace(UTC_RE, () => { + replaced = true; + return tzoStr; + }); + // IE11 doesn't include UTC/GMT in the original string, so append to end + if (!replaced) { + s += ` ${tzoStr}`; + } + return s; + } + function formatWeekNumber(num, weekText, weekTextLong, locale, display) { + let parts = []; + if (display === 'long') { + parts.push(weekTextLong); + } + else if (display === 'short' || display === 'narrow') { + parts.push(weekText); + } + if (display === 'long' || display === 'short') { + parts.push(' '); + } + parts.push(locale.simpleNumberFormat.format(num)); + if (locale.options.direction === 'rtl') { // TODO: use control characters instead? + parts.reverse(); + } + return parts.join(''); + } + // Range Formatting Utils + // 0 = exactly the same + // 1 = different by time + // and bigger + function computeMarkerDiffSeverity(d0, d1, ca) { + if (ca.getMarkerYear(d0) !== ca.getMarkerYear(d1)) { + return 5; + } + if (ca.getMarkerMonth(d0) !== ca.getMarkerMonth(d1)) { + return 4; + } + if (ca.getMarkerDay(d0) !== ca.getMarkerDay(d1)) { + return 2; + } + if (timeAsMs(d0) !== timeAsMs(d1)) { + return 1; + } + return 0; + } + function computePartialFormattingOptions(options, biggestUnit) { + let partialOptions = {}; + for (let name in options) { + if (!(name in STANDARD_DATE_PROP_SEVERITIES) || // not a date part prop (like timeZone) + STANDARD_DATE_PROP_SEVERITIES[name] <= biggestUnit) { + partialOptions[name] = options[name]; + } + } + return partialOptions; + } + function findCommonInsertion(full0, partial0, full1, partial1) { + let i0 = 0; + while (i0 < full0.length) { + let found0 = full0.indexOf(partial0, i0); + if (found0 === -1) { + break; + } + let before0 = full0.substr(0, found0); + i0 = found0 + partial0.length; + let after0 = full0.substr(i0); + let i1 = 0; + while (i1 < full1.length) { + let found1 = full1.indexOf(partial1, i1); + if (found1 === -1) { + break; + } + let before1 = full1.substr(0, found1); + i1 = found1 + partial1.length; + let after1 = full1.substr(i1); + if (before0 === before1 && after0 === after1) { + return { + before: before0, + after: after0, + }; + } + } + } + return null; + } + + function expandZonedMarker(dateInfo, calendarSystem) { + let a = calendarSystem.markerToArray(dateInfo.marker); + return { + marker: dateInfo.marker, + timeZoneOffset: dateInfo.timeZoneOffset, + array: a, + year: a[0], + month: a[1], + day: a[2], + hour: a[3], + minute: a[4], + second: a[5], + millisecond: a[6], + }; + } + + function createVerboseFormattingArg(start, end, context, betterDefaultSeparator) { + let startInfo = expandZonedMarker(start, context.calendarSystem); + let endInfo = end ? expandZonedMarker(end, context.calendarSystem) : null; + return { + date: startInfo, + start: startInfo, + end: endInfo, + timeZone: context.timeZone, + localeCodes: context.locale.codes, + defaultSeparator: betterDefaultSeparator || context.defaultSeparator, + }; + } + + /* + TODO: fix the terminology of "formatter" vs "formatting func" + */ + /* + At the time of instantiation, this object does not know which cmd-formatting system it will use. + It receives this at the time of formatting, as a setting. + */ + class CmdFormatter { + constructor(cmdStr) { + this.cmdStr = cmdStr; + } + format(date, context, betterDefaultSeparator) { + return context.cmdFormatter(this.cmdStr, createVerboseFormattingArg(date, null, context, betterDefaultSeparator)); + } + formatRange(start, end, context, betterDefaultSeparator) { + return context.cmdFormatter(this.cmdStr, createVerboseFormattingArg(start, end, context, betterDefaultSeparator)); + } + } + + class FuncFormatter { + constructor(func) { + this.func = func; + } + format(date, context, betterDefaultSeparator) { + return this.func(createVerboseFormattingArg(date, null, context, betterDefaultSeparator)); + } + formatRange(start, end, context, betterDefaultSeparator) { + return this.func(createVerboseFormattingArg(start, end, context, betterDefaultSeparator)); + } + } + + function createFormatter(input) { + if (typeof input === 'object' && input) { // non-null object + return new NativeFormatter(input); + } + if (typeof input === 'string') { + return new CmdFormatter(input); + } + if (typeof input === 'function') { + return new FuncFormatter(input); + } + return null; + } + + // base options + // ------------ + const BASE_OPTION_REFINERS = { + navLinkDayClick: identity, + navLinkWeekClick: identity, + duration: createDuration, + bootstrapFontAwesome: identity, + buttonIcons: identity, + customButtons: identity, + defaultAllDayEventDuration: createDuration, + defaultTimedEventDuration: createDuration, + nextDayThreshold: createDuration, + scrollTime: createDuration, + scrollTimeReset: Boolean, + slotMinTime: createDuration, + slotMaxTime: createDuration, + dayPopoverFormat: createFormatter, + slotDuration: createDuration, + snapDuration: createDuration, + headerToolbar: identity, + footerToolbar: identity, + defaultRangeSeparator: String, + titleRangeSeparator: String, + forceEventDuration: Boolean, + dayHeaders: Boolean, + dayHeaderFormat: createFormatter, + dayHeaderClassNames: identity, + dayHeaderContent: identity, + dayHeaderDidMount: identity, + dayHeaderWillUnmount: identity, + dayCellClassNames: identity, + dayCellContent: identity, + dayCellDidMount: identity, + dayCellWillUnmount: identity, + initialView: String, + aspectRatio: Number, + weekends: Boolean, + weekNumberCalculation: identity, + weekNumbers: Boolean, + weekNumberClassNames: identity, + weekNumberContent: identity, + weekNumberDidMount: identity, + weekNumberWillUnmount: identity, + editable: Boolean, + viewClassNames: identity, + viewDidMount: identity, + viewWillUnmount: identity, + nowIndicator: Boolean, + nowIndicatorClassNames: identity, + nowIndicatorContent: identity, + nowIndicatorDidMount: identity, + nowIndicatorWillUnmount: identity, + showNonCurrentDates: Boolean, + lazyFetching: Boolean, + startParam: String, + endParam: String, + timeZoneParam: String, + timeZone: String, + locales: identity, + locale: identity, + themeSystem: String, + dragRevertDuration: Number, + dragScroll: Boolean, + allDayMaintainDuration: Boolean, + unselectAuto: Boolean, + dropAccept: identity, + eventOrder: parseFieldSpecs, + eventOrderStrict: Boolean, + handleWindowResize: Boolean, + windowResizeDelay: Number, + longPressDelay: Number, + eventDragMinDistance: Number, + expandRows: Boolean, + height: identity, + contentHeight: identity, + direction: String, + weekNumberFormat: createFormatter, + eventResizableFromStart: Boolean, + displayEventTime: Boolean, + displayEventEnd: Boolean, + weekText: String, + weekTextLong: String, + progressiveEventRendering: Boolean, + businessHours: identity, + initialDate: identity, + now: identity, + eventDataTransform: identity, + stickyHeaderDates: identity, + stickyFooterScrollbar: identity, + viewHeight: identity, + defaultAllDay: Boolean, + eventSourceFailure: identity, + eventSourceSuccess: identity, + eventDisplay: String, + eventStartEditable: Boolean, + eventDurationEditable: Boolean, + eventOverlap: identity, + eventConstraint: identity, + eventAllow: identity, + eventBackgroundColor: String, + eventBorderColor: String, + eventTextColor: String, + eventColor: String, + eventClassNames: identity, + eventContent: identity, + eventDidMount: identity, + eventWillUnmount: identity, + selectConstraint: identity, + selectOverlap: identity, + selectAllow: identity, + droppable: Boolean, + unselectCancel: String, + slotLabelFormat: identity, + slotLaneClassNames: identity, + slotLaneContent: identity, + slotLaneDidMount: identity, + slotLaneWillUnmount: identity, + slotLabelClassNames: identity, + slotLabelContent: identity, + slotLabelDidMount: identity, + slotLabelWillUnmount: identity, + dayMaxEvents: identity, + dayMaxEventRows: identity, + dayMinWidth: Number, + slotLabelInterval: createDuration, + allDayText: String, + allDayClassNames: identity, + allDayContent: identity, + allDayDidMount: identity, + allDayWillUnmount: identity, + slotMinWidth: Number, + navLinks: Boolean, + eventTimeFormat: createFormatter, + rerenderDelay: Number, + moreLinkText: identity, + moreLinkHint: identity, + selectMinDistance: Number, + selectable: Boolean, + selectLongPressDelay: Number, + eventLongPressDelay: Number, + selectMirror: Boolean, + eventMaxStack: Number, + eventMinHeight: Number, + eventMinWidth: Number, + eventShortHeight: Number, + slotEventOverlap: Boolean, + plugins: identity, + firstDay: Number, + dayCount: Number, + dateAlignment: String, + dateIncrement: createDuration, + hiddenDays: identity, + monthMode: Boolean, + fixedWeekCount: Boolean, + validRange: identity, + visibleRange: identity, + titleFormat: identity, + eventInteractive: Boolean, + // only used by list-view, but languages define the value, so we need it in base options + noEventsText: String, + viewHint: identity, + navLinkHint: identity, + closeHint: String, + timeHint: String, + eventHint: String, + moreLinkClick: identity, + moreLinkClassNames: identity, + moreLinkContent: identity, + moreLinkDidMount: identity, + moreLinkWillUnmount: identity, + // for connectors + // (can't be part of plugin system b/c must be provided at runtime) + handleCustomRendering: identity, + customRenderingMetaMap: identity, + customRenderingReplacesEl: Boolean, + }; + // do NOT give a type here. need `typeof BASE_OPTION_DEFAULTS` to give real results. + // raw values. + const BASE_OPTION_DEFAULTS = { + eventDisplay: 'auto', + defaultRangeSeparator: ' - ', + titleRangeSeparator: ' \u2013 ', + defaultTimedEventDuration: '01:00:00', + defaultAllDayEventDuration: { day: 1 }, + forceEventDuration: false, + nextDayThreshold: '00:00:00', + dayHeaders: true, + initialView: '', + aspectRatio: 1.35, + headerToolbar: { + start: 'title', + center: '', + end: 'today prev,next', + }, + weekends: true, + weekNumbers: false, + weekNumberCalculation: 'local', + editable: false, + nowIndicator: false, + scrollTime: '06:00:00', + scrollTimeReset: true, + slotMinTime: '00:00:00', + slotMaxTime: '24:00:00', + showNonCurrentDates: true, + lazyFetching: true, + startParam: 'start', + endParam: 'end', + timeZoneParam: 'timeZone', + timeZone: 'local', + locales: [], + locale: '', + themeSystem: 'standard', + dragRevertDuration: 500, + dragScroll: true, + allDayMaintainDuration: false, + unselectAuto: true, + dropAccept: '*', + eventOrder: 'start,-duration,allDay,title', + dayPopoverFormat: { month: 'long', day: 'numeric', year: 'numeric' }, + handleWindowResize: true, + windowResizeDelay: 100, + longPressDelay: 1000, + eventDragMinDistance: 5, + expandRows: false, + navLinks: false, + selectable: false, + eventMinHeight: 15, + eventMinWidth: 30, + eventShortHeight: 30, + }; + // calendar listeners + // ------------------ + const CALENDAR_LISTENER_REFINERS = { + datesSet: identity, + eventsSet: identity, + eventAdd: identity, + eventChange: identity, + eventRemove: identity, + windowResize: identity, + eventClick: identity, + eventMouseEnter: identity, + eventMouseLeave: identity, + select: identity, + unselect: identity, + loading: identity, + // internal + _unmount: identity, + _beforeprint: identity, + _afterprint: identity, + _noEventDrop: identity, + _noEventResize: identity, + _resize: identity, + _scrollRequest: identity, + }; + // calendar-specific options + // ------------------------- + const CALENDAR_OPTION_REFINERS = { + buttonText: identity, + buttonHints: identity, + views: identity, + plugins: identity, + initialEvents: identity, + events: identity, + eventSources: identity, + }; + const COMPLEX_OPTION_COMPARATORS = { + headerToolbar: isMaybeObjectsEqual, + footerToolbar: isMaybeObjectsEqual, + buttonText: isMaybeObjectsEqual, + buttonHints: isMaybeObjectsEqual, + buttonIcons: isMaybeObjectsEqual, + dateIncrement: isMaybeObjectsEqual, + }; + function isMaybeObjectsEqual(a, b) { + if (typeof a === 'object' && typeof b === 'object' && a && b) { // both non-null objects + return isPropsEqual(a, b); + } + return a === b; + } + // view-specific options + // --------------------- + const VIEW_OPTION_REFINERS = { + type: String, + component: identity, + buttonText: String, + buttonTextKey: String, + dateProfileGeneratorClass: identity, + usesMinMaxTime: Boolean, + classNames: identity, + content: identity, + didMount: identity, + willUnmount: identity, + }; + // util funcs + // ---------------------------------------------------------------------------------------------------- + function mergeRawOptions(optionSets) { + return mergeProps(optionSets, COMPLEX_OPTION_COMPARATORS); + } + function refineProps(input, refiners) { + let refined = {}; + let extra = {}; + for (let propName in refiners) { + if (propName in input) { + refined[propName] = refiners[propName](input[propName]); + } + } + for (let propName in input) { + if (!(propName in refiners)) { + extra[propName] = input[propName]; + } + } + return { refined, extra }; + } + function identity(raw) { + return raw; + } + + /* + NOTE: this can be a public API, especially createElement for hooks. + See examples/typescript-scheduler/src/index.ts + */ + function flushSync(runBeforeFlush) { + runBeforeFlush(); + let oldDebounceRendering = l$1.debounceRendering; // orig + let callbackQ = []; + function execCallbackSync(callback) { + callbackQ.push(callback); + } + l$1.debounceRendering = execCallbackSync; + P$1(h(FakeComponent, {}), document.createElement('div')); + while (callbackQ.length) { + callbackQ.shift()(); + } + l$1.debounceRendering = oldDebounceRendering; + } + class FakeComponent extends d { + render() { return h('div', {}); } + componentDidMount() { this.setState({}); } + } + // TODO: use preact/compat instead? + function createContext(defaultValue) { + let ContextType = B$1(defaultValue); + let origProvider = ContextType.Provider; + ContextType.Provider = function () { + let isNew = !this.getChildContext; + let children = origProvider.apply(this, arguments); // eslint-disable-line prefer-rest-params + if (isNew) { + let subs = []; + this.shouldComponentUpdate = (_props) => { + if (this.props.value !== _props.value) { + subs.forEach((c) => { + c.context = _props.value; + c.forceUpdate(); + }); + } + }; + this.sub = (c) => { + subs.push(c); + let old = c.componentWillUnmount; + c.componentWillUnmount = () => { + subs.splice(subs.indexOf(c), 1); + old && old.call(c); + }; + }; + } + return children; + }; + return ContextType; + } + + class ScrollResponder { + constructor(execFunc, emitter, scrollTime, scrollTimeReset) { + this.execFunc = execFunc; + this.emitter = emitter; + this.scrollTime = scrollTime; + this.scrollTimeReset = scrollTimeReset; + this.handleScrollRequest = (request) => { + this.queuedRequest = Object.assign({}, this.queuedRequest || {}, request); + this.drain(); + }; + emitter.on('_scrollRequest', this.handleScrollRequest); + this.fireInitialScroll(); + } + detach() { + this.emitter.off('_scrollRequest', this.handleScrollRequest); + } + update(isDatesNew) { + if (isDatesNew && this.scrollTimeReset) { + this.fireInitialScroll(); // will drain + } + else { + this.drain(); + } + } + fireInitialScroll() { + this.handleScrollRequest({ + time: this.scrollTime, + }); + } + drain() { + if (this.queuedRequest && this.execFunc(this.queuedRequest)) { + this.queuedRequest = null; + } + } + } + + const ViewContextType = createContext({}); // for Components + function buildViewContext(viewSpec, viewApi, viewOptions, dateProfileGenerator, dateEnv, theme, pluginHooks, dispatch, getCurrentData, emitter, calendarApi, registerInteractiveComponent, unregisterInteractiveComponent) { + return { + dateEnv, + options: viewOptions, + pluginHooks, + emitter, + dispatch, + getCurrentData, + calendarApi, + viewSpec, + viewApi, + dateProfileGenerator, + theme, + isRtl: viewOptions.direction === 'rtl', + addResizeHandler(handler) { + emitter.on('_resize', handler); + }, + removeResizeHandler(handler) { + emitter.off('_resize', handler); + }, + createScrollResponder(execFunc) { + return new ScrollResponder(execFunc, emitter, createDuration(viewOptions.scrollTime), viewOptions.scrollTimeReset); + }, + registerInteractiveComponent, + unregisterInteractiveComponent, + }; + } + + /* eslint max-classes-per-file: off */ + class PureComponent extends d { + shouldComponentUpdate(nextProps, nextState) { + if (this.debug) { + // eslint-disable-next-line no-console + console.log(getUnequalProps(nextProps, this.props), getUnequalProps(nextState, this.state)); + } + return !compareObjs(this.props, nextProps, this.propEquality) || + !compareObjs(this.state, nextState, this.stateEquality); + } + // HACK for freakin' React StrictMode + safeSetState(newState) { + if (!compareObjs(this.state, Object.assign(Object.assign({}, this.state), newState), this.stateEquality)) { + this.setState(newState); + } + } + } + PureComponent.addPropsEquality = addPropsEquality; + PureComponent.addStateEquality = addStateEquality; + PureComponent.contextType = ViewContextType; + PureComponent.prototype.propEquality = {}; + PureComponent.prototype.stateEquality = {}; + class BaseComponent extends PureComponent { + } + BaseComponent.contextType = ViewContextType; + function addPropsEquality(propEquality) { + let hash = Object.create(this.prototype.propEquality); + Object.assign(hash, propEquality); + this.prototype.propEquality = hash; + } + function addStateEquality(stateEquality) { + let hash = Object.create(this.prototype.stateEquality); + Object.assign(hash, stateEquality); + this.prototype.stateEquality = hash; + } + // use other one + function setRef(ref, current) { + if (typeof ref === 'function') { + ref(current); + } + else if (ref) { + // see https://github.com/facebook/react/issues/13029 + ref.current = current; + } + } + + class ContentInjector extends BaseComponent { + constructor() { + super(...arguments); + this.id = guid(); + this.currentDomNodes = []; + this.queuedDomNodes = []; + this.handleEl = (el) => { + if (this.props.elRef) { + setRef(this.props.elRef, el); + } + }; + } + render() { + const { props, context } = this; + const { options } = context; + const { generator, renderProps } = props; + const attrs = buildElAttrs(props); + let innerContent; + let queuedDomNodes = []; + if (hasCustomRenderingHandler(props.generatorName, options)) { + if (options.customRenderingReplacesEl) { + delete attrs.elRef; // because handleEl will be used + } + } + else { + const customContent = typeof generator === 'function' ? + generator(renderProps, h) : + generator; + if (typeof customContent === 'string' || + i$1(customContent) || + Array.isArray(customContent)) { + innerContent = customContent; + } + else if (typeof customContent === 'object') { + if ('html' in customContent) { + attrs.dangerouslySetInnerHTML = { __html: customContent.html }; + } + else if ('domNodes' in customContent) { + queuedDomNodes = Array.prototype.slice.call(customContent.domNodes); + } + } + } + this.queuedDomNodes = queuedDomNodes; + return h(props.elTag, attrs, innerContent); + } + componentDidMount() { + this.applyQueueudDomNodes(); + this.triggerCustomRendering(true); + } + componentDidUpdate() { + this.applyQueueudDomNodes(); + this.triggerCustomRendering(true); + } + componentWillUnmount() { + this.triggerCustomRendering(false); // TODO: different API for removal? + } + triggerCustomRendering(isActive) { + const { props, context } = this; + const { handleCustomRendering, customRenderingMetaMap } = context.options; + if (handleCustomRendering) { + const customRenderingMeta = customRenderingMetaMap === null || customRenderingMetaMap === void 0 ? void 0 : customRenderingMetaMap[props.generatorName]; + if (customRenderingMeta) { + handleCustomRendering(Object.assign({ id: this.id, isActive, containerEl: this.base, reportNewContainerEl: this.handleEl, generatorMeta: customRenderingMeta }, props)); + } + } + } + applyQueueudDomNodes() { + const { queuedDomNodes, currentDomNodes } = this; + const el = this.base; + if (!isArraysEqual(queuedDomNodes, currentDomNodes)) { + currentDomNodes.forEach(removeElement); + for (let newNode of queuedDomNodes) { + el.appendChild(newNode); + } + this.currentDomNodes = queuedDomNodes; + } + } + } + ContentInjector.addPropsEquality({ + elClasses: isArraysEqual, + elStyle: isPropsEqual, + elAttrs: isNonHandlerPropsEqual, + renderProps: isPropsEqual, + }); + // Util + function hasCustomRenderingHandler(generatorName, options) { + var _a; + return Boolean(options.handleCustomRendering && + generatorName && + ((_a = options.customRenderingMetaMap) === null || _a === void 0 ? void 0 : _a[generatorName])); + } + function buildElAttrs(props, extraClassNames) { + const attrs = Object.assign(Object.assign({}, props.elAttrs), { ref: props.elRef }); + if (props.elClasses || extraClassNames) { + attrs.className = (props.elClasses || []) + .concat(extraClassNames || []) + .concat(attrs.className || []) + .filter(Boolean) + .join(' '); + } + if (props.elStyle) { + attrs.style = props.elStyle; + } + return attrs; + } + + const RenderId = createContext(0); + + class ContentContainer extends d { + constructor() { + super(...arguments); + this.InnerContent = InnerContentInjector.bind(undefined, this); + } + render() { + const { props } = this; + const generatedClassNames = generateClassNames(props.classNameGenerator, props.renderProps); + if (props.children) { + const elAttrs = buildElAttrs(props, generatedClassNames); + const children = props.children(this.InnerContent, props.renderProps, elAttrs); + if (props.elTag) { + return h(props.elTag, elAttrs, children); + } + else { + return children; + } + } + else { + return h((ContentInjector), Object.assign(Object.assign({}, props), { elTag: props.elTag || 'div', elClasses: (props.elClasses || []).concat(generatedClassNames), renderId: this.context })); + } + } + componentDidMount() { + var _a, _b; + (_b = (_a = this.props).didMount) === null || _b === void 0 ? void 0 : _b.call(_a, Object.assign(Object.assign({}, this.props.renderProps), { el: this.base })); + } + componentWillUnmount() { + var _a, _b; + (_b = (_a = this.props).willUnmount) === null || _b === void 0 ? void 0 : _b.call(_a, Object.assign(Object.assign({}, this.props.renderProps), { el: this.base })); + } + } + ContentContainer.contextType = RenderId; + function InnerContentInjector(containerComponent, props) { + const parentProps = containerComponent.props; + return h((ContentInjector), Object.assign({ renderProps: parentProps.renderProps, generatorName: parentProps.generatorName, generator: parentProps.generator, renderId: containerComponent.context }, props)); + } + // Utils + function generateClassNames(classNameGenerator, renderProps) { + const classNames = typeof classNameGenerator === 'function' ? + classNameGenerator(renderProps) : + classNameGenerator || []; + return typeof classNames === 'string' ? [classNames] : classNames; + } + + class ViewContainer$1 extends BaseComponent { + render() { + let { props, context } = this; + let { options } = context; + let renderProps = { view: context.viewApi }; + return (h(ContentContainer, Object.assign({}, props, { elTag: props.elTag || 'div', elClasses: [ + ...buildViewClassNames(props.viewSpec), + ...(props.elClasses || []), + ], renderProps: renderProps, classNameGenerator: options.viewClassNames, generatorName: undefined, generator: undefined, didMount: options.viewDidMount, willUnmount: options.viewWillUnmount }), () => props.children)); + } + } + function buildViewClassNames(viewSpec) { + return [ + `fc-${viewSpec.type}-view`, + 'fc-view', + ]; + } + + function parseRange(input, dateEnv) { + let start = null; + let end = null; + if (input.start) { + start = dateEnv.createMarker(input.start); + } + if (input.end) { + end = dateEnv.createMarker(input.end); + } + if (!start && !end) { + return null; + } + if (start && end && end < start) { + return null; + } + return { start, end }; + } + // SIDE-EFFECT: will mutate ranges. + // Will return a new array result. + function invertRanges(ranges, constraintRange) { + let invertedRanges = []; + let { start } = constraintRange; // the end of the previous range. the start of the new range + let i; + let dateRange; + // ranges need to be in order. required for our date-walking algorithm + ranges.sort(compareRanges); + for (i = 0; i < ranges.length; i += 1) { + dateRange = ranges[i]; + // add the span of time before the event (if there is any) + if (dateRange.start > start) { // compare millisecond time (skip any ambig logic) + invertedRanges.push({ start, end: dateRange.start }); + } + if (dateRange.end > start) { + start = dateRange.end; + } + } + // add the span of time after the last event (if there is any) + if (start < constraintRange.end) { // compare millisecond time (skip any ambig logic) + invertedRanges.push({ start, end: constraintRange.end }); + } + return invertedRanges; + } + function compareRanges(range0, range1) { + return range0.start.valueOf() - range1.start.valueOf(); // earlier ranges go first + } + function intersectRanges(range0, range1) { + let { start, end } = range0; + let newRange = null; + if (range1.start !== null) { + if (start === null) { + start = range1.start; + } + else { + start = new Date(Math.max(start.valueOf(), range1.start.valueOf())); + } + } + if (range1.end != null) { + if (end === null) { + end = range1.end; + } + else { + end = new Date(Math.min(end.valueOf(), range1.end.valueOf())); + } + } + if (start === null || end === null || start < end) { + newRange = { start, end }; + } + return newRange; + } + function rangesEqual(range0, range1) { + return (range0.start === null ? null : range0.start.valueOf()) === (range1.start === null ? null : range1.start.valueOf()) && + (range0.end === null ? null : range0.end.valueOf()) === (range1.end === null ? null : range1.end.valueOf()); + } + function rangesIntersect(range0, range1) { + return (range0.end === null || range1.start === null || range0.end > range1.start) && + (range0.start === null || range1.end === null || range0.start < range1.end); + } + function rangeContainsRange(outerRange, innerRange) { + return (outerRange.start === null || (innerRange.start !== null && innerRange.start >= outerRange.start)) && + (outerRange.end === null || (innerRange.end !== null && innerRange.end <= outerRange.end)); + } + function rangeContainsMarker(range, date) { + return (range.start === null || date >= range.start) && + (range.end === null || date < range.end); + } + // If the given date is not within the given range, move it inside. + // (If it's past the end, make it one millisecond before the end). + function constrainMarkerToRange(date, range) { + if (range.start != null && date < range.start) { + return range.start; + } + if (range.end != null && date >= range.end) { + return new Date(range.end.valueOf() - 1); + } + return date; + } + + /* Date stuff that doesn't belong in datelib core + ----------------------------------------------------------------------------------------------------------------------*/ + // given a timed range, computes an all-day range that has the same exact duration, + // but whose start time is aligned with the start of the day. + function computeAlignedDayRange(timedRange) { + let dayCnt = Math.floor(diffDays(timedRange.start, timedRange.end)) || 1; + let start = startOfDay(timedRange.start); + let end = addDays(start, dayCnt); + return { start, end }; + } + // given a timed range, computes an all-day range based on how for the end date bleeds into the next day + // TODO: give nextDayThreshold a default arg + function computeVisibleDayRange(timedRange, nextDayThreshold = createDuration(0)) { + let startDay = null; + let endDay = null; + if (timedRange.end) { + endDay = startOfDay(timedRange.end); + let endTimeMS = timedRange.end.valueOf() - endDay.valueOf(); // # of milliseconds into `endDay` + // If the end time is actually inclusively part of the next day and is equal to or + // beyond the next day threshold, adjust the end to be the exclusive end of `endDay`. + // Otherwise, leaving it as inclusive will cause it to exclude `endDay`. + if (endTimeMS && endTimeMS >= asRoughMs(nextDayThreshold)) { + endDay = addDays(endDay, 1); + } + } + if (timedRange.start) { + startDay = startOfDay(timedRange.start); // the beginning of the day the range starts + // If end is within `startDay` but not past nextDayThreshold, assign the default duration of one day. + if (endDay && endDay <= startDay) { + endDay = addDays(startDay, 1); + } + } + return { start: startDay, end: endDay }; + } + // spans from one day into another? + function isMultiDayRange(range) { + let visibleRange = computeVisibleDayRange(range); + return diffDays(visibleRange.start, visibleRange.end) > 1; + } + function diffDates(date0, date1, dateEnv, largeUnit) { + if (largeUnit === 'year') { + return createDuration(dateEnv.diffWholeYears(date0, date1), 'year'); + } + if (largeUnit === 'month') { + return createDuration(dateEnv.diffWholeMonths(date0, date1), 'month'); + } + return diffDayAndTime(date0, date1); // returns a duration + } + + function reduceCurrentDate(currentDate, action) { + switch (action.type) { + case 'CHANGE_DATE': + return action.dateMarker; + default: + return currentDate; + } + } + function getInitialDate(options, dateEnv) { + let initialDateInput = options.initialDate; + // compute the initial ambig-timezone date + if (initialDateInput != null) { + return dateEnv.createMarker(initialDateInput); + } + return getNow(options.now, dateEnv); // getNow already returns unzoned + } + function getNow(nowInput, dateEnv) { + if (typeof nowInput === 'function') { + nowInput = nowInput(); + } + if (nowInput == null) { + return dateEnv.createNowMarker(); + } + return dateEnv.createMarker(nowInput); + } + + class DateProfileGenerator { + constructor(props) { + this.props = props; + this.nowDate = getNow(props.nowInput, props.dateEnv); + this.initHiddenDays(); + } + /* Date Range Computation + ------------------------------------------------------------------------------------------------------------------*/ + // Builds a structure with info about what the dates/ranges will be for the "prev" view. + buildPrev(currentDateProfile, currentDate, forceToValid) { + let { dateEnv } = this.props; + let prevDate = dateEnv.subtract(dateEnv.startOf(currentDate, currentDateProfile.currentRangeUnit), // important for start-of-month + currentDateProfile.dateIncrement); + return this.build(prevDate, -1, forceToValid); + } + // Builds a structure with info about what the dates/ranges will be for the "next" view. + buildNext(currentDateProfile, currentDate, forceToValid) { + let { dateEnv } = this.props; + let nextDate = dateEnv.add(dateEnv.startOf(currentDate, currentDateProfile.currentRangeUnit), // important for start-of-month + currentDateProfile.dateIncrement); + return this.build(nextDate, 1, forceToValid); + } + // Builds a structure holding dates/ranges for rendering around the given date. + // Optional direction param indicates whether the date is being incremented/decremented + // from its previous value. decremented = -1, incremented = 1 (default). + build(currentDate, direction, forceToValid = true) { + let { props } = this; + let validRange; + let currentInfo; + let isRangeAllDay; + let renderRange; + let activeRange; + let isValid; + validRange = this.buildValidRange(); + validRange = this.trimHiddenDays(validRange); + if (forceToValid) { + currentDate = constrainMarkerToRange(currentDate, validRange); + } + currentInfo = this.buildCurrentRangeInfo(currentDate, direction); + isRangeAllDay = /^(year|month|week|day)$/.test(currentInfo.unit); + renderRange = this.buildRenderRange(this.trimHiddenDays(currentInfo.range), currentInfo.unit, isRangeAllDay); + renderRange = this.trimHiddenDays(renderRange); + activeRange = renderRange; + if (!props.showNonCurrentDates) { + activeRange = intersectRanges(activeRange, currentInfo.range); + } + activeRange = this.adjustActiveRange(activeRange); + activeRange = intersectRanges(activeRange, validRange); // might return null + // it's invalid if the originally requested date is not contained, + // or if the range is completely outside of the valid range. + isValid = rangesIntersect(currentInfo.range, validRange); + return { + // constraint for where prev/next operations can go and where events can be dragged/resized to. + // an object with optional start and end properties. + validRange, + // range the view is formally responsible for. + // for example, a month view might have 1st-31st, excluding padded dates + currentRange: currentInfo.range, + // name of largest unit being displayed, like "month" or "week" + currentRangeUnit: currentInfo.unit, + isRangeAllDay, + // dates that display events and accept drag-n-drop + // will be `null` if no dates accept events + activeRange, + // date range with a rendered skeleton + // includes not-active days that need some sort of DOM + renderRange, + // Duration object that denotes the first visible time of any given day + slotMinTime: props.slotMinTime, + // Duration object that denotes the exclusive visible end time of any given day + slotMaxTime: props.slotMaxTime, + isValid, + // how far the current date will move for a prev/next operation + dateIncrement: this.buildDateIncrement(currentInfo.duration), + // pass a fallback (might be null) ^ + }; + } + // Builds an object with optional start/end properties. + // Indicates the minimum/maximum dates to display. + // not responsible for trimming hidden days. + buildValidRange() { + let input = this.props.validRangeInput; + let simpleInput = typeof input === 'function' + ? input.call(this.props.calendarApi, this.nowDate) + : input; + return this.refineRange(simpleInput) || + { start: null, end: null }; // completely open-ended + } + // Builds a structure with info about the "current" range, the range that is + // highlighted as being the current month for example. + // See build() for a description of `direction`. + // Guaranteed to have `range` and `unit` properties. `duration` is optional. + buildCurrentRangeInfo(date, direction) { + let { props } = this; + let duration = null; + let unit = null; + let range = null; + let dayCount; + if (props.duration) { + duration = props.duration; + unit = props.durationUnit; + range = this.buildRangeFromDuration(date, direction, duration, unit); + } + else if ((dayCount = this.props.dayCount)) { + unit = 'day'; + range = this.buildRangeFromDayCount(date, direction, dayCount); + } + else if ((range = this.buildCustomVisibleRange(date))) { + unit = props.dateEnv.greatestWholeUnit(range.start, range.end).unit; + } + else { + duration = this.getFallbackDuration(); + unit = greatestDurationDenominator(duration).unit; + range = this.buildRangeFromDuration(date, direction, duration, unit); + } + return { duration, unit, range }; + } + getFallbackDuration() { + return createDuration({ day: 1 }); + } + // Returns a new activeRange to have time values (un-ambiguate) + // slotMinTime or slotMaxTime causes the range to expand. + adjustActiveRange(range) { + let { dateEnv, usesMinMaxTime, slotMinTime, slotMaxTime } = this.props; + let { start, end } = range; + if (usesMinMaxTime) { + // expand active range if slotMinTime is negative (why not when positive?) + if (asRoughDays(slotMinTime) < 0) { + start = startOfDay(start); // necessary? + start = dateEnv.add(start, slotMinTime); + } + // expand active range if slotMaxTime is beyond one day (why not when negative?) + if (asRoughDays(slotMaxTime) > 1) { + end = startOfDay(end); // necessary? + end = addDays(end, -1); + end = dateEnv.add(end, slotMaxTime); + } + } + return { start, end }; + } + // Builds the "current" range when it is specified as an explicit duration. + // `unit` is the already-computed greatestDurationDenominator unit of duration. + buildRangeFromDuration(date, direction, duration, unit) { + let { dateEnv, dateAlignment } = this.props; + let start; + let end; + let res; + // compute what the alignment should be + if (!dateAlignment) { + let { dateIncrement } = this.props; + if (dateIncrement) { + // use the smaller of the two units + if (asRoughMs(dateIncrement) < asRoughMs(duration)) { + dateAlignment = greatestDurationDenominator(dateIncrement).unit; + } + else { + dateAlignment = unit; + } + } + else { + dateAlignment = unit; + } + } + // if the view displays a single day or smaller + if (asRoughDays(duration) <= 1) { + if (this.isHiddenDay(start)) { + start = this.skipHiddenDays(start, direction); + start = startOfDay(start); + } + } + function computeRes() { + start = dateEnv.startOf(date, dateAlignment); + end = dateEnv.add(start, duration); + res = { start, end }; + } + computeRes(); + // if range is completely enveloped by hidden days, go past the hidden days + if (!this.trimHiddenDays(res)) { + date = this.skipHiddenDays(date, direction); + computeRes(); + } + return res; + } + // Builds the "current" range when a dayCount is specified. + buildRangeFromDayCount(date, direction, dayCount) { + let { dateEnv, dateAlignment } = this.props; + let runningCount = 0; + let start = date; + let end; + if (dateAlignment) { + start = dateEnv.startOf(start, dateAlignment); + } + start = startOfDay(start); + start = this.skipHiddenDays(start, direction); + end = start; + do { + end = addDays(end, 1); + if (!this.isHiddenDay(end)) { + runningCount += 1; + } + } while (runningCount < dayCount); + return { start, end }; + } + // Builds a normalized range object for the "visible" range, + // which is a way to define the currentRange and activeRange at the same time. + buildCustomVisibleRange(date) { + let { props } = this; + let input = props.visibleRangeInput; + let simpleInput = typeof input === 'function' + ? input.call(props.calendarApi, props.dateEnv.toDate(date)) + : input; + let range = this.refineRange(simpleInput); + if (range && (range.start == null || range.end == null)) { + return null; + } + return range; + } + // Computes the range that will represent the element/cells for *rendering*, + // but which may have voided days/times. + // not responsible for trimming hidden days. + buildRenderRange(currentRange, currentRangeUnit, isRangeAllDay) { + return currentRange; + } + // Compute the duration value that should be added/substracted to the current date + // when a prev/next operation happens. + buildDateIncrement(fallback) { + let { dateIncrement } = this.props; + let customAlignment; + if (dateIncrement) { + return dateIncrement; + } + if ((customAlignment = this.props.dateAlignment)) { + return createDuration(1, customAlignment); + } + if (fallback) { + return fallback; + } + return createDuration({ days: 1 }); + } + refineRange(rangeInput) { + if (rangeInput) { + let range = parseRange(rangeInput, this.props.dateEnv); + if (range) { + range = computeVisibleDayRange(range); + } + return range; + } + return null; + } + /* Hidden Days + ------------------------------------------------------------------------------------------------------------------*/ + // Initializes internal variables related to calculating hidden days-of-week + initHiddenDays() { + let hiddenDays = this.props.hiddenDays || []; // array of day-of-week indices that are hidden + let isHiddenDayHash = []; // is the day-of-week hidden? (hash with day-of-week-index -> bool) + let dayCnt = 0; + let i; + if (this.props.weekends === false) { + hiddenDays.push(0, 6); // 0=sunday, 6=saturday + } + for (i = 0; i < 7; i += 1) { + if (!(isHiddenDayHash[i] = hiddenDays.indexOf(i) !== -1)) { + dayCnt += 1; + } + } + if (!dayCnt) { + throw new Error('invalid hiddenDays'); // all days were hidden? bad. + } + this.isHiddenDayHash = isHiddenDayHash; + } + // Remove days from the beginning and end of the range that are computed as hidden. + // If the whole range is trimmed off, returns null + trimHiddenDays(range) { + let { start, end } = range; + if (start) { + start = this.skipHiddenDays(start); + } + if (end) { + end = this.skipHiddenDays(end, -1, true); + } + if (start == null || end == null || start < end) { + return { start, end }; + } + return null; + } + // Is the current day hidden? + // `day` is a day-of-week index (0-6), or a Date (used for UTC) + isHiddenDay(day) { + if (day instanceof Date) { + day = day.getUTCDay(); + } + return this.isHiddenDayHash[day]; + } + // Incrementing the current day until it is no longer a hidden day, returning a copy. + // DOES NOT CONSIDER validRange! + // If the initial value of `date` is not a hidden day, don't do anything. + // Pass `isExclusive` as `true` if you are dealing with an end date. + // `inc` defaults to `1` (increment one day forward each time) + skipHiddenDays(date, inc = 1, isExclusive = false) { + while (this.isHiddenDayHash[(date.getUTCDay() + (isExclusive ? inc : 0) + 7) % 7]) { + date = addDays(date, inc); + } + return date; + } + } + + function createEventInstance(defId, range, forcedStartTzo, forcedEndTzo) { + return { + instanceId: guid(), + defId, + range, + forcedStartTzo: forcedStartTzo == null ? null : forcedStartTzo, + forcedEndTzo: forcedEndTzo == null ? null : forcedEndTzo, + }; + } + + function parseRecurring(refined, defaultAllDay, dateEnv, recurringTypes) { + for (let i = 0; i < recurringTypes.length; i += 1) { + let parsed = recurringTypes[i].parse(refined, dateEnv); + if (parsed) { + let { allDay } = refined; + if (allDay == null) { + allDay = defaultAllDay; + if (allDay == null) { + allDay = parsed.allDayGuess; + if (allDay == null) { + allDay = false; + } + } + } + return { + allDay, + duration: parsed.duration, + typeData: parsed.typeData, + typeId: i, + }; + } + } + return null; + } + function expandRecurring(eventStore, framingRange, context) { + let { dateEnv, pluginHooks, options } = context; + let { defs, instances } = eventStore; + // remove existing recurring instances + // TODO: bad. always expand events as a second step + instances = filterHash(instances, (instance) => !defs[instance.defId].recurringDef); + for (let defId in defs) { + let def = defs[defId]; + if (def.recurringDef) { + let { duration } = def.recurringDef; + if (!duration) { + duration = def.allDay ? + options.defaultAllDayEventDuration : + options.defaultTimedEventDuration; + } + let starts = expandRecurringRanges(def, duration, framingRange, dateEnv, pluginHooks.recurringTypes); + for (let start of starts) { + let instance = createEventInstance(defId, { + start, + end: dateEnv.add(start, duration), + }); + instances[instance.instanceId] = instance; + } + } + } + return { defs, instances }; + } + /* + Event MUST have a recurringDef + */ + function expandRecurringRanges(eventDef, duration, framingRange, dateEnv, recurringTypes) { + let typeDef = recurringTypes[eventDef.recurringDef.typeId]; + let markers = typeDef.expand(eventDef.recurringDef.typeData, { + start: dateEnv.subtract(framingRange.start, duration), + end: framingRange.end, + }, dateEnv); + // the recurrence plugins don't guarantee that all-day events are start-of-day, so we have to + if (eventDef.allDay) { + markers = markers.map(startOfDay); + } + return markers; + } + + const EVENT_NON_DATE_REFINERS = { + id: String, + groupId: String, + title: String, + url: String, + interactive: Boolean, + }; + const EVENT_DATE_REFINERS = { + start: identity, + end: identity, + date: identity, + allDay: Boolean, + }; + const EVENT_REFINERS$1 = Object.assign(Object.assign(Object.assign({}, EVENT_NON_DATE_REFINERS), EVENT_DATE_REFINERS), { extendedProps: identity }); + function parseEvent(raw, eventSource, context, allowOpenRange, refiners = buildEventRefiners(context)) { + let { refined, extra } = refineEventDef(raw, context, refiners); + let defaultAllDay = computeIsDefaultAllDay(eventSource, context); + let recurringRes = parseRecurring(refined, defaultAllDay, context.dateEnv, context.pluginHooks.recurringTypes); + if (recurringRes) { + let def = parseEventDef(refined, extra, eventSource ? eventSource.sourceId : '', recurringRes.allDay, Boolean(recurringRes.duration), context); + def.recurringDef = { + typeId: recurringRes.typeId, + typeData: recurringRes.typeData, + duration: recurringRes.duration, + }; + return { def, instance: null }; + } + let singleRes = parseSingle(refined, defaultAllDay, context, allowOpenRange); + if (singleRes) { + let def = parseEventDef(refined, extra, eventSource ? eventSource.sourceId : '', singleRes.allDay, singleRes.hasEnd, context); + let instance = createEventInstance(def.defId, singleRes.range, singleRes.forcedStartTzo, singleRes.forcedEndTzo); + return { def, instance }; + } + return null; + } + function refineEventDef(raw, context, refiners = buildEventRefiners(context)) { + return refineProps(raw, refiners); + } + function buildEventRefiners(context) { + return Object.assign(Object.assign(Object.assign({}, EVENT_UI_REFINERS), EVENT_REFINERS$1), context.pluginHooks.eventRefiners); + } + /* + Will NOT populate extendedProps with the leftover properties. + Will NOT populate date-related props. + */ + function parseEventDef(refined, extra, sourceId, allDay, hasEnd, context) { + let def = { + title: refined.title || '', + groupId: refined.groupId || '', + publicId: refined.id || '', + url: refined.url || '', + recurringDef: null, + defId: guid(), + sourceId, + allDay, + hasEnd, + interactive: refined.interactive, + ui: createEventUi(refined, context), + extendedProps: Object.assign(Object.assign({}, (refined.extendedProps || {})), extra), + }; + for (let memberAdder of context.pluginHooks.eventDefMemberAdders) { + Object.assign(def, memberAdder(refined)); + } + // help out EventImpl from having user modify props + Object.freeze(def.ui.classNames); + Object.freeze(def.extendedProps); + return def; + } + function parseSingle(refined, defaultAllDay, context, allowOpenRange) { + let { allDay } = refined; + let startMeta; + let startMarker = null; + let hasEnd = false; + let endMeta; + let endMarker = null; + let startInput = refined.start != null ? refined.start : refined.date; + startMeta = context.dateEnv.createMarkerMeta(startInput); + if (startMeta) { + startMarker = startMeta.marker; + } + else if (!allowOpenRange) { + return null; + } + if (refined.end != null) { + endMeta = context.dateEnv.createMarkerMeta(refined.end); + } + if (allDay == null) { + if (defaultAllDay != null) { + allDay = defaultAllDay; + } + else { + // fall back to the date props LAST + allDay = (!startMeta || startMeta.isTimeUnspecified) && + (!endMeta || endMeta.isTimeUnspecified); + } + } + if (allDay && startMarker) { + startMarker = startOfDay(startMarker); + } + if (endMeta) { + endMarker = endMeta.marker; + if (allDay) { + endMarker = startOfDay(endMarker); + } + if (startMarker && endMarker <= startMarker) { + endMarker = null; + } + } + if (endMarker) { + hasEnd = true; + } + else if (!allowOpenRange) { + hasEnd = context.options.forceEventDuration || false; + endMarker = context.dateEnv.add(startMarker, allDay ? + context.options.defaultAllDayEventDuration : + context.options.defaultTimedEventDuration); + } + return { + allDay, + hasEnd, + range: { start: startMarker, end: endMarker }, + forcedStartTzo: startMeta ? startMeta.forcedTzo : null, + forcedEndTzo: endMeta ? endMeta.forcedTzo : null, + }; + } + function computeIsDefaultAllDay(eventSource, context) { + let res = null; + if (eventSource) { + res = eventSource.defaultAllDay; + } + if (res == null) { + res = context.options.defaultAllDay; + } + return res; + } + + function parseEvents(rawEvents, eventSource, context, allowOpenRange) { + let eventStore = createEmptyEventStore(); + let eventRefiners = buildEventRefiners(context); + for (let rawEvent of rawEvents) { + let tuple = parseEvent(rawEvent, eventSource, context, allowOpenRange, eventRefiners); + if (tuple) { + eventTupleToStore(tuple, eventStore); + } + } + return eventStore; + } + function eventTupleToStore(tuple, eventStore = createEmptyEventStore()) { + eventStore.defs[tuple.def.defId] = tuple.def; + if (tuple.instance) { + eventStore.instances[tuple.instance.instanceId] = tuple.instance; + } + return eventStore; + } + // retrieves events that have the same groupId as the instance specified by `instanceId` + // or they are the same as the instance. + // why might instanceId not be in the store? an event from another calendar? + function getRelevantEvents(eventStore, instanceId) { + let instance = eventStore.instances[instanceId]; + if (instance) { + let def = eventStore.defs[instance.defId]; + // get events/instances with same group + let newStore = filterEventStoreDefs(eventStore, (lookDef) => isEventDefsGrouped(def, lookDef)); + // add the original + // TODO: wish we could use eventTupleToStore or something like it + newStore.defs[def.defId] = def; + newStore.instances[instance.instanceId] = instance; + return newStore; + } + return createEmptyEventStore(); + } + function isEventDefsGrouped(def0, def1) { + return Boolean(def0.groupId && def0.groupId === def1.groupId); + } + function createEmptyEventStore() { + return { defs: {}, instances: {} }; + } + function mergeEventStores(store0, store1) { + return { + defs: Object.assign(Object.assign({}, store0.defs), store1.defs), + instances: Object.assign(Object.assign({}, store0.instances), store1.instances), + }; + } + function filterEventStoreDefs(eventStore, filterFunc) { + let defs = filterHash(eventStore.defs, filterFunc); + let instances = filterHash(eventStore.instances, (instance) => (defs[instance.defId] // still exists? + )); + return { defs, instances }; + } + function excludeSubEventStore(master, sub) { + let { defs, instances } = master; + let filteredDefs = {}; + let filteredInstances = {}; + for (let defId in defs) { + if (!sub.defs[defId]) { // not explicitly excluded + filteredDefs[defId] = defs[defId]; + } + } + for (let instanceId in instances) { + if (!sub.instances[instanceId] && // not explicitly excluded + filteredDefs[instances[instanceId].defId] // def wasn't filtered away + ) { + filteredInstances[instanceId] = instances[instanceId]; + } + } + return { + defs: filteredDefs, + instances: filteredInstances, + }; + } + + function normalizeConstraint(input, context) { + if (Array.isArray(input)) { + return parseEvents(input, null, context, true); // allowOpenRange=true + } + if (typeof input === 'object' && input) { // non-null object + return parseEvents([input], null, context, true); // allowOpenRange=true + } + if (input != null) { + return String(input); + } + return null; + } + + function parseClassNames(raw) { + if (Array.isArray(raw)) { + return raw; + } + if (typeof raw === 'string') { + return raw.split(/\s+/); + } + return []; + } + + // TODO: better called "EventSettings" or "EventConfig" + // TODO: move this file into structs + // TODO: separate constraint/overlap/allow, because selection uses only that, not other props + const EVENT_UI_REFINERS = { + display: String, + editable: Boolean, + startEditable: Boolean, + durationEditable: Boolean, + constraint: identity, + overlap: identity, + allow: identity, + className: parseClassNames, + classNames: parseClassNames, + color: String, + backgroundColor: String, + borderColor: String, + textColor: String, + }; + const EMPTY_EVENT_UI = { + display: null, + startEditable: null, + durationEditable: null, + constraints: [], + overlap: null, + allows: [], + backgroundColor: '', + borderColor: '', + textColor: '', + classNames: [], + }; + function createEventUi(refined, context) { + let constraint = normalizeConstraint(refined.constraint, context); + return { + display: refined.display || null, + startEditable: refined.startEditable != null ? refined.startEditable : refined.editable, + durationEditable: refined.durationEditable != null ? refined.durationEditable : refined.editable, + constraints: constraint != null ? [constraint] : [], + overlap: refined.overlap != null ? refined.overlap : null, + allows: refined.allow != null ? [refined.allow] : [], + backgroundColor: refined.backgroundColor || refined.color || '', + borderColor: refined.borderColor || refined.color || '', + textColor: refined.textColor || '', + classNames: (refined.className || []).concat(refined.classNames || []), // join singular and plural + }; + } + // TODO: prevent against problems with <2 args! + function combineEventUis(uis) { + return uis.reduce(combineTwoEventUis, EMPTY_EVENT_UI); + } + function combineTwoEventUis(item0, item1) { + return { + display: item1.display != null ? item1.display : item0.display, + startEditable: item1.startEditable != null ? item1.startEditable : item0.startEditable, + durationEditable: item1.durationEditable != null ? item1.durationEditable : item0.durationEditable, + constraints: item0.constraints.concat(item1.constraints), + overlap: typeof item1.overlap === 'boolean' ? item1.overlap : item0.overlap, + allows: item0.allows.concat(item1.allows), + backgroundColor: item1.backgroundColor || item0.backgroundColor, + borderColor: item1.borderColor || item0.borderColor, + textColor: item1.textColor || item0.textColor, + classNames: item0.classNames.concat(item1.classNames), + }; + } + + const EVENT_SOURCE_REFINERS = { + id: String, + defaultAllDay: Boolean, + url: String, + format: String, + events: identity, + eventDataTransform: identity, + // for any network-related sources + success: identity, + failure: identity, + }; + function parseEventSource(raw, context, refiners = buildEventSourceRefiners(context)) { + let rawObj; + if (typeof raw === 'string') { + rawObj = { url: raw }; + } + else if (typeof raw === 'function' || Array.isArray(raw)) { + rawObj = { events: raw }; + } + else if (typeof raw === 'object' && raw) { // not null + rawObj = raw; + } + if (rawObj) { + let { refined, extra } = refineProps(rawObj, refiners); + let metaRes = buildEventSourceMeta(refined, context); + if (metaRes) { + return { + _raw: raw, + isFetching: false, + latestFetchId: '', + fetchRange: null, + defaultAllDay: refined.defaultAllDay, + eventDataTransform: refined.eventDataTransform, + success: refined.success, + failure: refined.failure, + publicId: refined.id || '', + sourceId: guid(), + sourceDefId: metaRes.sourceDefId, + meta: metaRes.meta, + ui: createEventUi(refined, context), + extendedProps: extra, + }; + } + } + return null; + } + function buildEventSourceRefiners(context) { + return Object.assign(Object.assign(Object.assign({}, EVENT_UI_REFINERS), EVENT_SOURCE_REFINERS), context.pluginHooks.eventSourceRefiners); + } + function buildEventSourceMeta(raw, context) { + let defs = context.pluginHooks.eventSourceDefs; + for (let i = defs.length - 1; i >= 0; i -= 1) { // later-added plugins take precedence + let def = defs[i]; + let meta = def.parseMeta(raw); + if (meta) { + return { sourceDefId: i, meta }; + } + } + return null; + } + + function reduceEventStore(eventStore, action, eventSources, dateProfile, context) { + switch (action.type) { + case 'RECEIVE_EVENTS': // raw + return receiveRawEvents(eventStore, eventSources[action.sourceId], action.fetchId, action.fetchRange, action.rawEvents, context); + case 'ADD_EVENTS': // already parsed, but not expanded + return addEvent(eventStore, action.eventStore, // new ones + dateProfile ? dateProfile.activeRange : null, context); + case 'RESET_EVENTS': + return action.eventStore; + case 'MERGE_EVENTS': // already parsed and expanded + return mergeEventStores(eventStore, action.eventStore); + case 'PREV': // TODO: how do we track all actions that affect dateProfile :( + case 'NEXT': + case 'CHANGE_DATE': + case 'CHANGE_VIEW_TYPE': + if (dateProfile) { + return expandRecurring(eventStore, dateProfile.activeRange, context); + } + return eventStore; + case 'REMOVE_EVENTS': + return excludeSubEventStore(eventStore, action.eventStore); + case 'REMOVE_EVENT_SOURCE': + return excludeEventsBySourceId(eventStore, action.sourceId); + case 'REMOVE_ALL_EVENT_SOURCES': + return filterEventStoreDefs(eventStore, (eventDef) => (!eventDef.sourceId // only keep events with no source id + )); + case 'REMOVE_ALL_EVENTS': + return createEmptyEventStore(); + default: + return eventStore; + } + } + function receiveRawEvents(eventStore, eventSource, fetchId, fetchRange, rawEvents, context) { + if (eventSource && // not already removed + fetchId === eventSource.latestFetchId // TODO: wish this logic was always in event-sources + ) { + let subset = parseEvents(transformRawEvents(rawEvents, eventSource, context), eventSource, context); + if (fetchRange) { + subset = expandRecurring(subset, fetchRange, context); + } + return mergeEventStores(excludeEventsBySourceId(eventStore, eventSource.sourceId), subset); + } + return eventStore; + } + function transformRawEvents(rawEvents, eventSource, context) { + let calEachTransform = context.options.eventDataTransform; + let sourceEachTransform = eventSource ? eventSource.eventDataTransform : null; + if (sourceEachTransform) { + rawEvents = transformEachRawEvent(rawEvents, sourceEachTransform); + } + if (calEachTransform) { + rawEvents = transformEachRawEvent(rawEvents, calEachTransform); + } + return rawEvents; + } + function transformEachRawEvent(rawEvents, func) { + let refinedEvents; + if (!func) { + refinedEvents = rawEvents; + } + else { + refinedEvents = []; + for (let rawEvent of rawEvents) { + let refinedEvent = func(rawEvent); + if (refinedEvent) { + refinedEvents.push(refinedEvent); + } + else if (refinedEvent == null) { + refinedEvents.push(rawEvent); + } // if a different falsy value, do nothing + } + } + return refinedEvents; + } + function addEvent(eventStore, subset, expandRange, context) { + if (expandRange) { + subset = expandRecurring(subset, expandRange, context); + } + return mergeEventStores(eventStore, subset); + } + function rezoneEventStoreDates(eventStore, oldDateEnv, newDateEnv) { + let { defs } = eventStore; + let instances = mapHash(eventStore.instances, (instance) => { + let def = defs[instance.defId]; + if (def.allDay || def.recurringDef) { + return instance; // isn't dependent on timezone + } + return Object.assign(Object.assign({}, instance), { range: { + start: newDateEnv.createMarker(oldDateEnv.toDate(instance.range.start, instance.forcedStartTzo)), + end: newDateEnv.createMarker(oldDateEnv.toDate(instance.range.end, instance.forcedEndTzo)), + }, forcedStartTzo: newDateEnv.canComputeOffset ? null : instance.forcedStartTzo, forcedEndTzo: newDateEnv.canComputeOffset ? null : instance.forcedEndTzo }); + }); + return { defs, instances }; + } + function excludeEventsBySourceId(eventStore, sourceId) { + return filterEventStoreDefs(eventStore, (eventDef) => eventDef.sourceId !== sourceId); + } + // QUESTION: why not just return instances? do a general object-property-exclusion util + function excludeInstances(eventStore, removals) { + return { + defs: eventStore.defs, + instances: filterHash(eventStore.instances, (instance) => !removals[instance.instanceId]), + }; + } + + class Emitter { + constructor() { + this.handlers = {}; + this.thisContext = null; + } + setThisContext(thisContext) { + this.thisContext = thisContext; + } + setOptions(options) { + this.options = options; + } + on(type, handler) { + addToHash(this.handlers, type, handler); + } + off(type, handler) { + removeFromHash(this.handlers, type, handler); + } + trigger(type, ...args) { + let attachedHandlers = this.handlers[type] || []; + let optionHandler = this.options && this.options[type]; + let handlers = [].concat(optionHandler || [], attachedHandlers); + for (let handler of handlers) { + handler.apply(this.thisContext, args); + } + } + hasHandlers(type) { + return Boolean((this.handlers[type] && this.handlers[type].length) || + (this.options && this.options[type])); + } + } + function addToHash(hash, type, handler) { + (hash[type] || (hash[type] = [])) + .push(handler); + } + function removeFromHash(hash, type, handler) { + if (handler) { + if (hash[type]) { + hash[type] = hash[type].filter((func) => func !== handler); + } + } + else { + delete hash[type]; // remove all handler funcs for this type + } + } + + const DEF_DEFAULTS = { + startTime: '09:00', + endTime: '17:00', + daysOfWeek: [1, 2, 3, 4, 5], + display: 'inverse-background', + classNames: 'fc-non-business', + groupId: '_businessHours', // so multiple defs get grouped + }; + /* + TODO: pass around as EventDefHash!!! + */ + function parseBusinessHours(input, context) { + return parseEvents(refineInputs(input), null, context); + } + function refineInputs(input) { + let rawDefs; + if (input === true) { + rawDefs = [{}]; // will get DEF_DEFAULTS verbatim + } + else if (Array.isArray(input)) { + // if specifying an array, every sub-definition NEEDS a day-of-week + rawDefs = input.filter((rawDef) => rawDef.daysOfWeek); + } + else if (typeof input === 'object' && input) { // non-null object + rawDefs = [input]; + } + else { // is probably false + rawDefs = []; + } + rawDefs = rawDefs.map((rawDef) => (Object.assign(Object.assign({}, DEF_DEFAULTS), rawDef))); + return rawDefs; + } + + function triggerDateSelect(selection, pev, context) { + context.emitter.trigger('select', Object.assign(Object.assign({}, buildDateSpanApiWithContext(selection, context)), { jsEvent: pev ? pev.origEvent : null, view: context.viewApi || context.calendarApi.view })); + } + function triggerDateUnselect(pev, context) { + context.emitter.trigger('unselect', { + jsEvent: pev ? pev.origEvent : null, + view: context.viewApi || context.calendarApi.view, + }); + } + function buildDateSpanApiWithContext(dateSpan, context) { + let props = {}; + for (let transform of context.pluginHooks.dateSpanTransforms) { + Object.assign(props, transform(dateSpan, context)); + } + Object.assign(props, buildDateSpanApi(dateSpan, context.dateEnv)); + return props; + } + // Given an event's allDay status and start date, return what its fallback end date should be. + // TODO: rename to computeDefaultEventEnd + function getDefaultEventEnd(allDay, marker, context) { + let { dateEnv, options } = context; + let end = marker; + if (allDay) { + end = startOfDay(end); + end = dateEnv.add(end, options.defaultAllDayEventDuration); + } + else { + end = dateEnv.add(end, options.defaultTimedEventDuration); + } + return end; + } + + // applies the mutation to ALL defs/instances within the event store + function applyMutationToEventStore(eventStore, eventConfigBase, mutation, context) { + let eventConfigs = compileEventUis(eventStore.defs, eventConfigBase); + let dest = createEmptyEventStore(); + for (let defId in eventStore.defs) { + let def = eventStore.defs[defId]; + dest.defs[defId] = applyMutationToEventDef(def, eventConfigs[defId], mutation, context); + } + for (let instanceId in eventStore.instances) { + let instance = eventStore.instances[instanceId]; + let def = dest.defs[instance.defId]; // important to grab the newly modified def + dest.instances[instanceId] = applyMutationToEventInstance(instance, def, eventConfigs[instance.defId], mutation, context); + } + return dest; + } + function applyMutationToEventDef(eventDef, eventConfig, mutation, context) { + let standardProps = mutation.standardProps || {}; + // if hasEnd has not been specified, guess a good value based on deltas. + // if duration will change, there's no way the default duration will persist, + // and thus, we need to mark the event as having a real end + if (standardProps.hasEnd == null && + eventConfig.durationEditable && + (mutation.startDelta || mutation.endDelta)) { + standardProps.hasEnd = true; // TODO: is this mutation okay? + } + let copy = Object.assign(Object.assign(Object.assign({}, eventDef), standardProps), { ui: Object.assign(Object.assign({}, eventDef.ui), standardProps.ui) }); + if (mutation.extendedProps) { + copy.extendedProps = Object.assign(Object.assign({}, copy.extendedProps), mutation.extendedProps); + } + for (let applier of context.pluginHooks.eventDefMutationAppliers) { + applier(copy, mutation, context); + } + if (!copy.hasEnd && context.options.forceEventDuration) { + copy.hasEnd = true; + } + return copy; + } + function applyMutationToEventInstance(eventInstance, eventDef, // must first be modified by applyMutationToEventDef + eventConfig, mutation, context) { + let { dateEnv } = context; + let forceAllDay = mutation.standardProps && mutation.standardProps.allDay === true; + let clearEnd = mutation.standardProps && mutation.standardProps.hasEnd === false; + let copy = Object.assign({}, eventInstance); + if (forceAllDay) { + copy.range = computeAlignedDayRange(copy.range); + } + if (mutation.datesDelta && eventConfig.startEditable) { + copy.range = { + start: dateEnv.add(copy.range.start, mutation.datesDelta), + end: dateEnv.add(copy.range.end, mutation.datesDelta), + }; + } + if (mutation.startDelta && eventConfig.durationEditable) { + copy.range = { + start: dateEnv.add(copy.range.start, mutation.startDelta), + end: copy.range.end, + }; + } + if (mutation.endDelta && eventConfig.durationEditable) { + copy.range = { + start: copy.range.start, + end: dateEnv.add(copy.range.end, mutation.endDelta), + }; + } + if (clearEnd) { + copy.range = { + start: copy.range.start, + end: getDefaultEventEnd(eventDef.allDay, copy.range.start, context), + }; + } + // in case event was all-day but the supplied deltas were not + // better util for this? + if (eventDef.allDay) { + copy.range = { + start: startOfDay(copy.range.start), + end: startOfDay(copy.range.end), + }; + } + // handle invalid durations + if (copy.range.end < copy.range.start) { + copy.range.end = getDefaultEventEnd(eventDef.allDay, copy.range.start, context); + } + return copy; + } + + class EventSourceImpl { + constructor(context, internalEventSource) { + this.context = context; + this.internalEventSource = internalEventSource; + } + remove() { + this.context.dispatch({ + type: 'REMOVE_EVENT_SOURCE', + sourceId: this.internalEventSource.sourceId, + }); + } + refetch() { + this.context.dispatch({ + type: 'FETCH_EVENT_SOURCES', + sourceIds: [this.internalEventSource.sourceId], + isRefetch: true, + }); + } + get id() { + return this.internalEventSource.publicId; + } + get url() { + return this.internalEventSource.meta.url; + } + get format() { + return this.internalEventSource.meta.format; // TODO: bad. not guaranteed + } + } + + class EventImpl { + // instance will be null if expressing a recurring event that has no current instances, + // OR if trying to validate an incoming external event that has no dates assigned + constructor(context, def, instance) { + this._context = context; + this._def = def; + this._instance = instance || null; + } + /* + TODO: make event struct more responsible for this + */ + setProp(name, val) { + if (name in EVENT_DATE_REFINERS) { + console.warn('Could not set date-related prop \'name\'. Use one of the date-related methods instead.'); + // TODO: make proper aliasing system? + } + else if (name === 'id') { + val = EVENT_NON_DATE_REFINERS[name](val); + this.mutate({ + standardProps: { publicId: val }, // hardcoded internal name + }); + } + else if (name in EVENT_NON_DATE_REFINERS) { + val = EVENT_NON_DATE_REFINERS[name](val); + this.mutate({ + standardProps: { [name]: val }, + }); + } + else if (name in EVENT_UI_REFINERS) { + let ui = EVENT_UI_REFINERS[name](val); + if (name === 'color') { + ui = { backgroundColor: val, borderColor: val }; + } + else if (name === 'editable') { + ui = { startEditable: val, durationEditable: val }; + } + else { + ui = { [name]: val }; + } + this.mutate({ + standardProps: { ui }, + }); + } + else { + console.warn(`Could not set prop '${name}'. Use setExtendedProp instead.`); + } + } + setExtendedProp(name, val) { + this.mutate({ + extendedProps: { [name]: val }, + }); + } + setStart(startInput, options = {}) { + let { dateEnv } = this._context; + let start = dateEnv.createMarker(startInput); + if (start && this._instance) { // TODO: warning if parsed bad + let instanceRange = this._instance.range; + let startDelta = diffDates(instanceRange.start, start, dateEnv, options.granularity); // what if parsed bad!? + if (options.maintainDuration) { + this.mutate({ datesDelta: startDelta }); + } + else { + this.mutate({ startDelta }); + } + } + } + setEnd(endInput, options = {}) { + let { dateEnv } = this._context; + let end; + if (endInput != null) { + end = dateEnv.createMarker(endInput); + if (!end) { + return; // TODO: warning if parsed bad + } + } + if (this._instance) { + if (end) { + let endDelta = diffDates(this._instance.range.end, end, dateEnv, options.granularity); + this.mutate({ endDelta }); + } + else { + this.mutate({ standardProps: { hasEnd: false } }); + } + } + } + setDates(startInput, endInput, options = {}) { + let { dateEnv } = this._context; + let standardProps = { allDay: options.allDay }; + let start = dateEnv.createMarker(startInput); + let end; + if (!start) { + return; // TODO: warning if parsed bad + } + if (endInput != null) { + end = dateEnv.createMarker(endInput); + if (!end) { // TODO: warning if parsed bad + return; + } + } + if (this._instance) { + let instanceRange = this._instance.range; + // when computing the diff for an event being converted to all-day, + // compute diff off of the all-day values the way event-mutation does. + if (options.allDay === true) { + instanceRange = computeAlignedDayRange(instanceRange); + } + let startDelta = diffDates(instanceRange.start, start, dateEnv, options.granularity); + if (end) { + let endDelta = diffDates(instanceRange.end, end, dateEnv, options.granularity); + if (durationsEqual(startDelta, endDelta)) { + this.mutate({ datesDelta: startDelta, standardProps }); + } + else { + this.mutate({ startDelta, endDelta, standardProps }); + } + } + else { // means "clear the end" + standardProps.hasEnd = false; + this.mutate({ datesDelta: startDelta, standardProps }); + } + } + } + moveStart(deltaInput) { + let delta = createDuration(deltaInput); + if (delta) { // TODO: warning if parsed bad + this.mutate({ startDelta: delta }); + } + } + moveEnd(deltaInput) { + let delta = createDuration(deltaInput); + if (delta) { // TODO: warning if parsed bad + this.mutate({ endDelta: delta }); + } + } + moveDates(deltaInput) { + let delta = createDuration(deltaInput); + if (delta) { // TODO: warning if parsed bad + this.mutate({ datesDelta: delta }); + } + } + setAllDay(allDay, options = {}) { + let standardProps = { allDay }; + let { maintainDuration } = options; + if (maintainDuration == null) { + maintainDuration = this._context.options.allDayMaintainDuration; + } + if (this._def.allDay !== allDay) { + standardProps.hasEnd = maintainDuration; + } + this.mutate({ standardProps }); + } + formatRange(formatInput) { + let { dateEnv } = this._context; + let instance = this._instance; + let formatter = createFormatter(formatInput); + if (this._def.hasEnd) { + return dateEnv.formatRange(instance.range.start, instance.range.end, formatter, { + forcedStartTzo: instance.forcedStartTzo, + forcedEndTzo: instance.forcedEndTzo, + }); + } + return dateEnv.format(instance.range.start, formatter, { + forcedTzo: instance.forcedStartTzo, + }); + } + mutate(mutation) { + let instance = this._instance; + if (instance) { + let def = this._def; + let context = this._context; + let { eventStore } = context.getCurrentData(); + let relevantEvents = getRelevantEvents(eventStore, instance.instanceId); + let eventConfigBase = { + '': { + display: '', + startEditable: true, + durationEditable: true, + constraints: [], + overlap: null, + allows: [], + backgroundColor: '', + borderColor: '', + textColor: '', + classNames: [], + }, + }; + relevantEvents = applyMutationToEventStore(relevantEvents, eventConfigBase, mutation, context); + let oldEvent = new EventImpl(context, def, instance); // snapshot + this._def = relevantEvents.defs[def.defId]; + this._instance = relevantEvents.instances[instance.instanceId]; + context.dispatch({ + type: 'MERGE_EVENTS', + eventStore: relevantEvents, + }); + context.emitter.trigger('eventChange', { + oldEvent, + event: this, + relatedEvents: buildEventApis(relevantEvents, context, instance), + revert() { + context.dispatch({ + type: 'RESET_EVENTS', + eventStore, // the ORIGINAL store + }); + }, + }); + } + } + remove() { + let context = this._context; + let asStore = eventApiToStore(this); + context.dispatch({ + type: 'REMOVE_EVENTS', + eventStore: asStore, + }); + context.emitter.trigger('eventRemove', { + event: this, + relatedEvents: [], + revert() { + context.dispatch({ + type: 'MERGE_EVENTS', + eventStore: asStore, + }); + }, + }); + } + get source() { + let { sourceId } = this._def; + if (sourceId) { + return new EventSourceImpl(this._context, this._context.getCurrentData().eventSources[sourceId]); + } + return null; + } + get start() { + return this._instance ? + this._context.dateEnv.toDate(this._instance.range.start) : + null; + } + get end() { + return (this._instance && this._def.hasEnd) ? + this._context.dateEnv.toDate(this._instance.range.end) : + null; + } + get startStr() { + let instance = this._instance; + if (instance) { + return this._context.dateEnv.formatIso(instance.range.start, { + omitTime: this._def.allDay, + forcedTzo: instance.forcedStartTzo, + }); + } + return ''; + } + get endStr() { + let instance = this._instance; + if (instance && this._def.hasEnd) { + return this._context.dateEnv.formatIso(instance.range.end, { + omitTime: this._def.allDay, + forcedTzo: instance.forcedEndTzo, + }); + } + return ''; + } + // computable props that all access the def + // TODO: find a TypeScript-compatible way to do this at scale + get id() { return this._def.publicId; } + get groupId() { return this._def.groupId; } + get allDay() { return this._def.allDay; } + get title() { return this._def.title; } + get url() { return this._def.url; } + get display() { return this._def.ui.display || 'auto'; } // bad. just normalize the type earlier + get startEditable() { return this._def.ui.startEditable; } + get durationEditable() { return this._def.ui.durationEditable; } + get constraint() { return this._def.ui.constraints[0] || null; } + get overlap() { return this._def.ui.overlap; } + get allow() { return this._def.ui.allows[0] || null; } + get backgroundColor() { return this._def.ui.backgroundColor; } + get borderColor() { return this._def.ui.borderColor; } + get textColor() { return this._def.ui.textColor; } + // NOTE: user can't modify these because Object.freeze was called in event-def parsing + get classNames() { return this._def.ui.classNames; } + get extendedProps() { return this._def.extendedProps; } + toPlainObject(settings = {}) { + let def = this._def; + let { ui } = def; + let { startStr, endStr } = this; + let res = {}; + if (def.title) { + res.title = def.title; + } + if (startStr) { + res.start = startStr; + } + if (endStr) { + res.end = endStr; + } + if (def.publicId) { + res.id = def.publicId; + } + if (def.groupId) { + res.groupId = def.groupId; + } + if (def.url) { + res.url = def.url; + } + if (ui.display && ui.display !== 'auto') { + res.display = ui.display; + } + // TODO: what about recurring-event properties??? + // TODO: include startEditable/durationEditable/constraint/overlap/allow + if (settings.collapseColor && ui.backgroundColor && ui.backgroundColor === ui.borderColor) { + res.color = ui.backgroundColor; + } + else { + if (ui.backgroundColor) { + res.backgroundColor = ui.backgroundColor; + } + if (ui.borderColor) { + res.borderColor = ui.borderColor; + } + } + if (ui.textColor) { + res.textColor = ui.textColor; + } + if (ui.classNames.length) { + res.classNames = ui.classNames; + } + if (Object.keys(def.extendedProps).length) { + if (settings.collapseExtendedProps) { + Object.assign(res, def.extendedProps); + } + else { + res.extendedProps = def.extendedProps; + } + } + return res; + } + toJSON() { + return this.toPlainObject(); + } + } + function eventApiToStore(eventApi) { + let def = eventApi._def; + let instance = eventApi._instance; + return { + defs: { [def.defId]: def }, + instances: instance + ? { [instance.instanceId]: instance } + : {}, + }; + } + function buildEventApis(eventStore, context, excludeInstance) { + let { defs, instances } = eventStore; + let eventApis = []; + let excludeInstanceId = excludeInstance ? excludeInstance.instanceId : ''; + for (let id in instances) { + let instance = instances[id]; + let def = defs[instance.defId]; + if (instance.instanceId !== excludeInstanceId) { + eventApis.push(new EventImpl(context, def, instance)); + } + } + return eventApis; + } + + /* + Specifying nextDayThreshold signals that all-day ranges should be sliced. + */ + function sliceEventStore(eventStore, eventUiBases, framingRange, nextDayThreshold) { + let inverseBgByGroupId = {}; + let inverseBgByDefId = {}; + let defByGroupId = {}; + let bgRanges = []; + let fgRanges = []; + let eventUis = compileEventUis(eventStore.defs, eventUiBases); + for (let defId in eventStore.defs) { + let def = eventStore.defs[defId]; + let ui = eventUis[def.defId]; + if (ui.display === 'inverse-background') { + if (def.groupId) { + inverseBgByGroupId[def.groupId] = []; + if (!defByGroupId[def.groupId]) { + defByGroupId[def.groupId] = def; + } + } + else { + inverseBgByDefId[defId] = []; + } + } + } + for (let instanceId in eventStore.instances) { + let instance = eventStore.instances[instanceId]; + let def = eventStore.defs[instance.defId]; + let ui = eventUis[def.defId]; + let origRange = instance.range; + let normalRange = (!def.allDay && nextDayThreshold) ? + computeVisibleDayRange(origRange, nextDayThreshold) : + origRange; + let slicedRange = intersectRanges(normalRange, framingRange); + if (slicedRange) { + if (ui.display === 'inverse-background') { + if (def.groupId) { + inverseBgByGroupId[def.groupId].push(slicedRange); + } + else { + inverseBgByDefId[instance.defId].push(slicedRange); + } + } + else if (ui.display !== 'none') { + (ui.display === 'background' ? bgRanges : fgRanges).push({ + def, + ui, + instance, + range: slicedRange, + isStart: normalRange.start && normalRange.start.valueOf() === slicedRange.start.valueOf(), + isEnd: normalRange.end && normalRange.end.valueOf() === slicedRange.end.valueOf(), + }); + } + } + } + for (let groupId in inverseBgByGroupId) { // BY GROUP + let ranges = inverseBgByGroupId[groupId]; + let invertedRanges = invertRanges(ranges, framingRange); + for (let invertedRange of invertedRanges) { + let def = defByGroupId[groupId]; + let ui = eventUis[def.defId]; + bgRanges.push({ + def, + ui, + instance: null, + range: invertedRange, + isStart: false, + isEnd: false, + }); + } + } + for (let defId in inverseBgByDefId) { + let ranges = inverseBgByDefId[defId]; + let invertedRanges = invertRanges(ranges, framingRange); + for (let invertedRange of invertedRanges) { + bgRanges.push({ + def: eventStore.defs[defId], + ui: eventUis[defId], + instance: null, + range: invertedRange, + isStart: false, + isEnd: false, + }); + } + } + return { bg: bgRanges, fg: fgRanges }; + } + function hasBgRendering(def) { + return def.ui.display === 'background' || def.ui.display === 'inverse-background'; + } + function setElSeg(el, seg) { + el.fcSeg = seg; + } + function getElSeg(el) { + return el.fcSeg || + el.parentNode.fcSeg || // for the harness + null; + } + // event ui computation + function compileEventUis(eventDefs, eventUiBases) { + return mapHash(eventDefs, (eventDef) => compileEventUi(eventDef, eventUiBases)); + } + function compileEventUi(eventDef, eventUiBases) { + let uis = []; + if (eventUiBases['']) { + uis.push(eventUiBases['']); + } + if (eventUiBases[eventDef.defId]) { + uis.push(eventUiBases[eventDef.defId]); + } + uis.push(eventDef.ui); + return combineEventUis(uis); + } + function sortEventSegs(segs, eventOrderSpecs) { + let objs = segs.map(buildSegCompareObj); + objs.sort((obj0, obj1) => compareByFieldSpecs(obj0, obj1, eventOrderSpecs)); + return objs.map((c) => c._seg); + } + // returns a object with all primitive props that can be compared + function buildSegCompareObj(seg) { + let { eventRange } = seg; + let eventDef = eventRange.def; + let range = eventRange.instance ? eventRange.instance.range : eventRange.range; + let start = range.start ? range.start.valueOf() : 0; // TODO: better support for open-range events + let end = range.end ? range.end.valueOf() : 0; // " + return Object.assign(Object.assign(Object.assign({}, eventDef.extendedProps), eventDef), { id: eventDef.publicId, start, + end, duration: end - start, allDay: Number(eventDef.allDay), _seg: seg }); + } + function computeSegDraggable(seg, context) { + let { pluginHooks } = context; + let transformers = pluginHooks.isDraggableTransformers; + let { def, ui } = seg.eventRange; + let val = ui.startEditable; + for (let transformer of transformers) { + val = transformer(val, def, ui, context); + } + return val; + } + function computeSegStartResizable(seg, context) { + return seg.isStart && seg.eventRange.ui.durationEditable && context.options.eventResizableFromStart; + } + function computeSegEndResizable(seg, context) { + return seg.isEnd && seg.eventRange.ui.durationEditable; + } + function buildSegTimeText(seg, timeFormat, context, defaultDisplayEventTime, // defaults to true + defaultDisplayEventEnd, // defaults to true + startOverride, endOverride) { + let { dateEnv, options } = context; + let { displayEventTime, displayEventEnd } = options; + let eventDef = seg.eventRange.def; + let eventInstance = seg.eventRange.instance; + if (displayEventTime == null) { + displayEventTime = defaultDisplayEventTime !== false; + } + if (displayEventEnd == null) { + displayEventEnd = defaultDisplayEventEnd !== false; + } + let wholeEventStart = eventInstance.range.start; + let wholeEventEnd = eventInstance.range.end; + let segStart = startOverride || seg.start || seg.eventRange.range.start; + let segEnd = endOverride || seg.end || seg.eventRange.range.end; + let isStartDay = startOfDay(wholeEventStart).valueOf() === startOfDay(segStart).valueOf(); + let isEndDay = startOfDay(addMs(wholeEventEnd, -1)).valueOf() === startOfDay(addMs(segEnd, -1)).valueOf(); + if (displayEventTime && !eventDef.allDay && (isStartDay || isEndDay)) { + segStart = isStartDay ? wholeEventStart : segStart; + segEnd = isEndDay ? wholeEventEnd : segEnd; + if (displayEventEnd && eventDef.hasEnd) { + return dateEnv.formatRange(segStart, segEnd, timeFormat, { + forcedStartTzo: startOverride ? null : eventInstance.forcedStartTzo, + forcedEndTzo: endOverride ? null : eventInstance.forcedEndTzo, + }); + } + return dateEnv.format(segStart, timeFormat, { + forcedTzo: startOverride ? null : eventInstance.forcedStartTzo, // nooooo, same + }); + } + return ''; + } + function getSegMeta(seg, todayRange, nowDate) { + let segRange = seg.eventRange.range; + return { + isPast: segRange.end < (nowDate || todayRange.start), + isFuture: segRange.start >= (nowDate || todayRange.end), + isToday: todayRange && rangeContainsMarker(todayRange, segRange.start), + }; + } + function getEventClassNames(props) { + let classNames = ['fc-event']; + if (props.isMirror) { + classNames.push('fc-event-mirror'); + } + if (props.isDraggable) { + classNames.push('fc-event-draggable'); + } + if (props.isStartResizable || props.isEndResizable) { + classNames.push('fc-event-resizable'); + } + if (props.isDragging) { + classNames.push('fc-event-dragging'); + } + if (props.isResizing) { + classNames.push('fc-event-resizing'); + } + if (props.isSelected) { + classNames.push('fc-event-selected'); + } + if (props.isStart) { + classNames.push('fc-event-start'); + } + if (props.isEnd) { + classNames.push('fc-event-end'); + } + if (props.isPast) { + classNames.push('fc-event-past'); + } + if (props.isToday) { + classNames.push('fc-event-today'); + } + if (props.isFuture) { + classNames.push('fc-event-future'); + } + return classNames; + } + function buildEventRangeKey(eventRange) { + return eventRange.instance + ? eventRange.instance.instanceId + : `${eventRange.def.defId}:${eventRange.range.start.toISOString()}`; + // inverse-background events don't have specific instances. TODO: better solution + } + function getSegAnchorAttrs(seg, context) { + let { def, instance } = seg.eventRange; + let { url } = def; + if (url) { + return { href: url }; + } + let { emitter, options } = context; + let { eventInteractive } = options; + if (eventInteractive == null) { + eventInteractive = def.interactive; + if (eventInteractive == null) { + eventInteractive = Boolean(emitter.hasHandlers('eventClick')); + } + } + // mock what happens in EventClicking + if (eventInteractive) { + // only attach keyboard-related handlers because click handler is already done in EventClicking + return createAriaKeyboardAttrs((ev) => { + emitter.trigger('eventClick', { + el: ev.target, + event: new EventImpl(context, def, instance), + jsEvent: ev, + view: context.viewApi, + }); + }); + } + return {}; + } + + const STANDARD_PROPS = { + start: identity, + end: identity, + allDay: Boolean, + }; + function parseDateSpan(raw, dateEnv, defaultDuration) { + let span = parseOpenDateSpan(raw, dateEnv); + let { range } = span; + if (!range.start) { + return null; + } + if (!range.end) { + if (defaultDuration == null) { + return null; + } + range.end = dateEnv.add(range.start, defaultDuration); + } + return span; + } + /* + TODO: somehow combine with parseRange? + Will return null if the start/end props were present but parsed invalidly. + */ + function parseOpenDateSpan(raw, dateEnv) { + let { refined: standardProps, extra } = refineProps(raw, STANDARD_PROPS); + let startMeta = standardProps.start ? dateEnv.createMarkerMeta(standardProps.start) : null; + let endMeta = standardProps.end ? dateEnv.createMarkerMeta(standardProps.end) : null; + let { allDay } = standardProps; + if (allDay == null) { + allDay = (startMeta && startMeta.isTimeUnspecified) && + (!endMeta || endMeta.isTimeUnspecified); + } + return Object.assign({ range: { + start: startMeta ? startMeta.marker : null, + end: endMeta ? endMeta.marker : null, + }, allDay }, extra); + } + function isDateSpansEqual(span0, span1) { + return rangesEqual(span0.range, span1.range) && + span0.allDay === span1.allDay && + isSpanPropsEqual(span0, span1); + } + // the NON-DATE-RELATED props + function isSpanPropsEqual(span0, span1) { + for (let propName in span1) { + if (propName !== 'range' && propName !== 'allDay') { + if (span0[propName] !== span1[propName]) { + return false; + } + } + } + // are there any props that span0 has that span1 DOESN'T have? + // both have range/allDay, so no need to special-case. + for (let propName in span0) { + if (!(propName in span1)) { + return false; + } + } + return true; + } + function buildDateSpanApi(span, dateEnv) { + return Object.assign(Object.assign({}, buildRangeApi(span.range, dateEnv, span.allDay)), { allDay: span.allDay }); + } + function buildRangeApiWithTimeZone(range, dateEnv, omitTime) { + return Object.assign(Object.assign({}, buildRangeApi(range, dateEnv, omitTime)), { timeZone: dateEnv.timeZone }); + } + function buildRangeApi(range, dateEnv, omitTime) { + return { + start: dateEnv.toDate(range.start), + end: dateEnv.toDate(range.end), + startStr: dateEnv.formatIso(range.start, { omitTime }), + endStr: dateEnv.formatIso(range.end, { omitTime }), + }; + } + function fabricateEventRange(dateSpan, eventUiBases, context) { + let res = refineEventDef({ editable: false }, context); + let def = parseEventDef(res.refined, res.extra, '', // sourceId + dateSpan.allDay, true, // hasEnd + context); + return { + def, + ui: compileEventUi(def, eventUiBases), + instance: createEventInstance(def.defId, dateSpan.range), + range: dateSpan.range, + isStart: true, + isEnd: true, + }; + } + + /* + given a function that resolves a result asynchronously. + the function can either call passed-in success and failure callbacks, + or it can return a promise. + if you need to pass additional params to func, bind them first. + */ + function unpromisify(func, normalizedSuccessCallback, normalizedFailureCallback) { + // guard against success/failure callbacks being called more than once + // and guard against a promise AND callback being used together. + let isResolved = false; + let wrappedSuccess = function (res) { + if (!isResolved) { + isResolved = true; + normalizedSuccessCallback(res); + } + }; + let wrappedFailure = function (error) { + if (!isResolved) { + isResolved = true; + normalizedFailureCallback(error); + } + }; + let res = func(wrappedSuccess, wrappedFailure); + if (res && typeof res.then === 'function') { + res.then(wrappedSuccess, wrappedFailure); + } + } + + class JsonRequestError extends Error { + constructor(message, response) { + super(message); + this.response = response; + } + } + function requestJson(method, url, params) { + method = method.toUpperCase(); + const fetchOptions = { + method, + }; + if (method === 'GET') { + url += (url.indexOf('?') === -1 ? '?' : '&') + + new URLSearchParams(params); + } + else { + fetchOptions.body = new URLSearchParams(params); + fetchOptions.headers = { + 'Content-Type': 'application/x-www-form-urlencoded', + }; + } + return fetch(url, fetchOptions).then((fetchRes) => { + if (fetchRes.ok) { + return fetchRes.json().then((parsedResponse) => { + return [parsedResponse, fetchRes]; + }, () => { + throw new JsonRequestError('Failure parsing JSON', fetchRes); + }); + } + else { + throw new JsonRequestError('Request failed', fetchRes); + } + }); + } + + let canVGrowWithinCell; + function getCanVGrowWithinCell() { + if (canVGrowWithinCell == null) { + canVGrowWithinCell = computeCanVGrowWithinCell(); + } + return canVGrowWithinCell; + } + function computeCanVGrowWithinCell() { + // for SSR, because this function is call immediately at top-level + // TODO: just make this logic execute top-level, immediately, instead of doing lazily + if (typeof document === 'undefined') { + return true; + } + let el = document.createElement('div'); + el.style.position = 'absolute'; + el.style.top = '0px'; + el.style.left = '0px'; + el.innerHTML = '<table><tr><td><div></div></td></tr></table>'; + el.querySelector('table').style.height = '100px'; + el.querySelector('div').style.height = '100%'; + document.body.appendChild(el); + let div = el.querySelector('div'); + let possible = div.offsetHeight > 0; + document.body.removeChild(el); + return possible; + } + + class CalendarRoot extends BaseComponent { + constructor() { + super(...arguments); + this.state = { + forPrint: false, + }; + this.handleBeforePrint = () => { + this.setState({ forPrint: true }); + }; + this.handleAfterPrint = () => { + this.setState({ forPrint: false }); + }; + } + render() { + let { props } = this; + let { options } = props; + let { forPrint } = this.state; + let isHeightAuto = forPrint || options.height === 'auto' || options.contentHeight === 'auto'; + let height = (!isHeightAuto && options.height != null) ? options.height : ''; + let classNames = [ + 'fc', + forPrint ? 'fc-media-print' : 'fc-media-screen', + `fc-direction-${options.direction}`, + props.theme.getClass('root'), + ]; + if (!getCanVGrowWithinCell()) { + classNames.push('fc-liquid-hack'); + } + return props.children(classNames, height, isHeightAuto, forPrint); + } + componentDidMount() { + let { emitter } = this.props; + emitter.on('_beforeprint', this.handleBeforePrint); + emitter.on('_afterprint', this.handleAfterPrint); + } + componentWillUnmount() { + let { emitter } = this.props; + emitter.off('_beforeprint', this.handleBeforePrint); + emitter.off('_afterprint', this.handleAfterPrint); + } + } + + class Interaction { + constructor(settings) { + this.component = settings.component; + this.isHitComboAllowed = settings.isHitComboAllowed || null; + } + destroy() { + } + } + function parseInteractionSettings(component, input) { + return { + component, + el: input.el, + useEventCenter: input.useEventCenter != null ? input.useEventCenter : true, + isHitComboAllowed: input.isHitComboAllowed || null, + }; + } + function interactionSettingsToStore(settings) { + return { + [settings.component.uid]: settings, + }; + } + // global state + const interactionSettingsStore = {}; + + class CalendarImpl { + getCurrentData() { + return this.currentDataManager.getCurrentData(); + } + dispatch(action) { + this.currentDataManager.dispatch(action); + } + get view() { return this.getCurrentData().viewApi; } + batchRendering(callback) { + callback(); + } + updateSize() { + this.trigger('_resize', true); + } + // Options + // ----------------------------------------------------------------------------------------------------------------- + setOption(name, val) { + this.dispatch({ + type: 'SET_OPTION', + optionName: name, + rawOptionValue: val, + }); + } + getOption(name) { + return this.currentDataManager.currentCalendarOptionsInput[name]; + } + getAvailableLocaleCodes() { + return Object.keys(this.getCurrentData().availableRawLocales); + } + // Trigger + // ----------------------------------------------------------------------------------------------------------------- + on(handlerName, handler) { + let { currentDataManager } = this; + if (currentDataManager.currentCalendarOptionsRefiners[handlerName]) { + currentDataManager.emitter.on(handlerName, handler); + } + else { + console.warn(`Unknown listener name '${handlerName}'`); + } + } + off(handlerName, handler) { + this.currentDataManager.emitter.off(handlerName, handler); + } + // not meant for public use + trigger(handlerName, ...args) { + this.currentDataManager.emitter.trigger(handlerName, ...args); + } + // View + // ----------------------------------------------------------------------------------------------------------------- + changeView(viewType, dateOrRange) { + this.batchRendering(() => { + this.unselect(); + if (dateOrRange) { + if (dateOrRange.start && dateOrRange.end) { // a range + this.dispatch({ + type: 'CHANGE_VIEW_TYPE', + viewType, + }); + this.dispatch({ + type: 'SET_OPTION', + optionName: 'visibleRange', + rawOptionValue: dateOrRange, + }); + } + else { + let { dateEnv } = this.getCurrentData(); + this.dispatch({ + type: 'CHANGE_VIEW_TYPE', + viewType, + dateMarker: dateEnv.createMarker(dateOrRange), + }); + } + } + else { + this.dispatch({ + type: 'CHANGE_VIEW_TYPE', + viewType, + }); + } + }); + } + // Forces navigation to a view for the given date. + // `viewType` can be a specific view name or a generic one like "week" or "day". + // needs to change + zoomTo(dateMarker, viewType) { + let state = this.getCurrentData(); + let spec; + viewType = viewType || 'day'; // day is default zoom + spec = state.viewSpecs[viewType] || this.getUnitViewSpec(viewType); + this.unselect(); + if (spec) { + this.dispatch({ + type: 'CHANGE_VIEW_TYPE', + viewType: spec.type, + dateMarker, + }); + } + else { + this.dispatch({ + type: 'CHANGE_DATE', + dateMarker, + }); + } + } + // Given a duration singular unit, like "week" or "day", finds a matching view spec. + // Preference is given to views that have corresponding buttons. + getUnitViewSpec(unit) { + let { viewSpecs, toolbarConfig } = this.getCurrentData(); + let viewTypes = [].concat(toolbarConfig.header ? toolbarConfig.header.viewsWithButtons : [], toolbarConfig.footer ? toolbarConfig.footer.viewsWithButtons : []); + let i; + let spec; + for (let viewType in viewSpecs) { + viewTypes.push(viewType); + } + for (i = 0; i < viewTypes.length; i += 1) { + spec = viewSpecs[viewTypes[i]]; + if (spec) { + if (spec.singleUnit === unit) { + return spec; + } + } + } + return null; + } + // Current Date + // ----------------------------------------------------------------------------------------------------------------- + prev() { + this.unselect(); + this.dispatch({ type: 'PREV' }); + } + next() { + this.unselect(); + this.dispatch({ type: 'NEXT' }); + } + prevYear() { + let state = this.getCurrentData(); + this.unselect(); + this.dispatch({ + type: 'CHANGE_DATE', + dateMarker: state.dateEnv.addYears(state.currentDate, -1), + }); + } + nextYear() { + let state = this.getCurrentData(); + this.unselect(); + this.dispatch({ + type: 'CHANGE_DATE', + dateMarker: state.dateEnv.addYears(state.currentDate, 1), + }); + } + today() { + let state = this.getCurrentData(); + this.unselect(); + this.dispatch({ + type: 'CHANGE_DATE', + dateMarker: getNow(state.calendarOptions.now, state.dateEnv), + }); + } + gotoDate(zonedDateInput) { + let state = this.getCurrentData(); + this.unselect(); + this.dispatch({ + type: 'CHANGE_DATE', + dateMarker: state.dateEnv.createMarker(zonedDateInput), + }); + } + incrementDate(deltaInput) { + let state = this.getCurrentData(); + let delta = createDuration(deltaInput); + if (delta) { // else, warn about invalid input? + this.unselect(); + this.dispatch({ + type: 'CHANGE_DATE', + dateMarker: state.dateEnv.add(state.currentDate, delta), + }); + } + } + getDate() { + let state = this.getCurrentData(); + return state.dateEnv.toDate(state.currentDate); + } + // Date Formatting Utils + // ----------------------------------------------------------------------------------------------------------------- + formatDate(d, formatter) { + let { dateEnv } = this.getCurrentData(); + return dateEnv.format(dateEnv.createMarker(d), createFormatter(formatter)); + } + // `settings` is for formatter AND isEndExclusive + formatRange(d0, d1, settings) { + let { dateEnv } = this.getCurrentData(); + return dateEnv.formatRange(dateEnv.createMarker(d0), dateEnv.createMarker(d1), createFormatter(settings), settings); + } + formatIso(d, omitTime) { + let { dateEnv } = this.getCurrentData(); + return dateEnv.formatIso(dateEnv.createMarker(d), { omitTime }); + } + // Date Selection / Event Selection / DayClick + // ----------------------------------------------------------------------------------------------------------------- + select(dateOrObj, endDate) { + let selectionInput; + if (endDate == null) { + if (dateOrObj.start != null) { + selectionInput = dateOrObj; + } + else { + selectionInput = { + start: dateOrObj, + end: null, + }; + } + } + else { + selectionInput = { + start: dateOrObj, + end: endDate, + }; + } + let state = this.getCurrentData(); + let selection = parseDateSpan(selectionInput, state.dateEnv, createDuration({ days: 1 })); + if (selection) { // throw parse error otherwise? + this.dispatch({ type: 'SELECT_DATES', selection }); + triggerDateSelect(selection, null, state); + } + } + unselect(pev) { + let state = this.getCurrentData(); + if (state.dateSelection) { + this.dispatch({ type: 'UNSELECT_DATES' }); + triggerDateUnselect(pev, state); + } + } + // Public Events API + // ----------------------------------------------------------------------------------------------------------------- + addEvent(eventInput, sourceInput) { + if (eventInput instanceof EventImpl) { + let def = eventInput._def; + let instance = eventInput._instance; + let currentData = this.getCurrentData(); + // not already present? don't want to add an old snapshot + if (!currentData.eventStore.defs[def.defId]) { + this.dispatch({ + type: 'ADD_EVENTS', + eventStore: eventTupleToStore({ def, instance }), // TODO: better util for two args? + }); + this.triggerEventAdd(eventInput); + } + return eventInput; + } + let state = this.getCurrentData(); + let eventSource; + if (sourceInput instanceof EventSourceImpl) { + eventSource = sourceInput.internalEventSource; + } + else if (typeof sourceInput === 'boolean') { + if (sourceInput) { // true. part of the first event source + [eventSource] = hashValuesToArray(state.eventSources); + } + } + else if (sourceInput != null) { // an ID. accepts a number too + let sourceApi = this.getEventSourceById(sourceInput); // TODO: use an internal function + if (!sourceApi) { + console.warn(`Could not find an event source with ID "${sourceInput}"`); // TODO: test + return null; + } + eventSource = sourceApi.internalEventSource; + } + let tuple = parseEvent(eventInput, eventSource, state, false); + if (tuple) { + let newEventApi = new EventImpl(state, tuple.def, tuple.def.recurringDef ? null : tuple.instance); + this.dispatch({ + type: 'ADD_EVENTS', + eventStore: eventTupleToStore(tuple), + }); + this.triggerEventAdd(newEventApi); + return newEventApi; + } + return null; + } + triggerEventAdd(eventApi) { + let { emitter } = this.getCurrentData(); + emitter.trigger('eventAdd', { + event: eventApi, + relatedEvents: [], + revert: () => { + this.dispatch({ + type: 'REMOVE_EVENTS', + eventStore: eventApiToStore(eventApi), + }); + }, + }); + } + // TODO: optimize + getEventById(id) { + let state = this.getCurrentData(); + let { defs, instances } = state.eventStore; + id = String(id); + for (let defId in defs) { + let def = defs[defId]; + if (def.publicId === id) { + if (def.recurringDef) { + return new EventImpl(state, def, null); + } + for (let instanceId in instances) { + let instance = instances[instanceId]; + if (instance.defId === def.defId) { + return new EventImpl(state, def, instance); + } + } + } + } + return null; + } + getEvents() { + let currentData = this.getCurrentData(); + return buildEventApis(currentData.eventStore, currentData); + } + removeAllEvents() { + this.dispatch({ type: 'REMOVE_ALL_EVENTS' }); + } + // Public Event Sources API + // ----------------------------------------------------------------------------------------------------------------- + getEventSources() { + let state = this.getCurrentData(); + let sourceHash = state.eventSources; + let sourceApis = []; + for (let internalId in sourceHash) { + sourceApis.push(new EventSourceImpl(state, sourceHash[internalId])); + } + return sourceApis; + } + getEventSourceById(id) { + let state = this.getCurrentData(); + let sourceHash = state.eventSources; + id = String(id); + for (let sourceId in sourceHash) { + if (sourceHash[sourceId].publicId === id) { + return new EventSourceImpl(state, sourceHash[sourceId]); + } + } + return null; + } + addEventSource(sourceInput) { + let state = this.getCurrentData(); + if (sourceInput instanceof EventSourceImpl) { + // not already present? don't want to add an old snapshot + if (!state.eventSources[sourceInput.internalEventSource.sourceId]) { + this.dispatch({ + type: 'ADD_EVENT_SOURCES', + sources: [sourceInput.internalEventSource], + }); + } + return sourceInput; + } + let eventSource = parseEventSource(sourceInput, state); + if (eventSource) { // TODO: error otherwise? + this.dispatch({ type: 'ADD_EVENT_SOURCES', sources: [eventSource] }); + return new EventSourceImpl(state, eventSource); + } + return null; + } + removeAllEventSources() { + this.dispatch({ type: 'REMOVE_ALL_EVENT_SOURCES' }); + } + refetchEvents() { + this.dispatch({ type: 'FETCH_EVENT_SOURCES', isRefetch: true }); + } + // Scroll + // ----------------------------------------------------------------------------------------------------------------- + scrollToTime(timeInput) { + let time = createDuration(timeInput); + if (time) { + this.trigger('_scrollRequest', { time }); + } + } + } + + function pointInsideRect(point, rect) { + return point.left >= rect.left && + point.left < rect.right && + point.top >= rect.top && + point.top < rect.bottom; + } + // Returns a new rectangle that is the intersection of the two rectangles. If they don't intersect, returns false + function intersectRects(rect1, rect2) { + let res = { + left: Math.max(rect1.left, rect2.left), + right: Math.min(rect1.right, rect2.right), + top: Math.max(rect1.top, rect2.top), + bottom: Math.min(rect1.bottom, rect2.bottom), + }; + if (res.left < res.right && res.top < res.bottom) { + return res; + } + return false; + } + function translateRect(rect, deltaX, deltaY) { + return { + left: rect.left + deltaX, + right: rect.right + deltaX, + top: rect.top + deltaY, + bottom: rect.bottom + deltaY, + }; + } + // Returns a new point that will have been moved to reside within the given rectangle + function constrainPoint(point, rect) { + return { + left: Math.min(Math.max(point.left, rect.left), rect.right), + top: Math.min(Math.max(point.top, rect.top), rect.bottom), + }; + } + // Returns a point that is the center of the given rectangle + function getRectCenter(rect) { + return { + left: (rect.left + rect.right) / 2, + top: (rect.top + rect.bottom) / 2, + }; + } + // Subtracts point2's coordinates from point1's coordinates, returning a delta + function diffPoints(point1, point2) { + return { + left: point1.left - point2.left, + top: point1.top - point2.top, + }; + } + + const EMPTY_EVENT_STORE = createEmptyEventStore(); // for purecomponents. TODO: keep elsewhere + class Splitter { + constructor() { + this.getKeysForEventDefs = memoize(this._getKeysForEventDefs); + this.splitDateSelection = memoize(this._splitDateSpan); + this.splitEventStore = memoize(this._splitEventStore); + this.splitIndividualUi = memoize(this._splitIndividualUi); + this.splitEventDrag = memoize(this._splitInteraction); + this.splitEventResize = memoize(this._splitInteraction); + this.eventUiBuilders = {}; // TODO: typescript protection + } + splitProps(props) { + let keyInfos = this.getKeyInfo(props); + let defKeys = this.getKeysForEventDefs(props.eventStore); + let dateSelections = this.splitDateSelection(props.dateSelection); + let individualUi = this.splitIndividualUi(props.eventUiBases, defKeys); // the individual *bases* + let eventStores = this.splitEventStore(props.eventStore, defKeys); + let eventDrags = this.splitEventDrag(props.eventDrag); + let eventResizes = this.splitEventResize(props.eventResize); + let splitProps = {}; + this.eventUiBuilders = mapHash(keyInfos, (info, key) => this.eventUiBuilders[key] || memoize(buildEventUiForKey)); + for (let key in keyInfos) { + let keyInfo = keyInfos[key]; + let eventStore = eventStores[key] || EMPTY_EVENT_STORE; + let buildEventUi = this.eventUiBuilders[key]; + splitProps[key] = { + businessHours: keyInfo.businessHours || props.businessHours, + dateSelection: dateSelections[key] || null, + eventStore, + eventUiBases: buildEventUi(props.eventUiBases[''], keyInfo.ui, individualUi[key]), + eventSelection: eventStore.instances[props.eventSelection] ? props.eventSelection : '', + eventDrag: eventDrags[key] || null, + eventResize: eventResizes[key] || null, + }; + } + return splitProps; + } + _splitDateSpan(dateSpan) { + let dateSpans = {}; + if (dateSpan) { + let keys = this.getKeysForDateSpan(dateSpan); + for (let key of keys) { + dateSpans[key] = dateSpan; + } + } + return dateSpans; + } + _getKeysForEventDefs(eventStore) { + return mapHash(eventStore.defs, (eventDef) => this.getKeysForEventDef(eventDef)); + } + _splitEventStore(eventStore, defKeys) { + let { defs, instances } = eventStore; + let splitStores = {}; + for (let defId in defs) { + for (let key of defKeys[defId]) { + if (!splitStores[key]) { + splitStores[key] = createEmptyEventStore(); + } + splitStores[key].defs[defId] = defs[defId]; + } + } + for (let instanceId in instances) { + let instance = instances[instanceId]; + for (let key of defKeys[instance.defId]) { + if (splitStores[key]) { // must have already been created + splitStores[key].instances[instanceId] = instance; + } + } + } + return splitStores; + } + _splitIndividualUi(eventUiBases, defKeys) { + let splitHashes = {}; + for (let defId in eventUiBases) { + if (defId) { // not the '' key + for (let key of defKeys[defId]) { + if (!splitHashes[key]) { + splitHashes[key] = {}; + } + splitHashes[key][defId] = eventUiBases[defId]; + } + } + } + return splitHashes; + } + _splitInteraction(interaction) { + let splitStates = {}; + if (interaction) { + let affectedStores = this._splitEventStore(interaction.affectedEvents, this._getKeysForEventDefs(interaction.affectedEvents)); + // can't rely on defKeys because event data is mutated + let mutatedKeysByDefId = this._getKeysForEventDefs(interaction.mutatedEvents); + let mutatedStores = this._splitEventStore(interaction.mutatedEvents, mutatedKeysByDefId); + let populate = (key) => { + if (!splitStates[key]) { + splitStates[key] = { + affectedEvents: affectedStores[key] || EMPTY_EVENT_STORE, + mutatedEvents: mutatedStores[key] || EMPTY_EVENT_STORE, + isEvent: interaction.isEvent, + }; + } + }; + for (let key in affectedStores) { + populate(key); + } + for (let key in mutatedStores) { + populate(key); + } + } + return splitStates; + } + } + function buildEventUiForKey(allUi, eventUiForKey, individualUi) { + let baseParts = []; + if (allUi) { + baseParts.push(allUi); + } + if (eventUiForKey) { + baseParts.push(eventUiForKey); + } + let stuff = { + '': combineEventUis(baseParts), + }; + if (individualUi) { + Object.assign(stuff, individualUi); + } + return stuff; + } + + function getDateMeta(date, todayRange, nowDate, dateProfile) { + return { + dow: date.getUTCDay(), + isDisabled: Boolean(dateProfile && !rangeContainsMarker(dateProfile.activeRange, date)), + isOther: Boolean(dateProfile && !rangeContainsMarker(dateProfile.currentRange, date)), + isToday: Boolean(todayRange && rangeContainsMarker(todayRange, date)), + isPast: Boolean(nowDate ? (date < nowDate) : todayRange ? (date < todayRange.start) : false), + isFuture: Boolean(nowDate ? (date > nowDate) : todayRange ? (date >= todayRange.end) : false), + }; + } + function getDayClassNames(meta, theme) { + let classNames = [ + 'fc-day', + `fc-day-${DAY_IDS[meta.dow]}`, + ]; + if (meta.isDisabled) { + classNames.push('fc-day-disabled'); + } + else { + if (meta.isToday) { + classNames.push('fc-day-today'); + classNames.push(theme.getClass('today')); + } + if (meta.isPast) { + classNames.push('fc-day-past'); + } + if (meta.isFuture) { + classNames.push('fc-day-future'); + } + if (meta.isOther) { + classNames.push('fc-day-other'); + } + } + return classNames; + } + function getSlotClassNames(meta, theme) { + let classNames = [ + 'fc-slot', + `fc-slot-${DAY_IDS[meta.dow]}`, + ]; + if (meta.isDisabled) { + classNames.push('fc-slot-disabled'); + } + else { + if (meta.isToday) { + classNames.push('fc-slot-today'); + classNames.push(theme.getClass('today')); + } + if (meta.isPast) { + classNames.push('fc-slot-past'); + } + if (meta.isFuture) { + classNames.push('fc-slot-future'); + } + } + return classNames; + } + + const DAY_FORMAT = createFormatter({ year: 'numeric', month: 'long', day: 'numeric' }); + const WEEK_FORMAT = createFormatter({ week: 'long' }); + function buildNavLinkAttrs(context, dateMarker, viewType = 'day', isTabbable = true) { + const { dateEnv, options, calendarApi } = context; + let dateStr = dateEnv.format(dateMarker, viewType === 'week' ? WEEK_FORMAT : DAY_FORMAT); + if (options.navLinks) { + let zonedDate = dateEnv.toDate(dateMarker); + const handleInteraction = (ev) => { + let customAction = viewType === 'day' ? options.navLinkDayClick : + viewType === 'week' ? options.navLinkWeekClick : null; + if (typeof customAction === 'function') { + customAction.call(calendarApi, dateEnv.toDate(dateMarker), ev); + } + else { + if (typeof customAction === 'string') { + viewType = customAction; + } + calendarApi.zoomTo(dateMarker, viewType); + } + }; + return Object.assign({ title: formatWithOrdinals(options.navLinkHint, [dateStr, zonedDate], dateStr), 'data-navlink': '' }, (isTabbable + ? createAriaClickAttrs(handleInteraction) + : { onClick: handleInteraction })); + } + return { 'aria-label': dateStr }; + } + + let _isRtlScrollbarOnLeft = null; + function getIsRtlScrollbarOnLeft() { + if (_isRtlScrollbarOnLeft === null) { + _isRtlScrollbarOnLeft = computeIsRtlScrollbarOnLeft(); + } + return _isRtlScrollbarOnLeft; + } + function computeIsRtlScrollbarOnLeft() { + let outerEl = document.createElement('div'); + applyStyle(outerEl, { + position: 'absolute', + top: -1000, + left: 0, + border: 0, + padding: 0, + overflow: 'scroll', + direction: 'rtl', + }); + outerEl.innerHTML = '<div></div>'; + document.body.appendChild(outerEl); + let innerEl = outerEl.firstChild; + let res = innerEl.getBoundingClientRect().left > outerEl.getBoundingClientRect().left; + removeElement(outerEl); + return res; + } + + let _scrollbarWidths; + function getScrollbarWidths() { + if (!_scrollbarWidths) { + _scrollbarWidths = computeScrollbarWidths(); + } + return _scrollbarWidths; + } + function computeScrollbarWidths() { + let el = document.createElement('div'); + el.style.overflow = 'scroll'; + el.style.position = 'absolute'; + el.style.top = '-9999px'; + el.style.left = '-9999px'; + document.body.appendChild(el); + let res = computeScrollbarWidthsForEl(el); + document.body.removeChild(el); + return res; + } + // WARNING: will include border + function computeScrollbarWidthsForEl(el) { + return { + x: el.offsetHeight - el.clientHeight, + y: el.offsetWidth - el.clientWidth, + }; + } + + function computeEdges(el, getPadding = false) { + let computedStyle = window.getComputedStyle(el); + let borderLeft = parseInt(computedStyle.borderLeftWidth, 10) || 0; + let borderRight = parseInt(computedStyle.borderRightWidth, 10) || 0; + let borderTop = parseInt(computedStyle.borderTopWidth, 10) || 0; + let borderBottom = parseInt(computedStyle.borderBottomWidth, 10) || 0; + let badScrollbarWidths = computeScrollbarWidthsForEl(el); // includes border! + let scrollbarLeftRight = badScrollbarWidths.y - borderLeft - borderRight; + let scrollbarBottom = badScrollbarWidths.x - borderTop - borderBottom; + let res = { + borderLeft, + borderRight, + borderTop, + borderBottom, + scrollbarBottom, + scrollbarLeft: 0, + scrollbarRight: 0, + }; + if (getIsRtlScrollbarOnLeft() && computedStyle.direction === 'rtl') { // is the scrollbar on the left side? + res.scrollbarLeft = scrollbarLeftRight; + } + else { + res.scrollbarRight = scrollbarLeftRight; + } + if (getPadding) { + res.paddingLeft = parseInt(computedStyle.paddingLeft, 10) || 0; + res.paddingRight = parseInt(computedStyle.paddingRight, 10) || 0; + res.paddingTop = parseInt(computedStyle.paddingTop, 10) || 0; + res.paddingBottom = parseInt(computedStyle.paddingBottom, 10) || 0; + } + return res; + } + function computeInnerRect(el, goWithinPadding = false, doFromWindowViewport) { + let outerRect = doFromWindowViewport ? el.getBoundingClientRect() : computeRect(el); + let edges = computeEdges(el, goWithinPadding); + let res = { + left: outerRect.left + edges.borderLeft + edges.scrollbarLeft, + right: outerRect.right - edges.borderRight - edges.scrollbarRight, + top: outerRect.top + edges.borderTop, + bottom: outerRect.bottom - edges.borderBottom - edges.scrollbarBottom, + }; + if (goWithinPadding) { + res.left += edges.paddingLeft; + res.right -= edges.paddingRight; + res.top += edges.paddingTop; + res.bottom -= edges.paddingBottom; + } + return res; + } + function computeRect(el) { + let rect = el.getBoundingClientRect(); + return { + left: rect.left + window.pageXOffset, + top: rect.top + window.pageYOffset, + right: rect.right + window.pageXOffset, + bottom: rect.bottom + window.pageYOffset, + }; + } + function computeClippedClientRect(el) { + let clippingParents = getClippingParents(el); + let rect = el.getBoundingClientRect(); + for (let clippingParent of clippingParents) { + let intersection = intersectRects(rect, clippingParent.getBoundingClientRect()); + if (intersection) { + rect = intersection; + } + else { + return null; + } + } + return rect; + } + // does not return window + function getClippingParents(el) { + let parents = []; + while (el instanceof HTMLElement) { // will stop when gets to document or null + let computedStyle = window.getComputedStyle(el); + if (computedStyle.position === 'fixed') { + break; + } + if ((/(auto|scroll)/).test(computedStyle.overflow + computedStyle.overflowY + computedStyle.overflowX)) { + parents.push(el); + } + el = el.parentNode; + } + return parents; + } + + /* + Records offset information for a set of elements, relative to an origin element. + Can record the left/right OR the top/bottom OR both. + Provides methods for querying the cache by position. + */ + class PositionCache { + constructor(originEl, els, isHorizontal, isVertical) { + this.els = els; + let originClientRect = this.originClientRect = originEl.getBoundingClientRect(); // relative to viewport top-left + if (isHorizontal) { + this.buildElHorizontals(originClientRect.left); + } + if (isVertical) { + this.buildElVerticals(originClientRect.top); + } + } + // Populates the left/right internal coordinate arrays + buildElHorizontals(originClientLeft) { + let lefts = []; + let rights = []; + for (let el of this.els) { + let rect = el.getBoundingClientRect(); + lefts.push(rect.left - originClientLeft); + rights.push(rect.right - originClientLeft); + } + this.lefts = lefts; + this.rights = rights; + } + // Populates the top/bottom internal coordinate arrays + buildElVerticals(originClientTop) { + let tops = []; + let bottoms = []; + for (let el of this.els) { + let rect = el.getBoundingClientRect(); + tops.push(rect.top - originClientTop); + bottoms.push(rect.bottom - originClientTop); + } + this.tops = tops; + this.bottoms = bottoms; + } + // Given a left offset (from document left), returns the index of the el that it horizontally intersects. + // If no intersection is made, returns undefined. + leftToIndex(leftPosition) { + let { lefts, rights } = this; + let len = lefts.length; + let i; + for (i = 0; i < len; i += 1) { + if (leftPosition >= lefts[i] && leftPosition < rights[i]) { + return i; + } + } + return undefined; // TODO: better + } + // Given a top offset (from document top), returns the index of the el that it vertically intersects. + // If no intersection is made, returns undefined. + topToIndex(topPosition) { + let { tops, bottoms } = this; + let len = tops.length; + let i; + for (i = 0; i < len; i += 1) { + if (topPosition >= tops[i] && topPosition < bottoms[i]) { + return i; + } + } + return undefined; // TODO: better + } + // Gets the width of the element at the given index + getWidth(leftIndex) { + return this.rights[leftIndex] - this.lefts[leftIndex]; + } + // Gets the height of the element at the given index + getHeight(topIndex) { + return this.bottoms[topIndex] - this.tops[topIndex]; + } + } + + /* eslint max-classes-per-file: "off" */ + /* + An object for getting/setting scroll-related information for an element. + Internally, this is done very differently for window versus DOM element, + so this object serves as a common interface. + */ + class ScrollController { + getMaxScrollTop() { + return this.getScrollHeight() - this.getClientHeight(); + } + getMaxScrollLeft() { + return this.getScrollWidth() - this.getClientWidth(); + } + canScrollVertically() { + return this.getMaxScrollTop() > 0; + } + canScrollHorizontally() { + return this.getMaxScrollLeft() > 0; + } + canScrollUp() { + return this.getScrollTop() > 0; + } + canScrollDown() { + return this.getScrollTop() < this.getMaxScrollTop(); + } + canScrollLeft() { + return this.getScrollLeft() > 0; + } + canScrollRight() { + return this.getScrollLeft() < this.getMaxScrollLeft(); + } + } + class ElementScrollController extends ScrollController { + constructor(el) { + super(); + this.el = el; + } + getScrollTop() { + return this.el.scrollTop; + } + getScrollLeft() { + return this.el.scrollLeft; + } + setScrollTop(top) { + this.el.scrollTop = top; + } + setScrollLeft(left) { + this.el.scrollLeft = left; + } + getScrollWidth() { + return this.el.scrollWidth; + } + getScrollHeight() { + return this.el.scrollHeight; + } + getClientHeight() { + return this.el.clientHeight; + } + getClientWidth() { + return this.el.clientWidth; + } + } + class WindowScrollController extends ScrollController { + getScrollTop() { + return window.pageYOffset; + } + getScrollLeft() { + return window.pageXOffset; + } + setScrollTop(n) { + window.scroll(window.pageXOffset, n); + } + setScrollLeft(n) { + window.scroll(n, window.pageYOffset); + } + getScrollWidth() { + return document.documentElement.scrollWidth; + } + getScrollHeight() { + return document.documentElement.scrollHeight; + } + getClientHeight() { + return document.documentElement.clientHeight; + } + getClientWidth() { + return document.documentElement.clientWidth; + } + } + + /* + an INTERACTABLE date component + + PURPOSES: + - hook up to fg, fill, and mirror renderers + - interface for dragging and hits + */ + class DateComponent extends BaseComponent { + constructor() { + super(...arguments); + this.uid = guid(); + } + // Hit System + // ----------------------------------------------------------------------------------------------------------------- + prepareHits() { + } + queryHit(positionLeft, positionTop, elWidth, elHeight) { + return null; // this should be abstract + } + // Pointer Interaction Utils + // ----------------------------------------------------------------------------------------------------------------- + isValidSegDownEl(el) { + return !this.props.eventDrag && // HACK + !this.props.eventResize && // HACK + !elementClosest(el, '.fc-event-mirror'); + } + isValidDateDownEl(el) { + return !elementClosest(el, '.fc-event:not(.fc-bg-event)') && + !elementClosest(el, '.fc-more-link') && // a "more.." link + !elementClosest(el, 'a[data-navlink]') && // a clickable nav link + !elementClosest(el, '.fc-popover'); // hack + } + } + + class NamedTimeZoneImpl { + constructor(timeZoneName) { + this.timeZoneName = timeZoneName; + } + } + + class SegHierarchy { + constructor() { + // settings + this.strictOrder = false; + this.allowReslicing = false; + this.maxCoord = -1; // -1 means no max + this.maxStackCnt = -1; // -1 means no max + this.levelCoords = []; // ordered + this.entriesByLevel = []; // parallel with levelCoords + this.stackCnts = {}; // TODO: use better technique!? + } + addSegs(inputs) { + let hiddenEntries = []; + for (let input of inputs) { + this.insertEntry(input, hiddenEntries); + } + return hiddenEntries; + } + insertEntry(entry, hiddenEntries) { + let insertion = this.findInsertion(entry); + if (this.isInsertionValid(insertion, entry)) { + this.insertEntryAt(entry, insertion); + return 1; + } + return this.handleInvalidInsertion(insertion, entry, hiddenEntries); + } + isInsertionValid(insertion, entry) { + return (this.maxCoord === -1 || insertion.levelCoord + entry.thickness <= this.maxCoord) && + (this.maxStackCnt === -1 || insertion.stackCnt < this.maxStackCnt); + } + // returns number of new entries inserted + handleInvalidInsertion(insertion, entry, hiddenEntries) { + if (this.allowReslicing && insertion.touchingEntry) { + return this.splitEntry(entry, insertion.touchingEntry, hiddenEntries); + } + hiddenEntries.push(entry); + return 0; + } + splitEntry(entry, barrier, hiddenEntries) { + let partCnt = 0; + let splitHiddenEntries = []; + let entrySpan = entry.span; + let barrierSpan = barrier.span; + if (entrySpan.start < barrierSpan.start) { + partCnt += this.insertEntry({ + index: entry.index, + thickness: entry.thickness, + span: { start: entrySpan.start, end: barrierSpan.start }, + }, splitHiddenEntries); + } + if (entrySpan.end > barrierSpan.end) { + partCnt += this.insertEntry({ + index: entry.index, + thickness: entry.thickness, + span: { start: barrierSpan.end, end: entrySpan.end }, + }, splitHiddenEntries); + } + if (partCnt) { + hiddenEntries.push({ + index: entry.index, + thickness: entry.thickness, + span: intersectSpans(barrierSpan, entrySpan), // guaranteed to intersect + }, ...splitHiddenEntries); + return partCnt; + } + hiddenEntries.push(entry); + return 0; + } + insertEntryAt(entry, insertion) { + let { entriesByLevel, levelCoords } = this; + if (insertion.lateral === -1) { + // create a new level + insertAt(levelCoords, insertion.level, insertion.levelCoord); + insertAt(entriesByLevel, insertion.level, [entry]); + } + else { + // insert into existing level + insertAt(entriesByLevel[insertion.level], insertion.lateral, entry); + } + this.stackCnts[buildEntryKey(entry)] = insertion.stackCnt; + } + findInsertion(newEntry) { + let { levelCoords, entriesByLevel, strictOrder, stackCnts } = this; + let levelCnt = levelCoords.length; + let candidateCoord = 0; + let touchingLevel = -1; + let touchingLateral = -1; + let touchingEntry = null; + let stackCnt = 0; + for (let trackingLevel = 0; trackingLevel < levelCnt; trackingLevel += 1) { + let trackingCoord = levelCoords[trackingLevel]; + // if the current level is past the placed entry, we have found a good empty space and can stop. + // if strictOrder, keep finding more lateral intersections. + if (!strictOrder && trackingCoord >= candidateCoord + newEntry.thickness) { + break; + } + let trackingEntries = entriesByLevel[trackingLevel]; + let trackingEntry; + let searchRes = binarySearch(trackingEntries, newEntry.span.start, getEntrySpanEnd); // find first entry after newEntry's end + let lateralIndex = searchRes[0] + searchRes[1]; // if exact match (which doesn't collide), go to next one + while ( // loop through entries that horizontally intersect + (trackingEntry = trackingEntries[lateralIndex]) && // but not past the whole entry list + trackingEntry.span.start < newEntry.span.end // and not entirely past newEntry + ) { + let trackingEntryBottom = trackingCoord + trackingEntry.thickness; + // intersects into the top of the candidate? + if (trackingEntryBottom > candidateCoord) { + candidateCoord = trackingEntryBottom; + touchingEntry = trackingEntry; + touchingLevel = trackingLevel; + touchingLateral = lateralIndex; + } + // butts up against top of candidate? (will happen if just intersected as well) + if (trackingEntryBottom === candidateCoord) { + // accumulate the highest possible stackCnt of the trackingEntries that butt up + stackCnt = Math.max(stackCnt, stackCnts[buildEntryKey(trackingEntry)] + 1); + } + lateralIndex += 1; + } + } + // the destination level will be after touchingEntry's level. find it + let destLevel = 0; + if (touchingEntry) { + destLevel = touchingLevel + 1; + while (destLevel < levelCnt && levelCoords[destLevel] < candidateCoord) { + destLevel += 1; + } + } + // if adding to an existing level, find where to insert + let destLateral = -1; + if (destLevel < levelCnt && levelCoords[destLevel] === candidateCoord) { + destLateral = binarySearch(entriesByLevel[destLevel], newEntry.span.end, getEntrySpanEnd)[0]; + } + return { + touchingLevel, + touchingLateral, + touchingEntry, + stackCnt, + levelCoord: candidateCoord, + level: destLevel, + lateral: destLateral, + }; + } + // sorted by levelCoord (lowest to highest) + toRects() { + let { entriesByLevel, levelCoords } = this; + let levelCnt = entriesByLevel.length; + let rects = []; + for (let level = 0; level < levelCnt; level += 1) { + let entries = entriesByLevel[level]; + let levelCoord = levelCoords[level]; + for (let entry of entries) { + rects.push(Object.assign(Object.assign({}, entry), { levelCoord })); + } + } + return rects; + } + } + function getEntrySpanEnd(entry) { + return entry.span.end; + } + function buildEntryKey(entry) { + return entry.index + ':' + entry.span.start; + } + // returns groups with entries sorted by input order + function groupIntersectingEntries(entries) { + let merges = []; + for (let entry of entries) { + let filteredMerges = []; + let hungryMerge = { + span: entry.span, + entries: [entry], + }; + for (let merge of merges) { + if (intersectSpans(merge.span, hungryMerge.span)) { + hungryMerge = { + entries: merge.entries.concat(hungryMerge.entries), + span: joinSpans(merge.span, hungryMerge.span), + }; + } + else { + filteredMerges.push(merge); + } + } + filteredMerges.push(hungryMerge); + merges = filteredMerges; + } + return merges; + } + function joinSpans(span0, span1) { + return { + start: Math.min(span0.start, span1.start), + end: Math.max(span0.end, span1.end), + }; + } + function intersectSpans(span0, span1) { + let start = Math.max(span0.start, span1.start); + let end = Math.min(span0.end, span1.end); + if (start < end) { + return { start, end }; + } + return null; + } + // general util + // --------------------------------------------------------------------------------------------------------------------- + function insertAt(arr, index, item) { + arr.splice(index, 0, item); + } + function binarySearch(a, searchVal, getItemVal) { + let startIndex = 0; + let endIndex = a.length; // exclusive + if (!endIndex || searchVal < getItemVal(a[startIndex])) { // no items OR before first item + return [0, 0]; + } + if (searchVal > getItemVal(a[endIndex - 1])) { // after last item + return [endIndex, 0]; + } + while (startIndex < endIndex) { + let middleIndex = Math.floor(startIndex + (endIndex - startIndex) / 2); + let middleVal = getItemVal(a[middleIndex]); + if (searchVal < middleVal) { + endIndex = middleIndex; + } + else if (searchVal > middleVal) { + startIndex = middleIndex + 1; + } + else { // equal! + return [middleIndex, 1]; + } + } + return [startIndex, 0]; + } + + /* + An abstraction for a dragging interaction originating on an event. + Does higher-level things than PointerDragger, such as possibly: + - a "mirror" that moves with the pointer + - a minimum number of pixels or other criteria for a true drag to begin + + subclasses must emit: + - pointerdown + - dragstart + - dragmove + - pointerup + - dragend + */ + class ElementDragging { + constructor(el, selector) { + this.emitter = new Emitter(); + } + destroy() { + } + setMirrorIsVisible(bool) { + // optional if subclass doesn't want to support a mirror + } + setMirrorNeedsRevert(bool) { + // optional if subclass doesn't want to support a mirror + } + setAutoScrollEnabled(bool) { + // optional + } + } + + // TODO: get rid of this in favor of options system, + // tho it's really easy to access this globally rather than pass thru options. + const config = {}; + + /* + Information about what will happen when an external element is dragged-and-dropped + onto a calendar. Contains information for creating an event. + */ + const DRAG_META_REFINERS = { + startTime: createDuration, + duration: createDuration, + create: Boolean, + sourceId: String, + }; + function parseDragMeta(raw) { + let { refined, extra } = refineProps(raw, DRAG_META_REFINERS); + return { + startTime: refined.startTime || null, + duration: refined.duration || null, + create: refined.create != null ? refined.create : true, + sourceId: refined.sourceId, + leftoverProps: extra, + }; + } + + // Computes a default column header formatting string if `colFormat` is not explicitly defined + function computeFallbackHeaderFormat(datesRepDistinctDays, dayCnt) { + // if more than one week row, or if there are a lot of columns with not much space, + // put just the day numbers will be in each cell + if (!datesRepDistinctDays || dayCnt > 10) { + return createFormatter({ weekday: 'short' }); // "Sat" + } + if (dayCnt > 1) { + return createFormatter({ weekday: 'short', month: 'numeric', day: 'numeric', omitCommas: true }); // "Sat 11/12" + } + return createFormatter({ weekday: 'long' }); // "Saturday" + } + + const CLASS_NAME = 'fc-col-header-cell'; // do the cushion too? no + function renderInner$1(renderProps) { + return renderProps.text; + } + + // BAD name for this class now. used in the Header + class TableDateCell extends BaseComponent { + render() { + let { dateEnv, options, theme, viewApi } = this.context; + let { props } = this; + let { date, dateProfile } = props; + let dayMeta = getDateMeta(date, props.todayRange, null, dateProfile); + let classNames = [CLASS_NAME].concat(getDayClassNames(dayMeta, theme)); + let text = dateEnv.format(date, props.dayHeaderFormat); + // if colCnt is 1, we are already in a day-view and don't need a navlink + let navLinkAttrs = (!dayMeta.isDisabled && props.colCnt > 1) + ? buildNavLinkAttrs(this.context, date) + : {}; + let renderProps = Object.assign(Object.assign(Object.assign({ date: dateEnv.toDate(date), view: viewApi }, props.extraRenderProps), { text }), dayMeta); + return (h(ContentContainer, { elTag: "th", elClasses: classNames, elAttrs: Object.assign({ role: 'columnheader', colSpan: props.colSpan, 'data-date': !dayMeta.isDisabled ? formatDayString(date) : undefined }, props.extraDataAttrs), renderProps: renderProps, generatorName: "dayHeaderContent", generator: options.dayHeaderContent || renderInner$1, classNameGenerator: options.dayHeaderClassNames, didMount: options.dayHeaderDidMount, willUnmount: options.dayHeaderWillUnmount }, (InnerContainer) => (h("div", { className: "fc-scrollgrid-sync-inner" }, !dayMeta.isDisabled && (h(InnerContainer, { elTag: "a", elAttrs: navLinkAttrs, elClasses: [ + 'fc-col-header-cell-cushion', + props.isSticky && 'fc-sticky', + ] })))))); + } + } + + const WEEKDAY_FORMAT = createFormatter({ weekday: 'long' }); + class TableDowCell extends BaseComponent { + render() { + let { props } = this; + let { dateEnv, theme, viewApi, options } = this.context; + let date = addDays(new Date(259200000), props.dow); // start with Sun, 04 Jan 1970 00:00:00 GMT + let dateMeta = { + dow: props.dow, + isDisabled: false, + isFuture: false, + isPast: false, + isToday: false, + isOther: false, + }; + let text = dateEnv.format(date, props.dayHeaderFormat); + let renderProps = Object.assign(Object.assign(Object.assign(Object.assign({ // TODO: make this public? + date }, dateMeta), { view: viewApi }), props.extraRenderProps), { text }); + return (h(ContentContainer, { elTag: "th", elClasses: [ + CLASS_NAME, + ...getDayClassNames(dateMeta, theme), + ...(props.extraClassNames || []), + ], elAttrs: Object.assign({ role: 'columnheader', colSpan: props.colSpan }, props.extraDataAttrs), renderProps: renderProps, generatorName: "dayHeaderContent", generator: options.dayHeaderContent || renderInner$1, classNameGenerator: options.dayHeaderClassNames, didMount: options.dayHeaderDidMount, willUnmount: options.dayHeaderWillUnmount }, (InnerContent) => (h("div", { className: "fc-scrollgrid-sync-inner" }, + h(InnerContent, { elTag: "a", elClasses: [ + 'fc-col-header-cell-cushion', + props.isSticky && 'fc-sticky', + ], elAttrs: { + 'aria-label': dateEnv.format(date, WEEKDAY_FORMAT), + } }))))); + } + } + + class NowTimer extends d { + constructor(props, context) { + super(props, context); + this.initialNowDate = getNow(context.options.now, context.dateEnv); + this.initialNowQueriedMs = new Date().valueOf(); + this.state = this.computeTiming().currentState; + } + render() { + let { props, state } = this; + return props.children(state.nowDate, state.todayRange); + } + componentDidMount() { + this.setTimeout(); + } + componentDidUpdate(prevProps) { + if (prevProps.unit !== this.props.unit) { + this.clearTimeout(); + this.setTimeout(); + } + } + componentWillUnmount() { + this.clearTimeout(); + } + computeTiming() { + let { props, context } = this; + let unroundedNow = addMs(this.initialNowDate, new Date().valueOf() - this.initialNowQueriedMs); + let currentUnitStart = context.dateEnv.startOf(unroundedNow, props.unit); + let nextUnitStart = context.dateEnv.add(currentUnitStart, createDuration(1, props.unit)); + let waitMs = nextUnitStart.valueOf() - unroundedNow.valueOf(); + // there is a max setTimeout ms value (https://stackoverflow.com/a/3468650/96342) + // ensure no longer than a day + waitMs = Math.min(1000 * 60 * 60 * 24, waitMs); + return { + currentState: { nowDate: currentUnitStart, todayRange: buildDayRange(currentUnitStart) }, + nextState: { nowDate: nextUnitStart, todayRange: buildDayRange(nextUnitStart) }, + waitMs, + }; + } + setTimeout() { + let { nextState, waitMs } = this.computeTiming(); + this.timeoutId = setTimeout(() => { + this.setState(nextState, () => { + this.setTimeout(); + }); + }, waitMs); + } + clearTimeout() { + if (this.timeoutId) { + clearTimeout(this.timeoutId); + } + } + } + NowTimer.contextType = ViewContextType; + function buildDayRange(date) { + let start = startOfDay(date); + let end = addDays(start, 1); + return { start, end }; + } + + class DayHeader extends BaseComponent { + constructor() { + super(...arguments); + this.createDayHeaderFormatter = memoize(createDayHeaderFormatter); + } + render() { + let { context } = this; + let { dates, dateProfile, datesRepDistinctDays, renderIntro } = this.props; + let dayHeaderFormat = this.createDayHeaderFormatter(context.options.dayHeaderFormat, datesRepDistinctDays, dates.length); + return (h(NowTimer, { unit: "day" }, (nowDate, todayRange) => (h("tr", { role: "row" }, + renderIntro && renderIntro('day'), + dates.map((date) => (datesRepDistinctDays ? (h(TableDateCell, { key: date.toISOString(), date: date, dateProfile: dateProfile, todayRange: todayRange, colCnt: dates.length, dayHeaderFormat: dayHeaderFormat })) : (h(TableDowCell, { key: date.getUTCDay(), dow: date.getUTCDay(), dayHeaderFormat: dayHeaderFormat })))))))); + } + } + function createDayHeaderFormatter(explicitFormat, datesRepDistinctDays, dateCnt) { + return explicitFormat || computeFallbackHeaderFormat(datesRepDistinctDays, dateCnt); + } + + class DaySeriesModel { + constructor(range, dateProfileGenerator) { + let date = range.start; + let { end } = range; + let indices = []; + let dates = []; + let dayIndex = -1; + while (date < end) { // loop each day from start to end + if (dateProfileGenerator.isHiddenDay(date)) { + indices.push(dayIndex + 0.5); // mark that it's between indices + } + else { + dayIndex += 1; + indices.push(dayIndex); + dates.push(date); + } + date = addDays(date, 1); + } + this.dates = dates; + this.indices = indices; + this.cnt = dates.length; + } + sliceRange(range) { + let firstIndex = this.getDateDayIndex(range.start); // inclusive first index + let lastIndex = this.getDateDayIndex(addDays(range.end, -1)); // inclusive last index + let clippedFirstIndex = Math.max(0, firstIndex); + let clippedLastIndex = Math.min(this.cnt - 1, lastIndex); + // deal with in-between indices + clippedFirstIndex = Math.ceil(clippedFirstIndex); // in-between starts round to next cell + clippedLastIndex = Math.floor(clippedLastIndex); // in-between ends round to prev cell + if (clippedFirstIndex <= clippedLastIndex) { + return { + firstIndex: clippedFirstIndex, + lastIndex: clippedLastIndex, + isStart: firstIndex === clippedFirstIndex, + isEnd: lastIndex === clippedLastIndex, + }; + } + return null; + } + // Given a date, returns its chronolocial cell-index from the first cell of the grid. + // If the date lies between cells (because of hiddenDays), returns a floating-point value between offsets. + // If before the first offset, returns a negative number. + // If after the last offset, returns an offset past the last cell offset. + // Only works for *start* dates of cells. Will not work for exclusive end dates for cells. + getDateDayIndex(date) { + let { indices } = this; + let dayOffset = Math.floor(diffDays(this.dates[0], date)); + if (dayOffset < 0) { + return indices[0] - 1; + } + if (dayOffset >= indices.length) { + return indices[indices.length - 1] + 1; + } + return indices[dayOffset]; + } + } + + class DayTableModel { + constructor(daySeries, breakOnWeeks) { + let { dates } = daySeries; + let daysPerRow; + let firstDay; + let rowCnt; + if (breakOnWeeks) { + // count columns until the day-of-week repeats + firstDay = dates[0].getUTCDay(); + for (daysPerRow = 1; daysPerRow < dates.length; daysPerRow += 1) { + if (dates[daysPerRow].getUTCDay() === firstDay) { + break; + } + } + rowCnt = Math.ceil(dates.length / daysPerRow); + } + else { + rowCnt = 1; + daysPerRow = dates.length; + } + this.rowCnt = rowCnt; + this.colCnt = daysPerRow; + this.daySeries = daySeries; + this.cells = this.buildCells(); + this.headerDates = this.buildHeaderDates(); + } + buildCells() { + let rows = []; + for (let row = 0; row < this.rowCnt; row += 1) { + let cells = []; + for (let col = 0; col < this.colCnt; col += 1) { + cells.push(this.buildCell(row, col)); + } + rows.push(cells); + } + return rows; + } + buildCell(row, col) { + let date = this.daySeries.dates[row * this.colCnt + col]; + return { + key: date.toISOString(), + date, + }; + } + buildHeaderDates() { + let dates = []; + for (let col = 0; col < this.colCnt; col += 1) { + dates.push(this.cells[0][col].date); + } + return dates; + } + sliceRange(range) { + let { colCnt } = this; + let seriesSeg = this.daySeries.sliceRange(range); + let segs = []; + if (seriesSeg) { + let { firstIndex, lastIndex } = seriesSeg; + let index = firstIndex; + while (index <= lastIndex) { + let row = Math.floor(index / colCnt); + let nextIndex = Math.min((row + 1) * colCnt, lastIndex + 1); + segs.push({ + row, + firstCol: index % colCnt, + lastCol: (nextIndex - 1) % colCnt, + isStart: seriesSeg.isStart && index === firstIndex, + isEnd: seriesSeg.isEnd && (nextIndex - 1) === lastIndex, + }); + index = nextIndex; + } + } + return segs; + } + } + + class Slicer { + constructor() { + this.sliceBusinessHours = memoize(this._sliceBusinessHours); + this.sliceDateSelection = memoize(this._sliceDateSpan); + this.sliceEventStore = memoize(this._sliceEventStore); + this.sliceEventDrag = memoize(this._sliceInteraction); + this.sliceEventResize = memoize(this._sliceInteraction); + this.forceDayIfListItem = false; // hack + } + sliceProps(props, dateProfile, nextDayThreshold, context, ...extraArgs) { + let { eventUiBases } = props; + let eventSegs = this.sliceEventStore(props.eventStore, eventUiBases, dateProfile, nextDayThreshold, ...extraArgs); + return { + dateSelectionSegs: this.sliceDateSelection(props.dateSelection, eventUiBases, context, ...extraArgs), + businessHourSegs: this.sliceBusinessHours(props.businessHours, dateProfile, nextDayThreshold, context, ...extraArgs), + fgEventSegs: eventSegs.fg, + bgEventSegs: eventSegs.bg, + eventDrag: this.sliceEventDrag(props.eventDrag, eventUiBases, dateProfile, nextDayThreshold, ...extraArgs), + eventResize: this.sliceEventResize(props.eventResize, eventUiBases, dateProfile, nextDayThreshold, ...extraArgs), + eventSelection: props.eventSelection, + }; // TODO: give interactionSegs? + } + sliceNowDate(// does not memoize + date, context, ...extraArgs) { + return this._sliceDateSpan({ range: { start: date, end: addMs(date, 1) }, allDay: false }, // add 1 ms, protect against null range + {}, context, ...extraArgs); + } + _sliceBusinessHours(businessHours, dateProfile, nextDayThreshold, context, ...extraArgs) { + if (!businessHours) { + return []; + } + return this._sliceEventStore(expandRecurring(businessHours, computeActiveRange(dateProfile, Boolean(nextDayThreshold)), context), {}, dateProfile, nextDayThreshold, ...extraArgs).bg; + } + _sliceEventStore(eventStore, eventUiBases, dateProfile, nextDayThreshold, ...extraArgs) { + if (eventStore) { + let rangeRes = sliceEventStore(eventStore, eventUiBases, computeActiveRange(dateProfile, Boolean(nextDayThreshold)), nextDayThreshold); + return { + bg: this.sliceEventRanges(rangeRes.bg, extraArgs), + fg: this.sliceEventRanges(rangeRes.fg, extraArgs), + }; + } + return { bg: [], fg: [] }; + } + _sliceInteraction(interaction, eventUiBases, dateProfile, nextDayThreshold, ...extraArgs) { + if (!interaction) { + return null; + } + let rangeRes = sliceEventStore(interaction.mutatedEvents, eventUiBases, computeActiveRange(dateProfile, Boolean(nextDayThreshold)), nextDayThreshold); + return { + segs: this.sliceEventRanges(rangeRes.fg, extraArgs), + affectedInstances: interaction.affectedEvents.instances, + isEvent: interaction.isEvent, + }; + } + _sliceDateSpan(dateSpan, eventUiBases, context, ...extraArgs) { + if (!dateSpan) { + return []; + } + let eventRange = fabricateEventRange(dateSpan, eventUiBases, context); + let segs = this.sliceRange(dateSpan.range, ...extraArgs); + for (let seg of segs) { + seg.eventRange = eventRange; + } + return segs; + } + /* + "complete" seg means it has component and eventRange + */ + sliceEventRanges(eventRanges, extraArgs) { + let segs = []; + for (let eventRange of eventRanges) { + segs.push(...this.sliceEventRange(eventRange, extraArgs)); + } + return segs; + } + /* + "complete" seg means it has component and eventRange + */ + sliceEventRange(eventRange, extraArgs) { + let dateRange = eventRange.range; + // hack to make multi-day events that are being force-displayed as list-items to take up only one day + if (this.forceDayIfListItem && eventRange.ui.display === 'list-item') { + dateRange = { + start: dateRange.start, + end: addDays(dateRange.start, 1), + }; + } + let segs = this.sliceRange(dateRange, ...extraArgs); + for (let seg of segs) { + seg.eventRange = eventRange; + seg.isStart = eventRange.isStart && seg.isStart; + seg.isEnd = eventRange.isEnd && seg.isEnd; + } + return segs; + } + } + /* + for incorporating slotMinTime/slotMaxTime if appropriate + TODO: should be part of DateProfile! + TimelineDateProfile already does this btw + */ + function computeActiveRange(dateProfile, isComponentAllDay) { + let range = dateProfile.activeRange; + if (isComponentAllDay) { + return range; + } + return { + start: addMs(range.start, dateProfile.slotMinTime.milliseconds), + end: addMs(range.end, dateProfile.slotMaxTime.milliseconds - 864e5), // 864e5 = ms in a day + }; + } + + // high-level segmenting-aware tester functions + // ------------------------------------------------------------------------------------------------------------------------ + function isInteractionValid(interaction, dateProfile, context) { + let { instances } = interaction.mutatedEvents; + for (let instanceId in instances) { + if (!rangeContainsRange(dateProfile.validRange, instances[instanceId].range)) { + return false; + } + } + return isNewPropsValid({ eventDrag: interaction }, context); // HACK: the eventDrag props is used for ALL interactions + } + function isDateSelectionValid(dateSelection, dateProfile, context) { + if (!rangeContainsRange(dateProfile.validRange, dateSelection.range)) { + return false; + } + return isNewPropsValid({ dateSelection }, context); + } + function isNewPropsValid(newProps, context) { + let calendarState = context.getCurrentData(); + let props = Object.assign({ businessHours: calendarState.businessHours, dateSelection: '', eventStore: calendarState.eventStore, eventUiBases: calendarState.eventUiBases, eventSelection: '', eventDrag: null, eventResize: null }, newProps); + return (context.pluginHooks.isPropsValid || isPropsValid)(props, context); + } + function isPropsValid(state, context, dateSpanMeta = {}, filterConfig) { + if (state.eventDrag && !isInteractionPropsValid(state, context, dateSpanMeta, filterConfig)) { + return false; + } + if (state.dateSelection && !isDateSelectionPropsValid(state, context, dateSpanMeta, filterConfig)) { + return false; + } + return true; + } + // Moving Event Validation + // ------------------------------------------------------------------------------------------------------------------------ + function isInteractionPropsValid(state, context, dateSpanMeta, filterConfig) { + let currentState = context.getCurrentData(); + let interaction = state.eventDrag; // HACK: the eventDrag props is used for ALL interactions + let subjectEventStore = interaction.mutatedEvents; + let subjectDefs = subjectEventStore.defs; + let subjectInstances = subjectEventStore.instances; + let subjectConfigs = compileEventUis(subjectDefs, interaction.isEvent ? + state.eventUiBases : + { '': currentState.selectionConfig }); + if (filterConfig) { + subjectConfigs = mapHash(subjectConfigs, filterConfig); + } + // exclude the subject events. TODO: exclude defs too? + let otherEventStore = excludeInstances(state.eventStore, interaction.affectedEvents.instances); + let otherDefs = otherEventStore.defs; + let otherInstances = otherEventStore.instances; + let otherConfigs = compileEventUis(otherDefs, state.eventUiBases); + for (let subjectInstanceId in subjectInstances) { + let subjectInstance = subjectInstances[subjectInstanceId]; + let subjectRange = subjectInstance.range; + let subjectConfig = subjectConfigs[subjectInstance.defId]; + let subjectDef = subjectDefs[subjectInstance.defId]; + // constraint + if (!allConstraintsPass(subjectConfig.constraints, subjectRange, otherEventStore, state.businessHours, context)) { + return false; + } + // overlap + let { eventOverlap } = context.options; + let eventOverlapFunc = typeof eventOverlap === 'function' ? eventOverlap : null; + for (let otherInstanceId in otherInstances) { + let otherInstance = otherInstances[otherInstanceId]; + // intersect! evaluate + if (rangesIntersect(subjectRange, otherInstance.range)) { + let otherOverlap = otherConfigs[otherInstance.defId].overlap; + // consider the other event's overlap. only do this if the subject event is a "real" event + if (otherOverlap === false && interaction.isEvent) { + return false; + } + if (subjectConfig.overlap === false) { + return false; + } + if (eventOverlapFunc && !eventOverlapFunc(new EventImpl(context, otherDefs[otherInstance.defId], otherInstance), // still event + new EventImpl(context, subjectDef, subjectInstance))) { + return false; + } + } + } + // allow (a function) + let calendarEventStore = currentState.eventStore; // need global-to-calendar, not local to component (splittable)state + for (let subjectAllow of subjectConfig.allows) { + let subjectDateSpan = Object.assign(Object.assign({}, dateSpanMeta), { range: subjectInstance.range, allDay: subjectDef.allDay }); + let origDef = calendarEventStore.defs[subjectDef.defId]; + let origInstance = calendarEventStore.instances[subjectInstanceId]; + let eventApi; + if (origDef) { // was previously in the calendar + eventApi = new EventImpl(context, origDef, origInstance); + } + else { // was an external event + eventApi = new EventImpl(context, subjectDef); // no instance, because had no dates + } + if (!subjectAllow(buildDateSpanApiWithContext(subjectDateSpan, context), eventApi)) { + return false; + } + } + } + return true; + } + // Date Selection Validation + // ------------------------------------------------------------------------------------------------------------------------ + function isDateSelectionPropsValid(state, context, dateSpanMeta, filterConfig) { + let relevantEventStore = state.eventStore; + let relevantDefs = relevantEventStore.defs; + let relevantInstances = relevantEventStore.instances; + let selection = state.dateSelection; + let selectionRange = selection.range; + let { selectionConfig } = context.getCurrentData(); + if (filterConfig) { + selectionConfig = filterConfig(selectionConfig); + } + // constraint + if (!allConstraintsPass(selectionConfig.constraints, selectionRange, relevantEventStore, state.businessHours, context)) { + return false; + } + // overlap + let { selectOverlap } = context.options; + let selectOverlapFunc = typeof selectOverlap === 'function' ? selectOverlap : null; + for (let relevantInstanceId in relevantInstances) { + let relevantInstance = relevantInstances[relevantInstanceId]; + // intersect! evaluate + if (rangesIntersect(selectionRange, relevantInstance.range)) { + if (selectionConfig.overlap === false) { + return false; + } + if (selectOverlapFunc && !selectOverlapFunc(new EventImpl(context, relevantDefs[relevantInstance.defId], relevantInstance), null)) { + return false; + } + } + } + // allow (a function) + for (let selectionAllow of selectionConfig.allows) { + let fullDateSpan = Object.assign(Object.assign({}, dateSpanMeta), selection); + if (!selectionAllow(buildDateSpanApiWithContext(fullDateSpan, context), null)) { + return false; + } + } + return true; + } + // Constraint Utils + // ------------------------------------------------------------------------------------------------------------------------ + function allConstraintsPass(constraints, subjectRange, otherEventStore, businessHoursUnexpanded, context) { + for (let constraint of constraints) { + if (!anyRangesContainRange(constraintToRanges(constraint, subjectRange, otherEventStore, businessHoursUnexpanded, context), subjectRange)) { + return false; + } + } + return true; + } + function constraintToRanges(constraint, subjectRange, // for expanding a recurring constraint, or expanding business hours + otherEventStore, // for if constraint is an even group ID + businessHoursUnexpanded, // for if constraint is 'businessHours' + context) { + if (constraint === 'businessHours') { + return eventStoreToRanges(expandRecurring(businessHoursUnexpanded, subjectRange, context)); + } + if (typeof constraint === 'string') { // an group ID + return eventStoreToRanges(filterEventStoreDefs(otherEventStore, (eventDef) => eventDef.groupId === constraint)); + } + if (typeof constraint === 'object' && constraint) { // non-null object + return eventStoreToRanges(expandRecurring(constraint, subjectRange, context)); + } + return []; // if it's false + } + // TODO: move to event-store file? + function eventStoreToRanges(eventStore) { + let { instances } = eventStore; + let ranges = []; + for (let instanceId in instances) { + ranges.push(instances[instanceId].range); + } + return ranges; + } + // TODO: move to geom file? + function anyRangesContainRange(outerRanges, innerRange) { + for (let outerRange of outerRanges) { + if (rangeContainsRange(outerRange, innerRange)) { + return true; + } + } + return false; + } + + const VISIBLE_HIDDEN_RE = /^(visible|hidden)$/; + class Scroller extends BaseComponent { + constructor() { + super(...arguments); + this.handleEl = (el) => { + this.el = el; + setRef(this.props.elRef, el); + }; + } + render() { + let { props } = this; + let { liquid, liquidIsAbsolute } = props; + let isAbsolute = liquid && liquidIsAbsolute; + let className = ['fc-scroller']; + if (liquid) { + if (liquidIsAbsolute) { + className.push('fc-scroller-liquid-absolute'); + } + else { + className.push('fc-scroller-liquid'); + } + } + return (h("div", { ref: this.handleEl, className: className.join(' '), style: { + overflowX: props.overflowX, + overflowY: props.overflowY, + left: (isAbsolute && -(props.overcomeLeft || 0)) || '', + right: (isAbsolute && -(props.overcomeRight || 0)) || '', + bottom: (isAbsolute && -(props.overcomeBottom || 0)) || '', + marginLeft: (!isAbsolute && -(props.overcomeLeft || 0)) || '', + marginRight: (!isAbsolute && -(props.overcomeRight || 0)) || '', + marginBottom: (!isAbsolute && -(props.overcomeBottom || 0)) || '', + maxHeight: props.maxHeight || '', + } }, props.children)); + } + needsXScrolling() { + if (VISIBLE_HIDDEN_RE.test(this.props.overflowX)) { + return false; + } + // testing scrollWidth>clientWidth is unreliable cross-browser when pixel heights aren't integers. + // much more reliable to see if children are taller than the scroller, even tho doesn't account for + // inner-child margins and absolute positioning + let { el } = this; + let realClientWidth = this.el.getBoundingClientRect().width - this.getYScrollbarWidth(); + let { children } = el; + for (let i = 0; i < children.length; i += 1) { + let childEl = children[i]; + if (childEl.getBoundingClientRect().width > realClientWidth) { + return true; + } + } + return false; + } + needsYScrolling() { + if (VISIBLE_HIDDEN_RE.test(this.props.overflowY)) { + return false; + } + // testing scrollHeight>clientHeight is unreliable cross-browser when pixel heights aren't integers. + // much more reliable to see if children are taller than the scroller, even tho doesn't account for + // inner-child margins and absolute positioning + let { el } = this; + let realClientHeight = this.el.getBoundingClientRect().height - this.getXScrollbarWidth(); + let { children } = el; + for (let i = 0; i < children.length; i += 1) { + let childEl = children[i]; + if (childEl.getBoundingClientRect().height > realClientHeight) { + return true; + } + } + return false; + } + getXScrollbarWidth() { + if (VISIBLE_HIDDEN_RE.test(this.props.overflowX)) { + return 0; + } + return this.el.offsetHeight - this.el.clientHeight; // only works because we guarantee no borders. TODO: add to CSS with important? + } + getYScrollbarWidth() { + if (VISIBLE_HIDDEN_RE.test(this.props.overflowY)) { + return 0; + } + return this.el.offsetWidth - this.el.clientWidth; // only works because we guarantee no borders. TODO: add to CSS with important? + } + } + + /* + TODO: somehow infer OtherArgs from masterCallback? + TODO: infer RefType from masterCallback if provided + */ + class RefMap { + constructor(masterCallback) { + this.masterCallback = masterCallback; + this.currentMap = {}; + this.depths = {}; + this.callbackMap = {}; + this.handleValue = (val, key) => { + let { depths, currentMap } = this; + let removed = false; + let added = false; + if (val !== null) { + // for bug... ACTUALLY: can probably do away with this now that callers don't share numeric indices anymore + removed = (key in currentMap); + currentMap[key] = val; + depths[key] = (depths[key] || 0) + 1; + added = true; + } + else { + depths[key] -= 1; + if (!depths[key]) { + delete currentMap[key]; + delete this.callbackMap[key]; + removed = true; + } + } + if (this.masterCallback) { + if (removed) { + this.masterCallback(null, String(key)); + } + if (added) { + this.masterCallback(val, String(key)); + } + } + }; + } + createRef(key) { + let refCallback = this.callbackMap[key]; + if (!refCallback) { + refCallback = this.callbackMap[key] = (val) => { + this.handleValue(val, String(key)); + }; + } + return refCallback; + } + // TODO: check callers that don't care about order. should use getAll instead + // NOTE: this method has become less valuable now that we are encouraged to map order by some other index + // TODO: provide ONE array-export function, buildArray, which fails on non-numeric indexes. caller can manipulate and "collect" + collect(startIndex, endIndex, step) { + return collectFromHash(this.currentMap, startIndex, endIndex, step); + } + getAll() { + return hashValuesToArray(this.currentMap); + } + } + + function computeShrinkWidth(chunkEls) { + let shrinkCells = findElements(chunkEls, '.fc-scrollgrid-shrink'); + let largestWidth = 0; + for (let shrinkCell of shrinkCells) { + largestWidth = Math.max(largestWidth, computeSmallestCellWidth(shrinkCell)); + } + return Math.ceil(largestWidth); // <table> elements work best with integers. round up to ensure contents fits + } + function getSectionHasLiquidHeight(props, sectionConfig) { + return props.liquid && sectionConfig.liquid; // does the section do liquid-height? (need to have whole scrollgrid liquid-height as well) + } + function getAllowYScrolling(props, sectionConfig) { + return sectionConfig.maxHeight != null || // if its possible for the height to max out, we might need scrollbars + getSectionHasLiquidHeight(props, sectionConfig); // if the section is liquid height, it might condense enough to require scrollbars + } + // TODO: ONLY use `arg`. force out internal function to use same API + function renderChunkContent(sectionConfig, chunkConfig, arg, isHeader) { + let { expandRows } = arg; + let content = typeof chunkConfig.content === 'function' ? + chunkConfig.content(arg) : + h('table', { + role: 'presentation', + className: [ + chunkConfig.tableClassName, + sectionConfig.syncRowHeights ? 'fc-scrollgrid-sync-table' : '', + ].join(' '), + style: { + minWidth: arg.tableMinWidth, + width: arg.clientWidth, + height: expandRows ? arg.clientHeight : '', // css `height` on a <table> serves as a min-height + }, + }, arg.tableColGroupNode, h(isHeader ? 'thead' : 'tbody', { + role: 'presentation', + }, typeof chunkConfig.rowContent === 'function' + ? chunkConfig.rowContent(arg) + : chunkConfig.rowContent)); + return content; + } + function isColPropsEqual(cols0, cols1) { + return isArraysEqual(cols0, cols1, isPropsEqual); + } + function renderMicroColGroup(cols, shrinkWidth) { + let colNodes = []; + /* + for ColProps with spans, it would have been great to make a single <col span=""> + HOWEVER, Chrome was getting messing up distributing the width to <td>/<th> elements with colspans. + SOLUTION: making individual <col> elements makes Chrome behave. + */ + for (let colProps of cols) { + let span = colProps.span || 1; + for (let i = 0; i < span; i += 1) { + colNodes.push(h("col", { style: { + width: colProps.width === 'shrink' ? sanitizeShrinkWidth(shrinkWidth) : (colProps.width || ''), + minWidth: colProps.minWidth || '', + } })); + } + } + return h('colgroup', {}, ...colNodes); + } + function sanitizeShrinkWidth(shrinkWidth) { + /* why 4? if we do 0, it will kill any border, which are needed for computeSmallestCellWidth + 4 accounts for 2 2-pixel borders. TODO: better solution? */ + return shrinkWidth == null ? 4 : shrinkWidth; + } + function hasShrinkWidth(cols) { + for (let col of cols) { + if (col.width === 'shrink') { + return true; + } + } + return false; + } + function getScrollGridClassNames(liquid, context) { + let classNames = [ + 'fc-scrollgrid', + context.theme.getClass('table'), + ]; + if (liquid) { + classNames.push('fc-scrollgrid-liquid'); + } + return classNames; + } + function getSectionClassNames(sectionConfig, wholeTableVGrow) { + let classNames = [ + 'fc-scrollgrid-section', + `fc-scrollgrid-section-${sectionConfig.type}`, + sectionConfig.className, // used? + ]; + if (wholeTableVGrow && sectionConfig.liquid && sectionConfig.maxHeight == null) { + classNames.push('fc-scrollgrid-section-liquid'); + } + if (sectionConfig.isSticky) { + classNames.push('fc-scrollgrid-section-sticky'); + } + return classNames; + } + function renderScrollShim(arg) { + return (h("div", { className: "fc-scrollgrid-sticky-shim", style: { + width: arg.clientWidth, + minWidth: arg.tableMinWidth, + } })); + } + function getStickyHeaderDates(options) { + let { stickyHeaderDates } = options; + if (stickyHeaderDates == null || stickyHeaderDates === 'auto') { + stickyHeaderDates = options.height === 'auto' || options.viewHeight === 'auto'; + } + return stickyHeaderDates; + } + function getStickyFooterScrollbar(options) { + let { stickyFooterScrollbar } = options; + if (stickyFooterScrollbar == null || stickyFooterScrollbar === 'auto') { + stickyFooterScrollbar = options.height === 'auto' || options.viewHeight === 'auto'; + } + return stickyFooterScrollbar; + } + + class SimpleScrollGrid extends BaseComponent { + constructor() { + super(...arguments); + this.processCols = memoize((a) => a, isColPropsEqual); // so we get same `cols` props every time + // yucky to memoize VNodes, but much more efficient for consumers + this.renderMicroColGroup = memoize(renderMicroColGroup); + this.scrollerRefs = new RefMap(); + this.scrollerElRefs = new RefMap(this._handleScrollerEl.bind(this)); + this.state = { + shrinkWidth: null, + forceYScrollbars: false, + scrollerClientWidths: {}, + scrollerClientHeights: {}, + }; + // TODO: can do a really simple print-view. dont need to join rows + this.handleSizing = () => { + this.safeSetState(Object.assign({ shrinkWidth: this.computeShrinkWidth() }, this.computeScrollerDims())); + }; + } + render() { + let { props, state, context } = this; + let sectionConfigs = props.sections || []; + let cols = this.processCols(props.cols); + let microColGroupNode = this.renderMicroColGroup(cols, state.shrinkWidth); + let classNames = getScrollGridClassNames(props.liquid, context); + if (props.collapsibleWidth) { + classNames.push('fc-scrollgrid-collapsible'); + } + // TODO: make DRY + let configCnt = sectionConfigs.length; + let configI = 0; + let currentConfig; + let headSectionNodes = []; + let bodySectionNodes = []; + let footSectionNodes = []; + while (configI < configCnt && (currentConfig = sectionConfigs[configI]).type === 'header') { + headSectionNodes.push(this.renderSection(currentConfig, microColGroupNode, true)); + configI += 1; + } + while (configI < configCnt && (currentConfig = sectionConfigs[configI]).type === 'body') { + bodySectionNodes.push(this.renderSection(currentConfig, microColGroupNode, false)); + configI += 1; + } + while (configI < configCnt && (currentConfig = sectionConfigs[configI]).type === 'footer') { + footSectionNodes.push(this.renderSection(currentConfig, microColGroupNode, true)); + configI += 1; + } + // firefox bug: when setting height on table and there is a thead or tfoot, + // the necessary height:100% on the liquid-height body section forces the *whole* table to be taller. (bug #5524) + // use getCanVGrowWithinCell as a way to detect table-stupid firefox. + // if so, use a simpler dom structure, jam everything into a lone tbody. + let isBuggy = !getCanVGrowWithinCell(); + const roleAttrs = { role: 'rowgroup' }; + return h('table', { + role: 'grid', + className: classNames.join(' '), + style: { height: props.height }, + }, Boolean(!isBuggy && headSectionNodes.length) && h('thead', roleAttrs, ...headSectionNodes), Boolean(!isBuggy && bodySectionNodes.length) && h('tbody', roleAttrs, ...bodySectionNodes), Boolean(!isBuggy && footSectionNodes.length) && h('tfoot', roleAttrs, ...footSectionNodes), isBuggy && h('tbody', roleAttrs, ...headSectionNodes, ...bodySectionNodes, ...footSectionNodes)); + } + renderSection(sectionConfig, microColGroupNode, isHeader) { + if ('outerContent' in sectionConfig) { + return (h(p, { key: sectionConfig.key }, sectionConfig.outerContent)); + } + return (h("tr", { key: sectionConfig.key, role: "presentation", className: getSectionClassNames(sectionConfig, this.props.liquid).join(' ') }, this.renderChunkTd(sectionConfig, microColGroupNode, sectionConfig.chunk, isHeader))); + } + renderChunkTd(sectionConfig, microColGroupNode, chunkConfig, isHeader) { + if ('outerContent' in chunkConfig) { + return chunkConfig.outerContent; + } + let { props } = this; + let { forceYScrollbars, scrollerClientWidths, scrollerClientHeights } = this.state; + let needsYScrolling = getAllowYScrolling(props, sectionConfig); // TODO: do lazily. do in section config? + let isLiquid = getSectionHasLiquidHeight(props, sectionConfig); + // for `!props.liquid` - is WHOLE scrollgrid natural height? + // TODO: do same thing in advanced scrollgrid? prolly not b/c always has horizontal scrollbars + let overflowY = !props.liquid ? 'visible' : + forceYScrollbars ? 'scroll' : + !needsYScrolling ? 'hidden' : + 'auto'; + let sectionKey = sectionConfig.key; + let content = renderChunkContent(sectionConfig, chunkConfig, { + tableColGroupNode: microColGroupNode, + tableMinWidth: '', + clientWidth: (!props.collapsibleWidth && scrollerClientWidths[sectionKey] !== undefined) ? scrollerClientWidths[sectionKey] : null, + clientHeight: scrollerClientHeights[sectionKey] !== undefined ? scrollerClientHeights[sectionKey] : null, + expandRows: sectionConfig.expandRows, + syncRowHeights: false, + rowSyncHeights: [], + reportRowHeightChange: () => { }, + }, isHeader); + return h(isHeader ? 'th' : 'td', { + ref: chunkConfig.elRef, + role: 'presentation', + }, h("div", { className: `fc-scroller-harness${isLiquid ? ' fc-scroller-harness-liquid' : ''}` }, + h(Scroller, { ref: this.scrollerRefs.createRef(sectionKey), elRef: this.scrollerElRefs.createRef(sectionKey), overflowY: overflowY, overflowX: !props.liquid ? 'visible' : 'hidden' /* natural height? */, maxHeight: sectionConfig.maxHeight, liquid: isLiquid, liquidIsAbsolute // because its within a harness + : true }, content))); + } + _handleScrollerEl(scrollerEl, key) { + let section = getSectionByKey(this.props.sections, key); + if (section) { + setRef(section.chunk.scrollerElRef, scrollerEl); + } + } + componentDidMount() { + this.handleSizing(); + this.context.addResizeHandler(this.handleSizing); + } + componentDidUpdate() { + // TODO: need better solution when state contains non-sizing things + this.handleSizing(); + } + componentWillUnmount() { + this.context.removeResizeHandler(this.handleSizing); + } + computeShrinkWidth() { + return hasShrinkWidth(this.props.cols) + ? computeShrinkWidth(this.scrollerElRefs.getAll()) + : 0; + } + computeScrollerDims() { + let scrollbarWidth = getScrollbarWidths(); + let { scrollerRefs, scrollerElRefs } = this; + let forceYScrollbars = false; + let scrollerClientWidths = {}; + let scrollerClientHeights = {}; + for (let sectionKey in scrollerRefs.currentMap) { + let scroller = scrollerRefs.currentMap[sectionKey]; + if (scroller && scroller.needsYScrolling()) { + forceYScrollbars = true; + break; + } + } + for (let section of this.props.sections) { + let sectionKey = section.key; + let scrollerEl = scrollerElRefs.currentMap[sectionKey]; + if (scrollerEl) { + let harnessEl = scrollerEl.parentNode; // TODO: weird way to get this. need harness b/c doesn't include table borders + scrollerClientWidths[sectionKey] = Math.floor(harnessEl.getBoundingClientRect().width - (forceYScrollbars + ? scrollbarWidth.y // use global because scroller might not have scrollbars yet but will need them in future + : 0)); + scrollerClientHeights[sectionKey] = Math.floor(harnessEl.getBoundingClientRect().height); + } + } + return { forceYScrollbars, scrollerClientWidths, scrollerClientHeights }; + } + } + SimpleScrollGrid.addStateEquality({ + scrollerClientWidths: isPropsEqual, + scrollerClientHeights: isPropsEqual, + }); + function getSectionByKey(sections, key) { + for (let section of sections) { + if (section.key === key) { + return section; + } + } + return null; + } + + class EventContainer extends BaseComponent { + constructor() { + super(...arguments); + this.handleEl = (el) => { + this.el = el; + if (el) { + setElSeg(el, this.props.seg); + } + }; + } + render() { + const { props, context } = this; + const { options } = context; + const { seg } = props; + const { eventRange } = seg; + const { ui } = eventRange; + const renderProps = { + event: new EventImpl(context, eventRange.def, eventRange.instance), + view: context.viewApi, + timeText: props.timeText, + textColor: ui.textColor, + backgroundColor: ui.backgroundColor, + borderColor: ui.borderColor, + isDraggable: !props.disableDragging && computeSegDraggable(seg, context), + isStartResizable: !props.disableResizing && computeSegStartResizable(seg, context), + isEndResizable: !props.disableResizing && computeSegEndResizable(seg), + isMirror: Boolean(props.isDragging || props.isResizing || props.isDateSelecting), + isStart: Boolean(seg.isStart), + isEnd: Boolean(seg.isEnd), + isPast: Boolean(props.isPast), + isFuture: Boolean(props.isFuture), + isToday: Boolean(props.isToday), + isSelected: Boolean(props.isSelected), + isDragging: Boolean(props.isDragging), + isResizing: Boolean(props.isResizing), + }; + return (h(ContentContainer, Object.assign({}, props /* contains children */, { elRef: this.handleEl, elClasses: [ + ...getEventClassNames(renderProps), + ...seg.eventRange.ui.classNames, + ...(props.elClasses || []), + ], renderProps: renderProps, generatorName: "eventContent", generator: options.eventContent || props.defaultGenerator, classNameGenerator: options.eventClassNames, didMount: options.eventDidMount, willUnmount: options.eventWillUnmount }))); + } + componentDidUpdate(prevProps) { + if (this.el && this.props.seg !== prevProps.seg) { + setElSeg(this.el, this.props.seg); + } + } + } + + // should not be a purecomponent + class StandardEvent extends BaseComponent { + render() { + let { props, context } = this; + let { options } = context; + let { seg } = props; + let { ui } = seg.eventRange; + let timeFormat = options.eventTimeFormat || props.defaultTimeFormat; + let timeText = buildSegTimeText(seg, timeFormat, context, props.defaultDisplayEventTime, props.defaultDisplayEventEnd); + return (h(EventContainer, Object.assign({}, props /* includes elRef */, { elTag: "a", elStyle: { + borderColor: ui.borderColor, + backgroundColor: ui.backgroundColor, + }, elAttrs: getSegAnchorAttrs(seg, context), defaultGenerator: renderInnerContent$1$1, timeText: timeText }), (InnerContent, eventContentArg) => (h(p, null, + h(InnerContent, { elTag: "div", elClasses: ['fc-event-main'], elStyle: { color: eventContentArg.textColor } }), + Boolean(eventContentArg.isStartResizable) && (h("div", { className: "fc-event-resizer fc-event-resizer-start" })), + Boolean(eventContentArg.isEndResizable) && (h("div", { className: "fc-event-resizer fc-event-resizer-end" })))))); + } + } + function renderInnerContent$1$1(innerProps) { + return (h("div", { className: "fc-event-main-frame" }, + innerProps.timeText && (h("div", { className: "fc-event-time" }, innerProps.timeText)), + h("div", { className: "fc-event-title-container" }, + h("div", { className: "fc-event-title fc-sticky" }, innerProps.event.title || h(p, null, "\u00A0"))))); + } + + const NowIndicatorContainer = (props) => (h(ViewContextType.Consumer, null, (context) => { + let { options } = context; + let renderProps = { + isAxis: props.isAxis, + date: context.dateEnv.toDate(props.date), + view: context.viewApi, + }; + return (h(ContentContainer, Object.assign({}, props /* includes children */, { elTag: props.elTag || 'div', renderProps: renderProps, generatorName: "nowIndicatorContent", generator: options.nowIndicatorContent, classNameGenerator: options.nowIndicatorClassNames, didMount: options.nowIndicatorDidMount, willUnmount: options.nowIndicatorWillUnmount }))); + })); + + const DAY_NUM_FORMAT = createFormatter({ day: 'numeric' }); + class DayCellContainer extends BaseComponent { + constructor() { + super(...arguments); + this.refineRenderProps = memoizeObjArg(refineRenderProps$4); + } + render() { + let { props, context } = this; + let { options } = context; + let renderProps = this.refineRenderProps({ + date: props.date, + dateProfile: props.dateProfile, + todayRange: props.todayRange, + showDayNumber: props.showDayNumber, + extraRenderProps: props.extraRenderProps, + viewApi: context.viewApi, + dateEnv: context.dateEnv, + }); + return (h(ContentContainer, Object.assign({}, props /* includes children */, { elClasses: [ + ...getDayClassNames(renderProps, context.theme), + ...(props.elClasses || []), + ], elAttrs: Object.assign(Object.assign({}, props.elAttrs), (renderProps.isDisabled ? {} : { 'data-date': formatDayString(props.date) })), renderProps: renderProps, generatorName: "dayCellContent", generator: options.dayCellContent || props.defaultGenerator, classNameGenerator: + // don't use custom classNames if disabled + renderProps.isDisabled ? undefined : options.dayCellClassNames, didMount: options.dayCellDidMount, willUnmount: options.dayCellWillUnmount }))); + } + } + function hasCustomDayCellContent(options) { + return Boolean(options.dayCellContent || hasCustomRenderingHandler('dayCellContent', options)); + } + function refineRenderProps$4(raw) { + let { date, dateEnv } = raw; + let dayMeta = getDateMeta(date, raw.todayRange, null, raw.dateProfile); + return Object.assign(Object.assign(Object.assign({ date: dateEnv.toDate(date), view: raw.viewApi }, dayMeta), { dayNumberText: raw.showDayNumber ? dateEnv.format(date, DAY_NUM_FORMAT) : '' }), raw.extraRenderProps); + } + + class BgEvent extends BaseComponent { + render() { + let { props } = this; + let { seg } = props; + return (h(EventContainer, { elTag: "div", elClasses: ['fc-bg-event'], elStyle: { backgroundColor: seg.eventRange.ui.backgroundColor }, defaultGenerator: renderInnerContent$5, seg: seg, timeText: "", isDragging: false, isResizing: false, isDateSelecting: false, isSelected: false, isPast: props.isPast, isFuture: props.isFuture, isToday: props.isToday, disableDragging: true, disableResizing: true })); + } + } + function renderInnerContent$5(props) { + let { title } = props.event; + return title && (h("div", { className: "fc-event-title" }, props.event.title)); + } + function renderFill(fillType) { + return (h("div", { className: `fc-${fillType}` })); + } + + const WeekNumberContainer = (props) => (h(ViewContextType.Consumer, null, (context) => { + let { dateEnv, options } = context; + let { date } = props; + let format = options.weekNumberFormat || props.defaultFormat; + let num = dateEnv.computeWeekNumber(date); // TODO: somehow use for formatting as well? + let text = dateEnv.format(date, format); + let renderProps = { num, text, date }; + return (h(ContentContainer // why isn't WeekNumberContentArg being auto-detected? + , Object.assign({}, props /* includes children */, { renderProps: renderProps, generatorName: "weekNumberContent", generator: options.weekNumberContent || renderInner, classNameGenerator: options.weekNumberClassNames, didMount: options.weekNumberDidMount, willUnmount: options.weekNumberWillUnmount }))); + })); + function renderInner(innerProps) { + return innerProps.text; + } + + const PADDING_FROM_VIEWPORT = 10; + class Popover extends BaseComponent { + constructor() { + super(...arguments); + this.state = { + titleId: getUniqueDomId(), + }; + this.handleRootEl = (el) => { + this.rootEl = el; + if (this.props.elRef) { + setRef(this.props.elRef, el); + } + }; + // Triggered when the user clicks *anywhere* in the document, for the autoHide feature + this.handleDocumentMouseDown = (ev) => { + // only hide the popover if the click happened outside the popover + const target = getEventTargetViaRoot(ev); + if (!this.rootEl.contains(target)) { + this.handleCloseClick(); + } + }; + this.handleDocumentKeyDown = (ev) => { + if (ev.key === 'Escape') { + this.handleCloseClick(); + } + }; + this.handleCloseClick = () => { + let { onClose } = this.props; + if (onClose) { + onClose(); + } + }; + } + render() { + let { theme, options } = this.context; + let { props, state } = this; + let classNames = [ + 'fc-popover', + theme.getClass('popover'), + ].concat(props.extraClassNames || []); + return j(h("div", Object.assign({}, props.extraAttrs, { id: props.id, className: classNames.join(' '), "aria-labelledby": state.titleId, ref: this.handleRootEl }), + h("div", { className: 'fc-popover-header ' + theme.getClass('popoverHeader') }, + h("span", { className: "fc-popover-title", id: state.titleId }, props.title), + h("span", { className: 'fc-popover-close ' + theme.getIconClass('close'), title: options.closeHint, onClick: this.handleCloseClick })), + h("div", { className: 'fc-popover-body ' + theme.getClass('popoverContent') }, props.children)), props.parentEl); + } + componentDidMount() { + document.addEventListener('mousedown', this.handleDocumentMouseDown); + document.addEventListener('keydown', this.handleDocumentKeyDown); + this.updateSize(); + } + componentWillUnmount() { + document.removeEventListener('mousedown', this.handleDocumentMouseDown); + document.removeEventListener('keydown', this.handleDocumentKeyDown); + } + updateSize() { + let { isRtl } = this.context; + let { alignmentEl, alignGridTop } = this.props; + let { rootEl } = this; + let alignmentRect = computeClippedClientRect(alignmentEl); + if (alignmentRect) { + let popoverDims = rootEl.getBoundingClientRect(); + // position relative to viewport + let popoverTop = alignGridTop + ? elementClosest(alignmentEl, '.fc-scrollgrid').getBoundingClientRect().top + : alignmentRect.top; + let popoverLeft = isRtl ? alignmentRect.right - popoverDims.width : alignmentRect.left; + // constrain + popoverTop = Math.max(popoverTop, PADDING_FROM_VIEWPORT); + popoverLeft = Math.min(popoverLeft, document.documentElement.clientWidth - PADDING_FROM_VIEWPORT - popoverDims.width); + popoverLeft = Math.max(popoverLeft, PADDING_FROM_VIEWPORT); + let origin = rootEl.offsetParent.getBoundingClientRect(); + applyStyle(rootEl, { + top: popoverTop - origin.top, + left: popoverLeft - origin.left, + }); + } + } + } + + class MorePopover extends DateComponent { + constructor() { + super(...arguments); + this.handleRootEl = (rootEl) => { + this.rootEl = rootEl; + if (rootEl) { + this.context.registerInteractiveComponent(this, { + el: rootEl, + useEventCenter: false, + }); + } + else { + this.context.unregisterInteractiveComponent(this); + } + }; + } + render() { + let { options, dateEnv } = this.context; + let { props } = this; + let { startDate, todayRange, dateProfile } = props; + let title = dateEnv.format(startDate, options.dayPopoverFormat); + return (h(DayCellContainer, { elRef: this.handleRootEl, date: startDate, dateProfile: dateProfile, todayRange: todayRange }, (InnerContent, renderProps, elAttrs) => (h(Popover, { elRef: elAttrs.ref, id: props.id, title: title, extraClassNames: ['fc-more-popover'].concat(elAttrs.className || []), extraAttrs: elAttrs /* TODO: make these time-based when not whole-day? */, parentEl: props.parentEl, alignmentEl: props.alignmentEl, alignGridTop: props.alignGridTop, onClose: props.onClose }, + hasCustomDayCellContent(options) && (h(InnerContent, { elTag: "div", elClasses: ['fc-more-popover-misc'] })), + props.children)))); + } + queryHit(positionLeft, positionTop, elWidth, elHeight) { + let { rootEl, props } = this; + if (positionLeft >= 0 && positionLeft < elWidth && + positionTop >= 0 && positionTop < elHeight) { + return { + dateProfile: props.dateProfile, + dateSpan: Object.assign({ allDay: true, range: { + start: props.startDate, + end: props.endDate, + } }, props.extraDateSpan), + dayEl: rootEl, + rect: { + left: 0, + top: 0, + right: elWidth, + bottom: elHeight, + }, + layer: 1, // important when comparing with hits from other components + }; + } + return null; + } + } + + class MoreLinkContainer extends BaseComponent { + constructor() { + super(...arguments); + this.linkElRef = y(); + this.state = { + isPopoverOpen: false, + popoverId: getUniqueDomId(), + }; + this.handleClick = (ev) => { + let { props, context } = this; + let { moreLinkClick } = context.options; + let date = computeRange(props).start; + function buildPublicSeg(seg) { + let { def, instance, range } = seg.eventRange; + return { + event: new EventImpl(context, def, instance), + start: context.dateEnv.toDate(range.start), + end: context.dateEnv.toDate(range.end), + isStart: seg.isStart, + isEnd: seg.isEnd, + }; + } + if (typeof moreLinkClick === 'function') { + moreLinkClick = moreLinkClick({ + date, + allDay: Boolean(props.allDayDate), + allSegs: props.allSegs.map(buildPublicSeg), + hiddenSegs: props.hiddenSegs.map(buildPublicSeg), + jsEvent: ev, + view: context.viewApi, + }); + } + if (!moreLinkClick || moreLinkClick === 'popover') { + this.setState({ isPopoverOpen: true }); + } + else if (typeof moreLinkClick === 'string') { // a view name + context.calendarApi.zoomTo(date, moreLinkClick); + } + }; + this.handlePopoverClose = () => { + this.setState({ isPopoverOpen: false }); + }; + } + render() { + let { props, state } = this; + return (h(ViewContextType.Consumer, null, (context) => { + let { viewApi, options, calendarApi } = context; + let { moreLinkText } = options; + let { moreCnt } = props; + let range = computeRange(props); + let text = typeof moreLinkText === 'function' // TODO: eventually use formatWithOrdinals + ? moreLinkText.call(calendarApi, moreCnt) + : `+${moreCnt} ${moreLinkText}`; + let hint = formatWithOrdinals(options.moreLinkHint, [moreCnt], text); + let renderProps = { + num: moreCnt, + shortText: `+${moreCnt}`, + text, + view: viewApi, + }; + return (h(p, null, + Boolean(props.moreCnt) && (h(ContentContainer, { elTag: props.elTag || 'a', elRef: this.linkElRef, elClasses: [ + ...(props.elClasses || []), + 'fc-more-link', + ], elAttrs: Object.assign(Object.assign(Object.assign({}, props.elAttrs), createAriaClickAttrs(this.handleClick)), { title: hint, 'aria-expanded': state.isPopoverOpen, 'aria-controls': state.isPopoverOpen ? state.popoverId : '' }), renderProps: renderProps, generatorName: "moreLinkContent", generator: options.moreLinkContent || props.defaultGenerator || renderMoreLinkInner$1, classNameGenerator: options.moreLinkClassNames, didMount: options.moreLinkDidMount, willUnmount: options.moreLinkWillUnmount }, props.children)), + state.isPopoverOpen && (h(MorePopover, { id: state.popoverId, startDate: range.start, endDate: range.end, dateProfile: props.dateProfile, todayRange: props.todayRange, extraDateSpan: props.extraDateSpan, parentEl: this.parentEl, alignmentEl: props.alignmentElRef ? + props.alignmentElRef.current : + this.linkElRef.current, alignGridTop: props.alignGridTop, onClose: this.handlePopoverClose }, props.popoverContent())))); + })); + } + componentDidMount() { + this.updateParentEl(); + } + componentDidUpdate() { + this.updateParentEl(); + } + updateParentEl() { + if (this.linkElRef.current) { + this.parentEl = elementClosest(this.linkElRef.current, '.fc-view-harness'); + } + } + } + function renderMoreLinkInner$1(props) { + return props.text; + } + function computeRange(props) { + if (props.allDayDate) { + return { + start: props.allDayDate, + end: addDays(props.allDayDate, 1), + }; + } + let { hiddenSegs } = props; + return { + start: computeEarliestSegStart(hiddenSegs), + end: computeLatestSegEnd(hiddenSegs), + }; + } + function computeEarliestSegStart(segs) { + return segs.reduce(pickEarliestStart).eventRange.range.start; + } + function pickEarliestStart(seg0, seg1) { + return seg0.eventRange.range.start < seg1.eventRange.range.start ? seg0 : seg1; + } + function computeLatestSegEnd(segs) { + return segs.reduce(pickLatestEnd).eventRange.range.end; + } + function pickLatestEnd(seg0, seg1) { + return seg0.eventRange.range.end > seg1.eventRange.range.end ? seg0 : seg1; + } + + class Store { + constructor() { + this.handlers = []; + } + set(value) { + this.currentValue = value; + for (let handler of this.handlers) { + handler(value); + } + } + subscribe(handler) { + this.handlers.push(handler); + if (this.currentValue !== undefined) { + handler(this.currentValue); + } + } + } + + /* + Subscribers will get a LIST of CustomRenderings + */ + class CustomRenderingStore extends Store { + constructor() { + super(...arguments); + this.map = new Map(); + } + // for consistent order + handle(customRendering) { + const { map } = this; + let updated = false; + if (customRendering.isActive) { + map.set(customRendering.id, customRendering); + updated = true; + } + else if (map.has(customRendering.id)) { + map.delete(customRendering.id); + updated = true; + } + if (updated) { + this.set(map); + } + } + } + + var internal = { + __proto__: null, + BASE_OPTION_DEFAULTS: BASE_OPTION_DEFAULTS, + BaseComponent: BaseComponent, + BgEvent: BgEvent, + CalendarImpl: CalendarImpl, + CalendarRoot: CalendarRoot, + ContentContainer: ContentContainer, + CustomRenderingStore: CustomRenderingStore, + DateComponent: DateComponent, + DateEnv: DateEnv, + DateProfileGenerator: DateProfileGenerator, + DayCellContainer: DayCellContainer, + DayHeader: DayHeader, + DaySeriesModel: DaySeriesModel, + DayTableModel: DayTableModel, + DelayedRunner: DelayedRunner, + ElementDragging: ElementDragging, + ElementScrollController: ElementScrollController, + Emitter: Emitter, + EventContainer: EventContainer, + EventImpl: EventImpl, + Interaction: Interaction, + MoreLinkContainer: MoreLinkContainer, + NamedTimeZoneImpl: NamedTimeZoneImpl, + NowIndicatorContainer: NowIndicatorContainer, + NowTimer: NowTimer, + PositionCache: PositionCache, + RefMap: RefMap, + ScrollController: ScrollController, + ScrollResponder: ScrollResponder, + Scroller: Scroller, + SegHierarchy: SegHierarchy, + SimpleScrollGrid: SimpleScrollGrid, + Slicer: Slicer, + Splitter: Splitter, + StandardEvent: StandardEvent, + TableDateCell: TableDateCell, + TableDowCell: TableDowCell, + Theme: Theme, + ViewContainer: ViewContainer$1, + ViewContextType: ViewContextType, + WeekNumberContainer: WeekNumberContainer, + WindowScrollController: WindowScrollController, + addDays: addDays, + addDurations: addDurations, + addMs: addMs, + addWeeks: addWeeks, + allowContextMenu: allowContextMenu, + allowSelection: allowSelection, + applyMutationToEventStore: applyMutationToEventStore, + applyStyle: applyStyle, + asCleanDays: asCleanDays, + asRoughMinutes: asRoughMinutes, + asRoughMs: asRoughMs, + asRoughSeconds: asRoughSeconds, + binarySearch: binarySearch, + buildElAttrs: buildElAttrs, + buildEntryKey: buildEntryKey, + buildEventApis: buildEventApis, + buildEventRangeKey: buildEventRangeKey, + buildIsoString: buildIsoString, + buildNavLinkAttrs: buildNavLinkAttrs, + buildSegTimeText: buildSegTimeText, + collectFromHash: collectFromHash, + combineEventUis: combineEventUis, + compareByFieldSpecs: compareByFieldSpecs, + compareNumbers: compareNumbers, + compareObjs: compareObjs, + computeEarliestSegStart: computeEarliestSegStart, + computeEdges: computeEdges, + computeFallbackHeaderFormat: computeFallbackHeaderFormat, + computeInnerRect: computeInnerRect, + computeRect: computeRect, + computeShrinkWidth: computeShrinkWidth, + computeVisibleDayRange: computeVisibleDayRange, + config: config, + constrainPoint: constrainPoint, + createDuration: createDuration, + createEmptyEventStore: createEmptyEventStore, + createEventInstance: createEventInstance, + createEventUi: createEventUi, + createFormatter: createFormatter, + diffDates: diffDates, + diffDayAndTime: diffDayAndTime, + diffDays: diffDays, + diffPoints: diffPoints, + diffWeeks: diffWeeks, + diffWholeDays: diffWholeDays, + diffWholeWeeks: diffWholeWeeks, + disableCursor: disableCursor, + elementClosest: elementClosest, + elementMatches: elementMatches, + enableCursor: enableCursor, + eventTupleToStore: eventTupleToStore, + filterHash: filterHash, + findDirectChildren: findDirectChildren, + findElements: findElements, + flexibleCompare: flexibleCompare, + formatDayString: formatDayString, + formatIsoTimeString: formatIsoTimeString, + getAllowYScrolling: getAllowYScrolling, + getCanVGrowWithinCell: getCanVGrowWithinCell, + getClippingParents: getClippingParents, + getDateMeta: getDateMeta, + getDayClassNames: getDayClassNames, + getDefaultEventEnd: getDefaultEventEnd, + getElRoot: getElRoot, + getElSeg: getElSeg, + getEntrySpanEnd: getEntrySpanEnd, + getEventTargetViaRoot: getEventTargetViaRoot, + getIsRtlScrollbarOnLeft: getIsRtlScrollbarOnLeft, + getRectCenter: getRectCenter, + getRelevantEvents: getRelevantEvents, + getScrollGridClassNames: getScrollGridClassNames, + getScrollbarWidths: getScrollbarWidths, + getSectionClassNames: getSectionClassNames, + getSectionHasLiquidHeight: getSectionHasLiquidHeight, + getSegAnchorAttrs: getSegAnchorAttrs, + getSegMeta: getSegMeta, + getSlotClassNames: getSlotClassNames, + getStickyFooterScrollbar: getStickyFooterScrollbar, + getStickyHeaderDates: getStickyHeaderDates, + getUniqueDomId: getUniqueDomId, + greatestDurationDenominator: greatestDurationDenominator, + groupIntersectingEntries: groupIntersectingEntries, + guid: guid, + hasBgRendering: hasBgRendering, + hasCustomDayCellContent: hasCustomDayCellContent, + hasShrinkWidth: hasShrinkWidth, + identity: identity, + injectStyles: injectStyles, + interactionSettingsStore: interactionSettingsStore, + interactionSettingsToStore: interactionSettingsToStore, + intersectRanges: intersectRanges, + intersectRects: intersectRects, + intersectSpans: intersectSpans, + isArraysEqual: isArraysEqual, + isColPropsEqual: isColPropsEqual, + isDateSelectionValid: isDateSelectionValid, + isDateSpansEqual: isDateSpansEqual, + isInt: isInt, + isInteractionValid: isInteractionValid, + isMultiDayRange: isMultiDayRange, + isPropsEqual: isPropsEqual, + isPropsValid: isPropsValid, + isValidDate: isValidDate$1, + mapHash: mapHash, + memoize: memoize, + memoizeArraylike: memoizeArraylike, + memoizeHashlike: memoizeHashlike, + memoizeObjArg: memoizeObjArg, + mergeEventStores: mergeEventStores, + multiplyDuration: multiplyDuration, + padStart: padStart, + parseBusinessHours: parseBusinessHours, + parseClassNames: parseClassNames, + parseDragMeta: parseDragMeta, + parseEventDef: parseEventDef, + parseFieldSpecs: parseFieldSpecs, + parseMarker: parse, + pointInsideRect: pointInsideRect, + preventContextMenu: preventContextMenu, + preventDefault: preventDefault, + preventSelection: preventSelection, + rangeContainsMarker: rangeContainsMarker, + rangeContainsRange: rangeContainsRange, + rangesEqual: rangesEqual, + rangesIntersect: rangesIntersect, + refineEventDef: refineEventDef, + refineProps: refineProps, + removeElement: removeElement, + removeExact: removeExact, + renderChunkContent: renderChunkContent, + renderFill: renderFill, + renderMicroColGroup: renderMicroColGroup, + renderScrollShim: renderScrollShim, + requestJson: requestJson, + sanitizeShrinkWidth: sanitizeShrinkWidth, + setRef: setRef, + sliceEventStore: sliceEventStore, + sortEventSegs: sortEventSegs, + startOfDay: startOfDay, + translateRect: translateRect, + triggerDateSelect: triggerDateSelect, + unpromisify: unpromisify, + whenTransitionDone: whenTransitionDone, + wholeDivideDurations: wholeDivideDurations + }; + + var css_248z$6 = ":root{--fc-small-font-size:.85em;--fc-page-bg-color:#fff;--fc-neutral-bg-color:hsla(0,0%,82%,.3);--fc-neutral-text-color:grey;--fc-border-color:#ddd;--fc-button-text-color:#fff;--fc-button-bg-color:#2c3e50;--fc-button-border-color:#2c3e50;--fc-button-hover-bg-color:#1e2b37;--fc-button-hover-border-color:#1a252f;--fc-button-active-bg-color:#1a252f;--fc-button-active-border-color:#151e27;--fc-event-bg-color:#3788d8;--fc-event-border-color:#3788d8;--fc-event-text-color:#fff;--fc-event-selected-overlay-color:rgba(0,0,0,.25);--fc-more-link-bg-color:#d0d0d0;--fc-more-link-text-color:inherit;--fc-event-resizer-thickness:8px;--fc-event-resizer-dot-total-width:8px;--fc-event-resizer-dot-border-width:1px;--fc-non-business-color:hsla(0,0%,84%,.3);--fc-bg-event-color:#8fdf82;--fc-bg-event-opacity:0.3;--fc-highlight-color:rgba(188,232,241,.3);--fc-today-bg-color:rgba(255,220,40,.15);--fc-now-indicator-color:red}.fc-not-allowed,.fc-not-allowed .fc-event{cursor:not-allowed}.fc-unselectable{-webkit-touch-callout:none;-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-user-select:none;-moz-user-select:none;user-select:none}.fc{display:flex;flex-direction:column;font-size:1em}.fc,.fc *,.fc :after,.fc :before{box-sizing:border-box}.fc table{border-collapse:collapse;border-spacing:0;font-size:1em}.fc th{text-align:center}.fc td,.fc th{padding:0;vertical-align:top}.fc a[data-navlink]{cursor:pointer}.fc a[data-navlink]:hover{text-decoration:underline}.fc-direction-ltr{direction:ltr;text-align:left}.fc-direction-rtl{direction:rtl;text-align:right}.fc-theme-standard td,.fc-theme-standard th{border:1px solid var(--fc-border-color)}.fc-liquid-hack td,.fc-liquid-hack th{position:relative}@font-face{font-family:fcicons;font-style:normal;font-weight:400;src:url(\"data:application/x-font-ttf;charset=utf-8;base64,AAEAAAALAIAAAwAwT1MvMg8SBfAAAAC8AAAAYGNtYXAXVtKNAAABHAAAAFRnYXNwAAAAEAAAAXAAAAAIZ2x5ZgYydxIAAAF4AAAFNGhlYWQUJ7cIAAAGrAAAADZoaGVhB20DzAAABuQAAAAkaG10eCIABhQAAAcIAAAALGxvY2ED4AU6AAAHNAAAABhtYXhwAA8AjAAAB0wAAAAgbmFtZXsr690AAAdsAAABhnBvc3QAAwAAAAAI9AAAACAAAwPAAZAABQAAApkCzAAAAI8CmQLMAAAB6wAzAQkAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAAADpBgPA/8AAQAPAAEAAAAABAAAAAAAAAAAAAAAgAAAAAAADAAAAAwAAABwAAQADAAAAHAADAAEAAAAcAAQAOAAAAAoACAACAAIAAQAg6Qb//f//AAAAAAAg6QD//f//AAH/4xcEAAMAAQAAAAAAAAAAAAAAAQAB//8ADwABAAAAAAAAAAAAAgAANzkBAAAAAAEAAAAAAAAAAAACAAA3OQEAAAAAAQAAAAAAAAAAAAIAADc5AQAAAAABAWIAjQKeAskAEwAAJSc3NjQnJiIHAQYUFwEWMjc2NCcCnuLiDQ0MJAz/AA0NAQAMJAwNDcni4gwjDQwM/wANIwz/AA0NDCMNAAAAAQFiAI0CngLJABMAACUBNjQnASYiBwYUHwEHBhQXFjI3AZ4BAA0N/wAMJAwNDeLiDQ0MJAyNAQAMIw0BAAwMDSMM4uINIwwNDQAAAAIA4gC3Ax4CngATACcAACUnNzY0JyYiDwEGFB8BFjI3NjQnISc3NjQnJiIPAQYUHwEWMjc2NCcB87e3DQ0MIw3VDQ3VDSMMDQ0BK7e3DQ0MJAzVDQ3VDCQMDQ3zuLcMJAwNDdUNIwzWDAwNIwy4twwkDA0N1Q0jDNYMDA0jDAAAAgDiALcDHgKeABMAJwAAJTc2NC8BJiIHBhQfAQcGFBcWMjchNzY0LwEmIgcGFB8BBwYUFxYyNwJJ1Q0N1Q0jDA0Nt7cNDQwjDf7V1Q0N1QwkDA0Nt7cNDQwkDLfWDCMN1Q0NDCQMt7gMIw0MDNYMIw3VDQ0MJAy3uAwjDQwMAAADAFUAAAOrA1UAMwBoAHcAABMiBgcOAQcOAQcOARURFBYXHgEXHgEXHgEzITI2Nz4BNz4BNz4BNRE0JicuAScuAScuASMFITIWFx4BFx4BFx4BFREUBgcOAQcOAQcOASMhIiYnLgEnLgEnLgE1ETQ2Nz4BNz4BNz4BMxMhMjY1NCYjISIGFRQWM9UNGAwLFQkJDgUFBQUFBQ4JCRULDBgNAlYNGAwLFQkJDgUFBQUFBQ4JCRULDBgN/aoCVgQIBAQHAwMFAQIBAQIBBQMDBwQECAT9qgQIBAQHAwMFAQIBAQIBBQMDBwQECASAAVYRGRkR/qoRGRkRA1UFBAUOCQkVDAsZDf2rDRkLDBUJCA4FBQUFBQUOCQgVDAsZDQJVDRkLDBUJCQ4FBAVVAgECBQMCBwQECAX9qwQJAwQHAwMFAQICAgIBBQMDBwQDCQQCVQUIBAQHAgMFAgEC/oAZEhEZGRESGQAAAAADAFUAAAOrA1UAMwBoAIkAABMiBgcOAQcOAQcOARURFBYXHgEXHgEXHgEzITI2Nz4BNz4BNz4BNRE0JicuAScuAScuASMFITIWFx4BFx4BFx4BFREUBgcOAQcOAQcOASMhIiYnLgEnLgEnLgE1ETQ2Nz4BNz4BNz4BMxMzFRQWMzI2PQEzMjY1NCYrATU0JiMiBh0BIyIGFRQWM9UNGAwLFQkJDgUFBQUFBQ4JCRULDBgNAlYNGAwLFQkJDgUFBQUFBQ4JCRULDBgN/aoCVgQIBAQHAwMFAQIBAQIBBQMDBwQECAT9qgQIBAQHAwMFAQIBAQIBBQMDBwQECASAgBkSEhmAERkZEYAZEhIZgBEZGREDVQUEBQ4JCRUMCxkN/asNGQsMFQkIDgUFBQUFBQ4JCBUMCxkNAlUNGQsMFQkJDgUEBVUCAQIFAwIHBAQIBf2rBAkDBAcDAwUBAgICAgEFAwMHBAMJBAJVBQgEBAcCAwUCAQL+gIASGRkSgBkSERmAEhkZEoAZERIZAAABAOIAjQMeAskAIAAAExcHBhQXFjI/ARcWMjc2NC8BNzY0JyYiDwEnJiIHBhQX4uLiDQ0MJAzi4gwkDA0N4uINDQwkDOLiDCQMDQ0CjeLiDSMMDQ3h4Q0NDCMN4uIMIw0MDOLiDAwNIwwAAAABAAAAAQAAa5n0y18PPPUACwQAAAAAANivOVsAAAAA2K85WwAAAAADqwNVAAAACAACAAAAAAAAAAEAAAPA/8AAAAQAAAAAAAOrAAEAAAAAAAAAAAAAAAAAAAALBAAAAAAAAAAAAAAAAgAAAAQAAWIEAAFiBAAA4gQAAOIEAABVBAAAVQQAAOIAAAAAAAoAFAAeAEQAagCqAOoBngJkApoAAQAAAAsAigADAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAA4ArgABAAAAAAABAAcAAAABAAAAAAACAAcAYAABAAAAAAADAAcANgABAAAAAAAEAAcAdQABAAAAAAAFAAsAFQABAAAAAAAGAAcASwABAAAAAAAKABoAigADAAEECQABAA4ABwADAAEECQACAA4AZwADAAEECQADAA4APQADAAEECQAEAA4AfAADAAEECQAFABYAIAADAAEECQAGAA4AUgADAAEECQAKADQApGZjaWNvbnMAZgBjAGkAYwBvAG4Ac1ZlcnNpb24gMS4wAFYAZQByAHMAaQBvAG4AIAAxAC4AMGZjaWNvbnMAZgBjAGkAYwBvAG4Ac2ZjaWNvbnMAZgBjAGkAYwBvAG4Ac1JlZ3VsYXIAUgBlAGcAdQBsAGEAcmZjaWNvbnMAZgBjAGkAYwBvAG4Ac0ZvbnQgZ2VuZXJhdGVkIGJ5IEljb01vb24uAEYAbwBuAHQAIABnAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAEkAYwBvAE0AbwBvAG4ALgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\") format(\"truetype\")}.fc-icon{speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;display:inline-block;font-family:fcicons!important;font-style:normal;font-variant:normal;font-weight:400;height:1em;line-height:1;text-align:center;text-transform:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:1em}.fc-icon-chevron-left:before{content:\"\\e900\"}.fc-icon-chevron-right:before{content:\"\\e901\"}.fc-icon-chevrons-left:before{content:\"\\e902\"}.fc-icon-chevrons-right:before{content:\"\\e903\"}.fc-icon-minus-square:before{content:\"\\e904\"}.fc-icon-plus-square:before{content:\"\\e905\"}.fc-icon-x:before{content:\"\\e906\"}.fc .fc-button{border-radius:0;font-family:inherit;font-size:inherit;line-height:inherit;margin:0;overflow:visible;text-transform:none}.fc .fc-button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}.fc .fc-button{-webkit-appearance:button}.fc .fc-button:not(:disabled){cursor:pointer}.fc .fc-button::-moz-focus-inner{border-style:none;padding:0}.fc .fc-button{background-color:transparent;border:1px solid transparent;border-radius:.25em;display:inline-block;font-size:1em;font-weight:400;line-height:1.5;padding:.4em .65em;text-align:center;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle}.fc .fc-button:hover{text-decoration:none}.fc .fc-button:focus{box-shadow:0 0 0 .2rem rgba(44,62,80,.25);outline:0}.fc .fc-button:disabled{opacity:.65}.fc .fc-button-primary{background-color:var(--fc-button-bg-color);border-color:var(--fc-button-border-color);color:var(--fc-button-text-color)}.fc .fc-button-primary:hover{background-color:var(--fc-button-hover-bg-color);border-color:var(--fc-button-hover-border-color);color:var(--fc-button-text-color)}.fc .fc-button-primary:disabled{background-color:var(--fc-button-bg-color);border-color:var(--fc-button-border-color);color:var(--fc-button-text-color)}.fc .fc-button-primary:focus{box-shadow:0 0 0 .2rem rgba(76,91,106,.5)}.fc .fc-button-primary:not(:disabled).fc-button-active,.fc .fc-button-primary:not(:disabled):active{background-color:var(--fc-button-active-bg-color);border-color:var(--fc-button-active-border-color);color:var(--fc-button-text-color)}.fc .fc-button-primary:not(:disabled).fc-button-active:focus,.fc .fc-button-primary:not(:disabled):active:focus{box-shadow:0 0 0 .2rem rgba(76,91,106,.5)}.fc .fc-button .fc-icon{font-size:1.5em;vertical-align:middle}.fc .fc-button-group{display:inline-flex;position:relative;vertical-align:middle}.fc .fc-button-group>.fc-button{flex:1 1 auto;position:relative}.fc .fc-button-group>.fc-button.fc-button-active,.fc .fc-button-group>.fc-button:active,.fc .fc-button-group>.fc-button:focus,.fc .fc-button-group>.fc-button:hover{z-index:1}.fc-direction-ltr .fc-button-group>.fc-button:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0;margin-left:-1px}.fc-direction-ltr .fc-button-group>.fc-button:not(:last-child){border-bottom-right-radius:0;border-top-right-radius:0}.fc-direction-rtl .fc-button-group>.fc-button:not(:first-child){border-bottom-right-radius:0;border-top-right-radius:0;margin-right:-1px}.fc-direction-rtl .fc-button-group>.fc-button:not(:last-child){border-bottom-left-radius:0;border-top-left-radius:0}.fc .fc-toolbar{align-items:center;display:flex;justify-content:space-between}.fc .fc-toolbar.fc-header-toolbar{margin-bottom:1.5em}.fc .fc-toolbar.fc-footer-toolbar{margin-top:1.5em}.fc .fc-toolbar-title{font-size:1.75em;margin:0}.fc-direction-ltr .fc-toolbar>*>:not(:first-child){margin-left:.75em}.fc-direction-rtl .fc-toolbar>*>:not(:first-child){margin-right:.75em}.fc-direction-rtl .fc-toolbar-ltr{flex-direction:row-reverse}.fc .fc-scroller{-webkit-overflow-scrolling:touch;position:relative}.fc .fc-scroller-liquid{height:100%}.fc .fc-scroller-liquid-absolute{bottom:0;left:0;position:absolute;right:0;top:0}.fc .fc-scroller-harness{direction:ltr;overflow:hidden;position:relative}.fc .fc-scroller-harness-liquid{height:100%}.fc-direction-rtl .fc-scroller-harness>.fc-scroller{direction:rtl}.fc-theme-standard .fc-scrollgrid{border:1px solid var(--fc-border-color)}.fc .fc-scrollgrid,.fc .fc-scrollgrid table{table-layout:fixed;width:100%}.fc .fc-scrollgrid table{border-left-style:hidden;border-right-style:hidden;border-top-style:hidden}.fc .fc-scrollgrid{border-bottom-width:0;border-collapse:separate;border-right-width:0}.fc .fc-scrollgrid-liquid{height:100%}.fc .fc-scrollgrid-section,.fc .fc-scrollgrid-section table,.fc .fc-scrollgrid-section>td{height:1px}.fc .fc-scrollgrid-section-liquid>td{height:100%}.fc .fc-scrollgrid-section>*{border-left-width:0;border-top-width:0}.fc .fc-scrollgrid-section-footer>*,.fc .fc-scrollgrid-section-header>*{border-bottom-width:0}.fc .fc-scrollgrid-section-body table,.fc .fc-scrollgrid-section-footer table{border-bottom-style:hidden}.fc .fc-scrollgrid-section-sticky>*{background:var(--fc-page-bg-color);position:sticky;z-index:3}.fc .fc-scrollgrid-section-header.fc-scrollgrid-section-sticky>*{top:0}.fc .fc-scrollgrid-section-footer.fc-scrollgrid-section-sticky>*{bottom:0}.fc .fc-scrollgrid-sticky-shim{height:1px;margin-bottom:-1px}.fc-sticky{position:sticky}.fc .fc-view-harness{flex-grow:1;position:relative}.fc .fc-view-harness-active>.fc-view{bottom:0;left:0;position:absolute;right:0;top:0}.fc .fc-col-header-cell-cushion{display:inline-block;padding:2px 4px}.fc .fc-bg-event,.fc .fc-highlight,.fc .fc-non-business{bottom:0;left:0;position:absolute;right:0;top:0}.fc .fc-non-business{background:var(--fc-non-business-color)}.fc .fc-bg-event{background:var(--fc-bg-event-color);opacity:var(--fc-bg-event-opacity)}.fc .fc-bg-event .fc-event-title{font-size:var(--fc-small-font-size);font-style:italic;margin:.5em}.fc .fc-highlight{background:var(--fc-highlight-color)}.fc .fc-cell-shaded,.fc .fc-day-disabled{background:var(--fc-neutral-bg-color)}a.fc-event,a.fc-event:hover{text-decoration:none}.fc-event.fc-event-draggable,.fc-event[href]{cursor:pointer}.fc-event .fc-event-main{position:relative;z-index:2}.fc-event-dragging:not(.fc-event-selected){opacity:.75}.fc-event-dragging.fc-event-selected{box-shadow:0 2px 7px rgba(0,0,0,.3)}.fc-event .fc-event-resizer{display:none;position:absolute;z-index:4}.fc-event-selected .fc-event-resizer,.fc-event:hover .fc-event-resizer{display:block}.fc-event-selected .fc-event-resizer{background:var(--fc-page-bg-color);border-color:inherit;border-radius:calc(var(--fc-event-resizer-dot-total-width)/2);border-style:solid;border-width:var(--fc-event-resizer-dot-border-width);height:var(--fc-event-resizer-dot-total-width);width:var(--fc-event-resizer-dot-total-width)}.fc-event-selected .fc-event-resizer:before{bottom:-20px;content:\"\";left:-20px;position:absolute;right:-20px;top:-20px}.fc-event-selected,.fc-event:focus{box-shadow:0 2px 5px rgba(0,0,0,.2)}.fc-event-selected:before,.fc-event:focus:before{bottom:0;content:\"\";left:0;position:absolute;right:0;top:0;z-index:3}.fc-event-selected:after,.fc-event:focus:after{background:var(--fc-event-selected-overlay-color);bottom:-1px;content:\"\";left:-1px;position:absolute;right:-1px;top:-1px;z-index:1}.fc-h-event{background-color:var(--fc-event-bg-color);border:1px solid var(--fc-event-border-color);display:block}.fc-h-event .fc-event-main{color:var(--fc-event-text-color)}.fc-h-event .fc-event-main-frame{display:flex}.fc-h-event .fc-event-time{max-width:100%;overflow:hidden}.fc-h-event .fc-event-title-container{flex-grow:1;flex-shrink:1;min-width:0}.fc-h-event .fc-event-title{display:inline-block;left:0;max-width:100%;overflow:hidden;right:0;vertical-align:top}.fc-h-event.fc-event-selected:before{bottom:-10px;top:-10px}.fc-direction-ltr .fc-daygrid-block-event:not(.fc-event-start),.fc-direction-rtl .fc-daygrid-block-event:not(.fc-event-end){border-bottom-left-radius:0;border-left-width:0;border-top-left-radius:0}.fc-direction-ltr .fc-daygrid-block-event:not(.fc-event-end),.fc-direction-rtl .fc-daygrid-block-event:not(.fc-event-start){border-bottom-right-radius:0;border-right-width:0;border-top-right-radius:0}.fc-h-event:not(.fc-event-selected) .fc-event-resizer{bottom:0;top:0;width:var(--fc-event-resizer-thickness)}.fc-direction-ltr .fc-h-event:not(.fc-event-selected) .fc-event-resizer-start,.fc-direction-rtl .fc-h-event:not(.fc-event-selected) .fc-event-resizer-end{cursor:w-resize;left:calc(var(--fc-event-resizer-thickness)*-.5)}.fc-direction-ltr .fc-h-event:not(.fc-event-selected) .fc-event-resizer-end,.fc-direction-rtl .fc-h-event:not(.fc-event-selected) .fc-event-resizer-start{cursor:e-resize;right:calc(var(--fc-event-resizer-thickness)*-.5)}.fc-h-event.fc-event-selected .fc-event-resizer{margin-top:calc(var(--fc-event-resizer-dot-total-width)*-.5);top:50%}.fc-direction-ltr .fc-h-event.fc-event-selected .fc-event-resizer-start,.fc-direction-rtl .fc-h-event.fc-event-selected .fc-event-resizer-end{left:calc(var(--fc-event-resizer-dot-total-width)*-.5)}.fc-direction-ltr .fc-h-event.fc-event-selected .fc-event-resizer-end,.fc-direction-rtl .fc-h-event.fc-event-selected .fc-event-resizer-start{right:calc(var(--fc-event-resizer-dot-total-width)*-.5)}.fc .fc-popover{box-shadow:0 2px 6px rgba(0,0,0,.15);position:absolute;z-index:9999}.fc .fc-popover-header{align-items:center;display:flex;flex-direction:row;justify-content:space-between;padding:3px 4px}.fc .fc-popover-title{margin:0 2px}.fc .fc-popover-close{cursor:pointer;font-size:1.1em;opacity:.65}.fc-theme-standard .fc-popover{background:var(--fc-page-bg-color);border:1px solid var(--fc-border-color)}.fc-theme-standard .fc-popover-header{background:var(--fc-neutral-bg-color)}"; + injectStyles(css_248z$6); + + const globalLocales = []; + + const MINIMAL_RAW_EN_LOCALE = { + code: 'en', + week: { + dow: 0, + doy: 4, // 4 days need to be within the year to be considered the first week + }, + direction: 'ltr', + buttonText: { + prev: 'prev', + next: 'next', + prevYear: 'prev year', + nextYear: 'next year', + year: 'year', + today: 'today', + month: 'month', + week: 'week', + day: 'day', + list: 'list', + }, + weekText: 'W', + weekTextLong: 'Week', + closeHint: 'Close', + timeHint: 'Time', + eventHint: 'Event', + allDayText: 'all-day', + moreLinkText: 'more', + noEventsText: 'No events to display', + }; + const RAW_EN_LOCALE = Object.assign(Object.assign({}, MINIMAL_RAW_EN_LOCALE), { + // Includes things we don't want other locales to inherit, + // things that derive from other translatable strings. + buttonHints: { + prev: 'Previous $0', + next: 'Next $0', + today(buttonText, unit) { + return (unit === 'day') + ? 'Today' + : `This ${buttonText}`; + }, + }, viewHint: '$0 view', navLinkHint: 'Go to $0', moreLinkHint(eventCnt) { + return `Show ${eventCnt} more event${eventCnt === 1 ? '' : 's'}`; + } }); + function organizeRawLocales(explicitRawLocales) { + let defaultCode = explicitRawLocales.length > 0 ? explicitRawLocales[0].code : 'en'; + let allRawLocales = globalLocales.concat(explicitRawLocales); + let rawLocaleMap = { + en: RAW_EN_LOCALE, + }; + for (let rawLocale of allRawLocales) { + rawLocaleMap[rawLocale.code] = rawLocale; + } + return { + map: rawLocaleMap, + defaultCode, + }; + } + function buildLocale(inputSingular, available) { + if (typeof inputSingular === 'object' && !Array.isArray(inputSingular)) { + return parseLocale(inputSingular.code, [inputSingular.code], inputSingular); + } + return queryLocale(inputSingular, available); + } + function queryLocale(codeArg, available) { + let codes = [].concat(codeArg || []); // will convert to array + let raw = queryRawLocale(codes, available) || RAW_EN_LOCALE; + return parseLocale(codeArg, codes, raw); + } + function queryRawLocale(codes, available) { + for (let i = 0; i < codes.length; i += 1) { + let parts = codes[i].toLocaleLowerCase().split('-'); + for (let j = parts.length; j > 0; j -= 1) { + let simpleId = parts.slice(0, j).join('-'); + if (available[simpleId]) { + return available[simpleId]; + } + } + } + return null; + } + function parseLocale(codeArg, codes, raw) { + let merged = mergeProps([MINIMAL_RAW_EN_LOCALE, raw], ['buttonText']); + delete merged.code; // don't want this part of the options + let { week } = merged; + delete merged.week; + return { + codeArg, + codes, + week, + simpleNumberFormat: new Intl.NumberFormat(codeArg), + options: merged, + }; + } + + // TODO: easier way to add new hooks? need to update a million things + function createPlugin(input) { + return { + id: guid(), + name: input.name, + premiumReleaseDate: input.premiumReleaseDate ? new Date(input.premiumReleaseDate) : undefined, + deps: input.deps || [], + reducers: input.reducers || [], + isLoadingFuncs: input.isLoadingFuncs || [], + contextInit: [].concat(input.contextInit || []), + eventRefiners: input.eventRefiners || {}, + eventDefMemberAdders: input.eventDefMemberAdders || [], + eventSourceRefiners: input.eventSourceRefiners || {}, + isDraggableTransformers: input.isDraggableTransformers || [], + eventDragMutationMassagers: input.eventDragMutationMassagers || [], + eventDefMutationAppliers: input.eventDefMutationAppliers || [], + dateSelectionTransformers: input.dateSelectionTransformers || [], + datePointTransforms: input.datePointTransforms || [], + dateSpanTransforms: input.dateSpanTransforms || [], + views: input.views || {}, + viewPropsTransformers: input.viewPropsTransformers || [], + isPropsValid: input.isPropsValid || null, + externalDefTransforms: input.externalDefTransforms || [], + viewContainerAppends: input.viewContainerAppends || [], + eventDropTransformers: input.eventDropTransformers || [], + componentInteractions: input.componentInteractions || [], + calendarInteractions: input.calendarInteractions || [], + themeClasses: input.themeClasses || {}, + eventSourceDefs: input.eventSourceDefs || [], + cmdFormatter: input.cmdFormatter, + recurringTypes: input.recurringTypes || [], + namedTimeZonedImpl: input.namedTimeZonedImpl, + initialView: input.initialView || '', + elementDraggingImpl: input.elementDraggingImpl, + optionChangeHandlers: input.optionChangeHandlers || {}, + scrollGridImpl: input.scrollGridImpl || null, + listenerRefiners: input.listenerRefiners || {}, + optionRefiners: input.optionRefiners || {}, + propSetHandlers: input.propSetHandlers || {}, + }; + } + function buildPluginHooks(pluginDefs, globalDefs) { + let currentPluginIds = {}; + let hooks = { + premiumReleaseDate: undefined, + reducers: [], + isLoadingFuncs: [], + contextInit: [], + eventRefiners: {}, + eventDefMemberAdders: [], + eventSourceRefiners: {}, + isDraggableTransformers: [], + eventDragMutationMassagers: [], + eventDefMutationAppliers: [], + dateSelectionTransformers: [], + datePointTransforms: [], + dateSpanTransforms: [], + views: {}, + viewPropsTransformers: [], + isPropsValid: null, + externalDefTransforms: [], + viewContainerAppends: [], + eventDropTransformers: [], + componentInteractions: [], + calendarInteractions: [], + themeClasses: {}, + eventSourceDefs: [], + cmdFormatter: null, + recurringTypes: [], + namedTimeZonedImpl: null, + initialView: '', + elementDraggingImpl: null, + optionChangeHandlers: {}, + scrollGridImpl: null, + listenerRefiners: {}, + optionRefiners: {}, + propSetHandlers: {}, + }; + function addDefs(defs) { + for (let def of defs) { + const pluginName = def.name; + const currentId = currentPluginIds[pluginName]; + if (currentId === undefined) { + currentPluginIds[pluginName] = def.id; + addDefs(def.deps); + hooks = combineHooks(hooks, def); + } + else if (currentId !== def.id) { + // different ID than the one already added + console.warn(`Duplicate plugin '${pluginName}'`); + } + } + } + if (pluginDefs) { + addDefs(pluginDefs); + } + addDefs(globalDefs); + return hooks; + } + function buildBuildPluginHooks() { + let currentOverrideDefs = []; + let currentGlobalDefs = []; + let currentHooks; + return (overrideDefs, globalDefs) => { + if (!currentHooks || !isArraysEqual(overrideDefs, currentOverrideDefs) || !isArraysEqual(globalDefs, currentGlobalDefs)) { + currentHooks = buildPluginHooks(overrideDefs, globalDefs); + } + currentOverrideDefs = overrideDefs; + currentGlobalDefs = globalDefs; + return currentHooks; + }; + } + function combineHooks(hooks0, hooks1) { + return { + premiumReleaseDate: compareOptionalDates(hooks0.premiumReleaseDate, hooks1.premiumReleaseDate), + reducers: hooks0.reducers.concat(hooks1.reducers), + isLoadingFuncs: hooks0.isLoadingFuncs.concat(hooks1.isLoadingFuncs), + contextInit: hooks0.contextInit.concat(hooks1.contextInit), + eventRefiners: Object.assign(Object.assign({}, hooks0.eventRefiners), hooks1.eventRefiners), + eventDefMemberAdders: hooks0.eventDefMemberAdders.concat(hooks1.eventDefMemberAdders), + eventSourceRefiners: Object.assign(Object.assign({}, hooks0.eventSourceRefiners), hooks1.eventSourceRefiners), + isDraggableTransformers: hooks0.isDraggableTransformers.concat(hooks1.isDraggableTransformers), + eventDragMutationMassagers: hooks0.eventDragMutationMassagers.concat(hooks1.eventDragMutationMassagers), + eventDefMutationAppliers: hooks0.eventDefMutationAppliers.concat(hooks1.eventDefMutationAppliers), + dateSelectionTransformers: hooks0.dateSelectionTransformers.concat(hooks1.dateSelectionTransformers), + datePointTransforms: hooks0.datePointTransforms.concat(hooks1.datePointTransforms), + dateSpanTransforms: hooks0.dateSpanTransforms.concat(hooks1.dateSpanTransforms), + views: Object.assign(Object.assign({}, hooks0.views), hooks1.views), + viewPropsTransformers: hooks0.viewPropsTransformers.concat(hooks1.viewPropsTransformers), + isPropsValid: hooks1.isPropsValid || hooks0.isPropsValid, + externalDefTransforms: hooks0.externalDefTransforms.concat(hooks1.externalDefTransforms), + viewContainerAppends: hooks0.viewContainerAppends.concat(hooks1.viewContainerAppends), + eventDropTransformers: hooks0.eventDropTransformers.concat(hooks1.eventDropTransformers), + calendarInteractions: hooks0.calendarInteractions.concat(hooks1.calendarInteractions), + componentInteractions: hooks0.componentInteractions.concat(hooks1.componentInteractions), + themeClasses: Object.assign(Object.assign({}, hooks0.themeClasses), hooks1.themeClasses), + eventSourceDefs: hooks0.eventSourceDefs.concat(hooks1.eventSourceDefs), + cmdFormatter: hooks1.cmdFormatter || hooks0.cmdFormatter, + recurringTypes: hooks0.recurringTypes.concat(hooks1.recurringTypes), + namedTimeZonedImpl: hooks1.namedTimeZonedImpl || hooks0.namedTimeZonedImpl, + initialView: hooks0.initialView || hooks1.initialView, + elementDraggingImpl: hooks0.elementDraggingImpl || hooks1.elementDraggingImpl, + optionChangeHandlers: Object.assign(Object.assign({}, hooks0.optionChangeHandlers), hooks1.optionChangeHandlers), + scrollGridImpl: hooks1.scrollGridImpl || hooks0.scrollGridImpl, + listenerRefiners: Object.assign(Object.assign({}, hooks0.listenerRefiners), hooks1.listenerRefiners), + optionRefiners: Object.assign(Object.assign({}, hooks0.optionRefiners), hooks1.optionRefiners), + propSetHandlers: Object.assign(Object.assign({}, hooks0.propSetHandlers), hooks1.propSetHandlers), + }; + } + function compareOptionalDates(date0, date1) { + if (date0 === undefined) { + return date1; + } + if (date1 === undefined) { + return date0; + } + return new Date(Math.max(date0.valueOf(), date1.valueOf())); + } + + class StandardTheme extends Theme { + } + StandardTheme.prototype.classes = { + root: 'fc-theme-standard', + tableCellShaded: 'fc-cell-shaded', + buttonGroup: 'fc-button-group', + button: 'fc-button fc-button-primary', + buttonActive: 'fc-button-active', + }; + StandardTheme.prototype.baseIconClass = 'fc-icon'; + StandardTheme.prototype.iconClasses = { + close: 'fc-icon-x', + prev: 'fc-icon-chevron-left', + next: 'fc-icon-chevron-right', + prevYear: 'fc-icon-chevrons-left', + nextYear: 'fc-icon-chevrons-right', + }; + StandardTheme.prototype.rtlIconClasses = { + prev: 'fc-icon-chevron-right', + next: 'fc-icon-chevron-left', + prevYear: 'fc-icon-chevrons-right', + nextYear: 'fc-icon-chevrons-left', + }; + StandardTheme.prototype.iconOverrideOption = 'buttonIcons'; // TODO: make TS-friendly + StandardTheme.prototype.iconOverrideCustomButtonOption = 'icon'; + StandardTheme.prototype.iconOverridePrefix = 'fc-icon-'; + + function compileViewDefs(defaultConfigs, overrideConfigs) { + let hash = {}; + let viewType; + for (viewType in defaultConfigs) { + ensureViewDef(viewType, hash, defaultConfigs, overrideConfigs); + } + for (viewType in overrideConfigs) { + ensureViewDef(viewType, hash, defaultConfigs, overrideConfigs); + } + return hash; + } + function ensureViewDef(viewType, hash, defaultConfigs, overrideConfigs) { + if (hash[viewType]) { + return hash[viewType]; + } + let viewDef = buildViewDef(viewType, hash, defaultConfigs, overrideConfigs); + if (viewDef) { + hash[viewType] = viewDef; + } + return viewDef; + } + function buildViewDef(viewType, hash, defaultConfigs, overrideConfigs) { + let defaultConfig = defaultConfigs[viewType]; + let overrideConfig = overrideConfigs[viewType]; + let queryProp = (name) => ((defaultConfig && defaultConfig[name] !== null) ? defaultConfig[name] : + ((overrideConfig && overrideConfig[name] !== null) ? overrideConfig[name] : null)); + let theComponent = queryProp('component'); + let superType = queryProp('superType'); + let superDef = null; + if (superType) { + if (superType === viewType) { + throw new Error('Can\'t have a custom view type that references itself'); + } + superDef = ensureViewDef(superType, hash, defaultConfigs, overrideConfigs); + } + if (!theComponent && superDef) { + theComponent = superDef.component; + } + if (!theComponent) { + return null; // don't throw a warning, might be settings for a single-unit view + } + return { + type: viewType, + component: theComponent, + defaults: Object.assign(Object.assign({}, (superDef ? superDef.defaults : {})), (defaultConfig ? defaultConfig.rawOptions : {})), + overrides: Object.assign(Object.assign({}, (superDef ? superDef.overrides : {})), (overrideConfig ? overrideConfig.rawOptions : {})), + }; + } + + function parseViewConfigs(inputs) { + return mapHash(inputs, parseViewConfig); + } + function parseViewConfig(input) { + let rawOptions = typeof input === 'function' ? + { component: input } : + input; + let { component } = rawOptions; + if (rawOptions.content) { + component = createViewHookComponent(rawOptions); + // TODO: remove content/classNames/didMount/etc from options? + } + return { + superType: rawOptions.type, + component: component, + rawOptions, // includes type and component too :( + }; + } + function createViewHookComponent(options) { + return (viewProps) => (h(ViewContextType.Consumer, null, (context) => (h(ContentContainer, { elTag: "div", elClasses: buildViewClassNames(context.viewSpec), renderProps: Object.assign(Object.assign({}, viewProps), { nextDayThreshold: context.options.nextDayThreshold }), generatorName: undefined, generator: options.content, classNameGenerator: options.classNames, didMount: options.didMount, willUnmount: options.willUnmount })))); + } + + function buildViewSpecs(defaultInputs, optionOverrides, dynamicOptionOverrides, localeDefaults) { + let defaultConfigs = parseViewConfigs(defaultInputs); + let overrideConfigs = parseViewConfigs(optionOverrides.views); + let viewDefs = compileViewDefs(defaultConfigs, overrideConfigs); + return mapHash(viewDefs, (viewDef) => buildViewSpec(viewDef, overrideConfigs, optionOverrides, dynamicOptionOverrides, localeDefaults)); + } + function buildViewSpec(viewDef, overrideConfigs, optionOverrides, dynamicOptionOverrides, localeDefaults) { + let durationInput = viewDef.overrides.duration || + viewDef.defaults.duration || + dynamicOptionOverrides.duration || + optionOverrides.duration; + let duration = null; + let durationUnit = ''; + let singleUnit = ''; + let singleUnitOverrides = {}; + if (durationInput) { + duration = createDurationCached(durationInput); + if (duration) { // valid? + let denom = greatestDurationDenominator(duration); + durationUnit = denom.unit; + if (denom.value === 1) { + singleUnit = durationUnit; + singleUnitOverrides = overrideConfigs[durationUnit] ? overrideConfigs[durationUnit].rawOptions : {}; + } + } + } + let queryButtonText = (optionsSubset) => { + let buttonTextMap = optionsSubset.buttonText || {}; + let buttonTextKey = viewDef.defaults.buttonTextKey; + if (buttonTextKey != null && buttonTextMap[buttonTextKey] != null) { + return buttonTextMap[buttonTextKey]; + } + if (buttonTextMap[viewDef.type] != null) { + return buttonTextMap[viewDef.type]; + } + if (buttonTextMap[singleUnit] != null) { + return buttonTextMap[singleUnit]; + } + return null; + }; + let queryButtonTitle = (optionsSubset) => { + let buttonHints = optionsSubset.buttonHints || {}; + let buttonKey = viewDef.defaults.buttonTextKey; // use same key as text + if (buttonKey != null && buttonHints[buttonKey] != null) { + return buttonHints[buttonKey]; + } + if (buttonHints[viewDef.type] != null) { + return buttonHints[viewDef.type]; + } + if (buttonHints[singleUnit] != null) { + return buttonHints[singleUnit]; + } + return null; + }; + return { + type: viewDef.type, + component: viewDef.component, + duration, + durationUnit, + singleUnit, + optionDefaults: viewDef.defaults, + optionOverrides: Object.assign(Object.assign({}, singleUnitOverrides), viewDef.overrides), + buttonTextOverride: queryButtonText(dynamicOptionOverrides) || + queryButtonText(optionOverrides) || // constructor-specified buttonText lookup hash takes precedence + viewDef.overrides.buttonText, + buttonTextDefault: queryButtonText(localeDefaults) || + viewDef.defaults.buttonText || + queryButtonText(BASE_OPTION_DEFAULTS) || + viewDef.type, + // not DRY + buttonTitleOverride: queryButtonTitle(dynamicOptionOverrides) || + queryButtonTitle(optionOverrides) || + viewDef.overrides.buttonHint, + buttonTitleDefault: queryButtonTitle(localeDefaults) || + viewDef.defaults.buttonHint || + queryButtonTitle(BASE_OPTION_DEFAULTS), + // will eventually fall back to buttonText + }; + } + // hack to get memoization working + let durationInputMap = {}; + function createDurationCached(durationInput) { + let json = JSON.stringify(durationInput); + let res = durationInputMap[json]; + if (res === undefined) { + res = createDuration(durationInput); + durationInputMap[json] = res; + } + return res; + } + + function reduceViewType(viewType, action) { + switch (action.type) { + case 'CHANGE_VIEW_TYPE': + viewType = action.viewType; + } + return viewType; + } + + function reduceDynamicOptionOverrides(dynamicOptionOverrides, action) { + switch (action.type) { + case 'SET_OPTION': + return Object.assign(Object.assign({}, dynamicOptionOverrides), { [action.optionName]: action.rawOptionValue }); + default: + return dynamicOptionOverrides; + } + } + + function reduceDateProfile(currentDateProfile, action, currentDate, dateProfileGenerator) { + let dp; + switch (action.type) { + case 'CHANGE_VIEW_TYPE': + return dateProfileGenerator.build(action.dateMarker || currentDate); + case 'CHANGE_DATE': + return dateProfileGenerator.build(action.dateMarker); + case 'PREV': + dp = dateProfileGenerator.buildPrev(currentDateProfile, currentDate); + if (dp.isValid) { + return dp; + } + break; + case 'NEXT': + dp = dateProfileGenerator.buildNext(currentDateProfile, currentDate); + if (dp.isValid) { + return dp; + } + break; + } + return currentDateProfile; + } + + function initEventSources(calendarOptions, dateProfile, context) { + let activeRange = dateProfile ? dateProfile.activeRange : null; + return addSources({}, parseInitialSources(calendarOptions, context), activeRange, context); + } + function reduceEventSources(eventSources, action, dateProfile, context) { + let activeRange = dateProfile ? dateProfile.activeRange : null; // need this check? + switch (action.type) { + case 'ADD_EVENT_SOURCES': // already parsed + return addSources(eventSources, action.sources, activeRange, context); + case 'REMOVE_EVENT_SOURCE': + return removeSource(eventSources, action.sourceId); + case 'PREV': // TODO: how do we track all actions that affect dateProfile :( + case 'NEXT': + case 'CHANGE_DATE': + case 'CHANGE_VIEW_TYPE': + if (dateProfile) { + return fetchDirtySources(eventSources, activeRange, context); + } + return eventSources; + case 'FETCH_EVENT_SOURCES': + return fetchSourcesByIds(eventSources, action.sourceIds ? // why no type? + arrayToHash(action.sourceIds) : + excludeStaticSources(eventSources, context), activeRange, action.isRefetch || false, context); + case 'RECEIVE_EVENTS': + case 'RECEIVE_EVENT_ERROR': + return receiveResponse$1(eventSources, action.sourceId, action.fetchId, action.fetchRange); + case 'REMOVE_ALL_EVENT_SOURCES': + return {}; + default: + return eventSources; + } + } + function reduceEventSourcesNewTimeZone(eventSources, dateProfile, context) { + let activeRange = dateProfile ? dateProfile.activeRange : null; // need this check? + return fetchSourcesByIds(eventSources, excludeStaticSources(eventSources, context), activeRange, true, context); + } + function computeEventSourcesLoading(eventSources) { + for (let sourceId in eventSources) { + if (eventSources[sourceId].isFetching) { + return true; + } + } + return false; + } + function addSources(eventSourceHash, sources, fetchRange, context) { + let hash = {}; + for (let source of sources) { + hash[source.sourceId] = source; + } + if (fetchRange) { + hash = fetchDirtySources(hash, fetchRange, context); + } + return Object.assign(Object.assign({}, eventSourceHash), hash); + } + function removeSource(eventSourceHash, sourceId) { + return filterHash(eventSourceHash, (eventSource) => eventSource.sourceId !== sourceId); + } + function fetchDirtySources(sourceHash, fetchRange, context) { + return fetchSourcesByIds(sourceHash, filterHash(sourceHash, (eventSource) => isSourceDirty(eventSource, fetchRange, context)), fetchRange, false, context); + } + function isSourceDirty(eventSource, fetchRange, context) { + if (!doesSourceNeedRange(eventSource, context)) { + return !eventSource.latestFetchId; + } + return !context.options.lazyFetching || + !eventSource.fetchRange || + eventSource.isFetching || // always cancel outdated in-progress fetches + fetchRange.start < eventSource.fetchRange.start || + fetchRange.end > eventSource.fetchRange.end; + } + function fetchSourcesByIds(prevSources, sourceIdHash, fetchRange, isRefetch, context) { + let nextSources = {}; + for (let sourceId in prevSources) { + let source = prevSources[sourceId]; + if (sourceIdHash[sourceId]) { + nextSources[sourceId] = fetchSource$1(source, fetchRange, isRefetch, context); + } + else { + nextSources[sourceId] = source; + } + } + return nextSources; + } + function fetchSource$1(eventSource, fetchRange, isRefetch, context) { + let { options, calendarApi } = context; + let sourceDef = context.pluginHooks.eventSourceDefs[eventSource.sourceDefId]; + let fetchId = guid(); + sourceDef.fetch({ + eventSource, + range: fetchRange, + isRefetch, + context, + }, (res) => { + let { rawEvents } = res; + if (options.eventSourceSuccess) { + rawEvents = options.eventSourceSuccess.call(calendarApi, rawEvents, res.response) || rawEvents; + } + if (eventSource.success) { + rawEvents = eventSource.success.call(calendarApi, rawEvents, res.response) || rawEvents; + } + context.dispatch({ + type: 'RECEIVE_EVENTS', + sourceId: eventSource.sourceId, + fetchId, + fetchRange, + rawEvents, + }); + }, (error) => { + let errorHandled = false; + if (options.eventSourceFailure) { + options.eventSourceFailure.call(calendarApi, error); + errorHandled = true; + } + if (eventSource.failure) { + eventSource.failure(error); + errorHandled = true; + } + if (!errorHandled) { + console.warn(error.message, error); + } + context.dispatch({ + type: 'RECEIVE_EVENT_ERROR', + sourceId: eventSource.sourceId, + fetchId, + fetchRange, + error, + }); + }); + return Object.assign(Object.assign({}, eventSource), { isFetching: true, latestFetchId: fetchId }); + } + function receiveResponse$1(sourceHash, sourceId, fetchId, fetchRange) { + let eventSource = sourceHash[sourceId]; + if (eventSource && // not already removed + fetchId === eventSource.latestFetchId) { + return Object.assign(Object.assign({}, sourceHash), { [sourceId]: Object.assign(Object.assign({}, eventSource), { isFetching: false, fetchRange }) }); + } + return sourceHash; + } + function excludeStaticSources(eventSources, context) { + return filterHash(eventSources, (eventSource) => doesSourceNeedRange(eventSource, context)); + } + function parseInitialSources(rawOptions, context) { + let refiners = buildEventSourceRefiners(context); + let rawSources = [].concat(rawOptions.eventSources || []); + let sources = []; // parsed + if (rawOptions.initialEvents) { + rawSources.unshift(rawOptions.initialEvents); + } + if (rawOptions.events) { + rawSources.unshift(rawOptions.events); + } + for (let rawSource of rawSources) { + let source = parseEventSource(rawSource, context, refiners); + if (source) { + sources.push(source); + } + } + return sources; + } + function doesSourceNeedRange(eventSource, context) { + let defs = context.pluginHooks.eventSourceDefs; + return !defs[eventSource.sourceDefId].ignoreRange; + } + + function reduceDateSelection(currentSelection, action) { + switch (action.type) { + case 'UNSELECT_DATES': + return null; + case 'SELECT_DATES': + return action.selection; + default: + return currentSelection; + } + } + + function reduceSelectedEvent(currentInstanceId, action) { + switch (action.type) { + case 'UNSELECT_EVENT': + return ''; + case 'SELECT_EVENT': + return action.eventInstanceId; + default: + return currentInstanceId; + } + } + + function reduceEventDrag(currentDrag, action) { + let newDrag; + switch (action.type) { + case 'UNSET_EVENT_DRAG': + return null; + case 'SET_EVENT_DRAG': + newDrag = action.state; + return { + affectedEvents: newDrag.affectedEvents, + mutatedEvents: newDrag.mutatedEvents, + isEvent: newDrag.isEvent, + }; + default: + return currentDrag; + } + } + + function reduceEventResize(currentResize, action) { + let newResize; + switch (action.type) { + case 'UNSET_EVENT_RESIZE': + return null; + case 'SET_EVENT_RESIZE': + newResize = action.state; + return { + affectedEvents: newResize.affectedEvents, + mutatedEvents: newResize.mutatedEvents, + isEvent: newResize.isEvent, + }; + default: + return currentResize; + } + } + + function parseToolbars(calendarOptions, calendarOptionOverrides, theme, viewSpecs, calendarApi) { + let header = calendarOptions.headerToolbar ? parseToolbar(calendarOptions.headerToolbar, calendarOptions, calendarOptionOverrides, theme, viewSpecs, calendarApi) : null; + let footer = calendarOptions.footerToolbar ? parseToolbar(calendarOptions.footerToolbar, calendarOptions, calendarOptionOverrides, theme, viewSpecs, calendarApi) : null; + return { header, footer }; + } + function parseToolbar(sectionStrHash, calendarOptions, calendarOptionOverrides, theme, viewSpecs, calendarApi) { + let sectionWidgets = {}; + let viewsWithButtons = []; + let hasTitle = false; + for (let sectionName in sectionStrHash) { + let sectionStr = sectionStrHash[sectionName]; + let sectionRes = parseSection(sectionStr, calendarOptions, calendarOptionOverrides, theme, viewSpecs, calendarApi); + sectionWidgets[sectionName] = sectionRes.widgets; + viewsWithButtons.push(...sectionRes.viewsWithButtons); + hasTitle = hasTitle || sectionRes.hasTitle; + } + return { sectionWidgets, viewsWithButtons, hasTitle }; + } + /* + BAD: querying icons and text here. should be done at render time + */ + function parseSection(sectionStr, calendarOptions, // defaults+overrides, then refined + calendarOptionOverrides, // overrides only!, unrefined :( + theme, viewSpecs, calendarApi) { + let isRtl = calendarOptions.direction === 'rtl'; + let calendarCustomButtons = calendarOptions.customButtons || {}; + let calendarButtonTextOverrides = calendarOptionOverrides.buttonText || {}; + let calendarButtonText = calendarOptions.buttonText || {}; + let calendarButtonHintOverrides = calendarOptionOverrides.buttonHints || {}; + let calendarButtonHints = calendarOptions.buttonHints || {}; + let sectionSubstrs = sectionStr ? sectionStr.split(' ') : []; + let viewsWithButtons = []; + let hasTitle = false; + let widgets = sectionSubstrs.map((buttonGroupStr) => (buttonGroupStr.split(',').map((buttonName) => { + if (buttonName === 'title') { + hasTitle = true; + return { buttonName }; + } + let customButtonProps; + let viewSpec; + let buttonClick; + let buttonIcon; // only one of these will be set + let buttonText; // " + let buttonHint; + // ^ for the title="" attribute, for accessibility + if ((customButtonProps = calendarCustomButtons[buttonName])) { + buttonClick = (ev) => { + if (customButtonProps.click) { + customButtonProps.click.call(ev.target, ev, ev.target); // TODO: use Calendar this context? + } + }; + (buttonIcon = theme.getCustomButtonIconClass(customButtonProps)) || + (buttonIcon = theme.getIconClass(buttonName, isRtl)) || + (buttonText = customButtonProps.text); + buttonHint = customButtonProps.hint || customButtonProps.text; + } + else if ((viewSpec = viewSpecs[buttonName])) { + viewsWithButtons.push(buttonName); + buttonClick = () => { + calendarApi.changeView(buttonName); + }; + (buttonText = viewSpec.buttonTextOverride) || + (buttonIcon = theme.getIconClass(buttonName, isRtl)) || + (buttonText = viewSpec.buttonTextDefault); + let textFallback = viewSpec.buttonTextOverride || + viewSpec.buttonTextDefault; + buttonHint = formatWithOrdinals(viewSpec.buttonTitleOverride || + viewSpec.buttonTitleDefault || + calendarOptions.viewHint, [textFallback, buttonName], // view-name = buttonName + textFallback); + } + else if (calendarApi[buttonName]) { // a calendarApi method + buttonClick = () => { + calendarApi[buttonName](); + }; + (buttonText = calendarButtonTextOverrides[buttonName]) || + (buttonIcon = theme.getIconClass(buttonName, isRtl)) || + (buttonText = calendarButtonText[buttonName]); // everything else is considered default + if (buttonName === 'prevYear' || buttonName === 'nextYear') { + let prevOrNext = buttonName === 'prevYear' ? 'prev' : 'next'; + buttonHint = formatWithOrdinals(calendarButtonHintOverrides[prevOrNext] || + calendarButtonHints[prevOrNext], [ + calendarButtonText.year || 'year', + 'year', + ], calendarButtonText[buttonName]); + } + else { + buttonHint = (navUnit) => formatWithOrdinals(calendarButtonHintOverrides[buttonName] || + calendarButtonHints[buttonName], [ + calendarButtonText[navUnit] || navUnit, + navUnit, + ], calendarButtonText[buttonName]); + } + } + return { buttonName, buttonClick, buttonIcon, buttonText, buttonHint }; + }))); + return { widgets, viewsWithButtons, hasTitle }; + } + + // always represents the current view. otherwise, it'd need to change value every time date changes + class ViewImpl { + constructor(type, getCurrentData, dateEnv) { + this.type = type; + this.getCurrentData = getCurrentData; + this.dateEnv = dateEnv; + } + get calendar() { + return this.getCurrentData().calendarApi; + } + get title() { + return this.getCurrentData().viewTitle; + } + get activeStart() { + return this.dateEnv.toDate(this.getCurrentData().dateProfile.activeRange.start); + } + get activeEnd() { + return this.dateEnv.toDate(this.getCurrentData().dateProfile.activeRange.end); + } + get currentStart() { + return this.dateEnv.toDate(this.getCurrentData().dateProfile.currentRange.start); + } + get currentEnd() { + return this.dateEnv.toDate(this.getCurrentData().dateProfile.currentRange.end); + } + getOption(name) { + return this.getCurrentData().options[name]; // are the view-specific options + } + } + + let eventSourceDef$2 = { + ignoreRange: true, + parseMeta(refined) { + if (Array.isArray(refined.events)) { + return refined.events; + } + return null; + }, + fetch(arg, successCallback) { + successCallback({ + rawEvents: arg.eventSource.meta, + }); + }, + }; + const arrayEventSourcePlugin = createPlugin({ + name: 'array-event-source', + eventSourceDefs: [eventSourceDef$2], + }); + + let eventSourceDef$1 = { + parseMeta(refined) { + if (typeof refined.events === 'function') { + return refined.events; + } + return null; + }, + fetch(arg, successCallback, errorCallback) { + const { dateEnv } = arg.context; + const func = arg.eventSource.meta; + unpromisify(func.bind(null, buildRangeApiWithTimeZone(arg.range, dateEnv)), (rawEvents) => successCallback({ rawEvents }), errorCallback); + }, + }; + const funcEventSourcePlugin = createPlugin({ + name: 'func-event-source', + eventSourceDefs: [eventSourceDef$1], + }); + + const JSON_FEED_EVENT_SOURCE_REFINERS = { + method: String, + extraParams: identity, + startParam: String, + endParam: String, + timeZoneParam: String, + }; + + let eventSourceDef = { + parseMeta(refined) { + if (refined.url && (refined.format === 'json' || !refined.format)) { + return { + url: refined.url, + format: 'json', + method: (refined.method || 'GET').toUpperCase(), + extraParams: refined.extraParams, + startParam: refined.startParam, + endParam: refined.endParam, + timeZoneParam: refined.timeZoneParam, + }; + } + return null; + }, + fetch(arg, successCallback, errorCallback) { + const { meta } = arg.eventSource; + const requestParams = buildRequestParams$1(meta, arg.range, arg.context); + requestJson(meta.method, meta.url, requestParams).then(([rawEvents, response]) => { + successCallback({ rawEvents, response }); + }, errorCallback); + }, + }; + const jsonFeedEventSourcePlugin = createPlugin({ + name: 'json-event-source', + eventSourceRefiners: JSON_FEED_EVENT_SOURCE_REFINERS, + eventSourceDefs: [eventSourceDef], + }); + function buildRequestParams$1(meta, range, context) { + let { dateEnv, options } = context; + let startParam; + let endParam; + let timeZoneParam; + let customRequestParams; + let params = {}; + startParam = meta.startParam; + if (startParam == null) { + startParam = options.startParam; + } + endParam = meta.endParam; + if (endParam == null) { + endParam = options.endParam; + } + timeZoneParam = meta.timeZoneParam; + if (timeZoneParam == null) { + timeZoneParam = options.timeZoneParam; + } + // retrieve any outbound GET/POST data from the options + if (typeof meta.extraParams === 'function') { + // supplied as a function that returns a key/value object + customRequestParams = meta.extraParams(); + } + else { + // probably supplied as a straight key/value object + customRequestParams = meta.extraParams || {}; + } + Object.assign(params, customRequestParams); + params[startParam] = dateEnv.formatIso(range.start); + params[endParam] = dateEnv.formatIso(range.end); + if (dateEnv.timeZone !== 'local') { + params[timeZoneParam] = dateEnv.timeZone; + } + return params; + } + + const SIMPLE_RECURRING_REFINERS = { + daysOfWeek: identity, + startTime: createDuration, + endTime: createDuration, + duration: createDuration, + startRecur: identity, + endRecur: identity, + }; + + let recurring = { + parse(refined, dateEnv) { + if (refined.daysOfWeek || refined.startTime || refined.endTime || refined.startRecur || refined.endRecur) { + let recurringData = { + daysOfWeek: refined.daysOfWeek || null, + startTime: refined.startTime || null, + endTime: refined.endTime || null, + startRecur: refined.startRecur ? dateEnv.createMarker(refined.startRecur) : null, + endRecur: refined.endRecur ? dateEnv.createMarker(refined.endRecur) : null, + }; + let duration; + if (refined.duration) { + duration = refined.duration; + } + if (!duration && refined.startTime && refined.endTime) { + duration = subtractDurations(refined.endTime, refined.startTime); + } + return { + allDayGuess: Boolean(!refined.startTime && !refined.endTime), + duration, + typeData: recurringData, // doesn't need endTime anymore but oh well + }; + } + return null; + }, + expand(typeData, framingRange, dateEnv) { + let clippedFramingRange = intersectRanges(framingRange, { start: typeData.startRecur, end: typeData.endRecur }); + if (clippedFramingRange) { + return expandRanges(typeData.daysOfWeek, typeData.startTime, clippedFramingRange, dateEnv); + } + return []; + }, + }; + const simpleRecurringEventsPlugin = createPlugin({ + name: 'simple-recurring-event', + recurringTypes: [recurring], + eventRefiners: SIMPLE_RECURRING_REFINERS, + }); + function expandRanges(daysOfWeek, startTime, framingRange, dateEnv) { + let dowHash = daysOfWeek ? arrayToHash(daysOfWeek) : null; + let dayMarker = startOfDay(framingRange.start); + let endMarker = framingRange.end; + let instanceStarts = []; + while (dayMarker < endMarker) { + let instanceStart; + // if everyday, or this particular day-of-week + if (!dowHash || dowHash[dayMarker.getUTCDay()]) { + if (startTime) { + instanceStart = dateEnv.add(dayMarker, startTime); + } + else { + instanceStart = dayMarker; + } + instanceStarts.push(instanceStart); + } + dayMarker = addDays(dayMarker, 1); + } + return instanceStarts; + } + + const changeHandlerPlugin = createPlugin({ + name: 'change-handler', + optionChangeHandlers: { + events(events, context) { + handleEventSources([events], context); + }, + eventSources: handleEventSources, + }, + }); + /* + BUG: if `event` was supplied, all previously-given `eventSources` will be wiped out + */ + function handleEventSources(inputs, context) { + let unfoundSources = hashValuesToArray(context.getCurrentData().eventSources); + let newInputs = []; + for (let input of inputs) { + let inputFound = false; + for (let i = 0; i < unfoundSources.length; i += 1) { + if (unfoundSources[i]._raw === input) { + unfoundSources.splice(i, 1); // delete + inputFound = true; + break; + } + } + if (!inputFound) { + newInputs.push(input); + } + } + for (let unfoundSource of unfoundSources) { + context.dispatch({ + type: 'REMOVE_EVENT_SOURCE', + sourceId: unfoundSource.sourceId, + }); + } + for (let newInput of newInputs) { + context.calendarApi.addEventSource(newInput); + } + } + + function handleDateProfile(dateProfile, context) { + context.emitter.trigger('datesSet', Object.assign(Object.assign({}, buildRangeApiWithTimeZone(dateProfile.activeRange, context.dateEnv)), { view: context.viewApi })); + } + + function handleEventStore(eventStore, context) { + let { emitter } = context; + if (emitter.hasHandlers('eventsSet')) { + emitter.trigger('eventsSet', buildEventApis(eventStore, context)); + } + } + + /* + this array is exposed on the root namespace so that UMD plugins can add to it. + see the rollup-bundles script. + */ + const globalPlugins = [ + arrayEventSourcePlugin, + funcEventSourcePlugin, + jsonFeedEventSourcePlugin, + simpleRecurringEventsPlugin, + changeHandlerPlugin, + createPlugin({ + name: 'misc', + isLoadingFuncs: [ + (state) => computeEventSourcesLoading(state.eventSources), + ], + propSetHandlers: { + dateProfile: handleDateProfile, + eventStore: handleEventStore, + }, + }), + ]; + + class TaskRunner { + constructor(runTaskOption, drainedOption) { + this.runTaskOption = runTaskOption; + this.drainedOption = drainedOption; + this.queue = []; + this.delayedRunner = new DelayedRunner(this.drain.bind(this)); + } + request(task, delay) { + this.queue.push(task); + this.delayedRunner.request(delay); + } + pause(scope) { + this.delayedRunner.pause(scope); + } + resume(scope, force) { + this.delayedRunner.resume(scope, force); + } + drain() { + let { queue } = this; + while (queue.length) { + let completedTasks = []; + let task; + while ((task = queue.shift())) { + this.runTask(task); + completedTasks.push(task); + } + this.drained(completedTasks); + } // keep going, in case new tasks were added in the drained handler + } + runTask(task) { + if (this.runTaskOption) { + this.runTaskOption(task); + } + } + drained(completedTasks) { + if (this.drainedOption) { + this.drainedOption(completedTasks); + } + } + } + + // Computes what the title at the top of the calendarApi should be for this view + function buildTitle(dateProfile, viewOptions, dateEnv) { + let range; + // for views that span a large unit of time, show the proper interval, ignoring stray days before and after + if (/^(year|month)$/.test(dateProfile.currentRangeUnit)) { + range = dateProfile.currentRange; + } + else { // for day units or smaller, use the actual day range + range = dateProfile.activeRange; + } + return dateEnv.formatRange(range.start, range.end, createFormatter(viewOptions.titleFormat || buildTitleFormat(dateProfile)), { + isEndExclusive: dateProfile.isRangeAllDay, + defaultSeparator: viewOptions.titleRangeSeparator, + }); + } + // Generates the format string that should be used to generate the title for the current date range. + // Attempts to compute the most appropriate format if not explicitly specified with `titleFormat`. + function buildTitleFormat(dateProfile) { + let { currentRangeUnit } = dateProfile; + if (currentRangeUnit === 'year') { + return { year: 'numeric' }; + } + if (currentRangeUnit === 'month') { + return { year: 'numeric', month: 'long' }; // like "September 2014" + } + let days = diffWholeDays(dateProfile.currentRange.start, dateProfile.currentRange.end); + if (days !== null && days > 1) { + // multi-day range. shorter, like "Sep 9 - 10 2014" + return { year: 'numeric', month: 'short', day: 'numeric' }; + } + // one day. longer, like "September 9 2014" + return { year: 'numeric', month: 'long', day: 'numeric' }; + } + + // in future refactor, do the redux-style function(state=initial) for initial-state + // also, whatever is happening in constructor, have it happen in action queue too + class CalendarDataManager { + constructor(props) { + this.computeOptionsData = memoize(this._computeOptionsData); + this.computeCurrentViewData = memoize(this._computeCurrentViewData); + this.organizeRawLocales = memoize(organizeRawLocales); + this.buildLocale = memoize(buildLocale); + this.buildPluginHooks = buildBuildPluginHooks(); + this.buildDateEnv = memoize(buildDateEnv$1); + this.buildTheme = memoize(buildTheme); + this.parseToolbars = memoize(parseToolbars); + this.buildViewSpecs = memoize(buildViewSpecs); + this.buildDateProfileGenerator = memoizeObjArg(buildDateProfileGenerator); + this.buildViewApi = memoize(buildViewApi); + this.buildViewUiProps = memoizeObjArg(buildViewUiProps); + this.buildEventUiBySource = memoize(buildEventUiBySource, isPropsEqual); + this.buildEventUiBases = memoize(buildEventUiBases); + this.parseContextBusinessHours = memoizeObjArg(parseContextBusinessHours); + this.buildTitle = memoize(buildTitle); + this.emitter = new Emitter(); + this.actionRunner = new TaskRunner(this._handleAction.bind(this), this.updateData.bind(this)); + this.currentCalendarOptionsInput = {}; + this.currentCalendarOptionsRefined = {}; + this.currentViewOptionsInput = {}; + this.currentViewOptionsRefined = {}; + this.currentCalendarOptionsRefiners = {}; + this.getCurrentData = () => this.data; + this.dispatch = (action) => { + this.actionRunner.request(action); // protects against recursive calls to _handleAction + }; + this.props = props; + this.actionRunner.pause(); + let dynamicOptionOverrides = {}; + let optionsData = this.computeOptionsData(props.optionOverrides, dynamicOptionOverrides, props.calendarApi); + let currentViewType = optionsData.calendarOptions.initialView || optionsData.pluginHooks.initialView; + let currentViewData = this.computeCurrentViewData(currentViewType, optionsData, props.optionOverrides, dynamicOptionOverrides); + // wire things up + // TODO: not DRY + props.calendarApi.currentDataManager = this; + this.emitter.setThisContext(props.calendarApi); + this.emitter.setOptions(currentViewData.options); + let currentDate = getInitialDate(optionsData.calendarOptions, optionsData.dateEnv); + let dateProfile = currentViewData.dateProfileGenerator.build(currentDate); + if (!rangeContainsMarker(dateProfile.activeRange, currentDate)) { + currentDate = dateProfile.currentRange.start; + } + let calendarContext = { + dateEnv: optionsData.dateEnv, + options: optionsData.calendarOptions, + pluginHooks: optionsData.pluginHooks, + calendarApi: props.calendarApi, + dispatch: this.dispatch, + emitter: this.emitter, + getCurrentData: this.getCurrentData, + }; + // needs to be after setThisContext + for (let callback of optionsData.pluginHooks.contextInit) { + callback(calendarContext); + } + // NOT DRY + let eventSources = initEventSources(optionsData.calendarOptions, dateProfile, calendarContext); + let initialState = { + dynamicOptionOverrides, + currentViewType, + currentDate, + dateProfile, + businessHours: this.parseContextBusinessHours(calendarContext), + eventSources, + eventUiBases: {}, + eventStore: createEmptyEventStore(), + renderableEventStore: createEmptyEventStore(), + dateSelection: null, + eventSelection: '', + eventDrag: null, + eventResize: null, + selectionConfig: this.buildViewUiProps(calendarContext).selectionConfig, + }; + let contextAndState = Object.assign(Object.assign({}, calendarContext), initialState); + for (let reducer of optionsData.pluginHooks.reducers) { + Object.assign(initialState, reducer(null, null, contextAndState)); + } + if (computeIsLoading(initialState, calendarContext)) { + this.emitter.trigger('loading', true); // NOT DRY + } + this.state = initialState; + this.updateData(); + this.actionRunner.resume(); + } + resetOptions(optionOverrides, append) { + let { props } = this; + props.optionOverrides = append + ? Object.assign(Object.assign({}, props.optionOverrides), optionOverrides) : optionOverrides; + this.actionRunner.request({ + type: 'NOTHING', + }); + } + _handleAction(action) { + let { props, state, emitter } = this; + let dynamicOptionOverrides = reduceDynamicOptionOverrides(state.dynamicOptionOverrides, action); + let optionsData = this.computeOptionsData(props.optionOverrides, dynamicOptionOverrides, props.calendarApi); + let currentViewType = reduceViewType(state.currentViewType, action); + let currentViewData = this.computeCurrentViewData(currentViewType, optionsData, props.optionOverrides, dynamicOptionOverrides); + // wire things up + // TODO: not DRY + props.calendarApi.currentDataManager = this; + emitter.setThisContext(props.calendarApi); + emitter.setOptions(currentViewData.options); + let calendarContext = { + dateEnv: optionsData.dateEnv, + options: optionsData.calendarOptions, + pluginHooks: optionsData.pluginHooks, + calendarApi: props.calendarApi, + dispatch: this.dispatch, + emitter, + getCurrentData: this.getCurrentData, + }; + let { currentDate, dateProfile } = state; + if (this.data && this.data.dateProfileGenerator !== currentViewData.dateProfileGenerator) { // hack + dateProfile = currentViewData.dateProfileGenerator.build(currentDate); + } + currentDate = reduceCurrentDate(currentDate, action); + dateProfile = reduceDateProfile(dateProfile, action, currentDate, currentViewData.dateProfileGenerator); + if (action.type === 'PREV' || // TODO: move this logic into DateProfileGenerator + action.type === 'NEXT' || // " + !rangeContainsMarker(dateProfile.currentRange, currentDate)) { + currentDate = dateProfile.currentRange.start; + } + let eventSources = reduceEventSources(state.eventSources, action, dateProfile, calendarContext); + let eventStore = reduceEventStore(state.eventStore, action, eventSources, dateProfile, calendarContext); + let isEventsLoading = computeEventSourcesLoading(eventSources); // BAD. also called in this func in computeIsLoading + let renderableEventStore = (isEventsLoading && !currentViewData.options.progressiveEventRendering) ? + (state.renderableEventStore || eventStore) : // try from previous state + eventStore; + let { eventUiSingleBase, selectionConfig } = this.buildViewUiProps(calendarContext); // will memoize obj + let eventUiBySource = this.buildEventUiBySource(eventSources); + let eventUiBases = this.buildEventUiBases(renderableEventStore.defs, eventUiSingleBase, eventUiBySource); + let newState = { + dynamicOptionOverrides, + currentViewType, + currentDate, + dateProfile, + eventSources, + eventStore, + renderableEventStore, + selectionConfig, + eventUiBases, + businessHours: this.parseContextBusinessHours(calendarContext), + dateSelection: reduceDateSelection(state.dateSelection, action), + eventSelection: reduceSelectedEvent(state.eventSelection, action), + eventDrag: reduceEventDrag(state.eventDrag, action), + eventResize: reduceEventResize(state.eventResize, action), + }; + let contextAndState = Object.assign(Object.assign({}, calendarContext), newState); + for (let reducer of optionsData.pluginHooks.reducers) { + Object.assign(newState, reducer(state, action, contextAndState)); // give the OLD state, for old value + } + let wasLoading = computeIsLoading(state, calendarContext); + let isLoading = computeIsLoading(newState, calendarContext); + // TODO: use propSetHandlers in plugin system + if (!wasLoading && isLoading) { + emitter.trigger('loading', true); + } + else if (wasLoading && !isLoading) { + emitter.trigger('loading', false); + } + this.state = newState; + if (props.onAction) { + props.onAction(action); + } + } + updateData() { + let { props, state } = this; + let oldData = this.data; + let optionsData = this.computeOptionsData(props.optionOverrides, state.dynamicOptionOverrides, props.calendarApi); + let currentViewData = this.computeCurrentViewData(state.currentViewType, optionsData, props.optionOverrides, state.dynamicOptionOverrides); + let data = this.data = Object.assign(Object.assign(Object.assign({ viewTitle: this.buildTitle(state.dateProfile, currentViewData.options, optionsData.dateEnv), calendarApi: props.calendarApi, dispatch: this.dispatch, emitter: this.emitter, getCurrentData: this.getCurrentData }, optionsData), currentViewData), state); + let changeHandlers = optionsData.pluginHooks.optionChangeHandlers; + let oldCalendarOptions = oldData && oldData.calendarOptions; + let newCalendarOptions = optionsData.calendarOptions; + if (oldCalendarOptions && oldCalendarOptions !== newCalendarOptions) { + if (oldCalendarOptions.timeZone !== newCalendarOptions.timeZone) { + // hack + state.eventSources = data.eventSources = reduceEventSourcesNewTimeZone(data.eventSources, state.dateProfile, data); + state.eventStore = data.eventStore = rezoneEventStoreDates(data.eventStore, oldData.dateEnv, data.dateEnv); + } + for (let optionName in changeHandlers) { + if (oldCalendarOptions[optionName] !== newCalendarOptions[optionName]) { + changeHandlers[optionName](newCalendarOptions[optionName], data); + } + } + } + if (props.onData) { + props.onData(data); + } + } + _computeOptionsData(optionOverrides, dynamicOptionOverrides, calendarApi) { + // TODO: blacklist options that are handled by optionChangeHandlers + let { refinedOptions, pluginHooks, localeDefaults, availableLocaleData, extra, } = this.processRawCalendarOptions(optionOverrides, dynamicOptionOverrides); + warnUnknownOptions(extra); + let dateEnv = this.buildDateEnv(refinedOptions.timeZone, refinedOptions.locale, refinedOptions.weekNumberCalculation, refinedOptions.firstDay, refinedOptions.weekText, pluginHooks, availableLocaleData, refinedOptions.defaultRangeSeparator); + let viewSpecs = this.buildViewSpecs(pluginHooks.views, optionOverrides, dynamicOptionOverrides, localeDefaults); + let theme = this.buildTheme(refinedOptions, pluginHooks); + let toolbarConfig = this.parseToolbars(refinedOptions, optionOverrides, theme, viewSpecs, calendarApi); + return { + calendarOptions: refinedOptions, + pluginHooks, + dateEnv, + viewSpecs, + theme, + toolbarConfig, + localeDefaults, + availableRawLocales: availableLocaleData.map, + }; + } + // always called from behind a memoizer + processRawCalendarOptions(optionOverrides, dynamicOptionOverrides) { + let { locales, locale } = mergeRawOptions([ + BASE_OPTION_DEFAULTS, + optionOverrides, + dynamicOptionOverrides, + ]); + let availableLocaleData = this.organizeRawLocales(locales); + let availableRawLocales = availableLocaleData.map; + let localeDefaults = this.buildLocale(locale || availableLocaleData.defaultCode, availableRawLocales).options; + let pluginHooks = this.buildPluginHooks(optionOverrides.plugins || [], globalPlugins); + let refiners = this.currentCalendarOptionsRefiners = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, BASE_OPTION_REFINERS), CALENDAR_LISTENER_REFINERS), CALENDAR_OPTION_REFINERS), pluginHooks.listenerRefiners), pluginHooks.optionRefiners); + let extra = {}; + let raw = mergeRawOptions([ + BASE_OPTION_DEFAULTS, + localeDefaults, + optionOverrides, + dynamicOptionOverrides, + ]); + let refined = {}; + let currentRaw = this.currentCalendarOptionsInput; + let currentRefined = this.currentCalendarOptionsRefined; + let anyChanges = false; + for (let optionName in raw) { + if (optionName !== 'plugins') { // because plugins is special-cased + if (raw[optionName] === currentRaw[optionName] || + (COMPLEX_OPTION_COMPARATORS[optionName] && + (optionName in currentRaw) && + COMPLEX_OPTION_COMPARATORS[optionName](currentRaw[optionName], raw[optionName]))) { + refined[optionName] = currentRefined[optionName]; + } + else if (refiners[optionName]) { + refined[optionName] = refiners[optionName](raw[optionName]); + anyChanges = true; + } + else { + extra[optionName] = currentRaw[optionName]; + } + } + } + if (anyChanges) { + this.currentCalendarOptionsInput = raw; + this.currentCalendarOptionsRefined = refined; + } + return { + rawOptions: this.currentCalendarOptionsInput, + refinedOptions: this.currentCalendarOptionsRefined, + pluginHooks, + availableLocaleData, + localeDefaults, + extra, + }; + } + _computeCurrentViewData(viewType, optionsData, optionOverrides, dynamicOptionOverrides) { + let viewSpec = optionsData.viewSpecs[viewType]; + if (!viewSpec) { + throw new Error(`viewType "${viewType}" is not available. Please make sure you've loaded all neccessary plugins`); + } + let { refinedOptions, extra } = this.processRawViewOptions(viewSpec, optionsData.pluginHooks, optionsData.localeDefaults, optionOverrides, dynamicOptionOverrides); + warnUnknownOptions(extra); + let dateProfileGenerator = this.buildDateProfileGenerator({ + dateProfileGeneratorClass: viewSpec.optionDefaults.dateProfileGeneratorClass, + duration: viewSpec.duration, + durationUnit: viewSpec.durationUnit, + usesMinMaxTime: viewSpec.optionDefaults.usesMinMaxTime, + dateEnv: optionsData.dateEnv, + calendarApi: this.props.calendarApi, + slotMinTime: refinedOptions.slotMinTime, + slotMaxTime: refinedOptions.slotMaxTime, + showNonCurrentDates: refinedOptions.showNonCurrentDates, + dayCount: refinedOptions.dayCount, + dateAlignment: refinedOptions.dateAlignment, + dateIncrement: refinedOptions.dateIncrement, + hiddenDays: refinedOptions.hiddenDays, + weekends: refinedOptions.weekends, + nowInput: refinedOptions.now, + validRangeInput: refinedOptions.validRange, + visibleRangeInput: refinedOptions.visibleRange, + monthMode: refinedOptions.monthMode, + fixedWeekCount: refinedOptions.fixedWeekCount, + }); + let viewApi = this.buildViewApi(viewType, this.getCurrentData, optionsData.dateEnv); + return { viewSpec, options: refinedOptions, dateProfileGenerator, viewApi }; + } + processRawViewOptions(viewSpec, pluginHooks, localeDefaults, optionOverrides, dynamicOptionOverrides) { + let raw = mergeRawOptions([ + BASE_OPTION_DEFAULTS, + viewSpec.optionDefaults, + localeDefaults, + optionOverrides, + viewSpec.optionOverrides, + dynamicOptionOverrides, + ]); + let refiners = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, BASE_OPTION_REFINERS), CALENDAR_LISTENER_REFINERS), CALENDAR_OPTION_REFINERS), VIEW_OPTION_REFINERS), pluginHooks.listenerRefiners), pluginHooks.optionRefiners); + let refined = {}; + let currentRaw = this.currentViewOptionsInput; + let currentRefined = this.currentViewOptionsRefined; + let anyChanges = false; + let extra = {}; + for (let optionName in raw) { + if (raw[optionName] === currentRaw[optionName] || + (COMPLEX_OPTION_COMPARATORS[optionName] && + COMPLEX_OPTION_COMPARATORS[optionName](raw[optionName], currentRaw[optionName]))) { + refined[optionName] = currentRefined[optionName]; + } + else { + if (raw[optionName] === this.currentCalendarOptionsInput[optionName] || + (COMPLEX_OPTION_COMPARATORS[optionName] && + COMPLEX_OPTION_COMPARATORS[optionName](raw[optionName], this.currentCalendarOptionsInput[optionName]))) { + if (optionName in this.currentCalendarOptionsRefined) { // might be an "extra" prop + refined[optionName] = this.currentCalendarOptionsRefined[optionName]; + } + } + else if (refiners[optionName]) { + refined[optionName] = refiners[optionName](raw[optionName]); + } + else { + extra[optionName] = raw[optionName]; + } + anyChanges = true; + } + } + if (anyChanges) { + this.currentViewOptionsInput = raw; + this.currentViewOptionsRefined = refined; + } + return { + rawOptions: this.currentViewOptionsInput, + refinedOptions: this.currentViewOptionsRefined, + extra, + }; + } + } + function buildDateEnv$1(timeZone, explicitLocale, weekNumberCalculation, firstDay, weekText, pluginHooks, availableLocaleData, defaultSeparator) { + let locale = buildLocale(explicitLocale || availableLocaleData.defaultCode, availableLocaleData.map); + return new DateEnv({ + calendarSystem: 'gregory', + timeZone, + namedTimeZoneImpl: pluginHooks.namedTimeZonedImpl, + locale, + weekNumberCalculation, + firstDay, + weekText, + cmdFormatter: pluginHooks.cmdFormatter, + defaultSeparator, + }); + } + function buildTheme(options, pluginHooks) { + let ThemeClass = pluginHooks.themeClasses[options.themeSystem] || StandardTheme; + return new ThemeClass(options); + } + function buildDateProfileGenerator(props) { + let DateProfileGeneratorClass = props.dateProfileGeneratorClass || DateProfileGenerator; + return new DateProfileGeneratorClass(props); + } + function buildViewApi(type, getCurrentData, dateEnv) { + return new ViewImpl(type, getCurrentData, dateEnv); + } + function buildEventUiBySource(eventSources) { + return mapHash(eventSources, (eventSource) => eventSource.ui); + } + function buildEventUiBases(eventDefs, eventUiSingleBase, eventUiBySource) { + let eventUiBases = { '': eventUiSingleBase }; + for (let defId in eventDefs) { + let def = eventDefs[defId]; + if (def.sourceId && eventUiBySource[def.sourceId]) { + eventUiBases[defId] = eventUiBySource[def.sourceId]; + } + } + return eventUiBases; + } + function buildViewUiProps(calendarContext) { + let { options } = calendarContext; + return { + eventUiSingleBase: createEventUi({ + display: options.eventDisplay, + editable: options.editable, + startEditable: options.eventStartEditable, + durationEditable: options.eventDurationEditable, + constraint: options.eventConstraint, + overlap: typeof options.eventOverlap === 'boolean' ? options.eventOverlap : undefined, + allow: options.eventAllow, + backgroundColor: options.eventBackgroundColor, + borderColor: options.eventBorderColor, + textColor: options.eventTextColor, + color: options.eventColor, + // classNames: options.eventClassNames // render hook will handle this + }, calendarContext), + selectionConfig: createEventUi({ + constraint: options.selectConstraint, + overlap: typeof options.selectOverlap === 'boolean' ? options.selectOverlap : undefined, + allow: options.selectAllow, + }, calendarContext), + }; + } + function computeIsLoading(state, context) { + for (let isLoadingFunc of context.pluginHooks.isLoadingFuncs) { + if (isLoadingFunc(state)) { + return true; + } + } + return false; + } + function parseContextBusinessHours(calendarContext) { + return parseBusinessHours(calendarContext.options.businessHours, calendarContext); + } + function warnUnknownOptions(options, viewName) { + for (let optionName in options) { + console.warn(`Unknown option '${optionName}'` + + (viewName ? ` for view '${viewName}'` : '')); + } + } + + class ToolbarSection extends BaseComponent { + render() { + let children = this.props.widgetGroups.map((widgetGroup) => this.renderWidgetGroup(widgetGroup)); + return h('div', { className: 'fc-toolbar-chunk' }, ...children); + } + renderWidgetGroup(widgetGroup) { + let { props } = this; + let { theme } = this.context; + let children = []; + let isOnlyButtons = true; + for (let widget of widgetGroup) { + let { buttonName, buttonClick, buttonText, buttonIcon, buttonHint } = widget; + if (buttonName === 'title') { + isOnlyButtons = false; + children.push(h("h2", { className: "fc-toolbar-title", id: props.titleId }, props.title)); + } + else { + let isPressed = buttonName === props.activeButton; + let isDisabled = (!props.isTodayEnabled && buttonName === 'today') || + (!props.isPrevEnabled && buttonName === 'prev') || + (!props.isNextEnabled && buttonName === 'next'); + let buttonClasses = [`fc-${buttonName}-button`, theme.getClass('button')]; + if (isPressed) { + buttonClasses.push(theme.getClass('buttonActive')); + } + children.push(h("button", { type: "button", title: typeof buttonHint === 'function' ? buttonHint(props.navUnit) : buttonHint, disabled: isDisabled, "aria-pressed": isPressed, className: buttonClasses.join(' '), onClick: buttonClick }, buttonText || (buttonIcon ? h("span", { className: buttonIcon }) : ''))); + } + } + if (children.length > 1) { + let groupClassName = (isOnlyButtons && theme.getClass('buttonGroup')) || ''; + return h('div', { className: groupClassName }, ...children); + } + return children[0]; + } + } + + class Toolbar extends BaseComponent { + render() { + let { model, extraClassName } = this.props; + let forceLtr = false; + let startContent; + let endContent; + let sectionWidgets = model.sectionWidgets; + let centerContent = sectionWidgets.center; + if (sectionWidgets.left) { + forceLtr = true; + startContent = sectionWidgets.left; + } + else { + startContent = sectionWidgets.start; + } + if (sectionWidgets.right) { + forceLtr = true; + endContent = sectionWidgets.right; + } + else { + endContent = sectionWidgets.end; + } + let classNames = [ + extraClassName || '', + 'fc-toolbar', + forceLtr ? 'fc-toolbar-ltr' : '', + ]; + return (h("div", { className: classNames.join(' ') }, + this.renderSection('start', startContent || []), + this.renderSection('center', centerContent || []), + this.renderSection('end', endContent || []))); + } + renderSection(key, widgetGroups) { + let { props } = this; + return (h(ToolbarSection, { key: key, widgetGroups: widgetGroups, title: props.title, navUnit: props.navUnit, activeButton: props.activeButton, isTodayEnabled: props.isTodayEnabled, isPrevEnabled: props.isPrevEnabled, isNextEnabled: props.isNextEnabled, titleId: props.titleId })); + } + } + + // TODO: do function component? + class ViewContainer extends BaseComponent { + constructor() { + super(...arguments); + this.state = { + availableWidth: null, + }; + this.handleEl = (el) => { + this.el = el; + setRef(this.props.elRef, el); + this.updateAvailableWidth(); + }; + this.handleResize = () => { + this.updateAvailableWidth(); + }; + } + render() { + let { props, state } = this; + let { aspectRatio } = props; + let classNames = [ + 'fc-view-harness', + (aspectRatio || props.liquid || props.height) + ? 'fc-view-harness-active' // harness controls the height + : 'fc-view-harness-passive', // let the view do the height + ]; + let height = ''; + let paddingBottom = ''; + if (aspectRatio) { + if (state.availableWidth !== null) { + height = state.availableWidth / aspectRatio; + } + else { + // while waiting to know availableWidth, we can't set height to *zero* + // because will cause lots of unnecessary scrollbars within scrollgrid. + // BETTER: don't start rendering ANYTHING yet until we know container width + // NOTE: why not always use paddingBottom? Causes height oscillation (issue 5606) + paddingBottom = `${(1 / aspectRatio) * 100}%`; + } + } + else { + height = props.height || ''; + } + return (h("div", { "aria-labelledby": props.labeledById, ref: this.handleEl, className: classNames.join(' '), style: { height, paddingBottom } }, props.children)); + } + componentDidMount() { + this.context.addResizeHandler(this.handleResize); + } + componentWillUnmount() { + this.context.removeResizeHandler(this.handleResize); + } + updateAvailableWidth() { + if (this.el && // needed. but why? + this.props.aspectRatio // aspectRatio is the only height setting that needs availableWidth + ) { + this.setState({ availableWidth: this.el.offsetWidth }); + } + } + } + + /* + Detects when the user clicks on an event within a DateComponent + */ + class EventClicking extends Interaction { + constructor(settings) { + super(settings); + this.handleSegClick = (ev, segEl) => { + let { component } = this; + let { context } = component; + let seg = getElSeg(segEl); + if (seg && // might be the <div> surrounding the more link + component.isValidSegDownEl(ev.target)) { + // our way to simulate a link click for elements that can't be <a> tags + // grab before trigger fired in case trigger trashes DOM thru rerendering + let hasUrlContainer = elementClosest(ev.target, '.fc-event-forced-url'); + let url = hasUrlContainer ? hasUrlContainer.querySelector('a[href]').href : ''; + context.emitter.trigger('eventClick', { + el: segEl, + event: new EventImpl(component.context, seg.eventRange.def, seg.eventRange.instance), + jsEvent: ev, + view: context.viewApi, + }); + if (url && !ev.defaultPrevented) { + window.location.href = url; + } + } + }; + this.destroy = listenBySelector(settings.el, 'click', '.fc-event', // on both fg and bg events + this.handleSegClick); + } + } + + /* + Triggers events and adds/removes core classNames when the user's pointer + enters/leaves event-elements of a component. + */ + class EventHovering extends Interaction { + constructor(settings) { + super(settings); + // for simulating an eventMouseLeave when the event el is destroyed while mouse is over it + this.handleEventElRemove = (el) => { + if (el === this.currentSegEl) { + this.handleSegLeave(null, this.currentSegEl); + } + }; + this.handleSegEnter = (ev, segEl) => { + if (getElSeg(segEl)) { // TODO: better way to make sure not hovering over more+ link or its wrapper + this.currentSegEl = segEl; + this.triggerEvent('eventMouseEnter', ev, segEl); + } + }; + this.handleSegLeave = (ev, segEl) => { + if (this.currentSegEl) { + this.currentSegEl = null; + this.triggerEvent('eventMouseLeave', ev, segEl); + } + }; + this.removeHoverListeners = listenToHoverBySelector(settings.el, '.fc-event', // on both fg and bg events + this.handleSegEnter, this.handleSegLeave); + } + destroy() { + this.removeHoverListeners(); + } + triggerEvent(publicEvName, ev, segEl) { + let { component } = this; + let { context } = component; + let seg = getElSeg(segEl); + if (!ev || component.isValidSegDownEl(ev.target)) { + context.emitter.trigger(publicEvName, { + el: segEl, + event: new EventImpl(context, seg.eventRange.def, seg.eventRange.instance), + jsEvent: ev, + view: context.viewApi, + }); + } + } + } + + class CalendarContent extends PureComponent { + constructor() { + super(...arguments); + this.buildViewContext = memoize(buildViewContext); + this.buildViewPropTransformers = memoize(buildViewPropTransformers); + this.buildToolbarProps = memoize(buildToolbarProps); + this.headerRef = y(); + this.footerRef = y(); + this.interactionsStore = {}; + // eslint-disable-next-line + this.state = { + viewLabelId: getUniqueDomId(), + }; + // Component Registration + // ----------------------------------------------------------------------------------------------------------------- + this.registerInteractiveComponent = (component, settingsInput) => { + let settings = parseInteractionSettings(component, settingsInput); + let DEFAULT_INTERACTIONS = [ + EventClicking, + EventHovering, + ]; + let interactionClasses = DEFAULT_INTERACTIONS.concat(this.props.pluginHooks.componentInteractions); + let interactions = interactionClasses.map((TheInteractionClass) => new TheInteractionClass(settings)); + this.interactionsStore[component.uid] = interactions; + interactionSettingsStore[component.uid] = settings; + }; + this.unregisterInteractiveComponent = (component) => { + let listeners = this.interactionsStore[component.uid]; + if (listeners) { + for (let listener of listeners) { + listener.destroy(); + } + delete this.interactionsStore[component.uid]; + } + delete interactionSettingsStore[component.uid]; + }; + // Resizing + // ----------------------------------------------------------------------------------------------------------------- + this.resizeRunner = new DelayedRunner(() => { + this.props.emitter.trigger('_resize', true); // should window resizes be considered "forced" ? + this.props.emitter.trigger('windowResize', { view: this.props.viewApi }); + }); + this.handleWindowResize = (ev) => { + let { options } = this.props; + if (options.handleWindowResize && + ev.target === window // avoid jqui events + ) { + this.resizeRunner.request(options.windowResizeDelay); + } + }; + } + /* + renders INSIDE of an outer div + */ + render() { + let { props } = this; + let { toolbarConfig, options } = props; + let toolbarProps = this.buildToolbarProps(props.viewSpec, props.dateProfile, props.dateProfileGenerator, props.currentDate, getNow(props.options.now, props.dateEnv), // TODO: use NowTimer???? + props.viewTitle); + let viewVGrow = false; + let viewHeight = ''; + let viewAspectRatio; + if (props.isHeightAuto || props.forPrint) { + viewHeight = ''; + } + else if (options.height != null) { + viewVGrow = true; + } + else if (options.contentHeight != null) { + viewHeight = options.contentHeight; + } + else { + viewAspectRatio = Math.max(options.aspectRatio, 0.5); // prevent from getting too tall + } + let viewContext = this.buildViewContext(props.viewSpec, props.viewApi, props.options, props.dateProfileGenerator, props.dateEnv, props.theme, props.pluginHooks, props.dispatch, props.getCurrentData, props.emitter, props.calendarApi, this.registerInteractiveComponent, this.unregisterInteractiveComponent); + let viewLabelId = (toolbarConfig.header && toolbarConfig.header.hasTitle) + ? this.state.viewLabelId + : ''; + return (h(ViewContextType.Provider, { value: viewContext }, + toolbarConfig.header && (h(Toolbar, Object.assign({ ref: this.headerRef, extraClassName: "fc-header-toolbar", model: toolbarConfig.header, titleId: viewLabelId }, toolbarProps))), + h(ViewContainer, { liquid: viewVGrow, height: viewHeight, aspectRatio: viewAspectRatio, labeledById: viewLabelId }, + this.renderView(props), + this.buildAppendContent()), + toolbarConfig.footer && (h(Toolbar, Object.assign({ ref: this.footerRef, extraClassName: "fc-footer-toolbar", model: toolbarConfig.footer, titleId: "" }, toolbarProps))))); + } + componentDidMount() { + let { props } = this; + this.calendarInteractions = props.pluginHooks.calendarInteractions + .map((CalendarInteractionClass) => new CalendarInteractionClass(props)); + window.addEventListener('resize', this.handleWindowResize); + let { propSetHandlers } = props.pluginHooks; + for (let propName in propSetHandlers) { + propSetHandlers[propName](props[propName], props); + } + } + componentDidUpdate(prevProps) { + let { props } = this; + let { propSetHandlers } = props.pluginHooks; + for (let propName in propSetHandlers) { + if (props[propName] !== prevProps[propName]) { + propSetHandlers[propName](props[propName], props); + } + } + } + componentWillUnmount() { + window.removeEventListener('resize', this.handleWindowResize); + this.resizeRunner.clear(); + for (let interaction of this.calendarInteractions) { + interaction.destroy(); + } + this.props.emitter.trigger('_unmount'); + } + buildAppendContent() { + let { props } = this; + let children = props.pluginHooks.viewContainerAppends.map((buildAppendContent) => buildAppendContent(props)); + return h(p, {}, ...children); + } + renderView(props) { + let { pluginHooks } = props; + let { viewSpec } = props; + let viewProps = { + dateProfile: props.dateProfile, + businessHours: props.businessHours, + eventStore: props.renderableEventStore, + eventUiBases: props.eventUiBases, + dateSelection: props.dateSelection, + eventSelection: props.eventSelection, + eventDrag: props.eventDrag, + eventResize: props.eventResize, + isHeightAuto: props.isHeightAuto, + forPrint: props.forPrint, + }; + let transformers = this.buildViewPropTransformers(pluginHooks.viewPropsTransformers); + for (let transformer of transformers) { + Object.assign(viewProps, transformer.transform(viewProps, props)); + } + let ViewComponent = viewSpec.component; + return (h(ViewComponent, Object.assign({}, viewProps))); + } + } + function buildToolbarProps(viewSpec, dateProfile, dateProfileGenerator, currentDate, now, title) { + // don't force any date-profiles to valid date profiles (the `false`) so that we can tell if it's invalid + let todayInfo = dateProfileGenerator.build(now, undefined, false); // TODO: need `undefined` or else INFINITE LOOP for some reason + let prevInfo = dateProfileGenerator.buildPrev(dateProfile, currentDate, false); + let nextInfo = dateProfileGenerator.buildNext(dateProfile, currentDate, false); + return { + title, + activeButton: viewSpec.type, + navUnit: viewSpec.singleUnit, + isTodayEnabled: todayInfo.isValid && !rangeContainsMarker(dateProfile.currentRange, now), + isPrevEnabled: prevInfo.isValid, + isNextEnabled: nextInfo.isValid, + }; + } + // Plugin + // ----------------------------------------------------------------------------------------------------------------- + function buildViewPropTransformers(theClasses) { + return theClasses.map((TheClass) => new TheClass()); + } + + class Calendar extends CalendarImpl { + constructor(el, optionOverrides = {}) { + super(); + this.isRendering = false; + this.isRendered = false; + this.currentClassNames = []; + this.customContentRenderId = 0; + this.handleAction = (action) => { + // actions we know we want to render immediately + switch (action.type) { + case 'SET_EVENT_DRAG': + case 'SET_EVENT_RESIZE': + this.renderRunner.tryDrain(); + } + }; + this.handleData = (data) => { + this.currentData = data; + this.renderRunner.request(data.calendarOptions.rerenderDelay); + }; + this.handleRenderRequest = () => { + if (this.isRendering) { + this.isRendered = true; + let { currentData } = this; + flushSync(() => { + P$1(h(CalendarRoot, { options: currentData.calendarOptions, theme: currentData.theme, emitter: currentData.emitter }, (classNames, height, isHeightAuto, forPrint) => { + this.setClassNames(classNames); + this.setHeight(height); + return (h(RenderId.Provider, { value: this.customContentRenderId }, + h(CalendarContent, Object.assign({ isHeightAuto: isHeightAuto, forPrint: forPrint }, currentData)))); + }), this.el); + }); + } + else if (this.isRendered) { + this.isRendered = false; + P$1(null, this.el); + this.setClassNames([]); + this.setHeight(''); + } + }; + this.el = el; + this.renderRunner = new DelayedRunner(this.handleRenderRequest); + new CalendarDataManager({ + optionOverrides, + calendarApi: this, + onAction: this.handleAction, + onData: this.handleData, + }); + } + render() { + let wasRendering = this.isRendering; + if (!wasRendering) { + this.isRendering = true; + } + else { + this.customContentRenderId += 1; + } + this.renderRunner.request(); + if (wasRendering) { + this.updateSize(); + } + } + destroy() { + if (this.isRendering) { + this.isRendering = false; + this.renderRunner.request(); + } + } + updateSize() { + flushSync(() => { + super.updateSize(); + }); + } + batchRendering(func) { + this.renderRunner.pause('batchRendering'); + func(); + this.renderRunner.resume('batchRendering'); + } + pauseRendering() { + this.renderRunner.pause('pauseRendering'); + } + resumeRendering() { + this.renderRunner.resume('pauseRendering', true); + } + resetOptions(optionOverrides, append) { + this.currentDataManager.resetOptions(optionOverrides, append); + } + setClassNames(classNames) { + if (!isArraysEqual(classNames, this.currentClassNames)) { + let { classList } = this.el; + for (let className of this.currentClassNames) { + classList.remove(className); + } + for (let className of classNames) { + classList.add(className); + } + this.currentClassNames = classNames; + } + } + setHeight(height) { + applyStyleProp(this.el, 'height', height); + } + } + + function formatDate(dateInput, options = {}) { + let dateEnv = buildDateEnv(options); + let formatter = createFormatter(options); + let dateMeta = dateEnv.createMarkerMeta(dateInput); + if (!dateMeta) { // TODO: warning? + return ''; + } + return dateEnv.format(dateMeta.marker, formatter, { + forcedTzo: dateMeta.forcedTzo, + }); + } + function formatRange(startInput, endInput, options) { + let dateEnv = buildDateEnv(typeof options === 'object' && options ? options : {}); // pass in if non-null object + let formatter = createFormatter(options); + let startMeta = dateEnv.createMarkerMeta(startInput); + let endMeta = dateEnv.createMarkerMeta(endInput); + if (!startMeta || !endMeta) { // TODO: warning? + return ''; + } + return dateEnv.formatRange(startMeta.marker, endMeta.marker, formatter, { + forcedStartTzo: startMeta.forcedTzo, + forcedEndTzo: endMeta.forcedTzo, + isEndExclusive: options.isEndExclusive, + defaultSeparator: BASE_OPTION_DEFAULTS.defaultRangeSeparator, + }); + } + // TODO: more DRY and optimized + function buildDateEnv(settings) { + let locale = buildLocale(settings.locale || 'en', organizeRawLocales([]).map); // TODO: don't hardcode 'en' everywhere + return new DateEnv(Object.assign(Object.assign({ timeZone: BASE_OPTION_DEFAULTS.timeZone, calendarSystem: 'gregory' }, settings), { locale })); + } + + // HELPERS + /* + if nextDayThreshold is specified, slicing is done in an all-day fashion. + you can get nextDayThreshold from context.nextDayThreshold + */ + function sliceEvents(props, allDay) { + return sliceEventStore(props.eventStore, props.eventUiBases, props.dateProfile.activeRange, allDay ? props.nextDayThreshold : null).fg; + } + + const version = '6.0.2'; + + config.touchMouseIgnoreWait = 500; + let ignoreMouseDepth = 0; + let listenerCnt = 0; + let isWindowTouchMoveCancelled = false; + /* + Uses a "pointer" abstraction, which monitors UI events for both mouse and touch. + Tracks when the pointer "drags" on a certain element, meaning down+move+up. + + Also, tracks if there was touch-scrolling. + Also, can prevent touch-scrolling from happening. + Also, can fire pointermove events when scrolling happens underneath, even when no real pointer movement. + + emits: + - pointerdown + - pointermove + - pointerup + */ + class PointerDragging { + constructor(containerEl) { + this.subjectEl = null; + // options that can be directly assigned by caller + this.selector = ''; // will cause subjectEl in all emitted events to be this element + this.handleSelector = ''; + this.shouldIgnoreMove = false; + this.shouldWatchScroll = true; // for simulating pointermove on scroll + // internal states + this.isDragging = false; + this.isTouchDragging = false; + this.wasTouchScroll = false; + // Mouse + // ---------------------------------------------------------------------------------------------------- + this.handleMouseDown = (ev) => { + if (!this.shouldIgnoreMouse() && + isPrimaryMouseButton(ev) && + this.tryStart(ev)) { + let pev = this.createEventFromMouse(ev, true); + this.emitter.trigger('pointerdown', pev); + this.initScrollWatch(pev); + if (!this.shouldIgnoreMove) { + document.addEventListener('mousemove', this.handleMouseMove); + } + document.addEventListener('mouseup', this.handleMouseUp); + } + }; + this.handleMouseMove = (ev) => { + let pev = this.createEventFromMouse(ev); + this.recordCoords(pev); + this.emitter.trigger('pointermove', pev); + }; + this.handleMouseUp = (ev) => { + document.removeEventListener('mousemove', this.handleMouseMove); + document.removeEventListener('mouseup', this.handleMouseUp); + this.emitter.trigger('pointerup', this.createEventFromMouse(ev)); + this.cleanup(); // call last so that pointerup has access to props + }; + // Touch + // ---------------------------------------------------------------------------------------------------- + this.handleTouchStart = (ev) => { + if (this.tryStart(ev)) { + this.isTouchDragging = true; + let pev = this.createEventFromTouch(ev, true); + this.emitter.trigger('pointerdown', pev); + this.initScrollWatch(pev); + // unlike mouse, need to attach to target, not document + // https://stackoverflow.com/a/45760014 + let targetEl = ev.target; + if (!this.shouldIgnoreMove) { + targetEl.addEventListener('touchmove', this.handleTouchMove); + } + targetEl.addEventListener('touchend', this.handleTouchEnd); + targetEl.addEventListener('touchcancel', this.handleTouchEnd); // treat it as a touch end + // attach a handler to get called when ANY scroll action happens on the page. + // this was impossible to do with normal on/off because 'scroll' doesn't bubble. + // http://stackoverflow.com/a/32954565/96342 + window.addEventListener('scroll', this.handleTouchScroll, true); + } + }; + this.handleTouchMove = (ev) => { + let pev = this.createEventFromTouch(ev); + this.recordCoords(pev); + this.emitter.trigger('pointermove', pev); + }; + this.handleTouchEnd = (ev) => { + if (this.isDragging) { // done to guard against touchend followed by touchcancel + let targetEl = ev.target; + targetEl.removeEventListener('touchmove', this.handleTouchMove); + targetEl.removeEventListener('touchend', this.handleTouchEnd); + targetEl.removeEventListener('touchcancel', this.handleTouchEnd); + window.removeEventListener('scroll', this.handleTouchScroll, true); // useCaptured=true + this.emitter.trigger('pointerup', this.createEventFromTouch(ev)); + this.cleanup(); // call last so that pointerup has access to props + this.isTouchDragging = false; + startIgnoringMouse(); + } + }; + this.handleTouchScroll = () => { + this.wasTouchScroll = true; + }; + this.handleScroll = (ev) => { + if (!this.shouldIgnoreMove) { + let pageX = (window.pageXOffset - this.prevScrollX) + this.prevPageX; + let pageY = (window.pageYOffset - this.prevScrollY) + this.prevPageY; + this.emitter.trigger('pointermove', { + origEvent: ev, + isTouch: this.isTouchDragging, + subjectEl: this.subjectEl, + pageX, + pageY, + deltaX: pageX - this.origPageX, + deltaY: pageY - this.origPageY, + }); + } + }; + this.containerEl = containerEl; + this.emitter = new Emitter(); + containerEl.addEventListener('mousedown', this.handleMouseDown); + containerEl.addEventListener('touchstart', this.handleTouchStart, { passive: true }); + listenerCreated(); + } + destroy() { + this.containerEl.removeEventListener('mousedown', this.handleMouseDown); + this.containerEl.removeEventListener('touchstart', this.handleTouchStart, { passive: true }); + listenerDestroyed(); + } + tryStart(ev) { + let subjectEl = this.querySubjectEl(ev); + let downEl = ev.target; + if (subjectEl && + (!this.handleSelector || elementClosest(downEl, this.handleSelector))) { + this.subjectEl = subjectEl; + this.isDragging = true; // do this first so cancelTouchScroll will work + this.wasTouchScroll = false; + return true; + } + return false; + } + cleanup() { + isWindowTouchMoveCancelled = false; + this.isDragging = false; + this.subjectEl = null; + // keep wasTouchScroll around for later access + this.destroyScrollWatch(); + } + querySubjectEl(ev) { + if (this.selector) { + return elementClosest(ev.target, this.selector); + } + return this.containerEl; + } + shouldIgnoreMouse() { + return ignoreMouseDepth || this.isTouchDragging; + } + // can be called by user of this class, to cancel touch-based scrolling for the current drag + cancelTouchScroll() { + if (this.isDragging) { + isWindowTouchMoveCancelled = true; + } + } + // Scrolling that simulates pointermoves + // ---------------------------------------------------------------------------------------------------- + initScrollWatch(ev) { + if (this.shouldWatchScroll) { + this.recordCoords(ev); + window.addEventListener('scroll', this.handleScroll, true); // useCapture=true + } + } + recordCoords(ev) { + if (this.shouldWatchScroll) { + this.prevPageX = ev.pageX; + this.prevPageY = ev.pageY; + this.prevScrollX = window.pageXOffset; + this.prevScrollY = window.pageYOffset; + } + } + destroyScrollWatch() { + if (this.shouldWatchScroll) { + window.removeEventListener('scroll', this.handleScroll, true); // useCaptured=true + } + } + // Event Normalization + // ---------------------------------------------------------------------------------------------------- + createEventFromMouse(ev, isFirst) { + let deltaX = 0; + let deltaY = 0; + // TODO: repeat code + if (isFirst) { + this.origPageX = ev.pageX; + this.origPageY = ev.pageY; + } + else { + deltaX = ev.pageX - this.origPageX; + deltaY = ev.pageY - this.origPageY; + } + return { + origEvent: ev, + isTouch: false, + subjectEl: this.subjectEl, + pageX: ev.pageX, + pageY: ev.pageY, + deltaX, + deltaY, + }; + } + createEventFromTouch(ev, isFirst) { + let touches = ev.touches; + let pageX; + let pageY; + let deltaX = 0; + let deltaY = 0; + // if touch coords available, prefer, + // because FF would give bad ev.pageX ev.pageY + if (touches && touches.length) { + pageX = touches[0].pageX; + pageY = touches[0].pageY; + } + else { + pageX = ev.pageX; + pageY = ev.pageY; + } + // TODO: repeat code + if (isFirst) { + this.origPageX = pageX; + this.origPageY = pageY; + } + else { + deltaX = pageX - this.origPageX; + deltaY = pageY - this.origPageY; + } + return { + origEvent: ev, + isTouch: true, + subjectEl: this.subjectEl, + pageX, + pageY, + deltaX, + deltaY, + }; + } + } + // Returns a boolean whether this was a left mouse click and no ctrl key (which means right click on Mac) + function isPrimaryMouseButton(ev) { + return ev.button === 0 && !ev.ctrlKey; + } + // Ignoring fake mouse events generated by touch + // ---------------------------------------------------------------------------------------------------- + function startIgnoringMouse() { + ignoreMouseDepth += 1; + setTimeout(() => { + ignoreMouseDepth -= 1; + }, config.touchMouseIgnoreWait); + } + // We want to attach touchmove as early as possible for Safari + // ---------------------------------------------------------------------------------------------------- + function listenerCreated() { + listenerCnt += 1; + if (listenerCnt === 1) { + window.addEventListener('touchmove', onWindowTouchMove, { passive: false }); + } + } + function listenerDestroyed() { + listenerCnt -= 1; + if (!listenerCnt) { + window.removeEventListener('touchmove', onWindowTouchMove, { passive: false }); + } + } + function onWindowTouchMove(ev) { + if (isWindowTouchMoveCancelled) { + ev.preventDefault(); + } + } + + /* + An effect in which an element follows the movement of a pointer across the screen. + The moving element is a clone of some other element. + Must call start + handleMove + stop. + */ + class ElementMirror { + constructor() { + this.isVisible = false; // must be explicitly enabled + this.sourceEl = null; + this.mirrorEl = null; + this.sourceElRect = null; // screen coords relative to viewport + // options that can be set directly by caller + this.parentNode = document.body; // HIGHLY SUGGESTED to set this to sidestep ShadowDOM issues + this.zIndex = 9999; + this.revertDuration = 0; + } + start(sourceEl, pageX, pageY) { + this.sourceEl = sourceEl; + this.sourceElRect = this.sourceEl.getBoundingClientRect(); + this.origScreenX = pageX - window.pageXOffset; + this.origScreenY = pageY - window.pageYOffset; + this.deltaX = 0; + this.deltaY = 0; + this.updateElPosition(); + } + handleMove(pageX, pageY) { + this.deltaX = (pageX - window.pageXOffset) - this.origScreenX; + this.deltaY = (pageY - window.pageYOffset) - this.origScreenY; + this.updateElPosition(); + } + // can be called before start + setIsVisible(bool) { + if (bool) { + if (!this.isVisible) { + if (this.mirrorEl) { + this.mirrorEl.style.display = ''; + } + this.isVisible = bool; // needs to happen before updateElPosition + this.updateElPosition(); // because was not updating the position while invisible + } + } + else if (this.isVisible) { + if (this.mirrorEl) { + this.mirrorEl.style.display = 'none'; + } + this.isVisible = bool; + } + } + // always async + stop(needsRevertAnimation, callback) { + let done = () => { + this.cleanup(); + callback(); + }; + if (needsRevertAnimation && + this.mirrorEl && + this.isVisible && + this.revertDuration && // if 0, transition won't work + (this.deltaX || this.deltaY) // if same coords, transition won't work + ) { + this.doRevertAnimation(done, this.revertDuration); + } + else { + setTimeout(done, 0); + } + } + doRevertAnimation(callback, revertDuration) { + let mirrorEl = this.mirrorEl; + let finalSourceElRect = this.sourceEl.getBoundingClientRect(); // because autoscrolling might have happened + mirrorEl.style.transition = + 'top ' + revertDuration + 'ms,' + + 'left ' + revertDuration + 'ms'; + applyStyle(mirrorEl, { + left: finalSourceElRect.left, + top: finalSourceElRect.top, + }); + whenTransitionDone(mirrorEl, () => { + mirrorEl.style.transition = ''; + callback(); + }); + } + cleanup() { + if (this.mirrorEl) { + removeElement(this.mirrorEl); + this.mirrorEl = null; + } + this.sourceEl = null; + } + updateElPosition() { + if (this.sourceEl && this.isVisible) { + applyStyle(this.getMirrorEl(), { + left: this.sourceElRect.left + this.deltaX, + top: this.sourceElRect.top + this.deltaY, + }); + } + } + getMirrorEl() { + let sourceElRect = this.sourceElRect; + let mirrorEl = this.mirrorEl; + if (!mirrorEl) { + mirrorEl = this.mirrorEl = this.sourceEl.cloneNode(true); // cloneChildren=true + // we don't want long taps or any mouse interaction causing selection/menus. + // would use preventSelection(), but that prevents selectstart, causing problems. + mirrorEl.classList.add('fc-unselectable'); + mirrorEl.classList.add('fc-event-dragging'); + applyStyle(mirrorEl, { + position: 'fixed', + zIndex: this.zIndex, + visibility: '', + boxSizing: 'border-box', + width: sourceElRect.right - sourceElRect.left, + height: sourceElRect.bottom - sourceElRect.top, + right: 'auto', + bottom: 'auto', + margin: 0, + }); + this.parentNode.appendChild(mirrorEl); + } + return mirrorEl; + } + } + + /* + Is a cache for a given element's scroll information (all the info that ScrollController stores) + in addition the "client rectangle" of the element.. the area within the scrollbars. + + The cache can be in one of two modes: + - doesListening:false - ignores when the container is scrolled by someone else + - doesListening:true - watch for scrolling and update the cache + */ + class ScrollGeomCache extends ScrollController { + constructor(scrollController, doesListening) { + super(); + this.handleScroll = () => { + this.scrollTop = this.scrollController.getScrollTop(); + this.scrollLeft = this.scrollController.getScrollLeft(); + this.handleScrollChange(); + }; + this.scrollController = scrollController; + this.doesListening = doesListening; + this.scrollTop = this.origScrollTop = scrollController.getScrollTop(); + this.scrollLeft = this.origScrollLeft = scrollController.getScrollLeft(); + this.scrollWidth = scrollController.getScrollWidth(); + this.scrollHeight = scrollController.getScrollHeight(); + this.clientWidth = scrollController.getClientWidth(); + this.clientHeight = scrollController.getClientHeight(); + this.clientRect = this.computeClientRect(); // do last in case it needs cached values + if (this.doesListening) { + this.getEventTarget().addEventListener('scroll', this.handleScroll); + } + } + destroy() { + if (this.doesListening) { + this.getEventTarget().removeEventListener('scroll', this.handleScroll); + } + } + getScrollTop() { + return this.scrollTop; + } + getScrollLeft() { + return this.scrollLeft; + } + setScrollTop(top) { + this.scrollController.setScrollTop(top); + if (!this.doesListening) { + // we are not relying on the element to normalize out-of-bounds scroll values + // so we need to sanitize ourselves + this.scrollTop = Math.max(Math.min(top, this.getMaxScrollTop()), 0); + this.handleScrollChange(); + } + } + setScrollLeft(top) { + this.scrollController.setScrollLeft(top); + if (!this.doesListening) { + // we are not relying on the element to normalize out-of-bounds scroll values + // so we need to sanitize ourselves + this.scrollLeft = Math.max(Math.min(top, this.getMaxScrollLeft()), 0); + this.handleScrollChange(); + } + } + getClientWidth() { + return this.clientWidth; + } + getClientHeight() { + return this.clientHeight; + } + getScrollWidth() { + return this.scrollWidth; + } + getScrollHeight() { + return this.scrollHeight; + } + handleScrollChange() { + } + } + + class ElementScrollGeomCache extends ScrollGeomCache { + constructor(el, doesListening) { + super(new ElementScrollController(el), doesListening); + } + getEventTarget() { + return this.scrollController.el; + } + computeClientRect() { + return computeInnerRect(this.scrollController.el); + } + } + + class WindowScrollGeomCache extends ScrollGeomCache { + constructor(doesListening) { + super(new WindowScrollController(), doesListening); + } + getEventTarget() { + return window; + } + computeClientRect() { + return { + left: this.scrollLeft, + right: this.scrollLeft + this.clientWidth, + top: this.scrollTop, + bottom: this.scrollTop + this.clientHeight, + }; + } + // the window is the only scroll object that changes it's rectangle relative + // to the document's topleft as it scrolls + handleScrollChange() { + this.clientRect = this.computeClientRect(); + } + } + + // If available we are using native "performance" API instead of "Date" + // Read more about it on MDN: + // https://developer.mozilla.org/en-US/docs/Web/API/Performance + const getTime = typeof performance === 'function' ? performance.now : Date.now; + /* + For a pointer interaction, automatically scrolls certain scroll containers when the pointer + approaches the edge. + + The caller must call start + handleMove + stop. + */ + class AutoScroller { + constructor() { + // options that can be set by caller + this.isEnabled = true; + this.scrollQuery = [window, '.fc-scroller']; + this.edgeThreshold = 50; // pixels + this.maxVelocity = 300; // pixels per second + // internal state + this.pointerScreenX = null; + this.pointerScreenY = null; + this.isAnimating = false; + this.scrollCaches = null; + // protect against the initial pointerdown being too close to an edge and starting the scroll + this.everMovedUp = false; + this.everMovedDown = false; + this.everMovedLeft = false; + this.everMovedRight = false; + this.animate = () => { + if (this.isAnimating) { // wasn't cancelled between animation calls + let edge = this.computeBestEdge(this.pointerScreenX + window.pageXOffset, this.pointerScreenY + window.pageYOffset); + if (edge) { + let now = getTime(); + this.handleSide(edge, (now - this.msSinceRequest) / 1000); + this.requestAnimation(now); + } + else { + this.isAnimating = false; // will stop animation + } + } + }; + } + start(pageX, pageY, scrollStartEl) { + if (this.isEnabled) { + this.scrollCaches = this.buildCaches(scrollStartEl); + this.pointerScreenX = null; + this.pointerScreenY = null; + this.everMovedUp = false; + this.everMovedDown = false; + this.everMovedLeft = false; + this.everMovedRight = false; + this.handleMove(pageX, pageY); + } + } + handleMove(pageX, pageY) { + if (this.isEnabled) { + let pointerScreenX = pageX - window.pageXOffset; + let pointerScreenY = pageY - window.pageYOffset; + let yDelta = this.pointerScreenY === null ? 0 : pointerScreenY - this.pointerScreenY; + let xDelta = this.pointerScreenX === null ? 0 : pointerScreenX - this.pointerScreenX; + if (yDelta < 0) { + this.everMovedUp = true; + } + else if (yDelta > 0) { + this.everMovedDown = true; + } + if (xDelta < 0) { + this.everMovedLeft = true; + } + else if (xDelta > 0) { + this.everMovedRight = true; + } + this.pointerScreenX = pointerScreenX; + this.pointerScreenY = pointerScreenY; + if (!this.isAnimating) { + this.isAnimating = true; + this.requestAnimation(getTime()); + } + } + } + stop() { + if (this.isEnabled) { + this.isAnimating = false; // will stop animation + for (let scrollCache of this.scrollCaches) { + scrollCache.destroy(); + } + this.scrollCaches = null; + } + } + requestAnimation(now) { + this.msSinceRequest = now; + requestAnimationFrame(this.animate); + } + handleSide(edge, seconds) { + let { scrollCache } = edge; + let { edgeThreshold } = this; + let invDistance = edgeThreshold - edge.distance; + let velocity = // the closer to the edge, the faster we scroll + ((invDistance * invDistance) / (edgeThreshold * edgeThreshold)) * // quadratic + this.maxVelocity * seconds; + let sign = 1; + switch (edge.name) { + case 'left': + sign = -1; + // falls through + case 'right': + scrollCache.setScrollLeft(scrollCache.getScrollLeft() + velocity * sign); + break; + case 'top': + sign = -1; + // falls through + case 'bottom': + scrollCache.setScrollTop(scrollCache.getScrollTop() + velocity * sign); + break; + } + } + // left/top are relative to document topleft + computeBestEdge(left, top) { + let { edgeThreshold } = this; + let bestSide = null; + let scrollCaches = this.scrollCaches || []; + for (let scrollCache of scrollCaches) { + let rect = scrollCache.clientRect; + let leftDist = left - rect.left; + let rightDist = rect.right - left; + let topDist = top - rect.top; + let bottomDist = rect.bottom - top; + // completely within the rect? + if (leftDist >= 0 && rightDist >= 0 && topDist >= 0 && bottomDist >= 0) { + if (topDist <= edgeThreshold && this.everMovedUp && scrollCache.canScrollUp() && + (!bestSide || bestSide.distance > topDist)) { + bestSide = { scrollCache, name: 'top', distance: topDist }; + } + if (bottomDist <= edgeThreshold && this.everMovedDown && scrollCache.canScrollDown() && + (!bestSide || bestSide.distance > bottomDist)) { + bestSide = { scrollCache, name: 'bottom', distance: bottomDist }; + } + if (leftDist <= edgeThreshold && this.everMovedLeft && scrollCache.canScrollLeft() && + (!bestSide || bestSide.distance > leftDist)) { + bestSide = { scrollCache, name: 'left', distance: leftDist }; + } + if (rightDist <= edgeThreshold && this.everMovedRight && scrollCache.canScrollRight() && + (!bestSide || bestSide.distance > rightDist)) { + bestSide = { scrollCache, name: 'right', distance: rightDist }; + } + } + } + return bestSide; + } + buildCaches(scrollStartEl) { + return this.queryScrollEls(scrollStartEl).map((el) => { + if (el === window) { + return new WindowScrollGeomCache(false); // false = don't listen to user-generated scrolls + } + return new ElementScrollGeomCache(el, false); // false = don't listen to user-generated scrolls + }); + } + queryScrollEls(scrollStartEl) { + let els = []; + for (let query of this.scrollQuery) { + if (typeof query === 'object') { + els.push(query); + } + else { + els.push(...Array.prototype.slice.call(getElRoot(scrollStartEl).querySelectorAll(query))); + } + } + return els; + } + } + + /* + Monitors dragging on an element. Has a number of high-level features: + - minimum distance required before dragging + - minimum wait time ("delay") before dragging + - a mirror element that follows the pointer + */ + class FeaturefulElementDragging extends ElementDragging { + constructor(containerEl, selector) { + super(containerEl); + this.containerEl = containerEl; + // options that can be directly set by caller + // the caller can also set the PointerDragging's options as well + this.delay = null; + this.minDistance = 0; + this.touchScrollAllowed = true; // prevents drag from starting and blocks scrolling during drag + this.mirrorNeedsRevert = false; + this.isInteracting = false; // is the user validly moving the pointer? lasts until pointerup + this.isDragging = false; // is it INTENTFULLY dragging? lasts until after revert animation + this.isDelayEnded = false; + this.isDistanceSurpassed = false; + this.delayTimeoutId = null; + this.onPointerDown = (ev) => { + if (!this.isDragging) { // so new drag doesn't happen while revert animation is going + this.isInteracting = true; + this.isDelayEnded = false; + this.isDistanceSurpassed = false; + preventSelection(document.body); + preventContextMenu(document.body); + // prevent links from being visited if there's an eventual drag. + // also prevents selection in older browsers (maybe?). + // not necessary for touch, besides, browser would complain about passiveness. + if (!ev.isTouch) { + ev.origEvent.preventDefault(); + } + this.emitter.trigger('pointerdown', ev); + if (this.isInteracting && // not destroyed via pointerdown handler + !this.pointer.shouldIgnoreMove) { + // actions related to initiating dragstart+dragmove+dragend... + this.mirror.setIsVisible(false); // reset. caller must set-visible + this.mirror.start(ev.subjectEl, ev.pageX, ev.pageY); // must happen on first pointer down + this.startDelay(ev); + if (!this.minDistance) { + this.handleDistanceSurpassed(ev); + } + } + } + }; + this.onPointerMove = (ev) => { + if (this.isInteracting) { + this.emitter.trigger('pointermove', ev); + if (!this.isDistanceSurpassed) { + let minDistance = this.minDistance; + let distanceSq; // current distance from the origin, squared + let { deltaX, deltaY } = ev; + distanceSq = deltaX * deltaX + deltaY * deltaY; + if (distanceSq >= minDistance * minDistance) { // use pythagorean theorem + this.handleDistanceSurpassed(ev); + } + } + if (this.isDragging) { + // a real pointer move? (not one simulated by scrolling) + if (ev.origEvent.type !== 'scroll') { + this.mirror.handleMove(ev.pageX, ev.pageY); + this.autoScroller.handleMove(ev.pageX, ev.pageY); + } + this.emitter.trigger('dragmove', ev); + } + } + }; + this.onPointerUp = (ev) => { + if (this.isInteracting) { + this.isInteracting = false; + allowSelection(document.body); + allowContextMenu(document.body); + this.emitter.trigger('pointerup', ev); // can potentially set mirrorNeedsRevert + if (this.isDragging) { + this.autoScroller.stop(); + this.tryStopDrag(ev); // which will stop the mirror + } + if (this.delayTimeoutId) { + clearTimeout(this.delayTimeoutId); + this.delayTimeoutId = null; + } + } + }; + let pointer = this.pointer = new PointerDragging(containerEl); + pointer.emitter.on('pointerdown', this.onPointerDown); + pointer.emitter.on('pointermove', this.onPointerMove); + pointer.emitter.on('pointerup', this.onPointerUp); + if (selector) { + pointer.selector = selector; + } + this.mirror = new ElementMirror(); + this.autoScroller = new AutoScroller(); + } + destroy() { + this.pointer.destroy(); + // HACK: simulate a pointer-up to end the current drag + // TODO: fire 'dragend' directly and stop interaction. discourage use of pointerup event (b/c might not fire) + this.onPointerUp({}); + } + startDelay(ev) { + if (typeof this.delay === 'number') { + this.delayTimeoutId = setTimeout(() => { + this.delayTimeoutId = null; + this.handleDelayEnd(ev); + }, this.delay); // not assignable to number! + } + else { + this.handleDelayEnd(ev); + } + } + handleDelayEnd(ev) { + this.isDelayEnded = true; + this.tryStartDrag(ev); + } + handleDistanceSurpassed(ev) { + this.isDistanceSurpassed = true; + this.tryStartDrag(ev); + } + tryStartDrag(ev) { + if (this.isDelayEnded && this.isDistanceSurpassed) { + if (!this.pointer.wasTouchScroll || this.touchScrollAllowed) { + this.isDragging = true; + this.mirrorNeedsRevert = false; + this.autoScroller.start(ev.pageX, ev.pageY, this.containerEl); + this.emitter.trigger('dragstart', ev); + if (this.touchScrollAllowed === false) { + this.pointer.cancelTouchScroll(); + } + } + } + } + tryStopDrag(ev) { + // .stop() is ALWAYS asynchronous, which we NEED because we want all pointerup events + // that come from the document to fire beforehand. much more convenient this way. + this.mirror.stop(this.mirrorNeedsRevert, this.stopDrag.bind(this, ev)); + } + stopDrag(ev) { + this.isDragging = false; + this.emitter.trigger('dragend', ev); + } + // fill in the implementations... + setIgnoreMove(bool) { + this.pointer.shouldIgnoreMove = bool; + } + setMirrorIsVisible(bool) { + this.mirror.setIsVisible(bool); + } + setMirrorNeedsRevert(bool) { + this.mirrorNeedsRevert = bool; + } + setAutoScrollEnabled(bool) { + this.autoScroller.isEnabled = bool; + } + } + + /* + When this class is instantiated, it records the offset of an element (relative to the document topleft), + and continues to monitor scrolling, updating the cached coordinates if it needs to. + Does not access the DOM after instantiation, so highly performant. + + Also keeps track of all scrolling/overflow:hidden containers that are parents of the given element + and an determine if a given point is inside the combined clipping rectangle. + */ + class OffsetTracker { + constructor(el) { + this.origRect = computeRect(el); + // will work fine for divs that have overflow:hidden + this.scrollCaches = getClippingParents(el).map((scrollEl) => new ElementScrollGeomCache(scrollEl, true)); + } + destroy() { + for (let scrollCache of this.scrollCaches) { + scrollCache.destroy(); + } + } + computeLeft() { + let left = this.origRect.left; + for (let scrollCache of this.scrollCaches) { + left += scrollCache.origScrollLeft - scrollCache.getScrollLeft(); + } + return left; + } + computeTop() { + let top = this.origRect.top; + for (let scrollCache of this.scrollCaches) { + top += scrollCache.origScrollTop - scrollCache.getScrollTop(); + } + return top; + } + isWithinClipping(pageX, pageY) { + let point = { left: pageX, top: pageY }; + for (let scrollCache of this.scrollCaches) { + if (!isIgnoredClipping(scrollCache.getEventTarget()) && + !pointInsideRect(point, scrollCache.clientRect)) { + return false; + } + } + return true; + } + } + // certain clipping containers should never constrain interactions, like <html> and <body> + // https://github.com/fullcalendar/fullcalendar/issues/3615 + function isIgnoredClipping(node) { + let tagName = node.tagName; + return tagName === 'HTML' || tagName === 'BODY'; + } + + /* + Tracks movement over multiple droppable areas (aka "hits") + that exist in one or more DateComponents. + Relies on an existing draggable. + + emits: + - pointerdown + - dragstart + - hitchange - fires initially, even if not over a hit + - pointerup + - (hitchange - again, to null, if ended over a hit) + - dragend + */ + class HitDragging { + constructor(dragging, droppableStore) { + // options that can be set by caller + this.useSubjectCenter = false; + this.requireInitial = true; // if doesn't start out on a hit, won't emit any events + this.initialHit = null; + this.movingHit = null; + this.finalHit = null; // won't ever be populated if shouldIgnoreMove + this.handlePointerDown = (ev) => { + let { dragging } = this; + this.initialHit = null; + this.movingHit = null; + this.finalHit = null; + this.prepareHits(); + this.processFirstCoord(ev); + if (this.initialHit || !this.requireInitial) { + dragging.setIgnoreMove(false); + // TODO: fire this before computing processFirstCoord, so listeners can cancel. this gets fired by almost every handler :( + this.emitter.trigger('pointerdown', ev); + } + else { + dragging.setIgnoreMove(true); + } + }; + this.handleDragStart = (ev) => { + this.emitter.trigger('dragstart', ev); + this.handleMove(ev, true); // force = fire even if initially null + }; + this.handleDragMove = (ev) => { + this.emitter.trigger('dragmove', ev); + this.handleMove(ev); + }; + this.handlePointerUp = (ev) => { + this.releaseHits(); + this.emitter.trigger('pointerup', ev); + }; + this.handleDragEnd = (ev) => { + if (this.movingHit) { + this.emitter.trigger('hitupdate', null, true, ev); + } + this.finalHit = this.movingHit; + this.movingHit = null; + this.emitter.trigger('dragend', ev); + }; + this.droppableStore = droppableStore; + dragging.emitter.on('pointerdown', this.handlePointerDown); + dragging.emitter.on('dragstart', this.handleDragStart); + dragging.emitter.on('dragmove', this.handleDragMove); + dragging.emitter.on('pointerup', this.handlePointerUp); + dragging.emitter.on('dragend', this.handleDragEnd); + this.dragging = dragging; + this.emitter = new Emitter(); + } + // sets initialHit + // sets coordAdjust + processFirstCoord(ev) { + let origPoint = { left: ev.pageX, top: ev.pageY }; + let adjustedPoint = origPoint; + let subjectEl = ev.subjectEl; + let subjectRect; + if (subjectEl instanceof HTMLElement) { // i.e. not a Document/ShadowRoot + subjectRect = computeRect(subjectEl); + adjustedPoint = constrainPoint(adjustedPoint, subjectRect); + } + let initialHit = this.initialHit = this.queryHitForOffset(adjustedPoint.left, adjustedPoint.top); + if (initialHit) { + if (this.useSubjectCenter && subjectRect) { + let slicedSubjectRect = intersectRects(subjectRect, initialHit.rect); + if (slicedSubjectRect) { + adjustedPoint = getRectCenter(slicedSubjectRect); + } + } + this.coordAdjust = diffPoints(adjustedPoint, origPoint); + } + else { + this.coordAdjust = { left: 0, top: 0 }; + } + } + handleMove(ev, forceHandle) { + let hit = this.queryHitForOffset(ev.pageX + this.coordAdjust.left, ev.pageY + this.coordAdjust.top); + if (forceHandle || !isHitsEqual(this.movingHit, hit)) { + this.movingHit = hit; + this.emitter.trigger('hitupdate', hit, false, ev); + } + } + prepareHits() { + this.offsetTrackers = mapHash(this.droppableStore, (interactionSettings) => { + interactionSettings.component.prepareHits(); + return new OffsetTracker(interactionSettings.el); + }); + } + releaseHits() { + let { offsetTrackers } = this; + for (let id in offsetTrackers) { + offsetTrackers[id].destroy(); + } + this.offsetTrackers = {}; + } + queryHitForOffset(offsetLeft, offsetTop) { + let { droppableStore, offsetTrackers } = this; + let bestHit = null; + for (let id in droppableStore) { + let component = droppableStore[id].component; + let offsetTracker = offsetTrackers[id]; + if (offsetTracker && // wasn't destroyed mid-drag + offsetTracker.isWithinClipping(offsetLeft, offsetTop)) { + let originLeft = offsetTracker.computeLeft(); + let originTop = offsetTracker.computeTop(); + let positionLeft = offsetLeft - originLeft; + let positionTop = offsetTop - originTop; + let { origRect } = offsetTracker; + let width = origRect.right - origRect.left; + let height = origRect.bottom - origRect.top; + if ( + // must be within the element's bounds + positionLeft >= 0 && positionLeft < width && + positionTop >= 0 && positionTop < height) { + let hit = component.queryHit(positionLeft, positionTop, width, height); + if (hit && ( + // make sure the hit is within activeRange, meaning it's not a dead cell + rangeContainsRange(hit.dateProfile.activeRange, hit.dateSpan.range)) && + (!bestHit || hit.layer > bestHit.layer)) { + hit.componentId = id; + hit.context = component.context; + // TODO: better way to re-orient rectangle + hit.rect.left += originLeft; + hit.rect.right += originLeft; + hit.rect.top += originTop; + hit.rect.bottom += originTop; + bestHit = hit; + } + } + } + } + return bestHit; + } + } + function isHitsEqual(hit0, hit1) { + if (!hit0 && !hit1) { + return true; + } + if (Boolean(hit0) !== Boolean(hit1)) { + return false; + } + return isDateSpansEqual(hit0.dateSpan, hit1.dateSpan); + } + + function buildDatePointApiWithContext(dateSpan, context) { + let props = {}; + for (let transform of context.pluginHooks.datePointTransforms) { + Object.assign(props, transform(dateSpan, context)); + } + Object.assign(props, buildDatePointApi(dateSpan, context.dateEnv)); + return props; + } + function buildDatePointApi(span, dateEnv) { + return { + date: dateEnv.toDate(span.range.start), + dateStr: dateEnv.formatIso(span.range.start, { omitTime: span.allDay }), + allDay: span.allDay, + }; + } + + /* + Monitors when the user clicks on a specific date/time of a component. + A pointerdown+pointerup on the same "hit" constitutes a click. + */ + class DateClicking extends Interaction { + constructor(settings) { + super(settings); + this.handlePointerDown = (pev) => { + let { dragging } = this; + let downEl = pev.origEvent.target; + // do this in pointerdown (not dragend) because DOM might be mutated by the time dragend is fired + dragging.setIgnoreMove(!this.component.isValidDateDownEl(downEl)); + }; + // won't even fire if moving was ignored + this.handleDragEnd = (ev) => { + let { component } = this; + let { pointer } = this.dragging; + if (!pointer.wasTouchScroll) { + let { initialHit, finalHit } = this.hitDragging; + if (initialHit && finalHit && isHitsEqual(initialHit, finalHit)) { + let { context } = component; + let arg = Object.assign(Object.assign({}, buildDatePointApiWithContext(initialHit.dateSpan, context)), { dayEl: initialHit.dayEl, jsEvent: ev.origEvent, view: context.viewApi || context.calendarApi.view }); + context.emitter.trigger('dateClick', arg); + } + } + }; + // we DO want to watch pointer moves because otherwise finalHit won't get populated + this.dragging = new FeaturefulElementDragging(settings.el); + this.dragging.autoScroller.isEnabled = false; + let hitDragging = this.hitDragging = new HitDragging(this.dragging, interactionSettingsToStore(settings)); + hitDragging.emitter.on('pointerdown', this.handlePointerDown); + hitDragging.emitter.on('dragend', this.handleDragEnd); + } + destroy() { + this.dragging.destroy(); + } + } + + /* + Tracks when the user selects a portion of time of a component, + constituted by a drag over date cells, with a possible delay at the beginning of the drag. + */ + class DateSelecting extends Interaction { + constructor(settings) { + super(settings); + this.dragSelection = null; + this.handlePointerDown = (ev) => { + let { component, dragging } = this; + let { options } = component.context; + let canSelect = options.selectable && + component.isValidDateDownEl(ev.origEvent.target); + // don't bother to watch expensive moves if component won't do selection + dragging.setIgnoreMove(!canSelect); + // if touch, require user to hold down + dragging.delay = ev.isTouch ? getComponentTouchDelay$1(component) : null; + }; + this.handleDragStart = (ev) => { + this.component.context.calendarApi.unselect(ev); // unselect previous selections + }; + this.handleHitUpdate = (hit, isFinal) => { + let { context } = this.component; + let dragSelection = null; + let isInvalid = false; + if (hit) { + let initialHit = this.hitDragging.initialHit; + let disallowed = hit.componentId === initialHit.componentId + && this.isHitComboAllowed + && !this.isHitComboAllowed(initialHit, hit); + if (!disallowed) { + dragSelection = joinHitsIntoSelection(initialHit, hit, context.pluginHooks.dateSelectionTransformers); + } + if (!dragSelection || !isDateSelectionValid(dragSelection, hit.dateProfile, context)) { + isInvalid = true; + dragSelection = null; + } + } + if (dragSelection) { + context.dispatch({ type: 'SELECT_DATES', selection: dragSelection }); + } + else if (!isFinal) { // only unselect if moved away while dragging + context.dispatch({ type: 'UNSELECT_DATES' }); + } + if (!isInvalid) { + enableCursor(); + } + else { + disableCursor(); + } + if (!isFinal) { + this.dragSelection = dragSelection; // only clear if moved away from all hits while dragging + } + }; + this.handlePointerUp = (pev) => { + if (this.dragSelection) { + // selection is already rendered, so just need to report selection + triggerDateSelect(this.dragSelection, pev, this.component.context); + this.dragSelection = null; + } + }; + let { component } = settings; + let { options } = component.context; + let dragging = this.dragging = new FeaturefulElementDragging(settings.el); + dragging.touchScrollAllowed = false; + dragging.minDistance = options.selectMinDistance || 0; + dragging.autoScroller.isEnabled = options.dragScroll; + let hitDragging = this.hitDragging = new HitDragging(this.dragging, interactionSettingsToStore(settings)); + hitDragging.emitter.on('pointerdown', this.handlePointerDown); + hitDragging.emitter.on('dragstart', this.handleDragStart); + hitDragging.emitter.on('hitupdate', this.handleHitUpdate); + hitDragging.emitter.on('pointerup', this.handlePointerUp); + } + destroy() { + this.dragging.destroy(); + } + } + function getComponentTouchDelay$1(component) { + let { options } = component.context; + let delay = options.selectLongPressDelay; + if (delay == null) { + delay = options.longPressDelay; + } + return delay; + } + function joinHitsIntoSelection(hit0, hit1, dateSelectionTransformers) { + let dateSpan0 = hit0.dateSpan; + let dateSpan1 = hit1.dateSpan; + let ms = [ + dateSpan0.range.start, + dateSpan0.range.end, + dateSpan1.range.start, + dateSpan1.range.end, + ]; + ms.sort(compareNumbers); + let props = {}; + for (let transformer of dateSelectionTransformers) { + let res = transformer(hit0, hit1); + if (res === false) { + return null; + } + if (res) { + Object.assign(props, res); + } + } + props.range = { start: ms[0], end: ms[3] }; + props.allDay = dateSpan0.allDay; + return props; + } + + class EventDragging extends Interaction { + constructor(settings) { + super(settings); + // internal state + this.subjectEl = null; + this.subjectSeg = null; // the seg being selected/dragged + this.isDragging = false; + this.eventRange = null; + this.relevantEvents = null; // the events being dragged + this.receivingContext = null; + this.validMutation = null; + this.mutatedRelevantEvents = null; + this.handlePointerDown = (ev) => { + let origTarget = ev.origEvent.target; + let { component, dragging } = this; + let { mirror } = dragging; + let { options } = component.context; + let initialContext = component.context; + this.subjectEl = ev.subjectEl; + let subjectSeg = this.subjectSeg = getElSeg(ev.subjectEl); + let eventRange = this.eventRange = subjectSeg.eventRange; + let eventInstanceId = eventRange.instance.instanceId; + this.relevantEvents = getRelevantEvents(initialContext.getCurrentData().eventStore, eventInstanceId); + dragging.minDistance = ev.isTouch ? 0 : options.eventDragMinDistance; + dragging.delay = + // only do a touch delay if touch and this event hasn't been selected yet + (ev.isTouch && eventInstanceId !== component.props.eventSelection) ? + getComponentTouchDelay(component) : + null; + if (options.fixedMirrorParent) { + mirror.parentNode = options.fixedMirrorParent; + } + else { + mirror.parentNode = elementClosest(origTarget, '.fc'); + } + mirror.revertDuration = options.dragRevertDuration; + let isValid = component.isValidSegDownEl(origTarget) && + !elementClosest(origTarget, '.fc-event-resizer'); // NOT on a resizer + dragging.setIgnoreMove(!isValid); + // disable dragging for elements that are resizable (ie, selectable) + // but are not draggable + this.isDragging = isValid && + ev.subjectEl.classList.contains('fc-event-draggable'); + }; + this.handleDragStart = (ev) => { + let initialContext = this.component.context; + let eventRange = this.eventRange; + let eventInstanceId = eventRange.instance.instanceId; + if (ev.isTouch) { + // need to select a different event? + if (eventInstanceId !== this.component.props.eventSelection) { + initialContext.dispatch({ type: 'SELECT_EVENT', eventInstanceId }); + } + } + else { + // if now using mouse, but was previous touch interaction, clear selected event + initialContext.dispatch({ type: 'UNSELECT_EVENT' }); + } + if (this.isDragging) { + initialContext.calendarApi.unselect(ev); // unselect *date* selection + initialContext.emitter.trigger('eventDragStart', { + el: this.subjectEl, + event: new EventImpl(initialContext, eventRange.def, eventRange.instance), + jsEvent: ev.origEvent, + view: initialContext.viewApi, + }); + } + }; + this.handleHitUpdate = (hit, isFinal) => { + if (!this.isDragging) { + return; + } + let relevantEvents = this.relevantEvents; + let initialHit = this.hitDragging.initialHit; + let initialContext = this.component.context; + // states based on new hit + let receivingContext = null; + let mutation = null; + let mutatedRelevantEvents = null; + let isInvalid = false; + let interaction = { + affectedEvents: relevantEvents, + mutatedEvents: createEmptyEventStore(), + isEvent: true, + }; + if (hit) { + receivingContext = hit.context; + let receivingOptions = receivingContext.options; + if (initialContext === receivingContext || + (receivingOptions.editable && receivingOptions.droppable)) { + mutation = computeEventMutation(initialHit, hit, receivingContext.getCurrentData().pluginHooks.eventDragMutationMassagers); + if (mutation) { + mutatedRelevantEvents = applyMutationToEventStore(relevantEvents, receivingContext.getCurrentData().eventUiBases, mutation, receivingContext); + interaction.mutatedEvents = mutatedRelevantEvents; + if (!isInteractionValid(interaction, hit.dateProfile, receivingContext)) { + isInvalid = true; + mutation = null; + mutatedRelevantEvents = null; + interaction.mutatedEvents = createEmptyEventStore(); + } + } + } + else { + receivingContext = null; + } + } + this.displayDrag(receivingContext, interaction); + if (!isInvalid) { + enableCursor(); + } + else { + disableCursor(); + } + if (!isFinal) { + if (initialContext === receivingContext && // TODO: write test for this + isHitsEqual(initialHit, hit)) { + mutation = null; + } + this.dragging.setMirrorNeedsRevert(!mutation); + // render the mirror if no already-rendered mirror + // TODO: wish we could somehow wait for dispatch to guarantee render + this.dragging.setMirrorIsVisible(!hit || !getElRoot(this.subjectEl).querySelector('.fc-event-mirror')); + // assign states based on new hit + this.receivingContext = receivingContext; + this.validMutation = mutation; + this.mutatedRelevantEvents = mutatedRelevantEvents; + } + }; + this.handlePointerUp = () => { + if (!this.isDragging) { + this.cleanup(); // because handleDragEnd won't fire + } + }; + this.handleDragEnd = (ev) => { + if (this.isDragging) { + let initialContext = this.component.context; + let initialView = initialContext.viewApi; + let { receivingContext, validMutation } = this; + let eventDef = this.eventRange.def; + let eventInstance = this.eventRange.instance; + let eventApi = new EventImpl(initialContext, eventDef, eventInstance); + let relevantEvents = this.relevantEvents; + let mutatedRelevantEvents = this.mutatedRelevantEvents; + let { finalHit } = this.hitDragging; + this.clearDrag(); // must happen after revert animation + initialContext.emitter.trigger('eventDragStop', { + el: this.subjectEl, + event: eventApi, + jsEvent: ev.origEvent, + view: initialView, + }); + if (validMutation) { + // dropped within same calendar + if (receivingContext === initialContext) { + let updatedEventApi = new EventImpl(initialContext, mutatedRelevantEvents.defs[eventDef.defId], eventInstance ? mutatedRelevantEvents.instances[eventInstance.instanceId] : null); + initialContext.dispatch({ + type: 'MERGE_EVENTS', + eventStore: mutatedRelevantEvents, + }); + let eventChangeArg = { + oldEvent: eventApi, + event: updatedEventApi, + relatedEvents: buildEventApis(mutatedRelevantEvents, initialContext, eventInstance), + revert() { + initialContext.dispatch({ + type: 'MERGE_EVENTS', + eventStore: relevantEvents, // the pre-change data + }); + }, + }; + let transformed = {}; + for (let transformer of initialContext.getCurrentData().pluginHooks.eventDropTransformers) { + Object.assign(transformed, transformer(validMutation, initialContext)); + } + initialContext.emitter.trigger('eventDrop', Object.assign(Object.assign(Object.assign({}, eventChangeArg), transformed), { el: ev.subjectEl, delta: validMutation.datesDelta, jsEvent: ev.origEvent, view: initialView })); + initialContext.emitter.trigger('eventChange', eventChangeArg); + // dropped in different calendar + } + else if (receivingContext) { + let eventRemoveArg = { + event: eventApi, + relatedEvents: buildEventApis(relevantEvents, initialContext, eventInstance), + revert() { + initialContext.dispatch({ + type: 'MERGE_EVENTS', + eventStore: relevantEvents, + }); + }, + }; + initialContext.emitter.trigger('eventLeave', Object.assign(Object.assign({}, eventRemoveArg), { draggedEl: ev.subjectEl, view: initialView })); + initialContext.dispatch({ + type: 'REMOVE_EVENTS', + eventStore: relevantEvents, + }); + initialContext.emitter.trigger('eventRemove', eventRemoveArg); + let addedEventDef = mutatedRelevantEvents.defs[eventDef.defId]; + let addedEventInstance = mutatedRelevantEvents.instances[eventInstance.instanceId]; + let addedEventApi = new EventImpl(receivingContext, addedEventDef, addedEventInstance); + receivingContext.dispatch({ + type: 'MERGE_EVENTS', + eventStore: mutatedRelevantEvents, + }); + let eventAddArg = { + event: addedEventApi, + relatedEvents: buildEventApis(mutatedRelevantEvents, receivingContext, addedEventInstance), + revert() { + receivingContext.dispatch({ + type: 'REMOVE_EVENTS', + eventStore: mutatedRelevantEvents, + }); + }, + }; + receivingContext.emitter.trigger('eventAdd', eventAddArg); + if (ev.isTouch) { + receivingContext.dispatch({ + type: 'SELECT_EVENT', + eventInstanceId: eventInstance.instanceId, + }); + } + receivingContext.emitter.trigger('drop', Object.assign(Object.assign({}, buildDatePointApiWithContext(finalHit.dateSpan, receivingContext)), { draggedEl: ev.subjectEl, jsEvent: ev.origEvent, view: finalHit.context.viewApi })); + receivingContext.emitter.trigger('eventReceive', Object.assign(Object.assign({}, eventAddArg), { draggedEl: ev.subjectEl, view: finalHit.context.viewApi })); + } + } + else { + initialContext.emitter.trigger('_noEventDrop'); + } + } + this.cleanup(); + }; + let { component } = this; + let { options } = component.context; + let dragging = this.dragging = new FeaturefulElementDragging(settings.el); + dragging.pointer.selector = EventDragging.SELECTOR; + dragging.touchScrollAllowed = false; + dragging.autoScroller.isEnabled = options.dragScroll; + let hitDragging = this.hitDragging = new HitDragging(this.dragging, interactionSettingsStore); + hitDragging.useSubjectCenter = settings.useEventCenter; + hitDragging.emitter.on('pointerdown', this.handlePointerDown); + hitDragging.emitter.on('dragstart', this.handleDragStart); + hitDragging.emitter.on('hitupdate', this.handleHitUpdate); + hitDragging.emitter.on('pointerup', this.handlePointerUp); + hitDragging.emitter.on('dragend', this.handleDragEnd); + } + destroy() { + this.dragging.destroy(); + } + // render a drag state on the next receivingCalendar + displayDrag(nextContext, state) { + let initialContext = this.component.context; + let prevContext = this.receivingContext; + // does the previous calendar need to be cleared? + if (prevContext && prevContext !== nextContext) { + // does the initial calendar need to be cleared? + // if so, don't clear all the way. we still need to to hide the affectedEvents + if (prevContext === initialContext) { + prevContext.dispatch({ + type: 'SET_EVENT_DRAG', + state: { + affectedEvents: state.affectedEvents, + mutatedEvents: createEmptyEventStore(), + isEvent: true, + }, + }); + // completely clear the old calendar if it wasn't the initial + } + else { + prevContext.dispatch({ type: 'UNSET_EVENT_DRAG' }); + } + } + if (nextContext) { + nextContext.dispatch({ type: 'SET_EVENT_DRAG', state }); + } + } + clearDrag() { + let initialCalendar = this.component.context; + let { receivingContext } = this; + if (receivingContext) { + receivingContext.dispatch({ type: 'UNSET_EVENT_DRAG' }); + } + // the initial calendar might have an dummy drag state from displayDrag + if (initialCalendar !== receivingContext) { + initialCalendar.dispatch({ type: 'UNSET_EVENT_DRAG' }); + } + } + cleanup() { + this.subjectSeg = null; + this.isDragging = false; + this.eventRange = null; + this.relevantEvents = null; + this.receivingContext = null; + this.validMutation = null; + this.mutatedRelevantEvents = null; + } + } + // TODO: test this in IE11 + // QUESTION: why do we need it on the resizable??? + EventDragging.SELECTOR = '.fc-event-draggable, .fc-event-resizable'; + function computeEventMutation(hit0, hit1, massagers) { + let dateSpan0 = hit0.dateSpan; + let dateSpan1 = hit1.dateSpan; + let date0 = dateSpan0.range.start; + let date1 = dateSpan1.range.start; + let standardProps = {}; + if (dateSpan0.allDay !== dateSpan1.allDay) { + standardProps.allDay = dateSpan1.allDay; + standardProps.hasEnd = hit1.context.options.allDayMaintainDuration; + if (dateSpan1.allDay) { + // means date1 is already start-of-day, + // but date0 needs to be converted + date0 = startOfDay(date0); + } + } + let delta = diffDates(date0, date1, hit0.context.dateEnv, hit0.componentId === hit1.componentId ? + hit0.largeUnit : + null); + if (delta.milliseconds) { // has hours/minutes/seconds + standardProps.allDay = false; + } + let mutation = { + datesDelta: delta, + standardProps, + }; + for (let massager of massagers) { + massager(mutation, hit0, hit1); + } + return mutation; + } + function getComponentTouchDelay(component) { + let { options } = component.context; + let delay = options.eventLongPressDelay; + if (delay == null) { + delay = options.longPressDelay; + } + return delay; + } + + class EventResizing extends Interaction { + constructor(settings) { + super(settings); + // internal state + this.draggingSegEl = null; + this.draggingSeg = null; // TODO: rename to resizingSeg? subjectSeg? + this.eventRange = null; + this.relevantEvents = null; + this.validMutation = null; + this.mutatedRelevantEvents = null; + this.handlePointerDown = (ev) => { + let { component } = this; + let segEl = this.querySegEl(ev); + let seg = getElSeg(segEl); + let eventRange = this.eventRange = seg.eventRange; + this.dragging.minDistance = component.context.options.eventDragMinDistance; + // if touch, need to be working with a selected event + this.dragging.setIgnoreMove(!this.component.isValidSegDownEl(ev.origEvent.target) || + (ev.isTouch && this.component.props.eventSelection !== eventRange.instance.instanceId)); + }; + this.handleDragStart = (ev) => { + let { context } = this.component; + let eventRange = this.eventRange; + this.relevantEvents = getRelevantEvents(context.getCurrentData().eventStore, this.eventRange.instance.instanceId); + let segEl = this.querySegEl(ev); + this.draggingSegEl = segEl; + this.draggingSeg = getElSeg(segEl); + context.calendarApi.unselect(); + context.emitter.trigger('eventResizeStart', { + el: segEl, + event: new EventImpl(context, eventRange.def, eventRange.instance), + jsEvent: ev.origEvent, + view: context.viewApi, + }); + }; + this.handleHitUpdate = (hit, isFinal, ev) => { + let { context } = this.component; + let relevantEvents = this.relevantEvents; + let initialHit = this.hitDragging.initialHit; + let eventInstance = this.eventRange.instance; + let mutation = null; + let mutatedRelevantEvents = null; + let isInvalid = false; + let interaction = { + affectedEvents: relevantEvents, + mutatedEvents: createEmptyEventStore(), + isEvent: true, + }; + if (hit) { + let disallowed = hit.componentId === initialHit.componentId + && this.isHitComboAllowed + && !this.isHitComboAllowed(initialHit, hit); + if (!disallowed) { + mutation = computeMutation(initialHit, hit, ev.subjectEl.classList.contains('fc-event-resizer-start'), eventInstance.range); + } + } + if (mutation) { + mutatedRelevantEvents = applyMutationToEventStore(relevantEvents, context.getCurrentData().eventUiBases, mutation, context); + interaction.mutatedEvents = mutatedRelevantEvents; + if (!isInteractionValid(interaction, hit.dateProfile, context)) { + isInvalid = true; + mutation = null; + mutatedRelevantEvents = null; + interaction.mutatedEvents = null; + } + } + if (mutatedRelevantEvents) { + context.dispatch({ + type: 'SET_EVENT_RESIZE', + state: interaction, + }); + } + else { + context.dispatch({ type: 'UNSET_EVENT_RESIZE' }); + } + if (!isInvalid) { + enableCursor(); + } + else { + disableCursor(); + } + if (!isFinal) { + if (mutation && isHitsEqual(initialHit, hit)) { + mutation = null; + } + this.validMutation = mutation; + this.mutatedRelevantEvents = mutatedRelevantEvents; + } + }; + this.handleDragEnd = (ev) => { + let { context } = this.component; + let eventDef = this.eventRange.def; + let eventInstance = this.eventRange.instance; + let eventApi = new EventImpl(context, eventDef, eventInstance); + let relevantEvents = this.relevantEvents; + let mutatedRelevantEvents = this.mutatedRelevantEvents; + context.emitter.trigger('eventResizeStop', { + el: this.draggingSegEl, + event: eventApi, + jsEvent: ev.origEvent, + view: context.viewApi, + }); + if (this.validMutation) { + let updatedEventApi = new EventImpl(context, mutatedRelevantEvents.defs[eventDef.defId], eventInstance ? mutatedRelevantEvents.instances[eventInstance.instanceId] : null); + context.dispatch({ + type: 'MERGE_EVENTS', + eventStore: mutatedRelevantEvents, + }); + let eventChangeArg = { + oldEvent: eventApi, + event: updatedEventApi, + relatedEvents: buildEventApis(mutatedRelevantEvents, context, eventInstance), + revert() { + context.dispatch({ + type: 'MERGE_EVENTS', + eventStore: relevantEvents, // the pre-change events + }); + }, + }; + context.emitter.trigger('eventResize', Object.assign(Object.assign({}, eventChangeArg), { el: this.draggingSegEl, startDelta: this.validMutation.startDelta || createDuration(0), endDelta: this.validMutation.endDelta || createDuration(0), jsEvent: ev.origEvent, view: context.viewApi })); + context.emitter.trigger('eventChange', eventChangeArg); + } + else { + context.emitter.trigger('_noEventResize'); + } + // reset all internal state + this.draggingSeg = null; + this.relevantEvents = null; + this.validMutation = null; + // okay to keep eventInstance around. useful to set it in handlePointerDown + }; + let { component } = settings; + let dragging = this.dragging = new FeaturefulElementDragging(settings.el); + dragging.pointer.selector = '.fc-event-resizer'; + dragging.touchScrollAllowed = false; + dragging.autoScroller.isEnabled = component.context.options.dragScroll; + let hitDragging = this.hitDragging = new HitDragging(this.dragging, interactionSettingsToStore(settings)); + hitDragging.emitter.on('pointerdown', this.handlePointerDown); + hitDragging.emitter.on('dragstart', this.handleDragStart); + hitDragging.emitter.on('hitupdate', this.handleHitUpdate); + hitDragging.emitter.on('dragend', this.handleDragEnd); + } + destroy() { + this.dragging.destroy(); + } + querySegEl(ev) { + return elementClosest(ev.subjectEl, '.fc-event'); + } + } + function computeMutation(hit0, hit1, isFromStart, instanceRange) { + let dateEnv = hit0.context.dateEnv; + let date0 = hit0.dateSpan.range.start; + let date1 = hit1.dateSpan.range.start; + let delta = diffDates(date0, date1, dateEnv, hit0.largeUnit); + if (isFromStart) { + if (dateEnv.add(instanceRange.start, delta) < instanceRange.end) { + return { startDelta: delta }; + } + } + else if (dateEnv.add(instanceRange.end, delta) > instanceRange.start) { + return { endDelta: delta }; + } + return null; + } + + class UnselectAuto { + constructor(context) { + this.context = context; + this.isRecentPointerDateSelect = false; // wish we could use a selector to detect date selection, but uses hit system + this.matchesCancel = false; + this.matchesEvent = false; + this.onSelect = (selectInfo) => { + if (selectInfo.jsEvent) { + this.isRecentPointerDateSelect = true; + } + }; + this.onDocumentPointerDown = (pev) => { + let unselectCancel = this.context.options.unselectCancel; + let downEl = getEventTargetViaRoot(pev.origEvent); + this.matchesCancel = !!elementClosest(downEl, unselectCancel); + this.matchesEvent = !!elementClosest(downEl, EventDragging.SELECTOR); // interaction started on an event? + }; + this.onDocumentPointerUp = (pev) => { + let { context } = this; + let { documentPointer } = this; + let calendarState = context.getCurrentData(); + // touch-scrolling should never unfocus any type of selection + if (!documentPointer.wasTouchScroll) { + if (calendarState.dateSelection && // an existing date selection? + !this.isRecentPointerDateSelect // a new pointer-initiated date selection since last onDocumentPointerUp? + ) { + let unselectAuto = context.options.unselectAuto; + if (unselectAuto && (!unselectAuto || !this.matchesCancel)) { + context.calendarApi.unselect(pev); + } + } + if (calendarState.eventSelection && // an existing event selected? + !this.matchesEvent // interaction DIDN'T start on an event + ) { + context.dispatch({ type: 'UNSELECT_EVENT' }); + } + } + this.isRecentPointerDateSelect = false; + }; + let documentPointer = this.documentPointer = new PointerDragging(document); + documentPointer.shouldIgnoreMove = true; + documentPointer.shouldWatchScroll = false; + documentPointer.emitter.on('pointerdown', this.onDocumentPointerDown); + documentPointer.emitter.on('pointerup', this.onDocumentPointerUp); + /* + TODO: better way to know about whether there was a selection with the pointer + */ + context.emitter.on('select', this.onSelect); + } + destroy() { + this.context.emitter.off('select', this.onSelect); + this.documentPointer.destroy(); + } + } + + const OPTION_REFINERS$4 = { + fixedMirrorParent: identity, + }; + const LISTENER_REFINERS$1 = { + dateClick: identity, + eventDragStart: identity, + eventDragStop: identity, + eventDrop: identity, + eventResizeStart: identity, + eventResizeStop: identity, + eventResize: identity, + drop: identity, + eventReceive: identity, + eventLeave: identity, + }; + + /* + Given an already instantiated draggable object for one-or-more elements, + Interprets any dragging as an attempt to drag an events that lives outside + of a calendar onto a calendar. + */ + class ExternalElementDragging { + constructor(dragging, suppliedDragMeta) { + this.receivingContext = null; + this.droppableEvent = null; // will exist for all drags, even if create:false + this.suppliedDragMeta = null; + this.dragMeta = null; + this.handleDragStart = (ev) => { + this.dragMeta = this.buildDragMeta(ev.subjectEl); + }; + this.handleHitUpdate = (hit, isFinal, ev) => { + let { dragging } = this.hitDragging; + let receivingContext = null; + let droppableEvent = null; + let isInvalid = false; + let interaction = { + affectedEvents: createEmptyEventStore(), + mutatedEvents: createEmptyEventStore(), + isEvent: this.dragMeta.create, + }; + if (hit) { + receivingContext = hit.context; + if (this.canDropElOnCalendar(ev.subjectEl, receivingContext)) { + droppableEvent = computeEventForDateSpan(hit.dateSpan, this.dragMeta, receivingContext); + interaction.mutatedEvents = eventTupleToStore(droppableEvent); + isInvalid = !isInteractionValid(interaction, hit.dateProfile, receivingContext); + if (isInvalid) { + interaction.mutatedEvents = createEmptyEventStore(); + droppableEvent = null; + } + } + } + this.displayDrag(receivingContext, interaction); + // show mirror if no already-rendered mirror element OR if we are shutting down the mirror (?) + // TODO: wish we could somehow wait for dispatch to guarantee render + dragging.setMirrorIsVisible(isFinal || !droppableEvent || !document.querySelector('.fc-event-mirror')); + if (!isInvalid) { + enableCursor(); + } + else { + disableCursor(); + } + if (!isFinal) { + dragging.setMirrorNeedsRevert(!droppableEvent); + this.receivingContext = receivingContext; + this.droppableEvent = droppableEvent; + } + }; + this.handleDragEnd = (pev) => { + let { receivingContext, droppableEvent } = this; + this.clearDrag(); + if (receivingContext && droppableEvent) { + let finalHit = this.hitDragging.finalHit; + let finalView = finalHit.context.viewApi; + let dragMeta = this.dragMeta; + receivingContext.emitter.trigger('drop', Object.assign(Object.assign({}, buildDatePointApiWithContext(finalHit.dateSpan, receivingContext)), { draggedEl: pev.subjectEl, jsEvent: pev.origEvent, view: finalView })); + if (dragMeta.create) { + let addingEvents = eventTupleToStore(droppableEvent); + receivingContext.dispatch({ + type: 'MERGE_EVENTS', + eventStore: addingEvents, + }); + if (pev.isTouch) { + receivingContext.dispatch({ + type: 'SELECT_EVENT', + eventInstanceId: droppableEvent.instance.instanceId, + }); + } + // signal that an external event landed + receivingContext.emitter.trigger('eventReceive', { + event: new EventImpl(receivingContext, droppableEvent.def, droppableEvent.instance), + relatedEvents: [], + revert() { + receivingContext.dispatch({ + type: 'REMOVE_EVENTS', + eventStore: addingEvents, + }); + }, + draggedEl: pev.subjectEl, + view: finalView, + }); + } + } + this.receivingContext = null; + this.droppableEvent = null; + }; + let hitDragging = this.hitDragging = new HitDragging(dragging, interactionSettingsStore); + hitDragging.requireInitial = false; // will start outside of a component + hitDragging.emitter.on('dragstart', this.handleDragStart); + hitDragging.emitter.on('hitupdate', this.handleHitUpdate); + hitDragging.emitter.on('dragend', this.handleDragEnd); + this.suppliedDragMeta = suppliedDragMeta; + } + buildDragMeta(subjectEl) { + if (typeof this.suppliedDragMeta === 'object') { + return parseDragMeta(this.suppliedDragMeta); + } + if (typeof this.suppliedDragMeta === 'function') { + return parseDragMeta(this.suppliedDragMeta(subjectEl)); + } + return getDragMetaFromEl(subjectEl); + } + displayDrag(nextContext, state) { + let prevContext = this.receivingContext; + if (prevContext && prevContext !== nextContext) { + prevContext.dispatch({ type: 'UNSET_EVENT_DRAG' }); + } + if (nextContext) { + nextContext.dispatch({ type: 'SET_EVENT_DRAG', state }); + } + } + clearDrag() { + if (this.receivingContext) { + this.receivingContext.dispatch({ type: 'UNSET_EVENT_DRAG' }); + } + } + canDropElOnCalendar(el, receivingContext) { + let dropAccept = receivingContext.options.dropAccept; + if (typeof dropAccept === 'function') { + return dropAccept.call(receivingContext.calendarApi, el); + } + if (typeof dropAccept === 'string' && dropAccept) { + return Boolean(elementMatches(el, dropAccept)); + } + return true; + } + } + // Utils for computing event store from the DragMeta + // ---------------------------------------------------------------------------------------------------- + function computeEventForDateSpan(dateSpan, dragMeta, context) { + let defProps = Object.assign({}, dragMeta.leftoverProps); + for (let transform of context.pluginHooks.externalDefTransforms) { + Object.assign(defProps, transform(dateSpan, dragMeta)); + } + let { refined, extra } = refineEventDef(defProps, context); + let def = parseEventDef(refined, extra, dragMeta.sourceId, dateSpan.allDay, context.options.forceEventDuration || Boolean(dragMeta.duration), // hasEnd + context); + let start = dateSpan.range.start; + // only rely on time info if drop zone is all-day, + // otherwise, we already know the time + if (dateSpan.allDay && dragMeta.startTime) { + start = context.dateEnv.add(start, dragMeta.startTime); + } + let end = dragMeta.duration ? + context.dateEnv.add(start, dragMeta.duration) : + getDefaultEventEnd(dateSpan.allDay, start, context); + let instance = createEventInstance(def.defId, { start, end }); + return { def, instance }; + } + // Utils for extracting data from element + // ---------------------------------------------------------------------------------------------------- + function getDragMetaFromEl(el) { + let str = getEmbeddedElData(el, 'event'); + let obj = str ? + JSON.parse(str) : + { create: false }; // if no embedded data, assume no event creation + return parseDragMeta(obj); + } + config.dataAttrPrefix = ''; + function getEmbeddedElData(el, name) { + let prefix = config.dataAttrPrefix; + let prefixedName = (prefix ? prefix + '-' : '') + name; + return el.getAttribute('data-' + prefixedName) || ''; + } + + /* + Makes an element (that is *external* to any calendar) draggable. + Can pass in data that determines how an event will be created when dropped onto a calendar. + Leverages FullCalendar's internal drag-n-drop functionality WITHOUT a third-party drag system. + */ + class ExternalDraggable { + constructor(el, settings = {}) { + this.handlePointerDown = (ev) => { + let { dragging } = this; + let { minDistance, longPressDelay } = this.settings; + dragging.minDistance = + minDistance != null ? + minDistance : + (ev.isTouch ? 0 : BASE_OPTION_DEFAULTS.eventDragMinDistance); + dragging.delay = + ev.isTouch ? // TODO: eventually read eventLongPressDelay instead vvv + (longPressDelay != null ? longPressDelay : BASE_OPTION_DEFAULTS.longPressDelay) : + 0; + }; + this.handleDragStart = (ev) => { + if (ev.isTouch && + this.dragging.delay && + ev.subjectEl.classList.contains('fc-event')) { + this.dragging.mirror.getMirrorEl().classList.add('fc-event-selected'); + } + }; + this.settings = settings; + let dragging = this.dragging = new FeaturefulElementDragging(el); + dragging.touchScrollAllowed = false; + if (settings.itemSelector != null) { + dragging.pointer.selector = settings.itemSelector; + } + if (settings.appendTo != null) { + dragging.mirror.parentNode = settings.appendTo; // TODO: write tests + } + dragging.emitter.on('pointerdown', this.handlePointerDown); + dragging.emitter.on('dragstart', this.handleDragStart); + new ExternalElementDragging(dragging, settings.eventData); // eslint-disable-line no-new + } + destroy() { + this.dragging.destroy(); + } + } + + /* + Detects when a *THIRD-PARTY* drag-n-drop system interacts with elements. + The third-party system is responsible for drawing the visuals effects of the drag. + This class simply monitors for pointer movements and fires events. + It also has the ability to hide the moving element (the "mirror") during the drag. + */ + class InferredElementDragging extends ElementDragging { + constructor(containerEl) { + super(containerEl); + this.shouldIgnoreMove = false; + this.mirrorSelector = ''; + this.currentMirrorEl = null; + this.handlePointerDown = (ev) => { + this.emitter.trigger('pointerdown', ev); + if (!this.shouldIgnoreMove) { + // fire dragstart right away. does not support delay or min-distance + this.emitter.trigger('dragstart', ev); + } + }; + this.handlePointerMove = (ev) => { + if (!this.shouldIgnoreMove) { + this.emitter.trigger('dragmove', ev); + } + }; + this.handlePointerUp = (ev) => { + this.emitter.trigger('pointerup', ev); + if (!this.shouldIgnoreMove) { + // fire dragend right away. does not support a revert animation + this.emitter.trigger('dragend', ev); + } + }; + let pointer = this.pointer = new PointerDragging(containerEl); + pointer.emitter.on('pointerdown', this.handlePointerDown); + pointer.emitter.on('pointermove', this.handlePointerMove); + pointer.emitter.on('pointerup', this.handlePointerUp); + } + destroy() { + this.pointer.destroy(); + } + setIgnoreMove(bool) { + this.shouldIgnoreMove = bool; + } + setMirrorIsVisible(bool) { + if (bool) { + // restore a previously hidden element. + // use the reference in case the selector class has already been removed. + if (this.currentMirrorEl) { + this.currentMirrorEl.style.visibility = ''; + this.currentMirrorEl = null; + } + } + else { + let mirrorEl = this.mirrorSelector + // TODO: somehow query FullCalendars WITHIN shadow-roots + ? document.querySelector(this.mirrorSelector) + : null; + if (mirrorEl) { + this.currentMirrorEl = mirrorEl; + mirrorEl.style.visibility = 'hidden'; + } + } + } + } + + /* + Bridges third-party drag-n-drop systems with FullCalendar. + Must be instantiated and destroyed by caller. + */ + class ThirdPartyDraggable { + constructor(containerOrSettings, settings) { + let containerEl = document; + if ( + // wish we could just test instanceof EventTarget, but doesn't work in IE11 + containerOrSettings === document || + containerOrSettings instanceof Element) { + containerEl = containerOrSettings; + settings = settings || {}; + } + else { + settings = (containerOrSettings || {}); + } + let dragging = this.dragging = new InferredElementDragging(containerEl); + if (typeof settings.itemSelector === 'string') { + dragging.pointer.selector = settings.itemSelector; + } + else if (containerEl === document) { + dragging.pointer.selector = '[data-event]'; + } + if (typeof settings.mirrorSelector === 'string') { + dragging.mirrorSelector = settings.mirrorSelector; + } + new ExternalElementDragging(dragging, settings.eventData); // eslint-disable-line no-new + } + destroy() { + this.dragging.destroy(); + } + } + + var index$b = createPlugin({ + name: '@fullcalendar/interaction', + componentInteractions: [DateClicking, DateSelecting, EventDragging, EventResizing], + calendarInteractions: [UnselectAuto], + elementDraggingImpl: FeaturefulElementDragging, + optionRefiners: OPTION_REFINERS$4, + listenerRefiners: LISTENER_REFINERS$1, + }); + + /* An abstract class for the daygrid views, as well as month view. Renders one or more rows of day cells. + ----------------------------------------------------------------------------------------------------------------------*/ + // It is a manager for a Table subcomponent, which does most of the heavy lifting. + // It is responsible for managing width/height. + class TableView extends DateComponent { + constructor() { + super(...arguments); + this.headerElRef = y(); + } + renderSimpleLayout(headerRowContent, bodyContent) { + let { props, context } = this; + let sections = []; + let stickyHeaderDates = getStickyHeaderDates(context.options); + if (headerRowContent) { + sections.push({ + type: 'header', + key: 'header', + isSticky: stickyHeaderDates, + chunk: { + elRef: this.headerElRef, + tableClassName: 'fc-col-header', + rowContent: headerRowContent, + }, + }); + } + sections.push({ + type: 'body', + key: 'body', + liquid: true, + chunk: { content: bodyContent }, + }); + return (h(ViewContainer$1, { elClasses: ['fc-daygrid'], viewSpec: context.viewSpec }, + h(SimpleScrollGrid, { liquid: !props.isHeightAuto && !props.forPrint, collapsibleWidth: props.forPrint, cols: [] /* TODO: make optional? */, sections: sections }))); + } + renderHScrollLayout(headerRowContent, bodyContent, colCnt, dayMinWidth) { + let ScrollGrid = this.context.pluginHooks.scrollGridImpl; + if (!ScrollGrid) { + throw new Error('No ScrollGrid implementation'); + } + let { props, context } = this; + let stickyHeaderDates = !props.forPrint && getStickyHeaderDates(context.options); + let stickyFooterScrollbar = !props.forPrint && getStickyFooterScrollbar(context.options); + let sections = []; + if (headerRowContent) { + sections.push({ + type: 'header', + key: 'header', + isSticky: stickyHeaderDates, + chunks: [{ + key: 'main', + elRef: this.headerElRef, + tableClassName: 'fc-col-header', + rowContent: headerRowContent, + }], + }); + } + sections.push({ + type: 'body', + key: 'body', + liquid: true, + chunks: [{ + key: 'main', + content: bodyContent, + }], + }); + if (stickyFooterScrollbar) { + sections.push({ + type: 'footer', + key: 'footer', + isSticky: true, + chunks: [{ + key: 'main', + content: renderScrollShim, + }], + }); + } + return (h(ViewContainer$1, { elClasses: ['fc-daygrid'], viewSpec: context.viewSpec }, + h(ScrollGrid, { liquid: !props.isHeightAuto && !props.forPrint, collapsibleWidth: props.forPrint, colGroups: [{ cols: [{ span: colCnt, minWidth: dayMinWidth }] }], sections: sections }))); + } + } + + function splitSegsByRow(segs, rowCnt) { + let byRow = []; + for (let i = 0; i < rowCnt; i += 1) { + byRow[i] = []; + } + for (let seg of segs) { + byRow[seg.row].push(seg); + } + return byRow; + } + function splitSegsByFirstCol(segs, colCnt) { + let byCol = []; + for (let i = 0; i < colCnt; i += 1) { + byCol[i] = []; + } + for (let seg of segs) { + byCol[seg.firstCol].push(seg); + } + return byCol; + } + function splitInteractionByRow(ui, rowCnt) { + let byRow = []; + if (!ui) { + for (let i = 0; i < rowCnt; i += 1) { + byRow[i] = null; + } + } + else { + for (let i = 0; i < rowCnt; i += 1) { + byRow[i] = { + affectedInstances: ui.affectedInstances, + isEvent: ui.isEvent, + segs: [], + }; + } + for (let seg of ui.segs) { + byRow[seg.row].segs.push(seg); + } + } + return byRow; + } + + const DEFAULT_TABLE_EVENT_TIME_FORMAT = createFormatter({ + hour: 'numeric', + minute: '2-digit', + omitZeroMinute: true, + meridiem: 'narrow', + }); + function hasListItemDisplay(seg) { + let { display } = seg.eventRange.ui; + return display === 'list-item' || (display === 'auto' && + !seg.eventRange.def.allDay && + seg.firstCol === seg.lastCol && // can't be multi-day + seg.isStart && // " + seg.isEnd // " + ); + } + + class TableBlockEvent extends BaseComponent { + render() { + let { props } = this; + return (h(StandardEvent, Object.assign({}, props, { elClasses: ['fc-daygrid-event', 'fc-daygrid-block-event', 'fc-h-event'], defaultTimeFormat: DEFAULT_TABLE_EVENT_TIME_FORMAT, defaultDisplayEventEnd: props.defaultDisplayEventEnd, disableResizing: !props.seg.eventRange.def.allDay }))); + } + } + + class TableListItemEvent extends BaseComponent { + render() { + let { props, context } = this; + let { options } = context; + let { seg } = props; + let timeFormat = options.eventTimeFormat || DEFAULT_TABLE_EVENT_TIME_FORMAT; + let timeText = buildSegTimeText(seg, timeFormat, context, true, props.defaultDisplayEventEnd); + return (h(EventContainer, Object.assign({}, props, { elTag: "a", elClasses: ['fc-daygrid-event', 'fc-daygrid-dot-event'], elAttrs: getSegAnchorAttrs(props.seg, context), defaultGenerator: renderInnerContent$4, timeText: timeText, isResizing: false, isDateSelecting: false }))); + } + } + function renderInnerContent$4(renderProps) { + return (h(p, null, + h("div", { className: "fc-daygrid-event-dot", style: { borderColor: renderProps.borderColor || renderProps.backgroundColor } }), + renderProps.timeText && (h("div", { className: "fc-event-time" }, renderProps.timeText)), + h("div", { className: "fc-event-title" }, renderProps.event.title || h(p, null, "\u00A0")))); + } + + class TableCellMoreLink extends BaseComponent { + constructor() { + super(...arguments); + this.compileSegs = memoize(compileSegs); + } + render() { + let { props } = this; + let { allSegs, invisibleSegs } = this.compileSegs(props.singlePlacements); + return (h(MoreLinkContainer, { elClasses: ['fc-daygrid-more-link'], dateProfile: props.dateProfile, todayRange: props.todayRange, allDayDate: props.allDayDate, moreCnt: props.moreCnt, allSegs: allSegs, hiddenSegs: invisibleSegs, alignmentElRef: props.alignmentElRef, alignGridTop: props.alignGridTop, extraDateSpan: props.extraDateSpan, popoverContent: () => { + let isForcedInvisible = (props.eventDrag ? props.eventDrag.affectedInstances : null) || + (props.eventResize ? props.eventResize.affectedInstances : null) || + {}; + return (h(p, null, allSegs.map((seg) => { + let instanceId = seg.eventRange.instance.instanceId; + return (h("div", { className: "fc-daygrid-event-harness", key: instanceId, style: { + visibility: isForcedInvisible[instanceId] ? 'hidden' : '', + } }, hasListItemDisplay(seg) ? (h(TableListItemEvent, Object.assign({ seg: seg, isDragging: false, isSelected: instanceId === props.eventSelection, defaultDisplayEventEnd: false }, getSegMeta(seg, props.todayRange)))) : (h(TableBlockEvent, Object.assign({ seg: seg, isDragging: false, isResizing: false, isDateSelecting: false, isSelected: instanceId === props.eventSelection, defaultDisplayEventEnd: false }, getSegMeta(seg, props.todayRange)))))); + }))); + } })); + } + } + function compileSegs(singlePlacements) { + let allSegs = []; + let invisibleSegs = []; + for (let placement of singlePlacements) { + allSegs.push(placement.seg); + if (!placement.isVisible) { + invisibleSegs.push(placement.seg); + } + } + return { allSegs, invisibleSegs }; + } + + const DEFAULT_WEEK_NUM_FORMAT$1 = createFormatter({ week: 'narrow' }); + class TableCell extends DateComponent { + constructor() { + super(...arguments); + this.rootElRef = y(); + this.state = { + dayNumberId: getUniqueDomId(), + }; + this.handleRootEl = (el) => { + setRef(this.rootElRef, el); + setRef(this.props.elRef, el); + }; + } + render() { + let { context, props, state, rootElRef } = this; + let { options } = context; + let { date, dateProfile } = props; + return (h(DayCellContainer, { elTag: "td", elRef: this.handleRootEl, elClasses: [ + 'fc-daygrid-day', + ...(props.extraClassNames || []), + ], elAttrs: Object.assign(Object.assign(Object.assign({}, props.extraDataAttrs), (props.showDayNumber ? { 'aria-labelledby': state.dayNumberId } : {})), { role: 'gridcell' }), defaultGenerator: renderTopInner, date: date, dateProfile: dateProfile, todayRange: props.todayRange, showDayNumber: props.showDayNumber, extraRenderProps: props.extraRenderProps }, (InnerContent, renderProps) => (h("div", { className: "fc-daygrid-day-frame fc-scrollgrid-sync-inner", ref: props.innerElRef }, + props.showWeekNumber && (h(WeekNumberContainer, { elTag: "a", elClasses: ['fc-daygrid-week-number'], elAttrs: buildNavLinkAttrs(context, date, 'week'), date: date, defaultFormat: DEFAULT_WEEK_NUM_FORMAT$1 })), + Boolean(!renderProps.isDisabled && + (props.showDayNumber || hasCustomDayCellContent(options) || props.forceDayTop)) && (h("div", { className: "fc-daygrid-day-top" }, + h(InnerContent, { elTag: "a", elClasses: ['fc-daygrid-day-number'], elAttrs: Object.assign(Object.assign({}, buildNavLinkAttrs(context, date)), { id: state.dayNumberId }) }))), + h("div", { className: "fc-daygrid-day-events", ref: props.fgContentElRef }, + props.fgContent, + h("div", { className: "fc-daygrid-day-bottom", style: { marginTop: props.moreMarginTop } }, + h(TableCellMoreLink, { allDayDate: date, singlePlacements: props.singlePlacements, moreCnt: props.moreCnt, alignmentElRef: rootElRef, alignGridTop: !props.showDayNumber, extraDateSpan: props.extraDateSpan, dateProfile: props.dateProfile, eventSelection: props.eventSelection, eventDrag: props.eventDrag, eventResize: props.eventResize, todayRange: props.todayRange }))), + h("div", { className: "fc-daygrid-day-bg" }, props.bgContent))))); + } + } + function renderTopInner(props) { + return props.dayNumberText || h(p, null, "\u00A0"); + } + + function computeFgSegPlacement(segs, // assumed already sorted + dayMaxEvents, dayMaxEventRows, strictOrder, eventInstanceHeights, maxContentHeight, cells) { + let hierarchy = new DayGridSegHierarchy(); + hierarchy.allowReslicing = true; + hierarchy.strictOrder = strictOrder; + if (dayMaxEvents === true || dayMaxEventRows === true) { + hierarchy.maxCoord = maxContentHeight; + hierarchy.hiddenConsumes = true; + } + else if (typeof dayMaxEvents === 'number') { + hierarchy.maxStackCnt = dayMaxEvents; + } + else if (typeof dayMaxEventRows === 'number') { + hierarchy.maxStackCnt = dayMaxEventRows; + hierarchy.hiddenConsumes = true; + } + // create segInputs only for segs with known heights + let segInputs = []; + let unknownHeightSegs = []; + for (let i = 0; i < segs.length; i += 1) { + let seg = segs[i]; + let { instanceId } = seg.eventRange.instance; + let eventHeight = eventInstanceHeights[instanceId]; + if (eventHeight != null) { + segInputs.push({ + index: i, + thickness: eventHeight, + span: { + start: seg.firstCol, + end: seg.lastCol + 1, + }, + }); + } + else { + unknownHeightSegs.push(seg); + } + } + let hiddenEntries = hierarchy.addSegs(segInputs); + let segRects = hierarchy.toRects(); + let { singleColPlacements, multiColPlacements, leftoverMargins } = placeRects(segRects, segs, cells); + let moreCnts = []; + let moreMarginTops = []; + // add segs with unknown heights + for (let seg of unknownHeightSegs) { + multiColPlacements[seg.firstCol].push({ + seg, + isVisible: false, + isAbsolute: true, + absoluteTop: 0, + marginTop: 0, + }); + for (let col = seg.firstCol; col <= seg.lastCol; col += 1) { + singleColPlacements[col].push({ + seg: resliceSeg(seg, col, col + 1, cells), + isVisible: false, + isAbsolute: false, + absoluteTop: 0, + marginTop: 0, + }); + } + } + // add the hidden entries + for (let col = 0; col < cells.length; col += 1) { + moreCnts.push(0); + } + for (let hiddenEntry of hiddenEntries) { + let seg = segs[hiddenEntry.index]; + let hiddenSpan = hiddenEntry.span; + multiColPlacements[hiddenSpan.start].push({ + seg: resliceSeg(seg, hiddenSpan.start, hiddenSpan.end, cells), + isVisible: false, + isAbsolute: true, + absoluteTop: 0, + marginTop: 0, + }); + for (let col = hiddenSpan.start; col < hiddenSpan.end; col += 1) { + moreCnts[col] += 1; + singleColPlacements[col].push({ + seg: resliceSeg(seg, col, col + 1, cells), + isVisible: false, + isAbsolute: false, + absoluteTop: 0, + marginTop: 0, + }); + } + } + // deal with leftover margins + for (let col = 0; col < cells.length; col += 1) { + moreMarginTops.push(leftoverMargins[col]); + } + return { singleColPlacements, multiColPlacements, moreCnts, moreMarginTops }; + } + // rects ordered by top coord, then left + function placeRects(allRects, segs, cells) { + let rectsByEachCol = groupRectsByEachCol(allRects, cells.length); + let singleColPlacements = []; + let multiColPlacements = []; + let leftoverMargins = []; + for (let col = 0; col < cells.length; col += 1) { + let rects = rectsByEachCol[col]; + // compute all static segs in singlePlacements + let singlePlacements = []; + let currentHeight = 0; + let currentMarginTop = 0; + for (let rect of rects) { + let seg = segs[rect.index]; + singlePlacements.push({ + seg: resliceSeg(seg, col, col + 1, cells), + isVisible: true, + isAbsolute: false, + absoluteTop: rect.levelCoord, + marginTop: rect.levelCoord - currentHeight, + }); + currentHeight = rect.levelCoord + rect.thickness; + } + // compute mixed static/absolute segs in multiPlacements + let multiPlacements = []; + currentHeight = 0; + currentMarginTop = 0; + for (let rect of rects) { + let seg = segs[rect.index]; + let isAbsolute = rect.span.end - rect.span.start > 1; // multi-column? + let isFirstCol = rect.span.start === col; + currentMarginTop += rect.levelCoord - currentHeight; // amount of space since bottom of previous seg + currentHeight = rect.levelCoord + rect.thickness; // height will now be bottom of current seg + if (isAbsolute) { + currentMarginTop += rect.thickness; + if (isFirstCol) { + multiPlacements.push({ + seg: resliceSeg(seg, rect.span.start, rect.span.end, cells), + isVisible: true, + isAbsolute: true, + absoluteTop: rect.levelCoord, + marginTop: 0, + }); + } + } + else if (isFirstCol) { + multiPlacements.push({ + seg: resliceSeg(seg, rect.span.start, rect.span.end, cells), + isVisible: true, + isAbsolute: false, + absoluteTop: rect.levelCoord, + marginTop: currentMarginTop, // claim the margin + }); + currentMarginTop = 0; + } + } + singleColPlacements.push(singlePlacements); + multiColPlacements.push(multiPlacements); + leftoverMargins.push(currentMarginTop); + } + return { singleColPlacements, multiColPlacements, leftoverMargins }; + } + function groupRectsByEachCol(rects, colCnt) { + let rectsByEachCol = []; + for (let col = 0; col < colCnt; col += 1) { + rectsByEachCol.push([]); + } + for (let rect of rects) { + for (let col = rect.span.start; col < rect.span.end; col += 1) { + rectsByEachCol[col].push(rect); + } + } + return rectsByEachCol; + } + function resliceSeg(seg, spanStart, spanEnd, cells) { + if (seg.firstCol === spanStart && seg.lastCol === spanEnd - 1) { + return seg; + } + let eventRange = seg.eventRange; + let origRange = eventRange.range; + let slicedRange = intersectRanges(origRange, { + start: cells[spanStart].date, + end: addDays(cells[spanEnd - 1].date, 1), + }); + return Object.assign(Object.assign({}, seg), { firstCol: spanStart, lastCol: spanEnd - 1, eventRange: { + def: eventRange.def, + ui: Object.assign(Object.assign({}, eventRange.ui), { durationEditable: false }), + instance: eventRange.instance, + range: slicedRange, + }, isStart: seg.isStart && slicedRange.start.valueOf() === origRange.start.valueOf(), isEnd: seg.isEnd && slicedRange.end.valueOf() === origRange.end.valueOf() }); + } + class DayGridSegHierarchy extends SegHierarchy { + constructor() { + super(...arguments); + // config + this.hiddenConsumes = false; + // allows us to keep hidden entries in the hierarchy so they take up space + this.forceHidden = {}; + } + addSegs(segInputs) { + const hiddenSegs = super.addSegs(segInputs); + const { entriesByLevel } = this; + const excludeHidden = (entry) => !this.forceHidden[buildEntryKey(entry)]; + // remove the forced-hidden segs + for (let level = 0; level < entriesByLevel.length; level += 1) { + entriesByLevel[level] = entriesByLevel[level].filter(excludeHidden); + } + return hiddenSegs; + } + handleInvalidInsertion(insertion, entry, hiddenEntries) { + const { entriesByLevel, forceHidden } = this; + const { touchingEntry, touchingLevel, touchingLateral } = insertion; + if (this.hiddenConsumes && touchingEntry) { + const touchingEntryId = buildEntryKey(touchingEntry); + // if not already hidden + if (!forceHidden[touchingEntryId]) { + if (this.allowReslicing) { + const placeholderEntry = Object.assign(Object.assign({}, touchingEntry), { span: intersectSpans(touchingEntry.span, entry.span) }); + const placeholderEntryId = buildEntryKey(placeholderEntry); + forceHidden[placeholderEntryId] = true; + entriesByLevel[touchingLevel][touchingLateral] = placeholderEntry; // replace touchingEntry with our placeholder + this.splitEntry(touchingEntry, entry, hiddenEntries); // split up the touchingEntry, reinsert it + } + else { + forceHidden[touchingEntryId] = true; + hiddenEntries.push(touchingEntry); + } + } + } + return super.handleInvalidInsertion(insertion, entry, hiddenEntries); + } + } + + class TableRow extends DateComponent { + constructor() { + super(...arguments); + this.cellElRefs = new RefMap(); // the <td> + this.frameElRefs = new RefMap(); // the fc-daygrid-day-frame + this.fgElRefs = new RefMap(); // the fc-daygrid-day-events + this.segHarnessRefs = new RefMap(); // indexed by "instanceId:firstCol" + this.rootElRef = y(); + this.state = { + framePositions: null, + maxContentHeight: null, + eventInstanceHeights: {}, + }; + this.handleResize = (isForced) => { + if (isForced) { + this.updateSizing(true); // isExternal=true + } + }; + } + render() { + let { props, state, context } = this; + let { options } = context; + let colCnt = props.cells.length; + let businessHoursByCol = splitSegsByFirstCol(props.businessHourSegs, colCnt); + let bgEventSegsByCol = splitSegsByFirstCol(props.bgEventSegs, colCnt); + let highlightSegsByCol = splitSegsByFirstCol(this.getHighlightSegs(), colCnt); + let mirrorSegsByCol = splitSegsByFirstCol(this.getMirrorSegs(), colCnt); + let { singleColPlacements, multiColPlacements, moreCnts, moreMarginTops } = computeFgSegPlacement(sortEventSegs(props.fgEventSegs, options.eventOrder), props.dayMaxEvents, props.dayMaxEventRows, options.eventOrderStrict, state.eventInstanceHeights, state.maxContentHeight, props.cells); + let isForcedInvisible = // TODO: messy way to compute this + (props.eventDrag && props.eventDrag.affectedInstances) || + (props.eventResize && props.eventResize.affectedInstances) || + {}; + return (h("tr", { ref: this.rootElRef, role: "row" }, + props.renderIntro && props.renderIntro(), + props.cells.map((cell, col) => { + let normalFgNodes = this.renderFgSegs(col, props.forPrint ? singleColPlacements[col] : multiColPlacements[col], props.todayRange, isForcedInvisible); + let mirrorFgNodes = this.renderFgSegs(col, buildMirrorPlacements$1(mirrorSegsByCol[col], multiColPlacements), props.todayRange, {}, Boolean(props.eventDrag), Boolean(props.eventResize), false); + return (h(TableCell, { key: cell.key, elRef: this.cellElRefs.createRef(cell.key), innerElRef: this.frameElRefs.createRef(cell.key) /* FF <td> problem, but okay to use for left/right. TODO: rename prop */, dateProfile: props.dateProfile, date: cell.date, showDayNumber: props.showDayNumbers, showWeekNumber: props.showWeekNumbers && col === 0, forceDayTop: props.showWeekNumbers /* even displaying weeknum for row, not necessarily day */, todayRange: props.todayRange, eventSelection: props.eventSelection, eventDrag: props.eventDrag, eventResize: props.eventResize, extraRenderProps: cell.extraRenderProps, extraDataAttrs: cell.extraDataAttrs, extraClassNames: cell.extraClassNames, extraDateSpan: cell.extraDateSpan, moreCnt: moreCnts[col], moreMarginTop: moreMarginTops[col], singlePlacements: singleColPlacements[col], fgContentElRef: this.fgElRefs.createRef(cell.key), fgContent: ( // Fragment scopes the keys + h(p, null, + h(p, null, normalFgNodes), + h(p, null, mirrorFgNodes))), bgContent: ( // Fragment scopes the keys + h(p, null, + this.renderFillSegs(highlightSegsByCol[col], 'highlight'), + this.renderFillSegs(businessHoursByCol[col], 'non-business'), + this.renderFillSegs(bgEventSegsByCol[col], 'bg-event'))) })); + }))); + } + componentDidMount() { + this.updateSizing(true); + this.context.addResizeHandler(this.handleResize); + } + componentDidUpdate(prevProps, prevState) { + let currentProps = this.props; + this.updateSizing(!isPropsEqual(prevProps, currentProps)); + } + componentWillUnmount() { + this.context.removeResizeHandler(this.handleResize); + } + getHighlightSegs() { + let { props } = this; + if (props.eventDrag && props.eventDrag.segs.length) { // messy check + return props.eventDrag.segs; + } + if (props.eventResize && props.eventResize.segs.length) { // messy check + return props.eventResize.segs; + } + return props.dateSelectionSegs; + } + getMirrorSegs() { + let { props } = this; + if (props.eventResize && props.eventResize.segs.length) { // messy check + return props.eventResize.segs; + } + return []; + } + renderFgSegs(col, segPlacements, todayRange, isForcedInvisible, isDragging, isResizing, isDateSelecting) { + let { context } = this; + let { eventSelection } = this.props; + let { framePositions } = this.state; + let defaultDisplayEventEnd = this.props.cells.length === 1; // colCnt === 1 + let isMirror = isDragging || isResizing || isDateSelecting; + let nodes = []; + if (framePositions) { + for (let placement of segPlacements) { + let { seg } = placement; + let { instanceId } = seg.eventRange.instance; + let key = instanceId + ':' + col; + let isVisible = placement.isVisible && !isForcedInvisible[instanceId]; + let isAbsolute = placement.isAbsolute; + let left = ''; + let right = ''; + if (isAbsolute) { + if (context.isRtl) { + right = 0; + left = framePositions.lefts[seg.lastCol] - framePositions.lefts[seg.firstCol]; + } + else { + left = 0; + right = framePositions.rights[seg.firstCol] - framePositions.rights[seg.lastCol]; + } + } + /* + known bug: events that are force to be list-item but span multiple days still take up space in later columns + todo: in print view, for multi-day events, don't display title within non-start/end segs + */ + nodes.push(h("div", { className: 'fc-daygrid-event-harness' + (isAbsolute ? ' fc-daygrid-event-harness-abs' : ''), key: key, ref: isMirror ? null : this.segHarnessRefs.createRef(key), style: { + visibility: isVisible ? '' : 'hidden', + marginTop: isAbsolute ? '' : placement.marginTop, + top: isAbsolute ? placement.absoluteTop : '', + left, + right, + } }, hasListItemDisplay(seg) ? (h(TableListItemEvent, Object.assign({ seg: seg, isDragging: isDragging, isSelected: instanceId === eventSelection, defaultDisplayEventEnd: defaultDisplayEventEnd }, getSegMeta(seg, todayRange)))) : (h(TableBlockEvent, Object.assign({ seg: seg, isDragging: isDragging, isResizing: isResizing, isDateSelecting: isDateSelecting, isSelected: instanceId === eventSelection, defaultDisplayEventEnd: defaultDisplayEventEnd }, getSegMeta(seg, todayRange)))))); + } + } + return nodes; + } + renderFillSegs(segs, fillType) { + let { isRtl } = this.context; + let { todayRange } = this.props; + let { framePositions } = this.state; + let nodes = []; + if (framePositions) { + for (let seg of segs) { + let leftRightCss = isRtl ? { + right: 0, + left: framePositions.lefts[seg.lastCol] - framePositions.lefts[seg.firstCol], + } : { + left: 0, + right: framePositions.rights[seg.firstCol] - framePositions.rights[seg.lastCol], + }; + nodes.push(h("div", { key: buildEventRangeKey(seg.eventRange), className: "fc-daygrid-bg-harness", style: leftRightCss }, fillType === 'bg-event' ? + h(BgEvent, Object.assign({ seg: seg }, getSegMeta(seg, todayRange))) : + renderFill(fillType))); + } + } + return h(p, {}, ...nodes); + } + updateSizing(isExternalSizingChange) { + let { props, frameElRefs } = this; + if (!props.forPrint && + props.clientWidth !== null // positioning ready? + ) { + if (isExternalSizingChange) { + let frameEls = props.cells.map((cell) => frameElRefs.currentMap[cell.key]); + if (frameEls.length) { + let originEl = this.rootElRef.current; + this.setState({ + framePositions: new PositionCache(originEl, frameEls, true, // isHorizontal + false), + }); + } + } + const oldInstanceHeights = this.state.eventInstanceHeights; + const newInstanceHeights = this.queryEventInstanceHeights(); + const limitByContentHeight = props.dayMaxEvents === true || props.dayMaxEventRows === true; + this.safeSetState({ + // HACK to prevent oscillations of events being shown/hidden from max-event-rows + // Essentially, once you compute an element's height, never null-out. + // TODO: always display all events, as visibility:hidden? + eventInstanceHeights: Object.assign(Object.assign({}, oldInstanceHeights), newInstanceHeights), + maxContentHeight: limitByContentHeight ? this.computeMaxContentHeight() : null, + }); + } + } + queryEventInstanceHeights() { + let segElMap = this.segHarnessRefs.currentMap; + let eventInstanceHeights = {}; + // get the max height amongst instance segs + for (let key in segElMap) { + let height = Math.round(segElMap[key].getBoundingClientRect().height); + let instanceId = key.split(':')[0]; // deconstruct how renderFgSegs makes the key + eventInstanceHeights[instanceId] = Math.max(eventInstanceHeights[instanceId] || 0, height); + } + return eventInstanceHeights; + } + computeMaxContentHeight() { + let firstKey = this.props.cells[0].key; + let cellEl = this.cellElRefs.currentMap[firstKey]; + let fcContainerEl = this.fgElRefs.currentMap[firstKey]; + return cellEl.getBoundingClientRect().bottom - fcContainerEl.getBoundingClientRect().top; + } + getCellEls() { + let elMap = this.cellElRefs.currentMap; + return this.props.cells.map((cell) => elMap[cell.key]); + } + } + TableRow.addStateEquality({ + eventInstanceHeights: isPropsEqual, + }); + function buildMirrorPlacements$1(mirrorSegs, colPlacements) { + if (!mirrorSegs.length) { + return []; + } + let topsByInstanceId = buildAbsoluteTopHash$1(colPlacements); // TODO: cache this at first render? + return mirrorSegs.map((seg) => ({ + seg, + isVisible: true, + isAbsolute: true, + absoluteTop: topsByInstanceId[seg.eventRange.instance.instanceId], + marginTop: 0, + })); + } + function buildAbsoluteTopHash$1(colPlacements) { + let topsByInstanceId = {}; + for (let placements of colPlacements) { + for (let placement of placements) { + topsByInstanceId[placement.seg.eventRange.instance.instanceId] = placement.absoluteTop; + } + } + return topsByInstanceId; + } + + class Table extends DateComponent { + constructor() { + super(...arguments); + this.splitBusinessHourSegs = memoize(splitSegsByRow); + this.splitBgEventSegs = memoize(splitSegsByRow); + this.splitFgEventSegs = memoize(splitSegsByRow); + this.splitDateSelectionSegs = memoize(splitSegsByRow); + this.splitEventDrag = memoize(splitInteractionByRow); + this.splitEventResize = memoize(splitInteractionByRow); + this.rowRefs = new RefMap(); + this.handleRootEl = (rootEl) => { + this.rootEl = rootEl; + if (rootEl) { + this.context.registerInteractiveComponent(this, { + el: rootEl, + isHitComboAllowed: this.props.isHitComboAllowed, + }); + } + else { + this.context.unregisterInteractiveComponent(this); + } + }; + } + render() { + let { props } = this; + let { dateProfile, dayMaxEventRows, dayMaxEvents, expandRows } = props; + let rowCnt = props.cells.length; + let businessHourSegsByRow = this.splitBusinessHourSegs(props.businessHourSegs, rowCnt); + let bgEventSegsByRow = this.splitBgEventSegs(props.bgEventSegs, rowCnt); + let fgEventSegsByRow = this.splitFgEventSegs(props.fgEventSegs, rowCnt); + let dateSelectionSegsByRow = this.splitDateSelectionSegs(props.dateSelectionSegs, rowCnt); + let eventDragByRow = this.splitEventDrag(props.eventDrag, rowCnt); + let eventResizeByRow = this.splitEventResize(props.eventResize, rowCnt); + let limitViaBalanced = dayMaxEvents === true || dayMaxEventRows === true; + // if rows can't expand to fill fixed height, can't do balanced-height event limit + // TODO: best place to normalize these options? + if (limitViaBalanced && !expandRows) { + limitViaBalanced = false; + dayMaxEventRows = null; + dayMaxEvents = null; + } + let classNames = [ + 'fc-daygrid-body', + limitViaBalanced ? 'fc-daygrid-body-balanced' : 'fc-daygrid-body-unbalanced', + expandRows ? '' : 'fc-daygrid-body-natural', // will height of one row depend on the others? + ]; + return (h("div", { className: classNames.join(' '), ref: this.handleRootEl, style: { + // these props are important to give this wrapper correct dimensions for interactions + // TODO: if we set it here, can we avoid giving to inner tables? + width: props.clientWidth, + minWidth: props.tableMinWidth, + } }, + h(NowTimer, { unit: "day" }, (nowDate, todayRange) => (h(p, null, + h("table", { role: "presentation", className: "fc-scrollgrid-sync-table", style: { + width: props.clientWidth, + minWidth: props.tableMinWidth, + height: expandRows ? props.clientHeight : '', + } }, + props.colGroupNode, + h("tbody", { role: "presentation" }, props.cells.map((cells, row) => (h(TableRow, { ref: this.rowRefs.createRef(row), key: cells.length + ? cells[0].date.toISOString() /* best? or put key on cell? or use diff formatter? */ + : row // in case there are no cells (like when resource view is loading) + , showDayNumbers: rowCnt > 1, showWeekNumbers: props.showWeekNumbers, todayRange: todayRange, dateProfile: dateProfile, cells: cells, renderIntro: props.renderRowIntro, businessHourSegs: businessHourSegsByRow[row], eventSelection: props.eventSelection, bgEventSegs: bgEventSegsByRow[row].filter(isSegAllDay) /* hack */, fgEventSegs: fgEventSegsByRow[row], dateSelectionSegs: dateSelectionSegsByRow[row], eventDrag: eventDragByRow[row], eventResize: eventResizeByRow[row], dayMaxEvents: dayMaxEvents, dayMaxEventRows: dayMaxEventRows, clientWidth: props.clientWidth, clientHeight: props.clientHeight, forPrint: props.forPrint })))))))))); + } + // Hit System + // ---------------------------------------------------------------------------------------------------- + prepareHits() { + this.rowPositions = new PositionCache(this.rootEl, this.rowRefs.collect().map((rowObj) => rowObj.getCellEls()[0]), // first cell el in each row. TODO: not optimal + false, true); + this.colPositions = new PositionCache(this.rootEl, this.rowRefs.currentMap[0].getCellEls(), // cell els in first row + true, // horizontal + false); + } + queryHit(positionLeft, positionTop) { + let { colPositions, rowPositions } = this; + let col = colPositions.leftToIndex(positionLeft); + let row = rowPositions.topToIndex(positionTop); + if (row != null && col != null) { + let cell = this.props.cells[row][col]; + return { + dateProfile: this.props.dateProfile, + dateSpan: Object.assign({ range: this.getCellRange(row, col), allDay: true }, cell.extraDateSpan), + dayEl: this.getCellEl(row, col), + rect: { + left: colPositions.lefts[col], + right: colPositions.rights[col], + top: rowPositions.tops[row], + bottom: rowPositions.bottoms[row], + }, + layer: 0, + }; + } + return null; + } + getCellEl(row, col) { + return this.rowRefs.currentMap[row].getCellEls()[col]; // TODO: not optimal + } + getCellRange(row, col) { + let start = this.props.cells[row][col].date; + let end = addDays(start, 1); + return { start, end }; + } + } + function isSegAllDay(seg) { + return seg.eventRange.def.allDay; + } + + class DayTableSlicer extends Slicer { + constructor() { + super(...arguments); + this.forceDayIfListItem = true; + } + sliceRange(dateRange, dayTableModel) { + return dayTableModel.sliceRange(dateRange); + } + } + + class DayTable extends DateComponent { + constructor() { + super(...arguments); + this.slicer = new DayTableSlicer(); + this.tableRef = y(); + } + render() { + let { props, context } = this; + return (h(Table, Object.assign({ ref: this.tableRef }, this.slicer.sliceProps(props, props.dateProfile, props.nextDayThreshold, context, props.dayTableModel), { dateProfile: props.dateProfile, cells: props.dayTableModel.cells, colGroupNode: props.colGroupNode, tableMinWidth: props.tableMinWidth, renderRowIntro: props.renderRowIntro, dayMaxEvents: props.dayMaxEvents, dayMaxEventRows: props.dayMaxEventRows, showWeekNumbers: props.showWeekNumbers, expandRows: props.expandRows, headerAlignElRef: props.headerAlignElRef, clientWidth: props.clientWidth, clientHeight: props.clientHeight, forPrint: props.forPrint }))); + } + } + + class DayTableView extends TableView { + constructor() { + super(...arguments); + this.buildDayTableModel = memoize(buildDayTableModel); + this.headerRef = y(); + this.tableRef = y(); + } + render() { + let { options, dateProfileGenerator } = this.context; + let { props } = this; + let dayTableModel = this.buildDayTableModel(props.dateProfile, dateProfileGenerator); + let headerContent = options.dayHeaders && (h(DayHeader, { ref: this.headerRef, dateProfile: props.dateProfile, dates: dayTableModel.headerDates, datesRepDistinctDays: dayTableModel.rowCnt === 1 })); + let bodyContent = (contentArg) => (h(DayTable, { ref: this.tableRef, dateProfile: props.dateProfile, dayTableModel: dayTableModel, businessHours: props.businessHours, dateSelection: props.dateSelection, eventStore: props.eventStore, eventUiBases: props.eventUiBases, eventSelection: props.eventSelection, eventDrag: props.eventDrag, eventResize: props.eventResize, nextDayThreshold: options.nextDayThreshold, colGroupNode: contentArg.tableColGroupNode, tableMinWidth: contentArg.tableMinWidth, dayMaxEvents: options.dayMaxEvents, dayMaxEventRows: options.dayMaxEventRows, showWeekNumbers: options.weekNumbers, expandRows: !props.isHeightAuto, headerAlignElRef: this.headerElRef, clientWidth: contentArg.clientWidth, clientHeight: contentArg.clientHeight, forPrint: props.forPrint })); + return options.dayMinWidth + ? this.renderHScrollLayout(headerContent, bodyContent, dayTableModel.colCnt, options.dayMinWidth) + : this.renderSimpleLayout(headerContent, bodyContent); + } + } + function buildDayTableModel(dateProfile, dateProfileGenerator) { + let daySeries = new DaySeriesModel(dateProfile.renderRange, dateProfileGenerator); + return new DayTableModel(daySeries, /year|month|week/.test(dateProfile.currentRangeUnit)); + } + + class TableDateProfileGenerator extends DateProfileGenerator { + // Computes the date range that will be rendered. + buildRenderRange(currentRange, currentRangeUnit, isRangeAllDay) { + let { dateEnv } = this.props; + let renderRange = super.buildRenderRange(currentRange, currentRangeUnit, isRangeAllDay); + let start = renderRange.start; + let end = renderRange.end; + let endOfWeek; + // year and month views should be aligned with weeks. this is already done for week + if (/^(year|month)$/.test(currentRangeUnit)) { + start = dateEnv.startOfWeek(start); + // make end-of-week if not already + endOfWeek = dateEnv.startOfWeek(end); + if (endOfWeek.valueOf() !== end.valueOf()) { + end = addWeeks(endOfWeek, 1); + } + } + // ensure 6 weeks + if (this.props.monthMode && + this.props.fixedWeekCount) { + let rowCnt = Math.ceil(// could be partial weeks due to hiddenDays + diffWeeks(start, end)); + end = addWeeks(end, 6 - rowCnt); + } + return { start, end }; + } + } + + var css_248z$5 = ":root{--fc-daygrid-event-dot-width:8px}.fc-daygrid-day-events:after,.fc-daygrid-day-events:before,.fc-daygrid-day-frame:after,.fc-daygrid-day-frame:before,.fc-daygrid-event-harness:after,.fc-daygrid-event-harness:before{clear:both;content:\"\";display:table}.fc .fc-daygrid-body{position:relative;z-index:1}.fc .fc-daygrid-day.fc-day-today{background-color:var(--fc-today-bg-color)}.fc .fc-daygrid-day-frame{min-height:100%;position:relative}.fc .fc-daygrid-day-top{display:flex;flex-direction:row-reverse}.fc .fc-day-other .fc-daygrid-day-top{opacity:.3}.fc .fc-daygrid-day-number{padding:4px;position:relative;z-index:4}.fc .fc-daygrid-day-events{margin-top:1px}.fc .fc-daygrid-body-balanced .fc-daygrid-day-events{left:0;position:absolute;right:0}.fc .fc-daygrid-body-unbalanced .fc-daygrid-day-events{min-height:2em;position:relative}.fc .fc-daygrid-body-natural .fc-daygrid-day-events{margin-bottom:1em}.fc .fc-daygrid-event-harness{position:relative}.fc .fc-daygrid-event-harness-abs{left:0;position:absolute;right:0;top:0}.fc .fc-daygrid-bg-harness{bottom:0;position:absolute;top:0}.fc .fc-daygrid-day-bg .fc-non-business{z-index:1}.fc .fc-daygrid-day-bg .fc-bg-event{z-index:2}.fc .fc-daygrid-day-bg .fc-highlight{z-index:3}.fc .fc-daygrid-event{margin-top:1px;z-index:6}.fc .fc-daygrid-event.fc-event-mirror{z-index:7}.fc .fc-daygrid-day-bottom{font-size:.85em;padding:2px 3px 0}.fc .fc-daygrid-day-bottom:before{clear:both;content:\"\";display:table}.fc .fc-daygrid-more-link{cursor:pointer;position:relative;z-index:4}.fc .fc-daygrid-week-number{background-color:var(--fc-neutral-bg-color);color:var(--fc-neutral-text-color);min-width:1.5em;padding:2px;position:absolute;text-align:center;top:0;z-index:5}.fc .fc-more-popover .fc-popover-body{min-width:220px;padding:10px}.fc-direction-ltr .fc-daygrid-event.fc-event-start,.fc-direction-rtl .fc-daygrid-event.fc-event-end{margin-left:2px}.fc-direction-ltr .fc-daygrid-event.fc-event-end,.fc-direction-rtl .fc-daygrid-event.fc-event-start{margin-right:2px}.fc-direction-ltr .fc-daygrid-week-number{border-radius:0 0 3px 0;left:0}.fc-direction-rtl .fc-daygrid-week-number{border-radius:0 0 0 3px;right:0}.fc-liquid-hack .fc-daygrid-day-frame{position:static}.fc-daygrid-event{border-radius:3px;font-size:var(--fc-small-font-size);position:relative;white-space:nowrap}.fc-daygrid-block-event .fc-event-time{font-weight:700}.fc-daygrid-block-event .fc-event-time,.fc-daygrid-block-event .fc-event-title{padding:1px}.fc-daygrid-dot-event{align-items:center;display:flex;padding:2px 0}.fc-daygrid-dot-event .fc-event-title{flex-grow:1;flex-shrink:1;font-weight:700;min-width:0;overflow:hidden}.fc-daygrid-dot-event.fc-event-mirror,.fc-daygrid-dot-event:hover{background:rgba(0,0,0,.1)}.fc-daygrid-dot-event.fc-event-selected:before{bottom:-10px;top:-10px}.fc-daygrid-event-dot{border:calc(var(--fc-daygrid-event-dot-width)/2) solid var(--fc-event-border-color);border-radius:calc(var(--fc-daygrid-event-dot-width)/2);box-sizing:content-box;height:0;margin:0 4px;width:0}.fc-direction-ltr .fc-daygrid-event .fc-event-time{margin-right:3px}.fc-direction-rtl .fc-daygrid-event .fc-event-time{margin-left:3px}"; + injectStyles(css_248z$5); + + var index$a = createPlugin({ + name: '@fullcalendar/daygrid', + initialView: 'dayGridMonth', + views: { + dayGrid: { + component: DayTableView, + dateProfileGeneratorClass: TableDateProfileGenerator, + }, + dayGridDay: { + type: 'dayGrid', + duration: { days: 1 }, + }, + dayGridWeek: { + type: 'dayGrid', + duration: { weeks: 1 }, + }, + dayGridMonth: { + type: 'dayGrid', + duration: { months: 1 }, + monthMode: true, + fixedWeekCount: true, + }, + }, + }); + + class AllDaySplitter extends Splitter { + getKeyInfo() { + return { + allDay: {}, + timed: {}, + }; + } + getKeysForDateSpan(dateSpan) { + if (dateSpan.allDay) { + return ['allDay']; + } + return ['timed']; + } + getKeysForEventDef(eventDef) { + if (!eventDef.allDay) { + return ['timed']; + } + if (hasBgRendering(eventDef)) { + return ['timed', 'allDay']; + } + return ['allDay']; + } + } + + const DEFAULT_SLAT_LABEL_FORMAT = createFormatter({ + hour: 'numeric', + minute: '2-digit', + omitZeroMinute: true, + meridiem: 'short', + }); + function TimeColsAxisCell(props) { + let classNames = [ + 'fc-timegrid-slot', + 'fc-timegrid-slot-label', + props.isLabeled ? 'fc-scrollgrid-shrink' : 'fc-timegrid-slot-minor', + ]; + return (h(ViewContextType.Consumer, null, (context) => { + if (!props.isLabeled) { + return (h("td", { className: classNames.join(' '), "data-time": props.isoTimeStr })); + } + let { dateEnv, options, viewApi } = context; + let labelFormat = // TODO: fully pre-parse + options.slotLabelFormat == null ? DEFAULT_SLAT_LABEL_FORMAT : + Array.isArray(options.slotLabelFormat) ? createFormatter(options.slotLabelFormat[0]) : + createFormatter(options.slotLabelFormat); + let renderProps = { + level: 0, + time: props.time, + date: dateEnv.toDate(props.date), + view: viewApi, + text: dateEnv.format(props.date, labelFormat), + }; + return (h(ContentContainer, { elTag: "td", elClasses: classNames, elAttrs: { + 'data-time': props.isoTimeStr, + }, renderProps: renderProps, generatorName: "slotLabelContent", generator: options.slotLabelContent || renderInnerContent$3, classNameGenerator: options.slotLabelClassNames, didMount: options.slotLabelDidMount, willUnmount: options.slotLabelWillUnmount }, (InnerContent) => (h("div", { className: "fc-timegrid-slot-label-frame fc-scrollgrid-shrink-frame" }, + h(InnerContent, { elTag: "div", elClasses: [ + 'fc-timegrid-slot-label-cushion', + 'fc-scrollgrid-shrink-cushion', + ] }))))); + })); + } + function renderInnerContent$3(props) { + return props.text; + } + + class TimeBodyAxis extends BaseComponent { + render() { + return this.props.slatMetas.map((slatMeta) => (h("tr", { key: slatMeta.key }, + h(TimeColsAxisCell, Object.assign({}, slatMeta))))); + } + } + + const DEFAULT_WEEK_NUM_FORMAT = createFormatter({ week: 'short' }); + const AUTO_ALL_DAY_MAX_EVENT_ROWS = 5; + class TimeColsView extends DateComponent { + constructor() { + super(...arguments); + this.allDaySplitter = new AllDaySplitter(); // for use by subclasses + this.headerElRef = y(); + this.rootElRef = y(); + this.scrollerElRef = y(); + this.state = { + slatCoords: null, + }; + this.handleScrollTopRequest = (scrollTop) => { + let scrollerEl = this.scrollerElRef.current; + if (scrollerEl) { // TODO: not sure how this could ever be null. weirdness with the reducer + scrollerEl.scrollTop = scrollTop; + } + }; + /* Header Render Methods + ------------------------------------------------------------------------------------------------------------------*/ + this.renderHeadAxis = (rowKey, frameHeight = '') => { + let { options } = this.context; + let { dateProfile } = this.props; + let range = dateProfile.renderRange; + let dayCnt = diffDays(range.start, range.end); + // only do in day views (to avoid doing in week views that dont need it) + let navLinkAttrs = (dayCnt === 1) + ? buildNavLinkAttrs(this.context, range.start, 'week') + : {}; + if (options.weekNumbers && rowKey === 'day') { + return (h(WeekNumberContainer, { elTag: "th", elClasses: [ + 'fc-timegrid-axis', + 'fc-scrollgrid-shrink', + ], elAttrs: { + 'aria-hidden': true, + }, date: range.start, defaultFormat: DEFAULT_WEEK_NUM_FORMAT }, (InnerContent) => (h("div", { className: [ + 'fc-timegrid-axis-frame', + 'fc-scrollgrid-shrink-frame', + 'fc-timegrid-axis-frame-liquid', + ].join(' '), style: { height: frameHeight } }, + h(InnerContent, { elTag: "a", elClasses: [ + 'fc-timegrid-axis-cushion', + 'fc-scrollgrid-shrink-cushion', + 'fc-scrollgrid-sync-inner', + ], elAttrs: navLinkAttrs }))))); + } + return (h("th", { "aria-hidden": true, className: "fc-timegrid-axis" }, + h("div", { className: "fc-timegrid-axis-frame", style: { height: frameHeight } }))); + }; + /* Table Component Render Methods + ------------------------------------------------------------------------------------------------------------------*/ + // only a one-way height sync. we don't send the axis inner-content height to the DayGrid, + // but DayGrid still needs to have classNames on inner elements in order to measure. + this.renderTableRowAxis = (rowHeight) => { + let { options, viewApi } = this.context; + let renderProps = { + text: options.allDayText, + view: viewApi, + }; + return ( + // TODO: make reusable hook. used in list view too + h(ContentContainer, { elTag: "td", elClasses: [ + 'fc-timegrid-axis', + 'fc-scrollgrid-shrink', + ], elAttrs: { + 'aria-hidden': true, + }, renderProps: renderProps, generatorName: "allDayContent", generator: options.allDayContent || renderAllDayInner$1, classNameGenerator: options.allDayClassNames, didMount: options.allDayDidMount, willUnmount: options.allDayWillUnmount }, (InnerContent) => (h("div", { className: [ + 'fc-timegrid-axis-frame', + 'fc-scrollgrid-shrink-frame', + rowHeight == null ? ' fc-timegrid-axis-frame-liquid' : '', + ].join(' '), style: { height: rowHeight } }, + h(InnerContent, { elTag: "span", elClasses: [ + 'fc-timegrid-axis-cushion', + 'fc-scrollgrid-shrink-cushion', + 'fc-scrollgrid-sync-inner', + ] }))))); + }; + this.handleSlatCoords = (slatCoords) => { + this.setState({ slatCoords }); + }; + } + // rendering + // ---------------------------------------------------------------------------------------------------- + renderSimpleLayout(headerRowContent, allDayContent, timeContent) { + let { context, props } = this; + let sections = []; + let stickyHeaderDates = getStickyHeaderDates(context.options); + if (headerRowContent) { + sections.push({ + type: 'header', + key: 'header', + isSticky: stickyHeaderDates, + chunk: { + elRef: this.headerElRef, + tableClassName: 'fc-col-header', + rowContent: headerRowContent, + }, + }); + } + if (allDayContent) { + sections.push({ + type: 'body', + key: 'all-day', + chunk: { content: allDayContent }, + }); + sections.push({ + type: 'body', + key: 'all-day-divider', + outerContent: ( // TODO: rename to cellContent so don't need to define <tr>? + h("tr", { role: "presentation", className: "fc-scrollgrid-section" }, + h("td", { className: 'fc-timegrid-divider ' + context.theme.getClass('tableCellShaded') }))), + }); + } + sections.push({ + type: 'body', + key: 'body', + liquid: true, + expandRows: Boolean(context.options.expandRows), + chunk: { + scrollerElRef: this.scrollerElRef, + content: timeContent, + }, + }); + return (h(ViewContainer$1, { elRef: this.rootElRef, elClasses: ['fc-timegrid'], viewSpec: context.viewSpec }, + h(SimpleScrollGrid, { liquid: !props.isHeightAuto && !props.forPrint, collapsibleWidth: props.forPrint, cols: [{ width: 'shrink' }], sections: sections }))); + } + renderHScrollLayout(headerRowContent, allDayContent, timeContent, colCnt, dayMinWidth, slatMetas, slatCoords) { + let ScrollGrid = this.context.pluginHooks.scrollGridImpl; + if (!ScrollGrid) { + throw new Error('No ScrollGrid implementation'); + } + let { context, props } = this; + let stickyHeaderDates = !props.forPrint && getStickyHeaderDates(context.options); + let stickyFooterScrollbar = !props.forPrint && getStickyFooterScrollbar(context.options); + let sections = []; + if (headerRowContent) { + sections.push({ + type: 'header', + key: 'header', + isSticky: stickyHeaderDates, + syncRowHeights: true, + chunks: [ + { + key: 'axis', + rowContent: (arg) => (h("tr", { role: "presentation" }, this.renderHeadAxis('day', arg.rowSyncHeights[0]))), + }, + { + key: 'cols', + elRef: this.headerElRef, + tableClassName: 'fc-col-header', + rowContent: headerRowContent, + }, + ], + }); + } + if (allDayContent) { + sections.push({ + type: 'body', + key: 'all-day', + syncRowHeights: true, + chunks: [ + { + key: 'axis', + rowContent: (contentArg) => (h("tr", { role: "presentation" }, this.renderTableRowAxis(contentArg.rowSyncHeights[0]))), + }, + { + key: 'cols', + content: allDayContent, + }, + ], + }); + sections.push({ + key: 'all-day-divider', + type: 'body', + outerContent: ( // TODO: rename to cellContent so don't need to define <tr>? + h("tr", { role: "presentation", className: "fc-scrollgrid-section" }, + h("td", { colSpan: 2, className: 'fc-timegrid-divider ' + context.theme.getClass('tableCellShaded') }))), + }); + } + let isNowIndicator = context.options.nowIndicator; + sections.push({ + type: 'body', + key: 'body', + liquid: true, + expandRows: Boolean(context.options.expandRows), + chunks: [ + { + key: 'axis', + content: (arg) => ( + // TODO: make this now-indicator arrow more DRY with TimeColsContent + h("div", { className: "fc-timegrid-axis-chunk" }, + h("table", { "aria-hidden": true, style: { height: arg.expandRows ? arg.clientHeight : '' } }, + arg.tableColGroupNode, + h("tbody", null, + h(TimeBodyAxis, { slatMetas: slatMetas }))), + h("div", { className: "fc-timegrid-now-indicator-container" }, + h(NowTimer, { unit: isNowIndicator ? 'minute' : 'day' /* hacky */ }, (nowDate) => { + let nowIndicatorTop = isNowIndicator && + slatCoords && + slatCoords.safeComputeTop(nowDate); // might return void + if (typeof nowIndicatorTop === 'number') { + return (h(NowIndicatorContainer, { elClasses: ['fc-timegrid-now-indicator-arrow'], elStyle: { top: nowIndicatorTop }, isAxis: true, date: nowDate })); + } + return null; + })))), + }, + { + key: 'cols', + scrollerElRef: this.scrollerElRef, + content: timeContent, + }, + ], + }); + if (stickyFooterScrollbar) { + sections.push({ + key: 'footer', + type: 'footer', + isSticky: true, + chunks: [ + { + key: 'axis', + content: renderScrollShim, + }, + { + key: 'cols', + content: renderScrollShim, + }, + ], + }); + } + return (h(ViewContainer$1, { elRef: this.rootElRef, elClasses: ['fc-timegrid'], viewSpec: context.viewSpec }, + h(ScrollGrid, { liquid: !props.isHeightAuto && !props.forPrint, collapsibleWidth: false, colGroups: [ + { width: 'shrink', cols: [{ width: 'shrink' }] }, + { cols: [{ span: colCnt, minWidth: dayMinWidth }] }, + ], sections: sections }))); + } + /* Dimensions + ------------------------------------------------------------------------------------------------------------------*/ + getAllDayMaxEventProps() { + let { dayMaxEvents, dayMaxEventRows } = this.context.options; + if (dayMaxEvents === true || dayMaxEventRows === true) { // is auto? + dayMaxEvents = undefined; + dayMaxEventRows = AUTO_ALL_DAY_MAX_EVENT_ROWS; // make sure "auto" goes to a real number + } + return { dayMaxEvents, dayMaxEventRows }; + } + } + function renderAllDayInner$1(renderProps) { + return renderProps.text; + } + + class TimeColsSlatsCoords { + constructor(positions, dateProfile, slotDuration) { + this.positions = positions; + this.dateProfile = dateProfile; + this.slotDuration = slotDuration; + } + safeComputeTop(date) { + let { dateProfile } = this; + if (rangeContainsMarker(dateProfile.currentRange, date)) { + let startOfDayDate = startOfDay(date); + let timeMs = date.valueOf() - startOfDayDate.valueOf(); + if (timeMs >= asRoughMs(dateProfile.slotMinTime) && + timeMs < asRoughMs(dateProfile.slotMaxTime)) { + return this.computeTimeTop(createDuration(timeMs)); + } + } + return null; + } + // Computes the top coordinate, relative to the bounds of the grid, of the given date. + // A `startOfDayDate` must be given for avoiding ambiguity over how to treat midnight. + computeDateTop(when, startOfDayDate) { + if (!startOfDayDate) { + startOfDayDate = startOfDay(when); + } + return this.computeTimeTop(createDuration(when.valueOf() - startOfDayDate.valueOf())); + } + // Computes the top coordinate, relative to the bounds of the grid, of the given time (a Duration). + // This is a makeshify way to compute the time-top. Assumes all slatMetas dates are uniform. + // Eventually allow computation with arbirary slat dates. + computeTimeTop(duration) { + let { positions, dateProfile } = this; + let len = positions.els.length; + // floating-point value of # of slots covered + let slatCoverage = (duration.milliseconds - asRoughMs(dateProfile.slotMinTime)) / asRoughMs(this.slotDuration); + let slatIndex; + let slatRemainder; + // compute a floating-point number for how many slats should be progressed through. + // from 0 to number of slats (inclusive) + // constrained because slotMinTime/slotMaxTime might be customized. + slatCoverage = Math.max(0, slatCoverage); + slatCoverage = Math.min(len, slatCoverage); + // an integer index of the furthest whole slat + // from 0 to number slats (*exclusive*, so len-1) + slatIndex = Math.floor(slatCoverage); + slatIndex = Math.min(slatIndex, len - 1); + // how much further through the slatIndex slat (from 0.0-1.0) must be covered in addition. + // could be 1.0 if slatCoverage is covering *all* the slots + slatRemainder = slatCoverage - slatIndex; + return positions.tops[slatIndex] + + positions.getHeight(slatIndex) * slatRemainder; + } + } + + class TimeColsSlatsBody extends BaseComponent { + render() { + let { props, context } = this; + let { options } = context; + let { slatElRefs } = props; + return (h("tbody", null, props.slatMetas.map((slatMeta, i) => { + let renderProps = { + time: slatMeta.time, + date: context.dateEnv.toDate(slatMeta.date), + view: context.viewApi, + }; + return (h("tr", { key: slatMeta.key, ref: slatElRefs.createRef(slatMeta.key) }, + props.axis && (h(TimeColsAxisCell, Object.assign({}, slatMeta))), + h(ContentContainer, { elTag: "td", elClasses: [ + 'fc-timegrid-slot', + 'fc-timegrid-slot-lane', + !slatMeta.isLabeled && 'fc-timegrid-slot-minor', + ], elAttrs: { + 'data-time': slatMeta.isoTimeStr, + }, renderProps: renderProps, generatorName: "slotLaneContent", generator: options.slotLaneContent, classNameGenerator: options.slotLaneClassNames, didMount: options.slotLaneDidMount, willUnmount: options.slotLaneWillUnmount }))); + }))); + } + } + + /* + for the horizontal "slats" that run width-wise. Has a time axis on a side. Depends on RTL. + */ + class TimeColsSlats extends BaseComponent { + constructor() { + super(...arguments); + this.rootElRef = y(); + this.slatElRefs = new RefMap(); + } + render() { + let { props, context } = this; + return (h("div", { ref: this.rootElRef, className: "fc-timegrid-slots" }, + h("table", { "aria-hidden": true, className: context.theme.getClass('table'), style: { + minWidth: props.tableMinWidth, + width: props.clientWidth, + height: props.minHeight, + } }, + props.tableColGroupNode /* relies on there only being a single <col> for the axis */, + h(TimeColsSlatsBody, { slatElRefs: this.slatElRefs, axis: props.axis, slatMetas: props.slatMetas })))); + } + componentDidMount() { + this.updateSizing(); + } + componentDidUpdate() { + this.updateSizing(); + } + componentWillUnmount() { + if (this.props.onCoords) { + this.props.onCoords(null); + } + } + updateSizing() { + let { context, props } = this; + if (props.onCoords && + props.clientWidth !== null // means sizing has stabilized + ) { + let rootEl = this.rootElRef.current; + if (rootEl.offsetHeight) { // not hidden by css + props.onCoords(new TimeColsSlatsCoords(new PositionCache(this.rootElRef.current, collectSlatEls(this.slatElRefs.currentMap, props.slatMetas), false, true), this.props.dateProfile, context.options.slotDuration)); + } + } + } + } + function collectSlatEls(elMap, slatMetas) { + return slatMetas.map((slatMeta) => elMap[slatMeta.key]); + } + + function splitSegsByCol(segs, colCnt) { + let segsByCol = []; + let i; + for (i = 0; i < colCnt; i += 1) { + segsByCol.push([]); + } + if (segs) { + for (i = 0; i < segs.length; i += 1) { + segsByCol[segs[i].col].push(segs[i]); + } + } + return segsByCol; + } + function splitInteractionByCol(ui, colCnt) { + let byRow = []; + if (!ui) { + for (let i = 0; i < colCnt; i += 1) { + byRow[i] = null; + } + } + else { + for (let i = 0; i < colCnt; i += 1) { + byRow[i] = { + affectedInstances: ui.affectedInstances, + isEvent: ui.isEvent, + segs: [], + }; + } + for (let seg of ui.segs) { + byRow[seg.col].segs.push(seg); + } + } + return byRow; + } + + class TimeColMoreLink extends BaseComponent { + render() { + let { props } = this; + return (h(MoreLinkContainer, { elClasses: ['fc-timegrid-more-link'], elStyle: { + top: props.top, + bottom: props.bottom, + }, allDayDate: null, moreCnt: props.hiddenSegs.length, allSegs: props.hiddenSegs, hiddenSegs: props.hiddenSegs, extraDateSpan: props.extraDateSpan, dateProfile: props.dateProfile, todayRange: props.todayRange, popoverContent: () => renderPlainFgSegs(props.hiddenSegs, props), defaultGenerator: renderMoreLinkInner }, (InnerContent) => (h(InnerContent, { elTag: "div", elClasses: ['fc-timegrid-more-link-inner', 'fc-sticky'] })))); + } + } + function renderMoreLinkInner(props) { + return props.shortText; + } + + // segInputs assumed sorted + function buildPositioning(segInputs, strictOrder, maxStackCnt) { + let hierarchy = new SegHierarchy(); + if (strictOrder != null) { + hierarchy.strictOrder = strictOrder; + } + if (maxStackCnt != null) { + hierarchy.maxStackCnt = maxStackCnt; + } + let hiddenEntries = hierarchy.addSegs(segInputs); + let hiddenGroups = groupIntersectingEntries(hiddenEntries); + let web = buildWeb(hierarchy); + web = stretchWeb(web, 1); // all levelCoords/thickness will have 0.0-1.0 + let segRects = webToRects(web); + return { segRects, hiddenGroups }; + } + function buildWeb(hierarchy) { + const { entriesByLevel } = hierarchy; + const buildNode = cacheable((level, lateral) => level + ':' + lateral, (level, lateral) => { + let siblingRange = findNextLevelSegs(hierarchy, level, lateral); + let nextLevelRes = buildNodes(siblingRange, buildNode); + let entry = entriesByLevel[level][lateral]; + return [ + Object.assign(Object.assign({}, entry), { nextLevelNodes: nextLevelRes[0] }), + entry.thickness + nextLevelRes[1], // the pressure builds + ]; + }); + return buildNodes(entriesByLevel.length + ? { level: 0, lateralStart: 0, lateralEnd: entriesByLevel[0].length } + : null, buildNode)[0]; + } + function buildNodes(siblingRange, buildNode) { + if (!siblingRange) { + return [[], 0]; + } + let { level, lateralStart, lateralEnd } = siblingRange; + let lateral = lateralStart; + let pairs = []; + while (lateral < lateralEnd) { + pairs.push(buildNode(level, lateral)); + lateral += 1; + } + pairs.sort(cmpDescPressures); + return [ + pairs.map(extractNode), + pairs[0][1], // first item's pressure + ]; + } + function cmpDescPressures(a, b) { + return b[1] - a[1]; + } + function extractNode(a) { + return a[0]; + } + function findNextLevelSegs(hierarchy, subjectLevel, subjectLateral) { + let { levelCoords, entriesByLevel } = hierarchy; + let subjectEntry = entriesByLevel[subjectLevel][subjectLateral]; + let afterSubject = levelCoords[subjectLevel] + subjectEntry.thickness; + let levelCnt = levelCoords.length; + let level = subjectLevel; + // skip past levels that are too high up + for (; level < levelCnt && levelCoords[level] < afterSubject; level += 1) + ; // do nothing + for (; level < levelCnt; level += 1) { + let entries = entriesByLevel[level]; + let entry; + let searchIndex = binarySearch(entries, subjectEntry.span.start, getEntrySpanEnd); + let lateralStart = searchIndex[0] + searchIndex[1]; // if exact match (which doesn't collide), go to next one + let lateralEnd = lateralStart; + while ( // loop through entries that horizontally intersect + (entry = entries[lateralEnd]) && // but not past the whole seg list + entry.span.start < subjectEntry.span.end) { + lateralEnd += 1; + } + if (lateralStart < lateralEnd) { + return { level, lateralStart, lateralEnd }; + } + } + return null; + } + function stretchWeb(topLevelNodes, totalThickness) { + const stretchNode = cacheable((node, startCoord, prevThickness) => buildEntryKey(node), (node, startCoord, prevThickness) => { + let { nextLevelNodes, thickness } = node; + let allThickness = thickness + prevThickness; + let thicknessFraction = thickness / allThickness; + let endCoord; + let newChildren = []; + if (!nextLevelNodes.length) { + endCoord = totalThickness; + } + else { + for (let childNode of nextLevelNodes) { + if (endCoord === undefined) { + let res = stretchNode(childNode, startCoord, allThickness); + endCoord = res[0]; + newChildren.push(res[1]); + } + else { + let res = stretchNode(childNode, endCoord, 0); + newChildren.push(res[1]); + } + } + } + let newThickness = (endCoord - startCoord) * thicknessFraction; + return [endCoord - newThickness, Object.assign(Object.assign({}, node), { thickness: newThickness, nextLevelNodes: newChildren })]; + }); + return topLevelNodes.map((node) => stretchNode(node, 0, 0)[1]); + } + // not sorted in any particular order + function webToRects(topLevelNodes) { + let rects = []; + const processNode = cacheable((node, levelCoord, stackDepth) => buildEntryKey(node), (node, levelCoord, stackDepth) => { + let rect = Object.assign(Object.assign({}, node), { levelCoord, + stackDepth, stackForward: 0 }); + rects.push(rect); + return (rect.stackForward = processNodes(node.nextLevelNodes, levelCoord + node.thickness, stackDepth + 1) + 1); + }); + function processNodes(nodes, levelCoord, stackDepth) { + let stackForward = 0; + for (let node of nodes) { + stackForward = Math.max(processNode(node, levelCoord, stackDepth), stackForward); + } + return stackForward; + } + processNodes(topLevelNodes, 0, 0); + return rects; // TODO: sort rects by levelCoord to be consistent with toRects? + } + // TODO: move to general util + function cacheable(keyFunc, workFunc) { + const cache = {}; + return (...args) => { + let key = keyFunc(...args); + return (key in cache) + ? cache[key] + : (cache[key] = workFunc(...args)); + }; + } + + function computeSegVCoords(segs, colDate, slatCoords = null, eventMinHeight = 0) { + let vcoords = []; + if (slatCoords) { + for (let i = 0; i < segs.length; i += 1) { + let seg = segs[i]; + let spanStart = slatCoords.computeDateTop(seg.start, colDate); + let spanEnd = Math.max(spanStart + (eventMinHeight || 0), // :( + slatCoords.computeDateTop(seg.end, colDate)); + vcoords.push({ + start: Math.round(spanStart), + end: Math.round(spanEnd), // + }); + } + } + return vcoords; + } + function computeFgSegPlacements$1(segs, segVCoords, // might not have for every seg + eventOrderStrict, eventMaxStack) { + let segInputs = []; + let dumbSegs = []; // segs without coords + for (let i = 0; i < segs.length; i += 1) { + let vcoords = segVCoords[i]; + if (vcoords) { + segInputs.push({ + index: i, + thickness: 1, + span: vcoords, + }); + } + else { + dumbSegs.push(segs[i]); + } + } + let { segRects, hiddenGroups } = buildPositioning(segInputs, eventOrderStrict, eventMaxStack); + let segPlacements = []; + for (let segRect of segRects) { + segPlacements.push({ + seg: segs[segRect.index], + rect: segRect, + }); + } + for (let dumbSeg of dumbSegs) { + segPlacements.push({ seg: dumbSeg, rect: null }); + } + return { segPlacements, hiddenGroups }; + } + + const DEFAULT_TIME_FORMAT$2 = createFormatter({ + hour: 'numeric', + minute: '2-digit', + meridiem: false, + }); + class TimeColEvent extends BaseComponent { + render() { + return (h(StandardEvent, Object.assign({}, this.props, { elClasses: [ + 'fc-timegrid-event', + 'fc-v-event', + this.props.isShort && 'fc-timegrid-event-short', + ], defaultTimeFormat: DEFAULT_TIME_FORMAT$2 }))); + } + } + + class TimeCol extends BaseComponent { + constructor() { + super(...arguments); + this.sortEventSegs = memoize(sortEventSegs); + } + // TODO: memoize event-placement? + render() { + let { props, context } = this; + let { options } = context; + let isSelectMirror = options.selectMirror; + let mirrorSegs = // yuck + (props.eventDrag && props.eventDrag.segs) || + (props.eventResize && props.eventResize.segs) || + (isSelectMirror && props.dateSelectionSegs) || + []; + let interactionAffectedInstances = // TODO: messy way to compute this + (props.eventDrag && props.eventDrag.affectedInstances) || + (props.eventResize && props.eventResize.affectedInstances) || + {}; + let sortedFgSegs = this.sortEventSegs(props.fgEventSegs, options.eventOrder); + return (h(DayCellContainer, { elTag: "td", elRef: props.elRef, elClasses: [ + 'fc-timegrid-col', + ...(props.extraClassNames || []), + ], elAttrs: Object.assign({ role: 'gridcell' }, props.extraDataAttrs), date: props.date, dateProfile: props.dateProfile, todayRange: props.todayRange, extraRenderProps: props.extraRenderProps }, (InnerContent) => (h("div", { className: "fc-timegrid-col-frame" }, + h("div", { className: "fc-timegrid-col-bg" }, + this.renderFillSegs(props.businessHourSegs, 'non-business'), + this.renderFillSegs(props.bgEventSegs, 'bg-event'), + this.renderFillSegs(props.dateSelectionSegs, 'highlight')), + h("div", { className: "fc-timegrid-col-events" }, this.renderFgSegs(sortedFgSegs, interactionAffectedInstances, false, false, false)), + h("div", { className: "fc-timegrid-col-events" }, this.renderFgSegs(mirrorSegs, {}, Boolean(props.eventDrag), Boolean(props.eventResize), Boolean(isSelectMirror))), + h("div", { className: "fc-timegrid-now-indicator-container" }, this.renderNowIndicator(props.nowIndicatorSegs)), + hasCustomDayCellContent(options) && (h(InnerContent, { elTag: "div", elClasses: ['fc-timegrid-col-misc'] })))))); + } + renderFgSegs(sortedFgSegs, segIsInvisible, isDragging, isResizing, isDateSelecting) { + let { props } = this; + if (props.forPrint) { + return renderPlainFgSegs(sortedFgSegs, props); + } + return this.renderPositionedFgSegs(sortedFgSegs, segIsInvisible, isDragging, isResizing, isDateSelecting); + } + renderPositionedFgSegs(segs, // if not mirror, needs to be sorted + segIsInvisible, isDragging, isResizing, isDateSelecting) { + let { eventMaxStack, eventShortHeight, eventOrderStrict, eventMinHeight } = this.context.options; + let { date, slatCoords, eventSelection, todayRange, nowDate } = this.props; + let isMirror = isDragging || isResizing || isDateSelecting; + let segVCoords = computeSegVCoords(segs, date, slatCoords, eventMinHeight); + let { segPlacements, hiddenGroups } = computeFgSegPlacements$1(segs, segVCoords, eventOrderStrict, eventMaxStack); + return (h(p, null, + this.renderHiddenGroups(hiddenGroups, segs), + segPlacements.map((segPlacement) => { + let { seg, rect } = segPlacement; + let instanceId = seg.eventRange.instance.instanceId; + let isVisible = isMirror || Boolean(!segIsInvisible[instanceId] && rect); + let vStyle = computeSegVStyle(rect && rect.span); + let hStyle = (!isMirror && rect) ? this.computeSegHStyle(rect) : { left: 0, right: 0 }; + let isInset = Boolean(rect) && rect.stackForward > 0; + let isShort = Boolean(rect) && (rect.span.end - rect.span.start) < eventShortHeight; // look at other places for this problem + return (h("div", { className: 'fc-timegrid-event-harness' + + (isInset ? ' fc-timegrid-event-harness-inset' : ''), key: instanceId, style: Object.assign(Object.assign({ visibility: isVisible ? '' : 'hidden' }, vStyle), hStyle) }, + h(TimeColEvent, Object.assign({ seg: seg, isDragging: isDragging, isResizing: isResizing, isDateSelecting: isDateSelecting, isSelected: instanceId === eventSelection, isShort: isShort }, getSegMeta(seg, todayRange, nowDate))))); + }))); + } + // will already have eventMinHeight applied because segInputs already had it + renderHiddenGroups(hiddenGroups, segs) { + let { extraDateSpan, dateProfile, todayRange, nowDate, eventSelection, eventDrag, eventResize } = this.props; + return (h(p, null, hiddenGroups.map((hiddenGroup) => { + let positionCss = computeSegVStyle(hiddenGroup.span); + let hiddenSegs = compileSegsFromEntries(hiddenGroup.entries, segs); + return (h(TimeColMoreLink, { key: buildIsoString(computeEarliestSegStart(hiddenSegs)), hiddenSegs: hiddenSegs, top: positionCss.top, bottom: positionCss.bottom, extraDateSpan: extraDateSpan, dateProfile: dateProfile, todayRange: todayRange, nowDate: nowDate, eventSelection: eventSelection, eventDrag: eventDrag, eventResize: eventResize })); + }))); + } + renderFillSegs(segs, fillType) { + let { props, context } = this; + let segVCoords = computeSegVCoords(segs, props.date, props.slatCoords, context.options.eventMinHeight); // don't assume all populated + let children = segVCoords.map((vcoords, i) => { + let seg = segs[i]; + return (h("div", { key: buildEventRangeKey(seg.eventRange), className: "fc-timegrid-bg-harness", style: computeSegVStyle(vcoords) }, fillType === 'bg-event' ? + h(BgEvent, Object.assign({ seg: seg }, getSegMeta(seg, props.todayRange, props.nowDate))) : + renderFill(fillType))); + }); + return h(p, null, children); + } + renderNowIndicator(segs) { + let { slatCoords, date } = this.props; + if (!slatCoords) { + return null; + } + return segs.map((seg, i) => (h(NowIndicatorContainer + // key doesn't matter. will only ever be one + , { + // key doesn't matter. will only ever be one + key: i, elClasses: ['fc-timegrid-now-indicator-line'], elStyle: { + top: slatCoords.computeDateTop(seg.start, date), + }, isAxis: false, date: date }))); + } + computeSegHStyle(segHCoords) { + let { isRtl, options } = this.context; + let shouldOverlap = options.slotEventOverlap; + let nearCoord = segHCoords.levelCoord; // the left side if LTR. the right side if RTL. floating-point + let farCoord = segHCoords.levelCoord + segHCoords.thickness; // the right side if LTR. the left side if RTL. floating-point + let left; // amount of space from left edge, a fraction of the total width + let right; // amount of space from right edge, a fraction of the total width + if (shouldOverlap) { + // double the width, but don't go beyond the maximum forward coordinate (1.0) + farCoord = Math.min(1, nearCoord + (farCoord - nearCoord) * 2); + } + if (isRtl) { + left = 1 - farCoord; + right = nearCoord; + } + else { + left = nearCoord; + right = 1 - farCoord; + } + let props = { + zIndex: segHCoords.stackDepth + 1, + left: left * 100 + '%', + right: right * 100 + '%', + }; + if (shouldOverlap && !segHCoords.stackForward) { + // add padding to the edge so that forward stacked events don't cover the resizer's icon + props[isRtl ? 'marginLeft' : 'marginRight'] = 10 * 2; // 10 is a guesstimate of the icon's width + } + return props; + } + } + function renderPlainFgSegs(sortedFgSegs, { todayRange, nowDate, eventSelection, eventDrag, eventResize }) { + let hiddenInstances = (eventDrag ? eventDrag.affectedInstances : null) || + (eventResize ? eventResize.affectedInstances : null) || + {}; + return (h(p, null, sortedFgSegs.map((seg) => { + let instanceId = seg.eventRange.instance.instanceId; + return (h("div", { key: instanceId, style: { visibility: hiddenInstances[instanceId] ? 'hidden' : '' } }, + h(TimeColEvent, Object.assign({ seg: seg, isDragging: false, isResizing: false, isDateSelecting: false, isSelected: instanceId === eventSelection, isShort: false }, getSegMeta(seg, todayRange, nowDate))))); + }))); + } + function computeSegVStyle(segVCoords) { + if (!segVCoords) { + return { top: '', bottom: '' }; + } + return { + top: segVCoords.start, + bottom: -segVCoords.end, + }; + } + function compileSegsFromEntries(segEntries, allSegs) { + return segEntries.map((segEntry) => allSegs[segEntry.index]); + } + + class TimeColsContent extends BaseComponent { + constructor() { + super(...arguments); + this.splitFgEventSegs = memoize(splitSegsByCol); + this.splitBgEventSegs = memoize(splitSegsByCol); + this.splitBusinessHourSegs = memoize(splitSegsByCol); + this.splitNowIndicatorSegs = memoize(splitSegsByCol); + this.splitDateSelectionSegs = memoize(splitSegsByCol); + this.splitEventDrag = memoize(splitInteractionByCol); + this.splitEventResize = memoize(splitInteractionByCol); + this.rootElRef = y(); + this.cellElRefs = new RefMap(); + } + render() { + let { props, context } = this; + let nowIndicatorTop = context.options.nowIndicator && + props.slatCoords && + props.slatCoords.safeComputeTop(props.nowDate); // might return void + let colCnt = props.cells.length; + let fgEventSegsByRow = this.splitFgEventSegs(props.fgEventSegs, colCnt); + let bgEventSegsByRow = this.splitBgEventSegs(props.bgEventSegs, colCnt); + let businessHourSegsByRow = this.splitBusinessHourSegs(props.businessHourSegs, colCnt); + let nowIndicatorSegsByRow = this.splitNowIndicatorSegs(props.nowIndicatorSegs, colCnt); + let dateSelectionSegsByRow = this.splitDateSelectionSegs(props.dateSelectionSegs, colCnt); + let eventDragByRow = this.splitEventDrag(props.eventDrag, colCnt); + let eventResizeByRow = this.splitEventResize(props.eventResize, colCnt); + return (h("div", { className: "fc-timegrid-cols", ref: this.rootElRef }, + h("table", { role: "presentation", style: { + minWidth: props.tableMinWidth, + width: props.clientWidth, + } }, + props.tableColGroupNode, + h("tbody", { role: "presentation" }, + h("tr", { role: "row" }, + props.axis && (h("td", { "aria-hidden": true, className: "fc-timegrid-col fc-timegrid-axis" }, + h("div", { className: "fc-timegrid-col-frame" }, + h("div", { className: "fc-timegrid-now-indicator-container" }, typeof nowIndicatorTop === 'number' && (h(NowIndicatorContainer, { elClasses: ['fc-timegrid-now-indicator-arrow'], elStyle: { top: nowIndicatorTop }, isAxis: true, date: props.nowDate })))))), + props.cells.map((cell, i) => (h(TimeCol, { key: cell.key, elRef: this.cellElRefs.createRef(cell.key), dateProfile: props.dateProfile, date: cell.date, nowDate: props.nowDate, todayRange: props.todayRange, extraRenderProps: cell.extraRenderProps, extraDataAttrs: cell.extraDataAttrs, extraClassNames: cell.extraClassNames, extraDateSpan: cell.extraDateSpan, fgEventSegs: fgEventSegsByRow[i], bgEventSegs: bgEventSegsByRow[i], businessHourSegs: businessHourSegsByRow[i], nowIndicatorSegs: nowIndicatorSegsByRow[i], dateSelectionSegs: dateSelectionSegsByRow[i], eventDrag: eventDragByRow[i], eventResize: eventResizeByRow[i], slatCoords: props.slatCoords, eventSelection: props.eventSelection, forPrint: props.forPrint })))))))); + } + componentDidMount() { + this.updateCoords(); + } + componentDidUpdate() { + this.updateCoords(); + } + updateCoords() { + let { props } = this; + if (props.onColCoords && + props.clientWidth !== null // means sizing has stabilized + ) { + props.onColCoords(new PositionCache(this.rootElRef.current, collectCellEls$1(this.cellElRefs.currentMap, props.cells), true, // horizontal + false)); + } + } + } + function collectCellEls$1(elMap, cells) { + return cells.map((cell) => elMap[cell.key]); + } + + /* A component that renders one or more columns of vertical time slots + ----------------------------------------------------------------------------------------------------------------------*/ + class TimeCols extends DateComponent { + constructor() { + super(...arguments); + this.processSlotOptions = memoize(processSlotOptions); + this.state = { + slatCoords: null, + }; + this.handleRootEl = (el) => { + if (el) { + this.context.registerInteractiveComponent(this, { + el, + isHitComboAllowed: this.props.isHitComboAllowed, + }); + } + else { + this.context.unregisterInteractiveComponent(this); + } + }; + this.handleScrollRequest = (request) => { + let { onScrollTopRequest } = this.props; + let { slatCoords } = this.state; + if (onScrollTopRequest && slatCoords) { + if (request.time) { + let top = slatCoords.computeTimeTop(request.time); + top = Math.ceil(top); // zoom can give weird floating-point values. rather scroll a little bit further + if (top) { + top += 1; // to overcome top border that slots beyond the first have. looks better + } + onScrollTopRequest(top); + } + return true; + } + return false; + }; + this.handleColCoords = (colCoords) => { + this.colCoords = colCoords; + }; + this.handleSlatCoords = (slatCoords) => { + this.setState({ slatCoords }); + if (this.props.onSlatCoords) { + this.props.onSlatCoords(slatCoords); + } + }; + } + render() { + let { props, state } = this; + return (h("div", { className: "fc-timegrid-body", ref: this.handleRootEl, style: { + // these props are important to give this wrapper correct dimensions for interactions + // TODO: if we set it here, can we avoid giving to inner tables? + width: props.clientWidth, + minWidth: props.tableMinWidth, + } }, + h(TimeColsSlats, { axis: props.axis, dateProfile: props.dateProfile, slatMetas: props.slatMetas, clientWidth: props.clientWidth, minHeight: props.expandRows ? props.clientHeight : '', tableMinWidth: props.tableMinWidth, tableColGroupNode: props.axis ? props.tableColGroupNode : null /* axis depends on the colgroup's shrinking */, onCoords: this.handleSlatCoords }), + h(TimeColsContent, { cells: props.cells, axis: props.axis, dateProfile: props.dateProfile, businessHourSegs: props.businessHourSegs, bgEventSegs: props.bgEventSegs, fgEventSegs: props.fgEventSegs, dateSelectionSegs: props.dateSelectionSegs, eventSelection: props.eventSelection, eventDrag: props.eventDrag, eventResize: props.eventResize, todayRange: props.todayRange, nowDate: props.nowDate, nowIndicatorSegs: props.nowIndicatorSegs, clientWidth: props.clientWidth, tableMinWidth: props.tableMinWidth, tableColGroupNode: props.tableColGroupNode, slatCoords: state.slatCoords, onColCoords: this.handleColCoords, forPrint: props.forPrint }))); + } + componentDidMount() { + this.scrollResponder = this.context.createScrollResponder(this.handleScrollRequest); + } + componentDidUpdate(prevProps) { + this.scrollResponder.update(prevProps.dateProfile !== this.props.dateProfile); + } + componentWillUnmount() { + this.scrollResponder.detach(); + } + queryHit(positionLeft, positionTop) { + let { dateEnv, options } = this.context; + let { colCoords } = this; + let { dateProfile } = this.props; + let { slatCoords } = this.state; + let { snapDuration, snapsPerSlot } = this.processSlotOptions(this.props.slotDuration, options.snapDuration); + let colIndex = colCoords.leftToIndex(positionLeft); + let slatIndex = slatCoords.positions.topToIndex(positionTop); + if (colIndex != null && slatIndex != null) { + let cell = this.props.cells[colIndex]; + let slatTop = slatCoords.positions.tops[slatIndex]; + let slatHeight = slatCoords.positions.getHeight(slatIndex); + let partial = (positionTop - slatTop) / slatHeight; // floating point number between 0 and 1 + let localSnapIndex = Math.floor(partial * snapsPerSlot); // the snap # relative to start of slat + let snapIndex = slatIndex * snapsPerSlot + localSnapIndex; + let dayDate = this.props.cells[colIndex].date; + let time = addDurations(dateProfile.slotMinTime, multiplyDuration(snapDuration, snapIndex)); + let start = dateEnv.add(dayDate, time); + let end = dateEnv.add(start, snapDuration); + return { + dateProfile, + dateSpan: Object.assign({ range: { start, end }, allDay: false }, cell.extraDateSpan), + dayEl: colCoords.els[colIndex], + rect: { + left: colCoords.lefts[colIndex], + right: colCoords.rights[colIndex], + top: slatTop, + bottom: slatTop + slatHeight, + }, + layer: 0, + }; + } + return null; + } + } + function processSlotOptions(slotDuration, snapDurationOverride) { + let snapDuration = snapDurationOverride || slotDuration; + let snapsPerSlot = wholeDivideDurations(slotDuration, snapDuration); + if (snapsPerSlot === null) { + snapDuration = slotDuration; + snapsPerSlot = 1; + // TODO: say warning? + } + return { snapDuration, snapsPerSlot }; + } + + class DayTimeColsSlicer extends Slicer { + sliceRange(range, dayRanges) { + let segs = []; + for (let col = 0; col < dayRanges.length; col += 1) { + let segRange = intersectRanges(range, dayRanges[col]); + if (segRange) { + segs.push({ + start: segRange.start, + end: segRange.end, + isStart: segRange.start.valueOf() === range.start.valueOf(), + isEnd: segRange.end.valueOf() === range.end.valueOf(), + col, + }); + } + } + return segs; + } + } + + class DayTimeCols extends DateComponent { + constructor() { + super(...arguments); + this.buildDayRanges = memoize(buildDayRanges); + this.slicer = new DayTimeColsSlicer(); + this.timeColsRef = y(); + } + render() { + let { props, context } = this; + let { dateProfile, dayTableModel } = props; + let isNowIndicator = context.options.nowIndicator; + let dayRanges = this.buildDayRanges(dayTableModel, dateProfile, context.dateEnv); + // give it the first row of cells + // TODO: would move this further down hierarchy, but sliceNowDate needs it + return (h(NowTimer, { unit: isNowIndicator ? 'minute' : 'day' }, (nowDate, todayRange) => (h(TimeCols, Object.assign({ ref: this.timeColsRef }, this.slicer.sliceProps(props, dateProfile, null, context, dayRanges), { forPrint: props.forPrint, axis: props.axis, dateProfile: dateProfile, slatMetas: props.slatMetas, slotDuration: props.slotDuration, cells: dayTableModel.cells[0], tableColGroupNode: props.tableColGroupNode, tableMinWidth: props.tableMinWidth, clientWidth: props.clientWidth, clientHeight: props.clientHeight, expandRows: props.expandRows, nowDate: nowDate, nowIndicatorSegs: isNowIndicator && this.slicer.sliceNowDate(nowDate, context, dayRanges), todayRange: todayRange, onScrollTopRequest: props.onScrollTopRequest, onSlatCoords: props.onSlatCoords }))))); + } + } + function buildDayRanges(dayTableModel, dateProfile, dateEnv) { + let ranges = []; + for (let date of dayTableModel.headerDates) { + ranges.push({ + start: dateEnv.add(date, dateProfile.slotMinTime), + end: dateEnv.add(date, dateProfile.slotMaxTime), + }); + } + return ranges; + } + + // potential nice values for the slot-duration and interval-duration + // from largest to smallest + const STOCK_SUB_DURATIONS$1 = [ + { hours: 1 }, + { minutes: 30 }, + { minutes: 15 }, + { seconds: 30 }, + { seconds: 15 }, + ]; + function buildSlatMetas(slotMinTime, slotMaxTime, explicitLabelInterval, slotDuration, dateEnv) { + let dayStart = new Date(0); + let slatTime = slotMinTime; + let slatIterator = createDuration(0); + let labelInterval = explicitLabelInterval || computeLabelInterval(slotDuration); + let metas = []; + while (asRoughMs(slatTime) < asRoughMs(slotMaxTime)) { + let date = dateEnv.add(dayStart, slatTime); + let isLabeled = wholeDivideDurations(slatIterator, labelInterval) !== null; + metas.push({ + date, + time: slatTime, + key: date.toISOString(), + isoTimeStr: formatIsoTimeString(date), + isLabeled, + }); + slatTime = addDurations(slatTime, slotDuration); + slatIterator = addDurations(slatIterator, slotDuration); + } + return metas; + } + // Computes an automatic value for slotLabelInterval + function computeLabelInterval(slotDuration) { + let i; + let labelInterval; + let slotsPerLabel; + // find the smallest stock label interval that results in more than one slots-per-label + for (i = STOCK_SUB_DURATIONS$1.length - 1; i >= 0; i -= 1) { + labelInterval = createDuration(STOCK_SUB_DURATIONS$1[i]); + slotsPerLabel = wholeDivideDurations(labelInterval, slotDuration); + if (slotsPerLabel !== null && slotsPerLabel > 1) { + return labelInterval; + } + } + return slotDuration; // fall back + } + + class DayTimeColsView extends TimeColsView { + constructor() { + super(...arguments); + this.buildTimeColsModel = memoize(buildTimeColsModel); + this.buildSlatMetas = memoize(buildSlatMetas); + } + render() { + let { options, dateEnv, dateProfileGenerator } = this.context; + let { props } = this; + let { dateProfile } = props; + let dayTableModel = this.buildTimeColsModel(dateProfile, dateProfileGenerator); + let splitProps = this.allDaySplitter.splitProps(props); + let slatMetas = this.buildSlatMetas(dateProfile.slotMinTime, dateProfile.slotMaxTime, options.slotLabelInterval, options.slotDuration, dateEnv); + let { dayMinWidth } = options; + let hasAttachedAxis = !dayMinWidth; + let hasDetachedAxis = dayMinWidth; + let headerContent = options.dayHeaders && (h(DayHeader, { dates: dayTableModel.headerDates, dateProfile: dateProfile, datesRepDistinctDays: true, renderIntro: hasAttachedAxis ? this.renderHeadAxis : null })); + let allDayContent = (options.allDaySlot !== false) && ((contentArg) => (h(DayTable, Object.assign({}, splitProps.allDay, { dateProfile: dateProfile, dayTableModel: dayTableModel, nextDayThreshold: options.nextDayThreshold, tableMinWidth: contentArg.tableMinWidth, colGroupNode: contentArg.tableColGroupNode, renderRowIntro: hasAttachedAxis ? this.renderTableRowAxis : null, showWeekNumbers: false, expandRows: false, headerAlignElRef: this.headerElRef, clientWidth: contentArg.clientWidth, clientHeight: contentArg.clientHeight, forPrint: props.forPrint }, this.getAllDayMaxEventProps())))); + let timeGridContent = (contentArg) => (h(DayTimeCols, Object.assign({}, splitProps.timed, { dayTableModel: dayTableModel, dateProfile: dateProfile, axis: hasAttachedAxis, slotDuration: options.slotDuration, slatMetas: slatMetas, forPrint: props.forPrint, tableColGroupNode: contentArg.tableColGroupNode, tableMinWidth: contentArg.tableMinWidth, clientWidth: contentArg.clientWidth, clientHeight: contentArg.clientHeight, onSlatCoords: this.handleSlatCoords, expandRows: contentArg.expandRows, onScrollTopRequest: this.handleScrollTopRequest }))); + return hasDetachedAxis + ? this.renderHScrollLayout(headerContent, allDayContent, timeGridContent, dayTableModel.colCnt, dayMinWidth, slatMetas, this.state.slatCoords) + : this.renderSimpleLayout(headerContent, allDayContent, timeGridContent); + } + } + function buildTimeColsModel(dateProfile, dateProfileGenerator) { + let daySeries = new DaySeriesModel(dateProfile.renderRange, dateProfileGenerator); + return new DayTableModel(daySeries, false); + } + + const OPTION_REFINERS$3 = { + allDaySlot: Boolean, + }; + + var css_248z$4 = ".fc-v-event{background-color:var(--fc-event-bg-color);border:1px solid var(--fc-event-border-color);display:block}.fc-v-event .fc-event-main{color:var(--fc-event-text-color);height:100%}.fc-v-event .fc-event-main-frame{display:flex;flex-direction:column;height:100%}.fc-v-event .fc-event-time{flex-grow:0;flex-shrink:0;max-height:100%;overflow:hidden}.fc-v-event .fc-event-title-container{flex-grow:1;flex-shrink:1;min-height:0}.fc-v-event .fc-event-title{bottom:0;max-height:100%;overflow:hidden;top:0}.fc-v-event:not(.fc-event-start){border-top-left-radius:0;border-top-right-radius:0;border-top-width:0}.fc-v-event:not(.fc-event-end){border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-width:0}.fc-v-event.fc-event-selected:before{left:-10px;right:-10px}.fc-v-event .fc-event-resizer-start{cursor:n-resize}.fc-v-event .fc-event-resizer-end{cursor:s-resize}.fc-v-event:not(.fc-event-selected) .fc-event-resizer{height:var(--fc-event-resizer-thickness);left:0;right:0}.fc-v-event:not(.fc-event-selected) .fc-event-resizer-start{top:calc(var(--fc-event-resizer-thickness)/-2)}.fc-v-event:not(.fc-event-selected) .fc-event-resizer-end{bottom:calc(var(--fc-event-resizer-thickness)/-2)}.fc-v-event.fc-event-selected .fc-event-resizer{left:50%;margin-left:calc(var(--fc-event-resizer-dot-total-width)/-2)}.fc-v-event.fc-event-selected .fc-event-resizer-start{top:calc(var(--fc-event-resizer-dot-total-width)/-2)}.fc-v-event.fc-event-selected .fc-event-resizer-end{bottom:calc(var(--fc-event-resizer-dot-total-width)/-2)}.fc .fc-timegrid .fc-daygrid-body{z-index:2}.fc .fc-timegrid-divider{padding:0 0 2px}.fc .fc-timegrid-body{min-height:100%;position:relative;z-index:1}.fc .fc-timegrid-axis-chunk{position:relative}.fc .fc-timegrid-axis-chunk>table,.fc .fc-timegrid-slots{position:relative;z-index:1}.fc .fc-timegrid-slot{border-bottom:0;height:1.5em}.fc .fc-timegrid-slot:empty:before{content:\"\\00a0\"}.fc .fc-timegrid-slot-minor{border-top-style:dotted}.fc .fc-timegrid-slot-label-cushion{display:inline-block;white-space:nowrap}.fc .fc-timegrid-slot-label{vertical-align:middle}.fc .fc-timegrid-axis-cushion,.fc .fc-timegrid-slot-label-cushion{padding:0 4px}.fc .fc-timegrid-axis-frame-liquid{height:100%}.fc .fc-timegrid-axis-frame{align-items:center;display:flex;justify-content:flex-end;overflow:hidden}.fc .fc-timegrid-axis-cushion{flex-shrink:0;max-width:60px}.fc-direction-ltr .fc-timegrid-slot-label-frame{text-align:right}.fc-direction-rtl .fc-timegrid-slot-label-frame{text-align:left}.fc-liquid-hack .fc-timegrid-axis-frame-liquid{bottom:0;height:auto;left:0;position:absolute;right:0;top:0}.fc .fc-timegrid-col.fc-day-today{background-color:var(--fc-today-bg-color)}.fc .fc-timegrid-col-frame{min-height:100%;position:relative}.fc-media-screen.fc-liquid-hack .fc-timegrid-col-frame{bottom:0;height:auto;left:0;position:absolute;right:0;top:0}.fc-media-screen .fc-timegrid-cols{bottom:0;left:0;position:absolute;right:0;top:0}.fc-media-screen .fc-timegrid-cols>table{height:100%}.fc-media-screen .fc-timegrid-col-bg,.fc-media-screen .fc-timegrid-col-events,.fc-media-screen .fc-timegrid-now-indicator-container{left:0;position:absolute;right:0;top:0}.fc .fc-timegrid-col-bg{z-index:2}.fc .fc-timegrid-col-bg .fc-non-business{z-index:1}.fc .fc-timegrid-col-bg .fc-bg-event{z-index:2}.fc .fc-timegrid-col-bg .fc-highlight{z-index:3}.fc .fc-timegrid-bg-harness{left:0;position:absolute;right:0}.fc .fc-timegrid-col-events{z-index:3}.fc .fc-timegrid-now-indicator-container{bottom:0;overflow:hidden}.fc-direction-ltr .fc-timegrid-col-events{margin:0 2.5% 0 2px}.fc-direction-rtl .fc-timegrid-col-events{margin:0 2px 0 2.5%}.fc-timegrid-event-harness{position:absolute}.fc-timegrid-event-harness>.fc-timegrid-event{bottom:0;left:0;position:absolute;right:0;top:0}.fc-timegrid-event-harness-inset .fc-timegrid-event,.fc-timegrid-event.fc-event-mirror,.fc-timegrid-more-link{box-shadow:0 0 0 1px var(--fc-page-bg-color)}.fc-timegrid-event,.fc-timegrid-more-link{border-radius:3px;font-size:var(--fc-small-font-size)}.fc-timegrid-event{margin-bottom:1px}.fc-timegrid-event .fc-event-main{padding:1px 1px 0}.fc-timegrid-event .fc-event-time{font-size:var(--fc-small-font-size);margin-bottom:1px;white-space:nowrap}.fc-timegrid-event-short .fc-event-main-frame{flex-direction:row;overflow:hidden}.fc-timegrid-event-short .fc-event-time:after{content:\"\\00a0-\\00a0\"}.fc-timegrid-event-short .fc-event-title{font-size:var(--fc-small-font-size)}.fc-timegrid-more-link{background:var(--fc-more-link-bg-color);color:var(--fc-more-link-text-color);cursor:pointer;margin-bottom:1px;position:absolute;z-index:9999}.fc-timegrid-more-link-inner{padding:3px 2px;top:0}.fc-direction-ltr .fc-timegrid-more-link{right:0}.fc-direction-rtl .fc-timegrid-more-link{left:0}.fc .fc-timegrid-now-indicator-line{border-color:var(--fc-now-indicator-color);border-style:solid;border-width:1px 0 0;left:0;position:absolute;right:0;z-index:4}.fc .fc-timegrid-now-indicator-arrow{border-color:var(--fc-now-indicator-color);border-style:solid;margin-top:-5px;position:absolute;z-index:4}.fc-direction-ltr .fc-timegrid-now-indicator-arrow{border-bottom-color:transparent;border-top-color:transparent;border-width:5px 0 5px 6px;left:0}.fc-direction-rtl .fc-timegrid-now-indicator-arrow{border-bottom-color:transparent;border-top-color:transparent;border-width:5px 6px 5px 0;right:0}"; + injectStyles(css_248z$4); + + var index$9 = createPlugin({ + name: '@fullcalendar/timegrid', + initialView: 'timeGridWeek', + optionRefiners: OPTION_REFINERS$3, + views: { + timeGrid: { + component: DayTimeColsView, + usesMinMaxTime: true, + allDaySlot: true, + slotDuration: '00:30:00', + slotEventOverlap: true, // a bad name. confused with overlap/constraint system + }, + timeGridDay: { + type: 'timeGrid', + duration: { days: 1 }, + }, + timeGridWeek: { + type: 'timeGrid', + duration: { weeks: 1 }, + }, + }, + }); + + class ListViewHeaderRow extends BaseComponent { + constructor() { + super(...arguments); + this.state = { + textId: getUniqueDomId(), + }; + } + render() { + let { theme, dateEnv, options, viewApi } = this.context; + let { cellId, dayDate, todayRange } = this.props; + let { textId } = this.state; + let dayMeta = getDateMeta(dayDate, todayRange); + // will ever be falsy? + let text = options.listDayFormat ? dateEnv.format(dayDate, options.listDayFormat) : ''; + // will ever be falsy? also, BAD NAME "alt" + let sideText = options.listDaySideFormat ? dateEnv.format(dayDate, options.listDaySideFormat) : ''; + let renderProps = Object.assign({ date: dateEnv.toDate(dayDate), view: viewApi, textId, + text, + sideText, navLinkAttrs: buildNavLinkAttrs(this.context, dayDate), sideNavLinkAttrs: buildNavLinkAttrs(this.context, dayDate, 'day', false) }, dayMeta); + // TODO: make a reusable HOC for dayHeader (used in daygrid/timegrid too) + return (h(ContentContainer, { elTag: "tr", elClasses: [ + 'fc-list-day', + ...getDayClassNames(dayMeta, theme), + ], elAttrs: { + 'data-date': formatDayString(dayDate), + }, renderProps: renderProps, generatorName: "dayHeaderContent", generator: options.dayHeaderContent || renderInnerContent$2, classNameGenerator: options.dayHeaderClassNames, didMount: options.dayHeaderDidMount, willUnmount: options.dayHeaderWillUnmount }, (InnerContent) => ( // TODO: force-hide top border based on :first-child + h("th", { scope: "colgroup", colSpan: 3, id: cellId, "aria-labelledby": textId }, + h(InnerContent, { elTag: "div", elClasses: [ + 'fc-list-day-cushion', + theme.getClass('tableCellShaded'), + ] }))))); + } + } + function renderInnerContent$2(props) { + return (h(p, null, + props.text && (h("a", Object.assign({ id: props.textId, className: "fc-list-day-text" }, props.navLinkAttrs), props.text)), + props.sideText && ( /* not keyboard tabbable */h("a", Object.assign({ "aria-hidden": true, className: "fc-list-day-side-text" }, props.sideNavLinkAttrs), props.sideText)))); + } + + const DEFAULT_TIME_FORMAT$1 = createFormatter({ + hour: 'numeric', + minute: '2-digit', + meridiem: 'short', + }); + class ListViewEventRow extends BaseComponent { + render() { + let { props, context } = this; + let { options } = context; + let { seg, timeHeaderId, eventHeaderId, dateHeaderId } = props; + let timeFormat = options.eventTimeFormat || DEFAULT_TIME_FORMAT$1; + return (h(EventContainer, Object.assign({}, props, { elTag: "tr", elClasses: [ + 'fc-list-event', + seg.eventRange.def.url && 'fc-event-forced-url', + ], defaultGenerator: () => renderEventInnerContent(seg, context) /* weird */, seg: seg, timeText: "", disableDragging: true, disableResizing: true }), (InnerContent, eventContentArg) => (h(p, null, + buildTimeContent(seg, timeFormat, context, timeHeaderId, dateHeaderId), + h("td", { "aria-hidden": true, className: "fc-list-event-graphic" }, + h("span", { className: "fc-list-event-dot", style: { + borderColor: eventContentArg.borderColor || eventContentArg.backgroundColor, + } })), + h(InnerContent, { elTag: "td", elClasses: ['fc-list-event-title'], elAttrs: { headers: `${eventHeaderId} ${dateHeaderId}` } }))))); + } + } + function renderEventInnerContent(seg, context) { + let interactiveAttrs = getSegAnchorAttrs(seg, context); + return (h("a", Object.assign({}, interactiveAttrs), seg.eventRange.def.title)); + } + function buildTimeContent(seg, timeFormat, context, timeHeaderId, dateHeaderId) { + let { options } = context; + if (options.displayEventTime !== false) { + let eventDef = seg.eventRange.def; + let eventInstance = seg.eventRange.instance; + let doAllDay = false; + let timeText; + if (eventDef.allDay) { + doAllDay = true; + } + else if (isMultiDayRange(seg.eventRange.range)) { // TODO: use (!isStart || !isEnd) instead? + if (seg.isStart) { + timeText = buildSegTimeText(seg, timeFormat, context, null, null, eventInstance.range.start, seg.end); + } + else if (seg.isEnd) { + timeText = buildSegTimeText(seg, timeFormat, context, null, null, seg.start, eventInstance.range.end); + } + else { + doAllDay = true; + } + } + else { + timeText = buildSegTimeText(seg, timeFormat, context); + } + if (doAllDay) { + let renderProps = { + text: context.options.allDayText, + view: context.viewApi, + }; + return (h(ContentContainer, { elTag: "td", elClasses: ['fc-list-event-time'], elAttrs: { + headers: `${timeHeaderId} ${dateHeaderId}`, + }, renderProps: renderProps, generatorName: "allDayContent", generator: options.allDayContent || renderAllDayInner, classNameGenerator: options.allDayClassNames, didMount: options.allDayDidMount, willUnmount: options.allDayWillUnmount })); + } + return (h("td", { className: "fc-list-event-time" }, timeText)); + } + return null; + } + function renderAllDayInner(renderProps) { + return renderProps.text; + } + + /* + Responsible for the scroller, and forwarding event-related actions into the "grid". + */ + class ListView extends DateComponent { + constructor() { + super(...arguments); + this.computeDateVars = memoize(computeDateVars); + this.eventStoreToSegs = memoize(this._eventStoreToSegs); + this.state = { + timeHeaderId: getUniqueDomId(), + eventHeaderId: getUniqueDomId(), + dateHeaderIdRoot: getUniqueDomId(), + }; + this.setRootEl = (rootEl) => { + if (rootEl) { + this.context.registerInteractiveComponent(this, { + el: rootEl, + }); + } + else { + this.context.unregisterInteractiveComponent(this); + } + }; + } + render() { + let { props, context } = this; + let { dayDates, dayRanges } = this.computeDateVars(props.dateProfile); + let eventSegs = this.eventStoreToSegs(props.eventStore, props.eventUiBases, dayRanges); + return (h(ViewContainer$1, { elRef: this.setRootEl, elClasses: [ + 'fc-list', + context.theme.getClass('table'), + context.options.stickyHeaderDates !== false ? + 'fc-list-sticky' : + '', + ], viewSpec: context.viewSpec }, + h(Scroller, { liquid: !props.isHeightAuto, overflowX: props.isHeightAuto ? 'visible' : 'hidden', overflowY: props.isHeightAuto ? 'visible' : 'auto' }, eventSegs.length > 0 ? + this.renderSegList(eventSegs, dayDates) : + this.renderEmptyMessage()))); + } + renderEmptyMessage() { + let { options, viewApi } = this.context; + let renderProps = { + text: options.noEventsText, + view: viewApi, + }; + return (h(ContentContainer, { elTag: "div", elClasses: ['fc-list-empty'], renderProps: renderProps, generatorName: "noEventsContent", generator: options.noEventsContent || renderNoEventsInner, classNameGenerator: options.noEventsClassNames, didMount: options.noEventsDidMount, willUnmount: options.noEventsWillUnmount }, (InnerContent) => (h(InnerContent, { elTag: "div", elClasses: ['fc-list-empty-cushion'] })))); + } + renderSegList(allSegs, dayDates) { + let { theme, options } = this.context; + let { timeHeaderId, eventHeaderId, dateHeaderIdRoot } = this.state; + let segsByDay = groupSegsByDay(allSegs); // sparse array + return (h(NowTimer, { unit: "day" }, (nowDate, todayRange) => { + let innerNodes = []; + for (let dayIndex = 0; dayIndex < segsByDay.length; dayIndex += 1) { + let daySegs = segsByDay[dayIndex]; + if (daySegs) { // sparse array, so might be undefined + let dayStr = formatDayString(dayDates[dayIndex]); + let dateHeaderId = dateHeaderIdRoot + '-' + dayStr; + // append a day header + innerNodes.push(h(ListViewHeaderRow, { key: dayStr, cellId: dateHeaderId, dayDate: dayDates[dayIndex], todayRange: todayRange })); + daySegs = sortEventSegs(daySegs, options.eventOrder); + for (let seg of daySegs) { + innerNodes.push(h(ListViewEventRow, Object.assign({ key: dayStr + ':' + seg.eventRange.instance.instanceId /* are multiple segs for an instanceId */, seg: seg, isDragging: false, isResizing: false, isDateSelecting: false, isSelected: false, timeHeaderId: timeHeaderId, eventHeaderId: eventHeaderId, dateHeaderId: dateHeaderId }, getSegMeta(seg, todayRange, nowDate)))); + } + } + } + return (h("table", { className: 'fc-list-table ' + theme.getClass('table') }, + h("thead", null, + h("tr", null, + h("th", { scope: "col", id: timeHeaderId }, options.timeHint), + h("th", { scope: "col", "aria-hidden": true }), + h("th", { scope: "col", id: eventHeaderId }, options.eventHint))), + h("tbody", null, innerNodes))); + })); + } + _eventStoreToSegs(eventStore, eventUiBases, dayRanges) { + return this.eventRangesToSegs(sliceEventStore(eventStore, eventUiBases, this.props.dateProfile.activeRange, this.context.options.nextDayThreshold).fg, dayRanges); + } + eventRangesToSegs(eventRanges, dayRanges) { + let segs = []; + for (let eventRange of eventRanges) { + segs.push(...this.eventRangeToSegs(eventRange, dayRanges)); + } + return segs; + } + eventRangeToSegs(eventRange, dayRanges) { + let { dateEnv } = this.context; + let { nextDayThreshold } = this.context.options; + let range = eventRange.range; + let allDay = eventRange.def.allDay; + let dayIndex; + let segRange; + let seg; + let segs = []; + for (dayIndex = 0; dayIndex < dayRanges.length; dayIndex += 1) { + segRange = intersectRanges(range, dayRanges[dayIndex]); + if (segRange) { + seg = { + component: this, + eventRange, + start: segRange.start, + end: segRange.end, + isStart: eventRange.isStart && segRange.start.valueOf() === range.start.valueOf(), + isEnd: eventRange.isEnd && segRange.end.valueOf() === range.end.valueOf(), + dayIndex, + }; + segs.push(seg); + // detect when range won't go fully into the next day, + // and mutate the latest seg to the be the end. + if (!seg.isEnd && !allDay && + dayIndex + 1 < dayRanges.length && + range.end < + dateEnv.add(dayRanges[dayIndex + 1].start, nextDayThreshold)) { + seg.end = range.end; + seg.isEnd = true; + break; + } + } + } + return segs; + } + } + function renderNoEventsInner(renderProps) { + return renderProps.text; + } + function computeDateVars(dateProfile) { + let dayStart = startOfDay(dateProfile.renderRange.start); + let viewEnd = dateProfile.renderRange.end; + let dayDates = []; + let dayRanges = []; + while (dayStart < viewEnd) { + dayDates.push(dayStart); + dayRanges.push({ + start: dayStart, + end: addDays(dayStart, 1), + }); + dayStart = addDays(dayStart, 1); + } + return { dayDates, dayRanges }; + } + // Returns a sparse array of arrays, segs grouped by their dayIndex + function groupSegsByDay(segs) { + let segsByDay = []; // sparse array + let i; + let seg; + for (i = 0; i < segs.length; i += 1) { + seg = segs[i]; + (segsByDay[seg.dayIndex] || (segsByDay[seg.dayIndex] = [])) + .push(seg); + } + return segsByDay; + } + + const OPTION_REFINERS$2 = { + listDayFormat: createFalsableFormatter, + listDaySideFormat: createFalsableFormatter, + noEventsClassNames: identity, + noEventsContent: identity, + noEventsDidMount: identity, + noEventsWillUnmount: identity, + // noEventsText is defined in base options + }; + function createFalsableFormatter(input) { + return input === false ? null : createFormatter(input); + } + + var css_248z$3 = ":root{--fc-list-event-dot-width:10px;--fc-list-event-hover-bg-color:#f5f5f5}.fc-theme-standard .fc-list{border:1px solid var(--fc-border-color)}.fc .fc-list-empty{align-items:center;background-color:var(--fc-neutral-bg-color);display:flex;height:100%;justify-content:center}.fc .fc-list-empty-cushion{margin:5em 0}.fc .fc-list-table{border-style:hidden;width:100%}.fc .fc-list-table tr>*{border-left:0;border-right:0}.fc .fc-list-sticky .fc-list-day>*{background:var(--fc-page-bg-color);position:sticky;top:0}.fc .fc-list-table thead{left:-10000px;position:absolute}.fc .fc-list-table tbody>tr:first-child th{border-top:0}.fc .fc-list-table th{padding:0}.fc .fc-list-day-cushion,.fc .fc-list-table td{padding:8px 14px}.fc .fc-list-day-cushion:after{clear:both;content:\"\";display:table}.fc-theme-standard .fc-list-day-cushion{background-color:var(--fc-neutral-bg-color)}.fc-direction-ltr .fc-list-day-text,.fc-direction-rtl .fc-list-day-side-text{float:left}.fc-direction-ltr .fc-list-day-side-text,.fc-direction-rtl .fc-list-day-text{float:right}.fc-direction-ltr .fc-list-table .fc-list-event-graphic{padding-right:0}.fc-direction-rtl .fc-list-table .fc-list-event-graphic{padding-left:0}.fc .fc-list-event.fc-event-forced-url{cursor:pointer}.fc .fc-list-event:hover td{background-color:var(--fc-list-event-hover-bg-color)}.fc .fc-list-event-graphic,.fc .fc-list-event-time{white-space:nowrap;width:1px}.fc .fc-list-event-dot{border:calc(var(--fc-list-event-dot-width)/2) solid var(--fc-event-border-color);border-radius:calc(var(--fc-list-event-dot-width)/2);box-sizing:content-box;display:inline-block;height:0;width:0}.fc .fc-list-event-title a{color:inherit;text-decoration:none}.fc .fc-list-event.fc-event-forced-url:hover a{text-decoration:underline}"; + injectStyles(css_248z$3); + + var index$8 = createPlugin({ + name: '@fullcalendar/list', + optionRefiners: OPTION_REFINERS$2, + views: { + list: { + component: ListView, + buttonTextKey: 'list', + listDayFormat: { month: 'long', day: 'numeric', year: 'numeric' }, // like "January 1, 2016" + }, + listDay: { + type: 'list', + duration: { days: 1 }, + listDayFormat: { weekday: 'long' }, // day-of-week is all we need. full date is probably in headerToolbar + }, + listWeek: { + type: 'list', + duration: { weeks: 1 }, + listDayFormat: { weekday: 'long' }, + listDaySideFormat: { month: 'long', day: 'numeric', year: 'numeric' }, + }, + listMonth: { + type: 'list', + duration: { month: 1 }, + listDaySideFormat: { weekday: 'long' }, // day-of-week is nice-to-have + }, + listYear: { + type: 'list', + duration: { year: 1 }, + listDaySideFormat: { weekday: 'long' }, // day-of-week is nice-to-have + }, + }, + }); + + const UPGRADE_WINDOW = 365 + 7; // days. 1 week leeway, for tz shift reasons too + const INVALID_LICENSE_URL = 'https://fullcalendar.io/docs/schedulerLicenseKey#invalid'; + const OUTDATED_LICENSE_URL = 'https://fullcalendar.io/docs/schedulerLicenseKey#outdated'; + const PRESET_LICENSE_KEYS = [ + 'GPL-My-Project-Is-Open-Source', + 'CC-Attribution-NonCommercial-NoDerivatives', + ]; + const CSS = { + position: 'absolute', + zIndex: 99999, + bottom: '1px', + left: '1px', + background: '#eee', + borderColor: '#ddd', + borderStyle: 'solid', + borderWidth: '1px 1px 0 0', + padding: '2px 4px', + fontSize: '12px', + borderTopRightRadius: '3px', + }; + function buildLicenseWarning(context) { + let key = context.options.schedulerLicenseKey; + let currentUrl = typeof window !== 'undefined' ? window.location.href : ''; + if (!isImmuneUrl(currentUrl)) { + let status = processLicenseKey(key, context.pluginHooks.premiumReleaseDate); + if (status !== 'valid') { + return (h("div", { className: "fc-license-message", style: CSS }, (status === 'outdated') ? (h(p, null, + 'Your license key is too old to work with this version. ', + h("a", { href: OUTDATED_LICENSE_URL }, "More Info"))) : (h(p, null, + 'Your license key is invalid. ', + h("a", { href: INVALID_LICENSE_URL }, "More Info"))))); + } + } + return null; + } + /* + This decryption is not meant to be bulletproof. Just a way to remind about an upgrade. + */ + function processLicenseKey(key, premiumReleaseDate) { + if (PRESET_LICENSE_KEYS.indexOf(key) !== -1) { + return 'valid'; + } + const parts = (key || '').match(/^(\d+)-fcs-(\d+)$/); + if (parts && (parts[1].length === 10)) { + const purchaseDate = new Date(parseInt(parts[2], 10) * 1000); + const releaseDate = config.mockSchedulerReleaseDate || premiumReleaseDate; + if (isValidDate$1(releaseDate)) { // token won't be replaced in dev mode + const minPurchaseDate = addDays(releaseDate, -UPGRADE_WINDOW); + if (minPurchaseDate < purchaseDate) { + return 'valid'; + } + return 'outdated'; + } + } + return 'invalid'; + } + function isImmuneUrl(url) { + return /\w+:\/\/fullcalendar\.io\/|\/examples\/[\w-]+\.html$/.test(url); + } + + const OPTION_REFINERS$1 = { + schedulerLicenseKey: String, + }; + + var index$7 = createPlugin({ + name: '@fullcalendar/premium-common', + premiumReleaseDate: '2022-12-27', + optionRefiners: OPTION_REFINERS$1, + viewContainerAppends: [buildLicenseWarning], + }); + + // TODO: assume the el has no borders? + function getScrollCanvasOrigin(scrollEl) { + let rect = scrollEl.getBoundingClientRect(); + let edges = computeEdges(scrollEl); // TODO: pass in isRtl? + return { + left: rect.left + edges.borderLeft + edges.scrollbarLeft - getScrollFromLeftEdge(scrollEl), + top: rect.top + edges.borderTop - scrollEl.scrollTop, + }; + } + function getScrollFromLeftEdge(el) { + let scrollLeft = el.scrollLeft; + let computedStyles = window.getComputedStyle(el); // TODO: pass in isRtl instead? + if (computedStyles.direction === 'rtl') { + switch (getRtlScrollSystem()) { + case 'negative': + scrollLeft *= -1; // convert to 'reverse'. fall through... + case 'reverse': // scrollLeft is distance between scrollframe's right edge scrollcanvas's right edge + scrollLeft = el.scrollWidth - scrollLeft - el.clientWidth; + } + } + return scrollLeft; + } + function setScrollFromLeftEdge(el, scrollLeft) { + let computedStyles = window.getComputedStyle(el); // TODO: pass in isRtl instead? + if (computedStyles.direction === 'rtl') { + switch (getRtlScrollSystem()) { + case 'reverse': + scrollLeft = el.scrollWidth - scrollLeft; + break; + case 'negative': + scrollLeft = -(el.scrollWidth - scrollLeft); + break; + } + } + el.scrollLeft = scrollLeft; + } + // Horizontal Scroll System Detection + // ---------------------------------------------------------------------------------------------- + let _rtlScrollSystem; + function getRtlScrollSystem() { + return _rtlScrollSystem || (_rtlScrollSystem = detectRtlScrollSystem()); + } + function detectRtlScrollSystem() { + let el = document.createElement('div'); + el.style.position = 'absolute'; + el.style.top = '-1000px'; + el.style.width = '1px'; + el.style.height = '1px'; + el.style.overflow = 'scroll'; + el.style.direction = 'rtl'; + el.style.fontSize = '100px'; + el.innerHTML = 'A'; + document.body.appendChild(el); + let system; + if (el.scrollLeft > 0) { + system = 'positive'; // scroll is a positive number from the left edge + } + else { + el.scrollLeft = 1; + if (el.scrollLeft > 0) { + system = 'reverse'; // scroll is a positive number from the right edge + } + else { + system = 'negative'; // scroll is a negative number from the right edge + } + } + removeElement(el); + return system; + } + + const STICKY_SELECTOR = '.fc-sticky'; + /* + Goes beyond mere position:sticky, allows horizontal centering + + REQUIREMENT: fc-sticky elements, if the fc-sticky className is taken away, should NOT have relative or absolute positioning. + This is because we attach the coords with JS, and the VDOM might take away the fc-sticky class but doesn't know kill the positioning. + + TODO: don't query text-align:center. isn't compatible with flexbox centering. instead, check natural X coord within parent container + */ + class StickyScrolling { + constructor(scrollEl, isRtl) { + this.scrollEl = scrollEl; + this.isRtl = isRtl; + this.updateSize = () => { + let { scrollEl } = this; + let els = findElements(scrollEl, STICKY_SELECTOR); + let elGeoms = this.queryElGeoms(els); + let viewportWidth = scrollEl.clientWidth; + assignStickyPositions(els, elGeoms, viewportWidth); + }; + } + queryElGeoms(els) { + let { scrollEl, isRtl } = this; + let canvasOrigin = getScrollCanvasOrigin(scrollEl); + let elGeoms = []; + for (let el of els) { + let parentBound = translateRect(computeInnerRect(el.parentNode, true, true), // weird way to call this!!! + -canvasOrigin.left, -canvasOrigin.top); + let elRect = el.getBoundingClientRect(); + let computedStyles = window.getComputedStyle(el); + let textAlign = window.getComputedStyle(el.parentNode).textAlign; // ask the parent + let naturalBound = null; + if (textAlign === 'start') { + textAlign = isRtl ? 'right' : 'left'; + } + else if (textAlign === 'end') { + textAlign = isRtl ? 'left' : 'right'; + } + if (computedStyles.position !== 'sticky') { + naturalBound = translateRect(elRect, -canvasOrigin.left - (parseFloat(computedStyles.left) || 0), // could be 'auto' + -canvasOrigin.top - (parseFloat(computedStyles.top) || 0)); + } + elGeoms.push({ + parentBound, + naturalBound, + elWidth: elRect.width, + elHeight: elRect.height, + textAlign, + }); + } + return elGeoms; + } + } + function assignStickyPositions(els, elGeoms, viewportWidth) { + els.forEach((el, i) => { + let { textAlign, elWidth, parentBound } = elGeoms[i]; + let parentWidth = parentBound.right - parentBound.left; + let left; + if (textAlign === 'center' && + parentWidth > viewportWidth) { + left = (viewportWidth - elWidth) / 2; + } + else { // if parent container can be completely in view, we don't need stickiness + left = ''; + } + applyStyle(el, { + left, + right: left, + top: 0, + }); + }); + } + + class ClippedScroller extends BaseComponent { + constructor() { + super(...arguments); + this.elRef = y(); + this.state = { + xScrollbarWidth: 0, + yScrollbarWidth: 0, + }; + this.handleScroller = (scroller) => { + this.scroller = scroller; + setRef(this.props.scrollerRef, scroller); + }; + this.handleSizing = () => { + let { props } = this; + if (props.overflowY === 'scroll-hidden') { + this.setState({ yScrollbarWidth: this.scroller.getYScrollbarWidth() }); + } + if (props.overflowX === 'scroll-hidden') { + this.setState({ xScrollbarWidth: this.scroller.getXScrollbarWidth() }); + } + }; + } + render() { + let { props, state, context } = this; + let isScrollbarOnLeft = context.isRtl && getIsRtlScrollbarOnLeft(); + let overcomeLeft = 0; + let overcomeRight = 0; + let overcomeBottom = 0; + if (props.overflowX === 'scroll-hidden') { + overcomeBottom = state.xScrollbarWidth; + } + if (props.overflowY === 'scroll-hidden') { + if (state.yScrollbarWidth != null) { + if (isScrollbarOnLeft) { + overcomeLeft = state.yScrollbarWidth; + } + else { + overcomeRight = state.yScrollbarWidth; + } + } + } + return (h("div", { ref: this.elRef, className: 'fc-scroller-harness' + (props.liquid ? ' fc-scroller-harness-liquid' : '') }, + h(Scroller, { ref: this.handleScroller, elRef: this.props.scrollerElRef, overflowX: props.overflowX === 'scroll-hidden' ? 'scroll' : props.overflowX, overflowY: props.overflowY === 'scroll-hidden' ? 'scroll' : props.overflowY, overcomeLeft: overcomeLeft, overcomeRight: overcomeRight, overcomeBottom: overcomeBottom, maxHeight: typeof props.maxHeight === 'number' + ? (props.maxHeight + (props.overflowX === 'scroll-hidden' ? state.xScrollbarWidth : 0)) + : '', liquid: props.liquid, liquidIsAbsolute: true }, props.children))); + } + componentDidMount() { + this.handleSizing(); + this.context.addResizeHandler(this.handleSizing); + } + componentDidUpdate(prevProps) { + if (!isPropsEqual(prevProps, this.props)) { // an external change? + this.handleSizing(); + } + } + componentWillUnmount() { + this.context.removeResizeHandler(this.handleSizing); + } + needsXScrolling() { + return this.scroller.needsXScrolling(); + } + needsYScrolling() { + return this.scroller.needsYScrolling(); + } + } + + const WHEEL_EVENT_NAMES = 'wheel mousewheel DomMouseScroll MozMousePixelScroll'.split(' '); + /* + ALSO, with the ability to disable touch + */ + class ScrollListener { + constructor(el) { + this.el = el; + this.emitter = new Emitter(); + this.isScrolling = false; + this.isTouching = false; // user currently has finger down? + this.isRecentlyWheeled = false; + this.isRecentlyScrolled = false; + this.wheelWaiter = new DelayedRunner(this._handleWheelWaited.bind(this)); + this.scrollWaiter = new DelayedRunner(this._handleScrollWaited.bind(this)); + // Handlers + // ---------------------------------------------------------------------------------------------- + this.handleScroll = () => { + this.startScroll(); + this.emitter.trigger('scroll', this.isRecentlyWheeled, this.isTouching); + this.isRecentlyScrolled = true; + this.scrollWaiter.request(500); + }; + // will fire *before* the scroll event is fired (might not cause a scroll) + this.handleWheel = () => { + this.isRecentlyWheeled = true; + this.wheelWaiter.request(500); + }; + // will fire *before* the scroll event is fired (might not cause a scroll) + this.handleTouchStart = () => { + this.isTouching = true; + }; + this.handleTouchEnd = () => { + this.isTouching = false; + // if the user ended their touch, and the scroll area wasn't moving, + // we consider this to be the end of the scroll. + if (!this.isRecentlyScrolled) { + this.endScroll(); // won't fire if already ended + } + }; + el.addEventListener('scroll', this.handleScroll); + el.addEventListener('touchstart', this.handleTouchStart, { passive: true }); + el.addEventListener('touchend', this.handleTouchEnd); + for (let eventName of WHEEL_EVENT_NAMES) { + el.addEventListener(eventName, this.handleWheel); + } + } + destroy() { + let { el } = this; + el.removeEventListener('scroll', this.handleScroll); + el.removeEventListener('touchstart', this.handleTouchStart, { passive: true }); + el.removeEventListener('touchend', this.handleTouchEnd); + for (let eventName of WHEEL_EVENT_NAMES) { + el.removeEventListener(eventName, this.handleWheel); + } + } + // Start / Stop + // ---------------------------------------------------------------------------------------------- + startScroll() { + if (!this.isScrolling) { + this.isScrolling = true; + this.emitter.trigger('scrollStart', this.isRecentlyWheeled, this.isTouching); + } + } + endScroll() { + if (this.isScrolling) { + this.emitter.trigger('scrollEnd'); + this.isScrolling = false; + this.isRecentlyScrolled = true; + this.isRecentlyWheeled = false; + this.scrollWaiter.clear(); + this.wheelWaiter.clear(); + } + } + _handleScrollWaited() { + this.isRecentlyScrolled = false; + // only end the scroll if not currently touching. + // if touching, the scrolling will end later, on touchend. + if (!this.isTouching) { + this.endScroll(); // won't fire if already ended + } + } + _handleWheelWaited() { + this.isRecentlyWheeled = false; + } + } + + class ScrollSyncer { + constructor(isVertical, scrollEls) { + this.isVertical = isVertical; + this.scrollEls = scrollEls; + this.isPaused = false; + this.scrollListeners = scrollEls.map((el) => this.bindScroller(el)); + } + destroy() { + for (let scrollListener of this.scrollListeners) { + scrollListener.destroy(); + } + } + bindScroller(el) { + let { scrollEls, isVertical } = this; + let scrollListener = new ScrollListener(el); + const onScroll = (isWheel, isTouch) => { + if (!this.isPaused) { + if (!this.masterEl || (this.masterEl !== el && (isWheel || isTouch))) { + this.assignMaster(el); + } + if (this.masterEl === el) { // dealing with current + for (let otherEl of scrollEls) { + if (otherEl !== el) { + if (isVertical) { + otherEl.scrollTop = el.scrollTop; + } + else { + otherEl.scrollLeft = el.scrollLeft; + } + } + } + } + } + }; + const onScrollEnd = () => { + if (this.masterEl === el) { + this.masterEl = null; + } + }; + scrollListener.emitter.on('scroll', onScroll); + scrollListener.emitter.on('scrollEnd', onScrollEnd); + return scrollListener; + } + assignMaster(el) { + this.masterEl = el; + for (let scrollListener of this.scrollListeners) { + if (scrollListener.el !== el) { + scrollListener.endScroll(); // to prevent residual scrolls from reclaiming master + } + } + } + /* + will normalize the scrollLeft value + */ + forceScrollLeft(scrollLeft) { + this.isPaused = true; + for (let listener of this.scrollListeners) { + setScrollFromLeftEdge(listener.el, scrollLeft); + } + this.isPaused = false; + } + forceScrollTop(top) { + this.isPaused = true; + for (let listener of this.scrollListeners) { + listener.el.scrollTop = top; + } + this.isPaused = false; + } + } + + config.SCROLLGRID_RESIZE_INTERVAL = 500; + /* + TODO: make <ScrollGridSection> subcomponent + NOTE: doesn't support collapsibleWidth (which is sortof a hack anyway) + */ + class ScrollGrid extends BaseComponent { + constructor() { + super(...arguments); + this.compileColGroupStats = memoizeArraylike(compileColGroupStat, isColGroupStatsEqual); + this.renderMicroColGroups = memoizeArraylike(renderMicroColGroup); // yucky to memoize VNodes, but much more efficient for consumers + this.clippedScrollerRefs = new RefMap(); + // doesn't hold non-scrolling els used just for padding + this.scrollerElRefs = new RefMap(this._handleScrollerEl.bind(this)); + this.chunkElRefs = new RefMap(this._handleChunkEl.bind(this)); + this.scrollSyncersBySection = {}; + this.scrollSyncersByColumn = {}; + // for row-height-syncing + this.rowUnstableMap = new Map(); // no need to groom. always self-cancels + this.rowInnerMaxHeightMap = new Map(); + this.anyRowHeightsChanged = false; + this.recentSizingCnt = 0; + this.state = { + shrinkWidths: [], + forceYScrollbars: false, + forceXScrollbars: false, + scrollerClientWidths: {}, + scrollerClientHeights: {}, + sectionRowMaxHeights: [], + }; + this.handleSizing = (isForcedResize, sectionRowMaxHeightsChanged) => { + if (!this.allowSizing()) { + return; + } + if (!sectionRowMaxHeightsChanged) { // something else changed, probably external + this.anyRowHeightsChanged = true; + } + let otherState = {}; + // if reacting to self-change of sectionRowMaxHeightsChanged, or not stable, don't do anything + if (isForcedResize || (!sectionRowMaxHeightsChanged && !this.rowUnstableMap.size)) { + otherState.sectionRowMaxHeights = this.computeSectionRowMaxHeights(); + } + this.setState(Object.assign(Object.assign({ shrinkWidths: this.computeShrinkWidths() }, this.computeScrollerDims()), otherState), () => { + if (!this.rowUnstableMap.size) { + this.updateStickyScrolling(); // needs to happen AFTER final positioning committed to DOM + } + }); + }; + this.handleRowHeightChange = (rowEl, isStable) => { + let { rowUnstableMap, rowInnerMaxHeightMap } = this; + if (!isStable) { + rowUnstableMap.set(rowEl, true); + } + else { + rowUnstableMap.delete(rowEl); + let innerMaxHeight = getRowInnerMaxHeight(rowEl); + if (!rowInnerMaxHeightMap.has(rowEl) || rowInnerMaxHeightMap.get(rowEl) !== innerMaxHeight) { + rowInnerMaxHeightMap.set(rowEl, innerMaxHeight); + this.anyRowHeightsChanged = true; + } + if (!rowUnstableMap.size && this.anyRowHeightsChanged) { + this.anyRowHeightsChanged = false; + this.setState({ + sectionRowMaxHeights: this.computeSectionRowMaxHeights(), + }); + } + } + }; + } + render() { + let { props, state, context } = this; + let { shrinkWidths } = state; + let colGroupStats = this.compileColGroupStats(props.colGroups.map((colGroup) => [colGroup])); + let microColGroupNodes = this.renderMicroColGroups(colGroupStats.map((stat, i) => [stat.cols, shrinkWidths[i]])); + let classNames = getScrollGridClassNames(props.liquid, context); + this.getDims(); + // TODO: make DRY + let sectionConfigs = props.sections; + let configCnt = sectionConfigs.length; + let configI = 0; + let currentConfig; + let headSectionNodes = []; + let bodySectionNodes = []; + let footSectionNodes = []; + while (configI < configCnt && (currentConfig = sectionConfigs[configI]).type === 'header') { + headSectionNodes.push(this.renderSection(currentConfig, configI, colGroupStats, microColGroupNodes, state.sectionRowMaxHeights, true)); + configI += 1; + } + while (configI < configCnt && (currentConfig = sectionConfigs[configI]).type === 'body') { + bodySectionNodes.push(this.renderSection(currentConfig, configI, colGroupStats, microColGroupNodes, state.sectionRowMaxHeights, false)); + configI += 1; + } + while (configI < configCnt && (currentConfig = sectionConfigs[configI]).type === 'footer') { + footSectionNodes.push(this.renderSection(currentConfig, configI, colGroupStats, microColGroupNodes, state.sectionRowMaxHeights, true)); + configI += 1; + } + const isBuggy = !getCanVGrowWithinCell(); // see NOTE in SimpleScrollGrid + const roleAttrs = { role: 'rowgroup' }; + return h('table', { + ref: props.elRef, + role: 'grid', + className: classNames.join(' '), + }, renderMacroColGroup(colGroupStats, shrinkWidths), Boolean(!isBuggy && headSectionNodes.length) && h('thead', roleAttrs, ...headSectionNodes), Boolean(!isBuggy && bodySectionNodes.length) && h('tbody', roleAttrs, ...bodySectionNodes), Boolean(!isBuggy && footSectionNodes.length) && h('tfoot', roleAttrs, ...footSectionNodes), isBuggy && h('tbody', roleAttrs, ...headSectionNodes, ...bodySectionNodes, ...footSectionNodes)); + } + renderSection(sectionConfig, sectionIndex, colGroupStats, microColGroupNodes, sectionRowMaxHeights, isHeader) { + if ('outerContent' in sectionConfig) { + return (h(p, { key: sectionConfig.key }, sectionConfig.outerContent)); + } + return (h("tr", { key: sectionConfig.key, role: "presentation", className: getSectionClassNames(sectionConfig, this.props.liquid).join(' ') }, sectionConfig.chunks.map((chunkConfig, i) => this.renderChunk(sectionConfig, sectionIndex, colGroupStats[i], microColGroupNodes[i], chunkConfig, i, (sectionRowMaxHeights[sectionIndex] || [])[i] || [], isHeader)))); + } + renderChunk(sectionConfig, sectionIndex, colGroupStat, microColGroupNode, chunkConfig, chunkIndex, rowHeights, isHeader) { + if ('outerContent' in chunkConfig) { + return (h(p, { key: chunkConfig.key }, chunkConfig.outerContent)); + } + let { state } = this; + let { scrollerClientWidths, scrollerClientHeights } = state; + let [sectionCnt, chunksPerSection] = this.getDims(); + let index = sectionIndex * chunksPerSection + chunkIndex; + let sideScrollIndex = (!this.context.isRtl || getIsRtlScrollbarOnLeft()) ? chunksPerSection - 1 : 0; + let isVScrollSide = chunkIndex === sideScrollIndex; + let isLastSection = sectionIndex === sectionCnt - 1; + let forceXScrollbars = isLastSection && state.forceXScrollbars; // NOOOO can result in `null` + let forceYScrollbars = isVScrollSide && state.forceYScrollbars; // NOOOO can result in `null` + let allowXScrolling = colGroupStat && colGroupStat.allowXScrolling; // rename? + let allowYScrolling = getAllowYScrolling(this.props, sectionConfig); // rename? do in section func? + let chunkVGrow = getSectionHasLiquidHeight(this.props, sectionConfig); // do in section func? + let expandRows = sectionConfig.expandRows && chunkVGrow; + let tableMinWidth = (colGroupStat && colGroupStat.totalColMinWidth) || ''; + let content = renderChunkContent(sectionConfig, chunkConfig, { + tableColGroupNode: microColGroupNode, + tableMinWidth, + clientWidth: scrollerClientWidths[index] !== undefined ? scrollerClientWidths[index] : null, + clientHeight: scrollerClientHeights[index] !== undefined ? scrollerClientHeights[index] : null, + expandRows, + syncRowHeights: Boolean(sectionConfig.syncRowHeights), + rowSyncHeights: rowHeights, + reportRowHeightChange: this.handleRowHeightChange, + }, isHeader); + let overflowX = forceXScrollbars ? (isLastSection ? 'scroll' : 'scroll-hidden') : + !allowXScrolling ? 'hidden' : + (isLastSection ? 'auto' : 'scroll-hidden'); + let overflowY = forceYScrollbars ? (isVScrollSide ? 'scroll' : 'scroll-hidden') : + !allowYScrolling ? 'hidden' : + (isVScrollSide ? 'auto' : 'scroll-hidden'); + // it *could* be possible to reduce DOM wrappers by only doing a ClippedScroller when allowXScrolling or allowYScrolling, + // but if these values were to change, the inner components would be unmounted/remounted because of the parent change. + content = (h(ClippedScroller, { ref: this.clippedScrollerRefs.createRef(index), scrollerElRef: this.scrollerElRefs.createRef(index), overflowX: overflowX, overflowY: overflowY, liquid: chunkVGrow, maxHeight: sectionConfig.maxHeight }, content)); + return h(isHeader ? 'th' : 'td', { + key: chunkConfig.key, + ref: this.chunkElRefs.createRef(index), + role: 'presentation', + }, content); + } + componentDidMount() { + this.getStickyScrolling = memoizeArraylike(initStickyScrolling); + this.getScrollSyncersBySection = memoizeHashlike(initScrollSyncer.bind(this, true), null, destroyScrollSyncer); + this.getScrollSyncersByColumn = memoizeHashlike(initScrollSyncer.bind(this, false), null, destroyScrollSyncer); + this.updateScrollSyncers(); + this.handleSizing(false); + this.context.addResizeHandler(this.handleSizing); + } + componentDidUpdate(prevProps, prevState) { + this.updateScrollSyncers(); + // TODO: need better solution when state contains non-sizing things + this.handleSizing(false, prevState.sectionRowMaxHeights !== this.state.sectionRowMaxHeights); + } + componentWillUnmount() { + this.context.removeResizeHandler(this.handleSizing); + this.destroyScrollSyncers(); + } + allowSizing() { + let now = new Date(); + if (!this.lastSizingDate || + now.valueOf() > this.lastSizingDate.valueOf() + config.SCROLLGRID_RESIZE_INTERVAL) { + this.lastSizingDate = now; + this.recentSizingCnt = 0; + return true; + } + return (this.recentSizingCnt += 1) <= 10; + } + computeShrinkWidths() { + let colGroupStats = this.compileColGroupStats(this.props.colGroups.map((colGroup) => [colGroup])); + let [sectionCnt, chunksPerSection] = this.getDims(); + let cnt = sectionCnt * chunksPerSection; + let shrinkWidths = []; + colGroupStats.forEach((colGroupStat, i) => { + if (colGroupStat.hasShrinkCol) { + let chunkEls = this.chunkElRefs.collect(i, cnt, chunksPerSection); // in one col + shrinkWidths[i] = computeShrinkWidth(chunkEls); + } + }); + return shrinkWidths; + } + // has the side effect of grooming rowInnerMaxHeightMap + // TODO: somehow short-circuit if there are no new height changes + computeSectionRowMaxHeights() { + let newHeightMap = new Map(); + let [sectionCnt, chunksPerSection] = this.getDims(); + let sectionRowMaxHeights = []; + for (let sectionI = 0; sectionI < sectionCnt; sectionI += 1) { + let sectionConfig = this.props.sections[sectionI]; + let assignableHeights = []; // chunk, row + if (sectionConfig && sectionConfig.syncRowHeights) { + let rowHeightsByChunk = []; + for (let chunkI = 0; chunkI < chunksPerSection; chunkI += 1) { + let index = sectionI * chunksPerSection + chunkI; + let rowHeights = []; + let chunkEl = this.chunkElRefs.currentMap[index]; + if (chunkEl) { + rowHeights = findElements(chunkEl, '.fc-scrollgrid-sync-table tr').map((rowEl) => { + let max = getRowInnerMaxHeight(rowEl); + newHeightMap.set(rowEl, max); + return max; + }); + } + else { + rowHeights = []; + } + rowHeightsByChunk.push(rowHeights); + } + let rowCnt = rowHeightsByChunk[0].length; + let isEqualRowCnt = true; + for (let chunkI = 1; chunkI < chunksPerSection; chunkI += 1) { + let isOuterContent = sectionConfig.chunks[chunkI] && sectionConfig.chunks[chunkI].outerContent !== undefined; // can be null + if (!isOuterContent && rowHeightsByChunk[chunkI].length !== rowCnt) { // skip outer content + isEqualRowCnt = false; + break; + } + } + if (!isEqualRowCnt) { + let chunkHeightSums = []; + for (let chunkI = 0; chunkI < chunksPerSection; chunkI += 1) { + chunkHeightSums.push(sumNumbers(rowHeightsByChunk[chunkI]) + rowHeightsByChunk[chunkI].length); + } + let maxTotalSum = Math.max(...chunkHeightSums); + for (let chunkI = 0; chunkI < chunksPerSection; chunkI += 1) { + let rowInChunkCnt = rowHeightsByChunk[chunkI].length; + let rowInChunkTotalHeight = maxTotalSum - rowInChunkCnt; // subtract border + // height of non-first row. we do this to avoid rounding, because it's unreliable within a table + let rowInChunkHeightOthers = Math.floor(rowInChunkTotalHeight / rowInChunkCnt); + // whatever is leftover goes to the first row + let rowInChunkHeightFirst = rowInChunkTotalHeight - rowInChunkHeightOthers * (rowInChunkCnt - 1); + let rowInChunkHeights = []; + let row = 0; + if (row < rowInChunkCnt) { + rowInChunkHeights.push(rowInChunkHeightFirst); + row += 1; + } + while (row < rowInChunkCnt) { + rowInChunkHeights.push(rowInChunkHeightOthers); + row += 1; + } + assignableHeights.push(rowInChunkHeights); + } + } + else { + for (let chunkI = 0; chunkI < chunksPerSection; chunkI += 1) { + assignableHeights.push([]); + } + for (let row = 0; row < rowCnt; row += 1) { + let rowHeightsAcrossChunks = []; + for (let chunkI = 0; chunkI < chunksPerSection; chunkI += 1) { + let h = rowHeightsByChunk[chunkI][row]; + if (h != null) { // protect against outerContent + rowHeightsAcrossChunks.push(h); + } + } + let maxHeight = Math.max(...rowHeightsAcrossChunks); + for (let chunkI = 0; chunkI < chunksPerSection; chunkI += 1) { + assignableHeights[chunkI].push(maxHeight); + } + } + } + } + sectionRowMaxHeights.push(assignableHeights); + } + this.rowInnerMaxHeightMap = newHeightMap; + return sectionRowMaxHeights; + } + computeScrollerDims() { + let scrollbarWidth = getScrollbarWidths(); + let [sectionCnt, chunksPerSection] = this.getDims(); + let sideScrollI = (!this.context.isRtl || getIsRtlScrollbarOnLeft()) ? chunksPerSection - 1 : 0; + let lastSectionI = sectionCnt - 1; + let currentScrollers = this.clippedScrollerRefs.currentMap; + let scrollerEls = this.scrollerElRefs.currentMap; + let forceYScrollbars = false; + let forceXScrollbars = false; + let scrollerClientWidths = {}; + let scrollerClientHeights = {}; + for (let sectionI = 0; sectionI < sectionCnt; sectionI += 1) { // along edge + let index = sectionI * chunksPerSection + sideScrollI; + let scroller = currentScrollers[index]; + if (scroller && scroller.needsYScrolling()) { + forceYScrollbars = true; + break; + } + } + for (let chunkI = 0; chunkI < chunksPerSection; chunkI += 1) { // along last row + let index = lastSectionI * chunksPerSection + chunkI; + let scroller = currentScrollers[index]; + if (scroller && scroller.needsXScrolling()) { + forceXScrollbars = true; + break; + } + } + for (let sectionI = 0; sectionI < sectionCnt; sectionI += 1) { + for (let chunkI = 0; chunkI < chunksPerSection; chunkI += 1) { + let index = sectionI * chunksPerSection + chunkI; + let scrollerEl = scrollerEls[index]; + if (scrollerEl) { + // TODO: weird way to get this. need harness b/c doesn't include table borders + let harnessEl = scrollerEl.parentNode; + scrollerClientWidths[index] = Math.floor(harnessEl.getBoundingClientRect().width - ((chunkI === sideScrollI && forceYScrollbars) + ? scrollbarWidth.y // use global because scroller might not have scrollbars yet but will need them in future + : 0)); + scrollerClientHeights[index] = Math.floor(harnessEl.getBoundingClientRect().height - ((sectionI === lastSectionI && forceXScrollbars) + ? scrollbarWidth.x // use global because scroller might not have scrollbars yet but will need them in future + : 0)); + } + } + } + return { forceYScrollbars, forceXScrollbars, scrollerClientWidths, scrollerClientHeights }; + } + updateStickyScrolling() { + let { isRtl } = this.context; + let argsByKey = this.scrollerElRefs.getAll().map((scrollEl) => [scrollEl, isRtl]); + this.getStickyScrolling(argsByKey) + .forEach((stickyScrolling) => stickyScrolling.updateSize()); + } + updateScrollSyncers() { + let [sectionCnt, chunksPerSection] = this.getDims(); + let cnt = sectionCnt * chunksPerSection; + let scrollElsBySection = {}; + let scrollElsByColumn = {}; + let scrollElMap = this.scrollerElRefs.currentMap; + for (let sectionI = 0; sectionI < sectionCnt; sectionI += 1) { + let startIndex = sectionI * chunksPerSection; + let endIndex = startIndex + chunksPerSection; + scrollElsBySection[sectionI] = collectFromHash(scrollElMap, startIndex, endIndex, 1); // use the filtered + } + for (let col = 0; col < chunksPerSection; col += 1) { + scrollElsByColumn[col] = this.scrollerElRefs.collect(col, cnt, chunksPerSection); // DON'T use the filtered + } + this.scrollSyncersBySection = this.getScrollSyncersBySection(scrollElsBySection); + this.scrollSyncersByColumn = this.getScrollSyncersByColumn(scrollElsByColumn); + } + destroyScrollSyncers() { + mapHash(this.scrollSyncersBySection, destroyScrollSyncer); + mapHash(this.scrollSyncersByColumn, destroyScrollSyncer); + } + getChunkConfigByIndex(index) { + let chunksPerSection = this.getDims()[1]; + let sectionI = Math.floor(index / chunksPerSection); + let chunkI = index % chunksPerSection; + let sectionConfig = this.props.sections[sectionI]; + return sectionConfig && sectionConfig.chunks[chunkI]; + } + forceScrollLeft(col, scrollLeft) { + let scrollSyncer = this.scrollSyncersByColumn[col]; + if (scrollSyncer) { + scrollSyncer.forceScrollLeft(scrollLeft); + } + } + forceScrollTop(sectionI, scrollTop) { + let scrollSyncer = this.scrollSyncersBySection[sectionI]; + if (scrollSyncer) { + scrollSyncer.forceScrollTop(scrollTop); + } + } + _handleChunkEl(chunkEl, key) { + let chunkConfig = this.getChunkConfigByIndex(parseInt(key, 10)); + if (chunkConfig) { // null if section disappeared. bad, b/c won't null-set the elRef + setRef(chunkConfig.elRef, chunkEl); + } + } + _handleScrollerEl(scrollerEl, key) { + let chunkConfig = this.getChunkConfigByIndex(parseInt(key, 10)); + if (chunkConfig) { // null if section disappeared. bad, b/c won't null-set the elRef + setRef(chunkConfig.scrollerElRef, scrollerEl); + } + } + getDims() { + let sectionCnt = this.props.sections.length; + let chunksPerSection = sectionCnt ? this.props.sections[0].chunks.length : 0; + return [sectionCnt, chunksPerSection]; + } + } + ScrollGrid.addStateEquality({ + shrinkWidths: isArraysEqual, + scrollerClientWidths: isPropsEqual, + scrollerClientHeights: isPropsEqual, + }); + function sumNumbers(numbers) { + let sum = 0; + for (let n of numbers) { + sum += n; + } + return sum; + } + function getRowInnerMaxHeight(rowEl) { + let innerHeights = findElements(rowEl, '.fc-scrollgrid-sync-inner').map(getElHeight); + if (innerHeights.length) { + return Math.max(...innerHeights); + } + return 0; + } + function getElHeight(el) { + return el.offsetHeight; // better to deal with integers, for rounding, for PureComponent + } + function renderMacroColGroup(colGroupStats, shrinkWidths) { + let children = colGroupStats.map((colGroupStat, i) => { + let width = colGroupStat.width; + if (width === 'shrink') { + width = colGroupStat.totalColWidth + sanitizeShrinkWidth(shrinkWidths[i]) + 1; // +1 for border :( + } + return ( // eslint-disable-next-line react/jsx-key + h("col", { style: { width } })); + }); + return h('colgroup', {}, ...children); + } + function compileColGroupStat(colGroupConfig) { + let totalColWidth = sumColProp(colGroupConfig.cols, 'width'); // excludes "shrink" + let totalColMinWidth = sumColProp(colGroupConfig.cols, 'minWidth'); + let hasShrinkCol = hasShrinkWidth(colGroupConfig.cols); + let allowXScrolling = colGroupConfig.width !== 'shrink' && Boolean(totalColWidth || totalColMinWidth || hasShrinkCol); + return { + hasShrinkCol, + totalColWidth, + totalColMinWidth, + allowXScrolling, + cols: colGroupConfig.cols, + width: colGroupConfig.width, + }; + } + function sumColProp(cols, propName) { + let total = 0; + for (let col of cols) { + let val = col[propName]; + if (typeof val === 'number') { + total += val * (col.span || 1); + } + } + return total; + } + const COL_GROUP_STAT_EQUALITY = { + cols: isColPropsEqual, + }; + function isColGroupStatsEqual(stat0, stat1) { + return compareObjs(stat0, stat1, COL_GROUP_STAT_EQUALITY); + } + // for memoizers... + function initScrollSyncer(isVertical, ...scrollEls) { + return new ScrollSyncer(isVertical, scrollEls); + } + function destroyScrollSyncer(scrollSyncer) { + scrollSyncer.destroy(); + } + function initStickyScrolling(scrollEl, isRtl) { + return new StickyScrolling(scrollEl, isRtl); + } + + var index$6 = createPlugin({ + name: '@fullcalendar/scrollgrid', + premiumReleaseDate: '2022-12-27', + deps: [index$7], + scrollGridImpl: ScrollGrid, + }); + + config.COLLAPSIBLE_WIDTH_THRESHOLD = 1200; + let contexts = []; + let undoFuncs = []; + function contextInit(context) { + if (!contexts.length) { + attachGlobalHandlers(); + } + contexts.push(context); + context.calendarApi.on('_unmount', () => { + removeExact(contexts, context); + if (!contexts.length) { + removeGlobalHandlers(); + } + }); + } + function attachGlobalHandlers() { + window.addEventListener('beforeprint', handleBeforePrint); + window.addEventListener('afterprint', handleAfterPrint); + // // for testing + // let forPrint = false + // document.addEventListener('keypress', (ev) => { + // if (ev.key === 'p') { + // forPrint = !forPrint + // if (forPrint) { + // handleBeforePrint() + // } else { + // handleAfterPrint() + // } + // } + // }) + } + function removeGlobalHandlers() { + window.removeEventListener('beforeprint', handleBeforePrint); + window.removeEventListener('afterprint', handleAfterPrint); + } + function handleBeforePrint() { + let scrollEls = queryScrollerEls(); + let scrollCoords = queryScrollerCoords(scrollEls); + for (let context of contexts) { + context.emitter.trigger('_beforeprint'); + } + flushSync(() => { + killHorizontalScrolling(scrollEls, scrollCoords); + undoFuncs.push(() => restoreScrollerCoords(scrollEls, scrollCoords)); + undoFuncs.push(freezeScrollgridWidths()); + }); + } + function handleAfterPrint() { + for (let context of contexts) { + context.emitter.trigger('_afterprint'); + } + flushSync(() => { + while (undoFuncs.length) { + undoFuncs.shift()(); + } + }); + } + // scrollgrid widths + function freezeScrollgridWidths() { + let els = findElements(document.body, '.fc-scrollgrid'); + els.forEach(freezeScrollGridWidth); + return () => els.forEach(unfreezeScrollGridWidth); + } + function freezeScrollGridWidth(el) { + let elWidth = el.getBoundingClientRect().width; + // along with collapsibleWidth, this is a hack for #5707 + if (!el.classList.contains('fc-scrollgrid-collapsible') || elWidth < config.COLLAPSIBLE_WIDTH_THRESHOLD) { + el.style.width = elWidth + 'px'; + } + } + function unfreezeScrollGridWidth(el) { + el.style.width = ''; + } + // scrollers + // TODO: use scroll normalization!? yes + function queryScrollerEls() { + return findElements(document.body, '.fc-scroller-harness > .fc-scroller'); + } + function queryScrollerCoords(els) { + return els.map((el) => { + let computedStyle = window.getComputedStyle(el); + return { + scrollLeft: el.scrollLeft, + scrollTop: el.scrollTop, + overflowX: computedStyle.overflowX, + overflowY: computedStyle.overflowY, + marginBottom: computedStyle.marginBottom, + }; + }); + } + function killHorizontalScrolling(els, coords) { + els.forEach((el, i) => { + el.style.overflowX = 'visible'; // need to clear X/Y to get true overflow + el.style.overflowY = 'visible'; // " + el.style.marginBottom = ''; // for clipping away scrollbar. disable + el.style.left = -coords[i].scrollLeft + 'px'; // simulate scrollLeft! will be position:relative + }); + } + function restoreScrollerCoords(els, coords) { + els.forEach((el, i) => { + let c = coords[i]; + el.style.overflowX = c.overflowX; + el.style.overflowY = c.overflowY; + el.style.marginBottom = c.marginBottom; + el.style.left = ''; + el.scrollLeft = c.scrollLeft; + el.scrollTop = c.scrollTop; + }); + } + + var css_248z$2 = ".fc .fc-event,.fc .fc-scrollgrid table tr{-moz-column-break-inside:avoid;break-inside:avoid}.fc-media-print{display:block;max-width:100%}.fc-media-print .fc-bg-event,.fc-media-print .fc-non-business,.fc-media-print .fc-timegrid-axis-chunk,.fc-media-print .fc-timegrid-slots,.fc-media-print .fc-timeline-slots{display:none}.fc-media-print .fc-h-event,.fc-media-print .fc-toolbar button,.fc-media-print .fc-v-event{background:#fff!important;color:#000!important}.fc-media-print .fc-event,.fc-media-print .fc-event-main{color:#000!important}.fc-media-print .fc-timegrid-event{margin:.5em 0}"; + injectStyles(css_248z$2); + + var index$5 = createPlugin({ + name: '@fullcalendar/adaptive', + premiumReleaseDate: '2022-12-27', + deps: [index$7], + contextInit, + }); + + const MIN_AUTO_LABELS = 18; // more than `12` months but less that `24` hours + const MAX_AUTO_SLOTS_PER_LABEL = 6; // allows 6 10-min slots in an hour + const MAX_AUTO_CELLS = 200; // allows 4-days to have a :30 slot duration + config.MAX_TIMELINE_SLOTS = 1000; + // potential nice values for slot-duration and interval-duration + const STOCK_SUB_DURATIONS = [ + { years: 1 }, + { months: 1 }, + { days: 1 }, + { hours: 1 }, + { minutes: 30 }, + { minutes: 15 }, + { minutes: 10 }, + { minutes: 5 }, + { minutes: 1 }, + { seconds: 30 }, + { seconds: 15 }, + { seconds: 10 }, + { seconds: 5 }, + { seconds: 1 }, + { milliseconds: 500 }, + { milliseconds: 100 }, + { milliseconds: 10 }, + { milliseconds: 1 }, + ]; + function buildTimelineDateProfile(dateProfile, dateEnv, allOptions, dateProfileGenerator) { + let tDateProfile = { + labelInterval: allOptions.slotLabelInterval, + slotDuration: allOptions.slotDuration, + }; + validateLabelAndSlot(tDateProfile, dateProfile, dateEnv); // validate after computed grid duration + ensureLabelInterval(tDateProfile, dateProfile, dateEnv); + ensureSlotDuration(tDateProfile, dateProfile, dateEnv); + let input = allOptions.slotLabelFormat; + let rawFormats = Array.isArray(input) ? input : + (input != null) ? [input] : + computeHeaderFormats(tDateProfile, dateProfile, dateEnv, allOptions); + tDateProfile.headerFormats = rawFormats.map((rawFormat) => createFormatter(rawFormat)); + tDateProfile.isTimeScale = Boolean(tDateProfile.slotDuration.milliseconds); + let largeUnit = null; + if (!tDateProfile.isTimeScale) { + const slotUnit = greatestDurationDenominator(tDateProfile.slotDuration).unit; + if (/year|month|week/.test(slotUnit)) { + largeUnit = slotUnit; + } + } + tDateProfile.largeUnit = largeUnit; + tDateProfile.emphasizeWeeks = + asCleanDays(tDateProfile.slotDuration) === 1 && + currentRangeAs('weeks', dateProfile, dateEnv) >= 2 && + !allOptions.businessHours; + /* + console.log('label interval =', timelineView.labelInterval.humanize()) + console.log('slot duration =', timelineView.slotDuration.humanize()) + console.log('header formats =', timelineView.headerFormats) + console.log('isTimeScale', timelineView.isTimeScale) + console.log('largeUnit', timelineView.largeUnit) + */ + let rawSnapDuration = allOptions.snapDuration; + let snapDuration; + let snapsPerSlot; + if (rawSnapDuration) { + snapDuration = createDuration(rawSnapDuration); + snapsPerSlot = wholeDivideDurations(tDateProfile.slotDuration, snapDuration); + // ^ TODO: warning if not whole? + } + if (snapsPerSlot == null) { + snapDuration = tDateProfile.slotDuration; + snapsPerSlot = 1; + } + tDateProfile.snapDuration = snapDuration; + tDateProfile.snapsPerSlot = snapsPerSlot; + // more... + let timeWindowMs = asRoughMs(dateProfile.slotMaxTime) - asRoughMs(dateProfile.slotMinTime); + // TODO: why not use normalizeRange!? + let normalizedStart = normalizeDate(dateProfile.renderRange.start, tDateProfile, dateEnv); + let normalizedEnd = normalizeDate(dateProfile.renderRange.end, tDateProfile, dateEnv); + // apply slotMinTime/slotMaxTime + // TODO: View should be responsible. + if (tDateProfile.isTimeScale) { + normalizedStart = dateEnv.add(normalizedStart, dateProfile.slotMinTime); + normalizedEnd = dateEnv.add(addDays(normalizedEnd, -1), dateProfile.slotMaxTime); + } + tDateProfile.timeWindowMs = timeWindowMs; + tDateProfile.normalizedRange = { start: normalizedStart, end: normalizedEnd }; + let slotDates = []; + let date = normalizedStart; + while (date < normalizedEnd) { + if (isValidDate(date, tDateProfile, dateProfile, dateProfileGenerator)) { + slotDates.push(date); + } + date = dateEnv.add(date, tDateProfile.slotDuration); + } + tDateProfile.slotDates = slotDates; + // more... + let snapIndex = -1; + let snapDiff = 0; // index of the diff :( + const snapDiffToIndex = []; + const snapIndexToDiff = []; + date = normalizedStart; + while (date < normalizedEnd) { + if (isValidDate(date, tDateProfile, dateProfile, dateProfileGenerator)) { + snapIndex += 1; + snapDiffToIndex.push(snapIndex); + snapIndexToDiff.push(snapDiff); + } + else { + snapDiffToIndex.push(snapIndex + 0.5); + } + date = dateEnv.add(date, tDateProfile.snapDuration); + snapDiff += 1; + } + tDateProfile.snapDiffToIndex = snapDiffToIndex; + tDateProfile.snapIndexToDiff = snapIndexToDiff; + tDateProfile.snapCnt = snapIndex + 1; // is always one behind + tDateProfile.slotCnt = tDateProfile.snapCnt / tDateProfile.snapsPerSlot; + // more... + tDateProfile.isWeekStarts = buildIsWeekStarts(tDateProfile, dateEnv); + tDateProfile.cellRows = buildCellRows(tDateProfile, dateEnv); + tDateProfile.slotsPerLabel = wholeDivideDurations(tDateProfile.labelInterval, tDateProfile.slotDuration); + return tDateProfile; + } + /* + snaps to appropriate unit + */ + function normalizeDate(date, tDateProfile, dateEnv) { + let normalDate = date; + if (!tDateProfile.isTimeScale) { + normalDate = startOfDay(normalDate); + if (tDateProfile.largeUnit) { + normalDate = dateEnv.startOf(normalDate, tDateProfile.largeUnit); + } + } + return normalDate; + } + /* + snaps to appropriate unit + */ + function normalizeRange(range, tDateProfile, dateEnv) { + if (!tDateProfile.isTimeScale) { + range = computeVisibleDayRange(range); + if (tDateProfile.largeUnit) { + let dayRange = range; // preserve original result + range = { + start: dateEnv.startOf(range.start, tDateProfile.largeUnit), + end: dateEnv.startOf(range.end, tDateProfile.largeUnit), + }; + // if date is partially through the interval, or is in the same interval as the start, + // make the exclusive end be the *next* interval + if (range.end.valueOf() !== dayRange.end.valueOf() || range.end <= range.start) { + range = { + start: range.start, + end: dateEnv.add(range.end, tDateProfile.slotDuration), + }; + } + } + } + return range; + } + function isValidDate(date, tDateProfile, dateProfile, dateProfileGenerator) { + if (dateProfileGenerator.isHiddenDay(date)) { + return false; + } + if (tDateProfile.isTimeScale) { + // determine if the time is within slotMinTime/slotMaxTime, which may have wacky values + let day = startOfDay(date); + let timeMs = date.valueOf() - day.valueOf(); + let ms = timeMs - asRoughMs(dateProfile.slotMinTime); // milliseconds since slotMinTime + ms = ((ms % 86400000) + 86400000) % 86400000; // make negative values wrap to 24hr clock + return ms < tDateProfile.timeWindowMs; // before the slotMaxTime? + } + return true; + } + function validateLabelAndSlot(tDateProfile, dateProfile, dateEnv) { + const { currentRange } = dateProfile; + // make sure labelInterval doesn't exceed the max number of cells + if (tDateProfile.labelInterval) { + const labelCnt = dateEnv.countDurationsBetween(currentRange.start, currentRange.end, tDateProfile.labelInterval); + if (labelCnt > config.MAX_TIMELINE_SLOTS) { + console.warn('slotLabelInterval results in too many cells'); + tDateProfile.labelInterval = null; + } + } + // make sure slotDuration doesn't exceed the maximum number of cells + if (tDateProfile.slotDuration) { + const slotCnt = dateEnv.countDurationsBetween(currentRange.start, currentRange.end, tDateProfile.slotDuration); + if (slotCnt > config.MAX_TIMELINE_SLOTS) { + console.warn('slotDuration results in too many cells'); + tDateProfile.slotDuration = null; + } + } + // make sure labelInterval is a multiple of slotDuration + if (tDateProfile.labelInterval && tDateProfile.slotDuration) { + const slotsPerLabel = wholeDivideDurations(tDateProfile.labelInterval, tDateProfile.slotDuration); + if (slotsPerLabel === null || slotsPerLabel < 1) { + console.warn('slotLabelInterval must be a multiple of slotDuration'); + tDateProfile.slotDuration = null; + } + } + } + function ensureLabelInterval(tDateProfile, dateProfile, dateEnv) { + const { currentRange } = dateProfile; + let { labelInterval } = tDateProfile; + if (!labelInterval) { + // compute based off the slot duration + // find the largest label interval with an acceptable slots-per-label + let input; + if (tDateProfile.slotDuration) { + for (input of STOCK_SUB_DURATIONS) { + const tryLabelInterval = createDuration(input); + const slotsPerLabel = wholeDivideDurations(tryLabelInterval, tDateProfile.slotDuration); + if (slotsPerLabel !== null && slotsPerLabel <= MAX_AUTO_SLOTS_PER_LABEL) { + labelInterval = tryLabelInterval; + break; + } + } + // use the slot duration as a last resort + if (!labelInterval) { + labelInterval = tDateProfile.slotDuration; + } + // compute based off the view's duration + // find the largest label interval that yields the minimum number of labels + } + else { + for (input of STOCK_SUB_DURATIONS) { + labelInterval = createDuration(input); + const labelCnt = dateEnv.countDurationsBetween(currentRange.start, currentRange.end, labelInterval); + if (labelCnt >= MIN_AUTO_LABELS) { + break; + } + } + } + tDateProfile.labelInterval = labelInterval; + } + return labelInterval; + } + function ensureSlotDuration(tDateProfile, dateProfile, dateEnv) { + const { currentRange } = dateProfile; + let { slotDuration } = tDateProfile; + if (!slotDuration) { + const labelInterval = ensureLabelInterval(tDateProfile, dateProfile, dateEnv); // will compute if necessary + // compute based off the label interval + // find the largest slot duration that is different from labelInterval, but still acceptable + for (let input of STOCK_SUB_DURATIONS) { + const trySlotDuration = createDuration(input); + const slotsPerLabel = wholeDivideDurations(labelInterval, trySlotDuration); + if (slotsPerLabel !== null && slotsPerLabel > 1 && slotsPerLabel <= MAX_AUTO_SLOTS_PER_LABEL) { + slotDuration = trySlotDuration; + break; + } + } + // only allow the value if it won't exceed the view's # of slots limit + if (slotDuration) { + const slotCnt = dateEnv.countDurationsBetween(currentRange.start, currentRange.end, slotDuration); + if (slotCnt > MAX_AUTO_CELLS) { + slotDuration = null; + } + } + // use the label interval as a last resort + if (!slotDuration) { + slotDuration = labelInterval; + } + tDateProfile.slotDuration = slotDuration; + } + return slotDuration; + } + function computeHeaderFormats(tDateProfile, dateProfile, dateEnv, allOptions) { + let format1; + let format2; + const { labelInterval } = tDateProfile; + let unit = greatestDurationDenominator(labelInterval).unit; + const weekNumbersVisible = allOptions.weekNumbers; + let format0 = (format1 = (format2 = null)); + // NOTE: weekNumber computation function wont work + if ((unit === 'week') && !weekNumbersVisible) { + unit = 'day'; + } + switch (unit) { + case 'year': + format0 = { year: 'numeric' }; // '2015' + break; + case 'month': + if (currentRangeAs('years', dateProfile, dateEnv) > 1) { + format0 = { year: 'numeric' }; // '2015' + } + format1 = { month: 'short' }; // 'Jan' + break; + case 'week': + if (currentRangeAs('years', dateProfile, dateEnv) > 1) { + format0 = { year: 'numeric' }; // '2015' + } + format1 = { week: 'narrow' }; // 'Wk4' + break; + case 'day': + if (currentRangeAs('years', dateProfile, dateEnv) > 1) { + format0 = { year: 'numeric', month: 'long' }; // 'January 2014' + } + else if (currentRangeAs('months', dateProfile, dateEnv) > 1) { + format0 = { month: 'long' }; // 'January' + } + if (weekNumbersVisible) { + format1 = { week: 'short' }; // 'Wk 4' + } + format2 = { weekday: 'narrow', day: 'numeric' }; // 'Su 9' + break; + case 'hour': + if (weekNumbersVisible) { + format0 = { week: 'short' }; // 'Wk 4' + } + if (currentRangeAs('days', dateProfile, dateEnv) > 1) { + format1 = { weekday: 'short', day: 'numeric', month: 'numeric', omitCommas: true }; // Sat 4/7 + } + format2 = { + hour: 'numeric', + minute: '2-digit', + omitZeroMinute: true, + meridiem: 'short', + }; + break; + case 'minute': + // sufficiently large number of different minute cells? + if ((asRoughMinutes(labelInterval) / 60) >= MAX_AUTO_SLOTS_PER_LABEL) { + format0 = { + hour: 'numeric', + meridiem: 'short', + }; + format1 = (params) => (':' + padStart(params.date.minute, 2) // ':30' + ); + } + else { + format0 = { + hour: 'numeric', + minute: 'numeric', + meridiem: 'short', + }; + } + break; + case 'second': + // sufficiently large number of different second cells? + if ((asRoughSeconds(labelInterval) / 60) >= MAX_AUTO_SLOTS_PER_LABEL) { + format0 = { hour: 'numeric', minute: '2-digit', meridiem: 'lowercase' }; // '8:30 PM' + format1 = (params) => (':' + padStart(params.date.second, 2) // ':30' + ); + } + else { + format0 = { hour: 'numeric', minute: '2-digit', second: '2-digit', meridiem: 'lowercase' }; // '8:30:45 PM' + } + break; + case 'millisecond': + format0 = { hour: 'numeric', minute: '2-digit', second: '2-digit', meridiem: 'lowercase' }; // '8:30:45 PM' + format1 = (params) => ('.' + padStart(params.millisecond, 3)); + break; + } + return [].concat(format0 || [], format1 || [], format2 || []); + } + // Compute the number of the give units in the "current" range. + // Won't go more precise than days. + // Will return `0` if there's not a clean whole interval. + function currentRangeAs(unit, dateProfile, dateEnv) { + let range = dateProfile.currentRange; + let res = null; + if (unit === 'years') { + res = dateEnv.diffWholeYears(range.start, range.end); + } + else if (unit === 'months') { + res = dateEnv.diffWholeMonths(range.start, range.end); + } + else if (unit === 'weeks') { + res = dateEnv.diffWholeMonths(range.start, range.end); + } + else if (unit === 'days') { + res = diffWholeDays(range.start, range.end); + } + return res || 0; + } + function buildIsWeekStarts(tDateProfile, dateEnv) { + let { slotDates, emphasizeWeeks } = tDateProfile; + let prevWeekNumber = null; + let isWeekStarts = []; + for (let slotDate of slotDates) { + let weekNumber = dateEnv.computeWeekNumber(slotDate); + let isWeekStart = emphasizeWeeks && (prevWeekNumber !== null) && (prevWeekNumber !== weekNumber); + prevWeekNumber = weekNumber; + isWeekStarts.push(isWeekStart); + } + return isWeekStarts; + } + function buildCellRows(tDateProfile, dateEnv) { + let slotDates = tDateProfile.slotDates; + let formats = tDateProfile.headerFormats; + let cellRows = formats.map(() => []); // indexed by row,col + let slotAsDays = asCleanDays(tDateProfile.slotDuration); + let guessedSlotUnit = slotAsDays === 7 ? 'week' : + slotAsDays === 1 ? 'day' : + null; + // specifically for navclicks + let rowUnitsFromFormats = formats.map((format) => (format.getLargestUnit ? format.getLargestUnit() : null)); + // builds cellRows and slotCells + for (let i = 0; i < slotDates.length; i += 1) { + let date = slotDates[i]; + let isWeekStart = tDateProfile.isWeekStarts[i]; + for (let row = 0; row < formats.length; row += 1) { + let format = formats[row]; + let rowCells = cellRows[row]; + let leadingCell = rowCells[rowCells.length - 1]; + let isLastRow = row === formats.length - 1; + let isSuperRow = formats.length > 1 && !isLastRow; // more than one row and not the last + let newCell = null; + let rowUnit = rowUnitsFromFormats[row] || (isLastRow ? guessedSlotUnit : null); + if (isSuperRow) { + let text = dateEnv.format(date, format); + if (!leadingCell || (leadingCell.text !== text)) { + newCell = buildCellObject(date, text, rowUnit); + } + else { + leadingCell.colspan += 1; + } + } + else if (!leadingCell || + isInt(dateEnv.countDurationsBetween(tDateProfile.normalizedRange.start, date, tDateProfile.labelInterval))) { + let text = dateEnv.format(date, format); + newCell = buildCellObject(date, text, rowUnit); + } + else { + leadingCell.colspan += 1; + } + if (newCell) { + newCell.weekStart = isWeekStart; + rowCells.push(newCell); + } + } + } + return cellRows; + } + function buildCellObject(date, text, rowUnit) { + return { date, text, rowUnit, colspan: 1, isWeekStart: false }; + } + + class TimelineHeaderTh extends BaseComponent { + constructor() { + super(...arguments); + this.refineRenderProps = memoizeObjArg(refineRenderProps$3); + this.buildCellNavLinkAttrs = memoize(buildCellNavLinkAttrs); + } + render() { + let { props, context } = this; + let { dateEnv, options } = context; + let { cell, dateProfile, tDateProfile } = props; + // the cell.rowUnit is f'd + // giving 'month' for a 3-day view + // workaround: to infer day, do NOT time + let dateMeta = getDateMeta(cell.date, props.todayRange, props.nowDate, dateProfile); + let renderProps = this.refineRenderProps({ + level: props.rowLevel, + dateMarker: cell.date, + text: cell.text, + dateEnv: context.dateEnv, + viewApi: context.viewApi, + }); + return (h(ContentContainer, { elTag: "th", elClasses: [ + 'fc-timeline-slot', + 'fc-timeline-slot-label', + cell.isWeekStart && 'fc-timeline-slot-em', + ...( // TODO: so slot classnames for week/month/bigger. see note above about rowUnit + cell.rowUnit === 'time' ? + getSlotClassNames(dateMeta, context.theme) : + getDayClassNames(dateMeta, context.theme)), + ], elAttrs: { + colSpan: cell.colspan, + 'data-date': dateEnv.formatIso(cell.date, { + omitTime: !tDateProfile.isTimeScale, + omitTimeZoneOffset: true, + }), + }, renderProps: renderProps, generatorName: "slotLabelContent", generator: options.slotLabelContent || renderInnerContent$1, classNameGenerator: options.slotLabelClassNames, didMount: options.slotLabelDidMount, willUnmount: options.slotLabelWillUnmount }, (InnerContent) => (h("div", { className: "fc-timeline-slot-frame", style: { height: props.rowInnerHeight } }, + h(InnerContent, { elTag: "a", elClasses: [ + 'fc-timeline-slot-cushion', + 'fc-scrollgrid-sync-inner', + props.isSticky && 'fc-sticky', + ], elAttrs: this.buildCellNavLinkAttrs(context, cell.date, cell.rowUnit) }))))); + } + } + function buildCellNavLinkAttrs(context, cellDate, rowUnit) { + return (rowUnit && rowUnit !== 'time') + ? buildNavLinkAttrs(context, cellDate, rowUnit) + : {}; + } + function renderInnerContent$1(renderProps) { + return renderProps.text; + } + function refineRenderProps$3(input) { + return { + level: input.level, + date: input.dateEnv.toDate(input.dateMarker), + view: input.viewApi, + text: input.text, + }; + } + + class TimelineHeaderRows extends BaseComponent { + render() { + let { dateProfile, tDateProfile, rowInnerHeights, todayRange, nowDate } = this.props; + let { cellRows } = tDateProfile; + return (h(p, null, cellRows.map((rowCells, rowLevel) => { + let isLast = rowLevel === cellRows.length - 1; + let isChrono = tDateProfile.isTimeScale && isLast; // the final row, with times? + let classNames = [ + 'fc-timeline-header-row', + isChrono ? 'fc-timeline-header-row-chrono' : '', + ]; + return ( // eslint-disable-next-line react/no-array-index-key + h("tr", { key: rowLevel, className: classNames.join(' ') }, rowCells.map((cell) => (h(TimelineHeaderTh, { key: cell.date.toISOString(), cell: cell, rowLevel: rowLevel, dateProfile: dateProfile, tDateProfile: tDateProfile, todayRange: todayRange, nowDate: nowDate, rowInnerHeight: rowInnerHeights && rowInnerHeights[rowLevel], isSticky: !isLast }))))); + }))); + } + } + + class TimelineCoords { + constructor(slatRootEl, // okay to expose? + slatEls, dateProfile, tDateProfile, dateEnv, isRtl) { + this.slatRootEl = slatRootEl; + this.dateProfile = dateProfile; + this.tDateProfile = tDateProfile; + this.dateEnv = dateEnv; + this.isRtl = isRtl; + this.outerCoordCache = new PositionCache(slatRootEl, slatEls, true, // isHorizontal + false); + // for the inner divs within the slats + // used for event rendering and scrollTime, to disregard slat border + this.innerCoordCache = new PositionCache(slatRootEl, findDirectChildren(slatEls, 'div'), true, // isHorizontal + false); + } + isDateInRange(date) { + return rangeContainsMarker(this.dateProfile.currentRange, date); + } + // results range from negative width of area to 0 + dateToCoord(date) { + let { tDateProfile } = this; + let snapCoverage = this.computeDateSnapCoverage(date); + let slotCoverage = snapCoverage / tDateProfile.snapsPerSlot; + let slotIndex = Math.floor(slotCoverage); + slotIndex = Math.min(slotIndex, tDateProfile.slotCnt - 1); + let partial = slotCoverage - slotIndex; + let { innerCoordCache, outerCoordCache } = this; + if (this.isRtl) { + return outerCoordCache.originClientRect.width - (outerCoordCache.rights[slotIndex] - + (innerCoordCache.getWidth(slotIndex) * partial)); + } + return (outerCoordCache.lefts[slotIndex] + + (innerCoordCache.getWidth(slotIndex) * partial)); + } + rangeToCoords(range) { + return { + start: this.dateToCoord(range.start), + end: this.dateToCoord(range.end), + }; + } + durationToCoord(duration) { + let { dateProfile, tDateProfile, dateEnv, isRtl } = this; + let coord = 0; + if (dateProfile) { + let date = dateEnv.add(dateProfile.activeRange.start, duration); + if (!tDateProfile.isTimeScale) { + date = startOfDay(date); + } + coord = this.dateToCoord(date); + // hack to overcome the left borders of non-first slat + if (!isRtl && coord) { + coord += 1; + } + } + return coord; + } + coordFromLeft(coord) { + if (this.isRtl) { + return this.outerCoordCache.originClientRect.width - coord; + } + return coord; + } + // returned value is between 0 and the number of snaps + computeDateSnapCoverage(date) { + return computeDateSnapCoverage(date, this.tDateProfile, this.dateEnv); + } + } + // returned value is between 0 and the number of snaps + function computeDateSnapCoverage(date, tDateProfile, dateEnv) { + let snapDiff = dateEnv.countDurationsBetween(tDateProfile.normalizedRange.start, date, tDateProfile.snapDuration); + if (snapDiff < 0) { + return 0; + } + if (snapDiff >= tDateProfile.snapDiffToIndex.length) { + return tDateProfile.snapCnt; + } + let snapDiffInt = Math.floor(snapDiff); + let snapCoverage = tDateProfile.snapDiffToIndex[snapDiffInt]; + if (isInt(snapCoverage)) { // not an in-between value + snapCoverage += snapDiff - snapDiffInt; // add the remainder + } + else { + // a fractional value, meaning the date is not visible + // always round up in this case. works for start AND end dates in a range. + snapCoverage = Math.ceil(snapCoverage); + } + return snapCoverage; + } + function coordToCss(hcoord, isRtl) { + if (hcoord === null) { + return { left: '', right: '' }; + } + if (isRtl) { + return { right: hcoord, left: '' }; + } + return { left: hcoord, right: '' }; + } + function coordsToCss(hcoords, isRtl) { + if (!hcoords) { + return { left: '', right: '' }; + } + if (isRtl) { + return { right: hcoords.start, left: -hcoords.end }; + } + return { left: hcoords.start, right: -hcoords.end }; + } + + class TimelineHeader extends BaseComponent { + constructor() { + super(...arguments); + this.rootElRef = y(); + } + render() { + let { props, context } = this; + // TODO: very repetitive + // TODO: make part of tDateProfile? + let timerUnit = greatestDurationDenominator(props.tDateProfile.slotDuration).unit; + // WORKAROUND: make ignore slatCoords when out of sync with dateProfile + let slatCoords = props.slatCoords && props.slatCoords.dateProfile === props.dateProfile ? props.slatCoords : null; + return (h(NowTimer, { unit: timerUnit }, (nowDate, todayRange) => (h("div", { className: "fc-timeline-header", ref: this.rootElRef }, + h("table", { "aria-hidden": true, className: "fc-scrollgrid-sync-table", style: { minWidth: props.tableMinWidth, width: props.clientWidth } }, + props.tableColGroupNode, + h("tbody", null, + h(TimelineHeaderRows, { dateProfile: props.dateProfile, tDateProfile: props.tDateProfile, nowDate: nowDate, todayRange: todayRange, rowInnerHeights: props.rowInnerHeights }))), + context.options.nowIndicator && ( + // need to have a container regardless of whether the current view has a visible now indicator + // because apparently removal of the element resets the scroll for some reasons (issue #5351). + // this issue doesn't happen for the timeline body however ( + h("div", { className: "fc-timeline-now-indicator-container" }, (slatCoords && slatCoords.isDateInRange(nowDate)) && (h(NowIndicatorContainer, { elClasses: ['fc-timeline-now-indicator-arrow'], elStyle: coordToCss(slatCoords.dateToCoord(nowDate), context.isRtl), isAxis: true, date: nowDate })))))))); + } + componentDidMount() { + this.updateSize(); + } + componentDidUpdate() { + this.updateSize(); + } + updateSize() { + if (this.props.onMaxCushionWidth) { + this.props.onMaxCushionWidth(this.computeMaxCushionWidth()); + } + } + computeMaxCushionWidth() { + return Math.max(...findElements(this.rootElRef.current, '.fc-timeline-header-row:last-child .fc-timeline-slot-cushion').map((el) => el.getBoundingClientRect().width)); + } + } + + class TimelineSlatCell extends BaseComponent { + render() { + let { props, context } = this; + let { dateEnv, options, theme } = context; + let { date, tDateProfile, isEm } = props; + let dateMeta = getDateMeta(props.date, props.todayRange, props.nowDate, props.dateProfile); + let renderProps = Object.assign(Object.assign({ date: dateEnv.toDate(props.date) }, dateMeta), { view: context.viewApi }); + return (h(ContentContainer, { elTag: "td", elRef: props.elRef, elClasses: [ + 'fc-timeline-slot', + 'fc-timeline-slot-lane', + isEm && 'fc-timeline-slot-em', + tDateProfile.isTimeScale ? (isInt(dateEnv.countDurationsBetween(tDateProfile.normalizedRange.start, props.date, tDateProfile.labelInterval)) ? + 'fc-timeline-slot-major' : + 'fc-timeline-slot-minor') : '', + ...(props.isDay ? + getDayClassNames(dateMeta, theme) : + getSlotClassNames(dateMeta, theme)), + ], elAttrs: { + 'data-date': dateEnv.formatIso(date, { + omitTimeZoneOffset: true, + omitTime: !tDateProfile.isTimeScale, + }), + }, renderProps: renderProps, generatorName: "slotLaneContent", generator: options.slotLaneContent, classNameGenerator: options.slotLaneClassNames, didMount: options.slotLaneDidMount, willUnmount: options.slotLaneWillUnmount }, (InnerContent) => (h(InnerContent, { elTag: "div" })))); + } + } + + class TimelineSlatsBody extends BaseComponent { + render() { + let { props } = this; + let { tDateProfile, cellElRefs } = props; + let { slotDates, isWeekStarts } = tDateProfile; + let isDay = !tDateProfile.isTimeScale && !tDateProfile.largeUnit; + return (h("tbody", null, + h("tr", null, slotDates.map((slotDate, i) => { + let key = slotDate.toISOString(); + return (h(TimelineSlatCell, { key: key, elRef: cellElRefs.createRef(key), date: slotDate, dateProfile: props.dateProfile, tDateProfile: tDateProfile, nowDate: props.nowDate, todayRange: props.todayRange, isEm: isWeekStarts[i], isDay: isDay })); + })))); + } + } + + class TimelineSlats extends BaseComponent { + constructor() { + super(...arguments); + this.rootElRef = y(); + this.cellElRefs = new RefMap(); + this.handleScrollRequest = (request) => { + let { onScrollLeftRequest } = this.props; + let { coords } = this; + if (onScrollLeftRequest && coords) { + if (request.time) { + let scrollLeft = coords.coordFromLeft(coords.durationToCoord(request.time)); + onScrollLeftRequest(scrollLeft); + } + return true; + } + return null; // best? + }; + } + render() { + let { props, context } = this; + return (h("div", { className: "fc-timeline-slots", ref: this.rootElRef }, + h("table", { "aria-hidden": true, className: context.theme.getClass('table'), style: { + minWidth: props.tableMinWidth, + width: props.clientWidth, + } }, + props.tableColGroupNode, + h(TimelineSlatsBody, { cellElRefs: this.cellElRefs, dateProfile: props.dateProfile, tDateProfile: props.tDateProfile, nowDate: props.nowDate, todayRange: props.todayRange })))); + } + componentDidMount() { + this.updateSizing(); + this.scrollResponder = this.context.createScrollResponder(this.handleScrollRequest); + } + componentDidUpdate(prevProps) { + this.updateSizing(); + this.scrollResponder.update(prevProps.dateProfile !== this.props.dateProfile); + } + componentWillUnmount() { + this.scrollResponder.detach(); + if (this.props.onCoords) { + this.props.onCoords(null); + } + } + updateSizing() { + let { props, context } = this; + if (props.clientWidth !== null && // is sizing stable? + this.scrollResponder + // ^it's possible to have clientWidth immediately after mount (when returning from print view), but w/o scrollResponder + ) { + let rootEl = this.rootElRef.current; + if (rootEl.offsetWidth) { // not hidden by css + this.coords = new TimelineCoords(this.rootElRef.current, collectCellEls(this.cellElRefs.currentMap, props.tDateProfile.slotDates), props.dateProfile, props.tDateProfile, context.dateEnv, context.isRtl); + if (props.onCoords) { + props.onCoords(this.coords); + } + this.scrollResponder.update(false); // TODO: wouldn't have to do this if coords were in state + } + } + } + positionToHit(leftPosition) { + let { outerCoordCache } = this.coords; + let { dateEnv, isRtl } = this.context; + let { tDateProfile } = this.props; + let slatIndex = outerCoordCache.leftToIndex(leftPosition); + if (slatIndex != null) { + // somewhat similar to what TimeGrid does. consolidate? + let slatWidth = outerCoordCache.getWidth(slatIndex); + let partial = isRtl ? + (outerCoordCache.rights[slatIndex] - leftPosition) / slatWidth : + (leftPosition - outerCoordCache.lefts[slatIndex]) / slatWidth; + let localSnapIndex = Math.floor(partial * tDateProfile.snapsPerSlot); + let start = dateEnv.add(tDateProfile.slotDates[slatIndex], multiplyDuration(tDateProfile.snapDuration, localSnapIndex)); + let end = dateEnv.add(start, tDateProfile.snapDuration); + return { + dateSpan: { + range: { start, end }, + allDay: !this.props.tDateProfile.isTimeScale, + }, + dayEl: this.cellElRefs.currentMap[slatIndex], + left: outerCoordCache.lefts[slatIndex], + right: outerCoordCache.rights[slatIndex], + }; + } + return null; + } + } + function collectCellEls(elMap, slotDates) { + return slotDates.map((slotDate) => { + let key = slotDate.toISOString(); + return elMap[key]; + }); + } + + function computeSegHCoords(segs, minWidth, timelineCoords) { + let hcoords = []; + if (timelineCoords) { + for (let seg of segs) { + let res = timelineCoords.rangeToCoords(seg); + let start = Math.round(res.start); // for barely-overlapping collisions + let end = Math.round(res.end); // + if (end - start < minWidth) { + end = start + minWidth; + } + hcoords.push({ start, end }); + } + } + return hcoords; + } + function computeFgSegPlacements(segs, segHCoords, // might not have for every seg + eventInstanceHeights, // might not have for every seg + moreLinkHeights, // might not have for every more-link + strictOrder, maxStackCnt) { + let segInputs = []; + let crudePlacements = []; // when we don't know dims + for (let i = 0; i < segs.length; i += 1) { + let seg = segs[i]; + let instanceId = seg.eventRange.instance.instanceId; + let height = eventInstanceHeights[instanceId]; + let hcoords = segHCoords[i]; + if (height && hcoords) { + segInputs.push({ + index: i, + span: hcoords, + thickness: height, + }); + } + else { + crudePlacements.push({ + seg, + hcoords, + top: null, + }); + } + } + let hierarchy = new SegHierarchy(); + if (strictOrder != null) { + hierarchy.strictOrder = strictOrder; + } + if (maxStackCnt != null) { + hierarchy.maxStackCnt = maxStackCnt; + } + let hiddenEntries = hierarchy.addSegs(segInputs); + let hiddenPlacements = hiddenEntries.map((entry) => ({ + seg: segs[entry.index], + hcoords: entry.span, + top: null, + })); + let hiddenGroups = groupIntersectingEntries(hiddenEntries); + let moreLinkInputs = []; + let moreLinkCrudePlacements = []; + const extractSeg = (entry) => segs[entry.index]; + for (let i = 0; i < hiddenGroups.length; i += 1) { + let hiddenGroup = hiddenGroups[i]; + let sortedSegs = hiddenGroup.entries.map(extractSeg); + let height = moreLinkHeights[buildIsoString(computeEarliestSegStart(sortedSegs))]; // not optimal :( + if (height != null) { + // NOTE: the hiddenGroup's spanStart/spanEnd are already computed by rangeToCoords. computed during input. + moreLinkInputs.push({ + index: segs.length + i, + thickness: height, + span: hiddenGroup.span, + }); + } + else { + moreLinkCrudePlacements.push({ + seg: sortedSegs, + hcoords: hiddenGroup.span, + top: null, + }); + } + } + // add more-links into the hierarchy, but don't limit + hierarchy.maxStackCnt = -1; + hierarchy.addSegs(moreLinkInputs); + let visibleRects = hierarchy.toRects(); + let visiblePlacements = []; + let maxHeight = 0; + for (let rect of visibleRects) { + let segIndex = rect.index; + visiblePlacements.push({ + seg: segIndex < segs.length + ? segs[segIndex] // a real seg + : hiddenGroups[segIndex - segs.length].entries.map(extractSeg), + hcoords: rect.span, + top: rect.levelCoord, + }); + maxHeight = Math.max(maxHeight, rect.levelCoord + rect.thickness); + } + return [ + visiblePlacements.concat(crudePlacements, hiddenPlacements, moreLinkCrudePlacements), + maxHeight, + ]; + } + + class TimelineLaneBg extends BaseComponent { + render() { + let { props } = this; + let highlightSeg = [].concat(props.eventResizeSegs, props.dateSelectionSegs); + return props.timelineCoords && (h("div", { className: "fc-timeline-bg" }, + this.renderSegs(props.businessHourSegs || [], props.timelineCoords, 'non-business'), + this.renderSegs(props.bgEventSegs || [], props.timelineCoords, 'bg-event'), + this.renderSegs(highlightSeg, props.timelineCoords, 'highlight'))); + } + renderSegs(segs, timelineCoords, fillType) { + let { todayRange, nowDate } = this.props; + let { isRtl } = this.context; + let segHCoords = computeSegHCoords(segs, 0, timelineCoords); + let children = segs.map((seg, i) => { + let hcoords = segHCoords[i]; + let hStyle = coordsToCss(hcoords, isRtl); + return (h("div", { key: buildEventRangeKey(seg.eventRange), className: "fc-timeline-bg-harness", style: hStyle }, fillType === 'bg-event' ? + h(BgEvent, Object.assign({ seg: seg }, getSegMeta(seg, todayRange, nowDate))) : + renderFill(fillType))); + }); + return h(p, null, children); + } + } + + class TimelineLaneSlicer extends Slicer { + sliceRange(origRange, dateProfile, dateProfileGenerator, tDateProfile, dateEnv) { + let normalRange = normalizeRange(origRange, tDateProfile, dateEnv); + let segs = []; + // protect against when the span is entirely in an invalid date region + if (computeDateSnapCoverage(normalRange.start, tDateProfile, dateEnv) + < computeDateSnapCoverage(normalRange.end, tDateProfile, dateEnv)) { + // intersect the footprint's range with the grid's range + let slicedRange = intersectRanges(normalRange, tDateProfile.normalizedRange); + if (slicedRange) { + segs.push({ + start: slicedRange.start, + end: slicedRange.end, + isStart: slicedRange.start.valueOf() === normalRange.start.valueOf() + && isValidDate(slicedRange.start, tDateProfile, dateProfile, dateProfileGenerator), + isEnd: slicedRange.end.valueOf() === normalRange.end.valueOf() + && isValidDate(addMs(slicedRange.end, -1), tDateProfile, dateProfile, dateProfileGenerator), + }); + } + } + return segs; + } + } + + const DEFAULT_TIME_FORMAT = createFormatter({ + hour: 'numeric', + minute: '2-digit', + omitZeroMinute: true, + meridiem: 'narrow', + }); + class TimelineEvent extends BaseComponent { + render() { + let { props } = this; + return (h(StandardEvent, Object.assign({}, props, { elClasses: ['fc-timeline-event', 'fc-h-event'], defaultTimeFormat: DEFAULT_TIME_FORMAT, defaultDisplayEventTime: !props.isTimeScale }))); + } + } + + class TimelineLaneMoreLink extends BaseComponent { + render() { + let { props, context } = this; + let { hiddenSegs, placement, resourceId } = props; + let { top, hcoords } = placement; + let isVisible = hcoords && top !== null; + let hStyle = coordsToCss(hcoords, context.isRtl); + let extraDateSpan = resourceId ? { resourceId } : {}; + return (h(MoreLinkContainer, { elRef: props.elRef, elClasses: ['fc-timeline-more-link'], elStyle: Object.assign({ visibility: isVisible ? '' : 'hidden', top: top || 0 }, hStyle), allDayDate: null, moreCnt: hiddenSegs.length, allSegs: hiddenSegs, hiddenSegs: hiddenSegs, dateProfile: props.dateProfile, todayRange: props.todayRange, extraDateSpan: extraDateSpan, popoverContent: () => (h(p, null, hiddenSegs.map((seg) => { + let instanceId = seg.eventRange.instance.instanceId; + return (h("div", { key: instanceId, style: { visibility: props.isForcedInvisible[instanceId] ? 'hidden' : '' } }, + h(TimelineEvent, Object.assign({ isTimeScale: props.isTimeScale, seg: seg, isDragging: false, isResizing: false, isDateSelecting: false, isSelected: instanceId === props.eventSelection }, getSegMeta(seg, props.todayRange, props.nowDate))))); + }))) }, (InnerContent) => (h(InnerContent, { elTag: "div", elClasses: ['fc-timeline-more-link-inner', 'fc-sticky'] })))); + } + } + + class TimelineLane extends BaseComponent { + constructor() { + super(...arguments); + this.slicer = new TimelineLaneSlicer(); + this.sortEventSegs = memoize(sortEventSegs); + this.harnessElRefs = new RefMap(); + this.moreElRefs = new RefMap(); + this.innerElRef = y(); + // TODO: memoize event positioning + this.state = { + eventInstanceHeights: {}, + moreLinkHeights: {}, + }; + this.handleResize = (isForced) => { + if (isForced) { + this.updateSize(); + } + }; + } + render() { + let { props, state, context } = this; + let { options } = context; + let { dateProfile, tDateProfile } = props; + let slicedProps = this.slicer.sliceProps(props, dateProfile, tDateProfile.isTimeScale ? null : props.nextDayThreshold, context, // wish we didn't have to pass in the rest of the args... + dateProfile, context.dateProfileGenerator, tDateProfile, context.dateEnv); + let mirrorSegs = (slicedProps.eventDrag ? slicedProps.eventDrag.segs : null) || + (slicedProps.eventResize ? slicedProps.eventResize.segs : null) || + []; + let fgSegs = this.sortEventSegs(slicedProps.fgEventSegs, options.eventOrder); + let fgSegHCoords = computeSegHCoords(fgSegs, options.eventMinWidth, props.timelineCoords); + let [fgPlacements, fgHeight] = computeFgSegPlacements(fgSegs, fgSegHCoords, state.eventInstanceHeights, state.moreLinkHeights, options.eventOrderStrict, options.eventMaxStack); + let isForcedInvisible = // TODO: more convenient + (slicedProps.eventDrag ? slicedProps.eventDrag.affectedInstances : null) || + (slicedProps.eventResize ? slicedProps.eventResize.affectedInstances : null) || + {}; + return (h(p, null, + h(TimelineLaneBg, { businessHourSegs: slicedProps.businessHourSegs, bgEventSegs: slicedProps.bgEventSegs, timelineCoords: props.timelineCoords, eventResizeSegs: slicedProps.eventResize ? slicedProps.eventResize.segs : [] /* bad new empty array? */, dateSelectionSegs: slicedProps.dateSelectionSegs, nowDate: props.nowDate, todayRange: props.todayRange }), + h("div", { className: "fc-timeline-events fc-scrollgrid-sync-inner", ref: this.innerElRef, style: { height: fgHeight } }, + this.renderFgSegs(fgPlacements, isForcedInvisible, false, false, false), + this.renderFgSegs(buildMirrorPlacements(mirrorSegs, props.timelineCoords, fgPlacements), {}, Boolean(slicedProps.eventDrag), Boolean(slicedProps.eventResize), false)))); + } + componentDidMount() { + this.updateSize(); + this.context.addResizeHandler(this.handleResize); + } + componentDidUpdate(prevProps, prevState) { + if (prevProps.eventStore !== this.props.eventStore || // external thing changed? + prevProps.timelineCoords !== this.props.timelineCoords || // external thing changed? + prevState.moreLinkHeights !== this.state.moreLinkHeights // HACK. see addStateEquality + ) { + this.updateSize(); + } + } + componentWillUnmount() { + this.context.removeResizeHandler(this.handleResize); + } + updateSize() { + let { props } = this; + let { timelineCoords } = props; + const innerEl = this.innerElRef.current; + if (props.onHeightChange) { + props.onHeightChange(innerEl, false); + } + if (timelineCoords) { + this.setState({ + eventInstanceHeights: mapHash(this.harnessElRefs.currentMap, (harnessEl) => (Math.round(harnessEl.getBoundingClientRect().height))), + moreLinkHeights: mapHash(this.moreElRefs.currentMap, (moreEl) => (Math.round(moreEl.getBoundingClientRect().height))), + }, () => { + if (props.onHeightChange) { + props.onHeightChange(innerEl, true); + } + }); + } + // hack + if (props.syncParentMinHeight) { + innerEl.parentElement.style.minHeight = innerEl.style.height; + } + } + renderFgSegs(segPlacements, isForcedInvisible, isDragging, isResizing, isDateSelecting) { + let { harnessElRefs, moreElRefs, props, context } = this; + let isMirror = isDragging || isResizing || isDateSelecting; + return (h(p, null, segPlacements.map((segPlacement) => { + let { seg, hcoords, top } = segPlacement; + if (Array.isArray(seg)) { // a more-link + let isoStr = buildIsoString(computeEarliestSegStart(seg)); + return (h(TimelineLaneMoreLink, { key: 'm:' + isoStr /* "m" for "more" */, elRef: moreElRefs.createRef(isoStr), hiddenSegs: seg, placement: segPlacement, dateProfile: props.dateProfile, nowDate: props.nowDate, todayRange: props.todayRange, isTimeScale: props.tDateProfile.isTimeScale, eventSelection: props.eventSelection, resourceId: props.resourceId, isForcedInvisible: isForcedInvisible })); + } + let instanceId = seg.eventRange.instance.instanceId; + let isVisible = isMirror || Boolean(!isForcedInvisible[instanceId] && hcoords && top !== null); + let hStyle = coordsToCss(hcoords, context.isRtl); + return (h("div", { key: 'e:' + instanceId /* "e" for "event" */, ref: isMirror ? null : harnessElRefs.createRef(instanceId), className: "fc-timeline-event-harness", style: Object.assign({ visibility: isVisible ? '' : 'hidden', top: top || 0 }, hStyle) }, + h(TimelineEvent, Object.assign({ isTimeScale: props.tDateProfile.isTimeScale, seg: seg, isDragging: isDragging, isResizing: isResizing, isDateSelecting: isDateSelecting, isSelected: instanceId === props.eventSelection /* TODO: bad for mirror? */ }, getSegMeta(seg, props.todayRange, props.nowDate))))); + }))); + } + } + TimelineLane.addStateEquality({ + eventInstanceHeights: isPropsEqual, + moreLinkHeights: isPropsEqual, + }); + function buildMirrorPlacements(mirrorSegs, timelineCoords, fgPlacements) { + if (!mirrorSegs.length || !timelineCoords) { + return []; + } + let topsByInstanceId = buildAbsoluteTopHash(fgPlacements); // TODO: cache this at first render? + return mirrorSegs.map((seg) => ({ + seg, + hcoords: timelineCoords.rangeToCoords(seg), + top: topsByInstanceId[seg.eventRange.instance.instanceId], + })); + } + function buildAbsoluteTopHash(placements) { + let topsByInstanceId = {}; + for (let placement of placements) { + let { seg } = placement; + if (!Array.isArray(seg)) { // doesn't represent a more-link + topsByInstanceId[seg.eventRange.instance.instanceId] = placement.top; + } + } + return topsByInstanceId; + } + + class TimelineGrid extends DateComponent { + constructor() { + super(...arguments); + this.slatsRef = y(); + this.state = { + coords: null, + }; + this.handeEl = (el) => { + if (el) { + this.context.registerInteractiveComponent(this, { el }); + } + else { + this.context.unregisterInteractiveComponent(this); + } + }; + this.handleCoords = (coords) => { + this.setState({ coords }); + if (this.props.onSlatCoords) { + this.props.onSlatCoords(coords); + } + }; + } + render() { + let { props, state, context } = this; + let { options } = context; + let { dateProfile, tDateProfile } = props; + let timerUnit = greatestDurationDenominator(tDateProfile.slotDuration).unit; + return (h("div", { className: "fc-timeline-body", ref: this.handeEl, style: { + minWidth: props.tableMinWidth, + height: props.clientHeight, + width: props.clientWidth, + } }, + h(NowTimer, { unit: timerUnit }, (nowDate, todayRange) => (h(p, null, + h(TimelineSlats, { ref: this.slatsRef, dateProfile: dateProfile, tDateProfile: tDateProfile, nowDate: nowDate, todayRange: todayRange, clientWidth: props.clientWidth, tableColGroupNode: props.tableColGroupNode, tableMinWidth: props.tableMinWidth, onCoords: this.handleCoords, onScrollLeftRequest: props.onScrollLeftRequest }), + h(TimelineLane, { dateProfile: dateProfile, tDateProfile: props.tDateProfile, nowDate: nowDate, todayRange: todayRange, nextDayThreshold: options.nextDayThreshold, businessHours: props.businessHours, eventStore: props.eventStore, eventUiBases: props.eventUiBases, dateSelection: props.dateSelection, eventSelection: props.eventSelection, eventDrag: props.eventDrag, eventResize: props.eventResize, timelineCoords: state.coords, syncParentMinHeight: true }), + (options.nowIndicator && state.coords && state.coords.isDateInRange(nowDate)) && (h("div", { className: "fc-timeline-now-indicator-container" }, + h(NowIndicatorContainer, { elClasses: ['fc-timeline-now-indicator-line'], elStyle: coordToCss(state.coords.dateToCoord(nowDate), context.isRtl), isAxis: false, date: nowDate })))))))); + } + // Hit System + // ------------------------------------------------------------------------------------------ + queryHit(positionLeft, positionTop, elWidth, elHeight) { + let slats = this.slatsRef.current; + let slatHit = slats.positionToHit(positionLeft); + if (slatHit) { + return { + dateProfile: this.props.dateProfile, + dateSpan: slatHit.dateSpan, + rect: { + left: slatHit.left, + right: slatHit.right, + top: 0, + bottom: elHeight, + }, + dayEl: slatHit.dayEl, + layer: 0, + }; + } + return null; + } + } + + class TimelineView extends DateComponent { + constructor() { + super(...arguments); + this.buildTimelineDateProfile = memoize(buildTimelineDateProfile); + this.scrollGridRef = y(); + this.state = { + slatCoords: null, + slotCushionMaxWidth: null, + }; + this.handleSlatCoords = (slatCoords) => { + this.setState({ slatCoords }); + }; + this.handleScrollLeftRequest = (scrollLeft) => { + let scrollGrid = this.scrollGridRef.current; + scrollGrid.forceScrollLeft(0, scrollLeft); + }; + this.handleMaxCushionWidth = (slotCushionMaxWidth) => { + this.setState({ + slotCushionMaxWidth: Math.ceil(slotCushionMaxWidth), // for less rerendering TODO: DRY + }); + }; + } + render() { + let { props, state, context } = this; + let { options } = context; + let stickyHeaderDates = !props.forPrint && getStickyHeaderDates(options); + let stickyFooterScrollbar = !props.forPrint && getStickyFooterScrollbar(options); + let tDateProfile = this.buildTimelineDateProfile(props.dateProfile, context.dateEnv, options, context.dateProfileGenerator); + let { slotMinWidth } = options; + let slatCols = buildSlatCols(tDateProfile, slotMinWidth || this.computeFallbackSlotMinWidth(tDateProfile)); + let sections = [ + { + type: 'header', + key: 'header', + isSticky: stickyHeaderDates, + chunks: [{ + key: 'timeline', + content: (contentArg) => (h(TimelineHeader, { dateProfile: props.dateProfile, clientWidth: contentArg.clientWidth, clientHeight: contentArg.clientHeight, tableMinWidth: contentArg.tableMinWidth, tableColGroupNode: contentArg.tableColGroupNode, tDateProfile: tDateProfile, slatCoords: state.slatCoords, onMaxCushionWidth: slotMinWidth ? null : this.handleMaxCushionWidth })), + }], + }, + { + type: 'body', + key: 'body', + liquid: true, + chunks: [{ + key: 'timeline', + content: (contentArg) => (h(TimelineGrid, Object.assign({}, props, { clientWidth: contentArg.clientWidth, clientHeight: contentArg.clientHeight, tableMinWidth: contentArg.tableMinWidth, tableColGroupNode: contentArg.tableColGroupNode, tDateProfile: tDateProfile, onSlatCoords: this.handleSlatCoords, onScrollLeftRequest: this.handleScrollLeftRequest }))), + }], + }, + ]; + if (stickyFooterScrollbar) { + sections.push({ + type: 'footer', + key: 'footer', + isSticky: true, + chunks: [{ + key: 'timeline', + content: renderScrollShim, + }], + }); + } + return (h(ViewContainer$1, { elClasses: [ + 'fc-timeline', + options.eventOverlap === false ? + 'fc-timeline-overlap-disabled' : + '', + ], viewSpec: context.viewSpec }, + h(ScrollGrid, { ref: this.scrollGridRef, liquid: !props.isHeightAuto && !props.forPrint, collapsibleWidth: false, colGroups: [ + { cols: slatCols }, + ], sections: sections }))); + } + computeFallbackSlotMinWidth(tDateProfile) { + return Math.max(30, ((this.state.slotCushionMaxWidth || 0) / tDateProfile.slotsPerLabel)); + } + } + function buildSlatCols(tDateProfile, slotMinWidth) { + return [{ + span: tDateProfile.slotCnt, + minWidth: slotMinWidth || 1, // needs to be a non-zero number to trigger horizontal scrollbars!?????? + }]; + } + + var css_248z$1 = ".fc .fc-timeline-body{min-height:100%;position:relative;z-index:1}.fc .fc-timeline-slots{bottom:0;position:absolute;top:0;z-index:1}.fc .fc-timeline-slots>table{height:100%}.fc .fc-timeline-slot-minor{border-style:dotted}.fc .fc-timeline-slot-frame{align-items:center;display:flex;justify-content:center}.fc .fc-timeline-header-row-chrono .fc-timeline-slot-frame{justify-content:flex-start}.fc .fc-timeline-header-row:last-child .fc-timeline-slot-frame{overflow:hidden}.fc .fc-timeline-slot-cushion{padding:4px 5px;white-space:nowrap}.fc-direction-ltr .fc-timeline-slot{border-right:0!important}.fc-direction-rtl .fc-timeline-slot{border-left:0!important}.fc .fc-timeline-now-indicator-container{bottom:0;left:0;position:absolute;right:0;top:0;width:0;z-index:4}.fc .fc-timeline-now-indicator-arrow,.fc .fc-timeline-now-indicator-line{border-color:var(--fc-now-indicator-color);border-style:solid;position:absolute;top:0}.fc .fc-timeline-now-indicator-arrow{border-left-color:transparent;border-right-color:transparent;border-width:6px 5px 0;margin:0 -6px}.fc .fc-timeline-now-indicator-line{border-width:0 0 0 1px;bottom:0;margin:0 -1px}.fc .fc-timeline-events{position:relative;width:0;z-index:3}.fc .fc-timeline-event-harness,.fc .fc-timeline-more-link{position:absolute;top:0}.fc-timeline-event{z-index:1}.fc-timeline-event.fc-event-mirror{z-index:2}.fc-timeline-event{align-items:center;border-radius:0;display:flex;font-size:var(--fc-small-font-size);margin-bottom:1px;padding:2px 1px;position:relative}.fc-timeline-event .fc-event-main{flex-grow:1;flex-shrink:1;min-width:0}.fc-timeline-event .fc-event-time{font-weight:700}.fc-timeline-event .fc-event-time,.fc-timeline-event .fc-event-title{padding:0 2px;white-space:nowrap}.fc-direction-ltr .fc-timeline-event.fc-event-end,.fc-direction-ltr .fc-timeline-more-link{margin-right:1px}.fc-direction-rtl .fc-timeline-event.fc-event-end,.fc-direction-rtl .fc-timeline-more-link{margin-left:1px}.fc-timeline-overlap-disabled .fc-timeline-event{margin-bottom:0;padding-bottom:5px;padding-top:5px}.fc-timeline-event:not(.fc-event-end):after,.fc-timeline-event:not(.fc-event-start):before{border-color:transparent #000;border-style:solid;border-width:5px;content:\"\";flex-grow:0;flex-shrink:0;height:0;margin:0 1px;opacity:.5;width:0}.fc-direction-ltr .fc-timeline-event:not(.fc-event-start):before,.fc-direction-rtl .fc-timeline-event:not(.fc-event-end):after{border-left:0}.fc-direction-ltr .fc-timeline-event:not(.fc-event-end):after,.fc-direction-rtl .fc-timeline-event:not(.fc-event-start):before{border-right:0}.fc-timeline-more-link{background:var(--fc-more-link-bg-color);color:var(--fc-more-link-text-color);cursor:pointer;font-size:var(--fc-small-font-size);padding:1px}.fc-timeline-more-link-inner{display:inline-block;left:0;padding:2px;right:0}.fc .fc-timeline-bg{bottom:0;left:0;position:absolute;right:0;top:0;width:0;z-index:2}.fc .fc-timeline-bg .fc-non-business{z-index:1}.fc .fc-timeline-bg .fc-bg-event{z-index:2}.fc .fc-timeline-bg .fc-highlight{z-index:3}.fc .fc-timeline-bg-harness{bottom:0;position:absolute;top:0}"; + injectStyles(css_248z$1); + + var index$4 = createPlugin({ + name: '@fullcalendar/timeline', + premiumReleaseDate: '2022-12-27', + deps: [index$7], + initialView: 'timelineDay', + views: { + timeline: { + component: TimelineView, + usesMinMaxTime: true, + eventResizableFromStart: true, // how is this consumed for TimelineView tho? + }, + timelineDay: { + type: 'timeline', + duration: { days: 1 }, + }, + timelineWeek: { + type: 'timeline', + duration: { weeks: 1 }, + }, + timelineMonth: { + type: 'timeline', + duration: { months: 1 }, + }, + timelineYear: { + type: 'timeline', + duration: { years: 1 }, + }, + }, + }); + + const PRIVATE_ID_PREFIX = '_fc:'; + const RESOURCE_REFINERS = { + id: String, + parentId: String, + children: identity, + title: String, + businessHours: identity, + extendedProps: identity, + // event-ui + eventEditable: Boolean, + eventStartEditable: Boolean, + eventDurationEditable: Boolean, + eventConstraint: identity, + eventOverlap: Boolean, + eventAllow: identity, + eventClassNames: parseClassNames, + eventBackgroundColor: String, + eventBorderColor: String, + eventTextColor: String, + eventColor: String, + }; + /* + needs a full store so that it can populate children too + */ + function parseResource(raw, parentId = '', store, context) { + let { refined, extra } = refineProps(raw, RESOURCE_REFINERS); + let resource = { + id: refined.id || (PRIVATE_ID_PREFIX + guid()), + parentId: refined.parentId || parentId, + title: refined.title || '', + businessHours: refined.businessHours ? parseBusinessHours(refined.businessHours, context) : null, + ui: createEventUi({ + editable: refined.eventEditable, + startEditable: refined.eventStartEditable, + durationEditable: refined.eventDurationEditable, + constraint: refined.eventConstraint, + overlap: refined.eventOverlap, + allow: refined.eventAllow, + classNames: refined.eventClassNames, + backgroundColor: refined.eventBackgroundColor, + borderColor: refined.eventBorderColor, + textColor: refined.eventTextColor, + color: refined.eventColor, + }, context), + extendedProps: Object.assign(Object.assign({}, extra), refined.extendedProps), + }; + // help out ResourceApi from having user modify props + Object.freeze(resource.ui.classNames); + Object.freeze(resource.extendedProps); + if (store[resource.id]) ; + else { + store[resource.id] = resource; + if (refined.children) { + for (let childInput of refined.children) { + parseResource(childInput, resource.id, store, context); + } + } + } + return resource; + } + /* + TODO: use this in more places + */ + function getPublicId(id) { + if (id.indexOf(PRIVATE_ID_PREFIX) === 0) { + return ''; + } + return id; + } + + class ResourceApi { + constructor(_context, _resource) { + this._context = _context; + this._resource = _resource; + } + setProp(name, value) { + let oldResource = this._resource; + this._context.dispatch({ + type: 'SET_RESOURCE_PROP', + resourceId: oldResource.id, + propName: name, + propValue: value, + }); + this.sync(oldResource); + } + setExtendedProp(name, value) { + let oldResource = this._resource; + this._context.dispatch({ + type: 'SET_RESOURCE_EXTENDED_PROP', + resourceId: oldResource.id, + propName: name, + propValue: value, + }); + this.sync(oldResource); + } + sync(oldResource) { + let context = this._context; + let resourceId = oldResource.id; + // TODO: what if dispatch didn't complete synchronously? + this._resource = context.getCurrentData().resourceStore[resourceId]; + context.emitter.trigger('resourceChange', { + oldResource: new ResourceApi(context, oldResource), + resource: this, + revert() { + context.dispatch({ + type: 'ADD_RESOURCE', + resourceHash: { + [resourceId]: oldResource, + }, + }); + }, + }); + } + remove() { + let context = this._context; + let internalResource = this._resource; + let resourceId = internalResource.id; + context.dispatch({ + type: 'REMOVE_RESOURCE', + resourceId, + }); + context.emitter.trigger('resourceRemove', { + resource: this, + revert() { + context.dispatch({ + type: 'ADD_RESOURCE', + resourceHash: { + [resourceId]: internalResource, + }, + }); + }, + }); + } + getParent() { + let context = this._context; + let parentId = this._resource.parentId; + if (parentId) { + return new ResourceApi(context, context.getCurrentData().resourceSource[parentId]); + } + return null; + } + getChildren() { + let thisResourceId = this._resource.id; + let context = this._context; + let { resourceStore } = context.getCurrentData(); + let childApis = []; + for (let resourceId in resourceStore) { + if (resourceStore[resourceId].parentId === thisResourceId) { + childApis.push(new ResourceApi(context, resourceStore[resourceId])); + } + } + return childApis; + } + /* + this is really inefficient! + TODO: make EventApi::resourceIds a hash or keep an index in the Calendar's state + */ + getEvents() { + let thisResourceId = this._resource.id; + let context = this._context; + let { defs, instances } = context.getCurrentData().eventStore; + let eventApis = []; + for (let instanceId in instances) { + let instance = instances[instanceId]; + let def = defs[instance.defId]; + if (def.resourceIds.indexOf(thisResourceId) !== -1) { // inefficient!!! + eventApis.push(new EventImpl(context, def, instance)); + } + } + return eventApis; + } + get id() { return getPublicId(this._resource.id); } + get title() { return this._resource.title; } + get eventConstraint() { return this._resource.ui.constraints[0] || null; } // TODO: better type + get eventOverlap() { return this._resource.ui.overlap; } + get eventAllow() { return this._resource.ui.allows[0] || null; } // TODO: better type + get eventBackgroundColor() { return this._resource.ui.backgroundColor; } + get eventBorderColor() { return this._resource.ui.borderColor; } + get eventTextColor() { return this._resource.ui.textColor; } + // NOTE: user can't modify these because Object.freeze was called in event-def parsing + get eventClassNames() { return this._resource.ui.classNames; } + get extendedProps() { return this._resource.extendedProps; } + toPlainObject(settings = {}) { + let internal = this._resource; + let { ui } = internal; + let publicId = this.id; + let res = {}; + if (publicId) { + res.id = publicId; + } + if (internal.title) { + res.title = internal.title; + } + if (settings.collapseEventColor && ui.backgroundColor && ui.backgroundColor === ui.borderColor) { + res.eventColor = ui.backgroundColor; + } + else { + if (ui.backgroundColor) { + res.eventBackgroundColor = ui.backgroundColor; + } + if (ui.borderColor) { + res.eventBorderColor = ui.borderColor; + } + } + if (ui.textColor) { + res.eventTextColor = ui.textColor; + } + if (ui.classNames.length) { + res.eventClassNames = ui.classNames; + } + if (Object.keys(internal.extendedProps).length) { + if (settings.collapseExtendedProps) { + Object.assign(res, internal.extendedProps); + } + else { + res.extendedProps = internal.extendedProps; + } + } + return res; + } + toJSON() { + return this.toPlainObject(); + } + } + function buildResourceApis(resourceStore, context) { + let resourceApis = []; + for (let resourceId in resourceStore) { + resourceApis.push(new ResourceApi(context, resourceStore[resourceId])); + } + return resourceApis; + } + + /* + splits things BASED OFF OF which resources they are associated with. + creates a '' entry which is when something has NO resource. + */ + class ResourceSplitter extends Splitter { + getKeyInfo(props) { + return Object.assign({ '': {} }, props.resourceStore); + } + getKeysForDateSpan(dateSpan) { + return [dateSpan.resourceId || '']; + } + getKeysForEventDef(eventDef) { + let resourceIds = eventDef.resourceIds; + if (!resourceIds.length) { + return ['']; + } + return resourceIds; + } + } + + const DEFAULT_RESOURCE_ORDER = parseFieldSpecs('id,title'); + function handleResourceStore(resourceStore, calendarData) { + let { emitter } = calendarData; + if (emitter.hasHandlers('resourcesSet')) { + emitter.trigger('resourcesSet', buildResourceApis(resourceStore, calendarData)); + } + } + + function refineRenderProps$1(input) { + return { + resource: new ResourceApi(input.context, input.resource), + }; + } + + // TODO: not used for Spreadsheet. START USING. difficult because of col-specific rendering props + class ResourceLabelContainer extends BaseComponent { + constructor() { + super(...arguments); + this.refineRenderProps = memoizeObjArg(refineRenderProps$2); + } + render() { + const { props } = this; + return (h(ViewContextType.Consumer, null, (context) => { + let { options } = context; + let renderProps = this.refineRenderProps({ + resource: props.resource, + date: props.date, + context, + }); + return (h(ContentContainer, Object.assign({}, props, { elAttrs: Object.assign(Object.assign({}, props.elAttrs), { 'data-resource-id': props.resource.id, 'data-date': props.date ? formatDayString(props.date) : undefined }), renderProps: renderProps, generatorName: "resourceLabelContent", generator: options.resourceLabelContent || renderInnerContent, classNameGenerator: options.resourceLabelClassNames, didMount: options.resourceLabelDidMount, willUnmount: options.resourceLabelWillUnmount }))); + })); + } + } + function renderInnerContent(props) { + return props.resource.title || props.resource.id; + } + function refineRenderProps$2(input) { + return { + resource: new ResourceApi(input.context, input.resource), + date: input.date ? input.context.dateEnv.toDate(input.date) : null, + view: input.context.viewApi, + }; + } + + class ResourceCell extends BaseComponent { + render() { + let { props } = this; + return (h(ResourceLabelContainer, { elTag: "th", elClasses: ['fc-col-header-cell', 'fc-resource'], elAttrs: { + role: 'columnheader', + colSpan: props.colSpan, + }, resource: props.resource, date: props.date }, (InnerContent) => (h("div", { className: "fc-scrollgrid-sync-inner" }, + h(InnerContent, { elTag: "span", elClasses: [ + 'fc-col-header-cell-cushion', + props.isSticky && 'fc-sticky', + ] }))))); + } + } + + class ResourceDayHeader extends BaseComponent { + constructor() { + super(...arguments); + this.buildDateFormat = memoize(buildDateFormat); + } + render() { + let { props, context } = this; + let dateFormat = this.buildDateFormat(context.options.dayHeaderFormat, props.datesRepDistinctDays, props.dates.length); + return (h(NowTimer, { unit: "day" }, (nowDate, todayRange) => { + if (props.dates.length === 1) { + return this.renderResourceRow(props.resources, props.dates[0]); + } + if (context.options.datesAboveResources) { + return this.renderDayAndResourceRows(props.dates, dateFormat, todayRange, props.resources); + } + return this.renderResourceAndDayRows(props.resources, props.dates, dateFormat, todayRange); + })); + } + renderResourceRow(resources, date) { + let resourceCells = resources.map((resource) => (h(ResourceCell, { key: resource.id, resource: resource, colSpan: 1, date: date }))); + return this.buildTr(resourceCells, 'resources'); + } + renderDayAndResourceRows(dates, dateFormat, todayRange, resources) { + let dateCells = []; + let resourceCells = []; + for (let date of dates) { + dateCells.push(this.renderDateCell(date, dateFormat, todayRange, resources.length, null, true)); + for (let resource of resources) { + resourceCells.push(h(ResourceCell, { key: resource.id + ':' + date.toISOString(), resource: resource, colSpan: 1, date: date })); + } + } + return (h(p, null, + this.buildTr(dateCells, 'day'), + this.buildTr(resourceCells, 'resources'))); + } + renderResourceAndDayRows(resources, dates, dateFormat, todayRange) { + let resourceCells = []; + let dateCells = []; + for (let resource of resources) { + resourceCells.push(h(ResourceCell, { key: resource.id, resource: resource, colSpan: dates.length, isSticky: true })); + for (let date of dates) { + dateCells.push(this.renderDateCell(date, dateFormat, todayRange, 1, resource)); + } + } + return (h(p, null, + this.buildTr(resourceCells, 'resources'), + this.buildTr(dateCells, 'day'))); + } + // a cell with date text. might have a resource associated with it + renderDateCell(date, dateFormat, todayRange, colSpan, resource, isSticky) { + let { props } = this; + let keyPostfix = resource ? `:${resource.id}` : ''; + let extraRenderProps = resource ? { resource: new ResourceApi(this.context, resource) } : {}; + let extraDataAttrs = resource ? { 'data-resource-id': resource.id } : {}; + return props.datesRepDistinctDays ? (h(TableDateCell, { key: date.toISOString() + keyPostfix, date: date, dateProfile: props.dateProfile, todayRange: todayRange, colCnt: props.dates.length * props.resources.length, dayHeaderFormat: dateFormat, colSpan: colSpan, isSticky: isSticky, extraRenderProps: extraRenderProps, extraDataAttrs: extraDataAttrs })) : (h(TableDowCell // we can't leverage the pure-componentness becausae the extra* props are new every time :( + , { key: date.getUTCDay() + keyPostfix, dow: date.getUTCDay(), dayHeaderFormat: dateFormat, colSpan: colSpan, isSticky: isSticky, extraRenderProps: extraRenderProps, extraDataAttrs: extraDataAttrs })); + } + buildTr(cells, key) { + let { renderIntro } = this.props; + if (!cells.length) { + cells = [h("td", { key: 0 }, "\u00A0")]; + } + return (h("tr", { key: key, role: "row" }, + renderIntro && renderIntro(key), + cells)); + } + } + function buildDateFormat(dayHeaderFormat, datesRepDistinctDays, dayCnt) { + return dayHeaderFormat || computeFallbackHeaderFormat(datesRepDistinctDays, dayCnt); + } + + class ResourceIndex { + constructor(resources) { + let indicesById = {}; + let ids = []; + for (let i = 0; i < resources.length; i += 1) { + let id = resources[i].id; + ids.push(id); + indicesById[id] = i; + } + this.ids = ids; + this.indicesById = indicesById; + this.length = resources.length; + } + } + + class AbstractResourceDayTableModel { + constructor(dayTableModel, resources, context) { + this.dayTableModel = dayTableModel; + this.resources = resources; + this.context = context; + this.resourceIndex = new ResourceIndex(resources); + this.rowCnt = dayTableModel.rowCnt; + this.colCnt = dayTableModel.colCnt * resources.length; + this.cells = this.buildCells(); + } + buildCells() { + let { rowCnt, dayTableModel, resources } = this; + let rows = []; + for (let row = 0; row < rowCnt; row += 1) { + let rowCells = []; + for (let dateCol = 0; dateCol < dayTableModel.colCnt; dateCol += 1) { + for (let resourceCol = 0; resourceCol < resources.length; resourceCol += 1) { + let resource = resources[resourceCol]; + let extraRenderProps = { resource: new ResourceApi(this.context, resource) }; + let extraDataAttrs = { 'data-resource-id': resource.id }; + let extraClassNames = ['fc-resource']; + let extraDateSpan = { resourceId: resource.id }; + let date = dayTableModel.cells[row][dateCol].date; + rowCells[this.computeCol(dateCol, resourceCol)] = { + key: resource.id + ':' + date.toISOString(), + date, + extraRenderProps, + extraDataAttrs, + extraClassNames, + extraDateSpan, + }; + } + } + rows.push(rowCells); + } + return rows; + } + } + + /* + resources over dates + */ + class ResourceDayTableModel extends AbstractResourceDayTableModel { + computeCol(dateI, resourceI) { + return resourceI * this.dayTableModel.colCnt + dateI; + } + /* + all date ranges are intact + */ + computeColRanges(dateStartI, dateEndI, resourceI) { + return [ + { + firstCol: this.computeCol(dateStartI, resourceI), + lastCol: this.computeCol(dateEndI, resourceI), + isStart: true, + isEnd: true, + }, + ]; + } + } + + /* + dates over resources + */ + class DayResourceTableModel extends AbstractResourceDayTableModel { + computeCol(dateI, resourceI) { + return dateI * this.resources.length + resourceI; + } + /* + every single day is broken up + */ + computeColRanges(dateStartI, dateEndI, resourceI) { + let segs = []; + for (let i = dateStartI; i <= dateEndI; i += 1) { + let col = this.computeCol(i, resourceI); + segs.push({ + firstCol: col, + lastCol: col, + isStart: i === dateStartI, + isEnd: i === dateEndI, + }); + } + return segs; + } + } + + const NO_SEGS = []; // for memoizing + class VResourceJoiner { + constructor() { + this.joinDateSelection = memoize(this.joinSegs); + this.joinBusinessHours = memoize(this.joinSegs); + this.joinFgEvents = memoize(this.joinSegs); + this.joinBgEvents = memoize(this.joinSegs); + this.joinEventDrags = memoize(this.joinInteractions); + this.joinEventResizes = memoize(this.joinInteractions); + } + /* + propSets also has a '' key for things with no resource + */ + joinProps(propSets, resourceDayTable) { + let dateSelectionSets = []; + let businessHoursSets = []; + let fgEventSets = []; + let bgEventSets = []; + let eventDrags = []; + let eventResizes = []; + let eventSelection = ''; + let keys = resourceDayTable.resourceIndex.ids.concat(['']); // add in the all-resource key + for (let key of keys) { + let props = propSets[key]; + dateSelectionSets.push(props.dateSelectionSegs); + businessHoursSets.push(key ? props.businessHourSegs : NO_SEGS); // don't include redundant all-resource businesshours + fgEventSets.push(key ? props.fgEventSegs : NO_SEGS); // don't include fg all-resource segs + bgEventSets.push(props.bgEventSegs); + eventDrags.push(props.eventDrag); + eventResizes.push(props.eventResize); + eventSelection = eventSelection || props.eventSelection; + } + return { + dateSelectionSegs: this.joinDateSelection(resourceDayTable, ...dateSelectionSets), + businessHourSegs: this.joinBusinessHours(resourceDayTable, ...businessHoursSets), + fgEventSegs: this.joinFgEvents(resourceDayTable, ...fgEventSets), + bgEventSegs: this.joinBgEvents(resourceDayTable, ...bgEventSets), + eventDrag: this.joinEventDrags(resourceDayTable, ...eventDrags), + eventResize: this.joinEventResizes(resourceDayTable, ...eventResizes), + eventSelection, + }; + } + joinSegs(resourceDayTable, ...segGroups) { + let resourceCnt = resourceDayTable.resources.length; + let transformedSegs = []; + for (let i = 0; i < resourceCnt; i += 1) { + for (let seg of segGroups[i]) { + transformedSegs.push(...this.transformSeg(seg, resourceDayTable, i)); + } + for (let seg of segGroups[resourceCnt]) { // one beyond. the all-resource + transformedSegs.push(...this.transformSeg(seg, resourceDayTable, i)); + } + } + return transformedSegs; + } + /* + for expanding non-resource segs to all resources. + only for public use. + no memoizing. + */ + expandSegs(resourceDayTable, segs) { + let resourceCnt = resourceDayTable.resources.length; + let transformedSegs = []; + for (let i = 0; i < resourceCnt; i += 1) { + for (let seg of segs) { + transformedSegs.push(...this.transformSeg(seg, resourceDayTable, i)); + } + } + return transformedSegs; + } + joinInteractions(resourceDayTable, ...interactions) { + let resourceCnt = resourceDayTable.resources.length; + let affectedInstances = {}; + let transformedSegs = []; + let anyInteractions = false; + let isEvent = false; + for (let i = 0; i < resourceCnt; i += 1) { + let interaction = interactions[i]; + if (interaction) { + anyInteractions = true; + for (let seg of interaction.segs) { + transformedSegs.push(...this.transformSeg(seg, resourceDayTable, i)); + } + Object.assign(affectedInstances, interaction.affectedInstances); + isEvent = isEvent || interaction.isEvent; + } + if (interactions[resourceCnt]) { // one beyond. the all-resource + for (let seg of interactions[resourceCnt].segs) { + transformedSegs.push(...this.transformSeg(seg, resourceDayTable, i)); + } + } + } + if (anyInteractions) { + return { + affectedInstances, + segs: transformedSegs, + isEvent, + }; + } + return null; + } + } + + /* + TODO: just use ResourceHash somehow? could then use the generic ResourceSplitter + */ + class VResourceSplitter extends Splitter { + getKeyInfo(props) { + let { resourceDayTableModel } = props; + let hash = mapHash(resourceDayTableModel.resourceIndex.indicesById, (i) => resourceDayTableModel.resources[i]); // :( + hash[''] = {}; + return hash; + } + getKeysForDateSpan(dateSpan) { + return [dateSpan.resourceId || '']; + } + getKeysForEventDef(eventDef) { + let resourceIds = eventDef.resourceIds; + if (!resourceIds.length) { + return ['']; + } + return resourceIds; + } + } + + /* + doesn't accept grouping + */ + function flattenResources(resourceStore, orderSpecs) { + return buildRowNodes(resourceStore, [], orderSpecs, false, {}, true) + .map((node) => node.resource); + } + function buildRowNodes(resourceStore, groupSpecs, orderSpecs, isVGrouping, expansions, expansionDefault) { + let complexNodes = buildHierarchy(resourceStore, isVGrouping ? -1 : 1, groupSpecs, orderSpecs); + let flatNodes = []; + flattenNodes(complexNodes, flatNodes, isVGrouping, [], 0, expansions, expansionDefault); + return flatNodes; + } + function flattenNodes(complexNodes, res, isVGrouping, rowSpans, depth, expansions, expansionDefault) { + for (let i = 0; i < complexNodes.length; i += 1) { + let complexNode = complexNodes[i]; + let group = complexNode.group; + if (group) { + if (isVGrouping) { + let firstRowIndex = res.length; + let rowSpanIndex = rowSpans.length; + flattenNodes(complexNode.children, res, isVGrouping, rowSpans.concat(0), depth, expansions, expansionDefault); + if (firstRowIndex < res.length) { + let firstRow = res[firstRowIndex]; + let firstRowSpans = firstRow.rowSpans = firstRow.rowSpans.slice(); + firstRowSpans[rowSpanIndex] = res.length - firstRowIndex; + } + } + else { + let id = group.spec.field + ':' + group.value; + let isExpanded = expansions[id] != null ? expansions[id] : expansionDefault; + res.push({ id, group, isExpanded }); + if (isExpanded) { + flattenNodes(complexNode.children, res, isVGrouping, rowSpans, depth + 1, expansions, expansionDefault); + } + } + } + else if (complexNode.resource) { + let id = complexNode.resource.id; + let isExpanded = expansions[id] != null ? expansions[id] : expansionDefault; + res.push({ + id, + rowSpans, + depth, + isExpanded, + hasChildren: Boolean(complexNode.children.length), + resource: complexNode.resource, + resourceFields: complexNode.resourceFields, + }); + if (isExpanded) { + flattenNodes(complexNode.children, res, isVGrouping, rowSpans, depth + 1, expansions, expansionDefault); + } + } + } + } + function buildHierarchy(resourceStore, maxDepth, groupSpecs, orderSpecs) { + let resourceNodes = buildResourceNodes(resourceStore, orderSpecs); + let builtNodes = []; + for (let resourceId in resourceNodes) { + let resourceNode = resourceNodes[resourceId]; + if (!resourceNode.resource.parentId) { + insertResourceNode(resourceNode, builtNodes, groupSpecs, 0, maxDepth, orderSpecs); + } + } + return builtNodes; + } + function buildResourceNodes(resourceStore, orderSpecs) { + let nodeHash = {}; + for (let resourceId in resourceStore) { + let resource = resourceStore[resourceId]; + nodeHash[resourceId] = { + resource, + resourceFields: buildResourceFields(resource), + children: [], + }; + } + for (let resourceId in resourceStore) { + let resource = resourceStore[resourceId]; + if (resource.parentId) { + let parentNode = nodeHash[resource.parentId]; + if (parentNode) { + insertResourceNodeInSiblings(nodeHash[resourceId], parentNode.children, orderSpecs); + } + } + } + return nodeHash; + } + function insertResourceNode(resourceNode, nodes, groupSpecs, depth, maxDepth, orderSpecs) { + if (groupSpecs.length && (maxDepth === -1 || depth <= maxDepth)) { + let groupNode = ensureGroupNodes(resourceNode, nodes, groupSpecs[0]); + insertResourceNode(resourceNode, groupNode.children, groupSpecs.slice(1), depth + 1, maxDepth, orderSpecs); + } + else { + insertResourceNodeInSiblings(resourceNode, nodes, orderSpecs); + } + } + function ensureGroupNodes(resourceNode, nodes, groupSpec) { + let groupValue = resourceNode.resourceFields[groupSpec.field]; + let groupNode; + let newGroupIndex; + // find an existing group that matches, or determine the position for a new group + if (groupSpec.order) { + for (newGroupIndex = 0; newGroupIndex < nodes.length; newGroupIndex += 1) { + let node = nodes[newGroupIndex]; + if (node.group) { + let cmp = flexibleCompare(groupValue, node.group.value) * groupSpec.order; + if (cmp === 0) { + groupNode = node; + break; + } + else if (cmp < 0) { + break; + } + } + } + } + else { // the groups are unordered + for (newGroupIndex = 0; newGroupIndex < nodes.length; newGroupIndex += 1) { + let node = nodes[newGroupIndex]; + if (node.group && groupValue === node.group.value) { + groupNode = node; + break; + } + } + } + if (!groupNode) { + groupNode = { + group: { + value: groupValue, + spec: groupSpec, + }, + children: [], + }; + nodes.splice(newGroupIndex, 0, groupNode); + } + return groupNode; + } + function insertResourceNodeInSiblings(resourceNode, siblings, orderSpecs) { + let i; + for (i = 0; i < siblings.length; i += 1) { + let cmp = compareByFieldSpecs(siblings[i].resourceFields, resourceNode.resourceFields, orderSpecs); // TODO: pass in ResourceApi? + if (cmp > 0) { // went 1 past. insert at i + break; + } + } + siblings.splice(i, 0, resourceNode); + } + function buildResourceFields(resource) { + let obj = Object.assign(Object.assign(Object.assign({}, resource.extendedProps), resource.ui), resource); + delete obj.ui; + delete obj.extendedProps; + return obj; + } + function isGroupsEqual(group0, group1) { + return group0.spec === group1.spec && group0.value === group1.value; + } + + function massageEventDragMutation(eventMutation, hit0, hit1) { + let resource0 = hit0.dateSpan.resourceId; + let resource1 = hit1.dateSpan.resourceId; + if (resource0 && resource1 && + resource0 !== resource1) { + eventMutation.resourceMutation = { + matchResourceId: resource0, + setResourceId: resource1, + }; + } + } + /* + TODO: all this would be much easier if we were using a hash! + */ + function applyEventDefMutation(eventDef, mutation, context) { + let resourceMutation = mutation.resourceMutation; + if (resourceMutation && computeResourceEditable(eventDef, context)) { + let index = eventDef.resourceIds.indexOf(resourceMutation.matchResourceId); + if (index !== -1) { + let resourceIds = eventDef.resourceIds.slice(); // copy + resourceIds.splice(index, 1); // remove + if (resourceIds.indexOf(resourceMutation.setResourceId) === -1) { // not already in there + resourceIds.push(resourceMutation.setResourceId); // add + } + eventDef.resourceIds = resourceIds; + } + } + } + /* + HACK + TODO: use EventUi system instead of this + */ + function computeResourceEditable(eventDef, context) { + let { resourceEditable } = eventDef; + if (resourceEditable == null) { + let source = eventDef.sourceId && context.getCurrentData().eventSources[eventDef.sourceId]; + if (source) { + resourceEditable = source.extendedProps.resourceEditable; // used the Source::extendedProps hack + } + if (resourceEditable == null) { + resourceEditable = context.options.eventResourceEditable; + if (resourceEditable == null) { + resourceEditable = context.options.editable; // TODO: use defaults system instead + } + } + } + return resourceEditable; + } + function transformEventDrop(mutation, context) { + let { resourceMutation } = mutation; + if (resourceMutation) { + let { calendarApi } = context; + return { + oldResource: calendarApi.getResourceById(resourceMutation.matchResourceId), + newResource: calendarApi.getResourceById(resourceMutation.setResourceId), + }; + } + return { + oldResource: null, + newResource: null, + }; + } + + class ResourceDataAdder { + constructor() { + this.filterResources = memoize(filterResources); + } + transform(viewProps, calendarProps) { + if (calendarProps.viewSpec.optionDefaults.needsResourceData) { + return { + resourceStore: this.filterResources(calendarProps.resourceStore, calendarProps.options.filterResourcesWithEvents, calendarProps.eventStore, calendarProps.dateProfile.activeRange), + resourceEntityExpansions: calendarProps.resourceEntityExpansions, + }; + } + return null; + } + } + function filterResources(resourceStore, doFilterResourcesWithEvents, eventStore, activeRange) { + if (doFilterResourcesWithEvents) { + let instancesInRange = filterEventInstancesInRange(eventStore.instances, activeRange); + let hasEvents = computeHasEvents(instancesInRange, eventStore.defs); + Object.assign(hasEvents, computeAncestorHasEvents(hasEvents, resourceStore)); + return filterHash(resourceStore, (resource, resourceId) => hasEvents[resourceId]); + } + return resourceStore; + } + function filterEventInstancesInRange(eventInstances, activeRange) { + return filterHash(eventInstances, (eventInstance) => rangesIntersect(eventInstance.range, activeRange)); + } + function computeHasEvents(eventInstances, eventDefs) { + let hasEvents = {}; + for (let instanceId in eventInstances) { + let instance = eventInstances[instanceId]; + for (let resourceId of eventDefs[instance.defId].resourceIds) { + hasEvents[resourceId] = true; + } + } + return hasEvents; + } + /* + mark resources as having events if any of their ancestors have them + NOTE: resourceStore might not have all the resources that hasEvents{} has keyed + */ + function computeAncestorHasEvents(hasEvents, resourceStore) { + let res = {}; + for (let resourceId in hasEvents) { + let resource; + while ((resource = resourceStore[resourceId])) { + resourceId = resource.parentId; // now functioning as the parentId + if (resourceId) { + res[resourceId] = true; + } + else { + break; + } + } + } + return res; + } + /* + for making sure events that have editable resources are always draggable in resource views + */ + function transformIsDraggable(val, eventDef, eventUi, context) { + if (!val) { + let state = context.getCurrentData(); + let viewSpec = state.viewSpecs[state.currentViewType]; + if (viewSpec.optionDefaults.needsResourceData) { + if (computeResourceEditable(eventDef, context)) { + return true; + } + } + } + return val; + } + + // for when non-resource view should be given EventUi info (for event coloring/constraints based off of resource data) + class ResourceEventConfigAdder { + constructor() { + this.buildResourceEventUis = memoize(buildResourceEventUis, isPropsEqual); + this.injectResourceEventUis = memoize(injectResourceEventUis); + } + transform(viewProps, calendarProps) { + if (!calendarProps.viewSpec.optionDefaults.needsResourceData) { + return { + eventUiBases: this.injectResourceEventUis(viewProps.eventUiBases, viewProps.eventStore.defs, this.buildResourceEventUis(calendarProps.resourceStore)), + }; + } + return null; + } + } + function buildResourceEventUis(resourceStore) { + return mapHash(resourceStore, (resource) => resource.ui); + } + function injectResourceEventUis(eventUiBases, eventDefs, resourceEventUis) { + return mapHash(eventUiBases, (eventUi, defId) => { + if (defId) { // not the '' key + return injectResourceEventUi(eventUi, eventDefs[defId], resourceEventUis); + } + return eventUi; + }); + } + function injectResourceEventUi(origEventUi, eventDef, resourceEventUis) { + let parts = []; + // first resource takes precedence, which fights with the ordering of combineEventUis, thus the unshifts + for (let resourceId of eventDef.resourceIds) { + if (resourceEventUis[resourceId]) { + parts.unshift(resourceEventUis[resourceId]); + } + } + parts.unshift(origEventUi); + return combineEventUis(parts); + } + + let defs = []; // TODO: use plugin system + function registerResourceSourceDef(def) { + defs.push(def); + } + function getResourceSourceDef(id) { + return defs[id]; + } + function getResourceSourceDefs() { + return defs; + } + + // TODO: make this a plugin-able parser + // TODO: success/failure + const RESOURCE_SOURCE_REFINERS = { + id: String, + // for array. TODO: move to resource-array + resources: identity, + // for json feed. TODO: move to resource-json-feed + url: String, + method: String, + startParam: String, + endParam: String, + timeZoneParam: String, + extraParams: identity, + }; + function parseResourceSource(input) { + let inputObj; + if (typeof input === 'string') { + inputObj = { url: input }; + } + else if (typeof input === 'function' || Array.isArray(input)) { + inputObj = { resources: input }; + } + else if (typeof input === 'object' && input) { // non-null object + inputObj = input; + } + if (inputObj) { + let { refined, extra } = refineProps(inputObj, RESOURCE_SOURCE_REFINERS); + warnUnknownProps(extra); + let metaRes = buildResourceSourceMeta(refined); + if (metaRes) { + return { + _raw: input, + sourceId: guid(), + sourceDefId: metaRes.sourceDefId, + meta: metaRes.meta, + publicId: refined.id || '', + isFetching: false, + latestFetchId: '', + fetchRange: null, + }; + } + } + return null; + } + function buildResourceSourceMeta(refined) { + let defs = getResourceSourceDefs(); + for (let i = defs.length - 1; i >= 0; i -= 1) { // later-added plugins take precedence + let def = defs[i]; + let meta = def.parseMeta(refined); + if (meta) { + return { meta, sourceDefId: i }; + } + } + return null; + } + function warnUnknownProps(props) { + for (let propName in props) { + console.warn(`Unknown resource prop '${propName}'`); + } + } + + function reduceResourceSource(source, action, context) { + let { options, dateProfile } = context; + if (!source || !action) { + return createSource(options.initialResources || options.resources, dateProfile.activeRange, options.refetchResourcesOnNavigate, context); + } + switch (action.type) { + case 'RESET_RESOURCE_SOURCE': + return createSource(action.resourceSourceInput, dateProfile.activeRange, options.refetchResourcesOnNavigate, context); + case 'PREV': // TODO: how do we track all actions that affect dateProfile :( + case 'NEXT': + case 'CHANGE_DATE': + case 'CHANGE_VIEW_TYPE': + return handleRangeChange(source, dateProfile.activeRange, options.refetchResourcesOnNavigate, context); + case 'RECEIVE_RESOURCES': + case 'RECEIVE_RESOURCE_ERROR': + return receiveResponse(source, action.fetchId, action.fetchRange); + case 'REFETCH_RESOURCES': + return fetchSource(source, dateProfile.activeRange, context); + default: + return source; + } + } + function createSource(input, activeRange, refetchResourcesOnNavigate, context) { + if (input) { + let source = parseResourceSource(input); + source = fetchSource(source, refetchResourcesOnNavigate ? activeRange : null, context); + return source; + } + return null; + } + function handleRangeChange(source, activeRange, refetchResourcesOnNavigate, context) { + if (refetchResourcesOnNavigate && + !doesSourceIgnoreRange(source) && + (!source.fetchRange || !rangesEqual(source.fetchRange, activeRange))) { + return fetchSource(source, activeRange, context); + } + return source; + } + function doesSourceIgnoreRange(source) { + return Boolean(getResourceSourceDef(source.sourceDefId).ignoreRange); + } + function fetchSource(source, fetchRange, context) { + let sourceDef = getResourceSourceDef(source.sourceDefId); + let fetchId = guid(); + sourceDef.fetch({ + resourceSource: source, + range: fetchRange, + context, + }, (res) => { + context.dispatch({ + type: 'RECEIVE_RESOURCES', + fetchId, + fetchRange, + rawResources: res.rawResources, + }); + }, (error) => { + context.dispatch({ + type: 'RECEIVE_RESOURCE_ERROR', + fetchId, + fetchRange, + error, + }); + }); + return Object.assign(Object.assign({}, source), { isFetching: true, latestFetchId: fetchId }); + } + function receiveResponse(source, fetchId, fetchRange) { + if (fetchId === source.latestFetchId) { + return Object.assign(Object.assign({}, source), { isFetching: false, fetchRange }); + } + return source; + } + + function reduceResourceStore(store, action, source, context) { + if (!store || !action) { + return {}; + } + switch (action.type) { + case 'RECEIVE_RESOURCES': + return receiveRawResources(store, action.rawResources, action.fetchId, source, context); + case 'ADD_RESOURCE': + return addResource(store, action.resourceHash); + case 'REMOVE_RESOURCE': + return removeResource(store, action.resourceId); + case 'SET_RESOURCE_PROP': + return setResourceProp(store, action.resourceId, action.propName, action.propValue); + case 'SET_RESOURCE_EXTENDED_PROP': + return setResourceExtendedProp(store, action.resourceId, action.propName, action.propValue); + default: + return store; + } + } + function receiveRawResources(existingStore, inputs, fetchId, source, context) { + if (source.latestFetchId === fetchId) { + let nextStore = {}; + for (let input of inputs) { + parseResource(input, '', nextStore, context); + } + return nextStore; + } + return existingStore; + } + function addResource(existingStore, additions) { + // TODO: warn about duplicate IDs + return Object.assign(Object.assign({}, existingStore), additions); + } + function removeResource(existingStore, resourceId) { + let newStore = Object.assign({}, existingStore); + delete newStore[resourceId]; + // promote children + for (let childResourceId in newStore) { // a child, *maybe* but probably not + if (newStore[childResourceId].parentId === resourceId) { + newStore[childResourceId] = Object.assign(Object.assign({}, newStore[childResourceId]), { parentId: '' }); + } + } + return newStore; + } + function setResourceProp(existingStore, resourceId, name, value) { + let existingResource = existingStore[resourceId]; + // TODO: sanitization + if (existingResource) { + return Object.assign(Object.assign({}, existingStore), { [resourceId]: Object.assign(Object.assign({}, existingResource), { [name]: value }) }); + } + return existingStore; + } + function setResourceExtendedProp(existingStore, resourceId, name, value) { + let existingResource = existingStore[resourceId]; + if (existingResource) { + return Object.assign(Object.assign({}, existingStore), { [resourceId]: Object.assign(Object.assign({}, existingResource), { extendedProps: Object.assign(Object.assign({}, existingResource.extendedProps), { [name]: value }) }) }); + } + return existingStore; + } + + function reduceResourceEntityExpansions(expansions, action) { + if (!expansions || !action) { + return {}; + } + switch (action.type) { + case 'SET_RESOURCE_ENTITY_EXPANDED': + return Object.assign(Object.assign({}, expansions), { [action.id]: action.isExpanded }); + default: + return expansions; + } + } + + function reduceResources(state, action, context) { + let resourceSource = reduceResourceSource(state && state.resourceSource, action, context); + let resourceStore = reduceResourceStore(state && state.resourceStore, action, resourceSource, context); + let resourceEntityExpansions = reduceResourceEntityExpansions(state && state.resourceEntityExpansions, action); + return { + resourceSource, + resourceStore, + resourceEntityExpansions, + }; + } + + const EVENT_REFINERS = { + resourceId: String, + resourceIds: identity, + resourceEditable: Boolean, + }; + function generateEventDefResourceMembers(refined) { + return { + resourceIds: ensureStringArray(refined.resourceIds) + .concat(refined.resourceId ? [refined.resourceId] : []), + resourceEditable: refined.resourceEditable, + }; + } + function ensureStringArray(items) { + return (items || []).map((item) => String(item)); + } + + function transformDateSelectionJoin(hit0, hit1) { + let resourceId0 = hit0.dateSpan.resourceId; + let resourceId1 = hit1.dateSpan.resourceId; + if (resourceId0 && resourceId1) { + return { resourceId: resourceId0 }; + } + return null; + } + + CalendarImpl.prototype.addResource = function (input, scrollTo = true) { + let currentState = this.getCurrentData(); + let resourceHash; + let resource; + if (input instanceof ResourceApi) { + resource = input._resource; + resourceHash = { [resource.id]: resource }; + } + else { + resourceHash = {}; + resource = parseResource(input, '', resourceHash, currentState); + } + this.dispatch({ + type: 'ADD_RESOURCE', + resourceHash, + }); + if (scrollTo) { + // TODO: wait til dispatch completes somehow + this.trigger('_scrollRequest', { resourceId: resource.id }); + } + let resourceApi = new ResourceApi(currentState, resource); + currentState.emitter.trigger('resourceAdd', { + resource: resourceApi, + revert: () => { + this.dispatch({ + type: 'REMOVE_RESOURCE', + resourceId: resource.id, + }); + }, + }); + return resourceApi; + }; + CalendarImpl.prototype.getResourceById = function (id) { + id = String(id); + let currentState = this.getCurrentData(); // eslint-disable-line react/no-this-in-sfc + if (currentState.resourceStore) { // guard against calendar with no resource functionality + let rawResource = currentState.resourceStore[id]; + if (rawResource) { + return new ResourceApi(currentState, rawResource); + } + } + return null; + }; + CalendarImpl.prototype.getResources = function () { + let currentState = this.getCurrentData(); + let { resourceStore } = currentState; + let resourceApis = []; + if (resourceStore) { // guard against calendar with no resource functionality + for (let resourceId in resourceStore) { + resourceApis.push(new ResourceApi(currentState, resourceStore[resourceId])); + } + } + return resourceApis; + }; + CalendarImpl.prototype.getTopLevelResources = function () { + let currentState = this.getCurrentData(); + let { resourceStore } = currentState; + let resourceApis = []; + if (resourceStore) { // guard against calendar with no resource functionality + for (let resourceId in resourceStore) { + if (!resourceStore[resourceId].parentId) { + resourceApis.push(new ResourceApi(currentState, resourceStore[resourceId])); + } + } + } + return resourceApis; + }; + CalendarImpl.prototype.refetchResources = function () { + this.dispatch({ + type: 'REFETCH_RESOURCES', + }); + }; + function transformDatePoint(dateSpan, context) { + return dateSpan.resourceId ? + { resource: context.calendarApi.getResourceById(dateSpan.resourceId) } : + {}; + } + function transformDateSpan(dateSpan, context) { + return dateSpan.resourceId ? + { resource: context.calendarApi.getResourceById(dateSpan.resourceId) } : + {}; + } + + function isPropsValidWithResources(combinedProps, context) { + let splitter = new ResourceSplitter(); + let sets = splitter.splitProps(Object.assign(Object.assign({}, combinedProps), { resourceStore: context.getCurrentData().resourceStore })); + for (let resourceId in sets) { + let props = sets[resourceId]; + // merge in event data from the non-resource segment + if (resourceId && sets['']) { // current segment is not the non-resource one, and there IS a non-resource one + props = Object.assign(Object.assign({}, props), { eventStore: mergeEventStores(sets[''].eventStore, props.eventStore), eventUiBases: Object.assign(Object.assign({}, sets[''].eventUiBases), props.eventUiBases) }); + } + if (!isPropsValid(props, context, { resourceId }, filterConfig.bind(null, resourceId))) { + return false; + } + } + return true; + } + function filterConfig(resourceId, config) { + return Object.assign(Object.assign({}, config), { constraints: filterConstraints(resourceId, config.constraints) }); + } + function filterConstraints(resourceId, constraints) { + return constraints.map((constraint) => { + let defs = constraint.defs; + if (defs) { // we are dealing with an EventStore + // if any of the events define constraints to resources that are NOT this resource, + // then this resource is unconditionally prohibited, which is what a `false` value does. + for (let defId in defs) { + let resourceIds = defs[defId].resourceIds; + if (resourceIds.length && resourceIds.indexOf(resourceId) === -1) { // TODO: use a hash?!!! (for other reasons too) + return false; + } + } + } + return constraint; + }); + } + + function transformExternalDef(dateSpan) { + return dateSpan.resourceId ? + { resourceId: dateSpan.resourceId } : + {}; + } + + const optionChangeHandlers = { + resources: handleResources, + }; + function handleResources(newSourceInput, context) { + let oldSourceInput = context.getCurrentData().resourceSource._raw; + if (oldSourceInput !== newSourceInput) { + context.dispatch({ + type: 'RESET_RESOURCE_SOURCE', + resourceSourceInput: newSourceInput, + }); + } + } + + const OPTION_REFINERS = { + initialResources: identity, + resources: identity, + eventResourceEditable: Boolean, + refetchResourcesOnNavigate: Boolean, + resourceOrder: parseFieldSpecs, + filterResourcesWithEvents: Boolean, + resourceGroupField: String, + resourceAreaWidth: identity, + resourceAreaColumns: identity, + resourcesInitiallyExpanded: Boolean, + datesAboveResources: Boolean, + needsResourceData: Boolean, + resourceAreaHeaderClassNames: identity, + resourceAreaHeaderContent: identity, + resourceAreaHeaderDidMount: identity, + resourceAreaHeaderWillUnmount: identity, + resourceGroupLabelClassNames: identity, + resourceGroupLabelContent: identity, + resourceGroupLabelDidMount: identity, + resourceGroupLabelWillUnmount: identity, + resourceLabelClassNames: identity, + resourceLabelContent: identity, + resourceLabelDidMount: identity, + resourceLabelWillUnmount: identity, + resourceLaneClassNames: identity, + resourceLaneContent: identity, + resourceLaneDidMount: identity, + resourceLaneWillUnmount: identity, + resourceGroupLaneClassNames: identity, + resourceGroupLaneContent: identity, + resourceGroupLaneDidMount: identity, + resourceGroupLaneWillUnmount: identity, + }; + const LISTENER_REFINERS = { + resourcesSet: identity, + resourceAdd: identity, + resourceChange: identity, + resourceRemove: identity, + }; + + EventImpl.prototype.getResources = function () { + let { calendarApi } = this._context; + return this._def.resourceIds.map((resourceId) => calendarApi.getResourceById(resourceId)); + }; + EventImpl.prototype.setResources = function (resources) { + let resourceIds = []; + // massage resources -> resourceIds + for (let resource of resources) { + let resourceId = null; + if (typeof resource === 'string') { + resourceId = resource; + } + else if (typeof resource === 'number') { + resourceId = String(resource); + } + else if (resource instanceof ResourceApi) { + resourceId = resource.id; // guaranteed to always have an ID. hmmm + } + else { + console.warn('unknown resource type: ' + resource); + } + if (resourceId) { + resourceIds.push(resourceId); + } + } + this.mutate({ + standardProps: { + resourceIds, + }, + }); + }; + + registerResourceSourceDef({ + ignoreRange: true, + parseMeta(refined) { + if (Array.isArray(refined.resources)) { + return refined.resources; + } + return null; + }, + fetch(arg, successCallback) { + successCallback({ + rawResources: arg.resourceSource.meta, + }); + }, + }); + + registerResourceSourceDef({ + parseMeta(refined) { + if (typeof refined.resources === 'function') { + return refined.resources; + } + return null; + }, + fetch(arg, successCallback, errorCallback) { + const dateEnv = arg.context.dateEnv; + const func = arg.resourceSource.meta; + const publicArg = arg.range ? { + start: dateEnv.toDate(arg.range.start), + end: dateEnv.toDate(arg.range.end), + startStr: dateEnv.formatIso(arg.range.start), + endStr: dateEnv.formatIso(arg.range.end), + timeZone: dateEnv.timeZone, + } : {}; + unpromisify(func.bind(null, publicArg), (rawResources) => successCallback({ rawResources }), errorCallback); + }, + }); + + registerResourceSourceDef({ + parseMeta(refined) { + if (refined.url) { + return { + url: refined.url, + method: (refined.method || 'GET').toUpperCase(), + extraParams: refined.extraParams, + }; + } + return null; + }, + fetch(arg, successCallback, errorCallback) { + const meta = arg.resourceSource.meta; + const requestParams = buildRequestParams(meta, arg.range, arg.context); + requestJson(meta.method, meta.url, requestParams).then(([rawResources, response]) => { + successCallback({ rawResources, response }); + }, errorCallback); + }, + }); + // TODO: somehow consolidate with event json feed + function buildRequestParams(meta, range, context) { + let { dateEnv, options } = context; + let startParam; + let endParam; + let timeZoneParam; + let customRequestParams; + let params = {}; + if (range) { + startParam = meta.startParam; + if (startParam == null) { + startParam = options.startParam; + } + endParam = meta.endParam; + if (endParam == null) { + endParam = options.endParam; + } + timeZoneParam = meta.timeZoneParam; + if (timeZoneParam == null) { + timeZoneParam = options.timeZoneParam; + } + params[startParam] = dateEnv.formatIso(range.start); + params[endParam] = dateEnv.formatIso(range.end); + if (dateEnv.timeZone !== 'local') { + params[timeZoneParam] = dateEnv.timeZone; + } + } + // retrieve any outbound GET/POST data from the options + if (typeof meta.extraParams === 'function') { + // supplied as a function that returns a key/value object + customRequestParams = meta.extraParams(); + } + else { + // probably supplied as a straight key/value object + customRequestParams = meta.extraParams || {}; + } + Object.assign(params, customRequestParams); + return params; + } + + var index$3 = createPlugin({ + name: '@fullcalendar/resource', + premiumReleaseDate: '2022-12-27', + deps: [index$7], + reducers: [reduceResources], + isLoadingFuncs: [ + (state) => state.resourceSource && state.resourceSource.isFetching, + ], + eventRefiners: EVENT_REFINERS, + eventDefMemberAdders: [generateEventDefResourceMembers], + isDraggableTransformers: [transformIsDraggable], + eventDragMutationMassagers: [massageEventDragMutation], + eventDefMutationAppliers: [applyEventDefMutation], + dateSelectionTransformers: [transformDateSelectionJoin], + datePointTransforms: [transformDatePoint], + dateSpanTransforms: [transformDateSpan], + viewPropsTransformers: [ResourceDataAdder, ResourceEventConfigAdder], + isPropsValid: isPropsValidWithResources, + externalDefTransforms: [transformExternalDef], + eventDropTransformers: [transformEventDrop], + optionChangeHandlers, + optionRefiners: OPTION_REFINERS, + listenerRefiners: LISTENER_REFINERS, + propSetHandlers: { resourceStore: handleResourceStore }, + }); + + class ResourceDayTableJoiner extends VResourceJoiner { + transformSeg(seg, resourceDayTableModel, resourceI) { + let colRanges = resourceDayTableModel.computeColRanges(seg.firstCol, seg.lastCol, resourceI); + return colRanges.map((colRange) => (Object.assign(Object.assign(Object.assign({}, seg), colRange), { isStart: seg.isStart && colRange.isStart, isEnd: seg.isEnd && colRange.isEnd }))); + } + } + + class ResourceDayTable extends DateComponent { + constructor() { + super(...arguments); + this.splitter = new VResourceSplitter(); + this.slicers = {}; + this.joiner = new ResourceDayTableJoiner(); + this.tableRef = y(); + this.isHitComboAllowed = (hit0, hit1) => { + let allowAcrossResources = this.props.resourceDayTableModel.dayTableModel.colCnt === 1; + return allowAcrossResources || hit0.dateSpan.resourceId === hit1.dateSpan.resourceId; + }; + } + render() { + let { props, context } = this; + let { resourceDayTableModel, nextDayThreshold, dateProfile } = props; + let splitProps = this.splitter.splitProps(props); + this.slicers = mapHash(splitProps, (split, resourceId) => this.slicers[resourceId] || new DayTableSlicer()); + let slicedProps = mapHash(this.slicers, (slicer, resourceId) => slicer.sliceProps(splitProps[resourceId], dateProfile, nextDayThreshold, context, resourceDayTableModel.dayTableModel)); + return (h(Table, Object.assign({ forPrint: props.forPrint, ref: this.tableRef }, this.joiner.joinProps(slicedProps, resourceDayTableModel), { cells: resourceDayTableModel.cells, dateProfile: dateProfile, colGroupNode: props.colGroupNode, tableMinWidth: props.tableMinWidth, renderRowIntro: props.renderRowIntro, dayMaxEvents: props.dayMaxEvents, dayMaxEventRows: props.dayMaxEventRows, showWeekNumbers: props.showWeekNumbers, expandRows: props.expandRows, headerAlignElRef: props.headerAlignElRef, clientWidth: props.clientWidth, clientHeight: props.clientHeight, isHitComboAllowed: this.isHitComboAllowed }))); + } + } + + class ResourceDayTableView extends TableView { + constructor() { + super(...arguments); + this.flattenResources = memoize(flattenResources); + this.buildResourceDayTableModel = memoize(buildResourceDayTableModel); + this.headerRef = y(); + this.tableRef = y(); + } + render() { + let { props, context } = this; + let { options } = context; + let resourceOrderSpecs = options.resourceOrder || DEFAULT_RESOURCE_ORDER; + let resources = this.flattenResources(props.resourceStore, resourceOrderSpecs); + let resourceDayTableModel = this.buildResourceDayTableModel(props.dateProfile, context.dateProfileGenerator, resources, options.datesAboveResources, context); + let headerContent = options.dayHeaders && (h(ResourceDayHeader, { ref: this.headerRef, resources: resources, dateProfile: props.dateProfile, dates: resourceDayTableModel.dayTableModel.headerDates, datesRepDistinctDays: true })); + let bodyContent = (contentArg) => (h(ResourceDayTable, { ref: this.tableRef, dateProfile: props.dateProfile, resourceDayTableModel: resourceDayTableModel, businessHours: props.businessHours, eventStore: props.eventStore, eventUiBases: props.eventUiBases, dateSelection: props.dateSelection, eventSelection: props.eventSelection, eventDrag: props.eventDrag, eventResize: props.eventResize, nextDayThreshold: options.nextDayThreshold, tableMinWidth: contentArg.tableMinWidth, colGroupNode: contentArg.tableColGroupNode, dayMaxEvents: options.dayMaxEvents, dayMaxEventRows: options.dayMaxEventRows, showWeekNumbers: options.weekNumbers, expandRows: !props.isHeightAuto, headerAlignElRef: this.headerElRef, clientWidth: contentArg.clientWidth, clientHeight: contentArg.clientHeight, forPrint: props.forPrint })); + return options.dayMinWidth + ? this.renderHScrollLayout(headerContent, bodyContent, resourceDayTableModel.colCnt, options.dayMinWidth) + : this.renderSimpleLayout(headerContent, bodyContent); + } + } + function buildResourceDayTableModel(dateProfile, dateProfileGenerator, resources, datesAboveResources, context) { + let dayTable = buildDayTableModel(dateProfile, dateProfileGenerator); + return datesAboveResources ? + new DayResourceTableModel(dayTable, resources, context) : + new ResourceDayTableModel(dayTable, resources, context); + } + + var index$2 = createPlugin({ + name: '@fullcalendar/resource-daygrid', + premiumReleaseDate: '2022-12-27', + deps: [ + index$7, + index$3, + index$a, + ], + initialView: 'resourceDayGridDay', + views: { + resourceDayGrid: { + type: 'dayGrid', + component: ResourceDayTableView, + needsResourceData: true, + }, + resourceDayGridDay: { + type: 'resourceDayGrid', + duration: { days: 1 }, + }, + resourceDayGridWeek: { + type: 'resourceDayGrid', + duration: { weeks: 1 }, + }, + resourceDayGridMonth: { + type: 'resourceDayGrid', + duration: { months: 1 }, + // TODO: wish we didn't have to C&P from dayGrid's file + monthMode: true, + fixedWeekCount: true, + }, + }, + }); + + class ResourceDayTimeColsJoiner extends VResourceJoiner { + transformSeg(seg, resourceDayTable, resourceI) { + return [ + Object.assign(Object.assign({}, seg), { col: resourceDayTable.computeCol(seg.col, resourceI) }), + ]; + } + } + + class ResourceDayTimeCols extends DateComponent { + constructor() { + super(...arguments); + this.buildDayRanges = memoize(buildDayRanges); + this.splitter = new VResourceSplitter(); + this.slicers = {}; + this.joiner = new ResourceDayTimeColsJoiner(); + this.timeColsRef = y(); + this.isHitComboAllowed = (hit0, hit1) => { + let allowAcrossResources = this.dayRanges.length === 1; + return allowAcrossResources || hit0.dateSpan.resourceId === hit1.dateSpan.resourceId; + }; + } + render() { + let { props, context } = this; + let { dateEnv, options } = context; + let { dateProfile, resourceDayTableModel } = props; + let dayRanges = this.dayRanges = this.buildDayRanges(resourceDayTableModel.dayTableModel, dateProfile, dateEnv); + let splitProps = this.splitter.splitProps(props); + this.slicers = mapHash(splitProps, (split, resourceId) => this.slicers[resourceId] || new DayTimeColsSlicer()); + let slicedProps = mapHash(this.slicers, (slicer, resourceId) => slicer.sliceProps(splitProps[resourceId], dateProfile, null, context, dayRanges)); + return ( // TODO: would move this further down hierarchy, but sliceNowDate needs it + h(NowTimer, { unit: options.nowIndicator ? 'minute' : 'day' }, (nowDate, todayRange) => (h(TimeCols, Object.assign({ ref: this.timeColsRef }, this.joiner.joinProps(slicedProps, resourceDayTableModel), { dateProfile: dateProfile, axis: props.axis, slotDuration: props.slotDuration, slatMetas: props.slatMetas, cells: resourceDayTableModel.cells[0], tableColGroupNode: props.tableColGroupNode, tableMinWidth: props.tableMinWidth, clientWidth: props.clientWidth, clientHeight: props.clientHeight, expandRows: props.expandRows, nowDate: nowDate, nowIndicatorSegs: options.nowIndicator && this.buildNowIndicatorSegs(nowDate), todayRange: todayRange, onScrollTopRequest: props.onScrollTopRequest, forPrint: props.forPrint, onSlatCoords: props.onSlatCoords, isHitComboAllowed: this.isHitComboAllowed }))))); + } + buildNowIndicatorSegs(date) { + let nonResourceSegs = this.slicers[''].sliceNowDate(date, this.context, this.dayRanges); + return this.joiner.expandSegs(this.props.resourceDayTableModel, nonResourceSegs); + } + } + + class ResourceDayTimeColsView extends TimeColsView { + constructor() { + super(...arguments); + this.flattenResources = memoize(flattenResources); + this.buildResourceTimeColsModel = memoize(buildResourceTimeColsModel); + this.buildSlatMetas = memoize(buildSlatMetas); + } + render() { + let { props, context } = this; + let { options, dateEnv } = context; + let { dateProfile } = props; + let splitProps = this.allDaySplitter.splitProps(props); + let resourceOrderSpecs = options.resourceOrder || DEFAULT_RESOURCE_ORDER; + let resources = this.flattenResources(props.resourceStore, resourceOrderSpecs); + let resourceDayTableModel = this.buildResourceTimeColsModel(dateProfile, context.dateProfileGenerator, resources, options.datesAboveResources, context); + let slatMetas = this.buildSlatMetas(dateProfile.slotMinTime, dateProfile.slotMaxTime, options.slotLabelInterval, options.slotDuration, dateEnv); + let { dayMinWidth } = options; + let hasAttachedAxis = !dayMinWidth; + let hasDetachedAxis = dayMinWidth; + let headerContent = options.dayHeaders && (h(ResourceDayHeader, { resources: resources, dates: resourceDayTableModel.dayTableModel.headerDates, dateProfile: dateProfile, datesRepDistinctDays: true, renderIntro: hasAttachedAxis ? this.renderHeadAxis : null })); + let allDayContent = (options.allDaySlot !== false) && ((contentArg) => (h(ResourceDayTable, Object.assign({}, splitProps.allDay, { dateProfile: dateProfile, resourceDayTableModel: resourceDayTableModel, nextDayThreshold: options.nextDayThreshold, tableMinWidth: contentArg.tableMinWidth, colGroupNode: contentArg.tableColGroupNode, renderRowIntro: hasAttachedAxis ? this.renderTableRowAxis : null, showWeekNumbers: false, expandRows: false, headerAlignElRef: this.headerElRef, clientWidth: contentArg.clientWidth, clientHeight: contentArg.clientHeight, forPrint: props.forPrint }, this.getAllDayMaxEventProps())))); + let timeGridContent = (contentArg) => (h(ResourceDayTimeCols, Object.assign({}, splitProps.timed, { dateProfile: dateProfile, axis: hasAttachedAxis, slotDuration: options.slotDuration, slatMetas: slatMetas, resourceDayTableModel: resourceDayTableModel, tableColGroupNode: contentArg.tableColGroupNode, tableMinWidth: contentArg.tableMinWidth, clientWidth: contentArg.clientWidth, clientHeight: contentArg.clientHeight, onSlatCoords: this.handleSlatCoords, expandRows: contentArg.expandRows, forPrint: props.forPrint, onScrollTopRequest: this.handleScrollTopRequest }))); + return hasDetachedAxis + ? this.renderHScrollLayout(headerContent, allDayContent, timeGridContent, resourceDayTableModel.colCnt, dayMinWidth, slatMetas, this.state.slatCoords) + : this.renderSimpleLayout(headerContent, allDayContent, timeGridContent); + } + } + function buildResourceTimeColsModel(dateProfile, dateProfileGenerator, resources, datesAboveResources, context) { + let dayTable = buildTimeColsModel(dateProfile, dateProfileGenerator); + return datesAboveResources ? + new DayResourceTableModel(dayTable, resources, context) : + new ResourceDayTableModel(dayTable, resources, context); + } + + var index$1 = createPlugin({ + name: '@fullcalendar/resource-timegrid', + premiumReleaseDate: '2022-12-27', + deps: [ + index$7, + index$3, + index$9, + ], + initialView: 'resourceTimeGridDay', + views: { + resourceTimeGrid: { + type: 'timeGrid', + component: ResourceDayTimeColsView, + needsResourceData: true, + }, + resourceTimeGridDay: { + type: 'resourceTimeGrid', + duration: { days: 1 }, + }, + resourceTimeGridWeek: { + type: 'resourceTimeGrid', + duration: { weeks: 1 }, + }, + }, + }); + + /* + Renders the DOM responsible for the subrow expander area, + as well as the space before it (used to align expanders of similar depths) + */ + function ExpanderIcon({ depth, hasChildren, isExpanded, onExpanderClick }) { + let nodes = []; + for (let i = 0; i < depth; i += 1) { + nodes.push(h("span", { className: "fc-icon" })); + } + let iconClassNames = ['fc-icon']; + if (hasChildren) { + if (isExpanded) { + iconClassNames.push('fc-icon-minus-square'); + } + else { + iconClassNames.push('fc-icon-plus-square'); + } + } + nodes.push(h("span", { className: 'fc-datagrid-expander' + (hasChildren ? '' : ' fc-datagrid-expander-placeholder'), onClick: onExpanderClick }, + h("span", { className: iconClassNames.join(' ') }))); + return h(p, {}, ...nodes); + } + + // worth making a PureComponent? (because of innerHeight) + class SpreadsheetIndividualCell extends BaseComponent { + constructor() { + super(...arguments); + this.refineRenderProps = memoizeObjArg(refineRenderProps); + this.onExpanderClick = (ev) => { + let { props } = this; + if (props.hasChildren) { + this.context.dispatch({ + type: 'SET_RESOURCE_ENTITY_EXPANDED', + id: props.resource.id, + isExpanded: !props.isExpanded, + }); + } + }; + } + render() { + let { props, context } = this; + let { colSpec } = props; + let renderProps = this.refineRenderProps({ + resource: props.resource, + fieldValue: props.fieldValue, + context, + }); + return (h(ContentContainer, { elTag: "td", elClasses: [ + 'fc-datagrid-cell', + 'fc-resource', + ], elAttrs: { + role: 'gridcell', + 'data-resource-id': props.resource.id, + }, renderProps: renderProps, generatorName: colSpec.isMain ? 'resourceLabelContent' : undefined, generator: colSpec.cellContent || renderResourceInner, classNameGenerator: colSpec.cellClassNames, didMount: colSpec.cellDidMount, willUnmount: colSpec.cellWillUnmount }, (InnerContent) => (h("div", { className: "fc-datagrid-cell-frame", style: { height: props.innerHeight } }, + h("div", { className: "fc-datagrid-cell-cushion fc-scrollgrid-sync-inner" }, + colSpec.isMain && (h(ExpanderIcon, { depth: props.depth, hasChildren: props.hasChildren, isExpanded: props.isExpanded, onExpanderClick: this.onExpanderClick })), + h(InnerContent, { elTag: "span", elClasses: ['fc-datagrid-cell-main'] })))))); + } + } + function renderResourceInner(renderProps) { + return renderProps.fieldValue || h(p, null, "\u00A0"); + } + function refineRenderProps(input) { + return { + resource: new ResourceApi(input.context, input.resource), + fieldValue: input.fieldValue, + view: input.context.viewApi, + }; + } + + // for VERTICAL cell grouping, in spreadsheet area + class SpreadsheetGroupCell extends BaseComponent { + render() { + let { props, context } = this; + let { colSpec } = props; + let renderProps = { + groupValue: props.fieldValue, + view: context.viewApi, + }; + // a grouped cell. no data that is specific to this specific resource + // `colSpec` is for the group. a GroupSpec :( + return (h(ContentContainer, { elTag: "td", elClasses: [ + 'fc-datagrid-cell', + 'fc-resource-group', + ], elAttrs: { + role: 'gridcell', + rowSpan: props.rowSpan, + }, renderProps: renderProps, generatorName: "resourceGroupLabelContent", generator: colSpec.cellContent || renderGroupInner, classNameGenerator: colSpec.cellClassNames, didMount: colSpec.cellDidMount, willUnmount: colSpec.cellWillUnmount }, (InnerContent) => (h("div", { className: "fc-datagrid-cell-frame fc-datagrid-cell-frame-liquid" }, + h(InnerContent, { elTag: "div", elClasses: ['fc-datagrid-cell-cushion', 'fc-sticky'] }))))); + } + } + function renderGroupInner(renderProps) { + return renderProps.groupValue || h(p, null, "\u00A0"); + } + + class SpreadsheetRow extends BaseComponent { + render() { + let { props } = this; + let { resource, rowSpans, depth } = props; + let resourceFields = buildResourceFields(resource); // slightly inefficient. already done up the call stack + return (h("tr", { role: "row" }, props.colSpecs.map((colSpec, i) => { + let rowSpan = rowSpans[i]; + if (rowSpan === 0) { // not responsible for group-based rows. VRowGroup is + return null; + } + if (rowSpan == null) { + rowSpan = 1; + } + let fieldValue = colSpec.field ? resourceFields[colSpec.field] : + (resource.title || getPublicId(resource.id)); + if (rowSpan > 1) { + return (h(SpreadsheetGroupCell, { key: i, colSpec: colSpec, fieldValue: fieldValue, rowSpan: rowSpan })); + } + return (h(SpreadsheetIndividualCell, { key: i, colSpec: colSpec, resource: resource, fieldValue: fieldValue, depth: depth, hasChildren: props.hasChildren, isExpanded: props.isExpanded, innerHeight: props.innerHeight })); + }))); + } + } + SpreadsheetRow.addPropsEquality({ + rowSpans: isArraysEqual, + }); + + // for HORIZONTAL cell grouping, in spreadsheet area + class SpreadsheetGroupRow extends BaseComponent { + constructor() { + super(...arguments); + this.innerInnerRef = y(); + this.onExpanderClick = () => { + let { props } = this; + this.context.dispatch({ + type: 'SET_RESOURCE_ENTITY_EXPANDED', + id: props.id, + isExpanded: !props.isExpanded, + }); + }; + } + render() { + let { props, context } = this; + let renderProps = { groupValue: props.group.value, view: context.viewApi }; + let spec = props.group.spec; + return (h("tr", { role: "row" }, + h(ContentContainer, { elTag: "th", elClasses: [ + 'fc-datagrid-cell', + 'fc-resource-group', + context.theme.getClass('tableCellShaded'), + ], elAttrs: { + // ARIA TODO: not really a columnheader + // extremely tedious to make this aria-compliant, + // to assign multiple headers to each cell + // https://www.w3.org/WAI/tutorials/tables/multi-level/ + role: 'columnheader', + scope: 'colgroup', + colSpan: props.spreadsheetColCnt, + }, renderProps: renderProps, generatorName: "resourceGroupLabelContent", generator: spec.labelContent || renderCellInner, classNameGenerator: spec.labelClassNames, didMount: spec.labelDidMount, willUnmount: spec.labelWillUnmount }, (InnerContent) => (h("div", { className: "fc-datagrid-cell-frame", style: { height: props.innerHeight } }, + h("div", { className: "fc-datagrid-cell-cushion fc-scrollgrid-sync-inner", ref: this.innerInnerRef }, + h(ExpanderIcon, { depth: 0, hasChildren: true, isExpanded: props.isExpanded, onExpanderClick: this.onExpanderClick }), + h(InnerContent, { elTag: "span", elClasses: ['fc-datagrid-cell-main'] }))))))); + } + } + SpreadsheetGroupRow.addPropsEquality({ + group: isGroupsEqual, + }); + function renderCellInner(renderProps) { + return renderProps.groupValue || h(p, null, "\u00A0"); + } + + const SPREADSHEET_COL_MIN_WIDTH = 20; + class SpreadsheetHeader extends BaseComponent { + constructor() { + super(...arguments); + this.resizerElRefs = new RefMap(this._handleColResizerEl.bind(this)); + this.colDraggings = {}; + } + render() { + let { colSpecs, superHeaderRendering, rowInnerHeights } = this.props; + let renderProps = { view: this.context.viewApi }; + let rowNodes = []; + rowInnerHeights = rowInnerHeights.slice(); // copy, because we're gonna pop + if (superHeaderRendering) { + let rowInnerHeight = rowInnerHeights.shift(); + rowNodes.push(h("tr", { key: "row-super", role: "row" }, + h(ContentContainer, { elTag: "th", elClasses: [ + 'fc-datagrid-cell', + 'fc-datagrid-cell-super', + ], elAttrs: { + role: 'columnheader', + scope: 'colgroup', + colSpan: colSpecs.length, + }, renderProps: renderProps, generatorName: "resourceAreaHeaderContent", generator: superHeaderRendering.headerContent, classNameGenerator: superHeaderRendering.headerClassNames, didMount: superHeaderRendering.headerDidMount, willUnmount: superHeaderRendering.headerWillUnmount }, (InnerContent) => (h("div", { className: "fc-datagrid-cell-frame", style: { height: rowInnerHeight } }, + h(InnerContent, { elTag: "div", elClasses: ['fc-datagrid-cell-cushion', 'fc-scrollgrid-sync-inner'] })))))); + } + let rowInnerHeight = rowInnerHeights.shift(); + rowNodes.push(h("tr", { key: "row", role: "row" }, colSpecs.map((colSpec, i) => { + let isLastCol = i === (colSpecs.length - 1); + // need empty inner div for abs positioning for resizer + return (h(ContentContainer, { key: i, elTag: "th", elClasses: ['fc-datagrid-cell'], elAttrs: { role: 'columnheader' }, renderProps: renderProps, generatorName: "resourceAreaHeaderContent", generator: colSpec.headerContent, classNameGenerator: colSpec.headerClassNames, didMount: colSpec.headerDidMount, willUnmount: colSpec.headerWillUnmount }, (InnerContent) => (h("div", { className: "fc-datagrid-cell-frame", style: { height: rowInnerHeight } }, + h("div", { className: "fc-datagrid-cell-cushion fc-scrollgrid-sync-inner" }, + colSpec.isMain && (h("span", { className: "fc-datagrid-expander fc-datagrid-expander-placeholder" }, + h("span", { className: "fc-icon" }))), + h(InnerContent, { elTag: "span", elClasses: ['fc-datagrid-cell-main'] })), + !isLastCol && (h("div", { className: "fc-datagrid-cell-resizer", ref: this.resizerElRefs.createRef(i) })))))); + }))); + return (h(p, null, rowNodes)); + } + _handleColResizerEl(resizerEl, index) { + let { colDraggings } = this; + if (!resizerEl) { + let dragging = colDraggings[index]; + if (dragging) { + dragging.destroy(); + delete colDraggings[index]; + } + } + else { + let dragging = this.initColResizing(resizerEl, parseInt(index, 10)); + if (dragging) { + colDraggings[index] = dragging; + } + } + } + initColResizing(resizerEl, index) { + let { pluginHooks, isRtl } = this.context; + let { onColWidthChange } = this.props; + let ElementDraggingImpl = pluginHooks.elementDraggingImpl; + if (ElementDraggingImpl) { + let dragging = new ElementDraggingImpl(resizerEl); + let startWidth; // of just the single column + let currentWidths; // of all columns + dragging.emitter.on('dragstart', () => { + let allCells = findElements(elementClosest(resizerEl, 'tr'), 'th'); + currentWidths = allCells.map((cellEl) => (cellEl.getBoundingClientRect().width)); + startWidth = currentWidths[index]; + }); + dragging.emitter.on('dragmove', (pev) => { + currentWidths[index] = Math.max(startWidth + pev.deltaX * (isRtl ? -1 : 1), SPREADSHEET_COL_MIN_WIDTH); + if (onColWidthChange) { + onColWidthChange(currentWidths.slice()); // send a copy since currentWidths continues to be mutated + } + }); + dragging.setAutoScrollEnabled(false); // because gets weird with auto-scrolling time area + return dragging; + } + return null; + } + } + + class ResourceTimelineLane extends BaseComponent { + constructor() { + super(...arguments); + this.refineRenderProps = memoizeObjArg(refineRenderProps$1); + this.handleHeightChange = (innerEl, isStable) => { + if (this.props.onHeightChange) { + this.props.onHeightChange( + // would want to use own <tr> ref, but not guaranteed to be ready when this fires + elementClosest(innerEl, 'tr'), isStable); + } + }; + } + render() { + let { props, context } = this; + let { options } = context; + let renderProps = this.refineRenderProps({ resource: props.resource, context }); + return (h("tr", { ref: props.elRef }, + h(ContentContainer, { elTag: "td", elClasses: [ + 'fc-timeline-lane', + 'fc-resource', + ], elAttrs: { + 'data-resource-id': props.resource.id, + }, renderProps: renderProps, generatorName: "resourceLaneContent", generator: options.resourceLaneContent, classNameGenerator: options.resourceLaneClassNames, didMount: options.resourceLaneDidMount, willUnmount: options.resourceLaneWillUnmount }, (InnerContent) => (h("div", { className: "fc-timeline-lane-frame", style: { height: props.innerHeight } }, + h(InnerContent, { elTag: "div", elClasses: ['fc-timeline-lane-misc'] }), + h(TimelineLane, { dateProfile: props.dateProfile, tDateProfile: props.tDateProfile, nowDate: props.nowDate, todayRange: props.todayRange, nextDayThreshold: props.nextDayThreshold, businessHours: props.businessHours, eventStore: props.eventStore, eventUiBases: props.eventUiBases, dateSelection: props.dateSelection, eventSelection: props.eventSelection, eventDrag: props.eventDrag, eventResize: props.eventResize, timelineCoords: props.timelineCoords, onHeightChange: this.handleHeightChange, resourceId: props.resource.id })))))); // important NOT to do liquid-height. dont want to shrink height smaller than content + } + } + + /* + parallels the SpreadsheetGroupRow + */ + class DividerRow extends BaseComponent { + render() { + let { props, context } = this; + let { renderHooks } = props; + let renderProps = { + groupValue: props.groupValue, + view: context.viewApi, + }; + return (h("tr", { ref: props.elRef }, + h(ContentContainer, { elTag: "td", elRef: props.elRef, elClasses: [ + 'fc-timeline-lane', + 'fc-resource-group', + context.theme.getClass('tableCellShaded'), + ], renderProps: renderProps, generatorName: "resourceGroupLaneContent", generator: renderHooks.laneContent, classNameGenerator: renderHooks.laneClassNames, didMount: renderHooks.laneDidMount, willUnmount: renderHooks.laneWillUnmount }, (InnerContainer) => (h(InnerContainer, { elTag: "div", elStyle: { height: props.innerHeight } }))))); + } + } + + class ResourceTimelineLanesBody extends BaseComponent { + render() { + let { props, context } = this; + let { rowElRefs, innerHeights } = props; + return (h("tbody", null, props.rowNodes.map((node, index) => { + if (node.group) { + return (h(DividerRow, { key: node.id, elRef: rowElRefs.createRef(node.id), groupValue: node.group.value, renderHooks: node.group.spec, innerHeight: innerHeights[index] || '' })); + } + if (node.resource) { + let resource = node.resource; + return (h(ResourceTimelineLane, Object.assign({ key: node.id, elRef: rowElRefs.createRef(node.id) }, props.splitProps[resource.id], { resource: resource, dateProfile: props.dateProfile, tDateProfile: props.tDateProfile, nowDate: props.nowDate, todayRange: props.todayRange, nextDayThreshold: context.options.nextDayThreshold, businessHours: resource.businessHours || props.fallbackBusinessHours, innerHeight: innerHeights[index] || '', timelineCoords: props.slatCoords, onHeightChange: props.onRowHeightChange }))); + } + return null; + }))); + } + } + + class ResourceTimelineLanes extends BaseComponent { + constructor() { + super(...arguments); + this.rootElRef = y(); + this.rowElRefs = new RefMap(); + } + render() { + let { props, context } = this; + return (h("table", { ref: this.rootElRef, "aria-hidden": true, className: 'fc-scrollgrid-sync-table ' + context.theme.getClass('table'), style: { + minWidth: props.tableMinWidth, + width: props.clientWidth, + height: props.minHeight, + } }, + h(ResourceTimelineLanesBody, { rowElRefs: this.rowElRefs, rowNodes: props.rowNodes, dateProfile: props.dateProfile, tDateProfile: props.tDateProfile, nowDate: props.nowDate, todayRange: props.todayRange, splitProps: props.splitProps, fallbackBusinessHours: props.fallbackBusinessHours, slatCoords: props.slatCoords, innerHeights: props.innerHeights, onRowHeightChange: props.onRowHeightChange }))); + } + componentDidMount() { + this.updateCoords(); + } + componentDidUpdate() { + this.updateCoords(); + } + componentWillUnmount() { + if (this.props.onRowCoords) { + this.props.onRowCoords(null); + } + } + updateCoords() { + let { props } = this; + if (props.onRowCoords && props.clientWidth !== null) { // a populated clientWidth means sizing has stabilized + this.props.onRowCoords(new PositionCache(this.rootElRef.current, collectRowEls(this.rowElRefs.currentMap, props.rowNodes), false, true)); + } + } + } + function collectRowEls(elMap, rowNodes) { + return rowNodes.map((rowNode) => elMap[rowNode.id]); + } + + class ResourceTimelineGrid extends DateComponent { + constructor() { + super(...arguments); + this.computeHasResourceBusinessHours = memoize(computeHasResourceBusinessHours); + this.resourceSplitter = new ResourceSplitter(); // doesn't let it do businessHours tho + this.bgSlicer = new TimelineLaneSlicer(); + this.slatsRef = y(); // needed for Hit creation :( + this.state = { + slatCoords: null, + }; + this.handleEl = (el) => { + if (el) { + this.context.registerInteractiveComponent(this, { el }); + } + else { + this.context.unregisterInteractiveComponent(this); + } + }; + this.handleSlatCoords = (slatCoords) => { + this.setState({ slatCoords }); + if (this.props.onSlatCoords) { + this.props.onSlatCoords(slatCoords); + } + }; + this.handleRowCoords = (rowCoords) => { + this.rowCoords = rowCoords; + if (this.props.onRowCoords) { + this.props.onRowCoords(rowCoords); + } + }; + } + render() { + let { props, state, context } = this; + let { dateProfile, tDateProfile } = props; + let timerUnit = greatestDurationDenominator(tDateProfile.slotDuration).unit; + let hasResourceBusinessHours = this.computeHasResourceBusinessHours(props.rowNodes); + let splitProps = this.resourceSplitter.splitProps(props); + let bgLaneProps = splitProps['']; + let bgSlicedProps = this.bgSlicer.sliceProps(bgLaneProps, dateProfile, tDateProfile.isTimeScale ? null : props.nextDayThreshold, context, // wish we didn't need to pass in the rest of these args... + dateProfile, context.dateProfileGenerator, tDateProfile, context.dateEnv); + // WORKAROUND: make ignore slatCoords when out of sync with dateProfile + let slatCoords = state.slatCoords && state.slatCoords.dateProfile === props.dateProfile ? state.slatCoords : null; + return (h("div", { ref: this.handleEl, className: [ + 'fc-timeline-body', + props.expandRows ? 'fc-timeline-body-expandrows' : '', + ].join(' '), style: { minWidth: props.tableMinWidth } }, + h(NowTimer, { unit: timerUnit }, (nowDate, todayRange) => (h(p, null, + h(TimelineSlats, { ref: this.slatsRef, dateProfile: dateProfile, tDateProfile: tDateProfile, nowDate: nowDate, todayRange: todayRange, clientWidth: props.clientWidth, tableColGroupNode: props.tableColGroupNode, tableMinWidth: props.tableMinWidth, onCoords: this.handleSlatCoords, onScrollLeftRequest: props.onScrollLeftRequest }), + h(TimelineLaneBg, { businessHourSegs: hasResourceBusinessHours ? null : bgSlicedProps.businessHourSegs, bgEventSegs: bgSlicedProps.bgEventSegs, timelineCoords: slatCoords, + // empty array will result in unnecessary rerenders? + eventResizeSegs: (bgSlicedProps.eventResize ? bgSlicedProps.eventResize.segs : []), dateSelectionSegs: bgSlicedProps.dateSelectionSegs, nowDate: nowDate, todayRange: todayRange }), + h(ResourceTimelineLanes, { rowNodes: props.rowNodes, dateProfile: dateProfile, tDateProfile: props.tDateProfile, nowDate: nowDate, todayRange: todayRange, splitProps: splitProps, fallbackBusinessHours: hasResourceBusinessHours ? props.businessHours : null, clientWidth: props.clientWidth, minHeight: props.expandRows ? props.clientHeight : '', tableMinWidth: props.tableMinWidth, innerHeights: props.rowInnerHeights, slatCoords: slatCoords, onRowCoords: this.handleRowCoords, onRowHeightChange: props.onRowHeightChange }), + (context.options.nowIndicator && slatCoords && slatCoords.isDateInRange(nowDate)) && (h("div", { className: "fc-timeline-now-indicator-container" }, + h(NowIndicatorContainer, { elClasses: ['fc-timeline-now-indicator-line'], elStyle: coordToCss(slatCoords.dateToCoord(nowDate), context.isRtl), isAxis: false, date: nowDate })))))))); + } + // Hit System + // ------------------------------------------------------------------------------------------ + queryHit(positionLeft, positionTop) { + let rowCoords = this.rowCoords; + let rowIndex = rowCoords.topToIndex(positionTop); + if (rowIndex != null) { + let resource = this.props.rowNodes[rowIndex].resource; + if (resource) { // not a group + let slatHit = this.slatsRef.current.positionToHit(positionLeft); + if (slatHit) { + return { + dateProfile: this.props.dateProfile, + dateSpan: { + range: slatHit.dateSpan.range, + allDay: slatHit.dateSpan.allDay, + resourceId: resource.id, + }, + rect: { + left: slatHit.left, + right: slatHit.right, + top: rowCoords.tops[rowIndex], + bottom: rowCoords.bottoms[rowIndex], + }, + dayEl: slatHit.dayEl, + layer: 0, + }; + } + } + } + return null; + } + } + function computeHasResourceBusinessHours(rowNodes) { + for (let node of rowNodes) { + let resource = node.resource; + if (resource && resource.businessHours) { + return true; + } + } + return false; + } + + const MIN_RESOURCE_AREA_WIDTH = 30; // definitely bigger than scrollbars + // RENAME? + class ResourceTimelineViewLayout extends BaseComponent { + constructor() { + super(...arguments); + this.scrollGridRef = y(); + this.timeBodyScrollerElRef = y(); + this.spreadsheetHeaderChunkElRef = y(); + this.rootElRef = y(); + this.ensureScrollGridResizeId = 0; + this.state = { + resourceAreaWidthOverride: null, + }; + /* + ghetto debounce. don't race with ScrollGrid's resizing delay. solves #6140 + */ + this.ensureScrollGridResize = () => { + if (this.ensureScrollGridResizeId) { + clearTimeout(this.ensureScrollGridResizeId); + } + this.ensureScrollGridResizeId = setTimeout(() => { + this.scrollGridRef.current.handleSizing(false); + }, config.SCROLLGRID_RESIZE_INTERVAL + 1); + }; + } + render() { + let { props, state, context } = this; + let { options } = context; + let stickyHeaderDates = !props.forPrint && getStickyHeaderDates(options); + let stickyFooterScrollbar = !props.forPrint && getStickyFooterScrollbar(options); + let sections = [ + { + type: 'header', + key: 'header', + syncRowHeights: true, + isSticky: stickyHeaderDates, + chunks: [ + { + key: 'datagrid', + elRef: this.spreadsheetHeaderChunkElRef, + // TODO: allow the content to specify this. have general-purpose 'content' with obj with keys + tableClassName: 'fc-datagrid-header', + rowContent: props.spreadsheetHeaderRows, + }, + { + key: 'divider', + outerContent: (h("td", { role: "presentation", className: 'fc-resource-timeline-divider ' + context.theme.getClass('tableCellShaded') })), + }, + { + key: 'timeline', + content: props.timeHeaderContent, + }, + ], + }, + { + type: 'body', + key: 'body', + syncRowHeights: true, + liquid: true, + expandRows: Boolean(options.expandRows), + chunks: [ + { + key: 'datagrid', + tableClassName: 'fc-datagrid-body', + rowContent: props.spreadsheetBodyRows, + }, + { + key: 'divider', + outerContent: (h("td", { role: "presentation", className: 'fc-resource-timeline-divider ' + context.theme.getClass('tableCellShaded') })), + }, + { + key: 'timeline', + scrollerElRef: this.timeBodyScrollerElRef, + content: props.timeBodyContent, + }, + ], + }, + ]; + if (stickyFooterScrollbar) { + sections.push({ + type: 'footer', + key: 'footer', + isSticky: true, + chunks: [ + { + key: 'datagrid', + content: renderScrollShim, + }, + { + key: 'divider', + outerContent: (h("td", { role: "presentation", className: 'fc-resource-timeline-divider ' + context.theme.getClass('tableCellShaded') })), + }, + { + key: 'timeline', + content: renderScrollShim, + }, + ], + }); + } + let resourceAreaWidth = state.resourceAreaWidthOverride != null + ? state.resourceAreaWidthOverride + : options.resourceAreaWidth; + return (h(ScrollGrid, { ref: this.scrollGridRef, elRef: this.rootElRef, liquid: !props.isHeightAuto && !props.forPrint, collapsibleWidth: false, colGroups: [ + { cols: props.spreadsheetCols, width: resourceAreaWidth }, + { cols: [] }, + { cols: props.timeCols }, + ], sections: sections })); + } + forceTimeScroll(left) { + let scrollGrid = this.scrollGridRef.current; + scrollGrid.forceScrollLeft(2, left); // 2 = the time area + } + forceResourceScroll(top) { + let scrollGrid = this.scrollGridRef.current; + scrollGrid.forceScrollTop(1, top); // 1 = the body + } + getResourceScroll() { + let timeBodyScrollerEl = this.timeBodyScrollerElRef.current; + return timeBodyScrollerEl.scrollTop; + } + // Resource Area Resizing + // ------------------------------------------------------------------------------------------ + // NOTE: a callback Ref for the resizer was firing multiple times with same elements (Preact) + // that's why we use spreadsheetResizerElRef instead + componentDidMount() { + this.initSpreadsheetResizing(); + } + componentWillUnmount() { + this.destroySpreadsheetResizing(); + } + initSpreadsheetResizing() { + let { isRtl, pluginHooks } = this.context; + let ElementDraggingImpl = pluginHooks.elementDraggingImpl; + let spreadsheetHeadEl = this.spreadsheetHeaderChunkElRef.current; + if (ElementDraggingImpl) { + let rootEl = this.rootElRef.current; + let dragging = this.spreadsheetResizerDragging = new ElementDraggingImpl(rootEl, '.fc-resource-timeline-divider'); + let dragStartWidth; + let viewWidth; + dragging.emitter.on('dragstart', () => { + dragStartWidth = spreadsheetHeadEl.getBoundingClientRect().width; + viewWidth = rootEl.getBoundingClientRect().width; + }); + dragging.emitter.on('dragmove', (pev) => { + let newWidth = dragStartWidth + pev.deltaX * (isRtl ? -1 : 1); + newWidth = Math.max(newWidth, MIN_RESOURCE_AREA_WIDTH); + newWidth = Math.min(newWidth, viewWidth - MIN_RESOURCE_AREA_WIDTH); + // scrollgrid will ignore resize requests if there are too many :| + this.setState({ + resourceAreaWidthOverride: newWidth, + }, this.ensureScrollGridResize); + }); + dragging.setAutoScrollEnabled(false); // because gets weird with auto-scrolling time area + } + } + destroySpreadsheetResizing() { + if (this.spreadsheetResizerDragging) { + this.spreadsheetResizerDragging.destroy(); + } + } + } + + class ResourceTimelineView extends BaseComponent { + constructor(props, context) { + super(props, context); + this.processColOptions = memoize(processColOptions); + this.buildTimelineDateProfile = memoize(buildTimelineDateProfile); + this.hasNesting = memoize(hasNesting); + this.buildRowNodes = memoize(buildRowNodes); + this.layoutRef = y(); + this.rowNodes = []; + this.renderedRowNodes = []; + this.buildRowIndex = memoize(buildRowIndex); + this.handleSlatCoords = (slatCoords) => { + this.setState({ slatCoords }); + }; + this.handleRowCoords = (rowCoords) => { + this.rowCoords = rowCoords; + this.scrollResponder.update(false); // TODO: could eliminate this if rowCoords lived in state + }; + this.handleMaxCushionWidth = (slotCushionMaxWidth) => { + this.setState({ + slotCushionMaxWidth: Math.ceil(slotCushionMaxWidth), // for less rerendering TODO: DRY + }); + }; + // Scrolling + // ------------------------------------------------------------------------------------------------------------------ + // this is useful for scrolling prev/next dates while resource is scrolled down + this.handleScrollLeftRequest = (scrollLeft) => { + let layout = this.layoutRef.current; + layout.forceTimeScroll(scrollLeft); + }; + this.handleScrollRequest = (request) => { + let { rowCoords } = this; + let layout = this.layoutRef.current; + let rowId = request.rowId || request.resourceId; + if (rowCoords) { + if (rowId) { + let rowIdToIndex = this.buildRowIndex(this.renderedRowNodes); + let index = rowIdToIndex[rowId]; + if (index != null) { + let scrollTop = (request.fromBottom != null ? + rowCoords.bottoms[index] - request.fromBottom : // pixels from bottom edge + rowCoords.tops[index] // just use top edge + ); + layout.forceResourceScroll(scrollTop); + } + } + return true; + } + return null; + }; + // Resource INDIVIDUAL-Column Area Resizing + // ------------------------------------------------------------------------------------------ + this.handleColWidthChange = (colWidths) => { + this.setState({ + spreadsheetColWidths: colWidths, + }); + }; + this.state = { + resourceAreaWidth: context.options.resourceAreaWidth, + spreadsheetColWidths: [], + }; + } + render() { + let { props, state, context } = this; + let { options, viewSpec } = context; + let { superHeaderRendering, groupSpecs, orderSpecs, isVGrouping, colSpecs } = this.processColOptions(context.options); + let tDateProfile = this.buildTimelineDateProfile(props.dateProfile, context.dateEnv, options, context.dateProfileGenerator); + let rowNodes = this.rowNodes = this.buildRowNodes(props.resourceStore, groupSpecs, orderSpecs, isVGrouping, props.resourceEntityExpansions, options.resourcesInitiallyExpanded); + let { slotMinWidth } = options; + let slatCols = buildSlatCols(tDateProfile, slotMinWidth || this.computeFallbackSlotMinWidth(tDateProfile)); + return (h(ViewContainer$1, { elClasses: [ + 'fc-resource-timeline', + !this.hasNesting(rowNodes) && 'fc-resource-timeline-flat', + 'fc-timeline', + options.eventOverlap === false ? + 'fc-timeline-overlap-disabled' : + 'fc-timeline-overlap-enabled', + ], viewSpec: viewSpec }, + h(ResourceTimelineViewLayout, { ref: this.layoutRef, forPrint: props.forPrint, isHeightAuto: props.isHeightAuto, spreadsheetCols: buildSpreadsheetCols(colSpecs, state.spreadsheetColWidths, ''), spreadsheetHeaderRows: (contentArg) => (h(SpreadsheetHeader // TODO: rename to SpreadsheetHeaderRows + , { superHeaderRendering: superHeaderRendering, colSpecs: colSpecs, onColWidthChange: this.handleColWidthChange, rowInnerHeights: contentArg.rowSyncHeights })), spreadsheetBodyRows: (contentArg) => (h(p, null, this.renderSpreadsheetRows(rowNodes, colSpecs, contentArg.rowSyncHeights))), timeCols: slatCols, timeHeaderContent: (contentArg) => (h(TimelineHeader, { clientWidth: contentArg.clientWidth, clientHeight: contentArg.clientHeight, tableMinWidth: contentArg.tableMinWidth, tableColGroupNode: contentArg.tableColGroupNode, dateProfile: props.dateProfile, tDateProfile: tDateProfile, slatCoords: state.slatCoords, rowInnerHeights: contentArg.rowSyncHeights, onMaxCushionWidth: slotMinWidth ? null : this.handleMaxCushionWidth })), timeBodyContent: (contentArg) => (h(ResourceTimelineGrid, { dateProfile: props.dateProfile, clientWidth: contentArg.clientWidth, clientHeight: contentArg.clientHeight, tableMinWidth: contentArg.tableMinWidth, tableColGroupNode: contentArg.tableColGroupNode, expandRows: contentArg.expandRows, tDateProfile: tDateProfile, rowNodes: rowNodes, businessHours: props.businessHours, dateSelection: props.dateSelection, eventStore: props.eventStore, eventUiBases: props.eventUiBases, eventSelection: props.eventSelection, eventDrag: props.eventDrag, eventResize: props.eventResize, resourceStore: props.resourceStore, nextDayThreshold: context.options.nextDayThreshold, rowInnerHeights: contentArg.rowSyncHeights, onSlatCoords: this.handleSlatCoords, onRowCoords: this.handleRowCoords, onScrollLeftRequest: this.handleScrollLeftRequest, onRowHeightChange: contentArg.reportRowHeightChange })) }))); + } + renderSpreadsheetRows(nodes, colSpecs, rowSyncHeights) { + return nodes.map((node, index) => { + if (node.group) { + return (h(SpreadsheetGroupRow, { key: node.id, id: node.id, spreadsheetColCnt: colSpecs.length, isExpanded: node.isExpanded, group: node.group, innerHeight: rowSyncHeights[index] || '' })); + } + if (node.resource) { + return (h(SpreadsheetRow, { key: node.id, colSpecs: colSpecs, rowSpans: node.rowSpans, depth: node.depth, isExpanded: node.isExpanded, hasChildren: node.hasChildren, resource: node.resource, innerHeight: rowSyncHeights[index] || '' })); + } + return null; + }); + } + componentDidMount() { + this.renderedRowNodes = this.rowNodes; + this.scrollResponder = this.context.createScrollResponder(this.handleScrollRequest); + } + getSnapshotBeforeUpdate() { + if (!this.props.forPrint) { // because print-view is always zero? + return { resourceScroll: this.queryResourceScroll() }; + } + return {}; + } + componentDidUpdate(prevProps, prevState, snapshot) { + this.renderedRowNodes = this.rowNodes; + this.scrollResponder.update(prevProps.dateProfile !== this.props.dateProfile); + if (snapshot.resourceScroll) { + this.handleScrollRequest(snapshot.resourceScroll); // TODO: this gets triggered too often + } + } + componentWillUnmount() { + this.scrollResponder.detach(); + } + computeFallbackSlotMinWidth(tDateProfile) { + return Math.max(30, ((this.state.slotCushionMaxWidth || 0) / tDateProfile.slotsPerLabel)); + } + queryResourceScroll() { + let { rowCoords, renderedRowNodes } = this; + if (rowCoords) { + let layout = this.layoutRef.current; + let trBottoms = rowCoords.bottoms; + let scrollTop = layout.getResourceScroll(); + let scroll = {}; + for (let i = 0; i < trBottoms.length; i += 1) { + let rowNode = renderedRowNodes[i]; + let elBottom = trBottoms[i] - scrollTop; // from the top of the scroller + if (elBottom > 0) { + scroll.rowId = rowNode.id; + scroll.fromBottom = elBottom; + break; + } + } + return scroll; + } + return null; + } + } + ResourceTimelineView.addStateEquality({ + spreadsheetColWidths: isArraysEqual, + }); + function buildRowIndex(rowNodes) { + let rowIdToIndex = {}; + for (let i = 0; i < rowNodes.length; i += 1) { + rowIdToIndex[rowNodes[i].id] = i; + } + return rowIdToIndex; + } + function buildSpreadsheetCols(colSpecs, forcedWidths, fallbackWidth = '') { + return colSpecs.map((colSpec, i) => ({ + className: colSpec.isMain ? 'fc-main-col' : '', + width: forcedWidths[i] || colSpec.width || fallbackWidth, + })); + } + function hasNesting(nodes) { + for (let node of nodes) { + if (node.group) { + return true; + } + if (node.resource) { + if (node.hasChildren) { + return true; + } + } + } + return false; + } + function processColOptions(options) { + let allColSpecs = options.resourceAreaColumns || []; + let superHeaderRendering = null; + if (!allColSpecs.length) { + allColSpecs.push({ + headerClassNames: options.resourceAreaHeaderClassNames, + headerContent: options.resourceAreaHeaderContent || 'Resources', + headerDidMount: options.resourceAreaHeaderDidMount, + headerWillUnmount: options.resourceAreaHeaderWillUnmount, + }); + } + else if (options.resourceAreaHeaderContent) { // weird way to determine if content + superHeaderRendering = { + headerClassNames: options.resourceAreaHeaderClassNames, + headerContent: options.resourceAreaHeaderContent, + headerDidMount: options.resourceAreaHeaderDidMount, + headerWillUnmount: options.resourceAreaHeaderWillUnmount, + }; + } + let plainColSpecs = []; + let groupColSpecs = []; // part of the colSpecs, but filtered out in order to put first + let groupSpecs = []; + let isVGrouping = false; + for (let colSpec of allColSpecs) { + if (colSpec.group) { + groupColSpecs.push(Object.assign(Object.assign({}, colSpec), { cellClassNames: colSpec.cellClassNames || options.resourceGroupLabelClassNames, cellContent: colSpec.cellContent || options.resourceGroupLabelContent, cellDidMount: colSpec.cellDidMount || options.resourceGroupLabelDidMount, cellWillUnmount: colSpec.cellWillUnmount || options.resourceGroupLaneWillUnmount })); + } + else { + plainColSpecs.push(colSpec); + } + } + // BAD: mutates a user-supplied option + let mainColSpec = plainColSpecs[0]; + mainColSpec.isMain = true; + mainColSpec.cellClassNames = mainColSpec.cellClassNames || options.resourceLabelClassNames; + mainColSpec.cellContent = mainColSpec.cellContent || options.resourceLabelContent; + mainColSpec.cellDidMount = mainColSpec.cellDidMount || options.resourceLabelDidMount; + mainColSpec.cellWillUnmount = mainColSpec.cellWillUnmount || options.resourceLabelWillUnmount; + if (groupColSpecs.length) { + groupSpecs = groupColSpecs; + isVGrouping = true; + } + else { + let hGroupField = options.resourceGroupField; + if (hGroupField) { + groupSpecs.push({ + field: hGroupField, + labelClassNames: options.resourceGroupLabelClassNames, + labelContent: options.resourceGroupLabelContent, + labelDidMount: options.resourceGroupLabelDidMount, + labelWillUnmount: options.resourceGroupLabelWillUnmount, + laneClassNames: options.resourceGroupLaneClassNames, + laneContent: options.resourceGroupLaneContent, + laneDidMount: options.resourceGroupLaneDidMount, + laneWillUnmount: options.resourceGroupLaneWillUnmount, + }); + } + } + let allOrderSpecs = options.resourceOrder || DEFAULT_RESOURCE_ORDER; + let plainOrderSpecs = []; + for (let orderSpec of allOrderSpecs) { + let isGroup = false; + for (let groupSpec of groupSpecs) { + if (groupSpec.field === orderSpec.field) { + groupSpec.order = orderSpec.order; // -1, 0, 1 + isGroup = true; + break; + } + } + if (!isGroup) { + plainOrderSpecs.push(orderSpec); + } + } + return { + superHeaderRendering, + isVGrouping, + groupSpecs, + colSpecs: groupColSpecs.concat(plainColSpecs), + orderSpecs: plainOrderSpecs, + }; + } + + var css_248z = ".fc .fc-resource-timeline-divider{cursor:col-resize;width:3px}.fc .fc-resource-group{font-weight:inherit;text-align:inherit}.fc .fc-resource-timeline .fc-resource-group:not([rowspan]){background:var(--fc-neutral-bg-color)}.fc .fc-timeline-lane-frame{position:relative}.fc .fc-timeline-overlap-enabled .fc-timeline-lane-frame .fc-timeline-events{box-sizing:content-box;padding-bottom:10px}.fc-timeline-body-expandrows td.fc-timeline-lane{position:relative}.fc-timeline-body-expandrows .fc-timeline-lane-frame{position:static}.fc-datagrid-cell-frame-liquid{height:100%}.fc-liquid-hack .fc-datagrid-cell-frame-liquid{bottom:0;height:auto;left:0;position:absolute;right:0;top:0}.fc .fc-datagrid-header .fc-datagrid-cell-frame{align-items:center;display:flex;justify-content:flex-start;position:relative}.fc .fc-datagrid-cell-resizer{bottom:0;cursor:col-resize;position:absolute;top:0;width:5px;z-index:1}.fc .fc-datagrid-cell-cushion{overflow:hidden;padding:8px;white-space:nowrap}.fc .fc-datagrid-expander{cursor:pointer;opacity:.65}.fc .fc-datagrid-expander .fc-icon{display:inline-block;width:1em}.fc .fc-datagrid-expander-placeholder{cursor:auto}.fc .fc-resource-timeline-flat .fc-datagrid-expander-placeholder{display:none}.fc-direction-ltr .fc-datagrid-cell-resizer{right:-3px}.fc-direction-rtl .fc-datagrid-cell-resizer{left:-3px}.fc-direction-ltr .fc-datagrid-expander{margin-right:3px}.fc-direction-rtl .fc-datagrid-expander{margin-left:3px}"; + injectStyles(css_248z); + + var index = createPlugin({ + name: '@fullcalendar/resource-timeline', + premiumReleaseDate: '2022-12-27', + deps: [ + index$7, + index$3, + index$4, + ], + initialView: 'resourceTimelineDay', + views: { + resourceTimeline: { + type: 'timeline', + component: ResourceTimelineView, + needsResourceData: true, + resourceAreaWidth: '30%', + resourcesInitiallyExpanded: true, + eventResizableFromStart: true, // TODO: not DRY with this same setting in the main timeline config + }, + resourceTimelineDay: { + type: 'resourceTimeline', + duration: { days: 1 }, + }, + resourceTimelineWeek: { + type: 'resourceTimeline', + duration: { weeks: 1 }, + }, + resourceTimelineMonth: { + type: 'resourceTimeline', + duration: { months: 1 }, + }, + resourceTimelineYear: { + type: 'resourceTimeline', + duration: { years: 1 }, + }, + }, + }); + + globalPlugins.push(index$b, index$a, index$9, index$8, index$6, index$5, index$4, index$3, index$2, index$1, index); + + exports.Calendar = Calendar; + exports.Draggable = ExternalDraggable; + exports.Internal = internal; + exports.JsonRequestError = JsonRequestError; + exports.ThirdPartyDraggable = ThirdPartyDraggable; + exports.createPlugin = createPlugin; + exports.formatDate = formatDate; + exports.formatRange = formatRange; + exports.globalLocales = globalLocales; + exports.globalPlugins = globalPlugins; + exports.sliceEvents = sliceEvents; + exports.version = version; + + Object.defineProperty(exports, '__esModule', { value: true }); + + return exports; + +})({}); diff --git a/static_common/common/vendor/fullcalendar-scheduler/fullcalendar-6.0.2.min.js b/static_common/common/vendor/fullcalendar-scheduler/fullcalendar-6.0.2.min.js new file mode 100644 index 00000000..65b13881 --- /dev/null +++ b/static_common/common/vendor/fullcalendar-scheduler/fullcalendar-6.0.2.min.js @@ -0,0 +1,6 @@ +/*! +FullCalendar Premium Bundle v6.0.2 +Docs & License: https://fullcalendar.io/docs/initialize-globals +(c) 2022 Adam Shaw +*/ +var FullCalendar=function(e){"use strict";var t,n,r,i,s,o,l,a={},c=[],d=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function u(e,t){for(var n in t)e[n]=t[n];return e}function h(e){var t=e.parentNode;t&&t.removeChild(e)}function f(e,n,r){var i,s,o,l={};for(o in n)"key"==o?i=n[o]:"ref"==o?s=n[o]:l[o]=n[o];if(arguments.length>2&&(l.children=arguments.length>3?t.call(arguments,2):r),"function"==typeof e&&null!=e.defaultProps)for(o in e.defaultProps)void 0===l[o]&&(l[o]=e.defaultProps[o]);return p(e,l,i,s,null)}function p(e,t,i,s,o){var l={type:e,props:t,key:i,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==o?++r:o};return null==o&&null!=n.vnode&&n.vnode(l),l}function g(e){return e.children}function m(e,t){this.props=e,this.context=t}function v(e,t){if(null==t)return e.__?v(e.__,e.__.__k.indexOf(e)+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?v(e):null}function y(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return y(e)}}function b(e){(!e.__d&&(e.__d=!0)&&s.push(e)&&!S.__r++||o!==n.debounceRendering)&&((o=n.debounceRendering)||setTimeout)(S)}function S(){for(var e;S.__r=s.length;)e=s.sort((function(e,t){return e.__v.__b-t.__v.__b})),s=[],e.some((function(e){var t,n,r,i,s,o;e.__d&&(s=(i=(t=e).__v).__e,(o=t.__P)&&(n=[],(r=u({},i)).__v=i.__v+1,_(o,i,r,t.__n,void 0!==o.ownerSVGElement,null!=i.__h?[s]:null,n,null==s?v(i):s,i.__h),k(n,i),i.__e!=s&&y(i)))}))}function E(e,t,n,r,i,s,o,l,d,u){var h,f,m,y,b,S,E,w=r&&r.__k||c,R=w.length;for(n.__k=[],h=0;h<t.length;h++)if(null!=(y=n.__k[h]=null==(y=t[h])||"boolean"==typeof y?null:"string"==typeof y||"number"==typeof y||"bigint"==typeof y?p(null,y,null,null,y):Array.isArray(y)?p(g,{children:y},null,null,null):y.__b>0?p(y.type,y.props,y.key,y.ref?y.ref:null,y.__v):y)){if(y.__=n,y.__b=n.__b+1,null===(m=w[h])||m&&y.key==m.key&&y.type===m.type)w[h]=void 0;else for(f=0;f<R;f++){if((m=w[f])&&y.key==m.key&&y.type===m.type){w[f]=void 0;break}m=null}_(e,y,m=m||a,i,s,o,l,d,u),b=y.__e,(f=y.ref)&&m.ref!=f&&(E||(E=[]),m.ref&&E.push(m.ref,null,y),E.push(f,y.__c||b,y)),null!=b?(null==S&&(S=b),"function"==typeof y.type&&y.__k===m.__k?y.__d=d=C(y,d,e):d=D(e,y,m,w,b,d),"function"==typeof n.type&&(n.__d=d)):d&&m.__e==d&&d.parentNode!=e&&(d=v(m))}for(n.__e=S,h=R;h--;)null!=w[h]&&O(w[h],w[h]);if(E)for(h=0;h<E.length;h++)I(E[h],E[++h],E[++h])}function C(e,t,n){for(var r,i=e.__k,s=0;i&&s<i.length;s++)(r=i[s])&&(r.__=e,t="function"==typeof r.type?C(r,t,n):D(n,r,r,i,r.__e,t));return t}function w(e,t){return t=t||[],null==e||"boolean"==typeof e||(Array.isArray(e)?e.some((function(e){w(e,t)})):t.push(e)),t}function D(e,t,n,r,i,s){var o,l,a;if(void 0!==t.__d)o=t.__d,t.__d=void 0;else if(null==n||i!=s||null==i.parentNode)e:if(null==s||s.parentNode!==e)e.appendChild(i),o=null;else{for(l=s,a=0;(l=l.nextSibling)&&a<r.length;a+=1)if(l==i)break e;e.insertBefore(i,s),o=s}return void 0!==o?o:i.nextSibling}function R(e,t,n){"-"===t[0]?e.setProperty(t,n):e[t]=null==n?"":"number"!=typeof n||d.test(t)?n:n+"px"}function A(e,t,n,r,i){var s;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||R(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||R(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])s=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+s]=n,n?r||e.addEventListener(t,s?T:x,s):e.removeEventListener(t,s?T:x,s);else if("dangerouslySetInnerHTML"!==t){if(i)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&-1==t.indexOf("-")?e.removeAttribute(t):e.setAttribute(t,n))}}function x(e){this.l[e.type+!1](n.event?n.event(e):e)}function T(e){this.l[e.type+!0](n.event?n.event(e):e)}function _(e,t,r,i,s,o,l,a,c){var d,h,f,p,v,y,b,S,C,w,D,R,A,x,T,_=t.type;if(void 0!==t.constructor)return null;null!=r.__h&&(c=r.__h,a=t.__e=r.__e,t.__h=null,o=[a]),(d=n.__b)&&d(t);try{e:if("function"==typeof _){if(S=t.props,C=(d=_.contextType)&&i[d.__c],w=d?C?C.props.value:d.__:i,r.__c?b=(h=t.__c=r.__c).__=h.__E:("prototype"in _&&_.prototype.render?t.__c=h=new _(S,w):(t.__c=h=new m(S,w),h.constructor=_,h.render=N),C&&C.sub(h),h.props=S,h.state||(h.state={}),h.context=w,h.__n=i,f=h.__d=!0,h.__h=[],h._sb=[]),null==h.__s&&(h.__s=h.state),null!=_.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=u({},h.__s)),u(h.__s,_.getDerivedStateFromProps(S,h.__s))),p=h.props,v=h.state,f)null==_.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(null==_.getDerivedStateFromProps&&S!==p&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(S,w),!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(S,h.__s,w)||t.__v===r.__v){for(h.props=S,h.state=h.__s,t.__v!==r.__v&&(h.__d=!1),h.__v=t,t.__e=r.__e,t.__k=r.__k,t.__k.forEach((function(e){e&&(e.__=t)})),D=0;D<h._sb.length;D++)h.__h.push(h._sb[D]);h._sb=[],h.__h.length&&l.push(h);break e}null!=h.componentWillUpdate&&h.componentWillUpdate(S,h.__s,w),null!=h.componentDidUpdate&&h.__h.push((function(){h.componentDidUpdate(p,v,y)}))}if(h.context=w,h.props=S,h.__v=t,h.__P=e,R=n.__r,A=0,"prototype"in _&&_.prototype.render){for(h.state=h.__s,h.__d=!1,R&&R(t),d=h.render(h.props,h.state,h.context),x=0;x<h._sb.length;x++)h.__h.push(h._sb[x]);h._sb=[]}else do{h.__d=!1,R&&R(t),d=h.render(h.props,h.state,h.context),h.state=h.__s}while(h.__d&&++A<25);h.state=h.__s,null!=h.getChildContext&&(i=u(u({},i),h.getChildContext())),f||null==h.getSnapshotBeforeUpdate||(y=h.getSnapshotBeforeUpdate(p,v)),T=null!=d&&d.type===g&&null==d.key?d.props.children:d,E(e,Array.isArray(T)?T:[T],t,r,i,s,o,l,a,c),h.base=t.__e,t.__h=null,h.__h.length&&l.push(h),b&&(h.__E=h.__=null),h.__e=!1}else null==o&&t.__v===r.__v?(t.__k=r.__k,t.__e=r.__e):t.__e=M(r.__e,t,r,i,s,o,l,c);(d=n.diffed)&&d(t)}catch(e){t.__v=null,(c||null!=o)&&(t.__e=a,t.__h=!!c,o[o.indexOf(a)]=null),n.__e(e,t,r)}}function k(e,t){n.__c&&n.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){n.__e(e,t.__v)}}))}function M(e,n,r,i,s,o,l,c){var d,u,f,p=r.props,g=n.props,m=n.type,y=0;if("svg"===m&&(s=!0),null!=o)for(;y<o.length;y++)if((d=o[y])&&"setAttribute"in d==!!m&&(m?d.localName===m:3===d.nodeType)){e=d,o[y]=null;break}if(null==e){if(null===m)return document.createTextNode(g);e=s?document.createElementNS("http://www.w3.org/2000/svg",m):document.createElement(m,g.is&&g),o=null,c=!1}if(null===m)p===g||c&&e.data===g||(e.data=g);else{if(o=o&&t.call(e.childNodes),u=(p=r.props||a).dangerouslySetInnerHTML,f=g.dangerouslySetInnerHTML,!c){if(null!=o)for(p={},y=0;y<e.attributes.length;y++)p[e.attributes[y].name]=e.attributes[y].value;(f||u)&&(f&&(u&&f.__html==u.__html||f.__html===e.innerHTML)||(e.innerHTML=f&&f.__html||""))}if(function(e,t,n,r,i){var s;for(s in n)"children"===s||"key"===s||s in t||A(e,s,null,n[s],r);for(s in t)i&&"function"!=typeof t[s]||"children"===s||"key"===s||"value"===s||"checked"===s||n[s]===t[s]||A(e,s,t[s],n[s],r)}(e,g,p,s,c),f)n.__k=[];else if(y=n.props.children,E(e,Array.isArray(y)?y:[y],n,r,i,s&&"foreignObject"!==m,o,l,o?o[0]:r.__k&&v(r,0),c),null!=o)for(y=o.length;y--;)null!=o[y]&&h(o[y]);c||("value"in g&&void 0!==(y=g.value)&&(y!==e.value||"progress"===m&&!y||"option"===m&&y!==p.value)&&A(e,"value",y,p.value,!1),"checked"in g&&void 0!==(y=g.checked)&&y!==e.checked&&A(e,"checked",y,p.checked,!1))}return e}function I(e,t,r){try{"function"==typeof e?e(t):e.current=t}catch(e){n.__e(e,r)}}function O(e,t,r){var i,s;if(n.unmount&&n.unmount(e),(i=e.ref)&&(i.current&&i.current!==e.__e||I(i,null,t)),null!=(i=e.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){n.__e(e,t)}i.base=i.__P=null,e.__c=void 0}if(i=e.__k)for(s=0;s<i.length;s++)i[s]&&O(i[s],t,r||"function"!=typeof e.type);r||null==e.__e||h(e.__e),e.__=e.__e=e.__d=void 0}function N(e,t,n){return this.constructor(e,n)}function P(e,r,i){var s,o,l;n.__&&n.__(e,r),o=(s="function"==typeof i)?null:i&&i.__k||r.__k,l=[],_(r,e=(!s&&i||r).__k=f(g,null,[e]),o||a,a,void 0!==r.ownerSVGElement,!s&&i?[i]:o?null:r.firstChild?t.call(r.childNodes):null,l,!s&&i?i:o?o.__e:r.firstChild,s),k(l,e)}t=c.slice,n={__e:function(e,t,n,r){for(var i,s,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((s=i.constructor)&&null!=s.getDerivedStateFromError&&(i.setState(s.getDerivedStateFromError(e)),o=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(e,r||{}),o=i.__d),o)return i.__E=i}catch(t){e=t}throw e}},r=0,i=function(e){return null!=e&&void 0===e.constructor},m.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=u({},this.state),"function"==typeof e&&(e=e(u({},n),this.props)),e&&u(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),b(this))},m.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),b(this))},m.prototype.render=g,s=[],S.__r=0,l=0;var H,W,B,j=[],L=[],z=n.__b,U=n.__r,G=n.diffed,F=n.__c,V=n.unmount;function q(){for(var e;e=j.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Z),e.__H.__h.forEach(X),e.__H.__h=[]}catch(t){e.__H.__h=[],n.__e(t,e.__v)}}n.__b=function(e){H=null,z&&z(e)},n.__r=function(e){U&&U(e);var t=(H=e.__c).__H;t&&(W===H?(t.__h=[],H.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=L,e.__N=e.i=void 0}))):(t.__h.forEach(Z),t.__h.forEach(X),t.__h=[])),W=H},n.diffed=function(e){G&&G(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==j.push(t)&&B===n.requestAnimationFrame||((B=n.requestAnimationFrame)||Q)(q)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==L&&(e.__=e.__V),e.i=void 0,e.__V=L}))),W=H=null},n.__c=function(e,t){t.some((function(e){try{e.__h.forEach(Z),e.__h=e.__h.filter((function(e){return!e.__||X(e)}))}catch(r){t.some((function(e){e.__h&&(e.__h=[])})),t=[],n.__e(r,e.__v)}})),F&&F(e,t)},n.unmount=function(e){V&&V(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach((function(e){try{Z(e)}catch(e){t=e}})),r.__H=void 0,t&&n.__e(t,r.__v))};var Y="function"==typeof requestAnimationFrame;function Q(e){var t,n=function(){clearTimeout(r),Y&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);Y&&(t=requestAnimationFrame(n))}function Z(e){var t=H,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),H=t}function X(e){var t=H;e.__c=e.__(),H=t}function J(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var r in t)if("__source"!==r&&e[r]!==t[r])return!0;return!1}function $(e){this.props=e}($.prototype=new m).isPureReactComponent=!0,$.prototype.shouldComponentUpdate=function(e,t){return J(this.props,e)||J(this.state,t)};var K=n.__b;n.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),K&&K(e)};var ee=n.__e;n.__e=function(e,t,n,r){if(e.then)for(var i,s=t;s=s.__;)if((i=s.__c)&&i.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),i.__c(e,t);ee(e,t,n,r)};var te=n.unmount;function ne(){this.__u=0,this.t=null,this.__b=null}function re(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function ie(){this.u=null,this.o=null}n.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&!0===e.__h&&(e.type=null),te&&te(e)},(ne.prototype=new m).__c=function(e,t){var n=t.__c,r=this;null==r.t&&(r.t=[]),r.t.push(n);var i=re(r.__v),s=!1,o=function(){s||(s=!0,n.__R=null,i?i(l):l())};n.__R=o;var l=function(){if(!--r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=function e(t,n,r){return t&&(t.__v=null,t.__k=t.__k&&t.__k.map((function(t){return e(t,n,r)})),t.__c&&t.__c.__P===n&&(t.__e&&r.insertBefore(t.__e,t.__d),t.__c.__e=!0,t.__c.__P=r)),t}(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.t.pop();)t.forceUpdate()}},a=!0===t.__h;r.__u++||a||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(o,o)},ne.prototype.componentWillUnmount=function(){this.t=[]},ne.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=function e(t,n,r){return t&&(t.__c&&t.__c.__H&&(t.__c.__H.__.forEach((function(e){"function"==typeof e.__c&&e.__c()})),t.__c.__H=null),null!=(t=function(e,t){for(var n in t)e[n]=t[n];return e}({},t)).__c&&(t.__c.__P===r&&(t.__c.__P=n),t.__c=null),t.__k=t.__k&&t.__k.map((function(t){return e(t,n,r)}))),t}(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&f(g,null,e.fallback);return i&&(i.__h=null),[f(g,null,t.__a?null:e.children),i]};var se=function(e,t,n){if(++n[1]===n[0]&&e.o.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.o.size))for(n=e.u;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.u=n=n[2]}};function oe(e){return this.getChildContext=function(){return e.context},e.children}function le(e){var t=this,n=e.i;t.componentWillUnmount=function(){P(null,t.l),t.l=null,t.i=null},t.i&&t.i!==n&&t.componentWillUnmount(),e.__v?(t.l||(t.i=n,t.l={nodeType:1,parentNode:n,childNodes:[],appendChild:function(e){this.childNodes.push(e),t.i.appendChild(e)},insertBefore:function(e,n){this.childNodes.push(e),t.i.appendChild(e)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.i.removeChild(e)}}),P(f(oe,{context:t.context},e.__v),t.l)):t.l&&t.componentWillUnmount()}(ie.prototype=new m).__a=function(e){var t=this,n=re(t.__v),r=t.o.get(e);return r[0]++,function(i){var s=function(){t.props.revealOrder?(r.push(i),se(t,e,r)):i()};n?n(s):s()}},ie.prototype.render=function(e){this.u=null,this.o=new Map;var t=w(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.o.set(t[n],this.u=[1,0,this.u]);return e.children},ie.prototype.componentDidUpdate=ie.prototype.componentDidMount=function(){var e=this;this.o.forEach((function(t,n){se(e,n,t)}))};var ae="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,ce=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,de="undefined"!=typeof document,ue=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/i:/fil|che|ra/i).test(e)};m.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach((function(e){Object.defineProperty(m.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})}));var he=n.event;function fe(){}function pe(){return this.cancelBubble}function ge(){return this.defaultPrevented}n.event=function(e){return he&&(e=he(e)),e.persist=fe,e.isPropagationStopped=pe,e.isDefaultPrevented=ge,e.nativeEvent=e};var me={configurable:!0,get:function(){return this.class}},ve=n.vnode;n.vnode=function(e){var t=e.type,n=e.props,r=n;if("string"==typeof t){var i=-1===t.indexOf("-");for(var s in r={},n){var o=n[s];de&&"children"===s&&"noscript"===t||"value"===s&&"defaultValue"in n&&null==o||("defaultValue"===s&&"value"in n&&null==n.value?s="value":"download"===s&&!0===o?o="":/ondoubleclick/i.test(s)?s="ondblclick":/^onchange(textarea|input)/i.test(s+t)&&!ue(n.type)?s="oninput":/^onfocus$/i.test(s)?s="onfocusin":/^onblur$/i.test(s)?s="onfocusout":/^on(Ani|Tra|Tou|BeforeInp|Compo)/.test(s)?s=s.toLowerCase():i&&ce.test(s)?s=s.replace(/[A-Z0-9]/g,"-$&").toLowerCase():null===o&&(o=void 0),/^oninput$/i.test(s)&&(s=s.toLowerCase(),r[s]&&(s="oninputCapture")),r[s]=o)}"select"==t&&r.multiple&&Array.isArray(r.value)&&(r.value=w(n.children).forEach((function(e){e.props.selected=-1!=r.value.indexOf(e.props.value)}))),"select"==t&&null!=r.defaultValue&&(r.value=w(n.children).forEach((function(e){e.props.selected=r.multiple?-1!=r.defaultValue.indexOf(e.props.value):r.defaultValue==e.props.value}))),e.props=r,n.class!=n.className&&(me.enumerable="className"in n,null!=n.className&&(r.class=n.className),Object.defineProperty(r,"className",me))}e.$$typeof=ae,ve&&ve(e)};var ye=n.__r;function be(e){if(!e||"undefined"==typeof document)return;const t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}n.__r=function(e){ye&&ye(e),e.__c};class Se{constructor(e){this.drainedOption=e,this.isRunning=!1,this.isDirty=!1,this.pauseDepths={},this.timeoutId=0}request(e){this.isDirty=!0,this.isPaused()||(this.clearTimeout(),null==e?this.tryDrain():this.timeoutId=setTimeout(this.tryDrain.bind(this),e))}pause(e=""){let{pauseDepths:t}=this;t[e]=(t[e]||0)+1,this.clearTimeout()}resume(e="",t){let{pauseDepths:n}=this;if(e in n){if(t)delete n[e];else{n[e]-=1,n[e]<=0&&delete n[e]}this.tryDrain()}}isPaused(){return Object.keys(this.pauseDepths).length}tryDrain(){if(!this.isRunning&&!this.isPaused()){for(this.isRunning=!0;this.isDirty;)this.isDirty=!1,this.drained();this.isRunning=!1}}clear(){this.clearTimeout(),this.isDirty=!1,this.pauseDepths={}}clearTimeout(){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=0)}drained(){this.drainedOption&&this.drainedOption()}}const{hasOwnProperty:Ee}=Object.prototype;function Ce(e,t){let n={};if(t)for(let r in t){let t=[];for(let i=e.length-1;i>=0;i-=1){let s=e[i][r];if("object"==typeof s&&s)t.unshift(s);else if(void 0!==s){n[r]=s;break}}t.length&&(n[r]=Ce(t))}for(let t=e.length-1;t>=0;t-=1){let r=e[t];for(let e in r)e in n||(n[e]=r[e])}return n}function we(e,t){let n={};for(let r in e)t(e[r],r)&&(n[r]=e[r]);return n}function De(e,t){let n={};for(let r in e)n[r]=t(e[r],r);return n}function Re(e){let t={};for(let n of e)t[n]=!0;return t}function Ae(e){let t=[];for(let n in e)t.push(e[n]);return t}function xe(e,t){if(e===t)return!0;for(let n in e)if(Ee.call(e,n)&&!(n in t))return!1;for(let n in t)if(Ee.call(t,n)&&e[n]!==t[n])return!1;return!0}const Te=/^on[A-Z]/;function _e(e,t){let n=[];for(let r in e)Ee.call(e,r)&&(r in t||n.push(r));for(let r in t)Ee.call(t,r)&&e[r]!==t[r]&&n.push(r);return n}function ke(e,t,n={}){if(e===t)return!0;for(let r in t)if(!(r in e)||!Me(e[r],t[r],n[r]))return!1;for(let n in e)if(!(n in t))return!1;return!0}function Me(e,t,n){return e===t||!0===n||!!n&&n(e,t)}function Ie(e,t=0,n,r=1){let i=[];null==n&&(n=Object.keys(e).length);for(let s=t;s<n;s+=r){let t=e[s];void 0!==t&&i.push(t)}return i}function Oe(e,t){let n=0,r=0;for(;r<e.length;)e[r]===t?(e.splice(r,1),n+=1):r+=1;return n}function Ne(e,t,n){if(e===t)return!0;let r,i=e.length;if(i!==t.length)return!1;for(r=0;r<i;r+=1)if(!(n?n(e[r],t[r]):e[r]===t[r]))return!1;return!0}function Pe(e,t,n){let r,i;return function(...s){if(r){if(!Ne(r,s)){n&&n(i);let r=e.apply(this,s);t&&t(r,i)||(i=r)}}else i=e.apply(this,s);return r=s,i}}function He(e,t,n){let r,i;return s=>{if(r){if(!xe(r,s)){n&&n(i);let r=e.call(this,s);t&&t(r,i)||(i=r)}}else i=e.call(this,s);return r=s,i}}function We(e,t,n){let r=[],i=[];return s=>{let o=r.length,l=s.length,a=0;for(;a<o;a+=1)if(s[a]){if(!Ne(r[a],s[a])){n&&n(i[a]);let r=e.apply(this,s[a]);t&&t(r,i[a])||(i[a]=r)}}else n&&n(i[a]);for(;a<l;a+=1)i[a]=e.apply(this,s[a]);return r=s,i.splice(l),i}}function Be(e,t,n){let r={},i={};return s=>{let o={};for(let l in s)if(i[l])if(Ne(r[l],s[l]))o[l]=i[l];else{n&&n(i[l]);let r=e.apply(this,s[l]);o[l]=t&&t(r,i[l])?i[l]:r}else o[l]=e.apply(this,s[l]);return r=s,i=o,o}}function je(e){e.parentNode&&e.parentNode.removeChild(e)}function Le(e,t){if(e.closest)return e.closest(t);if(!document.documentElement.contains(e))return null;do{if(ze(e,t))return e;e=e.parentElement||e.parentNode}while(null!==e&&1===e.nodeType);return null}function ze(e,t){return(e.matches||e.matchesSelector||e.msMatchesSelector).call(e,t)}function Ue(e,t){let n=e instanceof HTMLElement?[e]:e,r=[];for(let e=0;e<n.length;e+=1){let i=n[e].querySelectorAll(t);for(let e=0;e<i.length;e+=1)r.push(i[e])}return r}function Ge(e,t){let n=e instanceof HTMLElement?[e]:e,r=[];for(let e=0;e<n.length;e+=1){let i=n[e].children;for(let e=0;e<i.length;e+=1){let n=i[e];t&&!ze(n,t)||r.push(n)}}return r}const Fe=/(top|left|right|bottom|width|height)$/i;function Ve(e,t){for(let n in t)qe(e,n,t[n])}function qe(e,t,n){null==n?e.style[t]="":"number"==typeof n&&Fe.test(t)?e.style[t]=n+"px":e.style[t]=n}function Ye(e){var t,n;return null!==(n=null===(t=e.composedPath)||void 0===t?void 0:t.call(e)[0])&&void 0!==n?n:e.target}function Qe(e){return e.getRootNode?e.getRootNode():document}let Ze=0;function Xe(){return Ze+=1,"fc-dom-"+Ze}function Je(e){e.preventDefault()}function $e(e,t,n,r){let i=function(e,t){return n=>{let r=Le(n.target,e);r&&t.call(r,n,r)}}(n,r);return e.addEventListener(t,i),()=>{e.removeEventListener(t,i)}}const Ke=["webkitTransitionEnd","otransitionend","oTransitionEnd","msTransitionEnd","transitionend"];function et(e,t){let n=r=>{t(r),Ke.forEach(t=>{e.removeEventListener(t,n)})};Ke.forEach(t=>{e.addEventListener(t,n)})}function tt(e){return Object.assign({onClick:e},nt(e))}function nt(e){return{tabIndex:0,onKeyDown(t){"Enter"!==t.key&&" "!==t.key||(e(t),t.preventDefault())}}}let rt=0;function it(){return rt+=1,String(rt)}function st(){document.body.classList.add("fc-not-allowed")}function ot(){document.body.classList.remove("fc-not-allowed")}function lt(e){e.classList.add("fc-unselectable"),e.addEventListener("selectstart",Je)}function at(e){e.classList.remove("fc-unselectable"),e.removeEventListener("selectstart",Je)}function ct(e){e.addEventListener("contextmenu",Je)}function dt(e){e.removeEventListener("contextmenu",Je)}function ut(e){let t,n,r=[],i=[];for("string"==typeof e?i=e.split(/\s*,\s*/):"function"==typeof e?i=[e]:Array.isArray(e)&&(i=e),t=0;t<i.length;t+=1)n=i[t],"string"==typeof n?r.push("-"===n.charAt(0)?{field:n.substring(1),order:-1}:{field:n,order:1}):"function"==typeof n&&r.push({func:n});return r}function ht(e,t,n){let r,i;for(r=0;r<n.length;r+=1)if(i=ft(e,t,n[r]),i)return i;return 0}function ft(e,t,n){return n.func?n.func(e,t):pt(e[n.field],t[n.field])*(n.order||1)}function pt(e,t){return e||t?null==t?-1:null==e?1:"string"==typeof e||"string"==typeof t?String(e).localeCompare(String(t)):e-t:0}function gt(e,t){let n=String(e);return"000".substr(0,t-n.length)+n}function mt(e,t,n){return"function"==typeof e?e(...t):"string"==typeof e?t.reduce((e,t,n)=>e.replace("$"+n,t||""),e):n}function vt(e,t){return e-t}function yt(e){return e%1==0}function bt(e){let t=e.querySelector(".fc-scrollgrid-shrink-frame"),n=e.querySelector(".fc-scrollgrid-shrink-cushion");if(!t)throw new Error("needs fc-scrollgrid-shrink-frame className");if(!n)throw new Error("needs fc-scrollgrid-shrink-cushion className");return e.getBoundingClientRect().width-t.getBoundingClientRect().width+n.getBoundingClientRect().width}const St=["sun","mon","tue","wed","thu","fri","sat"];function Et(e,t){let n=Nt(e);return n[2]+=7*t,Pt(n)}function Ct(e,t){let n=Nt(e);return n[2]+=t,Pt(n)}function wt(e,t){let n=Nt(e);return n[6]+=t,Pt(n)}function Dt(e,t){return Rt(e,t)/7}function Rt(e,t){return(t.valueOf()-e.valueOf())/864e5}function At(e,t){let n=_t(e),r=_t(t);return{years:0,months:0,days:Math.round(Rt(n,r)),milliseconds:t.valueOf()-r.valueOf()-(e.valueOf()-n.valueOf())}}function xt(e,t){let n=Tt(e,t);return null!==n&&n%7==0?n/7:null}function Tt(e,t){return Wt(e)===Wt(t)?Math.round(Rt(e,t)):null}function _t(e){return Pt([e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()])}function kt(e,t,n,r){let i=Pt([t,0,1+Mt(t,n,r)]),s=_t(e),o=Math.round(Rt(i,s));return Math.floor(o/7)+1}function Mt(e,t,n){let r=7+t-n;return-((7+Pt([e,0,r]).getUTCDay()-t)%7)+r-1}function It(e){return[e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()]}function Ot(e){return new Date(e[0],e[1]||0,null==e[2]?1:e[2],e[3]||0,e[4]||0,e[5]||0)}function Nt(e){return[e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()]}function Pt(e){return 1===e.length&&(e=e.concat([0])),new Date(Date.UTC(...e))}function Ht(e){return!isNaN(e.valueOf())}function Wt(e){return 1e3*e.getUTCHours()*60*60+1e3*e.getUTCMinutes()*60+1e3*e.getUTCSeconds()+e.getUTCMilliseconds()}let Bt={};var jt,Lt;jt="gregory",Lt=class{getMarkerYear(e){return e.getUTCFullYear()}getMarkerMonth(e){return e.getUTCMonth()}getMarkerDay(e){return e.getUTCDate()}arrayToMarker(e){return Pt(e)}markerToArray(e){return Nt(e)}},Bt[jt]=Lt;const zt=["years","months","days","milliseconds"],Ut=/^(-?)(?:(\d+)\.)?(\d+):(\d\d)(?::(\d\d)(?:\.(\d\d\d))?)?/;function Gt(e,t){return"string"==typeof e?function(e){let t=Ut.exec(e);if(t){let e=t[1]?-1:1;return{years:0,months:0,days:e*(t[2]?parseInt(t[2],10):0),milliseconds:e*(60*(t[3]?parseInt(t[3],10):0)*60*1e3+60*(t[4]?parseInt(t[4],10):0)*1e3+1e3*(t[5]?parseInt(t[5],10):0)+(t[6]?parseInt(t[6],10):0))}}return null}(e):"object"==typeof e&&e?Ft(e):"number"==typeof e?Ft({[t||"milliseconds"]:e}):null}function Ft(e){let t={years:e.years||e.year||0,months:e.months||e.month||0,days:e.days||e.day||0,milliseconds:60*(e.hours||e.hour||0)*60*1e3+60*(e.minutes||e.minute||0)*1e3+1e3*(e.seconds||e.second||0)+(e.milliseconds||e.millisecond||e.ms||0)},n=e.weeks||e.week;return n&&(t.days+=7*n,t.specifiedWeeks=!0),t}function Vt(e){return e.years||e.months||e.milliseconds?0:e.days}function qt(e,t){return{years:e.years+t.years,months:e.months+t.months,days:e.days+t.days,milliseconds:e.milliseconds+t.milliseconds}}function Yt(e,t){return{years:e.years*t,months:e.months*t,days:e.days*t,milliseconds:e.milliseconds*t}}function Qt(e){return Jt(e)/864e5}function Zt(e){return Jt(e)/6e4}function Xt(e){return Jt(e)/1e3}function Jt(e){return 31536e6*e.years+2592e6*e.months+864e5*e.days+e.milliseconds}function $t(e,t){let n=null;for(let r=0;r<zt.length;r+=1){let i=zt[r];if(t[i]){let r=e[i]/t[i];if(!yt(r)||null!==n&&n!==r)return null;n=r}else if(e[i])return null}return n}function Kt(e){let t=e.milliseconds;if(t){if(t%1e3!=0)return{unit:"millisecond",value:t};if(t%6e4!=0)return{unit:"second",value:t/1e3};if(t%36e5!=0)return{unit:"minute",value:t/6e4};if(t)return{unit:"hour",value:t/36e5}}return e.days?e.specifiedWeeks&&e.days%7==0?{unit:"week",value:e.days/7}:{unit:"day",value:e.days}:e.months?{unit:"month",value:e.months}:e.years?{unit:"year",value:e.years}:{unit:"millisecond",value:0}}function en(e,t,n=!1){let r=e.toISOString();return r=r.replace(".000",""),n&&(r=r.replace("T00:00:00Z","")),r.length>10&&(null==t?r=r.replace("Z",""):0!==t&&(r=r.replace("Z",rn(t,!0)))),r}function tn(e){return e.toISOString().replace(/T.*$/,"")}function nn(e){return gt(e.getUTCHours(),2)+":"+gt(e.getUTCMinutes(),2)+":"+gt(e.getUTCSeconds(),2)}function rn(e,t=!1){let n=e<0?"-":"+",r=Math.abs(e),i=Math.floor(r/60),s=Math.round(r%60);return t?`${n+gt(i,2)}:${gt(s,2)}`:`GMT${n}${i}${s?":"+gt(s,2):""}`}const sn=/^\s*(\d{4})(-?(\d{2})(-?(\d{2})([T ](\d{2}):?(\d{2})(:?(\d{2})(\.(\d+))?)?(Z|(([-+])(\d{2})(:?(\d{2}))?))?)?)?)?$/;function on(e){let t=sn.exec(e);if(t){let e=new Date(Date.UTC(Number(t[1]),t[3]?Number(t[3])-1:0,Number(t[5]||1),Number(t[7]||0),Number(t[8]||0),Number(t[10]||0),t[12]?1e3*Number("0."+t[12]):0));if(Ht(e)){let n=null;return t[13]&&(n=("-"===t[15]?-1:1)*(60*Number(t[16]||0)+Number(t[18]||0))),{marker:e,isTimeUnspecified:!t[6],timeZoneOffset:n}}}return null}class ln{constructor(e){let t=this.timeZone=e.timeZone,n="local"!==t&&"UTC"!==t;e.namedTimeZoneImpl&&n&&(this.namedTimeZoneImpl=new e.namedTimeZoneImpl(t)),this.canComputeOffset=Boolean(!n||this.namedTimeZoneImpl),this.calendarSystem=function(e){return new Bt[e]}(e.calendarSystem),this.locale=e.locale,this.weekDow=e.locale.week.dow,this.weekDoy=e.locale.week.doy,"ISO"===e.weekNumberCalculation&&(this.weekDow=1,this.weekDoy=4),"number"==typeof e.firstDay&&(this.weekDow=e.firstDay),"function"==typeof e.weekNumberCalculation&&(this.weekNumberFunc=e.weekNumberCalculation),this.weekText=null!=e.weekText?e.weekText:e.locale.options.weekText,this.weekTextLong=(null!=e.weekTextLong?e.weekTextLong:e.locale.options.weekTextLong)||this.weekText,this.cmdFormatter=e.cmdFormatter,this.defaultSeparator=e.defaultSeparator}createMarker(e){let t=this.createMarkerMeta(e);return null===t?null:t.marker}createNowMarker(){return this.canComputeOffset?this.timestampToMarker((new Date).valueOf()):Pt(It(new Date))}createMarkerMeta(e){if("string"==typeof e)return this.parse(e);let t=null;return"number"==typeof e?t=this.timestampToMarker(e):e instanceof Date?(e=e.valueOf(),isNaN(e)||(t=this.timestampToMarker(e))):Array.isArray(e)&&(t=Pt(e)),null!==t&&Ht(t)?{marker:t,isTimeUnspecified:!1,forcedTzo:null}:null}parse(e){let t=on(e);if(null===t)return null;let{marker:n}=t,r=null;return null!==t.timeZoneOffset&&(this.canComputeOffset?n=this.timestampToMarker(n.valueOf()-60*t.timeZoneOffset*1e3):r=t.timeZoneOffset),{marker:n,isTimeUnspecified:t.isTimeUnspecified,forcedTzo:r}}getYear(e){return this.calendarSystem.getMarkerYear(e)}getMonth(e){return this.calendarSystem.getMarkerMonth(e)}add(e,t){let n=this.calendarSystem.markerToArray(e);return n[0]+=t.years,n[1]+=t.months,n[2]+=t.days,n[6]+=t.milliseconds,this.calendarSystem.arrayToMarker(n)}subtract(e,t){let n=this.calendarSystem.markerToArray(e);return n[0]-=t.years,n[1]-=t.months,n[2]-=t.days,n[6]-=t.milliseconds,this.calendarSystem.arrayToMarker(n)}addYears(e,t){let n=this.calendarSystem.markerToArray(e);return n[0]+=t,this.calendarSystem.arrayToMarker(n)}addMonths(e,t){let n=this.calendarSystem.markerToArray(e);return n[1]+=t,this.calendarSystem.arrayToMarker(n)}diffWholeYears(e,t){let{calendarSystem:n}=this;return Wt(e)===Wt(t)&&n.getMarkerDay(e)===n.getMarkerDay(t)&&n.getMarkerMonth(e)===n.getMarkerMonth(t)?n.getMarkerYear(t)-n.getMarkerYear(e):null}diffWholeMonths(e,t){let{calendarSystem:n}=this;return Wt(e)===Wt(t)&&n.getMarkerDay(e)===n.getMarkerDay(t)?n.getMarkerMonth(t)-n.getMarkerMonth(e)+12*(n.getMarkerYear(t)-n.getMarkerYear(e)):null}greatestWholeUnit(e,t){let n=this.diffWholeYears(e,t);return null!==n?{unit:"year",value:n}:(n=this.diffWholeMonths(e,t),null!==n?{unit:"month",value:n}:(n=xt(e,t),null!==n?{unit:"week",value:n}:(n=Tt(e,t),null!==n?{unit:"day",value:n}:(n=function(e,t){return(t.valueOf()-e.valueOf())/36e5}(e,t),yt(n)?{unit:"hour",value:n}:(n=function(e,t){return(t.valueOf()-e.valueOf())/6e4}(e,t),yt(n)?{unit:"minute",value:n}:(n=function(e,t){return(t.valueOf()-e.valueOf())/1e3}(e,t),yt(n)?{unit:"second",value:n}:{unit:"millisecond",value:t.valueOf()-e.valueOf()}))))))}countDurationsBetween(e,t,n){let r;return n.years&&(r=this.diffWholeYears(e,t),null!==r)?r/(Qt(n)/365):n.months&&(r=this.diffWholeMonths(e,t),null!==r)?r/function(e){return Qt(e)/30}(n):n.days&&(r=Tt(e,t),null!==r)?r/Qt(n):(t.valueOf()-e.valueOf())/Jt(n)}startOf(e,t){return"year"===t?this.startOfYear(e):"month"===t?this.startOfMonth(e):"week"===t?this.startOfWeek(e):"day"===t?_t(e):"hour"===t?function(e){return Pt([e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours()])}(e):"minute"===t?function(e){return Pt([e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes()])}(e):"second"===t?function(e){return Pt([e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds()])}(e):null}startOfYear(e){return this.calendarSystem.arrayToMarker([this.calendarSystem.getMarkerYear(e)])}startOfMonth(e){return this.calendarSystem.arrayToMarker([this.calendarSystem.getMarkerYear(e),this.calendarSystem.getMarkerMonth(e)])}startOfWeek(e){return this.calendarSystem.arrayToMarker([this.calendarSystem.getMarkerYear(e),this.calendarSystem.getMarkerMonth(e),e.getUTCDate()-(e.getUTCDay()-this.weekDow+7)%7])}computeWeekNumber(e){return this.weekNumberFunc?this.weekNumberFunc(this.toDate(e)):function(e,t,n){let r=e.getUTCFullYear(),i=kt(e,r,t,n);if(i<1)return kt(e,r-1,t,n);let s=kt(e,r+1,t,n);return s>=1?Math.min(i,s):i}(e,this.weekDow,this.weekDoy)}format(e,t,n={}){return t.format({marker:e,timeZoneOffset:null!=n.forcedTzo?n.forcedTzo:this.offsetForMarker(e)},this)}formatRange(e,t,n,r={}){return r.isEndExclusive&&(t=wt(t,-1)),n.formatRange({marker:e,timeZoneOffset:null!=r.forcedStartTzo?r.forcedStartTzo:this.offsetForMarker(e)},{marker:t,timeZoneOffset:null!=r.forcedEndTzo?r.forcedEndTzo:this.offsetForMarker(t)},this,r.defaultSeparator)}formatIso(e,t={}){let n=null;return t.omitTimeZoneOffset||(n=null!=t.forcedTzo?t.forcedTzo:this.offsetForMarker(e)),en(e,n,t.omitTime)}timestampToMarker(e){return"local"===this.timeZone?Pt(It(new Date(e))):"UTC"!==this.timeZone&&this.namedTimeZoneImpl?Pt(this.namedTimeZoneImpl.timestampToArray(e)):new Date(e)}offsetForMarker(e){return"local"===this.timeZone?-Ot(Nt(e)).getTimezoneOffset():"UTC"===this.timeZone?0:this.namedTimeZoneImpl?this.namedTimeZoneImpl.offsetForArray(Nt(e)):null}toDate(e,t){return"local"===this.timeZone?Ot(Nt(e)):"UTC"===this.timeZone?new Date(e.valueOf()):this.namedTimeZoneImpl?new Date(e.valueOf()-1e3*this.namedTimeZoneImpl.offsetForArray(Nt(e))*60):new Date(e.valueOf()-(t||0))}}class an{constructor(e){this.iconOverrideOption&&this.setIconOverride(e[this.iconOverrideOption])}setIconOverride(e){let t,n;if("object"==typeof e&&e){for(n in t=Object.assign({},this.iconClasses),e)t[n]=this.applyIconOverridePrefix(e[n]);this.iconClasses=t}else!1===e&&(this.iconClasses={})}applyIconOverridePrefix(e){let t=this.iconOverridePrefix;return t&&0!==e.indexOf(t)&&(e=t+e),e}getClass(e){return this.classes[e]||""}getIconClass(e,t){let n;return n=t&&this.rtlIconClasses&&this.rtlIconClasses[e]||this.iconClasses[e],n?`${this.baseIconClass} ${n}`:""}getCustomButtonIconClass(e){let t;return this.iconOverrideCustomButtonOption&&(t=e[this.iconOverrideCustomButtonOption],t)?`${this.baseIconClass} ${this.applyIconOverridePrefix(t)}`:""}}an.prototype.classes={},an.prototype.iconClasses={},an.prototype.baseIconClass="",an.prototype.iconOverridePrefix="";const cn={week:3,separator:0,omitZeroMinute:0,meridiem:0,omitCommas:0},dn={timeZoneName:7,era:6,year:5,month:4,day:2,weekday:2,hour:1,minute:1,second:1},un=/\s*([ap])\.?m\.?/i,hn=/,/g,fn=/\s+/g,pn=/\u200e/g,gn=/UTC|GMT/;class mn{constructor(e){let t={},n={},r=0;for(let i in e)i in cn?(n[i]=e[i],r=Math.max(cn[i],r)):(t[i]=e[i],i in dn&&(r=Math.max(dn[i],r)));this.standardDateProps=t,this.extendedSettings=n,this.severity=r,this.buildFormattingFunc=Pe(vn)}format(e,t){return this.buildFormattingFunc(this.standardDateProps,this.extendedSettings,t)(e)}formatRange(e,t,n,r){let{standardDateProps:i,extendedSettings:s}=this,o=function(e,t,n){if(n.getMarkerYear(e)!==n.getMarkerYear(t))return 5;if(n.getMarkerMonth(e)!==n.getMarkerMonth(t))return 4;if(n.getMarkerDay(e)!==n.getMarkerDay(t))return 2;if(Wt(e)!==Wt(t))return 1;return 0}(e.marker,t.marker,n.calendarSystem);if(!o)return this.format(e,n);let l=o;!(l>1)||"numeric"!==i.year&&"2-digit"!==i.year||"numeric"!==i.month&&"2-digit"!==i.month||"numeric"!==i.day&&"2-digit"!==i.day||(l=1);let a=this.format(e,n),c=this.format(t,n);if(a===c)return a;let d=vn(function(e,t){let n={};for(let r in e)(!(r in dn)||dn[r]<=t)&&(n[r]=e[r]);return n}(i,l),s,n),u=d(e),h=d(t),f=function(e,t,n,r){let i=0;for(;i<e.length;){let s=e.indexOf(t,i);if(-1===s)break;let o=e.substr(0,s);i=s+t.length;let l=e.substr(i),a=0;for(;a<n.length;){let e=n.indexOf(r,a);if(-1===e)break;let t=n.substr(0,e);a=e+r.length;let i=n.substr(a);if(o===t&&l===i)return{before:o,after:l}}}return null}(a,u,c,h),p=s.separator||r||n.defaultSeparator||"";return f?f.before+u+p+h+f.after:a+p+c}getLargestUnit(){switch(this.severity){case 7:case 6:case 5:return"year";case 4:return"month";case 3:return"week";case 2:return"day";default:return"time"}}}function vn(e,t,n){let r=Object.keys(e).length;return 1===r&&"short"===e.timeZoneName?e=>rn(e.timeZoneOffset):0===r&&t.week?e=>function(e,t,n,r,i){let s=[];"long"===i?s.push(n):"short"!==i&&"narrow"!==i||s.push(t);"long"!==i&&"short"!==i||s.push(" ");s.push(r.simpleNumberFormat.format(e)),"rtl"===r.options.direction&&s.reverse();return s.join("")}(n.computeWeekNumber(e.marker),n.weekText,n.weekTextLong,n.locale,t.week):function(e,t,n){e=Object.assign({},e),t=Object.assign({},t),function(e,t){e.timeZoneName&&(e.hour||(e.hour="2-digit"),e.minute||(e.minute="2-digit"));"long"===e.timeZoneName&&(e.timeZoneName="short");t.omitZeroMinute&&(e.second||e.millisecond)&&delete t.omitZeroMinute}(e,t),e.timeZone="UTC";let r,i=new Intl.DateTimeFormat(n.locale.codes,e);if(t.omitZeroMinute){let t=Object.assign({},e);delete t.minute,r=new Intl.DateTimeFormat(n.locale.codes,t)}return s=>{let o,{marker:l}=s;return o=r&&!l.getUTCMinutes()?r:i,function(e,t,n,r,i){e=e.replace(pn,""),"short"===n.timeZoneName&&(e=function(e,t){let n=!1;e=e.replace(gn,()=>(n=!0,t)),n||(e+=" "+t);return e}(e,"UTC"===i.timeZone||null==t.timeZoneOffset?"UTC":rn(t.timeZoneOffset)));r.omitCommas&&(e=e.replace(hn,"").trim());r.omitZeroMinute&&(e=e.replace(":00",""));!1===r.meridiem?e=e.replace(un,"").trim():"narrow"===r.meridiem?e=e.replace(un,(e,t)=>t.toLocaleLowerCase()):"short"===r.meridiem?e=e.replace(un,(e,t)=>t.toLocaleLowerCase()+"m"):"lowercase"===r.meridiem&&(e=e.replace(un,e=>e.toLocaleLowerCase()));return e=(e=e.replace(fn," ")).trim()}(o.format(l),s,e,t,n)}}(e,t,n)}function yn(e,t){let n=t.markerToArray(e.marker);return{marker:e.marker,timeZoneOffset:e.timeZoneOffset,array:n,year:n[0],month:n[1],day:n[2],hour:n[3],minute:n[4],second:n[5],millisecond:n[6]}}function bn(e,t,n,r){let i=yn(e,n.calendarSystem);return{date:i,start:i,end:t?yn(t,n.calendarSystem):null,timeZone:n.timeZone,localeCodes:n.locale.codes,defaultSeparator:r||n.defaultSeparator}}class Sn{constructor(e){this.cmdStr=e}format(e,t,n){return t.cmdFormatter(this.cmdStr,bn(e,null,t,n))}formatRange(e,t,n,r){return n.cmdFormatter(this.cmdStr,bn(e,t,n,r))}}class En{constructor(e){this.func=e}format(e,t,n){return this.func(bn(e,null,t,n))}formatRange(e,t,n,r){return this.func(bn(e,t,n,r))}}function Cn(e){return"object"==typeof e&&e?new mn(e):"string"==typeof e?new Sn(e):"function"==typeof e?new En(e):null}const wn={navLinkDayClick:In,navLinkWeekClick:In,duration:Gt,bootstrapFontAwesome:In,buttonIcons:In,customButtons:In,defaultAllDayEventDuration:Gt,defaultTimedEventDuration:Gt,nextDayThreshold:Gt,scrollTime:Gt,scrollTimeReset:Boolean,slotMinTime:Gt,slotMaxTime:Gt,dayPopoverFormat:Cn,slotDuration:Gt,snapDuration:Gt,headerToolbar:In,footerToolbar:In,defaultRangeSeparator:String,titleRangeSeparator:String,forceEventDuration:Boolean,dayHeaders:Boolean,dayHeaderFormat:Cn,dayHeaderClassNames:In,dayHeaderContent:In,dayHeaderDidMount:In,dayHeaderWillUnmount:In,dayCellClassNames:In,dayCellContent:In,dayCellDidMount:In,dayCellWillUnmount:In,initialView:String,aspectRatio:Number,weekends:Boolean,weekNumberCalculation:In,weekNumbers:Boolean,weekNumberClassNames:In,weekNumberContent:In,weekNumberDidMount:In,weekNumberWillUnmount:In,editable:Boolean,viewClassNames:In,viewDidMount:In,viewWillUnmount:In,nowIndicator:Boolean,nowIndicatorClassNames:In,nowIndicatorContent:In,nowIndicatorDidMount:In,nowIndicatorWillUnmount:In,showNonCurrentDates:Boolean,lazyFetching:Boolean,startParam:String,endParam:String,timeZoneParam:String,timeZone:String,locales:In,locale:In,themeSystem:String,dragRevertDuration:Number,dragScroll:Boolean,allDayMaintainDuration:Boolean,unselectAuto:Boolean,dropAccept:In,eventOrder:ut,eventOrderStrict:Boolean,handleWindowResize:Boolean,windowResizeDelay:Number,longPressDelay:Number,eventDragMinDistance:Number,expandRows:Boolean,height:In,contentHeight:In,direction:String,weekNumberFormat:Cn,eventResizableFromStart:Boolean,displayEventTime:Boolean,displayEventEnd:Boolean,weekText:String,weekTextLong:String,progressiveEventRendering:Boolean,businessHours:In,initialDate:In,now:In,eventDataTransform:In,stickyHeaderDates:In,stickyFooterScrollbar:In,viewHeight:In,defaultAllDay:Boolean,eventSourceFailure:In,eventSourceSuccess:In,eventDisplay:String,eventStartEditable:Boolean,eventDurationEditable:Boolean,eventOverlap:In,eventConstraint:In,eventAllow:In,eventBackgroundColor:String,eventBorderColor:String,eventTextColor:String,eventColor:String,eventClassNames:In,eventContent:In,eventDidMount:In,eventWillUnmount:In,selectConstraint:In,selectOverlap:In,selectAllow:In,droppable:Boolean,unselectCancel:String,slotLabelFormat:In,slotLaneClassNames:In,slotLaneContent:In,slotLaneDidMount:In,slotLaneWillUnmount:In,slotLabelClassNames:In,slotLabelContent:In,slotLabelDidMount:In,slotLabelWillUnmount:In,dayMaxEvents:In,dayMaxEventRows:In,dayMinWidth:Number,slotLabelInterval:Gt,allDayText:String,allDayClassNames:In,allDayContent:In,allDayDidMount:In,allDayWillUnmount:In,slotMinWidth:Number,navLinks:Boolean,eventTimeFormat:Cn,rerenderDelay:Number,moreLinkText:In,moreLinkHint:In,selectMinDistance:Number,selectable:Boolean,selectLongPressDelay:Number,eventLongPressDelay:Number,selectMirror:Boolean,eventMaxStack:Number,eventMinHeight:Number,eventMinWidth:Number,eventShortHeight:Number,slotEventOverlap:Boolean,plugins:In,firstDay:Number,dayCount:Number,dateAlignment:String,dateIncrement:Gt,hiddenDays:In,monthMode:Boolean,fixedWeekCount:Boolean,validRange:In,visibleRange:In,titleFormat:In,eventInteractive:Boolean,noEventsText:String,viewHint:In,navLinkHint:In,closeHint:String,timeHint:String,eventHint:String,moreLinkClick:In,moreLinkClassNames:In,moreLinkContent:In,moreLinkDidMount:In,moreLinkWillUnmount:In,handleCustomRendering:In,customRenderingMetaMap:In,customRenderingReplacesEl:Boolean},Dn={eventDisplay:"auto",defaultRangeSeparator:" - ",titleRangeSeparator:" – ",defaultTimedEventDuration:"01:00:00",defaultAllDayEventDuration:{day:1},forceEventDuration:!1,nextDayThreshold:"00:00:00",dayHeaders:!0,initialView:"",aspectRatio:1.35,headerToolbar:{start:"title",center:"",end:"today prev,next"},weekends:!0,weekNumbers:!1,weekNumberCalculation:"local",editable:!1,nowIndicator:!1,scrollTime:"06:00:00",scrollTimeReset:!0,slotMinTime:"00:00:00",slotMaxTime:"24:00:00",showNonCurrentDates:!0,lazyFetching:!0,startParam:"start",endParam:"end",timeZoneParam:"timeZone",timeZone:"local",locales:[],locale:"",themeSystem:"standard",dragRevertDuration:500,dragScroll:!0,allDayMaintainDuration:!1,unselectAuto:!0,dropAccept:"*",eventOrder:"start,-duration,allDay,title",dayPopoverFormat:{month:"long",day:"numeric",year:"numeric"},handleWindowResize:!0,windowResizeDelay:100,longPressDelay:1e3,eventDragMinDistance:5,expandRows:!1,navLinks:!1,selectable:!1,eventMinHeight:15,eventMinWidth:30,eventShortHeight:30},Rn={datesSet:In,eventsSet:In,eventAdd:In,eventChange:In,eventRemove:In,windowResize:In,eventClick:In,eventMouseEnter:In,eventMouseLeave:In,select:In,unselect:In,loading:In,_unmount:In,_beforeprint:In,_afterprint:In,_noEventDrop:In,_noEventResize:In,_resize:In,_scrollRequest:In},An={buttonText:In,buttonHints:In,views:In,plugins:In,initialEvents:In,events:In,eventSources:In},xn={headerToolbar:Tn,footerToolbar:Tn,buttonText:Tn,buttonHints:Tn,buttonIcons:Tn,dateIncrement:Tn};function Tn(e,t){return"object"==typeof e&&"object"==typeof t&&e&&t?xe(e,t):e===t}const _n={type:String,component:In,buttonText:String,buttonTextKey:String,dateProfileGeneratorClass:In,usesMinMaxTime:Boolean,classNames:In,content:In,didMount:In,willUnmount:In};function kn(e){return Ce(e,xn)}function Mn(e,t){let n={},r={};for(let r in t)r in e&&(n[r]=t[r](e[r]));for(let n in e)n in t||(r[n]=e[n]);return{refined:n,extra:r}}function In(e){return e}function On(e){e();let t=n.debounceRendering,r=[];for(n.debounceRendering=function(e){r.push(e)},P(f(Nn,{}),document.createElement("div"));r.length;)r.shift()();n.debounceRendering=t}class Nn extends m{render(){return f("div",{})}componentDidMount(){this.setState({})}}function Pn(e){let t=function(e,t){var n={__c:t="__cC"+l++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var n,r;return this.getChildContext||(n=[],(r={})[t]=this,this.getChildContext=function(){return r},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&n.some(b)},this.sub=function(e){n.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n.splice(n.indexOf(e),1),t&&t.call(e)}}),e.children}};return n.Provider.__=n.Consumer.contextType=n}(e),n=t.Provider;return t.Provider=function(){let e=!this.getChildContext,t=n.apply(this,arguments);if(e){let e=[];this.shouldComponentUpdate=t=>{this.props.value!==t.value&&e.forEach(e=>{e.context=t.value,e.forceUpdate()})},this.sub=t=>{e.push(t);let n=t.componentWillUnmount;t.componentWillUnmount=()=>{e.splice(e.indexOf(t),1),n&&n.call(t)}}}return t},t}class Hn{constructor(e,t,n,r){this.execFunc=e,this.emitter=t,this.scrollTime=n,this.scrollTimeReset=r,this.handleScrollRequest=e=>{this.queuedRequest=Object.assign({},this.queuedRequest||{},e),this.drain()},t.on("_scrollRequest",this.handleScrollRequest),this.fireInitialScroll()}detach(){this.emitter.off("_scrollRequest",this.handleScrollRequest)}update(e){e&&this.scrollTimeReset?this.fireInitialScroll():this.drain()}fireInitialScroll(){this.handleScrollRequest({time:this.scrollTime})}drain(){this.queuedRequest&&this.execFunc(this.queuedRequest)&&(this.queuedRequest=null)}}const Wn=Pn({});function Bn(e,t,n,r,i,s,o,l,a,c,d,u,h){return{dateEnv:i,options:n,pluginHooks:o,emitter:c,dispatch:l,getCurrentData:a,calendarApi:d,viewSpec:e,viewApi:t,dateProfileGenerator:r,theme:s,isRtl:"rtl"===n.direction,addResizeHandler(e){c.on("_resize",e)},removeResizeHandler(e){c.off("_resize",e)},createScrollResponder:e=>new Hn(e,c,Gt(n.scrollTime),n.scrollTimeReset),registerInteractiveComponent:u,unregisterInteractiveComponent:h}}class jn extends m{shouldComponentUpdate(e,t){return this.debug&&console.log(_e(e,this.props),_e(t,this.state)),!ke(this.props,e,this.propEquality)||!ke(this.state,t,this.stateEquality)}safeSetState(e){ke(this.state,Object.assign(Object.assign({},this.state),e),this.stateEquality)||this.setState(e)}}jn.addPropsEquality=function(e){let t=Object.create(this.prototype.propEquality);Object.assign(t,e),this.prototype.propEquality=t},jn.addStateEquality=function(e){let t=Object.create(this.prototype.stateEquality);Object.assign(t,e),this.prototype.stateEquality=t},jn.contextType=Wn,jn.prototype.propEquality={},jn.prototype.stateEquality={};class Ln extends jn{}function zn(e,t){"function"==typeof e?e(t):e&&(e.current=t)}Ln.contextType=Wn;class Un extends Ln{constructor(){super(...arguments),this.id=it(),this.currentDomNodes=[],this.queuedDomNodes=[],this.handleEl=e=>{this.props.elRef&&zn(this.props.elRef,e)}}render(){const{props:e,context:t}=this,{options:n}=t,{generator:r,renderProps:s}=e,o=Fn(e);let l,a=[];if(Gn(e.generatorName,n))n.customRenderingReplacesEl&&delete o.elRef;else{const e="function"==typeof r?r(s,f):r;"string"==typeof e||i(e)||Array.isArray(e)?l=e:"object"==typeof e&&("html"in e?o.dangerouslySetInnerHTML={__html:e.html}:"domNodes"in e&&(a=Array.prototype.slice.call(e.domNodes)))}return this.queuedDomNodes=a,f(e.elTag,o,l)}componentDidMount(){this.applyQueueudDomNodes(),this.triggerCustomRendering(!0)}componentDidUpdate(){this.applyQueueudDomNodes(),this.triggerCustomRendering(!0)}componentWillUnmount(){this.triggerCustomRendering(!1)}triggerCustomRendering(e){const{props:t,context:n}=this,{handleCustomRendering:r,customRenderingMetaMap:i}=n.options;if(r){const n=null==i?void 0:i[t.generatorName];n&&r(Object.assign({id:this.id,isActive:e,containerEl:this.base,reportNewContainerEl:this.handleEl,generatorMeta:n},t))}}applyQueueudDomNodes(){const{queuedDomNodes:e,currentDomNodes:t}=this,n=this.base;if(!Ne(e,t)){t.forEach(je);for(let t of e)n.appendChild(t);this.currentDomNodes=e}}}function Gn(e,t){var n;return Boolean(t.handleCustomRendering&&e&&(null===(n=t.customRenderingMetaMap)||void 0===n?void 0:n[e]))}function Fn(e,t){const n=Object.assign(Object.assign({},e.elAttrs),{ref:e.elRef});return(e.elClasses||t)&&(n.className=(e.elClasses||[]).concat(t||[]).concat(n.className||[]).filter(Boolean).join(" ")),e.elStyle&&(n.style=e.elStyle),n}Un.addPropsEquality({elClasses:Ne,elStyle:xe,elAttrs:function(e,t){const n=_e(e,t);for(let e of n)if(!Te.test(e))return!1;return!0},renderProps:xe});const Vn=Pn(0);class qn extends m{constructor(){super(...arguments),this.InnerContent=Yn.bind(void 0,this)}render(){const{props:e}=this,t=function(e,t){const n="function"==typeof e?e(t):e||[];return"string"==typeof n?[n]:n}(e.classNameGenerator,e.renderProps);if(e.children){const n=Fn(e,t),r=e.children(this.InnerContent,e.renderProps,n);return e.elTag?f(e.elTag,n,r):r}return f(Un,Object.assign(Object.assign({},e),{elTag:e.elTag||"div",elClasses:(e.elClasses||[]).concat(t),renderId:this.context}))}componentDidMount(){var e,t;null===(t=(e=this.props).didMount)||void 0===t||t.call(e,Object.assign(Object.assign({},this.props.renderProps),{el:this.base}))}componentWillUnmount(){var e,t;null===(t=(e=this.props).willUnmount)||void 0===t||t.call(e,Object.assign(Object.assign({},this.props.renderProps),{el:this.base}))}}function Yn(e,t){const n=e.props;return f(Un,Object.assign({renderProps:n.renderProps,generatorName:n.generatorName,generator:n.generator,renderId:e.context},t))}qn.contextType=Vn;class Qn extends Ln{render(){let{props:e,context:t}=this,{options:n}=t,r={view:t.viewApi};return f(qn,Object.assign({},e,{elTag:e.elTag||"div",elClasses:[...Zn(e.viewSpec),...e.elClasses||[]],renderProps:r,classNameGenerator:n.viewClassNames,generatorName:void 0,generator:void 0,didMount:n.viewDidMount,willUnmount:n.viewWillUnmount}),()=>e.children)}}function Zn(e){return[`fc-${e.type}-view`,"fc-view"]}function Xn(e,t){let n,r,i=[],{start:s}=t;for(e.sort(Jn),n=0;n<e.length;n+=1)r=e[n],r.start>s&&i.push({start:s,end:r.start}),r.end>s&&(s=r.end);return s<t.end&&i.push({start:s,end:t.end}),i}function Jn(e,t){return e.start.valueOf()-t.start.valueOf()}function $n(e,t){let{start:n,end:r}=e,i=null;return null!==t.start&&(n=null===n?t.start:new Date(Math.max(n.valueOf(),t.start.valueOf()))),null!=t.end&&(r=null===r?t.end:new Date(Math.min(r.valueOf(),t.end.valueOf()))),(null===n||null===r||n<r)&&(i={start:n,end:r}),i}function Kn(e,t){return(null===e.start?null:e.start.valueOf())===(null===t.start?null:t.start.valueOf())&&(null===e.end?null:e.end.valueOf())===(null===t.end?null:t.end.valueOf())}function er(e,t){return(null===e.end||null===t.start||e.end>t.start)&&(null===e.start||null===t.end||e.start<t.end)}function tr(e,t){return(null===e.start||null!==t.start&&t.start>=e.start)&&(null===e.end||null!==t.end&&t.end<=e.end)}function nr(e,t){return(null===e.start||t>=e.start)&&(null===e.end||t<e.end)}function rr(e){let t=Math.floor(Rt(e.start,e.end))||1,n=_t(e.start);return{start:n,end:Ct(n,t)}}function ir(e,t=Gt(0)){let n=null,r=null;if(e.end){r=_t(e.end);let n=e.end.valueOf()-r.valueOf();n&&n>=Jt(t)&&(r=Ct(r,1))}return e.start&&(n=_t(e.start),r&&r<=n&&(r=Ct(n,1))),{start:n,end:r}}function sr(e){let t=ir(e);return Rt(t.start,t.end)>1}function or(e,t,n,r){return"year"===r?Gt(n.diffWholeYears(e,t),"year"):"month"===r?Gt(n.diffWholeMonths(e,t),"month"):At(e,t)}function lr(e,t){return"function"==typeof e&&(e=e()),null==e?t.createNowMarker():t.createMarker(e)}class ar{constructor(e){this.props=e,this.nowDate=lr(e.nowInput,e.dateEnv),this.initHiddenDays()}buildPrev(e,t,n){let{dateEnv:r}=this.props,i=r.subtract(r.startOf(t,e.currentRangeUnit),e.dateIncrement);return this.build(i,-1,n)}buildNext(e,t,n){let{dateEnv:r}=this.props,i=r.add(r.startOf(t,e.currentRangeUnit),e.dateIncrement);return this.build(i,1,n)}build(e,t,n=!0){let r,i,s,o,l,a,{props:c}=this;var d,u;return r=this.buildValidRange(),r=this.trimHiddenDays(r),n&&(d=e,e=null!=(u=r).start&&d<u.start?u.start:null!=u.end&&d>=u.end?new Date(u.end.valueOf()-1):d),i=this.buildCurrentRangeInfo(e,t),s=/^(year|month|week|day)$/.test(i.unit),o=this.buildRenderRange(this.trimHiddenDays(i.range),i.unit,s),o=this.trimHiddenDays(o),l=o,c.showNonCurrentDates||(l=$n(l,i.range)),l=this.adjustActiveRange(l),l=$n(l,r),a=er(i.range,r),{validRange:r,currentRange:i.range,currentRangeUnit:i.unit,isRangeAllDay:s,activeRange:l,renderRange:o,slotMinTime:c.slotMinTime,slotMaxTime:c.slotMaxTime,isValid:a,dateIncrement:this.buildDateIncrement(i.duration)}}buildValidRange(){let e=this.props.validRangeInput,t="function"==typeof e?e.call(this.props.calendarApi,this.nowDate):e;return this.refineRange(t)||{start:null,end:null}}buildCurrentRangeInfo(e,t){let n,{props:r}=this,i=null,s=null,o=null;return r.duration?(i=r.duration,s=r.durationUnit,o=this.buildRangeFromDuration(e,t,i,s)):(n=this.props.dayCount)?(s="day",o=this.buildRangeFromDayCount(e,t,n)):(o=this.buildCustomVisibleRange(e))?s=r.dateEnv.greatestWholeUnit(o.start,o.end).unit:(i=this.getFallbackDuration(),s=Kt(i).unit,o=this.buildRangeFromDuration(e,t,i,s)),{duration:i,unit:s,range:o}}getFallbackDuration(){return Gt({day:1})}adjustActiveRange(e){let{dateEnv:t,usesMinMaxTime:n,slotMinTime:r,slotMaxTime:i}=this.props,{start:s,end:o}=e;return n&&(Qt(r)<0&&(s=_t(s),s=t.add(s,r)),Qt(i)>1&&(o=_t(o),o=Ct(o,-1),o=t.add(o,i))),{start:s,end:o}}buildRangeFromDuration(e,t,n,r){let i,s,o,{dateEnv:l,dateAlignment:a}=this.props;if(!a){let{dateIncrement:e}=this.props;a=e&&Jt(e)<Jt(n)?Kt(e).unit:r}function c(){i=l.startOf(e,a),s=l.add(i,n),o={start:i,end:s}}return Qt(n)<=1&&this.isHiddenDay(i)&&(i=this.skipHiddenDays(i,t),i=_t(i)),c(),this.trimHiddenDays(o)||(e=this.skipHiddenDays(e,t),c()),o}buildRangeFromDayCount(e,t,n){let r,{dateEnv:i,dateAlignment:s}=this.props,o=0,l=e;s&&(l=i.startOf(l,s)),l=_t(l),l=this.skipHiddenDays(l,t),r=l;do{r=Ct(r,1),this.isHiddenDay(r)||(o+=1)}while(o<n);return{start:l,end:r}}buildCustomVisibleRange(e){let{props:t}=this,n=t.visibleRangeInput,r="function"==typeof n?n.call(t.calendarApi,t.dateEnv.toDate(e)):n,i=this.refineRange(r);return!i||null!=i.start&&null!=i.end?i:null}buildRenderRange(e,t,n){return e}buildDateIncrement(e){let t,{dateIncrement:n}=this.props;return n||((t=this.props.dateAlignment)?Gt(1,t):e||Gt({days:1}))}refineRange(e){if(e){let t=function(e,t){let n=null,r=null;return e.start&&(n=t.createMarker(e.start)),e.end&&(r=t.createMarker(e.end)),n||r?n&&r&&r<n?null:{start:n,end:r}:null}(e,this.props.dateEnv);return t&&(t=ir(t)),t}return null}initHiddenDays(){let e,t=this.props.hiddenDays||[],n=[],r=0;for(!1===this.props.weekends&&t.push(0,6),e=0;e<7;e+=1)(n[e]=-1!==t.indexOf(e))||(r+=1);if(!r)throw new Error("invalid hiddenDays");this.isHiddenDayHash=n}trimHiddenDays(e){let{start:t,end:n}=e;return t&&(t=this.skipHiddenDays(t)),n&&(n=this.skipHiddenDays(n,-1,!0)),null==t||null==n||t<n?{start:t,end:n}:null}isHiddenDay(e){return e instanceof Date&&(e=e.getUTCDay()),this.isHiddenDayHash[e]}skipHiddenDays(e,t=1,n=!1){for(;this.isHiddenDayHash[(e.getUTCDay()+(n?t:0)+7)%7];)e=Ct(e,t);return e}}function cr(e,t,n,r){return{instanceId:it(),defId:e,range:t,forcedStartTzo:null==n?null:n,forcedEndTzo:null==r?null:r}}function dr(e,t,n){let{dateEnv:r,pluginHooks:i,options:s}=n,{defs:o,instances:l}=e;l=we(l,e=>!o[e.defId].recurringDef);for(let e in o){let n=o[e];if(n.recurringDef){let{duration:o}=n.recurringDef;o||(o=n.allDay?s.defaultAllDayEventDuration:s.defaultTimedEventDuration);let a=ur(n,o,t,r,i.recurringTypes);for(let t of a){let n=cr(e,{start:t,end:r.add(t,o)});l[n.instanceId]=n}}}return{defs:o,instances:l}}function ur(e,t,n,r,i){let s=i[e.recurringDef.typeId].expand(e.recurringDef.typeData,{start:r.subtract(n.start,t),end:n.end},r);return e.allDay&&(s=s.map(_t)),s}const hr={id:String,groupId:String,title:String,url:String,interactive:Boolean},fr={start:In,end:In,date:In,allDay:Boolean},pr=Object.assign(Object.assign(Object.assign({},hr),fr),{extendedProps:In});function gr(e,t,n,r,i=vr(n)){let{refined:s,extra:o}=mr(e,n,i),l=function(e,t){let n=null;e&&(n=e.defaultAllDay);null==n&&(n=t.options.defaultAllDay);return n}(t,n),a=function(e,t,n,r){for(let i=0;i<r.length;i+=1){let s=r[i].parse(e,n);if(s){let{allDay:n}=e;return null==n&&(n=t,null==n&&(n=s.allDayGuess,null==n&&(n=!1))),{allDay:n,duration:s.duration,typeData:s.typeData,typeId:i}}}return null}(s,l,n.dateEnv,n.pluginHooks.recurringTypes);if(a){let e=yr(s,o,t?t.sourceId:"",a.allDay,Boolean(a.duration),n);return e.recurringDef={typeId:a.typeId,typeData:a.typeData,duration:a.duration},{def:e,instance:null}}let c=function(e,t,n,r){let i,s,{allDay:o}=e,l=null,a=!1,c=null,d=null!=e.start?e.start:e.date;if(i=n.dateEnv.createMarkerMeta(d),i)l=i.marker;else if(!r)return null;null!=e.end&&(s=n.dateEnv.createMarkerMeta(e.end));null==o&&(o=null!=t?t:(!i||i.isTimeUnspecified)&&(!s||s.isTimeUnspecified));o&&l&&(l=_t(l));s&&(c=s.marker,o&&(c=_t(c)),l&&c<=l&&(c=null));c?a=!0:r||(a=n.options.forceEventDuration||!1,c=n.dateEnv.add(l,o?n.options.defaultAllDayEventDuration:n.options.defaultTimedEventDuration));return{allDay:o,hasEnd:a,range:{start:l,end:c},forcedStartTzo:i?i.forcedTzo:null,forcedEndTzo:s?s.forcedTzo:null}}(s,l,n,r);if(c){let e=yr(s,o,t?t.sourceId:"",c.allDay,c.hasEnd,n);return{def:e,instance:cr(e.defId,c.range,c.forcedStartTzo,c.forcedEndTzo)}}return null}function mr(e,t,n=vr(t)){return Mn(e,n)}function vr(e){return Object.assign(Object.assign(Object.assign({},Ar),pr),e.pluginHooks.eventRefiners)}function yr(e,t,n,r,i,s){let o={title:e.title||"",groupId:e.groupId||"",publicId:e.id||"",url:e.url||"",recurringDef:null,defId:it(),sourceId:n,allDay:r,hasEnd:i,interactive:e.interactive,ui:Tr(e,s),extendedProps:Object.assign(Object.assign({},e.extendedProps||{}),t)};for(let t of s.pluginHooks.eventDefMemberAdders)Object.assign(o,t(e));return Object.freeze(o.ui.classNames),Object.freeze(o.extendedProps),o}function br(e,t,n,r){let i={defs:{},instances:{}},s=vr(n);for(let o of e){let e=gr(o,t,n,r,s);e&&Sr(e,i)}return i}function Sr(e,t={defs:{},instances:{}}){return t.defs[e.def.defId]=e.def,e.instance&&(t.instances[e.instance.instanceId]=e.instance),t}function Er(e,t){let n=e.instances[t];if(n){let t=e.defs[n.defId],r=Dr(e,e=>{return n=t,r=e,Boolean(n.groupId&&n.groupId===r.groupId);var n,r});return r.defs[t.defId]=t,r.instances[n.instanceId]=n,r}return{defs:{},instances:{}}}function Cr(){return{defs:{},instances:{}}}function wr(e,t){return{defs:Object.assign(Object.assign({},e.defs),t.defs),instances:Object.assign(Object.assign({},e.instances),t.instances)}}function Dr(e,t){let n=we(e.defs,t),r=we(e.instances,e=>n[e.defId]);return{defs:n,instances:r}}function Rr(e){return Array.isArray(e)?e:"string"==typeof e?e.split(/\s+/):[]}const Ar={display:String,editable:Boolean,startEditable:Boolean,durationEditable:Boolean,constraint:In,overlap:In,allow:In,className:Rr,classNames:Rr,color:String,backgroundColor:String,borderColor:String,textColor:String},xr={display:null,startEditable:null,durationEditable:null,constraints:[],overlap:null,allows:[],backgroundColor:"",borderColor:"",textColor:"",classNames:[]};function Tr(e,t){let n=function(e,t){return Array.isArray(e)?br(e,null,t,!0):"object"==typeof e&&e?br([e],null,t,!0):null!=e?String(e):null}(e.constraint,t);return{display:e.display||null,startEditable:null!=e.startEditable?e.startEditable:e.editable,durationEditable:null!=e.durationEditable?e.durationEditable:e.editable,constraints:null!=n?[n]:[],overlap:null!=e.overlap?e.overlap:null,allows:null!=e.allow?[e.allow]:[],backgroundColor:e.backgroundColor||e.color||"",borderColor:e.borderColor||e.color||"",textColor:e.textColor||"",classNames:(e.className||[]).concat(e.classNames||[])}}function _r(e){return e.reduce(kr,xr)}function kr(e,t){return{display:null!=t.display?t.display:e.display,startEditable:null!=t.startEditable?t.startEditable:e.startEditable,durationEditable:null!=t.durationEditable?t.durationEditable:e.durationEditable,constraints:e.constraints.concat(t.constraints),overlap:"boolean"==typeof t.overlap?t.overlap:e.overlap,allows:e.allows.concat(t.allows),backgroundColor:t.backgroundColor||e.backgroundColor,borderColor:t.borderColor||e.borderColor,textColor:t.textColor||e.textColor,classNames:e.classNames.concat(t.classNames)}}const Mr={id:String,defaultAllDay:Boolean,url:String,format:String,events:In,eventDataTransform:In,success:In,failure:In};function Ir(e,t,n=Or(t)){let r;if("string"==typeof e?r={url:e}:"function"==typeof e||Array.isArray(e)?r={events:e}:"object"==typeof e&&e&&(r=e),r){let{refined:i,extra:s}=Mn(r,n),o=function(e,t){let n=t.pluginHooks.eventSourceDefs;for(let t=n.length-1;t>=0;t-=1){let r=n[t].parseMeta(e);if(r)return{sourceDefId:t,meta:r}}return null}(i,t);if(o)return{_raw:e,isFetching:!1,latestFetchId:"",fetchRange:null,defaultAllDay:i.defaultAllDay,eventDataTransform:i.eventDataTransform,success:i.success,failure:i.failure,publicId:i.id||"",sourceId:it(),sourceDefId:o.sourceDefId,meta:o.meta,ui:Tr(i,t),extendedProps:s}}return null}function Or(e){return Object.assign(Object.assign(Object.assign({},Ar),Mr),e.pluginHooks.eventSourceRefiners)}function Nr(e,t,n,r,i){switch(t.type){case"RECEIVE_EVENTS":return function(e,t,n,r,i,s){if(t&&n===t.latestFetchId){let n=br(function(e,t,n){let r=n.options.eventDataTransform,i=t?t.eventDataTransform:null;i&&(e=Pr(e,i));r&&(e=Pr(e,r));return e}(i,t,s),t,s);return r&&(n=dr(n,r,s)),wr(Hr(e,t.sourceId),n)}return e}(e,n[t.sourceId],t.fetchId,t.fetchRange,t.rawEvents,i);case"ADD_EVENTS":return function(e,t,n,r){n&&(t=dr(t,n,r));return wr(e,t)}(e,t.eventStore,r?r.activeRange:null,i);case"RESET_EVENTS":return t.eventStore;case"MERGE_EVENTS":return wr(e,t.eventStore);case"PREV":case"NEXT":case"CHANGE_DATE":case"CHANGE_VIEW_TYPE":return r?dr(e,r.activeRange,i):e;case"REMOVE_EVENTS":return function(e,t){let{defs:n,instances:r}=e,i={},s={};for(let e in n)t.defs[e]||(i[e]=n[e]);for(let e in r)!t.instances[e]&&i[r[e].defId]&&(s[e]=r[e]);return{defs:i,instances:s}}(e,t.eventStore);case"REMOVE_EVENT_SOURCE":return Hr(e,t.sourceId);case"REMOVE_ALL_EVENT_SOURCES":return Dr(e,e=>!e.sourceId);case"REMOVE_ALL_EVENTS":return{defs:{},instances:{}};default:return e}}function Pr(e,t){let n;if(t){n=[];for(let r of e){let e=t(r);e?n.push(e):null==e&&n.push(r)}}else n=e;return n}function Hr(e,t){return Dr(e,e=>e.sourceId!==t)}class Wr{constructor(){this.handlers={},this.thisContext=null}setThisContext(e){this.thisContext=e}setOptions(e){this.options=e}on(e,t){!function(e,t,n){(e[t]||(e[t]=[])).push(n)}(this.handlers,e,t)}off(e,t){!function(e,t,n){n?e[t]&&(e[t]=e[t].filter(e=>e!==n)):delete e[t]}(this.handlers,e,t)}trigger(e,...t){let n=this.handlers[e]||[],r=this.options&&this.options[e],i=[].concat(r||[],n);for(let e of i)e.apply(this.thisContext,t)}hasHandlers(e){return Boolean(this.handlers[e]&&this.handlers[e].length||this.options&&this.options[e])}}const Br={startTime:"09:00",endTime:"17:00",daysOfWeek:[1,2,3,4,5],display:"inverse-background",classNames:"fc-non-business",groupId:"_businessHours"};function jr(e,t){return br(function(e){let t;t=!0===e?[{}]:Array.isArray(e)?e.filter(e=>e.daysOfWeek):"object"==typeof e&&e?[e]:[];return t=t.map(e=>Object.assign(Object.assign({},Br),e)),t}(e),null,t)}function Lr(e,t,n){n.emitter.trigger("select",Object.assign(Object.assign({},zr(e,n)),{jsEvent:t?t.origEvent:null,view:n.viewApi||n.calendarApi.view}))}function zr(e,t){let n={};for(let r of t.pluginHooks.dateSpanTransforms)Object.assign(n,r(e,t));var r,i;return Object.assign(n,(r=e,i=t.dateEnv,Object.assign(Object.assign({},mi(r.range,i,r.allDay)),{allDay:r.allDay}))),n}function Ur(e,t,n){let{dateEnv:r,options:i}=n,s=t;return e?(s=_t(s),s=r.add(s,i.defaultAllDayEventDuration)):s=r.add(s,i.defaultTimedEventDuration),s}function Gr(e,t,n,r){let i=ei(e.defs,t),s={defs:{},instances:{}};for(let t in e.defs){let o=e.defs[t];s.defs[t]=Fr(o,i[t],n,r)}for(let t in e.instances){let o=e.instances[t],l=s.defs[o.defId];s.instances[t]=Vr(o,l,i[o.defId],n,r)}return s}function Fr(e,t,n,r){let i=n.standardProps||{};null==i.hasEnd&&t.durationEditable&&(n.startDelta||n.endDelta)&&(i.hasEnd=!0);let s=Object.assign(Object.assign(Object.assign({},e),i),{ui:Object.assign(Object.assign({},e.ui),i.ui)});n.extendedProps&&(s.extendedProps=Object.assign(Object.assign({},s.extendedProps),n.extendedProps));for(let e of r.pluginHooks.eventDefMutationAppliers)e(s,n,r);return!s.hasEnd&&r.options.forceEventDuration&&(s.hasEnd=!0),s}function Vr(e,t,n,r,i){let{dateEnv:s}=i,o=r.standardProps&&!0===r.standardProps.allDay,l=r.standardProps&&!1===r.standardProps.hasEnd,a=Object.assign({},e);return o&&(a.range=rr(a.range)),r.datesDelta&&n.startEditable&&(a.range={start:s.add(a.range.start,r.datesDelta),end:s.add(a.range.end,r.datesDelta)}),r.startDelta&&n.durationEditable&&(a.range={start:s.add(a.range.start,r.startDelta),end:a.range.end}),r.endDelta&&n.durationEditable&&(a.range={start:a.range.start,end:s.add(a.range.end,r.endDelta)}),l&&(a.range={start:a.range.start,end:Ur(t.allDay,a.range.start,i)}),t.allDay&&(a.range={start:_t(a.range.start),end:_t(a.range.end)}),a.range.end<a.range.start&&(a.range.end=Ur(t.allDay,a.range.start,i)),a}class qr{constructor(e,t){this.context=e,this.internalEventSource=t}remove(){this.context.dispatch({type:"REMOVE_EVENT_SOURCE",sourceId:this.internalEventSource.sourceId})}refetch(){this.context.dispatch({type:"FETCH_EVENT_SOURCES",sourceIds:[this.internalEventSource.sourceId],isRefetch:!0})}get id(){return this.internalEventSource.publicId}get url(){return this.internalEventSource.meta.url}get format(){return this.internalEventSource.meta.format}}class Yr{constructor(e,t,n){this._context=e,this._def=t,this._instance=n||null}setProp(e,t){if(e in fr)console.warn("Could not set date-related prop 'name'. Use one of the date-related methods instead.");else if("id"===e)t=hr[e](t),this.mutate({standardProps:{publicId:t}});else if(e in hr)t=hr[e](t),this.mutate({standardProps:{[e]:t}});else if(e in Ar){let n=Ar[e](t);n="color"===e?{backgroundColor:t,borderColor:t}:"editable"===e?{startEditable:t,durationEditable:t}:{[e]:t},this.mutate({standardProps:{ui:n}})}else console.warn(`Could not set prop '${e}'. Use setExtendedProp instead.`)}setExtendedProp(e,t){this.mutate({extendedProps:{[e]:t}})}setStart(e,t={}){let{dateEnv:n}=this._context,r=n.createMarker(e);if(r&&this._instance){let e=or(this._instance.range.start,r,n,t.granularity);t.maintainDuration?this.mutate({datesDelta:e}):this.mutate({startDelta:e})}}setEnd(e,t={}){let n,{dateEnv:r}=this._context;if((null==e||(n=r.createMarker(e),n))&&this._instance)if(n){let e=or(this._instance.range.end,n,r,t.granularity);this.mutate({endDelta:e})}else this.mutate({standardProps:{hasEnd:!1}})}setDates(e,t,n={}){let r,{dateEnv:i}=this._context,s={allDay:n.allDay},o=i.createMarker(e);var l,a;if(o&&((null==t||(r=i.createMarker(t),r))&&this._instance)){let e=this._instance.range;!0===n.allDay&&(e=rr(e));let t=or(e.start,o,i,n.granularity);if(r){let o=or(e.end,r,i,n.granularity);a=o,(l=t).years===a.years&&l.months===a.months&&l.days===a.days&&l.milliseconds===a.milliseconds?this.mutate({datesDelta:t,standardProps:s}):this.mutate({startDelta:t,endDelta:o,standardProps:s})}else s.hasEnd=!1,this.mutate({datesDelta:t,standardProps:s})}}moveStart(e){let t=Gt(e);t&&this.mutate({startDelta:t})}moveEnd(e){let t=Gt(e);t&&this.mutate({endDelta:t})}moveDates(e){let t=Gt(e);t&&this.mutate({datesDelta:t})}setAllDay(e,t={}){let n={allDay:e},{maintainDuration:r}=t;null==r&&(r=this._context.options.allDayMaintainDuration),this._def.allDay!==e&&(n.hasEnd=r),this.mutate({standardProps:n})}formatRange(e){let{dateEnv:t}=this._context,n=this._instance,r=Cn(e);return this._def.hasEnd?t.formatRange(n.range.start,n.range.end,r,{forcedStartTzo:n.forcedStartTzo,forcedEndTzo:n.forcedEndTzo}):t.format(n.range.start,r,{forcedTzo:n.forcedStartTzo})}mutate(e){let t=this._instance;if(t){let n=this._def,r=this._context,{eventStore:i}=r.getCurrentData(),s=Er(i,t.instanceId);s=Gr(s,{"":{display:"",startEditable:!0,durationEditable:!0,constraints:[],overlap:null,allows:[],backgroundColor:"",borderColor:"",textColor:"",classNames:[]}},e,r);let o=new Yr(r,n,t);this._def=s.defs[n.defId],this._instance=s.instances[t.instanceId],r.dispatch({type:"MERGE_EVENTS",eventStore:s}),r.emitter.trigger("eventChange",{oldEvent:o,event:this,relatedEvents:Zr(s,r,t),revert(){r.dispatch({type:"RESET_EVENTS",eventStore:i})}})}}remove(){let e=this._context,t=Qr(this);e.dispatch({type:"REMOVE_EVENTS",eventStore:t}),e.emitter.trigger("eventRemove",{event:this,relatedEvents:[],revert(){e.dispatch({type:"MERGE_EVENTS",eventStore:t})}})}get source(){let{sourceId:e}=this._def;return e?new qr(this._context,this._context.getCurrentData().eventSources[e]):null}get start(){return this._instance?this._context.dateEnv.toDate(this._instance.range.start):null}get end(){return this._instance&&this._def.hasEnd?this._context.dateEnv.toDate(this._instance.range.end):null}get startStr(){let e=this._instance;return e?this._context.dateEnv.formatIso(e.range.start,{omitTime:this._def.allDay,forcedTzo:e.forcedStartTzo}):""}get endStr(){let e=this._instance;return e&&this._def.hasEnd?this._context.dateEnv.formatIso(e.range.end,{omitTime:this._def.allDay,forcedTzo:e.forcedEndTzo}):""}get id(){return this._def.publicId}get groupId(){return this._def.groupId}get allDay(){return this._def.allDay}get title(){return this._def.title}get url(){return this._def.url}get display(){return this._def.ui.display||"auto"}get startEditable(){return this._def.ui.startEditable}get durationEditable(){return this._def.ui.durationEditable}get constraint(){return this._def.ui.constraints[0]||null}get overlap(){return this._def.ui.overlap}get allow(){return this._def.ui.allows[0]||null}get backgroundColor(){return this._def.ui.backgroundColor}get borderColor(){return this._def.ui.borderColor}get textColor(){return this._def.ui.textColor}get classNames(){return this._def.ui.classNames}get extendedProps(){return this._def.extendedProps}toPlainObject(e={}){let t=this._def,{ui:n}=t,{startStr:r,endStr:i}=this,s={};return t.title&&(s.title=t.title),r&&(s.start=r),i&&(s.end=i),t.publicId&&(s.id=t.publicId),t.groupId&&(s.groupId=t.groupId),t.url&&(s.url=t.url),n.display&&"auto"!==n.display&&(s.display=n.display),e.collapseColor&&n.backgroundColor&&n.backgroundColor===n.borderColor?s.color=n.backgroundColor:(n.backgroundColor&&(s.backgroundColor=n.backgroundColor),n.borderColor&&(s.borderColor=n.borderColor)),n.textColor&&(s.textColor=n.textColor),n.classNames.length&&(s.classNames=n.classNames),Object.keys(t.extendedProps).length&&(e.collapseExtendedProps?Object.assign(s,t.extendedProps):s.extendedProps=t.extendedProps),s}toJSON(){return this.toPlainObject()}}function Qr(e){let t=e._def,n=e._instance;return{defs:{[t.defId]:t},instances:n?{[n.instanceId]:n}:{}}}function Zr(e,t,n){let{defs:r,instances:i}=e,s=[],o=n?n.instanceId:"";for(let e in i){let n=i[e],l=r[n.defId];n.instanceId!==o&&s.push(new Yr(t,l,n))}return s}function Xr(e,t,n,r){let i={},s={},o={},l=[],a=[],c=ei(e.defs,t);for(let t in e.defs){let n=e.defs[t];"inverse-background"===c[n.defId].display&&(n.groupId?(i[n.groupId]=[],o[n.groupId]||(o[n.groupId]=n)):s[t]=[])}for(let t in e.instances){let o=e.instances[t],d=e.defs[o.defId],u=c[d.defId],h=o.range,f=!d.allDay&&r?ir(h,r):h,p=$n(f,n);p&&("inverse-background"===u.display?d.groupId?i[d.groupId].push(p):s[o.defId].push(p):"none"!==u.display&&("background"===u.display?l:a).push({def:d,ui:u,instance:o,range:p,isStart:f.start&&f.start.valueOf()===p.start.valueOf(),isEnd:f.end&&f.end.valueOf()===p.end.valueOf()}))}for(let e in i){let t=Xn(i[e],n);for(let n of t){let t=o[e],r=c[t.defId];l.push({def:t,ui:r,instance:null,range:n,isStart:!1,isEnd:!1})}}for(let t in s){let r=Xn(s[t],n);for(let n of r)l.push({def:e.defs[t],ui:c[t],instance:null,range:n,isStart:!1,isEnd:!1})}return{bg:l,fg:a}}function Jr(e){return"background"===e.ui.display||"inverse-background"===e.ui.display}function $r(e,t){e.fcSeg=t}function Kr(e){return e.fcSeg||e.parentNode.fcSeg||null}function ei(e,t){return De(e,e=>ti(e,t))}function ti(e,t){let n=[];return t[""]&&n.push(t[""]),t[e.defId]&&n.push(t[e.defId]),n.push(e.ui),_r(n)}function ni(e,t){let n=e.map(ri);return n.sort((e,n)=>ht(e,n,t)),n.map(e=>e._seg)}function ri(e){let{eventRange:t}=e,n=t.def,r=t.instance?t.instance.range:t.range,i=r.start?r.start.valueOf():0,s=r.end?r.end.valueOf():0;return Object.assign(Object.assign(Object.assign({},n.extendedProps),n),{id:n.publicId,start:i,end:s,duration:s-i,allDay:Number(n.allDay),_seg:e})}function ii(e,t){let{pluginHooks:n}=t,r=n.isDraggableTransformers,{def:i,ui:s}=e.eventRange,o=s.startEditable;for(let e of r)o=e(o,i,s,t);return o}function si(e,t){return e.isStart&&e.eventRange.ui.durationEditable&&t.options.eventResizableFromStart}function oi(e,t){return e.isEnd&&e.eventRange.ui.durationEditable}function li(e,t,n,r,i,s,o){let{dateEnv:l,options:a}=n,{displayEventTime:c,displayEventEnd:d}=a,u=e.eventRange.def,h=e.eventRange.instance;null==c&&(c=!1!==r),null==d&&(d=!1!==i);let f=h.range.start,p=h.range.end,g=s||e.start||e.eventRange.range.start,m=o||e.end||e.eventRange.range.end,v=_t(f).valueOf()===_t(g).valueOf(),y=_t(wt(p,-1)).valueOf()===_t(wt(m,-1)).valueOf();return c&&!u.allDay&&(v||y)?(g=v?f:g,m=y?p:m,d&&u.hasEnd?l.formatRange(g,m,t,{forcedStartTzo:s?null:h.forcedStartTzo,forcedEndTzo:o?null:h.forcedEndTzo}):l.format(g,t,{forcedTzo:s?null:h.forcedStartTzo})):""}function ai(e,t,n){let r=e.eventRange.range;return{isPast:r.end<(n||t.start),isFuture:r.start>=(n||t.end),isToday:t&&nr(t,r.start)}}function ci(e){let t=["fc-event"];return e.isMirror&&t.push("fc-event-mirror"),e.isDraggable&&t.push("fc-event-draggable"),(e.isStartResizable||e.isEndResizable)&&t.push("fc-event-resizable"),e.isDragging&&t.push("fc-event-dragging"),e.isResizing&&t.push("fc-event-resizing"),e.isSelected&&t.push("fc-event-selected"),e.isStart&&t.push("fc-event-start"),e.isEnd&&t.push("fc-event-end"),e.isPast&&t.push("fc-event-past"),e.isToday&&t.push("fc-event-today"),e.isFuture&&t.push("fc-event-future"),t}function di(e){return e.instance?e.instance.instanceId:`${e.def.defId}:${e.range.start.toISOString()}`}function ui(e,t){let{def:n,instance:r}=e.eventRange,{url:i}=n;if(i)return{href:i};let{emitter:s,options:o}=t,{eventInteractive:l}=o;return null==l&&(l=n.interactive,null==l&&(l=Boolean(s.hasHandlers("eventClick")))),l?nt(e=>{s.trigger("eventClick",{el:e.target,event:new Yr(t,n,r),jsEvent:e,view:t.viewApi})}):{}}const hi={start:In,end:In,allDay:Boolean};function fi(e,t,n){let r=function(e,t){let{refined:n,extra:r}=Mn(e,hi),i=n.start?t.createMarkerMeta(n.start):null,s=n.end?t.createMarkerMeta(n.end):null,{allDay:o}=n;null==o&&(o=i&&i.isTimeUnspecified&&(!s||s.isTimeUnspecified));return Object.assign({range:{start:i?i.marker:null,end:s?s.marker:null},allDay:o},r)}(e,t),{range:i}=r;if(!i.start)return null;if(!i.end){if(null==n)return null;i.end=t.add(i.start,n)}return r}function pi(e,t){return Kn(e.range,t.range)&&e.allDay===t.allDay&&function(e,t){for(let n in t)if("range"!==n&&"allDay"!==n&&e[n]!==t[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}(e,t)}function gi(e,t,n){return Object.assign(Object.assign({},mi(e,t,n)),{timeZone:t.timeZone})}function mi(e,t,n){return{start:t.toDate(e.start),end:t.toDate(e.end),startStr:t.formatIso(e.start,{omitTime:n}),endStr:t.formatIso(e.end,{omitTime:n})}}function vi(e,t,n){let r=!1,i=function(e){r||(r=!0,t(e))},s=function(e){r||(r=!0,n(e))},o=e(i,s);o&&"function"==typeof o.then&&o.then(i,s)}class yi extends Error{constructor(e,t){super(e),this.response=t}}function bi(e,t,n){const r={method:e=e.toUpperCase()};return"GET"===e?t+=(-1===t.indexOf("?")?"?":"&")+new URLSearchParams(n):(r.body=new URLSearchParams(n),r.headers={"Content-Type":"application/x-www-form-urlencoded"}),fetch(t,r).then(e=>{if(e.ok)return e.json().then(t=>[t,e],()=>{throw new yi("Failure parsing JSON",e)});throw new yi("Request failed",e)})}let Si;function Ei(){return null==Si&&(Si=function(){if("undefined"==typeof document)return!0;let e=document.createElement("div");e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.innerHTML="<table><tr><td><div></div></td></tr></table>",e.querySelector("table").style.height="100px",e.querySelector("div").style.height="100%",document.body.appendChild(e);let t=e.querySelector("div").offsetHeight>0;return document.body.removeChild(e),t}()),Si}class Ci extends Ln{constructor(){super(...arguments),this.state={forPrint:!1},this.handleBeforePrint=()=>{this.setState({forPrint:!0})},this.handleAfterPrint=()=>{this.setState({forPrint:!1})}}render(){let{props:e}=this,{options:t}=e,{forPrint:n}=this.state,r=n||"auto"===t.height||"auto"===t.contentHeight,i=r||null==t.height?"":t.height,s=["fc",n?"fc-media-print":"fc-media-screen","fc-direction-"+t.direction,e.theme.getClass("root")];return Ei()||s.push("fc-liquid-hack"),e.children(s,i,r,n)}componentDidMount(){let{emitter:e}=this.props;e.on("_beforeprint",this.handleBeforePrint),e.on("_afterprint",this.handleAfterPrint)}componentWillUnmount(){let{emitter:e}=this.props;e.off("_beforeprint",this.handleBeforePrint),e.off("_afterprint",this.handleAfterPrint)}}class wi{constructor(e){this.component=e.component,this.isHitComboAllowed=e.isHitComboAllowed||null}destroy(){}}function Di(e){return{[e.component.uid]:e}}const Ri={};class Ai{getCurrentData(){return this.currentDataManager.getCurrentData()}dispatch(e){this.currentDataManager.dispatch(e)}get view(){return this.getCurrentData().viewApi}batchRendering(e){e()}updateSize(){this.trigger("_resize",!0)}setOption(e,t){this.dispatch({type:"SET_OPTION",optionName:e,rawOptionValue:t})}getOption(e){return this.currentDataManager.currentCalendarOptionsInput[e]}getAvailableLocaleCodes(){return Object.keys(this.getCurrentData().availableRawLocales)}on(e,t){let{currentDataManager:n}=this;n.currentCalendarOptionsRefiners[e]?n.emitter.on(e,t):console.warn(`Unknown listener name '${e}'`)}off(e,t){this.currentDataManager.emitter.off(e,t)}trigger(e,...t){this.currentDataManager.emitter.trigger(e,...t)}changeView(e,t){this.batchRendering(()=>{if(this.unselect(),t)if(t.start&&t.end)this.dispatch({type:"CHANGE_VIEW_TYPE",viewType:e}),this.dispatch({type:"SET_OPTION",optionName:"visibleRange",rawOptionValue:t});else{let{dateEnv:n}=this.getCurrentData();this.dispatch({type:"CHANGE_VIEW_TYPE",viewType:e,dateMarker:n.createMarker(t)})}else this.dispatch({type:"CHANGE_VIEW_TYPE",viewType:e})})}zoomTo(e,t){let n;t=t||"day",n=this.getCurrentData().viewSpecs[t]||this.getUnitViewSpec(t),this.unselect(),n?this.dispatch({type:"CHANGE_VIEW_TYPE",viewType:n.type,dateMarker:e}):this.dispatch({type:"CHANGE_DATE",dateMarker:e})}getUnitViewSpec(e){let t,n,{viewSpecs:r,toolbarConfig:i}=this.getCurrentData(),s=[].concat(i.header?i.header.viewsWithButtons:[],i.footer?i.footer.viewsWithButtons:[]);for(let e in r)s.push(e);for(t=0;t<s.length;t+=1)if(n=r[s[t]],n&&n.singleUnit===e)return n;return null}prev(){this.unselect(),this.dispatch({type:"PREV"})}next(){this.unselect(),this.dispatch({type:"NEXT"})}prevYear(){let e=this.getCurrentData();this.unselect(),this.dispatch({type:"CHANGE_DATE",dateMarker:e.dateEnv.addYears(e.currentDate,-1)})}nextYear(){let e=this.getCurrentData();this.unselect(),this.dispatch({type:"CHANGE_DATE",dateMarker:e.dateEnv.addYears(e.currentDate,1)})}today(){let e=this.getCurrentData();this.unselect(),this.dispatch({type:"CHANGE_DATE",dateMarker:lr(e.calendarOptions.now,e.dateEnv)})}gotoDate(e){let t=this.getCurrentData();this.unselect(),this.dispatch({type:"CHANGE_DATE",dateMarker:t.dateEnv.createMarker(e)})}incrementDate(e){let t=this.getCurrentData(),n=Gt(e);n&&(this.unselect(),this.dispatch({type:"CHANGE_DATE",dateMarker:t.dateEnv.add(t.currentDate,n)}))}getDate(){let e=this.getCurrentData();return e.dateEnv.toDate(e.currentDate)}formatDate(e,t){let{dateEnv:n}=this.getCurrentData();return n.format(n.createMarker(e),Cn(t))}formatRange(e,t,n){let{dateEnv:r}=this.getCurrentData();return r.formatRange(r.createMarker(e),r.createMarker(t),Cn(n),n)}formatIso(e,t){let{dateEnv:n}=this.getCurrentData();return n.formatIso(n.createMarker(e),{omitTime:t})}select(e,t){let n;n=null==t?null!=e.start?e:{start:e,end:null}:{start:e,end:t};let r=this.getCurrentData(),i=fi(n,r.dateEnv,Gt({days:1}));i&&(this.dispatch({type:"SELECT_DATES",selection:i}),Lr(i,null,r))}unselect(e){let t=this.getCurrentData();t.dateSelection&&(this.dispatch({type:"UNSELECT_DATES"}),function(e,t){t.emitter.trigger("unselect",{jsEvent:e?e.origEvent:null,view:t.viewApi||t.calendarApi.view})}(e,t))}addEvent(e,t){if(e instanceof Yr){let t=e._def,n=e._instance;return this.getCurrentData().eventStore.defs[t.defId]||(this.dispatch({type:"ADD_EVENTS",eventStore:Sr({def:t,instance:n})}),this.triggerEventAdd(e)),e}let n,r=this.getCurrentData();if(t instanceof qr)n=t.internalEventSource;else if("boolean"==typeof t)t&&([n]=Ae(r.eventSources));else if(null!=t){let e=this.getEventSourceById(t);if(!e)return console.warn(`Could not find an event source with ID "${t}"`),null;n=e.internalEventSource}let i=gr(e,n,r,!1);if(i){let e=new Yr(r,i.def,i.def.recurringDef?null:i.instance);return this.dispatch({type:"ADD_EVENTS",eventStore:Sr(i)}),this.triggerEventAdd(e),e}return null}triggerEventAdd(e){let{emitter:t}=this.getCurrentData();t.trigger("eventAdd",{event:e,relatedEvents:[],revert:()=>{this.dispatch({type:"REMOVE_EVENTS",eventStore:Qr(e)})}})}getEventById(e){let t=this.getCurrentData(),{defs:n,instances:r}=t.eventStore;e=String(e);for(let i in n){let s=n[i];if(s.publicId===e){if(s.recurringDef)return new Yr(t,s,null);for(let e in r){let n=r[e];if(n.defId===s.defId)return new Yr(t,s,n)}}}return null}getEvents(){let e=this.getCurrentData();return Zr(e.eventStore,e)}removeAllEvents(){this.dispatch({type:"REMOVE_ALL_EVENTS"})}getEventSources(){let e=this.getCurrentData(),t=e.eventSources,n=[];for(let r in t)n.push(new qr(e,t[r]));return n}getEventSourceById(e){let t=this.getCurrentData(),n=t.eventSources;e=String(e);for(let r in n)if(n[r].publicId===e)return new qr(t,n[r]);return null}addEventSource(e){let t=this.getCurrentData();if(e instanceof qr)return t.eventSources[e.internalEventSource.sourceId]||this.dispatch({type:"ADD_EVENT_SOURCES",sources:[e.internalEventSource]}),e;let n=Ir(e,t);return n?(this.dispatch({type:"ADD_EVENT_SOURCES",sources:[n]}),new qr(t,n)):null}removeAllEventSources(){this.dispatch({type:"REMOVE_ALL_EVENT_SOURCES"})}refetchEvents(){this.dispatch({type:"FETCH_EVENT_SOURCES",isRefetch:!0})}scrollToTime(e){let t=Gt(e);t&&this.trigger("_scrollRequest",{time:t})}}function xi(e,t){return e.left>=t.left&&e.left<t.right&&e.top>=t.top&&e.top<t.bottom}function Ti(e,t){let n={left:Math.max(e.left,t.left),right:Math.min(e.right,t.right),top:Math.max(e.top,t.top),bottom:Math.min(e.bottom,t.bottom)};return n.left<n.right&&n.top<n.bottom&&n}function _i(e,t,n){return{left:e.left+t,right:e.right+t,top:e.top+n,bottom:e.bottom+n}}function ki(e,t){return{left:Math.min(Math.max(e.left,t.left),t.right),top:Math.min(Math.max(e.top,t.top),t.bottom)}}function Mi(e){return{left:(e.left+e.right)/2,top:(e.top+e.bottom)/2}}function Ii(e,t){return{left:e.left-t.left,top:e.top-t.top}}const Oi={defs:{},instances:{}};class Ni{constructor(){this.getKeysForEventDefs=Pe(this._getKeysForEventDefs),this.splitDateSelection=Pe(this._splitDateSpan),this.splitEventStore=Pe(this._splitEventStore),this.splitIndividualUi=Pe(this._splitIndividualUi),this.splitEventDrag=Pe(this._splitInteraction),this.splitEventResize=Pe(this._splitInteraction),this.eventUiBuilders={}}splitProps(e){let t=this.getKeyInfo(e),n=this.getKeysForEventDefs(e.eventStore),r=this.splitDateSelection(e.dateSelection),i=this.splitIndividualUi(e.eventUiBases,n),s=this.splitEventStore(e.eventStore,n),o=this.splitEventDrag(e.eventDrag),l=this.splitEventResize(e.eventResize),a={};this.eventUiBuilders=De(t,(e,t)=>this.eventUiBuilders[t]||Pe(Pi));for(let n in t){let c=t[n],d=s[n]||Oi,u=this.eventUiBuilders[n];a[n]={businessHours:c.businessHours||e.businessHours,dateSelection:r[n]||null,eventStore:d,eventUiBases:u(e.eventUiBases[""],c.ui,i[n]),eventSelection:d.instances[e.eventSelection]?e.eventSelection:"",eventDrag:o[n]||null,eventResize:l[n]||null}}return a}_splitDateSpan(e){let t={};if(e){let n=this.getKeysForDateSpan(e);for(let r of n)t[r]=e}return t}_getKeysForEventDefs(e){return De(e.defs,e=>this.getKeysForEventDef(e))}_splitEventStore(e,t){let{defs:n,instances:r}=e,i={};for(let e in n)for(let r of t[e])i[r]||(i[r]={defs:{},instances:{}}),i[r].defs[e]=n[e];for(let e in r){let n=r[e];for(let r of t[n.defId])i[r]&&(i[r].instances[e]=n)}return i}_splitIndividualUi(e,t){let n={};for(let r in e)if(r)for(let i of t[r])n[i]||(n[i]={}),n[i][r]=e[r];return n}_splitInteraction(e){let t={};if(e){let n=this._splitEventStore(e.affectedEvents,this._getKeysForEventDefs(e.affectedEvents)),r=this._getKeysForEventDefs(e.mutatedEvents),i=this._splitEventStore(e.mutatedEvents,r),s=r=>{t[r]||(t[r]={affectedEvents:n[r]||Oi,mutatedEvents:i[r]||Oi,isEvent:e.isEvent})};for(let e in n)s(e);for(let e in i)s(e)}return t}}function Pi(e,t,n){let r=[];e&&r.push(e),t&&r.push(t);let i={"":_r(r)};return n&&Object.assign(i,n),i}function Hi(e,t,n,r){return{dow:e.getUTCDay(),isDisabled:Boolean(r&&!nr(r.activeRange,e)),isOther:Boolean(r&&!nr(r.currentRange,e)),isToday:Boolean(t&&nr(t,e)),isPast:Boolean(n?e<n:!!t&&e<t.start),isFuture:Boolean(n?e>n:!!t&&e>=t.end)}}function Wi(e,t){let n=["fc-day","fc-day-"+St[e.dow]];return e.isDisabled?n.push("fc-day-disabled"):(e.isToday&&(n.push("fc-day-today"),n.push(t.getClass("today"))),e.isPast&&n.push("fc-day-past"),e.isFuture&&n.push("fc-day-future"),e.isOther&&n.push("fc-day-other")),n}function Bi(e,t){let n=["fc-slot","fc-slot-"+St[e.dow]];return e.isDisabled?n.push("fc-slot-disabled"):(e.isToday&&(n.push("fc-slot-today"),n.push(t.getClass("today"))),e.isPast&&n.push("fc-slot-past"),e.isFuture&&n.push("fc-slot-future")),n}const ji=Cn({year:"numeric",month:"long",day:"numeric"}),Li=Cn({week:"long"});function zi(e,t,n="day",r=!0){const{dateEnv:i,options:s,calendarApi:o}=e;let l=i.format(t,"week"===n?Li:ji);if(s.navLinks){let e=i.toDate(t);const a=e=>{let r="day"===n?s.navLinkDayClick:"week"===n?s.navLinkWeekClick:null;"function"==typeof r?r.call(o,i.toDate(t),e):("string"==typeof r&&(n=r),o.zoomTo(t,n))};return Object.assign({title:mt(s.navLinkHint,[l,e],l),"data-navlink":""},r?tt(a):{onClick:a})}return{"aria-label":l}}let Ui,Gi=null;function Fi(){return null===Gi&&(Gi=function(){let e=document.createElement("div");Ve(e,{position:"absolute",top:-1e3,left:0,border:0,padding:0,overflow:"scroll",direction:"rtl"}),e.innerHTML="<div></div>",document.body.appendChild(e);let t=e.firstChild.getBoundingClientRect().left>e.getBoundingClientRect().left;return je(e),t}()),Gi}function Vi(){return Ui||(Ui=function(){let e=document.createElement("div");e.style.overflow="scroll",e.style.position="absolute",e.style.top="-9999px",e.style.left="-9999px",document.body.appendChild(e);let t=qi(e);return document.body.removeChild(e),t}()),Ui}function qi(e){return{x:e.offsetHeight-e.clientHeight,y:e.offsetWidth-e.clientWidth}}function Yi(e,t=!1){let n=window.getComputedStyle(e),r=parseInt(n.borderLeftWidth,10)||0,i=parseInt(n.borderRightWidth,10)||0,s=parseInt(n.borderTopWidth,10)||0,o=parseInt(n.borderBottomWidth,10)||0,l=qi(e),a=l.y-r-i,c={borderLeft:r,borderRight:i,borderTop:s,borderBottom:o,scrollbarBottom:l.x-s-o,scrollbarLeft:0,scrollbarRight:0};return Fi()&&"rtl"===n.direction?c.scrollbarLeft=a:c.scrollbarRight=a,t&&(c.paddingLeft=parseInt(n.paddingLeft,10)||0,c.paddingRight=parseInt(n.paddingRight,10)||0,c.paddingTop=parseInt(n.paddingTop,10)||0,c.paddingBottom=parseInt(n.paddingBottom,10)||0),c}function Qi(e,t=!1,n){let r=n?e.getBoundingClientRect():Zi(e),i=Yi(e,t),s={left:r.left+i.borderLeft+i.scrollbarLeft,right:r.right-i.borderRight-i.scrollbarRight,top:r.top+i.borderTop,bottom:r.bottom-i.borderBottom-i.scrollbarBottom};return t&&(s.left+=i.paddingLeft,s.right-=i.paddingRight,s.top+=i.paddingTop,s.bottom-=i.paddingBottom),s}function Zi(e){let t=e.getBoundingClientRect();return{left:t.left+window.pageXOffset,top:t.top+window.pageYOffset,right:t.right+window.pageXOffset,bottom:t.bottom+window.pageYOffset}}function Xi(e){let t=[];for(;e instanceof HTMLElement;){let n=window.getComputedStyle(e);if("fixed"===n.position)break;/(auto|scroll)/.test(n.overflow+n.overflowY+n.overflowX)&&t.push(e),e=e.parentNode}return t}class Ji{constructor(e,t,n,r){this.els=t;let i=this.originClientRect=e.getBoundingClientRect();n&&this.buildElHorizontals(i.left),r&&this.buildElVerticals(i.top)}buildElHorizontals(e){let t=[],n=[];for(let r of this.els){let i=r.getBoundingClientRect();t.push(i.left-e),n.push(i.right-e)}this.lefts=t,this.rights=n}buildElVerticals(e){let t=[],n=[];for(let r of this.els){let i=r.getBoundingClientRect();t.push(i.top-e),n.push(i.bottom-e)}this.tops=t,this.bottoms=n}leftToIndex(e){let t,{lefts:n,rights:r}=this,i=n.length;for(t=0;t<i;t+=1)if(e>=n[t]&&e<r[t])return t}topToIndex(e){let t,{tops:n,bottoms:r}=this,i=n.length;for(t=0;t<i;t+=1)if(e>=n[t]&&e<r[t])return t}getWidth(e){return this.rights[e]-this.lefts[e]}getHeight(e){return this.bottoms[e]-this.tops[e]}}class $i{getMaxScrollTop(){return this.getScrollHeight()-this.getClientHeight()}getMaxScrollLeft(){return this.getScrollWidth()-this.getClientWidth()}canScrollVertically(){return this.getMaxScrollTop()>0}canScrollHorizontally(){return this.getMaxScrollLeft()>0}canScrollUp(){return this.getScrollTop()>0}canScrollDown(){return this.getScrollTop()<this.getMaxScrollTop()}canScrollLeft(){return this.getScrollLeft()>0}canScrollRight(){return this.getScrollLeft()<this.getMaxScrollLeft()}}class Ki extends $i{constructor(e){super(),this.el=e}getScrollTop(){return this.el.scrollTop}getScrollLeft(){return this.el.scrollLeft}setScrollTop(e){this.el.scrollTop=e}setScrollLeft(e){this.el.scrollLeft=e}getScrollWidth(){return this.el.scrollWidth}getScrollHeight(){return this.el.scrollHeight}getClientHeight(){return this.el.clientHeight}getClientWidth(){return this.el.clientWidth}}class es extends $i{getScrollTop(){return window.pageYOffset}getScrollLeft(){return window.pageXOffset}setScrollTop(e){window.scroll(window.pageXOffset,e)}setScrollLeft(e){window.scroll(e,window.pageYOffset)}getScrollWidth(){return document.documentElement.scrollWidth}getScrollHeight(){return document.documentElement.scrollHeight}getClientHeight(){return document.documentElement.clientHeight}getClientWidth(){return document.documentElement.clientWidth}}class ts extends Ln{constructor(){super(...arguments),this.uid=it()}prepareHits(){}queryHit(e,t,n,r){return null}isValidSegDownEl(e){return!this.props.eventDrag&&!this.props.eventResize&&!Le(e,".fc-event-mirror")}isValidDateDownEl(e){return!(Le(e,".fc-event:not(.fc-bg-event)")||Le(e,".fc-more-link")||Le(e,"a[data-navlink]")||Le(e,".fc-popover"))}}class ns{constructor(){this.strictOrder=!1,this.allowReslicing=!1,this.maxCoord=-1,this.maxStackCnt=-1,this.levelCoords=[],this.entriesByLevel=[],this.stackCnts={}}addSegs(e){let t=[];for(let n of e)this.insertEntry(n,t);return t}insertEntry(e,t){let n=this.findInsertion(e);return this.isInsertionValid(n,e)?(this.insertEntryAt(e,n),1):this.handleInvalidInsertion(n,e,t)}isInsertionValid(e,t){return(-1===this.maxCoord||e.levelCoord+t.thickness<=this.maxCoord)&&(-1===this.maxStackCnt||e.stackCnt<this.maxStackCnt)}handleInvalidInsertion(e,t,n){return this.allowReslicing&&e.touchingEntry?this.splitEntry(t,e.touchingEntry,n):(n.push(t),0)}splitEntry(e,t,n){let r=0,i=[],s=e.span,o=t.span;return s.start<o.start&&(r+=this.insertEntry({index:e.index,thickness:e.thickness,span:{start:s.start,end:o.start}},i)),s.end>o.end&&(r+=this.insertEntry({index:e.index,thickness:e.thickness,span:{start:o.end,end:s.end}},i)),r?(n.push({index:e.index,thickness:e.thickness,span:os(o,s)},...i),r):(n.push(e),0)}insertEntryAt(e,t){let{entriesByLevel:n,levelCoords:r}=this;-1===t.lateral?(ls(r,t.level,t.levelCoord),ls(n,t.level,[e])):ls(n[t.level],t.lateral,e),this.stackCnts[is(e)]=t.stackCnt}findInsertion(e){let{levelCoords:t,entriesByLevel:n,strictOrder:r,stackCnts:i}=this,s=t.length,o=0,l=-1,a=-1,c=null,d=0;for(let u=0;u<s;u+=1){let s=t[u];if(!r&&s>=o+e.thickness)break;let h,f=n[u],p=as(f,e.span.start,rs),g=p[0]+p[1];for(;(h=f[g])&&h.span.start<e.span.end;){let e=s+h.thickness;e>o&&(o=e,c=h,l=u,a=g),e===o&&(d=Math.max(d,i[is(h)]+1)),g+=1}}let u=0;if(c)for(u=l+1;u<s&&t[u]<o;)u+=1;let h=-1;return u<s&&t[u]===o&&(h=as(n[u],e.span.end,rs)[0]),{touchingLevel:l,touchingLateral:a,touchingEntry:c,stackCnt:d,levelCoord:o,level:u,lateral:h}}toRects(){let{entriesByLevel:e,levelCoords:t}=this,n=e.length,r=[];for(let i=0;i<n;i+=1){let n=e[i],s=t[i];for(let e of n)r.push(Object.assign(Object.assign({},e),{levelCoord:s}))}return r}}function rs(e){return e.span.end}function is(e){return e.index+":"+e.span.start}function ss(e){let t=[];for(let i of e){let e=[],s={span:i.span,entries:[i]};for(let i of t)os(i.span,s.span)?s={entries:i.entries.concat(s.entries),span:(n=i.span,r=s.span,{start:Math.min(n.start,r.start),end:Math.max(n.end,r.end)})}:e.push(i);e.push(s),t=e}var n,r;return t}function os(e,t){let n=Math.max(e.start,t.start),r=Math.min(e.end,t.end);return n<r?{start:n,end:r}:null}function ls(e,t,n){e.splice(t,0,n)}function as(e,t,n){let r=0,i=e.length;if(!i||t<n(e[r]))return[0,0];if(t>n(e[i-1]))return[i,0];for(;r<i;){let s=Math.floor(r+(i-r)/2),o=n(e[s]);if(t<o)i=s;else{if(!(t>o))return[s,1];r=s+1}}return[r,0]}class cs{constructor(e,t){this.emitter=new Wr}destroy(){}setMirrorIsVisible(e){}setMirrorNeedsRevert(e){}setAutoScrollEnabled(e){}}const ds={},us={startTime:Gt,duration:Gt,create:Boolean,sourceId:String};function hs(e){let{refined:t,extra:n}=Mn(e,us);return{startTime:t.startTime||null,duration:t.duration||null,create:null==t.create||t.create,sourceId:t.sourceId,leftoverProps:n}}function fs(e,t){return Cn(!e||t>10?{weekday:"short"}:t>1?{weekday:"short",month:"numeric",day:"numeric",omitCommas:!0}:{weekday:"long"})}const ps="fc-col-header-cell";function gs(e){return e.text}class ms extends Ln{render(){let{dateEnv:e,options:t,theme:n,viewApi:r}=this.context,{props:i}=this,{date:s,dateProfile:o}=i,l=Hi(s,i.todayRange,null,o),a=[ps].concat(Wi(l,n)),c=e.format(s,i.dayHeaderFormat),d=!l.isDisabled&&i.colCnt>1?zi(this.context,s):{},u=Object.assign(Object.assign(Object.assign({date:e.toDate(s),view:r},i.extraRenderProps),{text:c}),l);return f(qn,{elTag:"th",elClasses:a,elAttrs:Object.assign({role:"columnheader",colSpan:i.colSpan,"data-date":l.isDisabled?void 0:tn(s)},i.extraDataAttrs),renderProps:u,generatorName:"dayHeaderContent",generator:t.dayHeaderContent||gs,classNameGenerator:t.dayHeaderClassNames,didMount:t.dayHeaderDidMount,willUnmount:t.dayHeaderWillUnmount},e=>f("div",{className:"fc-scrollgrid-sync-inner"},!l.isDisabled&&f(e,{elTag:"a",elAttrs:d,elClasses:["fc-col-header-cell-cushion",i.isSticky&&"fc-sticky"]})))}}const vs=Cn({weekday:"long"});class ys extends Ln{render(){let{props:e}=this,{dateEnv:t,theme:n,viewApi:r,options:i}=this.context,s=Ct(new Date(2592e5),e.dow),o={dow:e.dow,isDisabled:!1,isFuture:!1,isPast:!1,isToday:!1,isOther:!1},l=t.format(s,e.dayHeaderFormat),a=Object.assign(Object.assign(Object.assign(Object.assign({date:s},o),{view:r}),e.extraRenderProps),{text:l});return f(qn,{elTag:"th",elClasses:[ps,...Wi(o,n),...e.extraClassNames||[]],elAttrs:Object.assign({role:"columnheader",colSpan:e.colSpan},e.extraDataAttrs),renderProps:a,generatorName:"dayHeaderContent",generator:i.dayHeaderContent||gs,classNameGenerator:i.dayHeaderClassNames,didMount:i.dayHeaderDidMount,willUnmount:i.dayHeaderWillUnmount},n=>f("div",{className:"fc-scrollgrid-sync-inner"},f(n,{elTag:"a",elClasses:["fc-col-header-cell-cushion",e.isSticky&&"fc-sticky"],elAttrs:{"aria-label":t.format(s,vs)}})))}}class bs extends m{constructor(e,t){super(e,t),this.initialNowDate=lr(t.options.now,t.dateEnv),this.initialNowQueriedMs=(new Date).valueOf(),this.state=this.computeTiming().currentState}render(){let{props:e,state:t}=this;return e.children(t.nowDate,t.todayRange)}componentDidMount(){this.setTimeout()}componentDidUpdate(e){e.unit!==this.props.unit&&(this.clearTimeout(),this.setTimeout())}componentWillUnmount(){this.clearTimeout()}computeTiming(){let{props:e,context:t}=this,n=wt(this.initialNowDate,(new Date).valueOf()-this.initialNowQueriedMs),r=t.dateEnv.startOf(n,e.unit),i=t.dateEnv.add(r,Gt(1,e.unit)),s=i.valueOf()-n.valueOf();return s=Math.min(864e5,s),{currentState:{nowDate:r,todayRange:Ss(r)},nextState:{nowDate:i,todayRange:Ss(i)},waitMs:s}}setTimeout(){let{nextState:e,waitMs:t}=this.computeTiming();this.timeoutId=setTimeout(()=>{this.setState(e,()=>{this.setTimeout()})},t)}clearTimeout(){this.timeoutId&&clearTimeout(this.timeoutId)}}function Ss(e){let t=_t(e);return{start:t,end:Ct(t,1)}}bs.contextType=Wn;class Es extends Ln{constructor(){super(...arguments),this.createDayHeaderFormatter=Pe(Cs)}render(){let{context:e}=this,{dates:t,dateProfile:n,datesRepDistinctDays:r,renderIntro:i}=this.props,s=this.createDayHeaderFormatter(e.options.dayHeaderFormat,r,t.length);return f(bs,{unit:"day"},(e,o)=>f("tr",{role:"row"},i&&i("day"),t.map(e=>r?f(ms,{key:e.toISOString(),date:e,dateProfile:n,todayRange:o,colCnt:t.length,dayHeaderFormat:s}):f(ys,{key:e.getUTCDay(),dow:e.getUTCDay(),dayHeaderFormat:s}))))}}function Cs(e,t,n){return e||fs(t,n)}class ws{constructor(e,t){let n=e.start,{end:r}=e,i=[],s=[],o=-1;for(;n<r;)t.isHiddenDay(n)?i.push(o+.5):(o+=1,i.push(o),s.push(n)),n=Ct(n,1);this.dates=s,this.indices=i,this.cnt=s.length}sliceRange(e){let t=this.getDateDayIndex(e.start),n=this.getDateDayIndex(Ct(e.end,-1)),r=Math.max(0,t),i=Math.min(this.cnt-1,n);return r=Math.ceil(r),i=Math.floor(i),r<=i?{firstIndex:r,lastIndex:i,isStart:t===r,isEnd:n===i}:null}getDateDayIndex(e){let{indices:t}=this,n=Math.floor(Rt(this.dates[0],e));return n<0?t[0]-1:n>=t.length?t[t.length-1]+1:t[n]}}class Ds{constructor(e,t){let n,r,i,{dates:s}=e;if(t){for(r=s[0].getUTCDay(),n=1;n<s.length&&s[n].getUTCDay()!==r;n+=1);i=Math.ceil(s.length/n)}else i=1,n=s.length;this.rowCnt=i,this.colCnt=n,this.daySeries=e,this.cells=this.buildCells(),this.headerDates=this.buildHeaderDates()}buildCells(){let e=[];for(let t=0;t<this.rowCnt;t+=1){let n=[];for(let e=0;e<this.colCnt;e+=1)n.push(this.buildCell(t,e));e.push(n)}return e}buildCell(e,t){let n=this.daySeries.dates[e*this.colCnt+t];return{key:n.toISOString(),date:n}}buildHeaderDates(){let e=[];for(let t=0;t<this.colCnt;t+=1)e.push(this.cells[0][t].date);return e}sliceRange(e){let{colCnt:t}=this,n=this.daySeries.sliceRange(e),r=[];if(n){let{firstIndex:e,lastIndex:i}=n,s=e;for(;s<=i;){let o=Math.floor(s/t),l=Math.min((o+1)*t,i+1);r.push({row:o,firstCol:s%t,lastCol:(l-1)%t,isStart:n.isStart&&s===e,isEnd:n.isEnd&&l-1===i}),s=l}}return r}}class Rs{constructor(){this.sliceBusinessHours=Pe(this._sliceBusinessHours),this.sliceDateSelection=Pe(this._sliceDateSpan),this.sliceEventStore=Pe(this._sliceEventStore),this.sliceEventDrag=Pe(this._sliceInteraction),this.sliceEventResize=Pe(this._sliceInteraction),this.forceDayIfListItem=!1}sliceProps(e,t,n,r,...i){let{eventUiBases:s}=e,o=this.sliceEventStore(e.eventStore,s,t,n,...i);return{dateSelectionSegs:this.sliceDateSelection(e.dateSelection,s,r,...i),businessHourSegs:this.sliceBusinessHours(e.businessHours,t,n,r,...i),fgEventSegs:o.fg,bgEventSegs:o.bg,eventDrag:this.sliceEventDrag(e.eventDrag,s,t,n,...i),eventResize:this.sliceEventResize(e.eventResize,s,t,n,...i),eventSelection:e.eventSelection}}sliceNowDate(e,t,...n){return this._sliceDateSpan({range:{start:e,end:wt(e,1)},allDay:!1},{},t,...n)}_sliceBusinessHours(e,t,n,r,...i){return e?this._sliceEventStore(dr(e,As(t,Boolean(n)),r),{},t,n,...i).bg:[]}_sliceEventStore(e,t,n,r,...i){if(e){let s=Xr(e,t,As(n,Boolean(r)),r);return{bg:this.sliceEventRanges(s.bg,i),fg:this.sliceEventRanges(s.fg,i)}}return{bg:[],fg:[]}}_sliceInteraction(e,t,n,r,...i){if(!e)return null;let s=Xr(e.mutatedEvents,t,As(n,Boolean(r)),r);return{segs:this.sliceEventRanges(s.fg,i),affectedInstances:e.affectedEvents.instances,isEvent:e.isEvent}}_sliceDateSpan(e,t,n,...r){if(!e)return[];let i=function(e,t,n){let r=mr({editable:!1},n),i=yr(r.refined,r.extra,"",e.allDay,!0,n);return{def:i,ui:ti(i,t),instance:cr(i.defId,e.range),range:e.range,isStart:!0,isEnd:!0}}(e,t,n),s=this.sliceRange(e.range,...r);for(let e of s)e.eventRange=i;return s}sliceEventRanges(e,t){let n=[];for(let r of e)n.push(...this.sliceEventRange(r,t));return n}sliceEventRange(e,t){let n=e.range;this.forceDayIfListItem&&"list-item"===e.ui.display&&(n={start:n.start,end:Ct(n.start,1)});let r=this.sliceRange(n,...t);for(let t of r)t.eventRange=e,t.isStart=e.isStart&&t.isStart,t.isEnd=e.isEnd&&t.isEnd;return r}}function As(e,t){let n=e.activeRange;return t?n:{start:wt(n.start,e.slotMinTime.milliseconds),end:wt(n.end,e.slotMaxTime.milliseconds-864e5)}}function xs(e,t,n){let{instances:r}=e.mutatedEvents;for(let e in r)if(!tr(t.validRange,r[e].range))return!1;return _s({eventDrag:e},n)}function Ts(e,t,n){return!!tr(t.validRange,e.range)&&_s({dateSelection:e},n)}function _s(e,t){let n=t.getCurrentData(),r=Object.assign({businessHours:n.businessHours,dateSelection:"",eventStore:n.eventStore,eventUiBases:n.eventUiBases,eventSelection:"",eventDrag:null,eventResize:null},e);return(t.pluginHooks.isPropsValid||ks)(r,t)}function ks(e,t,n={},r){return!(e.eventDrag&&!function(e,t,n,r){let i=t.getCurrentData(),s=e.eventDrag,o=s.mutatedEvents,l=o.defs,a=o.instances,c=ei(l,s.isEvent?e.eventUiBases:{"":i.selectionConfig});r&&(c=De(c,r));let d=(p=e.eventStore,g=s.affectedEvents.instances,{defs:p.defs,instances:we(p.instances,e=>!g[e.instanceId])}),u=d.defs,h=d.instances,f=ei(u,e.eventUiBases);var p,g;for(let r in a){let o=a[r],p=o.range,g=c[o.defId],m=l[o.defId];if(!Ms(g.constraints,p,d,e.businessHours,t))return!1;let{eventOverlap:v}=t.options,y="function"==typeof v?v:null;for(let e in h){let n=h[e];if(er(p,n.range)){if(!1===f[n.defId].overlap&&s.isEvent)return!1;if(!1===g.overlap)return!1;if(y&&!y(new Yr(t,u[n.defId],n),new Yr(t,m,o)))return!1}}let b=i.eventStore;for(let e of g.allows){let i,s=Object.assign(Object.assign({},n),{range:o.range,allDay:m.allDay}),l=b.defs[m.defId],a=b.instances[r];if(i=l?new Yr(t,l,a):new Yr(t,m),!e(zr(s,t),i))return!1}}return!0}(e,t,n,r))&&!(e.dateSelection&&!function(e,t,n,r){let i=e.eventStore,s=i.defs,o=i.instances,l=e.dateSelection,a=l.range,{selectionConfig:c}=t.getCurrentData();r&&(c=r(c));if(!Ms(c.constraints,a,i,e.businessHours,t))return!1;let{selectOverlap:d}=t.options,u="function"==typeof d?d:null;for(let e in o){let n=o[e];if(er(a,n.range)){if(!1===c.overlap)return!1;if(u&&!u(new Yr(t,s[n.defId],n),null))return!1}}for(let e of c.allows){let r=Object.assign(Object.assign({},n),l);if(!e(zr(r,t),null))return!1}return!0}(e,t,n,r))}function Ms(e,t,n,r,i){for(let s of e)if(!Ns(Is(s,t,n,r,i),t))return!1;return!0}function Is(e,t,n,r,i){return"businessHours"===e?Os(dr(r,t,i)):"string"==typeof e?Os(Dr(n,t=>t.groupId===e)):"object"==typeof e&&e?Os(dr(e,t,i)):[]}function Os(e){let{instances:t}=e,n=[];for(let e in t)n.push(t[e].range);return n}function Ns(e,t){for(let n of e)if(tr(n,t))return!0;return!1}const Ps=/^(visible|hidden)$/;class Hs extends Ln{constructor(){super(...arguments),this.handleEl=e=>{this.el=e,zn(this.props.elRef,e)}}render(){let{props:e}=this,{liquid:t,liquidIsAbsolute:n}=e,r=t&&n,i=["fc-scroller"];return t&&(n?i.push("fc-scroller-liquid-absolute"):i.push("fc-scroller-liquid")),f("div",{ref:this.handleEl,className:i.join(" "),style:{overflowX:e.overflowX,overflowY:e.overflowY,left:r&&-(e.overcomeLeft||0)||"",right:r&&-(e.overcomeRight||0)||"",bottom:r&&-(e.overcomeBottom||0)||"",marginLeft:!r&&-(e.overcomeLeft||0)||"",marginRight:!r&&-(e.overcomeRight||0)||"",marginBottom:!r&&-(e.overcomeBottom||0)||"",maxHeight:e.maxHeight||""}},e.children)}needsXScrolling(){if(Ps.test(this.props.overflowX))return!1;let{el:e}=this,t=this.el.getBoundingClientRect().width-this.getYScrollbarWidth(),{children:n}=e;for(let e=0;e<n.length;e+=1){if(n[e].getBoundingClientRect().width>t)return!0}return!1}needsYScrolling(){if(Ps.test(this.props.overflowY))return!1;let{el:e}=this,t=this.el.getBoundingClientRect().height-this.getXScrollbarWidth(),{children:n}=e;for(let e=0;e<n.length;e+=1){if(n[e].getBoundingClientRect().height>t)return!0}return!1}getXScrollbarWidth(){return Ps.test(this.props.overflowX)?0:this.el.offsetHeight-this.el.clientHeight}getYScrollbarWidth(){return Ps.test(this.props.overflowY)?0:this.el.offsetWidth-this.el.clientWidth}}class Ws{constructor(e){this.masterCallback=e,this.currentMap={},this.depths={},this.callbackMap={},this.handleValue=(e,t)=>{let{depths:n,currentMap:r}=this,i=!1,s=!1;null!==e?(i=t in r,r[t]=e,n[t]=(n[t]||0)+1,s=!0):(n[t]-=1,n[t]||(delete r[t],delete this.callbackMap[t],i=!0)),this.masterCallback&&(i&&this.masterCallback(null,String(t)),s&&this.masterCallback(e,String(t)))}}createRef(e){let t=this.callbackMap[e];return t||(t=this.callbackMap[e]=t=>{this.handleValue(t,String(e))}),t}collect(e,t,n){return Ie(this.currentMap,e,t,n)}getAll(){return Ae(this.currentMap)}}function Bs(e){let t=Ue(e,".fc-scrollgrid-shrink"),n=0;for(let e of t)n=Math.max(n,bt(e));return Math.ceil(n)}function js(e,t){return e.liquid&&t.liquid}function Ls(e,t){return null!=t.maxHeight||js(e,t)}function zs(e,t,n,r){let{expandRows:i}=n;return"function"==typeof t.content?t.content(n):f("table",{role:"presentation",className:[t.tableClassName,e.syncRowHeights?"fc-scrollgrid-sync-table":""].join(" "),style:{minWidth:n.tableMinWidth,width:n.clientWidth,height:i?n.clientHeight:""}},n.tableColGroupNode,f(r?"thead":"tbody",{role:"presentation"},"function"==typeof t.rowContent?t.rowContent(n):t.rowContent))}function Us(e,t){return Ne(e,t,xe)}function Gs(e,t){let n=[];for(let r of e){let e=r.span||1;for(let i=0;i<e;i+=1)n.push(f("col",{style:{width:"shrink"===r.width?Fs(t):r.width||"",minWidth:r.minWidth||""}}))}return f("colgroup",{},...n)}function Fs(e){return null==e?4:e}function Vs(e){for(let t of e)if("shrink"===t.width)return!0;return!1}function qs(e,t){let n=["fc-scrollgrid",t.theme.getClass("table")];return e&&n.push("fc-scrollgrid-liquid"),n}function Ys(e,t){let n=["fc-scrollgrid-section","fc-scrollgrid-section-"+e.type,e.className];return t&&e.liquid&&null==e.maxHeight&&n.push("fc-scrollgrid-section-liquid"),e.isSticky&&n.push("fc-scrollgrid-section-sticky"),n}function Qs(e){return f("div",{className:"fc-scrollgrid-sticky-shim",style:{width:e.clientWidth,minWidth:e.tableMinWidth}})}function Zs(e){let{stickyHeaderDates:t}=e;return null!=t&&"auto"!==t||(t="auto"===e.height||"auto"===e.viewHeight),t}function Xs(e){let{stickyFooterScrollbar:t}=e;return null!=t&&"auto"!==t||(t="auto"===e.height||"auto"===e.viewHeight),t}class Js extends Ln{constructor(){super(...arguments),this.processCols=Pe(e=>e,Us),this.renderMicroColGroup=Pe(Gs),this.scrollerRefs=new Ws,this.scrollerElRefs=new Ws(this._handleScrollerEl.bind(this)),this.state={shrinkWidth:null,forceYScrollbars:!1,scrollerClientWidths:{},scrollerClientHeights:{}},this.handleSizing=()=>{this.safeSetState(Object.assign({shrinkWidth:this.computeShrinkWidth()},this.computeScrollerDims()))}}render(){let{props:e,state:t,context:n}=this,r=e.sections||[],i=this.processCols(e.cols),s=this.renderMicroColGroup(i,t.shrinkWidth),o=qs(e.liquid,n);e.collapsibleWidth&&o.push("fc-scrollgrid-collapsible");let l,a=r.length,c=0,d=[],u=[],h=[];for(;c<a&&"header"===(l=r[c]).type;)d.push(this.renderSection(l,s,!0)),c+=1;for(;c<a&&"body"===(l=r[c]).type;)u.push(this.renderSection(l,s,!1)),c+=1;for(;c<a&&"footer"===(l=r[c]).type;)h.push(this.renderSection(l,s,!0)),c+=1;let p=!Ei();const g={role:"rowgroup"};return f("table",{role:"grid",className:o.join(" "),style:{height:e.height}},Boolean(!p&&d.length)&&f("thead",g,...d),Boolean(!p&&u.length)&&f("tbody",g,...u),Boolean(!p&&h.length)&&f("tfoot",g,...h),p&&f("tbody",g,...d,...u,...h))}renderSection(e,t,n){return"outerContent"in e?f(g,{key:e.key},e.outerContent):f("tr",{key:e.key,role:"presentation",className:Ys(e,this.props.liquid).join(" ")},this.renderChunkTd(e,t,e.chunk,n))}renderChunkTd(e,t,n,r){if("outerContent"in n)return n.outerContent;let{props:i}=this,{forceYScrollbars:s,scrollerClientWidths:o,scrollerClientHeights:l}=this.state,a=Ls(i,e),c=js(i,e),d=i.liquid?s?"scroll":a?"auto":"hidden":"visible",u=e.key,h=zs(e,n,{tableColGroupNode:t,tableMinWidth:"",clientWidth:i.collapsibleWidth||void 0===o[u]?null:o[u],clientHeight:void 0!==l[u]?l[u]:null,expandRows:e.expandRows,syncRowHeights:!1,rowSyncHeights:[],reportRowHeightChange:()=>{}},r);return f(r?"th":"td",{ref:n.elRef,role:"presentation"},f("div",{className:"fc-scroller-harness"+(c?" fc-scroller-harness-liquid":"")},f(Hs,{ref:this.scrollerRefs.createRef(u),elRef:this.scrollerElRefs.createRef(u),overflowY:d,overflowX:i.liquid?"hidden":"visible",maxHeight:e.maxHeight,liquid:c,liquidIsAbsolute:!0},h)))}_handleScrollerEl(e,t){let n=function(e,t){for(let n of e)if(n.key===t)return n;return null}(this.props.sections,t);n&&zn(n.chunk.scrollerElRef,e)}componentDidMount(){this.handleSizing(),this.context.addResizeHandler(this.handleSizing)}componentDidUpdate(){this.handleSizing()}componentWillUnmount(){this.context.removeResizeHandler(this.handleSizing)}computeShrinkWidth(){return Vs(this.props.cols)?Bs(this.scrollerElRefs.getAll()):0}computeScrollerDims(){let e=Vi(),{scrollerRefs:t,scrollerElRefs:n}=this,r=!1,i={},s={};for(let e in t.currentMap){let n=t.currentMap[e];if(n&&n.needsYScrolling()){r=!0;break}}for(let t of this.props.sections){let o=t.key,l=n.currentMap[o];if(l){let t=l.parentNode;i[o]=Math.floor(t.getBoundingClientRect().width-(r?e.y:0)),s[o]=Math.floor(t.getBoundingClientRect().height)}}return{forceYScrollbars:r,scrollerClientWidths:i,scrollerClientHeights:s}}}Js.addStateEquality({scrollerClientWidths:xe,scrollerClientHeights:xe});class $s extends Ln{constructor(){super(...arguments),this.handleEl=e=>{this.el=e,e&&$r(e,this.props.seg)}}render(){const{props:e,context:t}=this,{options:n}=t,{seg:r}=e,{eventRange:i}=r,{ui:s}=i,o={event:new Yr(t,i.def,i.instance),view:t.viewApi,timeText:e.timeText,textColor:s.textColor,backgroundColor:s.backgroundColor,borderColor:s.borderColor,isDraggable:!e.disableDragging&&ii(r,t),isStartResizable:!e.disableResizing&&si(r,t),isEndResizable:!e.disableResizing&&oi(r),isMirror:Boolean(e.isDragging||e.isResizing||e.isDateSelecting),isStart:Boolean(r.isStart),isEnd:Boolean(r.isEnd),isPast:Boolean(e.isPast),isFuture:Boolean(e.isFuture),isToday:Boolean(e.isToday),isSelected:Boolean(e.isSelected),isDragging:Boolean(e.isDragging),isResizing:Boolean(e.isResizing)};return f(qn,Object.assign({},e,{elRef:this.handleEl,elClasses:[...ci(o),...r.eventRange.ui.classNames,...e.elClasses||[]],renderProps:o,generatorName:"eventContent",generator:n.eventContent||e.defaultGenerator,classNameGenerator:n.eventClassNames,didMount:n.eventDidMount,willUnmount:n.eventWillUnmount}))}componentDidUpdate(e){this.el&&this.props.seg!==e.seg&&$r(this.el,this.props.seg)}}class Ks extends Ln{render(){let{props:e,context:t}=this,{options:n}=t,{seg:r}=e,{ui:i}=r.eventRange,s=li(r,n.eventTimeFormat||e.defaultTimeFormat,t,e.defaultDisplayEventTime,e.defaultDisplayEventEnd);return f($s,Object.assign({},e,{elTag:"a",elStyle:{borderColor:i.borderColor,backgroundColor:i.backgroundColor},elAttrs:ui(r,t),defaultGenerator:eo,timeText:s}),(e,t)=>f(g,null,f(e,{elTag:"div",elClasses:["fc-event-main"],elStyle:{color:t.textColor}}),Boolean(t.isStartResizable)&&f("div",{className:"fc-event-resizer fc-event-resizer-start"}),Boolean(t.isEndResizable)&&f("div",{className:"fc-event-resizer fc-event-resizer-end"})))}}function eo(e){return f("div",{className:"fc-event-main-frame"},e.timeText&&f("div",{className:"fc-event-time"},e.timeText),f("div",{className:"fc-event-title-container"},f("div",{className:"fc-event-title fc-sticky"},e.event.title||f(g,null," "))))}const to=e=>f(Wn.Consumer,null,t=>{let{options:n}=t,r={isAxis:e.isAxis,date:t.dateEnv.toDate(e.date),view:t.viewApi};return f(qn,Object.assign({},e,{elTag:e.elTag||"div",renderProps:r,generatorName:"nowIndicatorContent",generator:n.nowIndicatorContent,classNameGenerator:n.nowIndicatorClassNames,didMount:n.nowIndicatorDidMount,willUnmount:n.nowIndicatorWillUnmount}))}),no=Cn({day:"numeric"});class ro extends Ln{constructor(){super(...arguments),this.refineRenderProps=He(so)}render(){let{props:e,context:t}=this,{options:n}=t,r=this.refineRenderProps({date:e.date,dateProfile:e.dateProfile,todayRange:e.todayRange,showDayNumber:e.showDayNumber,extraRenderProps:e.extraRenderProps,viewApi:t.viewApi,dateEnv:t.dateEnv});return f(qn,Object.assign({},e,{elClasses:[...Wi(r,t.theme),...e.elClasses||[]],elAttrs:Object.assign(Object.assign({},e.elAttrs),r.isDisabled?{}:{"data-date":tn(e.date)}),renderProps:r,generatorName:"dayCellContent",generator:n.dayCellContent||e.defaultGenerator,classNameGenerator:r.isDisabled?void 0:n.dayCellClassNames,didMount:n.dayCellDidMount,willUnmount:n.dayCellWillUnmount}))}}function io(e){return Boolean(e.dayCellContent||Gn("dayCellContent",e))}function so(e){let{date:t,dateEnv:n}=e,r=Hi(t,e.todayRange,null,e.dateProfile);return Object.assign(Object.assign(Object.assign({date:n.toDate(t),view:e.viewApi},r),{dayNumberText:e.showDayNumber?n.format(t,no):""}),e.extraRenderProps)}class oo extends Ln{render(){let{props:e}=this,{seg:t}=e;return f($s,{elTag:"div",elClasses:["fc-bg-event"],elStyle:{backgroundColor:t.eventRange.ui.backgroundColor},defaultGenerator:lo,seg:t,timeText:"",isDragging:!1,isResizing:!1,isDateSelecting:!1,isSelected:!1,isPast:e.isPast,isFuture:e.isFuture,isToday:e.isToday,disableDragging:!0,disableResizing:!0})}}function lo(e){let{title:t}=e.event;return t&&f("div",{className:"fc-event-title"},e.event.title)}function ao(e){return f("div",{className:"fc-"+e})}const co=e=>f(Wn.Consumer,null,t=>{let{dateEnv:n,options:r}=t,{date:i}=e,s=r.weekNumberFormat||e.defaultFormat,o={num:n.computeWeekNumber(i),text:n.format(i,s),date:i};return f(qn,Object.assign({},e,{renderProps:o,generatorName:"weekNumberContent",generator:r.weekNumberContent||uo,classNameGenerator:r.weekNumberClassNames,didMount:r.weekNumberDidMount,willUnmount:r.weekNumberWillUnmount}))});function uo(e){return e.text}class ho extends Ln{constructor(){super(...arguments),this.state={titleId:Xe()},this.handleRootEl=e=>{this.rootEl=e,this.props.elRef&&zn(this.props.elRef,e)},this.handleDocumentMouseDown=e=>{const t=Ye(e);this.rootEl.contains(t)||this.handleCloseClick()},this.handleDocumentKeyDown=e=>{"Escape"===e.key&&this.handleCloseClick()},this.handleCloseClick=()=>{let{onClose:e}=this.props;e&&e()}}render(){let{theme:e,options:t}=this.context,{props:n,state:r}=this,i=["fc-popover",e.getClass("popover")].concat(n.extraClassNames||[]);return function(e,t){var n=f(le,{__v:e,i:t});return n.containerInfo=t,n}(f("div",Object.assign({},n.extraAttrs,{id:n.id,className:i.join(" "),"aria-labelledby":r.titleId,ref:this.handleRootEl}),f("div",{className:"fc-popover-header "+e.getClass("popoverHeader")},f("span",{className:"fc-popover-title",id:r.titleId},n.title),f("span",{className:"fc-popover-close "+e.getIconClass("close"),title:t.closeHint,onClick:this.handleCloseClick})),f("div",{className:"fc-popover-body "+e.getClass("popoverContent")},n.children)),n.parentEl)}componentDidMount(){document.addEventListener("mousedown",this.handleDocumentMouseDown),document.addEventListener("keydown",this.handleDocumentKeyDown),this.updateSize()}componentWillUnmount(){document.removeEventListener("mousedown",this.handleDocumentMouseDown),document.removeEventListener("keydown",this.handleDocumentKeyDown)}updateSize(){let{isRtl:e}=this.context,{alignmentEl:t,alignGridTop:n}=this.props,{rootEl:r}=this,i=function(e){let t=Xi(e),n=e.getBoundingClientRect();for(let e of t){let t=Ti(n,e.getBoundingClientRect());if(!t)return null;n=t}return n}(t);if(i){let s=r.getBoundingClientRect(),o=n?Le(t,".fc-scrollgrid").getBoundingClientRect().top:i.top,l=e?i.right-s.width:i.left;o=Math.max(o,10),l=Math.min(l,document.documentElement.clientWidth-10-s.width),l=Math.max(l,10);let a=r.offsetParent.getBoundingClientRect();Ve(r,{top:o-a.top,left:l-a.left})}}}class fo extends ts{constructor(){super(...arguments),this.handleRootEl=e=>{this.rootEl=e,e?this.context.registerInteractiveComponent(this,{el:e,useEventCenter:!1}):this.context.unregisterInteractiveComponent(this)}}render(){let{options:e,dateEnv:t}=this.context,{props:n}=this,{startDate:r,todayRange:i,dateProfile:s}=n,o=t.format(r,e.dayPopoverFormat);return f(ro,{elRef:this.handleRootEl,date:r,dateProfile:s,todayRange:i},(t,r,i)=>f(ho,{elRef:i.ref,id:n.id,title:o,extraClassNames:["fc-more-popover"].concat(i.className||[]),extraAttrs:i,parentEl:n.parentEl,alignmentEl:n.alignmentEl,alignGridTop:n.alignGridTop,onClose:n.onClose},io(e)&&f(t,{elTag:"div",elClasses:["fc-more-popover-misc"]}),n.children))}queryHit(e,t,n,r){let{rootEl:i,props:s}=this;return e>=0&&e<n&&t>=0&&t<r?{dateProfile:s.dateProfile,dateSpan:Object.assign({allDay:!0,range:{start:s.startDate,end:s.endDate}},s.extraDateSpan),dayEl:i,rect:{left:0,top:0,right:n,bottom:r},layer:1}:null}}class po extends Ln{constructor(){super(...arguments),this.linkElRef={current:null},this.state={isPopoverOpen:!1,popoverId:Xe()},this.handleClick=e=>{let{props:t,context:n}=this,{moreLinkClick:r}=n.options,i=mo(t).start;function s(e){let{def:t,instance:r,range:i}=e.eventRange;return{event:new Yr(n,t,r),start:n.dateEnv.toDate(i.start),end:n.dateEnv.toDate(i.end),isStart:e.isStart,isEnd:e.isEnd}}"function"==typeof r&&(r=r({date:i,allDay:Boolean(t.allDayDate),allSegs:t.allSegs.map(s),hiddenSegs:t.hiddenSegs.map(s),jsEvent:e,view:n.viewApi})),r&&"popover"!==r?"string"==typeof r&&n.calendarApi.zoomTo(i,r):this.setState({isPopoverOpen:!0})},this.handlePopoverClose=()=>{this.setState({isPopoverOpen:!1})}}render(){let{props:e,state:t}=this;return f(Wn.Consumer,null,n=>{let{viewApi:r,options:i,calendarApi:s}=n,{moreLinkText:o}=i,{moreCnt:l}=e,a=mo(e),c="function"==typeof o?o.call(s,l):`+${l} ${o}`,d=mt(i.moreLinkHint,[l],c),u={num:l,shortText:"+"+l,text:c,view:r};return f(g,null,Boolean(e.moreCnt)&&f(qn,{elTag:e.elTag||"a",elRef:this.linkElRef,elClasses:[...e.elClasses||[],"fc-more-link"],elAttrs:Object.assign(Object.assign(Object.assign({},e.elAttrs),tt(this.handleClick)),{title:d,"aria-expanded":t.isPopoverOpen,"aria-controls":t.isPopoverOpen?t.popoverId:""}),renderProps:u,generatorName:"moreLinkContent",generator:i.moreLinkContent||e.defaultGenerator||go,classNameGenerator:i.moreLinkClassNames,didMount:i.moreLinkDidMount,willUnmount:i.moreLinkWillUnmount},e.children),t.isPopoverOpen&&f(fo,{id:t.popoverId,startDate:a.start,endDate:a.end,dateProfile:e.dateProfile,todayRange:e.todayRange,extraDateSpan:e.extraDateSpan,parentEl:this.parentEl,alignmentEl:e.alignmentElRef?e.alignmentElRef.current:this.linkElRef.current,alignGridTop:e.alignGridTop,onClose:this.handlePopoverClose},e.popoverContent()))})}componentDidMount(){this.updateParentEl()}componentDidUpdate(){this.updateParentEl()}updateParentEl(){this.linkElRef.current&&(this.parentEl=Le(this.linkElRef.current,".fc-view-harness"))}}function go(e){return e.text}function mo(e){if(e.allDayDate)return{start:e.allDayDate,end:Ct(e.allDayDate,1)};let{hiddenSegs:t}=e;return{start:vo(t),end:(n=t,n.reduce(bo).eventRange.range.end)};var n}function vo(e){return e.reduce(yo).eventRange.range.start}function yo(e,t){return e.eventRange.range.start<t.eventRange.range.start?e:t}function bo(e,t){return e.eventRange.range.end>t.eventRange.range.end?e:t}var So={__proto__:null,BASE_OPTION_DEFAULTS:Dn,BaseComponent:Ln,BgEvent:oo,CalendarImpl:Ai,CalendarRoot:Ci,ContentContainer:qn,CustomRenderingStore:class extends class{constructor(){this.handlers=[]}set(e){this.currentValue=e;for(let t of this.handlers)t(e)}subscribe(e){this.handlers.push(e),void 0!==this.currentValue&&e(this.currentValue)}}{constructor(){super(...arguments),this.map=new Map}handle(e){const{map:t}=this;let n=!1;e.isActive?(t.set(e.id,e),n=!0):t.has(e.id)&&(t.delete(e.id),n=!0),n&&this.set(t)}},DateComponent:ts,DateEnv:ln,DateProfileGenerator:ar,DayCellContainer:ro,DayHeader:Es,DaySeriesModel:ws,DayTableModel:Ds,DelayedRunner:Se,ElementDragging:cs,ElementScrollController:Ki,Emitter:Wr,EventContainer:$s,EventImpl:Yr,Interaction:wi,MoreLinkContainer:po,NamedTimeZoneImpl:class{constructor(e){this.timeZoneName=e}},NowIndicatorContainer:to,NowTimer:bs,PositionCache:Ji,RefMap:Ws,ScrollController:$i,ScrollResponder:Hn,Scroller:Hs,SegHierarchy:ns,SimpleScrollGrid:Js,Slicer:Rs,Splitter:Ni,StandardEvent:Ks,TableDateCell:ms,TableDowCell:ys,Theme:an,ViewContainer:Qn,ViewContextType:Wn,WeekNumberContainer:co,WindowScrollController:es,addDays:Ct,addDurations:qt,addMs:wt,addWeeks:Et,allowContextMenu:dt,allowSelection:at,applyMutationToEventStore:Gr,applyStyle:Ve,asCleanDays:Vt,asRoughMinutes:Zt,asRoughMs:Jt,asRoughSeconds:Xt,binarySearch:as,buildElAttrs:Fn,buildEntryKey:is,buildEventApis:Zr,buildEventRangeKey:di,buildIsoString:en,buildNavLinkAttrs:zi,buildSegTimeText:li,collectFromHash:Ie,combineEventUis:_r,compareByFieldSpecs:ht,compareNumbers:vt,compareObjs:ke,computeEarliestSegStart:vo,computeEdges:Yi,computeFallbackHeaderFormat:fs,computeInnerRect:Qi,computeRect:Zi,computeShrinkWidth:Bs,computeVisibleDayRange:ir,config:ds,constrainPoint:ki,createDuration:Gt,createEmptyEventStore:Cr,createEventInstance:cr,createEventUi:Tr,createFormatter:Cn,diffDates:or,diffDayAndTime:At,diffDays:Rt,diffPoints:Ii,diffWeeks:Dt,diffWholeDays:Tt,diffWholeWeeks:xt,disableCursor:st,elementClosest:Le,elementMatches:ze,enableCursor:ot,eventTupleToStore:Sr,filterHash:we,findDirectChildren:Ge,findElements:Ue,flexibleCompare:pt,formatDayString:tn,formatIsoTimeString:nn,getAllowYScrolling:Ls,getCanVGrowWithinCell:Ei,getClippingParents:Xi,getDateMeta:Hi,getDayClassNames:Wi,getDefaultEventEnd:Ur,getElRoot:Qe,getElSeg:Kr,getEntrySpanEnd:rs,getEventTargetViaRoot:Ye,getIsRtlScrollbarOnLeft:Fi,getRectCenter:Mi,getRelevantEvents:Er,getScrollGridClassNames:qs,getScrollbarWidths:Vi,getSectionClassNames:Ys,getSectionHasLiquidHeight:js,getSegAnchorAttrs:ui,getSegMeta:ai,getSlotClassNames:Bi,getStickyFooterScrollbar:Xs,getStickyHeaderDates:Zs,getUniqueDomId:Xe,greatestDurationDenominator:Kt,groupIntersectingEntries:ss,guid:it,hasBgRendering:Jr,hasCustomDayCellContent:io,hasShrinkWidth:Vs,identity:In,injectStyles:be,interactionSettingsStore:Ri,interactionSettingsToStore:Di,intersectRanges:$n,intersectRects:Ti,intersectSpans:os,isArraysEqual:Ne,isColPropsEqual:Us,isDateSelectionValid:Ts,isDateSpansEqual:pi,isInt:yt,isInteractionValid:xs,isMultiDayRange:sr,isPropsEqual:xe,isPropsValid:ks,isValidDate:Ht,mapHash:De,memoize:Pe,memoizeArraylike:We,memoizeHashlike:Be,memoizeObjArg:He,mergeEventStores:wr,multiplyDuration:Yt,padStart:gt,parseBusinessHours:jr,parseClassNames:Rr,parseDragMeta:hs,parseEventDef:yr,parseFieldSpecs:ut,parseMarker:on,pointInsideRect:xi,preventContextMenu:ct,preventDefault:Je,preventSelection:lt,rangeContainsMarker:nr,rangeContainsRange:tr,rangesEqual:Kn,rangesIntersect:er,refineEventDef:mr,refineProps:Mn,removeElement:je,removeExact:Oe,renderChunkContent:zs,renderFill:ao,renderMicroColGroup:Gs,renderScrollShim:Qs,requestJson:bi,sanitizeShrinkWidth:Fs,setRef:zn,sliceEventStore:Xr,sortEventSegs:ni,startOfDay:_t,translateRect:_i,triggerDateSelect:Lr,unpromisify:vi,whenTransitionDone:et,wholeDivideDurations:$t};be(':root{--fc-small-font-size:.85em;--fc-page-bg-color:#fff;--fc-neutral-bg-color:hsla(0,0%,82%,.3);--fc-neutral-text-color:grey;--fc-border-color:#ddd;--fc-button-text-color:#fff;--fc-button-bg-color:#2c3e50;--fc-button-border-color:#2c3e50;--fc-button-hover-bg-color:#1e2b37;--fc-button-hover-border-color:#1a252f;--fc-button-active-bg-color:#1a252f;--fc-button-active-border-color:#151e27;--fc-event-bg-color:#3788d8;--fc-event-border-color:#3788d8;--fc-event-text-color:#fff;--fc-event-selected-overlay-color:rgba(0,0,0,.25);--fc-more-link-bg-color:#d0d0d0;--fc-more-link-text-color:inherit;--fc-event-resizer-thickness:8px;--fc-event-resizer-dot-total-width:8px;--fc-event-resizer-dot-border-width:1px;--fc-non-business-color:hsla(0,0%,84%,.3);--fc-bg-event-color:#8fdf82;--fc-bg-event-opacity:0.3;--fc-highlight-color:rgba(188,232,241,.3);--fc-today-bg-color:rgba(255,220,40,.15);--fc-now-indicator-color:red}.fc-not-allowed,.fc-not-allowed .fc-event{cursor:not-allowed}.fc-unselectable{-webkit-touch-callout:none;-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-user-select:none;-moz-user-select:none;user-select:none}.fc{display:flex;flex-direction:column;font-size:1em}.fc,.fc *,.fc :after,.fc :before{box-sizing:border-box}.fc table{border-collapse:collapse;border-spacing:0;font-size:1em}.fc th{text-align:center}.fc td,.fc th{padding:0;vertical-align:top}.fc a[data-navlink]{cursor:pointer}.fc a[data-navlink]:hover{text-decoration:underline}.fc-direction-ltr{direction:ltr;text-align:left}.fc-direction-rtl{direction:rtl;text-align:right}.fc-theme-standard td,.fc-theme-standard th{border:1px solid var(--fc-border-color)}.fc-liquid-hack td,.fc-liquid-hack th{position:relative}@font-face{font-family:fcicons;font-style:normal;font-weight:400;src:url("data:application/x-font-ttf;charset=utf-8;base64,AAEAAAALAIAAAwAwT1MvMg8SBfAAAAC8AAAAYGNtYXAXVtKNAAABHAAAAFRnYXNwAAAAEAAAAXAAAAAIZ2x5ZgYydxIAAAF4AAAFNGhlYWQUJ7cIAAAGrAAAADZoaGVhB20DzAAABuQAAAAkaG10eCIABhQAAAcIAAAALGxvY2ED4AU6AAAHNAAAABhtYXhwAA8AjAAAB0wAAAAgbmFtZXsr690AAAdsAAABhnBvc3QAAwAAAAAI9AAAACAAAwPAAZAABQAAApkCzAAAAI8CmQLMAAAB6wAzAQkAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAAADpBgPA/8AAQAPAAEAAAAABAAAAAAAAAAAAAAAgAAAAAAADAAAAAwAAABwAAQADAAAAHAADAAEAAAAcAAQAOAAAAAoACAACAAIAAQAg6Qb//f//AAAAAAAg6QD//f//AAH/4xcEAAMAAQAAAAAAAAAAAAAAAQAB//8ADwABAAAAAAAAAAAAAgAANzkBAAAAAAEAAAAAAAAAAAACAAA3OQEAAAAAAQAAAAAAAAAAAAIAADc5AQAAAAABAWIAjQKeAskAEwAAJSc3NjQnJiIHAQYUFwEWMjc2NCcCnuLiDQ0MJAz/AA0NAQAMJAwNDcni4gwjDQwM/wANIwz/AA0NDCMNAAAAAQFiAI0CngLJABMAACUBNjQnASYiBwYUHwEHBhQXFjI3AZ4BAA0N/wAMJAwNDeLiDQ0MJAyNAQAMIw0BAAwMDSMM4uINIwwNDQAAAAIA4gC3Ax4CngATACcAACUnNzY0JyYiDwEGFB8BFjI3NjQnISc3NjQnJiIPAQYUHwEWMjc2NCcB87e3DQ0MIw3VDQ3VDSMMDQ0BK7e3DQ0MJAzVDQ3VDCQMDQ3zuLcMJAwNDdUNIwzWDAwNIwy4twwkDA0N1Q0jDNYMDA0jDAAAAgDiALcDHgKeABMAJwAAJTc2NC8BJiIHBhQfAQcGFBcWMjchNzY0LwEmIgcGFB8BBwYUFxYyNwJJ1Q0N1Q0jDA0Nt7cNDQwjDf7V1Q0N1QwkDA0Nt7cNDQwkDLfWDCMN1Q0NDCQMt7gMIw0MDNYMIw3VDQ0MJAy3uAwjDQwMAAADAFUAAAOrA1UAMwBoAHcAABMiBgcOAQcOAQcOARURFBYXHgEXHgEXHgEzITI2Nz4BNz4BNz4BNRE0JicuAScuAScuASMFITIWFx4BFx4BFx4BFREUBgcOAQcOAQcOASMhIiYnLgEnLgEnLgE1ETQ2Nz4BNz4BNz4BMxMhMjY1NCYjISIGFRQWM9UNGAwLFQkJDgUFBQUFBQ4JCRULDBgNAlYNGAwLFQkJDgUFBQUFBQ4JCRULDBgN/aoCVgQIBAQHAwMFAQIBAQIBBQMDBwQECAT9qgQIBAQHAwMFAQIBAQIBBQMDBwQECASAAVYRGRkR/qoRGRkRA1UFBAUOCQkVDAsZDf2rDRkLDBUJCA4FBQUFBQUOCQgVDAsZDQJVDRkLDBUJCQ4FBAVVAgECBQMCBwQECAX9qwQJAwQHAwMFAQICAgIBBQMDBwQDCQQCVQUIBAQHAgMFAgEC/oAZEhEZGRESGQAAAAADAFUAAAOrA1UAMwBoAIkAABMiBgcOAQcOAQcOARURFBYXHgEXHgEXHgEzITI2Nz4BNz4BNz4BNRE0JicuAScuAScuASMFITIWFx4BFx4BFx4BFREUBgcOAQcOAQcOASMhIiYnLgEnLgEnLgE1ETQ2Nz4BNz4BNz4BMxMzFRQWMzI2PQEzMjY1NCYrATU0JiMiBh0BIyIGFRQWM9UNGAwLFQkJDgUFBQUFBQ4JCRULDBgNAlYNGAwLFQkJDgUFBQUFBQ4JCRULDBgN/aoCVgQIBAQHAwMFAQIBAQIBBQMDBwQECAT9qgQIBAQHAwMFAQIBAQIBBQMDBwQECASAgBkSEhmAERkZEYAZEhIZgBEZGREDVQUEBQ4JCRUMCxkN/asNGQsMFQkIDgUFBQUFBQ4JCBUMCxkNAlUNGQsMFQkJDgUEBVUCAQIFAwIHBAQIBf2rBAkDBAcDAwUBAgICAgEFAwMHBAMJBAJVBQgEBAcCAwUCAQL+gIASGRkSgBkSERmAEhkZEoAZERIZAAABAOIAjQMeAskAIAAAExcHBhQXFjI/ARcWMjc2NC8BNzY0JyYiDwEnJiIHBhQX4uLiDQ0MJAzi4gwkDA0N4uINDQwkDOLiDCQMDQ0CjeLiDSMMDQ3h4Q0NDCMN4uIMIw0MDOLiDAwNIwwAAAABAAAAAQAAa5n0y18PPPUACwQAAAAAANivOVsAAAAA2K85WwAAAAADqwNVAAAACAACAAAAAAAAAAEAAAPA/8AAAAQAAAAAAAOrAAEAAAAAAAAAAAAAAAAAAAALBAAAAAAAAAAAAAAAAgAAAAQAAWIEAAFiBAAA4gQAAOIEAABVBAAAVQQAAOIAAAAAAAoAFAAeAEQAagCqAOoBngJkApoAAQAAAAsAigADAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAA4ArgABAAAAAAABAAcAAAABAAAAAAACAAcAYAABAAAAAAADAAcANgABAAAAAAAEAAcAdQABAAAAAAAFAAsAFQABAAAAAAAGAAcASwABAAAAAAAKABoAigADAAEECQABAA4ABwADAAEECQACAA4AZwADAAEECQADAA4APQADAAEECQAEAA4AfAADAAEECQAFABYAIAADAAEECQAGAA4AUgADAAEECQAKADQApGZjaWNvbnMAZgBjAGkAYwBvAG4Ac1ZlcnNpb24gMS4wAFYAZQByAHMAaQBvAG4AIAAxAC4AMGZjaWNvbnMAZgBjAGkAYwBvAG4Ac2ZjaWNvbnMAZgBjAGkAYwBvAG4Ac1JlZ3VsYXIAUgBlAGcAdQBsAGEAcmZjaWNvbnMAZgBjAGkAYwBvAG4Ac0ZvbnQgZ2VuZXJhdGVkIGJ5IEljb01vb24uAEYAbwBuAHQAIABnAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAEkAYwBvAE0AbwBvAG4ALgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=") format("truetype")}.fc-icon{speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;display:inline-block;font-family:fcicons!important;font-style:normal;font-variant:normal;font-weight:400;height:1em;line-height:1;text-align:center;text-transform:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:1em}.fc-icon-chevron-left:before{content:"\\e900"}.fc-icon-chevron-right:before{content:"\\e901"}.fc-icon-chevrons-left:before{content:"\\e902"}.fc-icon-chevrons-right:before{content:"\\e903"}.fc-icon-minus-square:before{content:"\\e904"}.fc-icon-plus-square:before{content:"\\e905"}.fc-icon-x:before{content:"\\e906"}.fc .fc-button{border-radius:0;font-family:inherit;font-size:inherit;line-height:inherit;margin:0;overflow:visible;text-transform:none}.fc .fc-button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}.fc .fc-button{-webkit-appearance:button}.fc .fc-button:not(:disabled){cursor:pointer}.fc .fc-button::-moz-focus-inner{border-style:none;padding:0}.fc .fc-button{background-color:transparent;border:1px solid transparent;border-radius:.25em;display:inline-block;font-size:1em;font-weight:400;line-height:1.5;padding:.4em .65em;text-align:center;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle}.fc .fc-button:hover{text-decoration:none}.fc .fc-button:focus{box-shadow:0 0 0 .2rem rgba(44,62,80,.25);outline:0}.fc .fc-button:disabled{opacity:.65}.fc .fc-button-primary{background-color:var(--fc-button-bg-color);border-color:var(--fc-button-border-color);color:var(--fc-button-text-color)}.fc .fc-button-primary:hover{background-color:var(--fc-button-hover-bg-color);border-color:var(--fc-button-hover-border-color);color:var(--fc-button-text-color)}.fc .fc-button-primary:disabled{background-color:var(--fc-button-bg-color);border-color:var(--fc-button-border-color);color:var(--fc-button-text-color)}.fc .fc-button-primary:focus{box-shadow:0 0 0 .2rem rgba(76,91,106,.5)}.fc .fc-button-primary:not(:disabled).fc-button-active,.fc .fc-button-primary:not(:disabled):active{background-color:var(--fc-button-active-bg-color);border-color:var(--fc-button-active-border-color);color:var(--fc-button-text-color)}.fc .fc-button-primary:not(:disabled).fc-button-active:focus,.fc .fc-button-primary:not(:disabled):active:focus{box-shadow:0 0 0 .2rem rgba(76,91,106,.5)}.fc .fc-button .fc-icon{font-size:1.5em;vertical-align:middle}.fc .fc-button-group{display:inline-flex;position:relative;vertical-align:middle}.fc .fc-button-group>.fc-button{flex:1 1 auto;position:relative}.fc .fc-button-group>.fc-button.fc-button-active,.fc .fc-button-group>.fc-button:active,.fc .fc-button-group>.fc-button:focus,.fc .fc-button-group>.fc-button:hover{z-index:1}.fc-direction-ltr .fc-button-group>.fc-button:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0;margin-left:-1px}.fc-direction-ltr .fc-button-group>.fc-button:not(:last-child){border-bottom-right-radius:0;border-top-right-radius:0}.fc-direction-rtl .fc-button-group>.fc-button:not(:first-child){border-bottom-right-radius:0;border-top-right-radius:0;margin-right:-1px}.fc-direction-rtl .fc-button-group>.fc-button:not(:last-child){border-bottom-left-radius:0;border-top-left-radius:0}.fc .fc-toolbar{align-items:center;display:flex;justify-content:space-between}.fc .fc-toolbar.fc-header-toolbar{margin-bottom:1.5em}.fc .fc-toolbar.fc-footer-toolbar{margin-top:1.5em}.fc .fc-toolbar-title{font-size:1.75em;margin:0}.fc-direction-ltr .fc-toolbar>*>:not(:first-child){margin-left:.75em}.fc-direction-rtl .fc-toolbar>*>:not(:first-child){margin-right:.75em}.fc-direction-rtl .fc-toolbar-ltr{flex-direction:row-reverse}.fc .fc-scroller{-webkit-overflow-scrolling:touch;position:relative}.fc .fc-scroller-liquid{height:100%}.fc .fc-scroller-liquid-absolute{bottom:0;left:0;position:absolute;right:0;top:0}.fc .fc-scroller-harness{direction:ltr;overflow:hidden;position:relative}.fc .fc-scroller-harness-liquid{height:100%}.fc-direction-rtl .fc-scroller-harness>.fc-scroller{direction:rtl}.fc-theme-standard .fc-scrollgrid{border:1px solid var(--fc-border-color)}.fc .fc-scrollgrid,.fc .fc-scrollgrid table{table-layout:fixed;width:100%}.fc .fc-scrollgrid table{border-left-style:hidden;border-right-style:hidden;border-top-style:hidden}.fc .fc-scrollgrid{border-bottom-width:0;border-collapse:separate;border-right-width:0}.fc .fc-scrollgrid-liquid{height:100%}.fc .fc-scrollgrid-section,.fc .fc-scrollgrid-section table,.fc .fc-scrollgrid-section>td{height:1px}.fc .fc-scrollgrid-section-liquid>td{height:100%}.fc .fc-scrollgrid-section>*{border-left-width:0;border-top-width:0}.fc .fc-scrollgrid-section-footer>*,.fc .fc-scrollgrid-section-header>*{border-bottom-width:0}.fc .fc-scrollgrid-section-body table,.fc .fc-scrollgrid-section-footer table{border-bottom-style:hidden}.fc .fc-scrollgrid-section-sticky>*{background:var(--fc-page-bg-color);position:sticky;z-index:3}.fc .fc-scrollgrid-section-header.fc-scrollgrid-section-sticky>*{top:0}.fc .fc-scrollgrid-section-footer.fc-scrollgrid-section-sticky>*{bottom:0}.fc .fc-scrollgrid-sticky-shim{height:1px;margin-bottom:-1px}.fc-sticky{position:sticky}.fc .fc-view-harness{flex-grow:1;position:relative}.fc .fc-view-harness-active>.fc-view{bottom:0;left:0;position:absolute;right:0;top:0}.fc .fc-col-header-cell-cushion{display:inline-block;padding:2px 4px}.fc .fc-bg-event,.fc .fc-highlight,.fc .fc-non-business{bottom:0;left:0;position:absolute;right:0;top:0}.fc .fc-non-business{background:var(--fc-non-business-color)}.fc .fc-bg-event{background:var(--fc-bg-event-color);opacity:var(--fc-bg-event-opacity)}.fc .fc-bg-event .fc-event-title{font-size:var(--fc-small-font-size);font-style:italic;margin:.5em}.fc .fc-highlight{background:var(--fc-highlight-color)}.fc .fc-cell-shaded,.fc .fc-day-disabled{background:var(--fc-neutral-bg-color)}a.fc-event,a.fc-event:hover{text-decoration:none}.fc-event.fc-event-draggable,.fc-event[href]{cursor:pointer}.fc-event .fc-event-main{position:relative;z-index:2}.fc-event-dragging:not(.fc-event-selected){opacity:.75}.fc-event-dragging.fc-event-selected{box-shadow:0 2px 7px rgba(0,0,0,.3)}.fc-event .fc-event-resizer{display:none;position:absolute;z-index:4}.fc-event-selected .fc-event-resizer,.fc-event:hover .fc-event-resizer{display:block}.fc-event-selected .fc-event-resizer{background:var(--fc-page-bg-color);border-color:inherit;border-radius:calc(var(--fc-event-resizer-dot-total-width)/2);border-style:solid;border-width:var(--fc-event-resizer-dot-border-width);height:var(--fc-event-resizer-dot-total-width);width:var(--fc-event-resizer-dot-total-width)}.fc-event-selected .fc-event-resizer:before{bottom:-20px;content:"";left:-20px;position:absolute;right:-20px;top:-20px}.fc-event-selected,.fc-event:focus{box-shadow:0 2px 5px rgba(0,0,0,.2)}.fc-event-selected:before,.fc-event:focus:before{bottom:0;content:"";left:0;position:absolute;right:0;top:0;z-index:3}.fc-event-selected:after,.fc-event:focus:after{background:var(--fc-event-selected-overlay-color);bottom:-1px;content:"";left:-1px;position:absolute;right:-1px;top:-1px;z-index:1}.fc-h-event{background-color:var(--fc-event-bg-color);border:1px solid var(--fc-event-border-color);display:block}.fc-h-event .fc-event-main{color:var(--fc-event-text-color)}.fc-h-event .fc-event-main-frame{display:flex}.fc-h-event .fc-event-time{max-width:100%;overflow:hidden}.fc-h-event .fc-event-title-container{flex-grow:1;flex-shrink:1;min-width:0}.fc-h-event .fc-event-title{display:inline-block;left:0;max-width:100%;overflow:hidden;right:0;vertical-align:top}.fc-h-event.fc-event-selected:before{bottom:-10px;top:-10px}.fc-direction-ltr .fc-daygrid-block-event:not(.fc-event-start),.fc-direction-rtl .fc-daygrid-block-event:not(.fc-event-end){border-bottom-left-radius:0;border-left-width:0;border-top-left-radius:0}.fc-direction-ltr .fc-daygrid-block-event:not(.fc-event-end),.fc-direction-rtl .fc-daygrid-block-event:not(.fc-event-start){border-bottom-right-radius:0;border-right-width:0;border-top-right-radius:0}.fc-h-event:not(.fc-event-selected) .fc-event-resizer{bottom:0;top:0;width:var(--fc-event-resizer-thickness)}.fc-direction-ltr .fc-h-event:not(.fc-event-selected) .fc-event-resizer-start,.fc-direction-rtl .fc-h-event:not(.fc-event-selected) .fc-event-resizer-end{cursor:w-resize;left:calc(var(--fc-event-resizer-thickness)*-.5)}.fc-direction-ltr .fc-h-event:not(.fc-event-selected) .fc-event-resizer-end,.fc-direction-rtl .fc-h-event:not(.fc-event-selected) .fc-event-resizer-start{cursor:e-resize;right:calc(var(--fc-event-resizer-thickness)*-.5)}.fc-h-event.fc-event-selected .fc-event-resizer{margin-top:calc(var(--fc-event-resizer-dot-total-width)*-.5);top:50%}.fc-direction-ltr .fc-h-event.fc-event-selected .fc-event-resizer-start,.fc-direction-rtl .fc-h-event.fc-event-selected .fc-event-resizer-end{left:calc(var(--fc-event-resizer-dot-total-width)*-.5)}.fc-direction-ltr .fc-h-event.fc-event-selected .fc-event-resizer-end,.fc-direction-rtl .fc-h-event.fc-event-selected .fc-event-resizer-start{right:calc(var(--fc-event-resizer-dot-total-width)*-.5)}.fc .fc-popover{box-shadow:0 2px 6px rgba(0,0,0,.15);position:absolute;z-index:9999}.fc .fc-popover-header{align-items:center;display:flex;flex-direction:row;justify-content:space-between;padding:3px 4px}.fc .fc-popover-title{margin:0 2px}.fc .fc-popover-close{cursor:pointer;font-size:1.1em;opacity:.65}.fc-theme-standard .fc-popover{background:var(--fc-page-bg-color);border:1px solid var(--fc-border-color)}.fc-theme-standard .fc-popover-header{background:var(--fc-neutral-bg-color)}');const Eo=[],Co={code:"en",week:{dow:0,doy:4},direction:"ltr",buttonText:{prev:"prev",next:"next",prevYear:"prev year",nextYear:"next year",year:"year",today:"today",month:"month",week:"week",day:"day",list:"list"},weekText:"W",weekTextLong:"Week",closeHint:"Close",timeHint:"Time",eventHint:"Event",allDayText:"all-day",moreLinkText:"more",noEventsText:"No events to display"},wo=Object.assign(Object.assign({},Co),{buttonHints:{prev:"Previous $0",next:"Next $0",today:(e,t)=>"day"===t?"Today":"This "+e},viewHint:"$0 view",navLinkHint:"Go to $0",moreLinkHint:e=>`Show ${e} more event${1===e?"":"s"}`});function Do(e){let t=e.length>0?e[0].code:"en",n=Eo.concat(e),r={en:wo};for(let e of n)r[e.code]=e;return{map:r,defaultCode:t}}function Ro(e,t){return"object"!=typeof e||Array.isArray(e)?function(e,t){let n=[].concat(e||[]),r=function(e,t){for(let n=0;n<e.length;n+=1){let r=e[n].toLocaleLowerCase().split("-");for(let e=r.length;e>0;e-=1){let n=r.slice(0,e).join("-");if(t[n])return t[n]}}return null}(n,t)||wo;return Ao(e,n,r)}(e,t):Ao(e.code,[e.code],e)}function Ao(e,t,n){let r=Ce([Co,n],["buttonText"]);delete r.code;let{week:i}=r;return delete r.week,{codeArg:e,codes:t,week:i,simpleNumberFormat:new Intl.NumberFormat(e),options:r}}function xo(e){return{id:it(),name:e.name,premiumReleaseDate:e.premiumReleaseDate?new Date(e.premiumReleaseDate):void 0,deps:e.deps||[],reducers:e.reducers||[],isLoadingFuncs:e.isLoadingFuncs||[],contextInit:[].concat(e.contextInit||[]),eventRefiners:e.eventRefiners||{},eventDefMemberAdders:e.eventDefMemberAdders||[],eventSourceRefiners:e.eventSourceRefiners||{},isDraggableTransformers:e.isDraggableTransformers||[],eventDragMutationMassagers:e.eventDragMutationMassagers||[],eventDefMutationAppliers:e.eventDefMutationAppliers||[],dateSelectionTransformers:e.dateSelectionTransformers||[],datePointTransforms:e.datePointTransforms||[],dateSpanTransforms:e.dateSpanTransforms||[],views:e.views||{},viewPropsTransformers:e.viewPropsTransformers||[],isPropsValid:e.isPropsValid||null,externalDefTransforms:e.externalDefTransforms||[],viewContainerAppends:e.viewContainerAppends||[],eventDropTransformers:e.eventDropTransformers||[],componentInteractions:e.componentInteractions||[],calendarInteractions:e.calendarInteractions||[],themeClasses:e.themeClasses||{},eventSourceDefs:e.eventSourceDefs||[],cmdFormatter:e.cmdFormatter,recurringTypes:e.recurringTypes||[],namedTimeZonedImpl:e.namedTimeZonedImpl,initialView:e.initialView||"",elementDraggingImpl:e.elementDraggingImpl,optionChangeHandlers:e.optionChangeHandlers||{},scrollGridImpl:e.scrollGridImpl||null,listenerRefiners:e.listenerRefiners||{},optionRefiners:e.optionRefiners||{},propSetHandlers:e.propSetHandlers||{}}}function To(){let e,t=[],n=[];return(r,i)=>(e&&Ne(r,t)&&Ne(i,n)||(e=function(e,t){let n={},r={premiumReleaseDate:void 0,reducers:[],isLoadingFuncs:[],contextInit:[],eventRefiners:{},eventDefMemberAdders:[],eventSourceRefiners:{},isDraggableTransformers:[],eventDragMutationMassagers:[],eventDefMutationAppliers:[],dateSelectionTransformers:[],datePointTransforms:[],dateSpanTransforms:[],views:{},viewPropsTransformers:[],isPropsValid:null,externalDefTransforms:[],viewContainerAppends:[],eventDropTransformers:[],componentInteractions:[],calendarInteractions:[],themeClasses:{},eventSourceDefs:[],cmdFormatter:null,recurringTypes:[],namedTimeZonedImpl:null,initialView:"",elementDraggingImpl:null,optionChangeHandlers:{},scrollGridImpl:null,listenerRefiners:{},optionRefiners:{},propSetHandlers:{}};function i(e){for(let o of e){const e=o.name,l=n[e];void 0===l?(n[e]=o.id,i(o.deps),s=o,r={premiumReleaseDate:_o((t=r).premiumReleaseDate,s.premiumReleaseDate),reducers:t.reducers.concat(s.reducers),isLoadingFuncs:t.isLoadingFuncs.concat(s.isLoadingFuncs),contextInit:t.contextInit.concat(s.contextInit),eventRefiners:Object.assign(Object.assign({},t.eventRefiners),s.eventRefiners),eventDefMemberAdders:t.eventDefMemberAdders.concat(s.eventDefMemberAdders),eventSourceRefiners:Object.assign(Object.assign({},t.eventSourceRefiners),s.eventSourceRefiners),isDraggableTransformers:t.isDraggableTransformers.concat(s.isDraggableTransformers),eventDragMutationMassagers:t.eventDragMutationMassagers.concat(s.eventDragMutationMassagers),eventDefMutationAppliers:t.eventDefMutationAppliers.concat(s.eventDefMutationAppliers),dateSelectionTransformers:t.dateSelectionTransformers.concat(s.dateSelectionTransformers),datePointTransforms:t.datePointTransforms.concat(s.datePointTransforms),dateSpanTransforms:t.dateSpanTransforms.concat(s.dateSpanTransforms),views:Object.assign(Object.assign({},t.views),s.views),viewPropsTransformers:t.viewPropsTransformers.concat(s.viewPropsTransformers),isPropsValid:s.isPropsValid||t.isPropsValid,externalDefTransforms:t.externalDefTransforms.concat(s.externalDefTransforms),viewContainerAppends:t.viewContainerAppends.concat(s.viewContainerAppends),eventDropTransformers:t.eventDropTransformers.concat(s.eventDropTransformers),calendarInteractions:t.calendarInteractions.concat(s.calendarInteractions),componentInteractions:t.componentInteractions.concat(s.componentInteractions),themeClasses:Object.assign(Object.assign({},t.themeClasses),s.themeClasses),eventSourceDefs:t.eventSourceDefs.concat(s.eventSourceDefs),cmdFormatter:s.cmdFormatter||t.cmdFormatter,recurringTypes:t.recurringTypes.concat(s.recurringTypes),namedTimeZonedImpl:s.namedTimeZonedImpl||t.namedTimeZonedImpl,initialView:t.initialView||s.initialView,elementDraggingImpl:t.elementDraggingImpl||s.elementDraggingImpl,optionChangeHandlers:Object.assign(Object.assign({},t.optionChangeHandlers),s.optionChangeHandlers),scrollGridImpl:s.scrollGridImpl||t.scrollGridImpl,listenerRefiners:Object.assign(Object.assign({},t.listenerRefiners),s.listenerRefiners),optionRefiners:Object.assign(Object.assign({},t.optionRefiners),s.optionRefiners),propSetHandlers:Object.assign(Object.assign({},t.propSetHandlers),s.propSetHandlers)}):l!==o.id&&console.warn(`Duplicate plugin '${e}'`)}var t,s}return e&&i(e),i(t),r}(r,i)),t=r,n=i,e)}function _o(e,t){return void 0===e?t:void 0===t?e:new Date(Math.max(e.valueOf(),t.valueOf()))}class ko extends an{}function Mo(e,t,n,r){if(t[e])return t[e];let i=function(e,t,n,r){let i=n[e],s=r[e],o=e=>i&&null!==i[e]?i[e]:s&&null!==s[e]?s[e]:null,l=o("component"),a=o("superType"),c=null;if(a){if(a===e)throw new Error("Can't have a custom view type that references itself");c=Mo(a,t,n,r)}!l&&c&&(l=c.component);if(!l)return null;return{type:e,component:l,defaults:Object.assign(Object.assign({},c?c.defaults:{}),i?i.rawOptions:{}),overrides:Object.assign(Object.assign({},c?c.overrides:{}),s?s.rawOptions:{})}}(e,t,n,r);return i&&(t[e]=i),i}function Io(e){return De(e,Oo)}function Oo(e){let t="function"==typeof e?{component:e}:e,{component:n}=t;var r;return t.content&&(r=t,n=e=>f(Wn.Consumer,null,t=>f(qn,{elTag:"div",elClasses:Zn(t.viewSpec),renderProps:Object.assign(Object.assign({},e),{nextDayThreshold:t.options.nextDayThreshold}),generatorName:void 0,generator:r.content,classNameGenerator:r.classNames,didMount:r.didMount,willUnmount:r.willUnmount}))),{superType:t.type,component:n,rawOptions:t}}function No(e,t,n,r){let i=Io(e),s=Io(t.views);return De(function(e,t){let n,r={};for(n in e)Mo(n,r,e,t);for(n in t)Mo(n,r,e,t);return r}(i,s),e=>function(e,t,n,r,i){let s=e.overrides.duration||e.defaults.duration||r.duration||n.duration,o=null,l="",a="",c={};if(s&&(o=function(e){let t=JSON.stringify(e),n=Po[t];void 0===n&&(n=Gt(e),Po[t]=n);return n}(s),o)){let e=Kt(o);l=e.unit,1===e.value&&(a=l,c=t[l]?t[l].rawOptions:{})}let d=t=>{let n=t.buttonText||{},r=e.defaults.buttonTextKey;return null!=r&&null!=n[r]?n[r]:null!=n[e.type]?n[e.type]:null!=n[a]?n[a]:null},u=t=>{let n=t.buttonHints||{},r=e.defaults.buttonTextKey;return null!=r&&null!=n[r]?n[r]:null!=n[e.type]?n[e.type]:null!=n[a]?n[a]:null};return{type:e.type,component:e.component,duration:o,durationUnit:l,singleUnit:a,optionDefaults:e.defaults,optionOverrides:Object.assign(Object.assign({},c),e.overrides),buttonTextOverride:d(r)||d(n)||e.overrides.buttonText,buttonTextDefault:d(i)||e.defaults.buttonText||d(Dn)||e.type,buttonTitleOverride:u(r)||u(n)||e.overrides.buttonHint,buttonTitleDefault:u(i)||e.defaults.buttonHint||u(Dn)}}(e,s,t,n,r))}ko.prototype.classes={root:"fc-theme-standard",tableCellShaded:"fc-cell-shaded",buttonGroup:"fc-button-group",button:"fc-button fc-button-primary",buttonActive:"fc-button-active"},ko.prototype.baseIconClass="fc-icon",ko.prototype.iconClasses={close:"fc-icon-x",prev:"fc-icon-chevron-left",next:"fc-icon-chevron-right",prevYear:"fc-icon-chevrons-left",nextYear:"fc-icon-chevrons-right"},ko.prototype.rtlIconClasses={prev:"fc-icon-chevron-right",next:"fc-icon-chevron-left",prevYear:"fc-icon-chevrons-right",nextYear:"fc-icon-chevrons-left"},ko.prototype.iconOverrideOption="buttonIcons",ko.prototype.iconOverrideCustomButtonOption="icon",ko.prototype.iconOverridePrefix="fc-icon-";let Po={};function Ho(e,t,n){let r=t?t.activeRange:null;return jo({},function(e,t){let n=Or(t),r=[].concat(e.eventSources||[]),i=[];e.initialEvents&&r.unshift(e.initialEvents);e.events&&r.unshift(e.events);for(let e of r){let r=Ir(e,t,n);r&&i.push(r)}return i}(e,n),r,n)}function Wo(e,t,n,r){let i=n?n.activeRange:null;switch(t.type){case"ADD_EVENT_SOURCES":return jo(e,t.sources,i,r);case"REMOVE_EVENT_SOURCE":return s=e,o=t.sourceId,we(s,e=>e.sourceId!==o);case"PREV":case"NEXT":case"CHANGE_DATE":case"CHANGE_VIEW_TYPE":return n?Lo(e,i,r):e;case"FETCH_EVENT_SOURCES":return zo(e,t.sourceIds?Re(t.sourceIds):Go(e,r),i,t.isRefetch||!1,r);case"RECEIVE_EVENTS":case"RECEIVE_EVENT_ERROR":return function(e,t,n,r){let i=e[t];if(i&&n===i.latestFetchId)return Object.assign(Object.assign({},e),{[t]:Object.assign(Object.assign({},i),{isFetching:!1,fetchRange:r})});return e}(e,t.sourceId,t.fetchId,t.fetchRange);case"REMOVE_ALL_EVENT_SOURCES":return{};default:return e}var s,o}function Bo(e){for(let t in e)if(e[t].isFetching)return!0;return!1}function jo(e,t,n,r){let i={};for(let e of t)i[e.sourceId]=e;return n&&(i=Lo(i,n,r)),Object.assign(Object.assign({},e),i)}function Lo(e,t,n){return zo(e,we(e,e=>function(e,t,n){if(!Fo(e,n))return!e.latestFetchId;return!n.options.lazyFetching||!e.fetchRange||e.isFetching||t.start<e.fetchRange.start||t.end>e.fetchRange.end}(e,t,n)),t,!1,n)}function zo(e,t,n,r,i){let s={};for(let o in e){let l=e[o];t[o]?s[o]=Uo(l,n,r,i):s[o]=l}return s}function Uo(e,t,n,r){let{options:i,calendarApi:s}=r,o=r.pluginHooks.eventSourceDefs[e.sourceDefId],l=it();return o.fetch({eventSource:e,range:t,isRefetch:n,context:r},n=>{let{rawEvents:o}=n;i.eventSourceSuccess&&(o=i.eventSourceSuccess.call(s,o,n.response)||o),e.success&&(o=e.success.call(s,o,n.response)||o),r.dispatch({type:"RECEIVE_EVENTS",sourceId:e.sourceId,fetchId:l,fetchRange:t,rawEvents:o})},n=>{let o=!1;i.eventSourceFailure&&(i.eventSourceFailure.call(s,n),o=!0),e.failure&&(e.failure(n),o=!0),o||console.warn(n.message,n),r.dispatch({type:"RECEIVE_EVENT_ERROR",sourceId:e.sourceId,fetchId:l,fetchRange:t,error:n})}),Object.assign(Object.assign({},e),{isFetching:!0,latestFetchId:l})}function Go(e,t){return we(e,e=>Fo(e,t))}function Fo(e,t){return!t.pluginHooks.eventSourceDefs[e.sourceDefId].ignoreRange}function Vo(e,t){switch(t.type){case"UNSELECT_DATES":return null;case"SELECT_DATES":return t.selection;default:return e}}function qo(e,t){switch(t.type){case"UNSELECT_EVENT":return"";case"SELECT_EVENT":return t.eventInstanceId;default:return e}}function Yo(e,t){let n;switch(t.type){case"UNSET_EVENT_DRAG":return null;case"SET_EVENT_DRAG":return n=t.state,{affectedEvents:n.affectedEvents,mutatedEvents:n.mutatedEvents,isEvent:n.isEvent};default:return e}}function Qo(e,t){let n;switch(t.type){case"UNSET_EVENT_RESIZE":return null;case"SET_EVENT_RESIZE":return n=t.state,{affectedEvents:n.affectedEvents,mutatedEvents:n.mutatedEvents,isEvent:n.isEvent};default:return e}}function Zo(e,t,n,r,i){return{header:e.headerToolbar?Xo(e.headerToolbar,e,t,n,r,i):null,footer:e.footerToolbar?Xo(e.footerToolbar,e,t,n,r,i):null}}function Xo(e,t,n,r,i,s){let o={},l=[],a=!1;for(let c in e){let d=Jo(e[c],t,n,r,i,s);o[c]=d.widgets,l.push(...d.viewsWithButtons),a=a||d.hasTitle}return{sectionWidgets:o,viewsWithButtons:l,hasTitle:a}}function Jo(e,t,n,r,i,s){let o="rtl"===t.direction,l=t.customButtons||{},a=n.buttonText||{},c=t.buttonText||{},d=n.buttonHints||{},u=t.buttonHints||{},h=e?e.split(" "):[],f=[],p=!1;return{widgets:h.map(e=>e.split(",").map(e=>{if("title"===e)return p=!0,{buttonName:e};let n,h,g,m,v,y;if(n=l[e])g=e=>{n.click&&n.click.call(e.target,e,e.target)},(m=r.getCustomButtonIconClass(n))||(m=r.getIconClass(e,o))||(v=n.text),y=n.hint||n.text;else if(h=i[e]){f.push(e),g=()=>{s.changeView(e)},(v=h.buttonTextOverride)||(m=r.getIconClass(e,o))||(v=h.buttonTextDefault);let n=h.buttonTextOverride||h.buttonTextDefault;y=mt(h.buttonTitleOverride||h.buttonTitleDefault||t.viewHint,[n,e],n)}else if(s[e])if(g=()=>{s[e]()},(v=a[e])||(m=r.getIconClass(e,o))||(v=c[e]),"prevYear"===e||"nextYear"===e){let t="prevYear"===e?"prev":"next";y=mt(d[t]||u[t],[c.year||"year","year"],c[e])}else y=t=>mt(d[e]||u[e],[c[t]||t,t],c[e]);return{buttonName:e,buttonClick:g,buttonIcon:m,buttonText:v,buttonHint:y}})),viewsWithButtons:f,hasTitle:p}}class $o{constructor(e,t,n){this.type=e,this.getCurrentData=t,this.dateEnv=n}get calendar(){return this.getCurrentData().calendarApi}get title(){return this.getCurrentData().viewTitle}get activeStart(){return this.dateEnv.toDate(this.getCurrentData().dateProfile.activeRange.start)}get activeEnd(){return this.dateEnv.toDate(this.getCurrentData().dateProfile.activeRange.end)}get currentStart(){return this.dateEnv.toDate(this.getCurrentData().dateProfile.currentRange.start)}get currentEnd(){return this.dateEnv.toDate(this.getCurrentData().dateProfile.currentRange.end)}getOption(e){return this.getCurrentData().options[e]}}function Ko(e,t){let n=Ae(t.getCurrentData().eventSources),r=[];for(let t of e){let e=!1;for(let r=0;r<n.length;r+=1)if(n[r]._raw===t){n.splice(r,1),e=!0;break}e||r.push(t)}for(let e of n)t.dispatch({type:"REMOVE_EVENT_SOURCE",sourceId:e.sourceId});for(let e of r)t.calendarApi.addEventSource(e)}const el=[xo({name:"array-event-source",eventSourceDefs:[{ignoreRange:!0,parseMeta:e=>Array.isArray(e.events)?e.events:null,fetch(e,t){t({rawEvents:e.eventSource.meta})}}]}),xo({name:"func-event-source",eventSourceDefs:[{parseMeta:e=>"function"==typeof e.events?e.events:null,fetch(e,t,n){const{dateEnv:r}=e.context;vi(e.eventSource.meta.bind(null,gi(e.range,r)),e=>t({rawEvents:e}),n)}}]}),xo({name:"json-event-source",eventSourceRefiners:{method:String,extraParams:In,startParam:String,endParam:String,timeZoneParam:String},eventSourceDefs:[{parseMeta:e=>!e.url||"json"!==e.format&&e.format?null:{url:e.url,format:"json",method:(e.method||"GET").toUpperCase(),extraParams:e.extraParams,startParam:e.startParam,endParam:e.endParam,timeZoneParam:e.timeZoneParam},fetch(e,t,n){const{meta:r}=e.eventSource,i=function(e,t,n){let r,i,s,o,{dateEnv:l,options:a}=n,c={};r=e.startParam,null==r&&(r=a.startParam);i=e.endParam,null==i&&(i=a.endParam);s=e.timeZoneParam,null==s&&(s=a.timeZoneParam);o="function"==typeof e.extraParams?e.extraParams():e.extraParams||{};Object.assign(c,o),c[r]=l.formatIso(t.start),c[i]=l.formatIso(t.end),"local"!==l.timeZone&&(c[s]=l.timeZone);return c}(r,e.range,e.context);bi(r.method,r.url,i).then(([e,n])=>{t({rawEvents:e,response:n})},n)}}]}),xo({name:"simple-recurring-event",recurringTypes:[{parse(e,t){if(e.daysOfWeek||e.startTime||e.endTime||e.startRecur||e.endRecur){let i,s={daysOfWeek:e.daysOfWeek||null,startTime:e.startTime||null,endTime:e.endTime||null,startRecur:e.startRecur?t.createMarker(e.startRecur):null,endRecur:e.endRecur?t.createMarker(e.endRecur):null};return e.duration&&(i=e.duration),!i&&e.startTime&&e.endTime&&(n=e.endTime,r=e.startTime,i={years:n.years-r.years,months:n.months-r.months,days:n.days-r.days,milliseconds:n.milliseconds-r.milliseconds}),{allDayGuess:Boolean(!e.startTime&&!e.endTime),duration:i,typeData:s}}var n,r;return null},expand(e,t,n){let r=$n(t,{start:e.startRecur,end:e.endRecur});return r?function(e,t,n,r){let i=e?Re(e):null,s=_t(n.start),o=n.end,l=[];for(;s<o;){let e;i&&!i[s.getUTCDay()]||(e=t?r.add(s,t):s,l.push(e)),s=Ct(s,1)}return l}(e.daysOfWeek,e.startTime,r,n):[]}}],eventRefiners:{daysOfWeek:In,startTime:Gt,endTime:Gt,duration:Gt,startRecur:In,endRecur:In}}),xo({name:"change-handler",optionChangeHandlers:{events(e,t){Ko([e],t)},eventSources:Ko}}),xo({name:"misc",isLoadingFuncs:[e=>Bo(e.eventSources)],propSetHandlers:{dateProfile:function(e,t){t.emitter.trigger("datesSet",Object.assign(Object.assign({},gi(e.activeRange,t.dateEnv)),{view:t.viewApi}))},eventStore:function(e,t){let{emitter:n}=t;n.hasHandlers("eventsSet")&&n.trigger("eventsSet",Zr(e,t))}}})];class tl{constructor(e,t){this.runTaskOption=e,this.drainedOption=t,this.queue=[],this.delayedRunner=new Se(this.drain.bind(this))}request(e,t){this.queue.push(e),this.delayedRunner.request(t)}pause(e){this.delayedRunner.pause(e)}resume(e,t){this.delayedRunner.resume(e,t)}drain(){let{queue:e}=this;for(;e.length;){let t,n=[];for(;t=e.shift();)this.runTask(t),n.push(t);this.drained(n)}}runTask(e){this.runTaskOption&&this.runTaskOption(e)}drained(e){this.drainedOption&&this.drainedOption(e)}}function nl(e,t,n){let r;return r=/^(year|month)$/.test(e.currentRangeUnit)?e.currentRange:e.activeRange,n.formatRange(r.start,r.end,Cn(t.titleFormat||function(e){let{currentRangeUnit:t}=e;if("year"===t)return{year:"numeric"};if("month"===t)return{year:"numeric",month:"long"};let n=Tt(e.currentRange.start,e.currentRange.end);if(null!==n&&n>1)return{year:"numeric",month:"short",day:"numeric"};return{year:"numeric",month:"long",day:"numeric"}}(e)),{isEndExclusive:e.isRangeAllDay,defaultSeparator:t.titleRangeSeparator})}class rl{constructor(e){this.computeOptionsData=Pe(this._computeOptionsData),this.computeCurrentViewData=Pe(this._computeCurrentViewData),this.organizeRawLocales=Pe(Do),this.buildLocale=Pe(Ro),this.buildPluginHooks=To(),this.buildDateEnv=Pe(il),this.buildTheme=Pe(sl),this.parseToolbars=Pe(Zo),this.buildViewSpecs=Pe(No),this.buildDateProfileGenerator=He(ol),this.buildViewApi=Pe(ll),this.buildViewUiProps=He(dl),this.buildEventUiBySource=Pe(al,xe),this.buildEventUiBases=Pe(cl),this.parseContextBusinessHours=He(hl),this.buildTitle=Pe(nl),this.emitter=new Wr,this.actionRunner=new tl(this._handleAction.bind(this),this.updateData.bind(this)),this.currentCalendarOptionsInput={},this.currentCalendarOptionsRefined={},this.currentViewOptionsInput={},this.currentViewOptionsRefined={},this.currentCalendarOptionsRefiners={},this.getCurrentData=()=>this.data,this.dispatch=e=>{this.actionRunner.request(e)},this.props=e,this.actionRunner.pause();let t={},n=this.computeOptionsData(e.optionOverrides,t,e.calendarApi),r=n.calendarOptions.initialView||n.pluginHooks.initialView,i=this.computeCurrentViewData(r,n,e.optionOverrides,t);e.calendarApi.currentDataManager=this,this.emitter.setThisContext(e.calendarApi),this.emitter.setOptions(i.options);let s=function(e,t){let n=e.initialDate;return null!=n?t.createMarker(n):lr(e.now,t)}(n.calendarOptions,n.dateEnv),o=i.dateProfileGenerator.build(s);nr(o.activeRange,s)||(s=o.currentRange.start);let l={dateEnv:n.dateEnv,options:n.calendarOptions,pluginHooks:n.pluginHooks,calendarApi:e.calendarApi,dispatch:this.dispatch,emitter:this.emitter,getCurrentData:this.getCurrentData};for(let e of n.pluginHooks.contextInit)e(l);let a=Ho(n.calendarOptions,o,l),c={dynamicOptionOverrides:t,currentViewType:r,currentDate:s,dateProfile:o,businessHours:this.parseContextBusinessHours(l),eventSources:a,eventUiBases:{},eventStore:{defs:{},instances:{}},renderableEventStore:{defs:{},instances:{}},dateSelection:null,eventSelection:"",eventDrag:null,eventResize:null,selectionConfig:this.buildViewUiProps(l).selectionConfig},d=Object.assign(Object.assign({},l),c);for(let e of n.pluginHooks.reducers)Object.assign(c,e(null,null,d));ul(c,l)&&this.emitter.trigger("loading",!0),this.state=c,this.updateData(),this.actionRunner.resume()}resetOptions(e,t){let{props:n}=this;n.optionOverrides=t?Object.assign(Object.assign({},n.optionOverrides),e):e,this.actionRunner.request({type:"NOTHING"})}_handleAction(e){let{props:t,state:n,emitter:r}=this,i=function(e,t){switch(t.type){case"SET_OPTION":return Object.assign(Object.assign({},e),{[t.optionName]:t.rawOptionValue});default:return e}}(n.dynamicOptionOverrides,e),s=this.computeOptionsData(t.optionOverrides,i,t.calendarApi),o=function(e,t){switch(t.type){case"CHANGE_VIEW_TYPE":e=t.viewType}return e}(n.currentViewType,e),l=this.computeCurrentViewData(o,s,t.optionOverrides,i);t.calendarApi.currentDataManager=this,r.setThisContext(t.calendarApi),r.setOptions(l.options);let a={dateEnv:s.dateEnv,options:s.calendarOptions,pluginHooks:s.pluginHooks,calendarApi:t.calendarApi,dispatch:this.dispatch,emitter:r,getCurrentData:this.getCurrentData},{currentDate:c,dateProfile:d}=n;this.data&&this.data.dateProfileGenerator!==l.dateProfileGenerator&&(d=l.dateProfileGenerator.build(c)),c=function(e,t){switch(t.type){case"CHANGE_DATE":return t.dateMarker;default:return e}}(c,e),d=function(e,t,n,r){let i;switch(t.type){case"CHANGE_VIEW_TYPE":return r.build(t.dateMarker||n);case"CHANGE_DATE":return r.build(t.dateMarker);case"PREV":if(i=r.buildPrev(e,n),i.isValid)return i;break;case"NEXT":if(i=r.buildNext(e,n),i.isValid)return i}return e}(d,e,c,l.dateProfileGenerator),"PREV"!==e.type&&"NEXT"!==e.type&&nr(d.currentRange,c)||(c=d.currentRange.start);let u=Wo(n.eventSources,e,d,a),h=Nr(n.eventStore,e,u,d,a),f=Bo(u)&&!l.options.progressiveEventRendering&&n.renderableEventStore||h,{eventUiSingleBase:p,selectionConfig:g}=this.buildViewUiProps(a),m=this.buildEventUiBySource(u),v={dynamicOptionOverrides:i,currentViewType:o,currentDate:c,dateProfile:d,eventSources:u,eventStore:h,renderableEventStore:f,selectionConfig:g,eventUiBases:this.buildEventUiBases(f.defs,p,m),businessHours:this.parseContextBusinessHours(a),dateSelection:Vo(n.dateSelection,e),eventSelection:qo(n.eventSelection,e),eventDrag:Yo(n.eventDrag,e),eventResize:Qo(n.eventResize,e)},y=Object.assign(Object.assign({},a),v);for(let t of s.pluginHooks.reducers)Object.assign(v,t(n,e,y));let b=ul(n,a),S=ul(v,a);!b&&S?r.trigger("loading",!0):b&&!S&&r.trigger("loading",!1),this.state=v,t.onAction&&t.onAction(e)}updateData(){let{props:e,state:t}=this,n=this.data,r=this.computeOptionsData(e.optionOverrides,t.dynamicOptionOverrides,e.calendarApi),i=this.computeCurrentViewData(t.currentViewType,r,e.optionOverrides,t.dynamicOptionOverrides),s=this.data=Object.assign(Object.assign(Object.assign({viewTitle:this.buildTitle(t.dateProfile,i.options,r.dateEnv),calendarApi:e.calendarApi,dispatch:this.dispatch,emitter:this.emitter,getCurrentData:this.getCurrentData},r),i),t),o=r.pluginHooks.optionChangeHandlers,l=n&&n.calendarOptions,a=r.calendarOptions;if(l&&l!==a){l.timeZone!==a.timeZone&&(t.eventSources=s.eventSources=function(e,t,n){let r=t?t.activeRange:null;return zo(e,Go(e,n),r,!0,n)}(s.eventSources,t.dateProfile,s),t.eventStore=s.eventStore=function(e,t,n){let{defs:r}=e,i=De(e.instances,e=>{let i=r[e.defId];return i.allDay||i.recurringDef?e:Object.assign(Object.assign({},e),{range:{start:n.createMarker(t.toDate(e.range.start,e.forcedStartTzo)),end:n.createMarker(t.toDate(e.range.end,e.forcedEndTzo))},forcedStartTzo:n.canComputeOffset?null:e.forcedStartTzo,forcedEndTzo:n.canComputeOffset?null:e.forcedEndTzo})});return{defs:r,instances:i}}(s.eventStore,n.dateEnv,s.dateEnv));for(let e in o)l[e]!==a[e]&&o[e](a[e],s)}e.onData&&e.onData(s)}_computeOptionsData(e,t,n){let{refinedOptions:r,pluginHooks:i,localeDefaults:s,availableLocaleData:o,extra:l}=this.processRawCalendarOptions(e,t);fl(l);let a=this.buildDateEnv(r.timeZone,r.locale,r.weekNumberCalculation,r.firstDay,r.weekText,i,o,r.defaultRangeSeparator),c=this.buildViewSpecs(i.views,e,t,s),d=this.buildTheme(r,i);return{calendarOptions:r,pluginHooks:i,dateEnv:a,viewSpecs:c,theme:d,toolbarConfig:this.parseToolbars(r,e,d,c,n),localeDefaults:s,availableRawLocales:o.map}}processRawCalendarOptions(e,t){let{locales:n,locale:r}=kn([Dn,e,t]),i=this.organizeRawLocales(n),s=i.map,o=this.buildLocale(r||i.defaultCode,s).options,l=this.buildPluginHooks(e.plugins||[],el),a=this.currentCalendarOptionsRefiners=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},wn),Rn),An),l.listenerRefiners),l.optionRefiners),c={},d=kn([Dn,o,e,t]),u={},h=this.currentCalendarOptionsInput,f=this.currentCalendarOptionsRefined,p=!1;for(let e in d)"plugins"!==e&&(d[e]===h[e]||xn[e]&&e in h&&xn[e](h[e],d[e])?u[e]=f[e]:a[e]?(u[e]=a[e](d[e]),p=!0):c[e]=h[e]);return p&&(this.currentCalendarOptionsInput=d,this.currentCalendarOptionsRefined=u),{rawOptions:this.currentCalendarOptionsInput,refinedOptions:this.currentCalendarOptionsRefined,pluginHooks:l,availableLocaleData:i,localeDefaults:o,extra:c}}_computeCurrentViewData(e,t,n,r){let i=t.viewSpecs[e];if(!i)throw new Error(`viewType "${e}" is not available. Please make sure you've loaded all neccessary plugins`);let{refinedOptions:s,extra:o}=this.processRawViewOptions(i,t.pluginHooks,t.localeDefaults,n,r);return fl(o),{viewSpec:i,options:s,dateProfileGenerator:this.buildDateProfileGenerator({dateProfileGeneratorClass:i.optionDefaults.dateProfileGeneratorClass,duration:i.duration,durationUnit:i.durationUnit,usesMinMaxTime:i.optionDefaults.usesMinMaxTime,dateEnv:t.dateEnv,calendarApi:this.props.calendarApi,slotMinTime:s.slotMinTime,slotMaxTime:s.slotMaxTime,showNonCurrentDates:s.showNonCurrentDates,dayCount:s.dayCount,dateAlignment:s.dateAlignment,dateIncrement:s.dateIncrement,hiddenDays:s.hiddenDays,weekends:s.weekends,nowInput:s.now,validRangeInput:s.validRange,visibleRangeInput:s.visibleRange,monthMode:s.monthMode,fixedWeekCount:s.fixedWeekCount}),viewApi:this.buildViewApi(e,this.getCurrentData,t.dateEnv)}}processRawViewOptions(e,t,n,r,i){let s=kn([Dn,e.optionDefaults,n,r,e.optionOverrides,i]),o=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},wn),Rn),An),_n),t.listenerRefiners),t.optionRefiners),l={},a=this.currentViewOptionsInput,c=this.currentViewOptionsRefined,d=!1,u={};for(let e in s)s[e]===a[e]||xn[e]&&xn[e](s[e],a[e])?l[e]=c[e]:(s[e]===this.currentCalendarOptionsInput[e]||xn[e]&&xn[e](s[e],this.currentCalendarOptionsInput[e])?e in this.currentCalendarOptionsRefined&&(l[e]=this.currentCalendarOptionsRefined[e]):o[e]?l[e]=o[e](s[e]):u[e]=s[e],d=!0);return d&&(this.currentViewOptionsInput=s,this.currentViewOptionsRefined=l),{rawOptions:this.currentViewOptionsInput,refinedOptions:this.currentViewOptionsRefined,extra:u}}}function il(e,t,n,r,i,s,o,l){let a=Ro(t||o.defaultCode,o.map);return new ln({calendarSystem:"gregory",timeZone:e,namedTimeZoneImpl:s.namedTimeZonedImpl,locale:a,weekNumberCalculation:n,firstDay:r,weekText:i,cmdFormatter:s.cmdFormatter,defaultSeparator:l})}function sl(e,t){return new(t.themeClasses[e.themeSystem]||ko)(e)}function ol(e){return new(e.dateProfileGeneratorClass||ar)(e)}function ll(e,t,n){return new $o(e,t,n)}function al(e){return De(e,e=>e.ui)}function cl(e,t,n){let r={"":t};for(let t in e){let i=e[t];i.sourceId&&n[i.sourceId]&&(r[t]=n[i.sourceId])}return r}function dl(e){let{options:t}=e;return{eventUiSingleBase:Tr({display:t.eventDisplay,editable:t.editable,startEditable:t.eventStartEditable,durationEditable:t.eventDurationEditable,constraint:t.eventConstraint,overlap:"boolean"==typeof t.eventOverlap?t.eventOverlap:void 0,allow:t.eventAllow,backgroundColor:t.eventBackgroundColor,borderColor:t.eventBorderColor,textColor:t.eventTextColor,color:t.eventColor},e),selectionConfig:Tr({constraint:t.selectConstraint,overlap:"boolean"==typeof t.selectOverlap?t.selectOverlap:void 0,allow:t.selectAllow},e)}}function ul(e,t){for(let n of t.pluginHooks.isLoadingFuncs)if(n(e))return!0;return!1}function hl(e){return jr(e.options.businessHours,e)}function fl(e,t){for(let n in e)console.warn(`Unknown option '${n}'`+(t?` for view '${t}'`:""))}class pl extends Ln{render(){return f("div",{className:"fc-toolbar-chunk"},...this.props.widgetGroups.map(e=>this.renderWidgetGroup(e)))}renderWidgetGroup(e){let{props:t}=this,{theme:n}=this.context,r=[],i=!0;for(let s of e){let{buttonName:e,buttonClick:o,buttonText:l,buttonIcon:a,buttonHint:c}=s;if("title"===e)i=!1,r.push(f("h2",{className:"fc-toolbar-title",id:t.titleId},t.title));else{let i=e===t.activeButton,s=!t.isTodayEnabled&&"today"===e||!t.isPrevEnabled&&"prev"===e||!t.isNextEnabled&&"next"===e,d=[`fc-${e}-button`,n.getClass("button")];i&&d.push(n.getClass("buttonActive")),r.push(f("button",{type:"button",title:"function"==typeof c?c(t.navUnit):c,disabled:s,"aria-pressed":i,className:d.join(" "),onClick:o},l||(a?f("span",{className:a}):"")))}}if(r.length>1){return f("div",{className:i&&n.getClass("buttonGroup")||""},...r)}return r[0]}}class gl extends Ln{render(){let e,t,{model:n,extraClassName:r}=this.props,i=!1,s=n.sectionWidgets,o=s.center;return s.left?(i=!0,e=s.left):e=s.start,s.right?(i=!0,t=s.right):t=s.end,f("div",{className:[r||"","fc-toolbar",i?"fc-toolbar-ltr":""].join(" ")},this.renderSection("start",e||[]),this.renderSection("center",o||[]),this.renderSection("end",t||[]))}renderSection(e,t){let{props:n}=this;return f(pl,{key:e,widgetGroups:t,title:n.title,navUnit:n.navUnit,activeButton:n.activeButton,isTodayEnabled:n.isTodayEnabled,isPrevEnabled:n.isPrevEnabled,isNextEnabled:n.isNextEnabled,titleId:n.titleId})}}class ml extends Ln{constructor(){super(...arguments),this.state={availableWidth:null},this.handleEl=e=>{this.el=e,zn(this.props.elRef,e),this.updateAvailableWidth()},this.handleResize=()=>{this.updateAvailableWidth()}}render(){let{props:e,state:t}=this,{aspectRatio:n}=e,r=["fc-view-harness",n||e.liquid||e.height?"fc-view-harness-active":"fc-view-harness-passive"],i="",s="";return n?null!==t.availableWidth?i=t.availableWidth/n:s=1/n*100+"%":i=e.height||"",f("div",{"aria-labelledby":e.labeledById,ref:this.handleEl,className:r.join(" "),style:{height:i,paddingBottom:s}},e.children)}componentDidMount(){this.context.addResizeHandler(this.handleResize)}componentWillUnmount(){this.context.removeResizeHandler(this.handleResize)}updateAvailableWidth(){this.el&&this.props.aspectRatio&&this.setState({availableWidth:this.el.offsetWidth})}}class vl extends wi{constructor(e){super(e),this.handleSegClick=(e,t)=>{let{component:n}=this,{context:r}=n,i=Kr(t);if(i&&n.isValidSegDownEl(e.target)){let s=Le(e.target,".fc-event-forced-url"),o=s?s.querySelector("a[href]").href:"";r.emitter.trigger("eventClick",{el:t,event:new Yr(n.context,i.eventRange.def,i.eventRange.instance),jsEvent:e,view:r.viewApi}),o&&!e.defaultPrevented&&(window.location.href=o)}},this.destroy=$e(e.el,"click",".fc-event",this.handleSegClick)}}class yl extends wi{constructor(e){super(e),this.handleEventElRemove=e=>{e===this.currentSegEl&&this.handleSegLeave(null,this.currentSegEl)},this.handleSegEnter=(e,t)=>{Kr(t)&&(this.currentSegEl=t,this.triggerEvent("eventMouseEnter",e,t))},this.handleSegLeave=(e,t)=>{this.currentSegEl&&(this.currentSegEl=null,this.triggerEvent("eventMouseLeave",e,t))},this.removeHoverListeners=function(e,t,n,r){let i;return $e(e,"mouseover",t,(e,t)=>{if(t!==i){i=t,n(e,t);let s=e=>{i=null,r(e,t),t.removeEventListener("mouseleave",s)};t.addEventListener("mouseleave",s)}})}(e.el,".fc-event",this.handleSegEnter,this.handleSegLeave)}destroy(){this.removeHoverListeners()}triggerEvent(e,t,n){let{component:r}=this,{context:i}=r,s=Kr(n);t&&!r.isValidSegDownEl(t.target)||i.emitter.trigger(e,{el:n,event:new Yr(i,s.eventRange.def,s.eventRange.instance),jsEvent:t,view:i.viewApi})}}class bl extends jn{constructor(){super(...arguments),this.buildViewContext=Pe(Bn),this.buildViewPropTransformers=Pe(El),this.buildToolbarProps=Pe(Sl),this.headerRef={current:null},this.footerRef={current:null},this.interactionsStore={},this.state={viewLabelId:Xe()},this.registerInteractiveComponent=(e,t)=>{let n=function(e,t){return{component:e,el:t.el,useEventCenter:null==t.useEventCenter||t.useEventCenter,isHitComboAllowed:t.isHitComboAllowed||null}}(e,t),r=[vl,yl].concat(this.props.pluginHooks.componentInteractions).map(e=>new e(n));this.interactionsStore[e.uid]=r,Ri[e.uid]=n},this.unregisterInteractiveComponent=e=>{let t=this.interactionsStore[e.uid];if(t){for(let e of t)e.destroy();delete this.interactionsStore[e.uid]}delete Ri[e.uid]},this.resizeRunner=new Se(()=>{this.props.emitter.trigger("_resize",!0),this.props.emitter.trigger("windowResize",{view:this.props.viewApi})}),this.handleWindowResize=e=>{let{options:t}=this.props;t.handleWindowResize&&e.target===window&&this.resizeRunner.request(t.windowResizeDelay)}}render(){let e,{props:t}=this,{toolbarConfig:n,options:r}=t,i=this.buildToolbarProps(t.viewSpec,t.dateProfile,t.dateProfileGenerator,t.currentDate,lr(t.options.now,t.dateEnv),t.viewTitle),s=!1,o="";t.isHeightAuto||t.forPrint?o="":null!=r.height?s=!0:null!=r.contentHeight?o=r.contentHeight:e=Math.max(r.aspectRatio,.5);let l=this.buildViewContext(t.viewSpec,t.viewApi,t.options,t.dateProfileGenerator,t.dateEnv,t.theme,t.pluginHooks,t.dispatch,t.getCurrentData,t.emitter,t.calendarApi,this.registerInteractiveComponent,this.unregisterInteractiveComponent),a=n.header&&n.header.hasTitle?this.state.viewLabelId:"";return f(Wn.Provider,{value:l},n.header&&f(gl,Object.assign({ref:this.headerRef,extraClassName:"fc-header-toolbar",model:n.header,titleId:a},i)),f(ml,{liquid:s,height:o,aspectRatio:e,labeledById:a},this.renderView(t),this.buildAppendContent()),n.footer&&f(gl,Object.assign({ref:this.footerRef,extraClassName:"fc-footer-toolbar",model:n.footer,titleId:""},i)))}componentDidMount(){let{props:e}=this;this.calendarInteractions=e.pluginHooks.calendarInteractions.map(t=>new t(e)),window.addEventListener("resize",this.handleWindowResize);let{propSetHandlers:t}=e.pluginHooks;for(let n in t)t[n](e[n],e)}componentDidUpdate(e){let{props:t}=this,{propSetHandlers:n}=t.pluginHooks;for(let r in n)t[r]!==e[r]&&n[r](t[r],t)}componentWillUnmount(){window.removeEventListener("resize",this.handleWindowResize),this.resizeRunner.clear();for(let e of this.calendarInteractions)e.destroy();this.props.emitter.trigger("_unmount")}buildAppendContent(){let{props:e}=this;return f(g,{},...e.pluginHooks.viewContainerAppends.map(t=>t(e)))}renderView(e){let{pluginHooks:t}=e,{viewSpec:n}=e,r={dateProfile:e.dateProfile,businessHours:e.businessHours,eventStore:e.renderableEventStore,eventUiBases:e.eventUiBases,dateSelection:e.dateSelection,eventSelection:e.eventSelection,eventDrag:e.eventDrag,eventResize:e.eventResize,isHeightAuto:e.isHeightAuto,forPrint:e.forPrint},i=this.buildViewPropTransformers(t.viewPropsTransformers);for(let t of i)Object.assign(r,t.transform(r,e));return f(n.component,Object.assign({},r))}}function Sl(e,t,n,r,i,s){let o=n.build(i,void 0,!1),l=n.buildPrev(t,r,!1),a=n.buildNext(t,r,!1);return{title:s,activeButton:e.type,navUnit:e.singleUnit,isTodayEnabled:o.isValid&&!nr(t.currentRange,i),isPrevEnabled:l.isValid,isNextEnabled:a.isValid}}function El(e){return e.map(e=>new e)}function Cl(e){let t=Ro(e.locale||"en",Do([]).map);return new ln(Object.assign(Object.assign({timeZone:Dn.timeZone,calendarSystem:"gregory"},e),{locale:t}))}ds.touchMouseIgnoreWait=500;let wl=0,Dl=0,Rl=!1;class Al{constructor(e){this.subjectEl=null,this.selector="",this.handleSelector="",this.shouldIgnoreMove=!1,this.shouldWatchScroll=!0,this.isDragging=!1,this.isTouchDragging=!1,this.wasTouchScroll=!1,this.handleMouseDown=e=>{if(!this.shouldIgnoreMouse()&&function(e){return 0===e.button&&!e.ctrlKey}(e)&&this.tryStart(e)){let t=this.createEventFromMouse(e,!0);this.emitter.trigger("pointerdown",t),this.initScrollWatch(t),this.shouldIgnoreMove||document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp)}},this.handleMouseMove=e=>{let t=this.createEventFromMouse(e);this.recordCoords(t),this.emitter.trigger("pointermove",t)},this.handleMouseUp=e=>{document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),this.emitter.trigger("pointerup",this.createEventFromMouse(e)),this.cleanup()},this.handleTouchStart=e=>{if(this.tryStart(e)){this.isTouchDragging=!0;let t=this.createEventFromTouch(e,!0);this.emitter.trigger("pointerdown",t),this.initScrollWatch(t);let n=e.target;this.shouldIgnoreMove||n.addEventListener("touchmove",this.handleTouchMove),n.addEventListener("touchend",this.handleTouchEnd),n.addEventListener("touchcancel",this.handleTouchEnd),window.addEventListener("scroll",this.handleTouchScroll,!0)}},this.handleTouchMove=e=>{let t=this.createEventFromTouch(e);this.recordCoords(t),this.emitter.trigger("pointermove",t)},this.handleTouchEnd=e=>{if(this.isDragging){let t=e.target;t.removeEventListener("touchmove",this.handleTouchMove),t.removeEventListener("touchend",this.handleTouchEnd),t.removeEventListener("touchcancel",this.handleTouchEnd),window.removeEventListener("scroll",this.handleTouchScroll,!0),this.emitter.trigger("pointerup",this.createEventFromTouch(e)),this.cleanup(),this.isTouchDragging=!1,wl+=1,setTimeout(()=>{wl-=1},ds.touchMouseIgnoreWait)}},this.handleTouchScroll=()=>{this.wasTouchScroll=!0},this.handleScroll=e=>{if(!this.shouldIgnoreMove){let t=window.pageXOffset-this.prevScrollX+this.prevPageX,n=window.pageYOffset-this.prevScrollY+this.prevPageY;this.emitter.trigger("pointermove",{origEvent:e,isTouch:this.isTouchDragging,subjectEl:this.subjectEl,pageX:t,pageY:n,deltaX:t-this.origPageX,deltaY:n-this.origPageY})}},this.containerEl=e,this.emitter=new Wr,e.addEventListener("mousedown",this.handleMouseDown),e.addEventListener("touchstart",this.handleTouchStart,{passive:!0}),Dl+=1,1===Dl&&window.addEventListener("touchmove",xl,{passive:!1})}destroy(){this.containerEl.removeEventListener("mousedown",this.handleMouseDown),this.containerEl.removeEventListener("touchstart",this.handleTouchStart,{passive:!0}),Dl-=1,Dl||window.removeEventListener("touchmove",xl,{passive:!1})}tryStart(e){let t=this.querySubjectEl(e),n=e.target;return!(!t||this.handleSelector&&!Le(n,this.handleSelector))&&(this.subjectEl=t,this.isDragging=!0,this.wasTouchScroll=!1,!0)}cleanup(){Rl=!1,this.isDragging=!1,this.subjectEl=null,this.destroyScrollWatch()}querySubjectEl(e){return this.selector?Le(e.target,this.selector):this.containerEl}shouldIgnoreMouse(){return wl||this.isTouchDragging}cancelTouchScroll(){this.isDragging&&(Rl=!0)}initScrollWatch(e){this.shouldWatchScroll&&(this.recordCoords(e),window.addEventListener("scroll",this.handleScroll,!0))}recordCoords(e){this.shouldWatchScroll&&(this.prevPageX=e.pageX,this.prevPageY=e.pageY,this.prevScrollX=window.pageXOffset,this.prevScrollY=window.pageYOffset)}destroyScrollWatch(){this.shouldWatchScroll&&window.removeEventListener("scroll",this.handleScroll,!0)}createEventFromMouse(e,t){let n=0,r=0;return t?(this.origPageX=e.pageX,this.origPageY=e.pageY):(n=e.pageX-this.origPageX,r=e.pageY-this.origPageY),{origEvent:e,isTouch:!1,subjectEl:this.subjectEl,pageX:e.pageX,pageY:e.pageY,deltaX:n,deltaY:r}}createEventFromTouch(e,t){let n,r,i=e.touches,s=0,o=0;return i&&i.length?(n=i[0].pageX,r=i[0].pageY):(n=e.pageX,r=e.pageY),t?(this.origPageX=n,this.origPageY=r):(s=n-this.origPageX,o=r-this.origPageY),{origEvent:e,isTouch:!0,subjectEl:this.subjectEl,pageX:n,pageY:r,deltaX:s,deltaY:o}}}function xl(e){Rl&&e.preventDefault()}class Tl{constructor(){this.isVisible=!1,this.sourceEl=null,this.mirrorEl=null,this.sourceElRect=null,this.parentNode=document.body,this.zIndex=9999,this.revertDuration=0}start(e,t,n){this.sourceEl=e,this.sourceElRect=this.sourceEl.getBoundingClientRect(),this.origScreenX=t-window.pageXOffset,this.origScreenY=n-window.pageYOffset,this.deltaX=0,this.deltaY=0,this.updateElPosition()}handleMove(e,t){this.deltaX=e-window.pageXOffset-this.origScreenX,this.deltaY=t-window.pageYOffset-this.origScreenY,this.updateElPosition()}setIsVisible(e){e?this.isVisible||(this.mirrorEl&&(this.mirrorEl.style.display=""),this.isVisible=e,this.updateElPosition()):this.isVisible&&(this.mirrorEl&&(this.mirrorEl.style.display="none"),this.isVisible=e)}stop(e,t){let n=()=>{this.cleanup(),t()};e&&this.mirrorEl&&this.isVisible&&this.revertDuration&&(this.deltaX||this.deltaY)?this.doRevertAnimation(n,this.revertDuration):setTimeout(n,0)}doRevertAnimation(e,t){let n=this.mirrorEl,r=this.sourceEl.getBoundingClientRect();n.style.transition="top "+t+"ms,left "+t+"ms",Ve(n,{left:r.left,top:r.top}),et(n,()=>{n.style.transition="",e()})}cleanup(){this.mirrorEl&&(je(this.mirrorEl),this.mirrorEl=null),this.sourceEl=null}updateElPosition(){this.sourceEl&&this.isVisible&&Ve(this.getMirrorEl(),{left:this.sourceElRect.left+this.deltaX,top:this.sourceElRect.top+this.deltaY})}getMirrorEl(){let e=this.sourceElRect,t=this.mirrorEl;return t||(t=this.mirrorEl=this.sourceEl.cloneNode(!0),t.classList.add("fc-unselectable"),t.classList.add("fc-event-dragging"),Ve(t,{position:"fixed",zIndex:this.zIndex,visibility:"",boxSizing:"border-box",width:e.right-e.left,height:e.bottom-e.top,right:"auto",bottom:"auto",margin:0}),this.parentNode.appendChild(t)),t}}class _l extends $i{constructor(e,t){super(),this.handleScroll=()=>{this.scrollTop=this.scrollController.getScrollTop(),this.scrollLeft=this.scrollController.getScrollLeft(),this.handleScrollChange()},this.scrollController=e,this.doesListening=t,this.scrollTop=this.origScrollTop=e.getScrollTop(),this.scrollLeft=this.origScrollLeft=e.getScrollLeft(),this.scrollWidth=e.getScrollWidth(),this.scrollHeight=e.getScrollHeight(),this.clientWidth=e.getClientWidth(),this.clientHeight=e.getClientHeight(),this.clientRect=this.computeClientRect(),this.doesListening&&this.getEventTarget().addEventListener("scroll",this.handleScroll)}destroy(){this.doesListening&&this.getEventTarget().removeEventListener("scroll",this.handleScroll)}getScrollTop(){return this.scrollTop}getScrollLeft(){return this.scrollLeft}setScrollTop(e){this.scrollController.setScrollTop(e),this.doesListening||(this.scrollTop=Math.max(Math.min(e,this.getMaxScrollTop()),0),this.handleScrollChange())}setScrollLeft(e){this.scrollController.setScrollLeft(e),this.doesListening||(this.scrollLeft=Math.max(Math.min(e,this.getMaxScrollLeft()),0),this.handleScrollChange())}getClientWidth(){return this.clientWidth}getClientHeight(){return this.clientHeight}getScrollWidth(){return this.scrollWidth}getScrollHeight(){return this.scrollHeight}handleScrollChange(){}}class kl extends _l{constructor(e,t){super(new Ki(e),t)}getEventTarget(){return this.scrollController.el}computeClientRect(){return Qi(this.scrollController.el)}}class Ml extends _l{constructor(e){super(new es,e)}getEventTarget(){return window}computeClientRect(){return{left:this.scrollLeft,right:this.scrollLeft+this.clientWidth,top:this.scrollTop,bottom:this.scrollTop+this.clientHeight}}handleScrollChange(){this.clientRect=this.computeClientRect()}}const Il="function"==typeof performance?performance.now:Date.now;class Ol{constructor(){this.isEnabled=!0,this.scrollQuery=[window,".fc-scroller"],this.edgeThreshold=50,this.maxVelocity=300,this.pointerScreenX=null,this.pointerScreenY=null,this.isAnimating=!1,this.scrollCaches=null,this.everMovedUp=!1,this.everMovedDown=!1,this.everMovedLeft=!1,this.everMovedRight=!1,this.animate=()=>{if(this.isAnimating){let e=this.computeBestEdge(this.pointerScreenX+window.pageXOffset,this.pointerScreenY+window.pageYOffset);if(e){let t=Il();this.handleSide(e,(t-this.msSinceRequest)/1e3),this.requestAnimation(t)}else this.isAnimating=!1}}}start(e,t,n){this.isEnabled&&(this.scrollCaches=this.buildCaches(n),this.pointerScreenX=null,this.pointerScreenY=null,this.everMovedUp=!1,this.everMovedDown=!1,this.everMovedLeft=!1,this.everMovedRight=!1,this.handleMove(e,t))}handleMove(e,t){if(this.isEnabled){let n=e-window.pageXOffset,r=t-window.pageYOffset,i=null===this.pointerScreenY?0:r-this.pointerScreenY,s=null===this.pointerScreenX?0:n-this.pointerScreenX;i<0?this.everMovedUp=!0:i>0&&(this.everMovedDown=!0),s<0?this.everMovedLeft=!0:s>0&&(this.everMovedRight=!0),this.pointerScreenX=n,this.pointerScreenY=r,this.isAnimating||(this.isAnimating=!0,this.requestAnimation(Il()))}}stop(){if(this.isEnabled){this.isAnimating=!1;for(let e of this.scrollCaches)e.destroy();this.scrollCaches=null}}requestAnimation(e){this.msSinceRequest=e,requestAnimationFrame(this.animate)}handleSide(e,t){let{scrollCache:n}=e,{edgeThreshold:r}=this,i=r-e.distance,s=i*i/(r*r)*this.maxVelocity*t,o=1;switch(e.name){case"left":o=-1;case"right":n.setScrollLeft(n.getScrollLeft()+s*o);break;case"top":o=-1;case"bottom":n.setScrollTop(n.getScrollTop()+s*o)}}computeBestEdge(e,t){let{edgeThreshold:n}=this,r=null,i=this.scrollCaches||[];for(let s of i){let i=s.clientRect,o=e-i.left,l=i.right-e,a=t-i.top,c=i.bottom-t;o>=0&&l>=0&&a>=0&&c>=0&&(a<=n&&this.everMovedUp&&s.canScrollUp()&&(!r||r.distance>a)&&(r={scrollCache:s,name:"top",distance:a}),c<=n&&this.everMovedDown&&s.canScrollDown()&&(!r||r.distance>c)&&(r={scrollCache:s,name:"bottom",distance:c}),o<=n&&this.everMovedLeft&&s.canScrollLeft()&&(!r||r.distance>o)&&(r={scrollCache:s,name:"left",distance:o}),l<=n&&this.everMovedRight&&s.canScrollRight()&&(!r||r.distance>l)&&(r={scrollCache:s,name:"right",distance:l}))}return r}buildCaches(e){return this.queryScrollEls(e).map(e=>e===window?new Ml(!1):new kl(e,!1))}queryScrollEls(e){let t=[];for(let n of this.scrollQuery)"object"==typeof n?t.push(n):t.push(...Array.prototype.slice.call(Qe(e).querySelectorAll(n)));return t}}class Nl extends cs{constructor(e,t){super(e),this.containerEl=e,this.delay=null,this.minDistance=0,this.touchScrollAllowed=!0,this.mirrorNeedsRevert=!1,this.isInteracting=!1,this.isDragging=!1,this.isDelayEnded=!1,this.isDistanceSurpassed=!1,this.delayTimeoutId=null,this.onPointerDown=e=>{this.isDragging||(this.isInteracting=!0,this.isDelayEnded=!1,this.isDistanceSurpassed=!1,lt(document.body),ct(document.body),e.isTouch||e.origEvent.preventDefault(),this.emitter.trigger("pointerdown",e),this.isInteracting&&!this.pointer.shouldIgnoreMove&&(this.mirror.setIsVisible(!1),this.mirror.start(e.subjectEl,e.pageX,e.pageY),this.startDelay(e),this.minDistance||this.handleDistanceSurpassed(e)))},this.onPointerMove=e=>{if(this.isInteracting){if(this.emitter.trigger("pointermove",e),!this.isDistanceSurpassed){let t,n=this.minDistance,{deltaX:r,deltaY:i}=e;t=r*r+i*i,t>=n*n&&this.handleDistanceSurpassed(e)}this.isDragging&&("scroll"!==e.origEvent.type&&(this.mirror.handleMove(e.pageX,e.pageY),this.autoScroller.handleMove(e.pageX,e.pageY)),this.emitter.trigger("dragmove",e))}},this.onPointerUp=e=>{this.isInteracting&&(this.isInteracting=!1,at(document.body),dt(document.body),this.emitter.trigger("pointerup",e),this.isDragging&&(this.autoScroller.stop(),this.tryStopDrag(e)),this.delayTimeoutId&&(clearTimeout(this.delayTimeoutId),this.delayTimeoutId=null))};let n=this.pointer=new Al(e);n.emitter.on("pointerdown",this.onPointerDown),n.emitter.on("pointermove",this.onPointerMove),n.emitter.on("pointerup",this.onPointerUp),t&&(n.selector=t),this.mirror=new Tl,this.autoScroller=new Ol}destroy(){this.pointer.destroy(),this.onPointerUp({})}startDelay(e){"number"==typeof this.delay?this.delayTimeoutId=setTimeout(()=>{this.delayTimeoutId=null,this.handleDelayEnd(e)},this.delay):this.handleDelayEnd(e)}handleDelayEnd(e){this.isDelayEnded=!0,this.tryStartDrag(e)}handleDistanceSurpassed(e){this.isDistanceSurpassed=!0,this.tryStartDrag(e)}tryStartDrag(e){this.isDelayEnded&&this.isDistanceSurpassed&&(this.pointer.wasTouchScroll&&!this.touchScrollAllowed||(this.isDragging=!0,this.mirrorNeedsRevert=!1,this.autoScroller.start(e.pageX,e.pageY,this.containerEl),this.emitter.trigger("dragstart",e),!1===this.touchScrollAllowed&&this.pointer.cancelTouchScroll()))}tryStopDrag(e){this.mirror.stop(this.mirrorNeedsRevert,this.stopDrag.bind(this,e))}stopDrag(e){this.isDragging=!1,this.emitter.trigger("dragend",e)}setIgnoreMove(e){this.pointer.shouldIgnoreMove=e}setMirrorIsVisible(e){this.mirror.setIsVisible(e)}setMirrorNeedsRevert(e){this.mirrorNeedsRevert=e}setAutoScrollEnabled(e){this.autoScroller.isEnabled=e}}class Pl{constructor(e){this.origRect=Zi(e),this.scrollCaches=Xi(e).map(e=>new kl(e,!0))}destroy(){for(let e of this.scrollCaches)e.destroy()}computeLeft(){let e=this.origRect.left;for(let t of this.scrollCaches)e+=t.origScrollLeft-t.getScrollLeft();return e}computeTop(){let e=this.origRect.top;for(let t of this.scrollCaches)e+=t.origScrollTop-t.getScrollTop();return e}isWithinClipping(e,t){let n={left:e,top:t};for(let e of this.scrollCaches)if(!Hl(e.getEventTarget())&&!xi(n,e.clientRect))return!1;return!0}}function Hl(e){let t=e.tagName;return"HTML"===t||"BODY"===t}class Wl{constructor(e,t){this.useSubjectCenter=!1,this.requireInitial=!0,this.initialHit=null,this.movingHit=null,this.finalHit=null,this.handlePointerDown=e=>{let{dragging:t}=this;this.initialHit=null,this.movingHit=null,this.finalHit=null,this.prepareHits(),this.processFirstCoord(e),this.initialHit||!this.requireInitial?(t.setIgnoreMove(!1),this.emitter.trigger("pointerdown",e)):t.setIgnoreMove(!0)},this.handleDragStart=e=>{this.emitter.trigger("dragstart",e),this.handleMove(e,!0)},this.handleDragMove=e=>{this.emitter.trigger("dragmove",e),this.handleMove(e)},this.handlePointerUp=e=>{this.releaseHits(),this.emitter.trigger("pointerup",e)},this.handleDragEnd=e=>{this.movingHit&&this.emitter.trigger("hitupdate",null,!0,e),this.finalHit=this.movingHit,this.movingHit=null,this.emitter.trigger("dragend",e)},this.droppableStore=t,e.emitter.on("pointerdown",this.handlePointerDown),e.emitter.on("dragstart",this.handleDragStart),e.emitter.on("dragmove",this.handleDragMove),e.emitter.on("pointerup",this.handlePointerUp),e.emitter.on("dragend",this.handleDragEnd),this.dragging=e,this.emitter=new Wr}processFirstCoord(e){let t,n={left:e.pageX,top:e.pageY},r=n,i=e.subjectEl;i instanceof HTMLElement&&(t=Zi(i),r=ki(r,t));let s=this.initialHit=this.queryHitForOffset(r.left,r.top);if(s){if(this.useSubjectCenter&&t){let e=Ti(t,s.rect);e&&(r=Mi(e))}this.coordAdjust=Ii(r,n)}else this.coordAdjust={left:0,top:0}}handleMove(e,t){let n=this.queryHitForOffset(e.pageX+this.coordAdjust.left,e.pageY+this.coordAdjust.top);!t&&Bl(this.movingHit,n)||(this.movingHit=n,this.emitter.trigger("hitupdate",n,!1,e))}prepareHits(){this.offsetTrackers=De(this.droppableStore,e=>(e.component.prepareHits(),new Pl(e.el)))}releaseHits(){let{offsetTrackers:e}=this;for(let t in e)e[t].destroy();this.offsetTrackers={}}queryHitForOffset(e,t){let{droppableStore:n,offsetTrackers:r}=this,i=null;for(let s in n){let o=n[s].component,l=r[s];if(l&&l.isWithinClipping(e,t)){let n=l.computeLeft(),r=l.computeTop(),a=e-n,c=t-r,{origRect:d}=l,u=d.right-d.left,h=d.bottom-d.top;if(a>=0&&a<u&&c>=0&&c<h){let e=o.queryHit(a,c,u,h);e&&tr(e.dateProfile.activeRange,e.dateSpan.range)&&(!i||e.layer>i.layer)&&(e.componentId=s,e.context=o.context,e.rect.left+=n,e.rect.right+=n,e.rect.top+=r,e.rect.bottom+=r,i=e)}}}return i}}function Bl(e,t){return!e&&!t||Boolean(e)===Boolean(t)&&pi(e.dateSpan,t.dateSpan)}function jl(e,t){let n={};for(let r of t.pluginHooks.datePointTransforms)Object.assign(n,r(e,t));var r,i;return Object.assign(n,(r=e,{date:(i=t.dateEnv).toDate(r.range.start),dateStr:i.formatIso(r.range.start,{omitTime:r.allDay}),allDay:r.allDay})),n}class Ll extends wi{constructor(e){super(e),this.subjectEl=null,this.subjectSeg=null,this.isDragging=!1,this.eventRange=null,this.relevantEvents=null,this.receivingContext=null,this.validMutation=null,this.mutatedRelevantEvents=null,this.handlePointerDown=e=>{let t=e.origEvent.target,{component:n,dragging:r}=this,{mirror:i}=r,{options:s}=n.context,o=n.context;this.subjectEl=e.subjectEl;let l=this.subjectSeg=Kr(e.subjectEl),a=(this.eventRange=l.eventRange).instance.instanceId;this.relevantEvents=Er(o.getCurrentData().eventStore,a),r.minDistance=e.isTouch?0:s.eventDragMinDistance,r.delay=e.isTouch&&a!==n.props.eventSelection?function(e){let{options:t}=e.context,n=t.eventLongPressDelay;null==n&&(n=t.longPressDelay);return n}(n):null,s.fixedMirrorParent?i.parentNode=s.fixedMirrorParent:i.parentNode=Le(t,".fc"),i.revertDuration=s.dragRevertDuration;let c=n.isValidSegDownEl(t)&&!Le(t,".fc-event-resizer");r.setIgnoreMove(!c),this.isDragging=c&&e.subjectEl.classList.contains("fc-event-draggable")},this.handleDragStart=e=>{let t=this.component.context,n=this.eventRange,r=n.instance.instanceId;e.isTouch?r!==this.component.props.eventSelection&&t.dispatch({type:"SELECT_EVENT",eventInstanceId:r}):t.dispatch({type:"UNSELECT_EVENT"}),this.isDragging&&(t.calendarApi.unselect(e),t.emitter.trigger("eventDragStart",{el:this.subjectEl,event:new Yr(t,n.def,n.instance),jsEvent:e.origEvent,view:t.viewApi}))},this.handleHitUpdate=(e,t)=>{if(!this.isDragging)return;let n=this.relevantEvents,r=this.hitDragging.initialHit,i=this.component.context,s=null,o=null,l=null,a=!1,c={affectedEvents:n,mutatedEvents:{defs:{},instances:{}},isEvent:!0};if(e){s=e.context;let t=s.options;i===s||t.editable&&t.droppable?(o=function(e,t,n){let r=e.dateSpan,i=t.dateSpan,s=r.range.start,o=i.range.start,l={};r.allDay!==i.allDay&&(l.allDay=i.allDay,l.hasEnd=t.context.options.allDayMaintainDuration,i.allDay&&(s=_t(s)));let a=or(s,o,e.context.dateEnv,e.componentId===t.componentId?e.largeUnit:null);a.milliseconds&&(l.allDay=!1);let c={datesDelta:a,standardProps:l};for(let r of n)r(c,e,t);return c}(r,e,s.getCurrentData().pluginHooks.eventDragMutationMassagers),o&&(l=Gr(n,s.getCurrentData().eventUiBases,o,s),c.mutatedEvents=l,xs(c,e.dateProfile,s)||(a=!0,o=null,l=null,c.mutatedEvents={defs:{},instances:{}}))):s=null}this.displayDrag(s,c),a?st():ot(),t||(i===s&&Bl(r,e)&&(o=null),this.dragging.setMirrorNeedsRevert(!o),this.dragging.setMirrorIsVisible(!e||!Qe(this.subjectEl).querySelector(".fc-event-mirror")),this.receivingContext=s,this.validMutation=o,this.mutatedRelevantEvents=l)},this.handlePointerUp=()=>{this.isDragging||this.cleanup()},this.handleDragEnd=e=>{if(this.isDragging){let t=this.component.context,n=t.viewApi,{receivingContext:r,validMutation:i}=this,s=this.eventRange.def,o=this.eventRange.instance,l=new Yr(t,s,o),a=this.relevantEvents,c=this.mutatedRelevantEvents,{finalHit:d}=this.hitDragging;if(this.clearDrag(),t.emitter.trigger("eventDragStop",{el:this.subjectEl,event:l,jsEvent:e.origEvent,view:n}),i){if(r===t){let r=new Yr(t,c.defs[s.defId],o?c.instances[o.instanceId]:null);t.dispatch({type:"MERGE_EVENTS",eventStore:c});let d={oldEvent:l,event:r,relatedEvents:Zr(c,t,o),revert(){t.dispatch({type:"MERGE_EVENTS",eventStore:a})}},u={};for(let e of t.getCurrentData().pluginHooks.eventDropTransformers)Object.assign(u,e(i,t));t.emitter.trigger("eventDrop",Object.assign(Object.assign(Object.assign({},d),u),{el:e.subjectEl,delta:i.datesDelta,jsEvent:e.origEvent,view:n})),t.emitter.trigger("eventChange",d)}else if(r){let i={event:l,relatedEvents:Zr(a,t,o),revert(){t.dispatch({type:"MERGE_EVENTS",eventStore:a})}};t.emitter.trigger("eventLeave",Object.assign(Object.assign({},i),{draggedEl:e.subjectEl,view:n})),t.dispatch({type:"REMOVE_EVENTS",eventStore:a}),t.emitter.trigger("eventRemove",i);let u=c.defs[s.defId],h=c.instances[o.instanceId],f=new Yr(r,u,h);r.dispatch({type:"MERGE_EVENTS",eventStore:c});let p={event:f,relatedEvents:Zr(c,r,h),revert(){r.dispatch({type:"REMOVE_EVENTS",eventStore:c})}};r.emitter.trigger("eventAdd",p),e.isTouch&&r.dispatch({type:"SELECT_EVENT",eventInstanceId:o.instanceId}),r.emitter.trigger("drop",Object.assign(Object.assign({},jl(d.dateSpan,r)),{draggedEl:e.subjectEl,jsEvent:e.origEvent,view:d.context.viewApi})),r.emitter.trigger("eventReceive",Object.assign(Object.assign({},p),{draggedEl:e.subjectEl,view:d.context.viewApi}))}}else t.emitter.trigger("_noEventDrop")}this.cleanup()};let{component:t}=this,{options:n}=t.context,r=this.dragging=new Nl(e.el);r.pointer.selector=Ll.SELECTOR,r.touchScrollAllowed=!1,r.autoScroller.isEnabled=n.dragScroll;let i=this.hitDragging=new Wl(this.dragging,Ri);i.useSubjectCenter=e.useEventCenter,i.emitter.on("pointerdown",this.handlePointerDown),i.emitter.on("dragstart",this.handleDragStart),i.emitter.on("hitupdate",this.handleHitUpdate),i.emitter.on("pointerup",this.handlePointerUp),i.emitter.on("dragend",this.handleDragEnd)}destroy(){this.dragging.destroy()}displayDrag(e,t){let n=this.component.context,r=this.receivingContext;r&&r!==e&&(r===n?r.dispatch({type:"SET_EVENT_DRAG",state:{affectedEvents:t.affectedEvents,mutatedEvents:{defs:{},instances:{}},isEvent:!0}}):r.dispatch({type:"UNSET_EVENT_DRAG"})),e&&e.dispatch({type:"SET_EVENT_DRAG",state:t})}clearDrag(){let e=this.component.context,{receivingContext:t}=this;t&&t.dispatch({type:"UNSET_EVENT_DRAG"}),e!==t&&e.dispatch({type:"UNSET_EVENT_DRAG"})}cleanup(){this.subjectSeg=null,this.isDragging=!1,this.eventRange=null,this.relevantEvents=null,this.receivingContext=null,this.validMutation=null,this.mutatedRelevantEvents=null}}Ll.SELECTOR=".fc-event-draggable, .fc-event-resizable";const zl={fixedMirrorParent:In},Ul={dateClick:In,eventDragStart:In,eventDragStop:In,eventDrop:In,eventResizeStart:In,eventResizeStop:In,eventResize:In,drop:In,eventReceive:In,eventLeave:In};class Gl{constructor(e,t){this.receivingContext=null,this.droppableEvent=null,this.suppliedDragMeta=null,this.dragMeta=null,this.handleDragStart=e=>{this.dragMeta=this.buildDragMeta(e.subjectEl)},this.handleHitUpdate=(e,t,n)=>{let{dragging:r}=this.hitDragging,i=null,s=null,o=!1,l={affectedEvents:{defs:{},instances:{}},mutatedEvents:{defs:{},instances:{}},isEvent:this.dragMeta.create};e&&(i=e.context,this.canDropElOnCalendar(n.subjectEl,i)&&(s=function(e,t,n){let r=Object.assign({},t.leftoverProps);for(let i of n.pluginHooks.externalDefTransforms)Object.assign(r,i(e,t));let{refined:i,extra:s}=mr(r,n),o=yr(i,s,t.sourceId,e.allDay,n.options.forceEventDuration||Boolean(t.duration),n),l=e.range.start;e.allDay&&t.startTime&&(l=n.dateEnv.add(l,t.startTime));let a=t.duration?n.dateEnv.add(l,t.duration):Ur(e.allDay,l,n),c=cr(o.defId,{start:l,end:a});return{def:o,instance:c}}(e.dateSpan,this.dragMeta,i),l.mutatedEvents=Sr(s),o=!xs(l,e.dateProfile,i),o&&(l.mutatedEvents={defs:{},instances:{}},s=null))),this.displayDrag(i,l),r.setMirrorIsVisible(t||!s||!document.querySelector(".fc-event-mirror")),o?st():ot(),t||(r.setMirrorNeedsRevert(!s),this.receivingContext=i,this.droppableEvent=s)},this.handleDragEnd=e=>{let{receivingContext:t,droppableEvent:n}=this;if(this.clearDrag(),t&&n){let r=this.hitDragging.finalHit,i=r.context.viewApi,s=this.dragMeta;if(t.emitter.trigger("drop",Object.assign(Object.assign({},jl(r.dateSpan,t)),{draggedEl:e.subjectEl,jsEvent:e.origEvent,view:i})),s.create){let r=Sr(n);t.dispatch({type:"MERGE_EVENTS",eventStore:r}),e.isTouch&&t.dispatch({type:"SELECT_EVENT",eventInstanceId:n.instance.instanceId}),t.emitter.trigger("eventReceive",{event:new Yr(t,n.def,n.instance),relatedEvents:[],revert(){t.dispatch({type:"REMOVE_EVENTS",eventStore:r})},draggedEl:e.subjectEl,view:i})}}this.receivingContext=null,this.droppableEvent=null};let n=this.hitDragging=new Wl(e,Ri);n.requireInitial=!1,n.emitter.on("dragstart",this.handleDragStart),n.emitter.on("hitupdate",this.handleHitUpdate),n.emitter.on("dragend",this.handleDragEnd),this.suppliedDragMeta=t}buildDragMeta(e){return"object"==typeof this.suppliedDragMeta?hs(this.suppliedDragMeta):"function"==typeof this.suppliedDragMeta?hs(this.suppliedDragMeta(e)):function(e){let t=function(e,t){let n=ds.dataAttrPrefix,r=(n?n+"-":"")+t;return e.getAttribute("data-"+r)||""}(e,"event");return hs(t?JSON.parse(t):{create:!1})}(e)}displayDrag(e,t){let n=this.receivingContext;n&&n!==e&&n.dispatch({type:"UNSET_EVENT_DRAG"}),e&&e.dispatch({type:"SET_EVENT_DRAG",state:t})}clearDrag(){this.receivingContext&&this.receivingContext.dispatch({type:"UNSET_EVENT_DRAG"})}canDropElOnCalendar(e,t){let n=t.options.dropAccept;return"function"==typeof n?n.call(t.calendarApi,e):"string"!=typeof n||!n||Boolean(ze(e,n))}}ds.dataAttrPrefix="";class Fl extends cs{constructor(e){super(e),this.shouldIgnoreMove=!1,this.mirrorSelector="",this.currentMirrorEl=null,this.handlePointerDown=e=>{this.emitter.trigger("pointerdown",e),this.shouldIgnoreMove||this.emitter.trigger("dragstart",e)},this.handlePointerMove=e=>{this.shouldIgnoreMove||this.emitter.trigger("dragmove",e)},this.handlePointerUp=e=>{this.emitter.trigger("pointerup",e),this.shouldIgnoreMove||this.emitter.trigger("dragend",e)};let t=this.pointer=new Al(e);t.emitter.on("pointerdown",this.handlePointerDown),t.emitter.on("pointermove",this.handlePointerMove),t.emitter.on("pointerup",this.handlePointerUp)}destroy(){this.pointer.destroy()}setIgnoreMove(e){this.shouldIgnoreMove=e}setMirrorIsVisible(e){if(e)this.currentMirrorEl&&(this.currentMirrorEl.style.visibility="",this.currentMirrorEl=null);else{let e=this.mirrorSelector?document.querySelector(this.mirrorSelector):null;e&&(this.currentMirrorEl=e,e.style.visibility="hidden")}}}var Vl=xo({name:"@fullcalendar/interaction",componentInteractions:[class extends wi{constructor(e){super(e),this.handlePointerDown=e=>{let{dragging:t}=this,n=e.origEvent.target;t.setIgnoreMove(!this.component.isValidDateDownEl(n))},this.handleDragEnd=e=>{let{component:t}=this,{pointer:n}=this.dragging;if(!n.wasTouchScroll){let{initialHit:n,finalHit:r}=this.hitDragging;if(n&&r&&Bl(n,r)){let{context:r}=t,i=Object.assign(Object.assign({},jl(n.dateSpan,r)),{dayEl:n.dayEl,jsEvent:e.origEvent,view:r.viewApi||r.calendarApi.view});r.emitter.trigger("dateClick",i)}}},this.dragging=new Nl(e.el),this.dragging.autoScroller.isEnabled=!1;let t=this.hitDragging=new Wl(this.dragging,Di(e));t.emitter.on("pointerdown",this.handlePointerDown),t.emitter.on("dragend",this.handleDragEnd)}destroy(){this.dragging.destroy()}},class extends wi{constructor(e){super(e),this.dragSelection=null,this.handlePointerDown=e=>{let{component:t,dragging:n}=this,{options:r}=t.context,i=r.selectable&&t.isValidDateDownEl(e.origEvent.target);n.setIgnoreMove(!i),n.delay=e.isTouch?function(e){let{options:t}=e.context,n=t.selectLongPressDelay;null==n&&(n=t.longPressDelay);return n}(t):null},this.handleDragStart=e=>{this.component.context.calendarApi.unselect(e)},this.handleHitUpdate=(e,t)=>{let{context:n}=this.component,r=null,i=!1;if(e){let t=this.hitDragging.initialHit;e.componentId===t.componentId&&this.isHitComboAllowed&&!this.isHitComboAllowed(t,e)||(r=function(e,t,n){let r=e.dateSpan,i=t.dateSpan,s=[r.range.start,r.range.end,i.range.start,i.range.end];s.sort(vt);let o={};for(let r of n){let n=r(e,t);if(!1===n)return null;n&&Object.assign(o,n)}return o.range={start:s[0],end:s[3]},o.allDay=r.allDay,o}(t,e,n.pluginHooks.dateSelectionTransformers)),r&&Ts(r,e.dateProfile,n)||(i=!0,r=null)}r?n.dispatch({type:"SELECT_DATES",selection:r}):t||n.dispatch({type:"UNSELECT_DATES"}),i?st():ot(),t||(this.dragSelection=r)},this.handlePointerUp=e=>{this.dragSelection&&(Lr(this.dragSelection,e,this.component.context),this.dragSelection=null)};let{component:t}=e,{options:n}=t.context,r=this.dragging=new Nl(e.el);r.touchScrollAllowed=!1,r.minDistance=n.selectMinDistance||0,r.autoScroller.isEnabled=n.dragScroll;let i=this.hitDragging=new Wl(this.dragging,Di(e));i.emitter.on("pointerdown",this.handlePointerDown),i.emitter.on("dragstart",this.handleDragStart),i.emitter.on("hitupdate",this.handleHitUpdate),i.emitter.on("pointerup",this.handlePointerUp)}destroy(){this.dragging.destroy()}},Ll,class extends wi{constructor(e){super(e),this.draggingSegEl=null,this.draggingSeg=null,this.eventRange=null,this.relevantEvents=null,this.validMutation=null,this.mutatedRelevantEvents=null,this.handlePointerDown=e=>{let{component:t}=this,n=Kr(this.querySegEl(e)),r=this.eventRange=n.eventRange;this.dragging.minDistance=t.context.options.eventDragMinDistance,this.dragging.setIgnoreMove(!this.component.isValidSegDownEl(e.origEvent.target)||e.isTouch&&this.component.props.eventSelection!==r.instance.instanceId)},this.handleDragStart=e=>{let{context:t}=this.component,n=this.eventRange;this.relevantEvents=Er(t.getCurrentData().eventStore,this.eventRange.instance.instanceId);let r=this.querySegEl(e);this.draggingSegEl=r,this.draggingSeg=Kr(r),t.calendarApi.unselect(),t.emitter.trigger("eventResizeStart",{el:r,event:new Yr(t,n.def,n.instance),jsEvent:e.origEvent,view:t.viewApi})},this.handleHitUpdate=(e,t,n)=>{let{context:r}=this.component,i=this.relevantEvents,s=this.hitDragging.initialHit,o=this.eventRange.instance,l=null,a=null,c=!1,d={affectedEvents:i,mutatedEvents:{defs:{},instances:{}},isEvent:!0};if(e){e.componentId===s.componentId&&this.isHitComboAllowed&&!this.isHitComboAllowed(s,e)||(l=function(e,t,n,r){let i=e.context.dateEnv,s=e.dateSpan.range.start,o=t.dateSpan.range.start,l=or(s,o,i,e.largeUnit);if(n){if(i.add(r.start,l)<r.end)return{startDelta:l}}else if(i.add(r.end,l)>r.start)return{endDelta:l};return null}(s,e,n.subjectEl.classList.contains("fc-event-resizer-start"),o.range))}l&&(a=Gr(i,r.getCurrentData().eventUiBases,l,r),d.mutatedEvents=a,xs(d,e.dateProfile,r)||(c=!0,l=null,a=null,d.mutatedEvents=null)),a?r.dispatch({type:"SET_EVENT_RESIZE",state:d}):r.dispatch({type:"UNSET_EVENT_RESIZE"}),c?st():ot(),t||(l&&Bl(s,e)&&(l=null),this.validMutation=l,this.mutatedRelevantEvents=a)},this.handleDragEnd=e=>{let{context:t}=this.component,n=this.eventRange.def,r=this.eventRange.instance,i=new Yr(t,n,r),s=this.relevantEvents,o=this.mutatedRelevantEvents;if(t.emitter.trigger("eventResizeStop",{el:this.draggingSegEl,event:i,jsEvent:e.origEvent,view:t.viewApi}),this.validMutation){let l=new Yr(t,o.defs[n.defId],r?o.instances[r.instanceId]:null);t.dispatch({type:"MERGE_EVENTS",eventStore:o});let a={oldEvent:i,event:l,relatedEvents:Zr(o,t,r),revert(){t.dispatch({type:"MERGE_EVENTS",eventStore:s})}};t.emitter.trigger("eventResize",Object.assign(Object.assign({},a),{el:this.draggingSegEl,startDelta:this.validMutation.startDelta||Gt(0),endDelta:this.validMutation.endDelta||Gt(0),jsEvent:e.origEvent,view:t.viewApi})),t.emitter.trigger("eventChange",a)}else t.emitter.trigger("_noEventResize");this.draggingSeg=null,this.relevantEvents=null,this.validMutation=null};let{component:t}=e,n=this.dragging=new Nl(e.el);n.pointer.selector=".fc-event-resizer",n.touchScrollAllowed=!1,n.autoScroller.isEnabled=t.context.options.dragScroll;let r=this.hitDragging=new Wl(this.dragging,Di(e));r.emitter.on("pointerdown",this.handlePointerDown),r.emitter.on("dragstart",this.handleDragStart),r.emitter.on("hitupdate",this.handleHitUpdate),r.emitter.on("dragend",this.handleDragEnd)}destroy(){this.dragging.destroy()}querySegEl(e){return Le(e.subjectEl,".fc-event")}}],calendarInteractions:[class{constructor(e){this.context=e,this.isRecentPointerDateSelect=!1,this.matchesCancel=!1,this.matchesEvent=!1,this.onSelect=e=>{e.jsEvent&&(this.isRecentPointerDateSelect=!0)},this.onDocumentPointerDown=e=>{let t=this.context.options.unselectCancel,n=Ye(e.origEvent);this.matchesCancel=!!Le(n,t),this.matchesEvent=!!Le(n,Ll.SELECTOR)},this.onDocumentPointerUp=e=>{let{context:t}=this,{documentPointer:n}=this,r=t.getCurrentData();if(!n.wasTouchScroll){if(r.dateSelection&&!this.isRecentPointerDateSelect){let n=t.options.unselectAuto;!n||n&&this.matchesCancel||t.calendarApi.unselect(e)}r.eventSelection&&!this.matchesEvent&&t.dispatch({type:"UNSELECT_EVENT"})}this.isRecentPointerDateSelect=!1};let t=this.documentPointer=new Al(document);t.shouldIgnoreMove=!0,t.shouldWatchScroll=!1,t.emitter.on("pointerdown",this.onDocumentPointerDown),t.emitter.on("pointerup",this.onDocumentPointerUp),e.emitter.on("select",this.onSelect)}destroy(){this.context.emitter.off("select",this.onSelect),this.documentPointer.destroy()}}],elementDraggingImpl:Nl,optionRefiners:zl,listenerRefiners:Ul});class ql extends ts{constructor(){super(...arguments),this.headerElRef={current:null}}renderSimpleLayout(e,t){let{props:n,context:r}=this,i=[],s=Zs(r.options);return e&&i.push({type:"header",key:"header",isSticky:s,chunk:{elRef:this.headerElRef,tableClassName:"fc-col-header",rowContent:e}}),i.push({type:"body",key:"body",liquid:!0,chunk:{content:t}}),f(Qn,{elClasses:["fc-daygrid"],viewSpec:r.viewSpec},f(Js,{liquid:!n.isHeightAuto&&!n.forPrint,collapsibleWidth:n.forPrint,cols:[],sections:i}))}renderHScrollLayout(e,t,n,r){let i=this.context.pluginHooks.scrollGridImpl;if(!i)throw new Error("No ScrollGrid implementation");let{props:s,context:o}=this,l=!s.forPrint&&Zs(o.options),a=!s.forPrint&&Xs(o.options),c=[];return e&&c.push({type:"header",key:"header",isSticky:l,chunks:[{key:"main",elRef:this.headerElRef,tableClassName:"fc-col-header",rowContent:e}]}),c.push({type:"body",key:"body",liquid:!0,chunks:[{key:"main",content:t}]}),a&&c.push({type:"footer",key:"footer",isSticky:!0,chunks:[{key:"main",content:Qs}]}),f(Qn,{elClasses:["fc-daygrid"],viewSpec:o.viewSpec},f(i,{liquid:!s.isHeightAuto&&!s.forPrint,collapsibleWidth:s.forPrint,colGroups:[{cols:[{span:n,minWidth:r}]}],sections:c}))}}function Yl(e,t){let n=[];for(let e=0;e<t;e+=1)n[e]=[];for(let t of e)n[t.row].push(t);return n}function Ql(e,t){let n=[];for(let e=0;e<t;e+=1)n[e]=[];for(let t of e)n[t.firstCol].push(t);return n}function Zl(e,t){let n=[];if(e){for(let r=0;r<t;r+=1)n[r]={affectedInstances:e.affectedInstances,isEvent:e.isEvent,segs:[]};for(let t of e.segs)n[t.row].segs.push(t)}else for(let e=0;e<t;e+=1)n[e]=null;return n}const Xl=Cn({hour:"numeric",minute:"2-digit",omitZeroMinute:!0,meridiem:"narrow"});function Jl(e){let{display:t}=e.eventRange.ui;return"list-item"===t||"auto"===t&&!e.eventRange.def.allDay&&e.firstCol===e.lastCol&&e.isStart&&e.isEnd}class $l extends Ln{render(){let{props:e}=this;return f(Ks,Object.assign({},e,{elClasses:["fc-daygrid-event","fc-daygrid-block-event","fc-h-event"],defaultTimeFormat:Xl,defaultDisplayEventEnd:e.defaultDisplayEventEnd,disableResizing:!e.seg.eventRange.def.allDay}))}}class Kl extends Ln{render(){let{props:e,context:t}=this,{options:n}=t,{seg:r}=e,i=li(r,n.eventTimeFormat||Xl,t,!0,e.defaultDisplayEventEnd);return f($s,Object.assign({},e,{elTag:"a",elClasses:["fc-daygrid-event","fc-daygrid-dot-event"],elAttrs:ui(e.seg,t),defaultGenerator:ea,timeText:i,isResizing:!1,isDateSelecting:!1}))}}function ea(e){return f(g,null,f("div",{className:"fc-daygrid-event-dot",style:{borderColor:e.borderColor||e.backgroundColor}}),e.timeText&&f("div",{className:"fc-event-time"},e.timeText),f("div",{className:"fc-event-title"},e.event.title||f(g,null," ")))}class ta extends Ln{constructor(){super(...arguments),this.compileSegs=Pe(na)}render(){let{props:e}=this,{allSegs:t,invisibleSegs:n}=this.compileSegs(e.singlePlacements);return f(po,{elClasses:["fc-daygrid-more-link"],dateProfile:e.dateProfile,todayRange:e.todayRange,allDayDate:e.allDayDate,moreCnt:e.moreCnt,allSegs:t,hiddenSegs:n,alignmentElRef:e.alignmentElRef,alignGridTop:e.alignGridTop,extraDateSpan:e.extraDateSpan,popoverContent:()=>{let n=(e.eventDrag?e.eventDrag.affectedInstances:null)||(e.eventResize?e.eventResize.affectedInstances:null)||{};return f(g,null,t.map(t=>{let r=t.eventRange.instance.instanceId;return f("div",{className:"fc-daygrid-event-harness",key:r,style:{visibility:n[r]?"hidden":""}},Jl(t)?f(Kl,Object.assign({seg:t,isDragging:!1,isSelected:r===e.eventSelection,defaultDisplayEventEnd:!1},ai(t,e.todayRange))):f($l,Object.assign({seg:t,isDragging:!1,isResizing:!1,isDateSelecting:!1,isSelected:r===e.eventSelection,defaultDisplayEventEnd:!1},ai(t,e.todayRange))))}))}})}}function na(e){let t=[],n=[];for(let r of e)t.push(r.seg),r.isVisible||n.push(r.seg);return{allSegs:t,invisibleSegs:n}}const ra=Cn({week:"narrow"});class ia extends ts{constructor(){super(...arguments),this.rootElRef={current:null},this.state={dayNumberId:Xe()},this.handleRootEl=e=>{zn(this.rootElRef,e),zn(this.props.elRef,e)}}render(){let{context:e,props:t,state:n,rootElRef:r}=this,{options:i}=e,{date:s,dateProfile:o}=t;return f(ro,{elTag:"td",elRef:this.handleRootEl,elClasses:["fc-daygrid-day",...t.extraClassNames||[]],elAttrs:Object.assign(Object.assign(Object.assign({},t.extraDataAttrs),t.showDayNumber?{"aria-labelledby":n.dayNumberId}:{}),{role:"gridcell"}),defaultGenerator:sa,date:s,dateProfile:o,todayRange:t.todayRange,showDayNumber:t.showDayNumber,extraRenderProps:t.extraRenderProps},(o,l)=>f("div",{className:"fc-daygrid-day-frame fc-scrollgrid-sync-inner",ref:t.innerElRef},t.showWeekNumber&&f(co,{elTag:"a",elClasses:["fc-daygrid-week-number"],elAttrs:zi(e,s,"week"),date:s,defaultFormat:ra}),Boolean(!l.isDisabled&&(t.showDayNumber||io(i)||t.forceDayTop))&&f("div",{className:"fc-daygrid-day-top"},f(o,{elTag:"a",elClasses:["fc-daygrid-day-number"],elAttrs:Object.assign(Object.assign({},zi(e,s)),{id:n.dayNumberId})})),f("div",{className:"fc-daygrid-day-events",ref:t.fgContentElRef},t.fgContent,f("div",{className:"fc-daygrid-day-bottom",style:{marginTop:t.moreMarginTop}},f(ta,{allDayDate:s,singlePlacements:t.singlePlacements,moreCnt:t.moreCnt,alignmentElRef:r,alignGridTop:!t.showDayNumber,extraDateSpan:t.extraDateSpan,dateProfile:t.dateProfile,eventSelection:t.eventSelection,eventDrag:t.eventDrag,eventResize:t.eventResize,todayRange:t.todayRange}))),f("div",{className:"fc-daygrid-day-bg"},t.bgContent)))}}function sa(e){return e.dayNumberText||f(g,null," ")}function oa(e,t,n,r,i,s,o){let l=new aa;l.allowReslicing=!0,l.strictOrder=r,!0===t||!0===n?(l.maxCoord=s,l.hiddenConsumes=!0):"number"==typeof t?l.maxStackCnt=t:"number"==typeof n&&(l.maxStackCnt=n,l.hiddenConsumes=!0);let a=[],c=[];for(let t=0;t<e.length;t+=1){let n=e[t],{instanceId:r}=n.eventRange.instance,s=i[r];null!=s?a.push({index:t,thickness:s,span:{start:n.firstCol,end:n.lastCol+1}}):c.push(n)}let d=l.addSegs(a),u=l.toRects(),{singleColPlacements:h,multiColPlacements:f,leftoverMargins:p}=function(e,t,n){let r=function(e,t){let n=[];for(let e=0;e<t;e+=1)n.push([]);for(let t of e)for(let e=t.span.start;e<t.span.end;e+=1)n[e].push(t);return n}(e,n.length),i=[],s=[],o=[];for(let e=0;e<n.length;e+=1){let l=r[e],a=[],c=0,d=0;for(let r of l){let i=t[r.index];a.push({seg:la(i,e,e+1,n),isVisible:!0,isAbsolute:!1,absoluteTop:r.levelCoord,marginTop:r.levelCoord-c}),c=r.levelCoord+r.thickness}let u=[];c=0,d=0;for(let r of l){let i=t[r.index],s=r.span.end-r.span.start>1,o=r.span.start===e;d+=r.levelCoord-c,c=r.levelCoord+r.thickness,s?(d+=r.thickness,o&&u.push({seg:la(i,r.span.start,r.span.end,n),isVisible:!0,isAbsolute:!0,absoluteTop:r.levelCoord,marginTop:0})):o&&(u.push({seg:la(i,r.span.start,r.span.end,n),isVisible:!0,isAbsolute:!1,absoluteTop:r.levelCoord,marginTop:d}),d=0)}i.push(a),s.push(u),o.push(d)}return{singleColPlacements:i,multiColPlacements:s,leftoverMargins:o}}(u,e,o),g=[],m=[];for(let e of c){f[e.firstCol].push({seg:e,isVisible:!1,isAbsolute:!0,absoluteTop:0,marginTop:0});for(let t=e.firstCol;t<=e.lastCol;t+=1)h[t].push({seg:la(e,t,t+1,o),isVisible:!1,isAbsolute:!1,absoluteTop:0,marginTop:0})}for(let e=0;e<o.length;e+=1)g.push(0);for(let t of d){let n=e[t.index],r=t.span;f[r.start].push({seg:la(n,r.start,r.end,o),isVisible:!1,isAbsolute:!0,absoluteTop:0,marginTop:0});for(let e=r.start;e<r.end;e+=1)g[e]+=1,h[e].push({seg:la(n,e,e+1,o),isVisible:!1,isAbsolute:!1,absoluteTop:0,marginTop:0})}for(let e=0;e<o.length;e+=1)m.push(p[e]);return{singleColPlacements:h,multiColPlacements:f,moreCnts:g,moreMarginTops:m}}function la(e,t,n,r){if(e.firstCol===t&&e.lastCol===n-1)return e;let i=e.eventRange,s=i.range,o=$n(s,{start:r[t].date,end:Ct(r[n-1].date,1)});return Object.assign(Object.assign({},e),{firstCol:t,lastCol:n-1,eventRange:{def:i.def,ui:Object.assign(Object.assign({},i.ui),{durationEditable:!1}),instance:i.instance,range:o},isStart:e.isStart&&o.start.valueOf()===s.start.valueOf(),isEnd:e.isEnd&&o.end.valueOf()===s.end.valueOf()})}class aa extends ns{constructor(){super(...arguments),this.hiddenConsumes=!1,this.forceHidden={}}addSegs(e){const t=super.addSegs(e),{entriesByLevel:n}=this,r=e=>!this.forceHidden[is(e)];for(let e=0;e<n.length;e+=1)n[e]=n[e].filter(r);return t}handleInvalidInsertion(e,t,n){const{entriesByLevel:r,forceHidden:i}=this,{touchingEntry:s,touchingLevel:o,touchingLateral:l}=e;if(this.hiddenConsumes&&s){const e=is(s);if(!i[e])if(this.allowReslicing){const e=Object.assign(Object.assign({},s),{span:os(s.span,t.span)});i[is(e)]=!0,r[o][l]=e,this.splitEntry(s,t,n)}else i[e]=!0,n.push(s)}return super.handleInvalidInsertion(e,t,n)}}class ca extends ts{constructor(){super(...arguments),this.cellElRefs=new Ws,this.frameElRefs=new Ws,this.fgElRefs=new Ws,this.segHarnessRefs=new Ws,this.rootElRef={current:null},this.state={framePositions:null,maxContentHeight:null,eventInstanceHeights:{}},this.handleResize=e=>{e&&this.updateSizing(!0)}}render(){let{props:e,state:t,context:n}=this,{options:r}=n,i=e.cells.length,s=Ql(e.businessHourSegs,i),o=Ql(e.bgEventSegs,i),l=Ql(this.getHighlightSegs(),i),a=Ql(this.getMirrorSegs(),i),{singleColPlacements:c,multiColPlacements:d,moreCnts:u,moreMarginTops:h}=oa(ni(e.fgEventSegs,r.eventOrder),e.dayMaxEvents,e.dayMaxEventRows,r.eventOrderStrict,t.eventInstanceHeights,t.maxContentHeight,e.cells),p=e.eventDrag&&e.eventDrag.affectedInstances||e.eventResize&&e.eventResize.affectedInstances||{};return f("tr",{ref:this.rootElRef,role:"row"},e.renderIntro&&e.renderIntro(),e.cells.map((t,n)=>{let r=this.renderFgSegs(n,e.forPrint?c[n]:d[n],e.todayRange,p),i=this.renderFgSegs(n,function(e,t){if(!e.length)return[];let n=function(e){let t={};for(let n of e)for(let e of n)t[e.seg.eventRange.instance.instanceId]=e.absoluteTop;return t}(t);return e.map(e=>({seg:e,isVisible:!0,isAbsolute:!0,absoluteTop:n[e.eventRange.instance.instanceId],marginTop:0}))}(a[n],d),e.todayRange,{},Boolean(e.eventDrag),Boolean(e.eventResize),!1);return f(ia,{key:t.key,elRef:this.cellElRefs.createRef(t.key),innerElRef:this.frameElRefs.createRef(t.key),dateProfile:e.dateProfile,date:t.date,showDayNumber:e.showDayNumbers,showWeekNumber:e.showWeekNumbers&&0===n,forceDayTop:e.showWeekNumbers,todayRange:e.todayRange,eventSelection:e.eventSelection,eventDrag:e.eventDrag,eventResize:e.eventResize,extraRenderProps:t.extraRenderProps,extraDataAttrs:t.extraDataAttrs,extraClassNames:t.extraClassNames,extraDateSpan:t.extraDateSpan,moreCnt:u[n],moreMarginTop:h[n],singlePlacements:c[n],fgContentElRef:this.fgElRefs.createRef(t.key),fgContent:f(g,null,f(g,null,r),f(g,null,i)),bgContent:f(g,null,this.renderFillSegs(l[n],"highlight"),this.renderFillSegs(s[n],"non-business"),this.renderFillSegs(o[n],"bg-event"))})}))}componentDidMount(){this.updateSizing(!0),this.context.addResizeHandler(this.handleResize)}componentDidUpdate(e,t){let n=this.props;this.updateSizing(!xe(e,n))}componentWillUnmount(){this.context.removeResizeHandler(this.handleResize)}getHighlightSegs(){let{props:e}=this;return e.eventDrag&&e.eventDrag.segs.length?e.eventDrag.segs:e.eventResize&&e.eventResize.segs.length?e.eventResize.segs:e.dateSelectionSegs}getMirrorSegs(){let{props:e}=this;return e.eventResize&&e.eventResize.segs.length?e.eventResize.segs:[]}renderFgSegs(e,t,n,r,i,s,o){let{context:l}=this,{eventSelection:a}=this.props,{framePositions:c}=this.state,d=1===this.props.cells.length,u=i||s||o,h=[];if(c)for(let p of t){let{seg:t}=p,{instanceId:g}=t.eventRange.instance,m=g+":"+e,v=p.isVisible&&!r[g],y=p.isAbsolute,b="",S="";y&&(l.isRtl?(S=0,b=c.lefts[t.lastCol]-c.lefts[t.firstCol]):(b=0,S=c.rights[t.firstCol]-c.rights[t.lastCol])),h.push(f("div",{className:"fc-daygrid-event-harness"+(y?" fc-daygrid-event-harness-abs":""),key:m,ref:u?null:this.segHarnessRefs.createRef(m),style:{visibility:v?"":"hidden",marginTop:y?"":p.marginTop,top:y?p.absoluteTop:"",left:b,right:S}},Jl(t)?f(Kl,Object.assign({seg:t,isDragging:i,isSelected:g===a,defaultDisplayEventEnd:d},ai(t,n))):f($l,Object.assign({seg:t,isDragging:i,isResizing:s,isDateSelecting:o,isSelected:g===a,defaultDisplayEventEnd:d},ai(t,n)))))}return h}renderFillSegs(e,t){let{isRtl:n}=this.context,{todayRange:r}=this.props,{framePositions:i}=this.state,s=[];if(i)for(let o of e){let e=n?{right:0,left:i.lefts[o.lastCol]-i.lefts[o.firstCol]}:{left:0,right:i.rights[o.firstCol]-i.rights[o.lastCol]};s.push(f("div",{key:di(o.eventRange),className:"fc-daygrid-bg-harness",style:e},"bg-event"===t?f(oo,Object.assign({seg:o},ai(o,r))):ao(t)))}return f(g,{},...s)}updateSizing(e){let{props:t,frameElRefs:n}=this;if(!t.forPrint&&null!==t.clientWidth){if(e){let e=t.cells.map(e=>n.currentMap[e.key]);if(e.length){let t=this.rootElRef.current;this.setState({framePositions:new Ji(t,e,!0,!1)})}}const r=this.state.eventInstanceHeights,i=this.queryEventInstanceHeights(),s=!0===t.dayMaxEvents||!0===t.dayMaxEventRows;this.safeSetState({eventInstanceHeights:Object.assign(Object.assign({},r),i),maxContentHeight:s?this.computeMaxContentHeight():null})}}queryEventInstanceHeights(){let e=this.segHarnessRefs.currentMap,t={};for(let n in e){let r=Math.round(e[n].getBoundingClientRect().height),i=n.split(":")[0];t[i]=Math.max(t[i]||0,r)}return t}computeMaxContentHeight(){let e=this.props.cells[0].key,t=this.cellElRefs.currentMap[e],n=this.fgElRefs.currentMap[e];return t.getBoundingClientRect().bottom-n.getBoundingClientRect().top}getCellEls(){let e=this.cellElRefs.currentMap;return this.props.cells.map(t=>e[t.key])}}ca.addStateEquality({eventInstanceHeights:xe});class da extends ts{constructor(){super(...arguments),this.splitBusinessHourSegs=Pe(Yl),this.splitBgEventSegs=Pe(Yl),this.splitFgEventSegs=Pe(Yl),this.splitDateSelectionSegs=Pe(Yl),this.splitEventDrag=Pe(Zl),this.splitEventResize=Pe(Zl),this.rowRefs=new Ws,this.handleRootEl=e=>{this.rootEl=e,e?this.context.registerInteractiveComponent(this,{el:e,isHitComboAllowed:this.props.isHitComboAllowed}):this.context.unregisterInteractiveComponent(this)}}render(){let{props:e}=this,{dateProfile:t,dayMaxEventRows:n,dayMaxEvents:r,expandRows:i}=e,s=e.cells.length,o=this.splitBusinessHourSegs(e.businessHourSegs,s),l=this.splitBgEventSegs(e.bgEventSegs,s),a=this.splitFgEventSegs(e.fgEventSegs,s),c=this.splitDateSelectionSegs(e.dateSelectionSegs,s),d=this.splitEventDrag(e.eventDrag,s),u=this.splitEventResize(e.eventResize,s),h=!0===r||!0===n;return h&&!i&&(h=!1,n=null,r=null),f("div",{className:["fc-daygrid-body",h?"fc-daygrid-body-balanced":"fc-daygrid-body-unbalanced",i?"":"fc-daygrid-body-natural"].join(" "),ref:this.handleRootEl,style:{width:e.clientWidth,minWidth:e.tableMinWidth}},f(bs,{unit:"day"},(h,p)=>f(g,null,f("table",{role:"presentation",className:"fc-scrollgrid-sync-table",style:{width:e.clientWidth,minWidth:e.tableMinWidth,height:i?e.clientHeight:""}},e.colGroupNode,f("tbody",{role:"presentation"},e.cells.map((i,h)=>f(ca,{ref:this.rowRefs.createRef(h),key:i.length?i[0].date.toISOString():h,showDayNumbers:s>1,showWeekNumbers:e.showWeekNumbers,todayRange:p,dateProfile:t,cells:i,renderIntro:e.renderRowIntro,businessHourSegs:o[h],eventSelection:e.eventSelection,bgEventSegs:l[h].filter(ua),fgEventSegs:a[h],dateSelectionSegs:c[h],eventDrag:d[h],eventResize:u[h],dayMaxEvents:r,dayMaxEventRows:n,clientWidth:e.clientWidth,clientHeight:e.clientHeight,forPrint:e.forPrint})))))))}prepareHits(){this.rowPositions=new Ji(this.rootEl,this.rowRefs.collect().map(e=>e.getCellEls()[0]),!1,!0),this.colPositions=new Ji(this.rootEl,this.rowRefs.currentMap[0].getCellEls(),!0,!1)}queryHit(e,t){let{colPositions:n,rowPositions:r}=this,i=n.leftToIndex(e),s=r.topToIndex(t);if(null!=s&&null!=i){let e=this.props.cells[s][i];return{dateProfile:this.props.dateProfile,dateSpan:Object.assign({range:this.getCellRange(s,i),allDay:!0},e.extraDateSpan),dayEl:this.getCellEl(s,i),rect:{left:n.lefts[i],right:n.rights[i],top:r.tops[s],bottom:r.bottoms[s]},layer:0}}return null}getCellEl(e,t){return this.rowRefs.currentMap[e].getCellEls()[t]}getCellRange(e,t){let n=this.props.cells[e][t].date;return{start:n,end:Ct(n,1)}}}function ua(e){return e.eventRange.def.allDay}class ha extends Rs{constructor(){super(...arguments),this.forceDayIfListItem=!0}sliceRange(e,t){return t.sliceRange(e)}}class fa extends ts{constructor(){super(...arguments),this.slicer=new ha,this.tableRef={current:null}}render(){let{props:e,context:t}=this;return f(da,Object.assign({ref:this.tableRef},this.slicer.sliceProps(e,e.dateProfile,e.nextDayThreshold,t,e.dayTableModel),{dateProfile:e.dateProfile,cells:e.dayTableModel.cells,colGroupNode:e.colGroupNode,tableMinWidth:e.tableMinWidth,renderRowIntro:e.renderRowIntro,dayMaxEvents:e.dayMaxEvents,dayMaxEventRows:e.dayMaxEventRows,showWeekNumbers:e.showWeekNumbers,expandRows:e.expandRows,headerAlignElRef:e.headerAlignElRef,clientWidth:e.clientWidth,clientHeight:e.clientHeight,forPrint:e.forPrint}))}}function pa(e,t){let n=new ws(e.renderRange,t);return new Ds(n,/year|month|week/.test(e.currentRangeUnit))}be(':root{--fc-daygrid-event-dot-width:8px}.fc-daygrid-day-events:after,.fc-daygrid-day-events:before,.fc-daygrid-day-frame:after,.fc-daygrid-day-frame:before,.fc-daygrid-event-harness:after,.fc-daygrid-event-harness:before{clear:both;content:"";display:table}.fc .fc-daygrid-body{position:relative;z-index:1}.fc .fc-daygrid-day.fc-day-today{background-color:var(--fc-today-bg-color)}.fc .fc-daygrid-day-frame{min-height:100%;position:relative}.fc .fc-daygrid-day-top{display:flex;flex-direction:row-reverse}.fc .fc-day-other .fc-daygrid-day-top{opacity:.3}.fc .fc-daygrid-day-number{padding:4px;position:relative;z-index:4}.fc .fc-daygrid-day-events{margin-top:1px}.fc .fc-daygrid-body-balanced .fc-daygrid-day-events{left:0;position:absolute;right:0}.fc .fc-daygrid-body-unbalanced .fc-daygrid-day-events{min-height:2em;position:relative}.fc .fc-daygrid-body-natural .fc-daygrid-day-events{margin-bottom:1em}.fc .fc-daygrid-event-harness{position:relative}.fc .fc-daygrid-event-harness-abs{left:0;position:absolute;right:0;top:0}.fc .fc-daygrid-bg-harness{bottom:0;position:absolute;top:0}.fc .fc-daygrid-day-bg .fc-non-business{z-index:1}.fc .fc-daygrid-day-bg .fc-bg-event{z-index:2}.fc .fc-daygrid-day-bg .fc-highlight{z-index:3}.fc .fc-daygrid-event{margin-top:1px;z-index:6}.fc .fc-daygrid-event.fc-event-mirror{z-index:7}.fc .fc-daygrid-day-bottom{font-size:.85em;padding:2px 3px 0}.fc .fc-daygrid-day-bottom:before{clear:both;content:"";display:table}.fc .fc-daygrid-more-link{cursor:pointer;position:relative;z-index:4}.fc .fc-daygrid-week-number{background-color:var(--fc-neutral-bg-color);color:var(--fc-neutral-text-color);min-width:1.5em;padding:2px;position:absolute;text-align:center;top:0;z-index:5}.fc .fc-more-popover .fc-popover-body{min-width:220px;padding:10px}.fc-direction-ltr .fc-daygrid-event.fc-event-start,.fc-direction-rtl .fc-daygrid-event.fc-event-end{margin-left:2px}.fc-direction-ltr .fc-daygrid-event.fc-event-end,.fc-direction-rtl .fc-daygrid-event.fc-event-start{margin-right:2px}.fc-direction-ltr .fc-daygrid-week-number{border-radius:0 0 3px 0;left:0}.fc-direction-rtl .fc-daygrid-week-number{border-radius:0 0 0 3px;right:0}.fc-liquid-hack .fc-daygrid-day-frame{position:static}.fc-daygrid-event{border-radius:3px;font-size:var(--fc-small-font-size);position:relative;white-space:nowrap}.fc-daygrid-block-event .fc-event-time{font-weight:700}.fc-daygrid-block-event .fc-event-time,.fc-daygrid-block-event .fc-event-title{padding:1px}.fc-daygrid-dot-event{align-items:center;display:flex;padding:2px 0}.fc-daygrid-dot-event .fc-event-title{flex-grow:1;flex-shrink:1;font-weight:700;min-width:0;overflow:hidden}.fc-daygrid-dot-event.fc-event-mirror,.fc-daygrid-dot-event:hover{background:rgba(0,0,0,.1)}.fc-daygrid-dot-event.fc-event-selected:before{bottom:-10px;top:-10px}.fc-daygrid-event-dot{border:calc(var(--fc-daygrid-event-dot-width)/2) solid var(--fc-event-border-color);border-radius:calc(var(--fc-daygrid-event-dot-width)/2);box-sizing:content-box;height:0;margin:0 4px;width:0}.fc-direction-ltr .fc-daygrid-event .fc-event-time{margin-right:3px}.fc-direction-rtl .fc-daygrid-event .fc-event-time{margin-left:3px}');var ga=xo({name:"@fullcalendar/daygrid",initialView:"dayGridMonth",views:{dayGrid:{component:class extends ql{constructor(){super(...arguments),this.buildDayTableModel=Pe(pa),this.headerRef={current:null},this.tableRef={current:null}}render(){let{options:e,dateProfileGenerator:t}=this.context,{props:n}=this,r=this.buildDayTableModel(n.dateProfile,t),i=e.dayHeaders&&f(Es,{ref:this.headerRef,dateProfile:n.dateProfile,dates:r.headerDates,datesRepDistinctDays:1===r.rowCnt}),s=t=>f(fa,{ref:this.tableRef,dateProfile:n.dateProfile,dayTableModel:r,businessHours:n.businessHours,dateSelection:n.dateSelection,eventStore:n.eventStore,eventUiBases:n.eventUiBases,eventSelection:n.eventSelection,eventDrag:n.eventDrag,eventResize:n.eventResize,nextDayThreshold:e.nextDayThreshold,colGroupNode:t.tableColGroupNode,tableMinWidth:t.tableMinWidth,dayMaxEvents:e.dayMaxEvents,dayMaxEventRows:e.dayMaxEventRows,showWeekNumbers:e.weekNumbers,expandRows:!n.isHeightAuto,headerAlignElRef:this.headerElRef,clientWidth:t.clientWidth,clientHeight:t.clientHeight,forPrint:n.forPrint});return e.dayMinWidth?this.renderHScrollLayout(i,s,r.colCnt,e.dayMinWidth):this.renderSimpleLayout(i,s)}},dateProfileGeneratorClass:class extends ar{buildRenderRange(e,t,n){let r,{dateEnv:i}=this.props,s=super.buildRenderRange(e,t,n),o=s.start,l=s.end;if(/^(year|month)$/.test(t)&&(o=i.startOfWeek(o),r=i.startOfWeek(l),r.valueOf()!==l.valueOf()&&(l=Et(r,1))),this.props.monthMode&&this.props.fixedWeekCount){l=Et(l,6-Math.ceil(Dt(o,l)))}return{start:o,end:l}}}},dayGridDay:{type:"dayGrid",duration:{days:1}},dayGridWeek:{type:"dayGrid",duration:{weeks:1}},dayGridMonth:{type:"dayGrid",duration:{months:1},monthMode:!0,fixedWeekCount:!0}}});class ma extends Ni{getKeyInfo(){return{allDay:{},timed:{}}}getKeysForDateSpan(e){return e.allDay?["allDay"]:["timed"]}getKeysForEventDef(e){return e.allDay?Jr(e)?["timed","allDay"]:["allDay"]:["timed"]}}const va=Cn({hour:"numeric",minute:"2-digit",omitZeroMinute:!0,meridiem:"short"});function ya(e){let t=["fc-timegrid-slot","fc-timegrid-slot-label",e.isLabeled?"fc-scrollgrid-shrink":"fc-timegrid-slot-minor"];return f(Wn.Consumer,null,n=>{if(!e.isLabeled)return f("td",{className:t.join(" "),"data-time":e.isoTimeStr});let{dateEnv:r,options:i,viewApi:s}=n,o=null==i.slotLabelFormat?va:Array.isArray(i.slotLabelFormat)?Cn(i.slotLabelFormat[0]):Cn(i.slotLabelFormat),l={level:0,time:e.time,date:r.toDate(e.date),view:s,text:r.format(e.date,o)};return f(qn,{elTag:"td",elClasses:t,elAttrs:{"data-time":e.isoTimeStr},renderProps:l,generatorName:"slotLabelContent",generator:i.slotLabelContent||ba,classNameGenerator:i.slotLabelClassNames,didMount:i.slotLabelDidMount,willUnmount:i.slotLabelWillUnmount},e=>f("div",{className:"fc-timegrid-slot-label-frame fc-scrollgrid-shrink-frame"},f(e,{elTag:"div",elClasses:["fc-timegrid-slot-label-cushion","fc-scrollgrid-shrink-cushion"]})))})}function ba(e){return e.text}class Sa extends Ln{render(){return this.props.slatMetas.map(e=>f("tr",{key:e.key},f(ya,Object.assign({},e))))}}const Ea=Cn({week:"short"});class Ca extends ts{constructor(){super(...arguments),this.allDaySplitter=new ma,this.headerElRef={current:null},this.rootElRef={current:null},this.scrollerElRef={current:null},this.state={slatCoords:null},this.handleScrollTopRequest=e=>{let t=this.scrollerElRef.current;t&&(t.scrollTop=e)},this.renderHeadAxis=(e,t="")=>{let{options:n}=this.context,{dateProfile:r}=this.props,i=r.renderRange,s=1===Rt(i.start,i.end)?zi(this.context,i.start,"week"):{};return n.weekNumbers&&"day"===e?f(co,{elTag:"th",elClasses:["fc-timegrid-axis","fc-scrollgrid-shrink"],elAttrs:{"aria-hidden":!0},date:i.start,defaultFormat:Ea},e=>f("div",{className:["fc-timegrid-axis-frame","fc-scrollgrid-shrink-frame","fc-timegrid-axis-frame-liquid"].join(" "),style:{height:t}},f(e,{elTag:"a",elClasses:["fc-timegrid-axis-cushion","fc-scrollgrid-shrink-cushion","fc-scrollgrid-sync-inner"],elAttrs:s}))):f("th",{"aria-hidden":!0,className:"fc-timegrid-axis"},f("div",{className:"fc-timegrid-axis-frame",style:{height:t}}))},this.renderTableRowAxis=e=>{let{options:t,viewApi:n}=this.context,r={text:t.allDayText,view:n};return f(qn,{elTag:"td",elClasses:["fc-timegrid-axis","fc-scrollgrid-shrink"],elAttrs:{"aria-hidden":!0},renderProps:r,generatorName:"allDayContent",generator:t.allDayContent||wa,classNameGenerator:t.allDayClassNames,didMount:t.allDayDidMount,willUnmount:t.allDayWillUnmount},t=>f("div",{className:["fc-timegrid-axis-frame","fc-scrollgrid-shrink-frame",null==e?" fc-timegrid-axis-frame-liquid":""].join(" "),style:{height:e}},f(t,{elTag:"span",elClasses:["fc-timegrid-axis-cushion","fc-scrollgrid-shrink-cushion","fc-scrollgrid-sync-inner"]})))},this.handleSlatCoords=e=>{this.setState({slatCoords:e})}}renderSimpleLayout(e,t,n){let{context:r,props:i}=this,s=[],o=Zs(r.options);return e&&s.push({type:"header",key:"header",isSticky:o,chunk:{elRef:this.headerElRef,tableClassName:"fc-col-header",rowContent:e}}),t&&(s.push({type:"body",key:"all-day",chunk:{content:t}}),s.push({type:"body",key:"all-day-divider",outerContent:f("tr",{role:"presentation",className:"fc-scrollgrid-section"},f("td",{className:"fc-timegrid-divider "+r.theme.getClass("tableCellShaded")}))})),s.push({type:"body",key:"body",liquid:!0,expandRows:Boolean(r.options.expandRows),chunk:{scrollerElRef:this.scrollerElRef,content:n}}),f(Qn,{elRef:this.rootElRef,elClasses:["fc-timegrid"],viewSpec:r.viewSpec},f(Js,{liquid:!i.isHeightAuto&&!i.forPrint,collapsibleWidth:i.forPrint,cols:[{width:"shrink"}],sections:s}))}renderHScrollLayout(e,t,n,r,i,s,o){let l=this.context.pluginHooks.scrollGridImpl;if(!l)throw new Error("No ScrollGrid implementation");let{context:a,props:c}=this,d=!c.forPrint&&Zs(a.options),u=!c.forPrint&&Xs(a.options),h=[];e&&h.push({type:"header",key:"header",isSticky:d,syncRowHeights:!0,chunks:[{key:"axis",rowContent:e=>f("tr",{role:"presentation"},this.renderHeadAxis("day",e.rowSyncHeights[0]))},{key:"cols",elRef:this.headerElRef,tableClassName:"fc-col-header",rowContent:e}]}),t&&(h.push({type:"body",key:"all-day",syncRowHeights:!0,chunks:[{key:"axis",rowContent:e=>f("tr",{role:"presentation"},this.renderTableRowAxis(e.rowSyncHeights[0]))},{key:"cols",content:t}]}),h.push({key:"all-day-divider",type:"body",outerContent:f("tr",{role:"presentation",className:"fc-scrollgrid-section"},f("td",{colSpan:2,className:"fc-timegrid-divider "+a.theme.getClass("tableCellShaded")}))}));let p=a.options.nowIndicator;return h.push({type:"body",key:"body",liquid:!0,expandRows:Boolean(a.options.expandRows),chunks:[{key:"axis",content:e=>f("div",{className:"fc-timegrid-axis-chunk"},f("table",{"aria-hidden":!0,style:{height:e.expandRows?e.clientHeight:""}},e.tableColGroupNode,f("tbody",null,f(Sa,{slatMetas:s}))),f("div",{className:"fc-timegrid-now-indicator-container"},f(bs,{unit:p?"minute":"day"},e=>{let t=p&&o&&o.safeComputeTop(e);return"number"==typeof t?f(to,{elClasses:["fc-timegrid-now-indicator-arrow"],elStyle:{top:t},isAxis:!0,date:e}):null})))},{key:"cols",scrollerElRef:this.scrollerElRef,content:n}]}),u&&h.push({key:"footer",type:"footer",isSticky:!0,chunks:[{key:"axis",content:Qs},{key:"cols",content:Qs}]}),f(Qn,{elRef:this.rootElRef,elClasses:["fc-timegrid"],viewSpec:a.viewSpec},f(l,{liquid:!c.isHeightAuto&&!c.forPrint,collapsibleWidth:!1,colGroups:[{width:"shrink",cols:[{width:"shrink"}]},{cols:[{span:r,minWidth:i}]}],sections:h}))}getAllDayMaxEventProps(){let{dayMaxEvents:e,dayMaxEventRows:t}=this.context.options;return!0!==e&&!0!==t||(e=void 0,t=5),{dayMaxEvents:e,dayMaxEventRows:t}}}function wa(e){return e.text}class Da{constructor(e,t,n){this.positions=e,this.dateProfile=t,this.slotDuration=n}safeComputeTop(e){let{dateProfile:t}=this;if(nr(t.currentRange,e)){let n=_t(e),r=e.valueOf()-n.valueOf();if(r>=Jt(t.slotMinTime)&&r<Jt(t.slotMaxTime))return this.computeTimeTop(Gt(r))}return null}computeDateTop(e,t){return t||(t=_t(e)),this.computeTimeTop(Gt(e.valueOf()-t.valueOf()))}computeTimeTop(e){let t,n,{positions:r,dateProfile:i}=this,s=r.els.length,o=(e.milliseconds-Jt(i.slotMinTime))/Jt(this.slotDuration);return o=Math.max(0,o),o=Math.min(s,o),t=Math.floor(o),t=Math.min(t,s-1),n=o-t,r.tops[t]+r.getHeight(t)*n}}class Ra extends Ln{render(){let{props:e,context:t}=this,{options:n}=t,{slatElRefs:r}=e;return f("tbody",null,e.slatMetas.map((i,s)=>{let o={time:i.time,date:t.dateEnv.toDate(i.date),view:t.viewApi};return f("tr",{key:i.key,ref:r.createRef(i.key)},e.axis&&f(ya,Object.assign({},i)),f(qn,{elTag:"td",elClasses:["fc-timegrid-slot","fc-timegrid-slot-lane",!i.isLabeled&&"fc-timegrid-slot-minor"],elAttrs:{"data-time":i.isoTimeStr},renderProps:o,generatorName:"slotLaneContent",generator:n.slotLaneContent,classNameGenerator:n.slotLaneClassNames,didMount:n.slotLaneDidMount,willUnmount:n.slotLaneWillUnmount}))}))}}class Aa extends Ln{constructor(){super(...arguments),this.rootElRef={current:null},this.slatElRefs=new Ws}render(){let{props:e,context:t}=this;return f("div",{ref:this.rootElRef,className:"fc-timegrid-slots"},f("table",{"aria-hidden":!0,className:t.theme.getClass("table"),style:{minWidth:e.tableMinWidth,width:e.clientWidth,height:e.minHeight}},e.tableColGroupNode,f(Ra,{slatElRefs:this.slatElRefs,axis:e.axis,slatMetas:e.slatMetas})))}componentDidMount(){this.updateSizing()}componentDidUpdate(){this.updateSizing()}componentWillUnmount(){this.props.onCoords&&this.props.onCoords(null)}updateSizing(){let{context:e,props:t}=this;if(t.onCoords&&null!==t.clientWidth){this.rootElRef.current.offsetHeight&&t.onCoords(new Da(new Ji(this.rootElRef.current,(n=this.slatElRefs.currentMap,t.slatMetas.map(e=>n[e.key])),!1,!0),this.props.dateProfile,e.options.slotDuration))}var n}}function xa(e,t){let n,r=[];for(n=0;n<t;n+=1)r.push([]);if(e)for(n=0;n<e.length;n+=1)r[e[n].col].push(e[n]);return r}function Ta(e,t){let n=[];if(e){for(let r=0;r<t;r+=1)n[r]={affectedInstances:e.affectedInstances,isEvent:e.isEvent,segs:[]};for(let t of e.segs)n[t.col].segs.push(t)}else for(let e=0;e<t;e+=1)n[e]=null;return n}class _a extends Ln{render(){let{props:e}=this;return f(po,{elClasses:["fc-timegrid-more-link"],elStyle:{top:e.top,bottom:e.bottom},allDayDate:null,moreCnt:e.hiddenSegs.length,allSegs:e.hiddenSegs,hiddenSegs:e.hiddenSegs,extraDateSpan:e.extraDateSpan,dateProfile:e.dateProfile,todayRange:e.todayRange,popoverContent:()=>La(e.hiddenSegs,e),defaultGenerator:ka},e=>f(e,{elTag:"div",elClasses:["fc-timegrid-more-link-inner","fc-sticky"]}))}}function ka(e){return e.shortText}function Ma(e,t,n){let r=new ns;null!=t&&(r.strictOrder=t),null!=n&&(r.maxStackCnt=n);let i=ss(r.addSegs(e)),s=function(e){const{entriesByLevel:t}=e,n=Pa((e,t)=>e+":"+t,(r,i)=>{let s=Ia(function(e,t,n){let{levelCoords:r,entriesByLevel:i}=e,s=i[t][n],o=r[t]+s.thickness,l=r.length,a=t;for(;a<l&&r[a]<o;a+=1);for(;a<l;a+=1){let e,t=i[a],n=as(t,s.span.start,rs),r=n[0]+n[1],o=r;for(;(e=t[o])&&e.span.start<s.span.end;)o+=1;if(r<o)return{level:a,lateralStart:r,lateralEnd:o}}return null}(e,r,i),n),o=t[r][i];return[Object.assign(Object.assign({},o),{nextLevelNodes:s[0]}),o.thickness+s[1]]});return Ia(t.length?{level:0,lateralStart:0,lateralEnd:t[0].length}:null,n)[0]}(r);return s=function(e,t){const n=Pa((e,t,n)=>is(e),(e,r,i)=>{let s,{nextLevelNodes:o,thickness:l}=e,a=l+i,c=l/a,d=[];if(o.length)for(let e of o)if(void 0===s){let t=n(e,r,a);s=t[0],d.push(t[1])}else{let t=n(e,s,0);d.push(t[1])}else s=t;let u=(s-r)*c;return[s-u,Object.assign(Object.assign({},e),{thickness:u,nextLevelNodes:d})]});return e.map(e=>n(e,0,0)[1])}(s,1),{segRects:function(e){let t=[];const n=Pa((e,t,n)=>is(e),(e,n,i)=>{let s=Object.assign(Object.assign({},e),{levelCoord:n,stackDepth:i,stackForward:0});return t.push(s),s.stackForward=r(e.nextLevelNodes,n+e.thickness,i+1)+1});function r(e,t,r){let i=0;for(let s of e)i=Math.max(n(s,t,r),i);return i}return r(e,0,0),t}(s),hiddenGroups:i}}function Ia(e,t){if(!e)return[[],0];let{level:n,lateralStart:r,lateralEnd:i}=e,s=r,o=[];for(;s<i;)o.push(t(n,s)),s+=1;return o.sort(Oa),[o.map(Na),o[0][1]]}function Oa(e,t){return t[1]-e[1]}function Na(e){return e[0]}function Pa(e,t){const n={};return(...r)=>{let i=e(...r);return i in n?n[i]:n[i]=t(...r)}}function Ha(e,t,n=null,r=0){let i=[];if(n)for(let s=0;s<e.length;s+=1){let o=e[s],l=n.computeDateTop(o.start,t),a=Math.max(l+(r||0),n.computeDateTop(o.end,t));i.push({start:Math.round(l),end:Math.round(a)})}return i}const Wa=Cn({hour:"numeric",minute:"2-digit",meridiem:!1});class Ba extends Ln{render(){return f(Ks,Object.assign({},this.props,{elClasses:["fc-timegrid-event","fc-v-event",this.props.isShort&&"fc-timegrid-event-short"],defaultTimeFormat:Wa}))}}class ja extends Ln{constructor(){super(...arguments),this.sortEventSegs=Pe(ni)}render(){let{props:e,context:t}=this,{options:n}=t,r=n.selectMirror,i=e.eventDrag&&e.eventDrag.segs||e.eventResize&&e.eventResize.segs||r&&e.dateSelectionSegs||[],s=e.eventDrag&&e.eventDrag.affectedInstances||e.eventResize&&e.eventResize.affectedInstances||{},o=this.sortEventSegs(e.fgEventSegs,n.eventOrder);return f(ro,{elTag:"td",elRef:e.elRef,elClasses:["fc-timegrid-col",...e.extraClassNames||[]],elAttrs:Object.assign({role:"gridcell"},e.extraDataAttrs),date:e.date,dateProfile:e.dateProfile,todayRange:e.todayRange,extraRenderProps:e.extraRenderProps},t=>f("div",{className:"fc-timegrid-col-frame"},f("div",{className:"fc-timegrid-col-bg"},this.renderFillSegs(e.businessHourSegs,"non-business"),this.renderFillSegs(e.bgEventSegs,"bg-event"),this.renderFillSegs(e.dateSelectionSegs,"highlight")),f("div",{className:"fc-timegrid-col-events"},this.renderFgSegs(o,s,!1,!1,!1)),f("div",{className:"fc-timegrid-col-events"},this.renderFgSegs(i,{},Boolean(e.eventDrag),Boolean(e.eventResize),Boolean(r))),f("div",{className:"fc-timegrid-now-indicator-container"},this.renderNowIndicator(e.nowIndicatorSegs)),io(n)&&f(t,{elTag:"div",elClasses:["fc-timegrid-col-misc"]})))}renderFgSegs(e,t,n,r,i){let{props:s}=this;return s.forPrint?La(e,s):this.renderPositionedFgSegs(e,t,n,r,i)}renderPositionedFgSegs(e,t,n,r,i){let{eventMaxStack:s,eventShortHeight:o,eventOrderStrict:l,eventMinHeight:a}=this.context.options,{date:c,slatCoords:d,eventSelection:u,todayRange:h,nowDate:p}=this.props,m=n||r||i,v=Ha(e,c,d,a),{segPlacements:y,hiddenGroups:b}=function(e,t,n,r){let i=[],s=[];for(let n=0;n<e.length;n+=1){let r=t[n];r?i.push({index:n,thickness:1,span:r}):s.push(e[n])}let{segRects:o,hiddenGroups:l}=Ma(i,n,r),a=[];for(let t of o)a.push({seg:e[t.index],rect:t});for(let e of s)a.push({seg:e,rect:null});return{segPlacements:a,hiddenGroups:l}}(e,v,l,s);return f(g,null,this.renderHiddenGroups(b,e),y.map(e=>{let{seg:s,rect:l}=e,a=s.eventRange.instance.instanceId,c=m||Boolean(!t[a]&&l),d=za(l&&l.span),g=!m&&l?this.computeSegHStyle(l):{left:0,right:0},v=Boolean(l)&&l.stackForward>0,y=Boolean(l)&&l.span.end-l.span.start<o;return f("div",{className:"fc-timegrid-event-harness"+(v?" fc-timegrid-event-harness-inset":""),key:a,style:Object.assign(Object.assign({visibility:c?"":"hidden"},d),g)},f(Ba,Object.assign({seg:s,isDragging:n,isResizing:r,isDateSelecting:i,isSelected:a===u,isShort:y},ai(s,h,p))))}))}renderHiddenGroups(e,t){let{extraDateSpan:n,dateProfile:r,todayRange:i,nowDate:s,eventSelection:o,eventDrag:l,eventResize:a}=this.props;return f(g,null,e.map(e=>{let c=za(e.span),d=(u=e.entries,h=t,u.map(e=>h[e.index]));var u,h;return f(_a,{key:en(vo(d)),hiddenSegs:d,top:c.top,bottom:c.bottom,extraDateSpan:n,dateProfile:r,todayRange:i,nowDate:s,eventSelection:o,eventDrag:l,eventResize:a})}))}renderFillSegs(e,t){let{props:n,context:r}=this,i=Ha(e,n.date,n.slatCoords,r.options.eventMinHeight).map((r,i)=>{let s=e[i];return f("div",{key:di(s.eventRange),className:"fc-timegrid-bg-harness",style:za(r)},"bg-event"===t?f(oo,Object.assign({seg:s},ai(s,n.todayRange,n.nowDate))):ao(t))});return f(g,null,i)}renderNowIndicator(e){let{slatCoords:t,date:n}=this.props;return t?e.map((e,r)=>f(to,{key:r,elClasses:["fc-timegrid-now-indicator-line"],elStyle:{top:t.computeDateTop(e.start,n)},isAxis:!1,date:n})):null}computeSegHStyle(e){let t,n,{isRtl:r,options:i}=this.context,s=i.slotEventOverlap,o=e.levelCoord,l=e.levelCoord+e.thickness;s&&(l=Math.min(1,o+2*(l-o))),r?(t=1-l,n=o):(t=o,n=1-l);let a={zIndex:e.stackDepth+1,left:100*t+"%",right:100*n+"%"};return s&&!e.stackForward&&(a[r?"marginLeft":"marginRight"]=20),a}}function La(e,{todayRange:t,nowDate:n,eventSelection:r,eventDrag:i,eventResize:s}){let o=(i?i.affectedInstances:null)||(s?s.affectedInstances:null)||{};return f(g,null,e.map(e=>{let i=e.eventRange.instance.instanceId;return f("div",{key:i,style:{visibility:o[i]?"hidden":""}},f(Ba,Object.assign({seg:e,isDragging:!1,isResizing:!1,isDateSelecting:!1,isSelected:i===r,isShort:!1},ai(e,t,n))))}))}function za(e){return e?{top:e.start,bottom:-e.end}:{top:"",bottom:""}}class Ua extends Ln{constructor(){super(...arguments),this.splitFgEventSegs=Pe(xa),this.splitBgEventSegs=Pe(xa),this.splitBusinessHourSegs=Pe(xa),this.splitNowIndicatorSegs=Pe(xa),this.splitDateSelectionSegs=Pe(xa),this.splitEventDrag=Pe(Ta),this.splitEventResize=Pe(Ta),this.rootElRef={current:null},this.cellElRefs=new Ws}render(){let{props:e,context:t}=this,n=t.options.nowIndicator&&e.slatCoords&&e.slatCoords.safeComputeTop(e.nowDate),r=e.cells.length,i=this.splitFgEventSegs(e.fgEventSegs,r),s=this.splitBgEventSegs(e.bgEventSegs,r),o=this.splitBusinessHourSegs(e.businessHourSegs,r),l=this.splitNowIndicatorSegs(e.nowIndicatorSegs,r),a=this.splitDateSelectionSegs(e.dateSelectionSegs,r),c=this.splitEventDrag(e.eventDrag,r),d=this.splitEventResize(e.eventResize,r);return f("div",{className:"fc-timegrid-cols",ref:this.rootElRef},f("table",{role:"presentation",style:{minWidth:e.tableMinWidth,width:e.clientWidth}},e.tableColGroupNode,f("tbody",{role:"presentation"},f("tr",{role:"row"},e.axis&&f("td",{"aria-hidden":!0,className:"fc-timegrid-col fc-timegrid-axis"},f("div",{className:"fc-timegrid-col-frame"},f("div",{className:"fc-timegrid-now-indicator-container"},"number"==typeof n&&f(to,{elClasses:["fc-timegrid-now-indicator-arrow"],elStyle:{top:n},isAxis:!0,date:e.nowDate})))),e.cells.map((t,n)=>f(ja,{key:t.key,elRef:this.cellElRefs.createRef(t.key),dateProfile:e.dateProfile,date:t.date,nowDate:e.nowDate,todayRange:e.todayRange,extraRenderProps:t.extraRenderProps,extraDataAttrs:t.extraDataAttrs,extraClassNames:t.extraClassNames,extraDateSpan:t.extraDateSpan,fgEventSegs:i[n],bgEventSegs:s[n],businessHourSegs:o[n],nowIndicatorSegs:l[n],dateSelectionSegs:a[n],eventDrag:c[n],eventResize:d[n],slatCoords:e.slatCoords,eventSelection:e.eventSelection,forPrint:e.forPrint}))))))}componentDidMount(){this.updateCoords()}componentDidUpdate(){this.updateCoords()}updateCoords(){let{props:e}=this;var t;e.onColCoords&&null!==e.clientWidth&&e.onColCoords(new Ji(this.rootElRef.current,(t=this.cellElRefs.currentMap,e.cells.map(e=>t[e.key])),!0,!1))}}class Ga extends ts{constructor(){super(...arguments),this.processSlotOptions=Pe(Fa),this.state={slatCoords:null},this.handleRootEl=e=>{e?this.context.registerInteractiveComponent(this,{el:e,isHitComboAllowed:this.props.isHitComboAllowed}):this.context.unregisterInteractiveComponent(this)},this.handleScrollRequest=e=>{let{onScrollTopRequest:t}=this.props,{slatCoords:n}=this.state;if(t&&n){if(e.time){let r=n.computeTimeTop(e.time);r=Math.ceil(r),r&&(r+=1),t(r)}return!0}return!1},this.handleColCoords=e=>{this.colCoords=e},this.handleSlatCoords=e=>{this.setState({slatCoords:e}),this.props.onSlatCoords&&this.props.onSlatCoords(e)}}render(){let{props:e,state:t}=this;return f("div",{className:"fc-timegrid-body",ref:this.handleRootEl,style:{width:e.clientWidth,minWidth:e.tableMinWidth}},f(Aa,{axis:e.axis,dateProfile:e.dateProfile,slatMetas:e.slatMetas,clientWidth:e.clientWidth,minHeight:e.expandRows?e.clientHeight:"",tableMinWidth:e.tableMinWidth,tableColGroupNode:e.axis?e.tableColGroupNode:null,onCoords:this.handleSlatCoords}),f(Ua,{cells:e.cells,axis:e.axis,dateProfile:e.dateProfile,businessHourSegs:e.businessHourSegs,bgEventSegs:e.bgEventSegs,fgEventSegs:e.fgEventSegs,dateSelectionSegs:e.dateSelectionSegs,eventSelection:e.eventSelection,eventDrag:e.eventDrag,eventResize:e.eventResize,todayRange:e.todayRange,nowDate:e.nowDate,nowIndicatorSegs:e.nowIndicatorSegs,clientWidth:e.clientWidth,tableMinWidth:e.tableMinWidth,tableColGroupNode:e.tableColGroupNode,slatCoords:t.slatCoords,onColCoords:this.handleColCoords,forPrint:e.forPrint}))}componentDidMount(){this.scrollResponder=this.context.createScrollResponder(this.handleScrollRequest)}componentDidUpdate(e){this.scrollResponder.update(e.dateProfile!==this.props.dateProfile)}componentWillUnmount(){this.scrollResponder.detach()}queryHit(e,t){let{dateEnv:n,options:r}=this.context,{colCoords:i}=this,{dateProfile:s}=this.props,{slatCoords:o}=this.state,{snapDuration:l,snapsPerSlot:a}=this.processSlotOptions(this.props.slotDuration,r.snapDuration),c=i.leftToIndex(e),d=o.positions.topToIndex(t);if(null!=c&&null!=d){let e=this.props.cells[c],r=o.positions.tops[d],u=o.positions.getHeight(d),h=(t-r)/u,f=d*a+Math.floor(h*a),p=this.props.cells[c].date,g=qt(s.slotMinTime,Yt(l,f)),m=n.add(p,g),v=n.add(m,l);return{dateProfile:s,dateSpan:Object.assign({range:{start:m,end:v},allDay:!1},e.extraDateSpan),dayEl:i.els[c],rect:{left:i.lefts[c],right:i.rights[c],top:r,bottom:r+u},layer:0}}return null}}function Fa(e,t){let n=t||e,r=$t(e,n);return null===r&&(n=e,r=1),{snapDuration:n,snapsPerSlot:r}}class Va extends Rs{sliceRange(e,t){let n=[];for(let r=0;r<t.length;r+=1){let i=$n(e,t[r]);i&&n.push({start:i.start,end:i.end,isStart:i.start.valueOf()===e.start.valueOf(),isEnd:i.end.valueOf()===e.end.valueOf(),col:r})}return n}}class qa extends ts{constructor(){super(...arguments),this.buildDayRanges=Pe(Ya),this.slicer=new Va,this.timeColsRef={current:null}}render(){let{props:e,context:t}=this,{dateProfile:n,dayTableModel:r}=e,i=t.options.nowIndicator,s=this.buildDayRanges(r,n,t.dateEnv);return f(bs,{unit:i?"minute":"day"},(o,l)=>f(Ga,Object.assign({ref:this.timeColsRef},this.slicer.sliceProps(e,n,null,t,s),{forPrint:e.forPrint,axis:e.axis,dateProfile:n,slatMetas:e.slatMetas,slotDuration:e.slotDuration,cells:r.cells[0],tableColGroupNode:e.tableColGroupNode,tableMinWidth:e.tableMinWidth,clientWidth:e.clientWidth,clientHeight:e.clientHeight,expandRows:e.expandRows,nowDate:o,nowIndicatorSegs:i&&this.slicer.sliceNowDate(o,t,s),todayRange:l,onScrollTopRequest:e.onScrollTopRequest,onSlatCoords:e.onSlatCoords})))}}function Ya(e,t,n){let r=[];for(let i of e.headerDates)r.push({start:n.add(i,t.slotMinTime),end:n.add(i,t.slotMaxTime)});return r}const Qa=[{hours:1},{minutes:30},{minutes:15},{seconds:30},{seconds:15}];function Za(e,t,n,r,i){let s=new Date(0),o=e,l=Gt(0),a=n||function(e){let t,n,r;for(t=Qa.length-1;t>=0;t-=1)if(n=Gt(Qa[t]),r=$t(n,e),null!==r&&r>1)return n;return e}(r),c=[];for(;Jt(o)<Jt(t);){let e=i.add(s,o),t=null!==$t(l,a);c.push({date:e,time:o,key:e.toISOString(),isoTimeStr:nn(e),isLabeled:t}),o=qt(o,r),l=qt(l,r)}return c}function Xa(e,t){let n=new ws(e.renderRange,t);return new Ds(n,!1)}const Ja={allDaySlot:Boolean};be('.fc-v-event{background-color:var(--fc-event-bg-color);border:1px solid var(--fc-event-border-color);display:block}.fc-v-event .fc-event-main{color:var(--fc-event-text-color);height:100%}.fc-v-event .fc-event-main-frame{display:flex;flex-direction:column;height:100%}.fc-v-event .fc-event-time{flex-grow:0;flex-shrink:0;max-height:100%;overflow:hidden}.fc-v-event .fc-event-title-container{flex-grow:1;flex-shrink:1;min-height:0}.fc-v-event .fc-event-title{bottom:0;max-height:100%;overflow:hidden;top:0}.fc-v-event:not(.fc-event-start){border-top-left-radius:0;border-top-right-radius:0;border-top-width:0}.fc-v-event:not(.fc-event-end){border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-width:0}.fc-v-event.fc-event-selected:before{left:-10px;right:-10px}.fc-v-event .fc-event-resizer-start{cursor:n-resize}.fc-v-event .fc-event-resizer-end{cursor:s-resize}.fc-v-event:not(.fc-event-selected) .fc-event-resizer{height:var(--fc-event-resizer-thickness);left:0;right:0}.fc-v-event:not(.fc-event-selected) .fc-event-resizer-start{top:calc(var(--fc-event-resizer-thickness)/-2)}.fc-v-event:not(.fc-event-selected) .fc-event-resizer-end{bottom:calc(var(--fc-event-resizer-thickness)/-2)}.fc-v-event.fc-event-selected .fc-event-resizer{left:50%;margin-left:calc(var(--fc-event-resizer-dot-total-width)/-2)}.fc-v-event.fc-event-selected .fc-event-resizer-start{top:calc(var(--fc-event-resizer-dot-total-width)/-2)}.fc-v-event.fc-event-selected .fc-event-resizer-end{bottom:calc(var(--fc-event-resizer-dot-total-width)/-2)}.fc .fc-timegrid .fc-daygrid-body{z-index:2}.fc .fc-timegrid-divider{padding:0 0 2px}.fc .fc-timegrid-body{min-height:100%;position:relative;z-index:1}.fc .fc-timegrid-axis-chunk{position:relative}.fc .fc-timegrid-axis-chunk>table,.fc .fc-timegrid-slots{position:relative;z-index:1}.fc .fc-timegrid-slot{border-bottom:0;height:1.5em}.fc .fc-timegrid-slot:empty:before{content:"\\00a0"}.fc .fc-timegrid-slot-minor{border-top-style:dotted}.fc .fc-timegrid-slot-label-cushion{display:inline-block;white-space:nowrap}.fc .fc-timegrid-slot-label{vertical-align:middle}.fc .fc-timegrid-axis-cushion,.fc .fc-timegrid-slot-label-cushion{padding:0 4px}.fc .fc-timegrid-axis-frame-liquid{height:100%}.fc .fc-timegrid-axis-frame{align-items:center;display:flex;justify-content:flex-end;overflow:hidden}.fc .fc-timegrid-axis-cushion{flex-shrink:0;max-width:60px}.fc-direction-ltr .fc-timegrid-slot-label-frame{text-align:right}.fc-direction-rtl .fc-timegrid-slot-label-frame{text-align:left}.fc-liquid-hack .fc-timegrid-axis-frame-liquid{bottom:0;height:auto;left:0;position:absolute;right:0;top:0}.fc .fc-timegrid-col.fc-day-today{background-color:var(--fc-today-bg-color)}.fc .fc-timegrid-col-frame{min-height:100%;position:relative}.fc-media-screen.fc-liquid-hack .fc-timegrid-col-frame{bottom:0;height:auto;left:0;position:absolute;right:0;top:0}.fc-media-screen .fc-timegrid-cols{bottom:0;left:0;position:absolute;right:0;top:0}.fc-media-screen .fc-timegrid-cols>table{height:100%}.fc-media-screen .fc-timegrid-col-bg,.fc-media-screen .fc-timegrid-col-events,.fc-media-screen .fc-timegrid-now-indicator-container{left:0;position:absolute;right:0;top:0}.fc .fc-timegrid-col-bg{z-index:2}.fc .fc-timegrid-col-bg .fc-non-business{z-index:1}.fc .fc-timegrid-col-bg .fc-bg-event{z-index:2}.fc .fc-timegrid-col-bg .fc-highlight{z-index:3}.fc .fc-timegrid-bg-harness{left:0;position:absolute;right:0}.fc .fc-timegrid-col-events{z-index:3}.fc .fc-timegrid-now-indicator-container{bottom:0;overflow:hidden}.fc-direction-ltr .fc-timegrid-col-events{margin:0 2.5% 0 2px}.fc-direction-rtl .fc-timegrid-col-events{margin:0 2px 0 2.5%}.fc-timegrid-event-harness{position:absolute}.fc-timegrid-event-harness>.fc-timegrid-event{bottom:0;left:0;position:absolute;right:0;top:0}.fc-timegrid-event-harness-inset .fc-timegrid-event,.fc-timegrid-event.fc-event-mirror,.fc-timegrid-more-link{box-shadow:0 0 0 1px var(--fc-page-bg-color)}.fc-timegrid-event,.fc-timegrid-more-link{border-radius:3px;font-size:var(--fc-small-font-size)}.fc-timegrid-event{margin-bottom:1px}.fc-timegrid-event .fc-event-main{padding:1px 1px 0}.fc-timegrid-event .fc-event-time{font-size:var(--fc-small-font-size);margin-bottom:1px;white-space:nowrap}.fc-timegrid-event-short .fc-event-main-frame{flex-direction:row;overflow:hidden}.fc-timegrid-event-short .fc-event-time:after{content:"\\00a0-\\00a0"}.fc-timegrid-event-short .fc-event-title{font-size:var(--fc-small-font-size)}.fc-timegrid-more-link{background:var(--fc-more-link-bg-color);color:var(--fc-more-link-text-color);cursor:pointer;margin-bottom:1px;position:absolute;z-index:9999}.fc-timegrid-more-link-inner{padding:3px 2px;top:0}.fc-direction-ltr .fc-timegrid-more-link{right:0}.fc-direction-rtl .fc-timegrid-more-link{left:0}.fc .fc-timegrid-now-indicator-line{border-color:var(--fc-now-indicator-color);border-style:solid;border-width:1px 0 0;left:0;position:absolute;right:0;z-index:4}.fc .fc-timegrid-now-indicator-arrow{border-color:var(--fc-now-indicator-color);border-style:solid;margin-top:-5px;position:absolute;z-index:4}.fc-direction-ltr .fc-timegrid-now-indicator-arrow{border-bottom-color:transparent;border-top-color:transparent;border-width:5px 0 5px 6px;left:0}.fc-direction-rtl .fc-timegrid-now-indicator-arrow{border-bottom-color:transparent;border-top-color:transparent;border-width:5px 6px 5px 0;right:0}');var $a=xo({name:"@fullcalendar/timegrid",initialView:"timeGridWeek",optionRefiners:Ja,views:{timeGrid:{component:class extends Ca{constructor(){super(...arguments),this.buildTimeColsModel=Pe(Xa),this.buildSlatMetas=Pe(Za)}render(){let{options:e,dateEnv:t,dateProfileGenerator:n}=this.context,{props:r}=this,{dateProfile:i}=r,s=this.buildTimeColsModel(i,n),o=this.allDaySplitter.splitProps(r),l=this.buildSlatMetas(i.slotMinTime,i.slotMaxTime,e.slotLabelInterval,e.slotDuration,t),{dayMinWidth:a}=e,c=!a,d=a,u=e.dayHeaders&&f(Es,{dates:s.headerDates,dateProfile:i,datesRepDistinctDays:!0,renderIntro:c?this.renderHeadAxis:null}),h=!1!==e.allDaySlot&&(t=>f(fa,Object.assign({},o.allDay,{dateProfile:i,dayTableModel:s,nextDayThreshold:e.nextDayThreshold,tableMinWidth:t.tableMinWidth,colGroupNode:t.tableColGroupNode,renderRowIntro:c?this.renderTableRowAxis:null,showWeekNumbers:!1,expandRows:!1,headerAlignElRef:this.headerElRef,clientWidth:t.clientWidth,clientHeight:t.clientHeight,forPrint:r.forPrint},this.getAllDayMaxEventProps()))),p=t=>f(qa,Object.assign({},o.timed,{dayTableModel:s,dateProfile:i,axis:c,slotDuration:e.slotDuration,slatMetas:l,forPrint:r.forPrint,tableColGroupNode:t.tableColGroupNode,tableMinWidth:t.tableMinWidth,clientWidth:t.clientWidth,clientHeight:t.clientHeight,onSlatCoords:this.handleSlatCoords,expandRows:t.expandRows,onScrollTopRequest:this.handleScrollTopRequest}));return d?this.renderHScrollLayout(u,h,p,s.colCnt,a,l,this.state.slatCoords):this.renderSimpleLayout(u,h,p)}},usesMinMaxTime:!0,allDaySlot:!0,slotDuration:"00:30:00",slotEventOverlap:!0},timeGridDay:{type:"timeGrid",duration:{days:1}},timeGridWeek:{type:"timeGrid",duration:{weeks:1}}}});class Ka extends Ln{constructor(){super(...arguments),this.state={textId:Xe()}}render(){let{theme:e,dateEnv:t,options:n,viewApi:r}=this.context,{cellId:i,dayDate:s,todayRange:o}=this.props,{textId:l}=this.state,a=Hi(s,o),c=n.listDayFormat?t.format(s,n.listDayFormat):"",d=n.listDaySideFormat?t.format(s,n.listDaySideFormat):"",u=Object.assign({date:t.toDate(s),view:r,textId:l,text:c,sideText:d,navLinkAttrs:zi(this.context,s),sideNavLinkAttrs:zi(this.context,s,"day",!1)},a);return f(qn,{elTag:"tr",elClasses:["fc-list-day",...Wi(a,e)],elAttrs:{"data-date":tn(s)},renderProps:u,generatorName:"dayHeaderContent",generator:n.dayHeaderContent||ec,classNameGenerator:n.dayHeaderClassNames,didMount:n.dayHeaderDidMount,willUnmount:n.dayHeaderWillUnmount},t=>f("th",{scope:"colgroup",colSpan:3,id:i,"aria-labelledby":l},f(t,{elTag:"div",elClasses:["fc-list-day-cushion",e.getClass("tableCellShaded")]})))}}function ec(e){return f(g,null,e.text&&f("a",Object.assign({id:e.textId,className:"fc-list-day-text"},e.navLinkAttrs),e.text),e.sideText&&f("a",Object.assign({"aria-hidden":!0,className:"fc-list-day-side-text"},e.sideNavLinkAttrs),e.sideText))}const tc=Cn({hour:"numeric",minute:"2-digit",meridiem:"short"});class nc extends Ln{render(){let{props:e,context:t}=this,{options:n}=t,{seg:r,timeHeaderId:i,eventHeaderId:s,dateHeaderId:o}=e,l=n.eventTimeFormat||tc;return f($s,Object.assign({},e,{elTag:"tr",elClasses:["fc-list-event",r.eventRange.def.url&&"fc-event-forced-url"],defaultGenerator:()=>function(e,t){let n=ui(e,t);return f("a",Object.assign({},n),e.eventRange.def.title)}(r,t),seg:r,timeText:"",disableDragging:!0,disableResizing:!0}),(e,n)=>f(g,null,function(e,t,n,r,i){let{options:s}=n;if(!1!==s.displayEventTime){let o,l=e.eventRange.def,a=e.eventRange.instance,c=!1;if(l.allDay?c=!0:sr(e.eventRange.range)?e.isStart?o=li(e,t,n,null,null,a.range.start,e.end):e.isEnd?o=li(e,t,n,null,null,e.start,a.range.end):c=!0:o=li(e,t,n),c){let e={text:n.options.allDayText,view:n.viewApi};return f(qn,{elTag:"td",elClasses:["fc-list-event-time"],elAttrs:{headers:`${r} ${i}`},renderProps:e,generatorName:"allDayContent",generator:s.allDayContent||rc,classNameGenerator:s.allDayClassNames,didMount:s.allDayDidMount,willUnmount:s.allDayWillUnmount})}return f("td",{className:"fc-list-event-time"},o)}return null}(r,l,t,i,o),f("td",{"aria-hidden":!0,className:"fc-list-event-graphic"},f("span",{className:"fc-list-event-dot",style:{borderColor:n.borderColor||n.backgroundColor}})),f(e,{elTag:"td",elClasses:["fc-list-event-title"],elAttrs:{headers:`${s} ${o}`}})))}}function rc(e){return e.text}function ic(e){return e.text}function sc(e){let t=_t(e.renderRange.start),n=e.renderRange.end,r=[],i=[];for(;t<n;)r.push(t),i.push({start:t,end:Ct(t,1)}),t=Ct(t,1);return{dayDates:r,dayRanges:i}}const oc={listDayFormat:lc,listDaySideFormat:lc,noEventsClassNames:In,noEventsContent:In,noEventsDidMount:In,noEventsWillUnmount:In};function lc(e){return!1===e?null:Cn(e)}be(':root{--fc-list-event-dot-width:10px;--fc-list-event-hover-bg-color:#f5f5f5}.fc-theme-standard .fc-list{border:1px solid var(--fc-border-color)}.fc .fc-list-empty{align-items:center;background-color:var(--fc-neutral-bg-color);display:flex;height:100%;justify-content:center}.fc .fc-list-empty-cushion{margin:5em 0}.fc .fc-list-table{border-style:hidden;width:100%}.fc .fc-list-table tr>*{border-left:0;border-right:0}.fc .fc-list-sticky .fc-list-day>*{background:var(--fc-page-bg-color);position:sticky;top:0}.fc .fc-list-table thead{left:-10000px;position:absolute}.fc .fc-list-table tbody>tr:first-child th{border-top:0}.fc .fc-list-table th{padding:0}.fc .fc-list-day-cushion,.fc .fc-list-table td{padding:8px 14px}.fc .fc-list-day-cushion:after{clear:both;content:"";display:table}.fc-theme-standard .fc-list-day-cushion{background-color:var(--fc-neutral-bg-color)}.fc-direction-ltr .fc-list-day-text,.fc-direction-rtl .fc-list-day-side-text{float:left}.fc-direction-ltr .fc-list-day-side-text,.fc-direction-rtl .fc-list-day-text{float:right}.fc-direction-ltr .fc-list-table .fc-list-event-graphic{padding-right:0}.fc-direction-rtl .fc-list-table .fc-list-event-graphic{padding-left:0}.fc .fc-list-event.fc-event-forced-url{cursor:pointer}.fc .fc-list-event:hover td{background-color:var(--fc-list-event-hover-bg-color)}.fc .fc-list-event-graphic,.fc .fc-list-event-time{white-space:nowrap;width:1px}.fc .fc-list-event-dot{border:calc(var(--fc-list-event-dot-width)/2) solid var(--fc-event-border-color);border-radius:calc(var(--fc-list-event-dot-width)/2);box-sizing:content-box;display:inline-block;height:0;width:0}.fc .fc-list-event-title a{color:inherit;text-decoration:none}.fc .fc-list-event.fc-event-forced-url:hover a{text-decoration:underline}');var ac=xo({name:"@fullcalendar/list",optionRefiners:oc,views:{list:{component:class extends ts{constructor(){super(...arguments),this.computeDateVars=Pe(sc),this.eventStoreToSegs=Pe(this._eventStoreToSegs),this.state={timeHeaderId:Xe(),eventHeaderId:Xe(),dateHeaderIdRoot:Xe()},this.setRootEl=e=>{e?this.context.registerInteractiveComponent(this,{el:e}):this.context.unregisterInteractiveComponent(this)}}render(){let{props:e,context:t}=this,{dayDates:n,dayRanges:r}=this.computeDateVars(e.dateProfile),i=this.eventStoreToSegs(e.eventStore,e.eventUiBases,r);return f(Qn,{elRef:this.setRootEl,elClasses:["fc-list",t.theme.getClass("table"),!1!==t.options.stickyHeaderDates?"fc-list-sticky":""],viewSpec:t.viewSpec},f(Hs,{liquid:!e.isHeightAuto,overflowX:e.isHeightAuto?"visible":"hidden",overflowY:e.isHeightAuto?"visible":"auto"},i.length>0?this.renderSegList(i,n):this.renderEmptyMessage()))}renderEmptyMessage(){let{options:e,viewApi:t}=this.context,n={text:e.noEventsText,view:t};return f(qn,{elTag:"div",elClasses:["fc-list-empty"],renderProps:n,generatorName:"noEventsContent",generator:e.noEventsContent||ic,classNameGenerator:e.noEventsClassNames,didMount:e.noEventsDidMount,willUnmount:e.noEventsWillUnmount},e=>f(e,{elTag:"div",elClasses:["fc-list-empty-cushion"]}))}renderSegList(e,t){let{theme:n,options:r}=this.context,{timeHeaderId:i,eventHeaderId:s,dateHeaderIdRoot:o}=this.state,l=function(e){let t,n,r=[];for(t=0;t<e.length;t+=1)n=e[t],(r[n.dayIndex]||(r[n.dayIndex]=[])).push(n);return r}(e);return f(bs,{unit:"day"},(e,a)=>{let c=[];for(let n=0;n<l.length;n+=1){let d=l[n];if(d){let l=tn(t[n]),u=o+"-"+l;c.push(f(Ka,{key:l,cellId:u,dayDate:t[n],todayRange:a})),d=ni(d,r.eventOrder);for(let t of d)c.push(f(nc,Object.assign({key:l+":"+t.eventRange.instance.instanceId,seg:t,isDragging:!1,isResizing:!1,isDateSelecting:!1,isSelected:!1,timeHeaderId:i,eventHeaderId:s,dateHeaderId:u},ai(t,a,e))))}}return f("table",{className:"fc-list-table "+n.getClass("table")},f("thead",null,f("tr",null,f("th",{scope:"col",id:i},r.timeHint),f("th",{scope:"col","aria-hidden":!0}),f("th",{scope:"col",id:s},r.eventHint))),f("tbody",null,c))})}_eventStoreToSegs(e,t,n){return this.eventRangesToSegs(Xr(e,t,this.props.dateProfile.activeRange,this.context.options.nextDayThreshold).fg,n)}eventRangesToSegs(e,t){let n=[];for(let r of e)n.push(...this.eventRangeToSegs(r,t));return n}eventRangeToSegs(e,t){let n,r,i,{dateEnv:s}=this.context,{nextDayThreshold:o}=this.context.options,l=e.range,a=e.def.allDay,c=[];for(n=0;n<t.length;n+=1)if(r=$n(l,t[n]),r&&(i={component:this,eventRange:e,start:r.start,end:r.end,isStart:e.isStart&&r.start.valueOf()===l.start.valueOf(),isEnd:e.isEnd&&r.end.valueOf()===l.end.valueOf(),dayIndex:n},c.push(i),!i.isEnd&&!a&&n+1<t.length&&l.end<s.add(t[n+1].start,o))){i.end=l.end,i.isEnd=!0;break}return c}},buttonTextKey:"list",listDayFormat:{month:"long",day:"numeric",year:"numeric"}},listDay:{type:"list",duration:{days:1},listDayFormat:{weekday:"long"}},listWeek:{type:"list",duration:{weeks:1},listDayFormat:{weekday:"long"},listDaySideFormat:{month:"long",day:"numeric",year:"numeric"}},listMonth:{type:"list",duration:{month:1},listDaySideFormat:{weekday:"long"}},listYear:{type:"list",duration:{year:1},listDaySideFormat:{weekday:"long"}}}});const cc=["GPL-My-Project-Is-Open-Source","CC-Attribution-NonCommercial-NoDerivatives"],dc={position:"absolute",zIndex:99999,bottom:"1px",left:"1px",background:"#eee",borderColor:"#ddd",borderStyle:"solid",borderWidth:"1px 1px 0 0",padding:"2px 4px",fontSize:"12px",borderTopRightRadius:"3px"};var uc=xo({name:"@fullcalendar/premium-common",premiumReleaseDate:"2022-12-27",optionRefiners:{schedulerLicenseKey:String},viewContainerAppends:[function(e){let t=e.options.schedulerLicenseKey,n="undefined"!=typeof window?window.location.href:"";if(!/\w+:\/\/fullcalendar\.io\/|\/examples\/[\w-]+\.html$/.test(n)){let n=function(e,t){if(-1!==cc.indexOf(e))return"valid";const n=(e||"").match(/^(\d+)-fcs-(\d+)$/);if(n&&10===n[1].length){const e=new Date(1e3*parseInt(n[2],10)),r=ds.mockSchedulerReleaseDate||t;if(Ht(r)){return Ct(r,-372)<e?"valid":"outdated"}}return"invalid"}(t,e.pluginHooks.premiumReleaseDate);if("valid"!==n)return f("div",{className:"fc-license-message",style:dc},"outdated"===n?f(g,null,"Your license key is too old to work with this version. ",f("a",{href:"https://fullcalendar.io/docs/schedulerLicenseKey#outdated"},"More Info")):f(g,null,"Your license key is invalid. ",f("a",{href:"https://fullcalendar.io/docs/schedulerLicenseKey#invalid"},"More Info")))}return null}]});function hc(e){let t=e.scrollLeft;if("rtl"===window.getComputedStyle(e).direction)switch(gc()){case"negative":t*=-1;case"reverse":t=e.scrollWidth-t-e.clientWidth}return t}function fc(e,t){if("rtl"===window.getComputedStyle(e).direction)switch(gc()){case"reverse":t=e.scrollWidth-t;break;case"negative":t=-(e.scrollWidth-t)}e.scrollLeft=t}let pc;function gc(){return pc||(pc=function(){let e,t=document.createElement("div");t.style.position="absolute",t.style.top="-1000px",t.style.width="1px",t.style.height="1px",t.style.overflow="scroll",t.style.direction="rtl",t.style.fontSize="100px",t.innerHTML="A",document.body.appendChild(t),t.scrollLeft>0?e="positive":(t.scrollLeft=1,e=t.scrollLeft>0?"reverse":"negative");return je(t),e}())}class mc{constructor(e,t){this.scrollEl=e,this.isRtl=t,this.updateSize=()=>{let{scrollEl:e}=this,t=Ue(e,".fc-sticky");!function(e,t,n){e.forEach((e,r)=>{let i,{textAlign:s,elWidth:o,parentBound:l}=t[r],a=l.right-l.left;i="center"===s&&a>n?(n-o)/2:"",Ve(e,{left:i,right:i,top:0})})}(t,this.queryElGeoms(t),e.clientWidth)}}queryElGeoms(e){let{scrollEl:t,isRtl:n}=this,r=function(e){let t=e.getBoundingClientRect(),n=Yi(e);return{left:t.left+n.borderLeft+n.scrollbarLeft-hc(e),top:t.top+n.borderTop-e.scrollTop}}(t),i=[];for(let t of e){let e=_i(Qi(t.parentNode,!0,!0),-r.left,-r.top),s=t.getBoundingClientRect(),o=window.getComputedStyle(t),l=window.getComputedStyle(t.parentNode).textAlign,a=null;"start"===l?l=n?"right":"left":"end"===l&&(l=n?"left":"right"),"sticky"!==o.position&&(a=_i(s,-r.left-(parseFloat(o.left)||0),-r.top-(parseFloat(o.top)||0))),i.push({parentBound:e,naturalBound:a,elWidth:s.width,elHeight:s.height,textAlign:l})}return i}}class vc extends Ln{constructor(){super(...arguments),this.elRef={current:null},this.state={xScrollbarWidth:0,yScrollbarWidth:0},this.handleScroller=e=>{this.scroller=e,zn(this.props.scrollerRef,e)},this.handleSizing=()=>{let{props:e}=this;"scroll-hidden"===e.overflowY&&this.setState({yScrollbarWidth:this.scroller.getYScrollbarWidth()}),"scroll-hidden"===e.overflowX&&this.setState({xScrollbarWidth:this.scroller.getXScrollbarWidth()})}}render(){let{props:e,state:t,context:n}=this,r=n.isRtl&&Fi(),i=0,s=0,o=0;return"scroll-hidden"===e.overflowX&&(o=t.xScrollbarWidth),"scroll-hidden"===e.overflowY&&null!=t.yScrollbarWidth&&(r?i=t.yScrollbarWidth:s=t.yScrollbarWidth),f("div",{ref:this.elRef,className:"fc-scroller-harness"+(e.liquid?" fc-scroller-harness-liquid":"")},f(Hs,{ref:this.handleScroller,elRef:this.props.scrollerElRef,overflowX:"scroll-hidden"===e.overflowX?"scroll":e.overflowX,overflowY:"scroll-hidden"===e.overflowY?"scroll":e.overflowY,overcomeLeft:i,overcomeRight:s,overcomeBottom:o,maxHeight:"number"==typeof e.maxHeight?e.maxHeight+("scroll-hidden"===e.overflowX?t.xScrollbarWidth:0):"",liquid:e.liquid,liquidIsAbsolute:!0},e.children))}componentDidMount(){this.handleSizing(),this.context.addResizeHandler(this.handleSizing)}componentDidUpdate(e){xe(e,this.props)||this.handleSizing()}componentWillUnmount(){this.context.removeResizeHandler(this.handleSizing)}needsXScrolling(){return this.scroller.needsXScrolling()}needsYScrolling(){return this.scroller.needsYScrolling()}}const yc="wheel mousewheel DomMouseScroll MozMousePixelScroll".split(" ");class bc{constructor(e){this.el=e,this.emitter=new Wr,this.isScrolling=!1,this.isTouching=!1,this.isRecentlyWheeled=!1,this.isRecentlyScrolled=!1,this.wheelWaiter=new Se(this._handleWheelWaited.bind(this)),this.scrollWaiter=new Se(this._handleScrollWaited.bind(this)),this.handleScroll=()=>{this.startScroll(),this.emitter.trigger("scroll",this.isRecentlyWheeled,this.isTouching),this.isRecentlyScrolled=!0,this.scrollWaiter.request(500)},this.handleWheel=()=>{this.isRecentlyWheeled=!0,this.wheelWaiter.request(500)},this.handleTouchStart=()=>{this.isTouching=!0},this.handleTouchEnd=()=>{this.isTouching=!1,this.isRecentlyScrolled||this.endScroll()},e.addEventListener("scroll",this.handleScroll),e.addEventListener("touchstart",this.handleTouchStart,{passive:!0}),e.addEventListener("touchend",this.handleTouchEnd);for(let t of yc)e.addEventListener(t,this.handleWheel)}destroy(){let{el:e}=this;e.removeEventListener("scroll",this.handleScroll),e.removeEventListener("touchstart",this.handleTouchStart,{passive:!0}),e.removeEventListener("touchend",this.handleTouchEnd);for(let t of yc)e.removeEventListener(t,this.handleWheel)}startScroll(){this.isScrolling||(this.isScrolling=!0,this.emitter.trigger("scrollStart",this.isRecentlyWheeled,this.isTouching))}endScroll(){this.isScrolling&&(this.emitter.trigger("scrollEnd"),this.isScrolling=!1,this.isRecentlyScrolled=!0,this.isRecentlyWheeled=!1,this.scrollWaiter.clear(),this.wheelWaiter.clear())}_handleScrollWaited(){this.isRecentlyScrolled=!1,this.isTouching||this.endScroll()}_handleWheelWaited(){this.isRecentlyWheeled=!1}}class Sc{constructor(e,t){this.isVertical=e,this.scrollEls=t,this.isPaused=!1,this.scrollListeners=t.map(e=>this.bindScroller(e))}destroy(){for(let e of this.scrollListeners)e.destroy()}bindScroller(e){let{scrollEls:t,isVertical:n}=this,r=new bc(e);return r.emitter.on("scroll",(r,i)=>{if(!this.isPaused&&((!this.masterEl||this.masterEl!==e&&(r||i))&&this.assignMaster(e),this.masterEl===e))for(let r of t)r!==e&&(n?r.scrollTop=e.scrollTop:r.scrollLeft=e.scrollLeft)}),r.emitter.on("scrollEnd",()=>{this.masterEl===e&&(this.masterEl=null)}),r}assignMaster(e){this.masterEl=e;for(let t of this.scrollListeners)t.el!==e&&t.endScroll()}forceScrollLeft(e){this.isPaused=!0;for(let t of this.scrollListeners)fc(t.el,e);this.isPaused=!1}forceScrollTop(e){this.isPaused=!0;for(let t of this.scrollListeners)t.el.scrollTop=e;this.isPaused=!1}}ds.SCROLLGRID_RESIZE_INTERVAL=500;class Ec extends Ln{constructor(){super(...arguments),this.compileColGroupStats=We(Rc,Tc),this.renderMicroColGroups=We(Gs),this.clippedScrollerRefs=new Ws,this.scrollerElRefs=new Ws(this._handleScrollerEl.bind(this)),this.chunkElRefs=new Ws(this._handleChunkEl.bind(this)),this.scrollSyncersBySection={},this.scrollSyncersByColumn={},this.rowUnstableMap=new Map,this.rowInnerMaxHeightMap=new Map,this.anyRowHeightsChanged=!1,this.recentSizingCnt=0,this.state={shrinkWidths:[],forceYScrollbars:!1,forceXScrollbars:!1,scrollerClientWidths:{},scrollerClientHeights:{},sectionRowMaxHeights:[]},this.handleSizing=(e,t)=>{if(!this.allowSizing())return;t||(this.anyRowHeightsChanged=!0);let n={};(e||!t&&!this.rowUnstableMap.size)&&(n.sectionRowMaxHeights=this.computeSectionRowMaxHeights()),this.setState(Object.assign(Object.assign({shrinkWidths:this.computeShrinkWidths()},this.computeScrollerDims()),n),()=>{this.rowUnstableMap.size||this.updateStickyScrolling()})},this.handleRowHeightChange=(e,t)=>{let{rowUnstableMap:n,rowInnerMaxHeightMap:r}=this;if(t){n.delete(e);let t=wc(e);r.has(e)&&r.get(e)===t||(r.set(e,t),this.anyRowHeightsChanged=!0),!n.size&&this.anyRowHeightsChanged&&(this.anyRowHeightsChanged=!1,this.setState({sectionRowMaxHeights:this.computeSectionRowMaxHeights()}))}else n.set(e,!0)}}render(){let{props:e,state:t,context:n}=this,{shrinkWidths:r}=t,i=this.compileColGroupStats(e.colGroups.map(e=>[e])),s=this.renderMicroColGroups(i.map((e,t)=>[e.cols,r[t]])),o=qs(e.liquid,n);this.getDims();let l,a=e.sections,c=a.length,d=0,u=[],h=[],p=[];for(;d<c&&"header"===(l=a[d]).type;)u.push(this.renderSection(l,d,i,s,t.sectionRowMaxHeights,!0)),d+=1;for(;d<c&&"body"===(l=a[d]).type;)h.push(this.renderSection(l,d,i,s,t.sectionRowMaxHeights,!1)),d+=1;for(;d<c&&"footer"===(l=a[d]).type;)p.push(this.renderSection(l,d,i,s,t.sectionRowMaxHeights,!0)),d+=1;const g=!Ei(),m={role:"rowgroup"};return f("table",{ref:e.elRef,role:"grid",className:o.join(" ")},function(e,t){let n=e.map((e,n)=>{let r=e.width;return"shrink"===r&&(r=e.totalColWidth+Fs(t[n])+1),f("col",{style:{width:r}})});return f("colgroup",{},...n)}(i,r),Boolean(!g&&u.length)&&f("thead",m,...u),Boolean(!g&&h.length)&&f("tbody",m,...h),Boolean(!g&&p.length)&&f("tfoot",m,...p),g&&f("tbody",m,...u,...h,...p))}renderSection(e,t,n,r,i,s){return"outerContent"in e?f(g,{key:e.key},e.outerContent):f("tr",{key:e.key,role:"presentation",className:Ys(e,this.props.liquid).join(" ")},e.chunks.map((o,l)=>this.renderChunk(e,t,n[l],r[l],o,l,(i[t]||[])[l]||[],s)))}renderChunk(e,t,n,r,i,s,o,l){if("outerContent"in i)return f(g,{key:i.key},i.outerContent);let{state:a}=this,{scrollerClientWidths:c,scrollerClientHeights:d}=a,[u,h]=this.getDims(),p=t*h+s,m=s===(!this.context.isRtl||Fi()?h-1:0),v=t===u-1,y=v&&a.forceXScrollbars,b=m&&a.forceYScrollbars,S=n&&n.allowXScrolling,E=Ls(this.props,e),C=js(this.props,e),w=e.expandRows&&C,D=zs(e,i,{tableColGroupNode:r,tableMinWidth:n&&n.totalColMinWidth||"",clientWidth:void 0!==c[p]?c[p]:null,clientHeight:void 0!==d[p]?d[p]:null,expandRows:w,syncRowHeights:Boolean(e.syncRowHeights),rowSyncHeights:o,reportRowHeightChange:this.handleRowHeightChange},l),R=y?v?"scroll":"scroll-hidden":S?v?"auto":"scroll-hidden":"hidden",A=b?m?"scroll":"scroll-hidden":E?m?"auto":"scroll-hidden":"hidden";return D=f(vc,{ref:this.clippedScrollerRefs.createRef(p),scrollerElRef:this.scrollerElRefs.createRef(p),overflowX:R,overflowY:A,liquid:C,maxHeight:e.maxHeight},D),f(l?"th":"td",{key:i.key,ref:this.chunkElRefs.createRef(p),role:"presentation"},D)}componentDidMount(){this.getStickyScrolling=We(Mc),this.getScrollSyncersBySection=Be(_c.bind(this,!0),null,kc),this.getScrollSyncersByColumn=Be(_c.bind(this,!1),null,kc),this.updateScrollSyncers(),this.handleSizing(!1),this.context.addResizeHandler(this.handleSizing)}componentDidUpdate(e,t){this.updateScrollSyncers(),this.handleSizing(!1,t.sectionRowMaxHeights!==this.state.sectionRowMaxHeights)}componentWillUnmount(){this.context.removeResizeHandler(this.handleSizing),this.destroyScrollSyncers()}allowSizing(){let e=new Date;return!this.lastSizingDate||e.valueOf()>this.lastSizingDate.valueOf()+ds.SCROLLGRID_RESIZE_INTERVAL?(this.lastSizingDate=e,this.recentSizingCnt=0,!0):(this.recentSizingCnt+=1)<=10}computeShrinkWidths(){let e=this.compileColGroupStats(this.props.colGroups.map(e=>[e])),[t,n]=this.getDims(),r=t*n,i=[];return e.forEach((e,t)=>{if(e.hasShrinkCol){let e=this.chunkElRefs.collect(t,r,n);i[t]=Bs(e)}}),i}computeSectionRowMaxHeights(){let e=new Map,[t,n]=this.getDims(),r=[];for(let i=0;i<t;i+=1){let t=this.props.sections[i],s=[];if(t&&t.syncRowHeights){let r=[];for(let t=0;t<n;t+=1){let s=i*n+t,o=[],l=this.chunkElRefs.currentMap[s];o=l?Ue(l,".fc-scrollgrid-sync-table tr").map(t=>{let n=wc(t);return e.set(t,n),n}):[],r.push(o)}let o=r[0].length,l=!0;for(let e=1;e<n;e+=1){if(!(t.chunks[e]&&void 0!==t.chunks[e].outerContent)&&r[e].length!==o){l=!1;break}}if(l){for(let e=0;e<n;e+=1)s.push([]);for(let e=0;e<o;e+=1){let t=[];for(let i=0;i<n;i+=1){let n=r[i][e];null!=n&&t.push(n)}let i=Math.max(...t);for(let e=0;e<n;e+=1)s[e].push(i)}}else{let e=[];for(let t=0;t<n;t+=1)e.push(Cc(r[t])+r[t].length);let t=Math.max(...e);for(let e=0;e<n;e+=1){let n=r[e].length,i=t-n,o=Math.floor(i/n),l=i-o*(n-1),a=[],c=0;for(c<n&&(a.push(l),c+=1);c<n;)a.push(o),c+=1;s.push(a)}}}r.push(s)}return this.rowInnerMaxHeightMap=e,r}computeScrollerDims(){let e=Vi(),[t,n]=this.getDims(),r=!this.context.isRtl||Fi()?n-1:0,i=t-1,s=this.clippedScrollerRefs.currentMap,o=this.scrollerElRefs.currentMap,l=!1,a=!1,c={},d={};for(let e=0;e<t;e+=1){let t=s[e*n+r];if(t&&t.needsYScrolling()){l=!0;break}}for(let e=0;e<n;e+=1){let t=s[i*n+e];if(t&&t.needsXScrolling()){a=!0;break}}for(let s=0;s<t;s+=1)for(let t=0;t<n;t+=1){let u=s*n+t,h=o[u];if(h){let n=h.parentNode;c[u]=Math.floor(n.getBoundingClientRect().width-(t===r&&l?e.y:0)),d[u]=Math.floor(n.getBoundingClientRect().height-(s===i&&a?e.x:0))}}return{forceYScrollbars:l,forceXScrollbars:a,scrollerClientWidths:c,scrollerClientHeights:d}}updateStickyScrolling(){let{isRtl:e}=this.context,t=this.scrollerElRefs.getAll().map(t=>[t,e]);this.getStickyScrolling(t).forEach(e=>e.updateSize())}updateScrollSyncers(){let[e,t]=this.getDims(),n=e*t,r={},i={},s=this.scrollerElRefs.currentMap;for(let n=0;n<e;n+=1){let e=n*t,i=e+t;r[n]=Ie(s,e,i,1)}for(let e=0;e<t;e+=1)i[e]=this.scrollerElRefs.collect(e,n,t);this.scrollSyncersBySection=this.getScrollSyncersBySection(r),this.scrollSyncersByColumn=this.getScrollSyncersByColumn(i)}destroyScrollSyncers(){De(this.scrollSyncersBySection,kc),De(this.scrollSyncersByColumn,kc)}getChunkConfigByIndex(e){let t=this.getDims()[1],n=Math.floor(e/t),r=e%t,i=this.props.sections[n];return i&&i.chunks[r]}forceScrollLeft(e,t){let n=this.scrollSyncersByColumn[e];n&&n.forceScrollLeft(t)}forceScrollTop(e,t){let n=this.scrollSyncersBySection[e];n&&n.forceScrollTop(t)}_handleChunkEl(e,t){let n=this.getChunkConfigByIndex(parseInt(t,10));n&&zn(n.elRef,e)}_handleScrollerEl(e,t){let n=this.getChunkConfigByIndex(parseInt(t,10));n&&zn(n.scrollerElRef,e)}getDims(){let e=this.props.sections.length;return[e,e?this.props.sections[0].chunks.length:0]}}function Cc(e){let t=0;for(let n of e)t+=n;return t}function wc(e){let t=Ue(e,".fc-scrollgrid-sync-inner").map(Dc);return t.length?Math.max(...t):0}function Dc(e){return e.offsetHeight}function Rc(e){let t=Ac(e.cols,"width"),n=Ac(e.cols,"minWidth"),r=Vs(e.cols);return{hasShrinkCol:r,totalColWidth:t,totalColMinWidth:n,allowXScrolling:"shrink"!==e.width&&Boolean(t||n||r),cols:e.cols,width:e.width}}function Ac(e,t){let n=0;for(let r of e){let e=r[t];"number"==typeof e&&(n+=e*(r.span||1))}return n}Ec.addStateEquality({shrinkWidths:Ne,scrollerClientWidths:xe,scrollerClientHeights:xe});const xc={cols:Us};function Tc(e,t){return ke(e,t,xc)}function _c(e,...t){return new Sc(e,t)}function kc(e){e.destroy()}function Mc(e,t){return new mc(e,t)}var Ic=xo({name:"@fullcalendar/scrollgrid",premiumReleaseDate:"2022-12-27",deps:[uc],scrollGridImpl:Ec});ds.COLLAPSIBLE_WIDTH_THRESHOLD=1200;let Oc=[],Nc=[];function Pc(){let e=Ue(document.body,".fc-scroller-harness > .fc-scroller"),t=e.map(e=>{let t=window.getComputedStyle(e);return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop,overflowX:t.overflowX,overflowY:t.overflowY,marginBottom:t.marginBottom}});for(let e of Oc)e.emitter.trigger("_beforeprint");On(()=>{!function(e,t){e.forEach((e,n)=>{e.style.overflowX="visible",e.style.overflowY="visible",e.style.marginBottom="",e.style.left=-t[n].scrollLeft+"px"})}(e,t),Nc.push(()=>function(e,t){e.forEach((e,n)=>{let r=t[n];e.style.overflowX=r.overflowX,e.style.overflowY=r.overflowY,e.style.marginBottom=r.marginBottom,e.style.left="",e.scrollLeft=r.scrollLeft,e.scrollTop=r.scrollTop})}(e,t)),Nc.push(function(){let e=Ue(document.body,".fc-scrollgrid");return e.forEach(Wc),()=>e.forEach(Bc)}())})}function Hc(){for(let e of Oc)e.emitter.trigger("_afterprint");On(()=>{for(;Nc.length;)Nc.shift()()})}function Wc(e){let t=e.getBoundingClientRect().width;(!e.classList.contains("fc-scrollgrid-collapsible")||t<ds.COLLAPSIBLE_WIDTH_THRESHOLD)&&(e.style.width=t+"px")}function Bc(e){e.style.width=""}be(".fc .fc-event,.fc .fc-scrollgrid table tr{-moz-column-break-inside:avoid;break-inside:avoid}.fc-media-print{display:block;max-width:100%}.fc-media-print .fc-bg-event,.fc-media-print .fc-non-business,.fc-media-print .fc-timegrid-axis-chunk,.fc-media-print .fc-timegrid-slots,.fc-media-print .fc-timeline-slots{display:none}.fc-media-print .fc-h-event,.fc-media-print .fc-toolbar button,.fc-media-print .fc-v-event{background:#fff!important;color:#000!important}.fc-media-print .fc-event,.fc-media-print .fc-event-main{color:#000!important}.fc-media-print .fc-timegrid-event{margin:.5em 0}");var jc=xo({name:"@fullcalendar/adaptive",premiumReleaseDate:"2022-12-27",deps:[uc],contextInit:function(e){Oc.length||(window.addEventListener("beforeprint",Pc),window.addEventListener("afterprint",Hc)),Oc.push(e),e.calendarApi.on("_unmount",()=>{Oe(Oc,e),Oc.length||(window.removeEventListener("beforeprint",Pc),window.removeEventListener("afterprint",Hc))})}});ds.MAX_TIMELINE_SLOTS=1e3;const Lc=[{years:1},{months:1},{days:1},{hours:1},{minutes:30},{minutes:15},{minutes:10},{minutes:5},{minutes:1},{seconds:30},{seconds:15},{seconds:10},{seconds:5},{seconds:1},{milliseconds:500},{milliseconds:100},{milliseconds:10},{milliseconds:1}];function zc(e,t,n,r){let i={labelInterval:n.slotLabelInterval,slotDuration:n.slotDuration};!function(e,t,n){const{currentRange:r}=t;if(e.labelInterval){n.countDurationsBetween(r.start,r.end,e.labelInterval)>ds.MAX_TIMELINE_SLOTS&&(console.warn("slotLabelInterval results in too many cells"),e.labelInterval=null)}if(e.slotDuration){n.countDurationsBetween(r.start,r.end,e.slotDuration)>ds.MAX_TIMELINE_SLOTS&&(console.warn("slotDuration results in too many cells"),e.slotDuration=null)}if(e.labelInterval&&e.slotDuration){const t=$t(e.labelInterval,e.slotDuration);(null===t||t<1)&&(console.warn("slotLabelInterval must be a multiple of slotDuration"),e.slotDuration=null)}}(i,e,t),Fc(i,e,t),function(e,t,n){const{currentRange:r}=t;let{slotDuration:i}=e;if(!i){const s=Fc(e,t,n);for(let e of Lc){const t=Gt(e),n=$t(s,t);if(null!==n&&n>1&&n<=6){i=t;break}}if(i){n.countDurationsBetween(r.start,r.end,i)>200&&(i=null)}i||(i=s),e.slotDuration=i}}(i,e,t);let s=n.slotLabelFormat,o=Array.isArray(s)?s:null!=s?[s]:function(e,t,n,r){let i,s;const{labelInterval:o}=e;let l=Kt(o).unit;const a=r.weekNumbers;let c=i=s=null;"week"!==l||a||(l="day");switch(l){case"year":c={year:"numeric"};break;case"month":Vc("years",t,n)>1&&(c={year:"numeric"}),i={month:"short"};break;case"week":Vc("years",t,n)>1&&(c={year:"numeric"}),i={week:"narrow"};break;case"day":Vc("years",t,n)>1?c={year:"numeric",month:"long"}:Vc("months",t,n)>1&&(c={month:"long"}),a&&(i={week:"short"}),s={weekday:"narrow",day:"numeric"};break;case"hour":a&&(c={week:"short"}),Vc("days",t,n)>1&&(i={weekday:"short",day:"numeric",month:"numeric",omitCommas:!0}),s={hour:"numeric",minute:"2-digit",omitZeroMinute:!0,meridiem:"short"};break;case"minute":Zt(o)/60>=6?(c={hour:"numeric",meridiem:"short"},i=e=>":"+gt(e.date.minute,2)):c={hour:"numeric",minute:"numeric",meridiem:"short"};break;case"second":Xt(o)/60>=6?(c={hour:"numeric",minute:"2-digit",meridiem:"lowercase"},i=e=>":"+gt(e.date.second,2)):c={hour:"numeric",minute:"2-digit",second:"2-digit",meridiem:"lowercase"};break;case"millisecond":c={hour:"numeric",minute:"2-digit",second:"2-digit",meridiem:"lowercase"},i=e=>"."+gt(e.millisecond,3)}return[].concat(c||[],i||[],s||[])}(i,e,t,n);i.headerFormats=o.map(e=>Cn(e)),i.isTimeScale=Boolean(i.slotDuration.milliseconds);let l=null;if(!i.isTimeScale){const e=Kt(i.slotDuration).unit;/year|month|week/.test(e)&&(l=e)}i.largeUnit=l,i.emphasizeWeeks=1===Vt(i.slotDuration)&&Vc("weeks",e,t)>=2&&!n.businessHours;let a,c,d=n.snapDuration;d&&(a=Gt(d),c=$t(i.slotDuration,a)),null==c&&(a=i.slotDuration,c=1),i.snapDuration=a,i.snapsPerSlot=c;let u=Jt(e.slotMaxTime)-Jt(e.slotMinTime),h=Uc(e.renderRange.start,i,t),f=Uc(e.renderRange.end,i,t);i.isTimeScale&&(h=t.add(h,e.slotMinTime),f=t.add(Ct(f,-1),e.slotMaxTime)),i.timeWindowMs=u,i.normalizedRange={start:h,end:f};let p=[],g=h;for(;g<f;)Gc(g,i,e,r)&&p.push(g),g=t.add(g,i.slotDuration);i.slotDates=p;let m=-1,v=0;const y=[],b=[];for(g=h;g<f;)Gc(g,i,e,r)?(m+=1,y.push(m),b.push(v)):y.push(m+.5),g=t.add(g,i.snapDuration),v+=1;return i.snapDiffToIndex=y,i.snapIndexToDiff=b,i.snapCnt=m+1,i.slotCnt=i.snapCnt/i.snapsPerSlot,i.isWeekStarts=function(e,t){let{slotDates:n,emphasizeWeeks:r}=e,i=null,s=[];for(let e of n){let n=t.computeWeekNumber(e),o=r&&null!==i&&i!==n;i=n,s.push(o)}return s}(i,t),i.cellRows=function(e,t){let n=e.slotDates,r=e.headerFormats,i=r.map(()=>[]),s=Vt(e.slotDuration),o=7===s?"week":1===s?"day":null,l=r.map(e=>e.getLargestUnit?e.getLargestUnit():null);for(let s=0;s<n.length;s+=1){let a=n[s],c=e.isWeekStarts[s];for(let n=0;n<r.length;n+=1){let s=r[n],d=i[n],u=d[d.length-1],h=n===r.length-1,f=r.length>1&&!h,p=null,g=l[n]||(h?o:null);if(f){let e=t.format(a,s);u&&u.text===e?u.colspan+=1:p=qc(a,e,g)}else if(!u||yt(t.countDurationsBetween(e.normalizedRange.start,a,e.labelInterval))){let e=t.format(a,s);p=qc(a,e,g)}else u.colspan+=1;p&&(p.weekStart=c,d.push(p))}}return i}(i,t),i.slotsPerLabel=$t(i.labelInterval,i.slotDuration),i}function Uc(e,t,n){let r=e;return t.isTimeScale||(r=_t(r),t.largeUnit&&(r=n.startOf(r,t.largeUnit))),r}function Gc(e,t,n,r){if(r.isHiddenDay(e))return!1;if(t.isTimeScale){let r=_t(e),i=e.valueOf()-r.valueOf()-Jt(n.slotMinTime);return i=(i%864e5+864e5)%864e5,i<t.timeWindowMs}return!0}function Fc(e,t,n){const{currentRange:r}=t;let{labelInterval:i}=e;if(!i){let t;if(e.slotDuration){for(t of Lc){const n=Gt(t),r=$t(n,e.slotDuration);if(null!==r&&r<=6){i=n;break}}i||(i=e.slotDuration)}else for(t of Lc){i=Gt(t);if(n.countDurationsBetween(r.start,r.end,i)>=18)break}e.labelInterval=i}return i}function Vc(e,t,n){let r=t.currentRange,i=null;return"years"===e?i=n.diffWholeYears(r.start,r.end):"months"===e||"weeks"===e?i=n.diffWholeMonths(r.start,r.end):"days"===e&&(i=Tt(r.start,r.end)),i||0}function qc(e,t,n){return{date:e,text:t,rowUnit:n,colspan:1,isWeekStart:!1}}class Yc extends Ln{constructor(){super(...arguments),this.refineRenderProps=He(Xc),this.buildCellNavLinkAttrs=Pe(Qc)}render(){let{props:e,context:t}=this,{dateEnv:n,options:r}=t,{cell:i,dateProfile:s,tDateProfile:o}=e,l=Hi(i.date,e.todayRange,e.nowDate,s),a=this.refineRenderProps({level:e.rowLevel,dateMarker:i.date,text:i.text,dateEnv:t.dateEnv,viewApi:t.viewApi});return f(qn,{elTag:"th",elClasses:["fc-timeline-slot","fc-timeline-slot-label",i.isWeekStart&&"fc-timeline-slot-em",..."time"===i.rowUnit?Bi(l,t.theme):Wi(l,t.theme)],elAttrs:{colSpan:i.colspan,"data-date":n.formatIso(i.date,{omitTime:!o.isTimeScale,omitTimeZoneOffset:!0})},renderProps:a,generatorName:"slotLabelContent",generator:r.slotLabelContent||Zc,classNameGenerator:r.slotLabelClassNames,didMount:r.slotLabelDidMount,willUnmount:r.slotLabelWillUnmount},n=>f("div",{className:"fc-timeline-slot-frame",style:{height:e.rowInnerHeight}},f(n,{elTag:"a",elClasses:["fc-timeline-slot-cushion","fc-scrollgrid-sync-inner",e.isSticky&&"fc-sticky"],elAttrs:this.buildCellNavLinkAttrs(t,i.date,i.rowUnit)})))}}function Qc(e,t,n){return n&&"time"!==n?zi(e,t,n):{}}function Zc(e){return e.text}function Xc(e){return{level:e.level,date:e.dateEnv.toDate(e.dateMarker),view:e.viewApi,text:e.text}}class Jc extends Ln{render(){let{dateProfile:e,tDateProfile:t,rowInnerHeights:n,todayRange:r,nowDate:i}=this.props,{cellRows:s}=t;return f(g,null,s.map((o,l)=>{let a=l===s.length-1,c=t.isTimeScale&&a;return f("tr",{key:l,className:["fc-timeline-header-row",c?"fc-timeline-header-row-chrono":""].join(" ")},o.map(s=>f(Yc,{key:s.date.toISOString(),cell:s,rowLevel:l,dateProfile:e,tDateProfile:t,todayRange:r,nowDate:i,rowInnerHeight:n&&n[l],isSticky:!a})))}))}}class $c{constructor(e,t,n,r,i,s){this.slatRootEl=e,this.dateProfile=n,this.tDateProfile=r,this.dateEnv=i,this.isRtl=s,this.outerCoordCache=new Ji(e,t,!0,!1),this.innerCoordCache=new Ji(e,Ge(t,"div"),!0,!1)}isDateInRange(e){return nr(this.dateProfile.currentRange,e)}dateToCoord(e){let{tDateProfile:t}=this,n=this.computeDateSnapCoverage(e)/t.snapsPerSlot,r=Math.floor(n);r=Math.min(r,t.slotCnt-1);let i=n-r,{innerCoordCache:s,outerCoordCache:o}=this;return this.isRtl?o.originClientRect.width-(o.rights[r]-s.getWidth(r)*i):o.lefts[r]+s.getWidth(r)*i}rangeToCoords(e){return{start:this.dateToCoord(e.start),end:this.dateToCoord(e.end)}}durationToCoord(e){let{dateProfile:t,tDateProfile:n,dateEnv:r,isRtl:i}=this,s=0;if(t){let o=r.add(t.activeRange.start,e);n.isTimeScale||(o=_t(o)),s=this.dateToCoord(o),!i&&s&&(s+=1)}return s}coordFromLeft(e){return this.isRtl?this.outerCoordCache.originClientRect.width-e:e}computeDateSnapCoverage(e){return Kc(e,this.tDateProfile,this.dateEnv)}}function Kc(e,t,n){let r=n.countDurationsBetween(t.normalizedRange.start,e,t.snapDuration);if(r<0)return 0;if(r>=t.snapDiffToIndex.length)return t.snapCnt;let i=Math.floor(r),s=t.snapDiffToIndex[i];return yt(s)?s+=r-i:s=Math.ceil(s),s}function ed(e,t){return null===e?{left:"",right:""}:t?{right:e,left:""}:{left:e,right:""}}function td(e,t){return e?t?{right:e.start,left:-e.end}:{left:e.start,right:-e.end}:{left:"",right:""}}class nd extends Ln{constructor(){super(...arguments),this.rootElRef={current:null}}render(){let{props:e,context:t}=this,n=Kt(e.tDateProfile.slotDuration).unit,r=e.slatCoords&&e.slatCoords.dateProfile===e.dateProfile?e.slatCoords:null;return f(bs,{unit:n},(n,i)=>f("div",{className:"fc-timeline-header",ref:this.rootElRef},f("table",{"aria-hidden":!0,className:"fc-scrollgrid-sync-table",style:{minWidth:e.tableMinWidth,width:e.clientWidth}},e.tableColGroupNode,f("tbody",null,f(Jc,{dateProfile:e.dateProfile,tDateProfile:e.tDateProfile,nowDate:n,todayRange:i,rowInnerHeights:e.rowInnerHeights}))),t.options.nowIndicator&&f("div",{className:"fc-timeline-now-indicator-container"},r&&r.isDateInRange(n)&&f(to,{elClasses:["fc-timeline-now-indicator-arrow"],elStyle:ed(r.dateToCoord(n),t.isRtl),isAxis:!0,date:n}))))}componentDidMount(){this.updateSize()}componentDidUpdate(){this.updateSize()}updateSize(){this.props.onMaxCushionWidth&&this.props.onMaxCushionWidth(this.computeMaxCushionWidth())}computeMaxCushionWidth(){return Math.max(...Ue(this.rootElRef.current,".fc-timeline-header-row:last-child .fc-timeline-slot-cushion").map(e=>e.getBoundingClientRect().width))}}class rd extends Ln{render(){let{props:e,context:t}=this,{dateEnv:n,options:r,theme:i}=t,{date:s,tDateProfile:o,isEm:l}=e,a=Hi(e.date,e.todayRange,e.nowDate,e.dateProfile),c=Object.assign(Object.assign({date:n.toDate(e.date)},a),{view:t.viewApi});return f(qn,{elTag:"td",elRef:e.elRef,elClasses:["fc-timeline-slot","fc-timeline-slot-lane",l&&"fc-timeline-slot-em",o.isTimeScale?yt(n.countDurationsBetween(o.normalizedRange.start,e.date,o.labelInterval))?"fc-timeline-slot-major":"fc-timeline-slot-minor":"",...e.isDay?Wi(a,i):Bi(a,i)],elAttrs:{"data-date":n.formatIso(s,{omitTimeZoneOffset:!0,omitTime:!o.isTimeScale})},renderProps:c,generatorName:"slotLaneContent",generator:r.slotLaneContent,classNameGenerator:r.slotLaneClassNames,didMount:r.slotLaneDidMount,willUnmount:r.slotLaneWillUnmount},e=>f(e,{elTag:"div"}))}}class id extends Ln{render(){let{props:e}=this,{tDateProfile:t,cellElRefs:n}=e,{slotDates:r,isWeekStarts:i}=t,s=!t.isTimeScale&&!t.largeUnit;return f("tbody",null,f("tr",null,r.map((r,o)=>{let l=r.toISOString();return f(rd,{key:l,elRef:n.createRef(l),date:r,dateProfile:e.dateProfile,tDateProfile:t,nowDate:e.nowDate,todayRange:e.todayRange,isEm:i[o],isDay:s})})))}}class sd extends Ln{constructor(){super(...arguments),this.rootElRef={current:null},this.cellElRefs=new Ws,this.handleScrollRequest=e=>{let{onScrollLeftRequest:t}=this.props,{coords:n}=this;if(t&&n){if(e.time){t(n.coordFromLeft(n.durationToCoord(e.time)))}return!0}return null}}render(){let{props:e,context:t}=this;return f("div",{className:"fc-timeline-slots",ref:this.rootElRef},f("table",{"aria-hidden":!0,className:t.theme.getClass("table"),style:{minWidth:e.tableMinWidth,width:e.clientWidth}},e.tableColGroupNode,f(id,{cellElRefs:this.cellElRefs,dateProfile:e.dateProfile,tDateProfile:e.tDateProfile,nowDate:e.nowDate,todayRange:e.todayRange})))}componentDidMount(){this.updateSizing(),this.scrollResponder=this.context.createScrollResponder(this.handleScrollRequest)}componentDidUpdate(e){this.updateSizing(),this.scrollResponder.update(e.dateProfile!==this.props.dateProfile)}componentWillUnmount(){this.scrollResponder.detach(),this.props.onCoords&&this.props.onCoords(null)}updateSizing(){let{props:e,context:t}=this;if(null!==e.clientWidth&&this.scrollResponder){this.rootElRef.current.offsetWidth&&(this.coords=new $c(this.rootElRef.current,(n=this.cellElRefs.currentMap,e.tDateProfile.slotDates.map(e=>{let t=e.toISOString();return n[t]})),e.dateProfile,e.tDateProfile,t.dateEnv,t.isRtl),e.onCoords&&e.onCoords(this.coords),this.scrollResponder.update(!1))}var n}positionToHit(e){let{outerCoordCache:t}=this.coords,{dateEnv:n,isRtl:r}=this.context,{tDateProfile:i}=this.props,s=t.leftToIndex(e);if(null!=s){let o=t.getWidth(s),l=r?(t.rights[s]-e)/o:(e-t.lefts[s])/o,a=Math.floor(l*i.snapsPerSlot),c=n.add(i.slotDates[s],Yt(i.snapDuration,a));return{dateSpan:{range:{start:c,end:n.add(c,i.snapDuration)},allDay:!this.props.tDateProfile.isTimeScale},dayEl:this.cellElRefs.currentMap[s],left:t.lefts[s],right:t.rights[s]}}return null}}function od(e,t,n){let r=[];if(n)for(let i of e){let e=n.rangeToCoords(i),s=Math.round(e.start),o=Math.round(e.end);o-s<t&&(o=s+t),r.push({start:s,end:o})}return r}class ld extends Ln{render(){let{props:e}=this,t=[].concat(e.eventResizeSegs,e.dateSelectionSegs);return e.timelineCoords&&f("div",{className:"fc-timeline-bg"},this.renderSegs(e.businessHourSegs||[],e.timelineCoords,"non-business"),this.renderSegs(e.bgEventSegs||[],e.timelineCoords,"bg-event"),this.renderSegs(t,e.timelineCoords,"highlight"))}renderSegs(e,t,n){let{todayRange:r,nowDate:i}=this.props,{isRtl:s}=this.context,o=od(e,0,t),l=e.map((e,t)=>{let l=td(o[t],s);return f("div",{key:di(e.eventRange),className:"fc-timeline-bg-harness",style:l},"bg-event"===n?f(oo,Object.assign({seg:e},ai(e,r,i))):ao(n))});return f(g,null,l)}}class ad extends Rs{sliceRange(e,t,n,r,i){let s=function(e,t,n){if(!t.isTimeScale&&(e=ir(e),t.largeUnit)){let r=e;((e={start:n.startOf(e.start,t.largeUnit),end:n.startOf(e.end,t.largeUnit)}).end.valueOf()!==r.end.valueOf()||e.end<=e.start)&&(e={start:e.start,end:n.add(e.end,t.slotDuration)})}return e}(e,r,i),o=[];if(Kc(s.start,r,i)<Kc(s.end,r,i)){let e=$n(s,r.normalizedRange);e&&o.push({start:e.start,end:e.end,isStart:e.start.valueOf()===s.start.valueOf()&&Gc(e.start,r,t,n),isEnd:e.end.valueOf()===s.end.valueOf()&&Gc(wt(e.end,-1),r,t,n)})}return o}}const cd=Cn({hour:"numeric",minute:"2-digit",omitZeroMinute:!0,meridiem:"narrow"});class dd extends Ln{render(){let{props:e}=this;return f(Ks,Object.assign({},e,{elClasses:["fc-timeline-event","fc-h-event"],defaultTimeFormat:cd,defaultDisplayEventTime:!e.isTimeScale}))}}class ud extends Ln{render(){let{props:e,context:t}=this,{hiddenSegs:n,placement:r,resourceId:i}=e,{top:s,hcoords:o}=r,l=o&&null!==s,a=td(o,t.isRtl),c=i?{resourceId:i}:{};return f(po,{elRef:e.elRef,elClasses:["fc-timeline-more-link"],elStyle:Object.assign({visibility:l?"":"hidden",top:s||0},a),allDayDate:null,moreCnt:n.length,allSegs:n,hiddenSegs:n,dateProfile:e.dateProfile,todayRange:e.todayRange,extraDateSpan:c,popoverContent:()=>f(g,null,n.map(t=>{let n=t.eventRange.instance.instanceId;return f("div",{key:n,style:{visibility:e.isForcedInvisible[n]?"hidden":""}},f(dd,Object.assign({isTimeScale:e.isTimeScale,seg:t,isDragging:!1,isResizing:!1,isDateSelecting:!1,isSelected:n===e.eventSelection},ai(t,e.todayRange,e.nowDate))))}))},e=>f(e,{elTag:"div",elClasses:["fc-timeline-more-link-inner","fc-sticky"]}))}}class hd extends Ln{constructor(){super(...arguments),this.slicer=new ad,this.sortEventSegs=Pe(ni),this.harnessElRefs=new Ws,this.moreElRefs=new Ws,this.innerElRef={current:null},this.state={eventInstanceHeights:{},moreLinkHeights:{}},this.handleResize=e=>{e&&this.updateSize()}}render(){let{props:e,state:t,context:n}=this,{options:r}=n,{dateProfile:i,tDateProfile:s}=e,o=this.slicer.sliceProps(e,i,s.isTimeScale?null:e.nextDayThreshold,n,i,n.dateProfileGenerator,s,n.dateEnv),l=(o.eventDrag?o.eventDrag.segs:null)||(o.eventResize?o.eventResize.segs:null)||[],a=this.sortEventSegs(o.fgEventSegs,r.eventOrder),c=od(a,r.eventMinWidth,e.timelineCoords),[d,u]=function(e,t,n,r,i,s){let o=[],l=[];for(let r=0;r<e.length;r+=1){let i=e[r],s=n[i.eventRange.instance.instanceId],a=t[r];s&&a?o.push({index:r,span:a,thickness:s}):l.push({seg:i,hcoords:a,top:null})}let a=new ns;null!=i&&(a.strictOrder=i),null!=s&&(a.maxStackCnt=s);let c=a.addSegs(o),d=c.map(t=>({seg:e[t.index],hcoords:t.span,top:null})),u=ss(c),h=[],f=[];const p=t=>e[t.index];for(let t=0;t<u.length;t+=1){let n=u[t],i=n.entries.map(p),s=r[en(vo(i))];null!=s?h.push({index:e.length+t,thickness:s,span:n.span}):f.push({seg:i,hcoords:n.span,top:null})}a.maxStackCnt=-1,a.addSegs(h);let g=a.toRects(),m=[],v=0;for(let t of g){let n=t.index;m.push({seg:n<e.length?e[n]:u[n-e.length].entries.map(p),hcoords:t.span,top:t.levelCoord}),v=Math.max(v,t.levelCoord+t.thickness)}return[m.concat(l,d,f),v]}(a,c,t.eventInstanceHeights,t.moreLinkHeights,r.eventOrderStrict,r.eventMaxStack),h=(o.eventDrag?o.eventDrag.affectedInstances:null)||(o.eventResize?o.eventResize.affectedInstances:null)||{};return f(g,null,f(ld,{businessHourSegs:o.businessHourSegs,bgEventSegs:o.bgEventSegs,timelineCoords:e.timelineCoords,eventResizeSegs:o.eventResize?o.eventResize.segs:[],dateSelectionSegs:o.dateSelectionSegs,nowDate:e.nowDate,todayRange:e.todayRange}),f("div",{className:"fc-timeline-events fc-scrollgrid-sync-inner",ref:this.innerElRef,style:{height:u}},this.renderFgSegs(d,h,!1,!1,!1),this.renderFgSegs(function(e,t,n){if(!e.length||!t)return[];let r=function(e){let t={};for(let n of e){let{seg:e}=n;Array.isArray(e)||(t[e.eventRange.instance.instanceId]=n.top)}return t}(n);return e.map(e=>({seg:e,hcoords:t.rangeToCoords(e),top:r[e.eventRange.instance.instanceId]}))}(l,e.timelineCoords,d),{},Boolean(o.eventDrag),Boolean(o.eventResize),!1)))}componentDidMount(){this.updateSize(),this.context.addResizeHandler(this.handleResize)}componentDidUpdate(e,t){e.eventStore===this.props.eventStore&&e.timelineCoords===this.props.timelineCoords&&t.moreLinkHeights===this.state.moreLinkHeights||this.updateSize()}componentWillUnmount(){this.context.removeResizeHandler(this.handleResize)}updateSize(){let{props:e}=this,{timelineCoords:t}=e;const n=this.innerElRef.current;e.onHeightChange&&e.onHeightChange(n,!1),t&&this.setState({eventInstanceHeights:De(this.harnessElRefs.currentMap,e=>Math.round(e.getBoundingClientRect().height)),moreLinkHeights:De(this.moreElRefs.currentMap,e=>Math.round(e.getBoundingClientRect().height))},()=>{e.onHeightChange&&e.onHeightChange(n,!0)}),e.syncParentMinHeight&&(n.parentElement.style.minHeight=n.style.height)}renderFgSegs(e,t,n,r,i){let{harnessElRefs:s,moreElRefs:o,props:l,context:a}=this,c=n||r||i;return f(g,null,e.map(e=>{let{seg:d,hcoords:u,top:h}=e;if(Array.isArray(d)){let n=en(vo(d));return f(ud,{key:"m:"+n,elRef:o.createRef(n),hiddenSegs:d,placement:e,dateProfile:l.dateProfile,nowDate:l.nowDate,todayRange:l.todayRange,isTimeScale:l.tDateProfile.isTimeScale,eventSelection:l.eventSelection,resourceId:l.resourceId,isForcedInvisible:t})}let p=d.eventRange.instance.instanceId,g=c||Boolean(!t[p]&&u&&null!==h),m=td(u,a.isRtl);return f("div",{key:"e:"+p,ref:c?null:s.createRef(p),className:"fc-timeline-event-harness",style:Object.assign({visibility:g?"":"hidden",top:h||0},m)},f(dd,Object.assign({isTimeScale:l.tDateProfile.isTimeScale,seg:d,isDragging:n,isResizing:r,isDateSelecting:i,isSelected:p===l.eventSelection},ai(d,l.todayRange,l.nowDate))))}))}}hd.addStateEquality({eventInstanceHeights:xe,moreLinkHeights:xe});class fd extends ts{constructor(){super(...arguments),this.slatsRef={current:null},this.state={coords:null},this.handeEl=e=>{e?this.context.registerInteractiveComponent(this,{el:e}):this.context.unregisterInteractiveComponent(this)},this.handleCoords=e=>{this.setState({coords:e}),this.props.onSlatCoords&&this.props.onSlatCoords(e)}}render(){let{props:e,state:t,context:n}=this,{options:r}=n,{dateProfile:i,tDateProfile:s}=e,o=Kt(s.slotDuration).unit;return f("div",{className:"fc-timeline-body",ref:this.handeEl,style:{minWidth:e.tableMinWidth,height:e.clientHeight,width:e.clientWidth}},f(bs,{unit:o},(o,l)=>f(g,null,f(sd,{ref:this.slatsRef,dateProfile:i,tDateProfile:s,nowDate:o,todayRange:l,clientWidth:e.clientWidth,tableColGroupNode:e.tableColGroupNode,tableMinWidth:e.tableMinWidth,onCoords:this.handleCoords,onScrollLeftRequest:e.onScrollLeftRequest}),f(hd,{dateProfile:i,tDateProfile:e.tDateProfile,nowDate:o,todayRange:l,nextDayThreshold:r.nextDayThreshold,businessHours:e.businessHours,eventStore:e.eventStore,eventUiBases:e.eventUiBases,dateSelection:e.dateSelection,eventSelection:e.eventSelection,eventDrag:e.eventDrag,eventResize:e.eventResize,timelineCoords:t.coords,syncParentMinHeight:!0}),r.nowIndicator&&t.coords&&t.coords.isDateInRange(o)&&f("div",{className:"fc-timeline-now-indicator-container"},f(to,{elClasses:["fc-timeline-now-indicator-line"],elStyle:ed(t.coords.dateToCoord(o),n.isRtl),isAxis:!1,date:o})))))}queryHit(e,t,n,r){let i=this.slatsRef.current.positionToHit(e);return i?{dateProfile:this.props.dateProfile,dateSpan:i.dateSpan,rect:{left:i.left,right:i.right,top:0,bottom:r},dayEl:i.dayEl,layer:0}:null}}function pd(e,t){return[{span:e.slotCnt,minWidth:t||1}]}be('.fc .fc-timeline-body{min-height:100%;position:relative;z-index:1}.fc .fc-timeline-slots{bottom:0;position:absolute;top:0;z-index:1}.fc .fc-timeline-slots>table{height:100%}.fc .fc-timeline-slot-minor{border-style:dotted}.fc .fc-timeline-slot-frame{align-items:center;display:flex;justify-content:center}.fc .fc-timeline-header-row-chrono .fc-timeline-slot-frame{justify-content:flex-start}.fc .fc-timeline-header-row:last-child .fc-timeline-slot-frame{overflow:hidden}.fc .fc-timeline-slot-cushion{padding:4px 5px;white-space:nowrap}.fc-direction-ltr .fc-timeline-slot{border-right:0!important}.fc-direction-rtl .fc-timeline-slot{border-left:0!important}.fc .fc-timeline-now-indicator-container{bottom:0;left:0;position:absolute;right:0;top:0;width:0;z-index:4}.fc .fc-timeline-now-indicator-arrow,.fc .fc-timeline-now-indicator-line{border-color:var(--fc-now-indicator-color);border-style:solid;position:absolute;top:0}.fc .fc-timeline-now-indicator-arrow{border-left-color:transparent;border-right-color:transparent;border-width:6px 5px 0;margin:0 -6px}.fc .fc-timeline-now-indicator-line{border-width:0 0 0 1px;bottom:0;margin:0 -1px}.fc .fc-timeline-events{position:relative;width:0;z-index:3}.fc .fc-timeline-event-harness,.fc .fc-timeline-more-link{position:absolute;top:0}.fc-timeline-event{z-index:1}.fc-timeline-event.fc-event-mirror{z-index:2}.fc-timeline-event{align-items:center;border-radius:0;display:flex;font-size:var(--fc-small-font-size);margin-bottom:1px;padding:2px 1px;position:relative}.fc-timeline-event .fc-event-main{flex-grow:1;flex-shrink:1;min-width:0}.fc-timeline-event .fc-event-time{font-weight:700}.fc-timeline-event .fc-event-time,.fc-timeline-event .fc-event-title{padding:0 2px;white-space:nowrap}.fc-direction-ltr .fc-timeline-event.fc-event-end,.fc-direction-ltr .fc-timeline-more-link{margin-right:1px}.fc-direction-rtl .fc-timeline-event.fc-event-end,.fc-direction-rtl .fc-timeline-more-link{margin-left:1px}.fc-timeline-overlap-disabled .fc-timeline-event{margin-bottom:0;padding-bottom:5px;padding-top:5px}.fc-timeline-event:not(.fc-event-end):after,.fc-timeline-event:not(.fc-event-start):before{border-color:transparent #000;border-style:solid;border-width:5px;content:"";flex-grow:0;flex-shrink:0;height:0;margin:0 1px;opacity:.5;width:0}.fc-direction-ltr .fc-timeline-event:not(.fc-event-start):before,.fc-direction-rtl .fc-timeline-event:not(.fc-event-end):after{border-left:0}.fc-direction-ltr .fc-timeline-event:not(.fc-event-end):after,.fc-direction-rtl .fc-timeline-event:not(.fc-event-start):before{border-right:0}.fc-timeline-more-link{background:var(--fc-more-link-bg-color);color:var(--fc-more-link-text-color);cursor:pointer;font-size:var(--fc-small-font-size);padding:1px}.fc-timeline-more-link-inner{display:inline-block;left:0;padding:2px;right:0}.fc .fc-timeline-bg{bottom:0;left:0;position:absolute;right:0;top:0;width:0;z-index:2}.fc .fc-timeline-bg .fc-non-business{z-index:1}.fc .fc-timeline-bg .fc-bg-event{z-index:2}.fc .fc-timeline-bg .fc-highlight{z-index:3}.fc .fc-timeline-bg-harness{bottom:0;position:absolute;top:0}');var gd=xo({name:"@fullcalendar/timeline",premiumReleaseDate:"2022-12-27",deps:[uc],initialView:"timelineDay",views:{timeline:{component:class extends ts{constructor(){super(...arguments),this.buildTimelineDateProfile=Pe(zc),this.scrollGridRef={current:null},this.state={slatCoords:null,slotCushionMaxWidth:null},this.handleSlatCoords=e=>{this.setState({slatCoords:e})},this.handleScrollLeftRequest=e=>{this.scrollGridRef.current.forceScrollLeft(0,e)},this.handleMaxCushionWidth=e=>{this.setState({slotCushionMaxWidth:Math.ceil(e)})}}render(){let{props:e,state:t,context:n}=this,{options:r}=n,i=!e.forPrint&&Zs(r),s=!e.forPrint&&Xs(r),o=this.buildTimelineDateProfile(e.dateProfile,n.dateEnv,r,n.dateProfileGenerator),{slotMinWidth:l}=r,a=pd(o,l||this.computeFallbackSlotMinWidth(o)),c=[{type:"header",key:"header",isSticky:i,chunks:[{key:"timeline",content:n=>f(nd,{dateProfile:e.dateProfile,clientWidth:n.clientWidth,clientHeight:n.clientHeight,tableMinWidth:n.tableMinWidth,tableColGroupNode:n.tableColGroupNode,tDateProfile:o,slatCoords:t.slatCoords,onMaxCushionWidth:l?null:this.handleMaxCushionWidth})}]},{type:"body",key:"body",liquid:!0,chunks:[{key:"timeline",content:t=>f(fd,Object.assign({},e,{clientWidth:t.clientWidth,clientHeight:t.clientHeight,tableMinWidth:t.tableMinWidth,tableColGroupNode:t.tableColGroupNode,tDateProfile:o,onSlatCoords:this.handleSlatCoords,onScrollLeftRequest:this.handleScrollLeftRequest}))}]}];return s&&c.push({type:"footer",key:"footer",isSticky:!0,chunks:[{key:"timeline",content:Qs}]}),f(Qn,{elClasses:["fc-timeline",!1===r.eventOverlap?"fc-timeline-overlap-disabled":""],viewSpec:n.viewSpec},f(Ec,{ref:this.scrollGridRef,liquid:!e.isHeightAuto&&!e.forPrint,collapsibleWidth:!1,colGroups:[{cols:a}],sections:c}))}computeFallbackSlotMinWidth(e){return Math.max(30,(this.state.slotCushionMaxWidth||0)/e.slotsPerLabel)}},usesMinMaxTime:!0,eventResizableFromStart:!0},timelineDay:{type:"timeline",duration:{days:1}},timelineWeek:{type:"timeline",duration:{weeks:1}},timelineMonth:{type:"timeline",duration:{months:1}},timelineYear:{type:"timeline",duration:{years:1}}}});const md={id:String,parentId:String,children:In,title:String,businessHours:In,extendedProps:In,eventEditable:Boolean,eventStartEditable:Boolean,eventDurationEditable:Boolean,eventConstraint:In,eventOverlap:Boolean,eventAllow:In,eventClassNames:Rr,eventBackgroundColor:String,eventBorderColor:String,eventTextColor:String,eventColor:String};function vd(e,t="",n,r){let{refined:i,extra:s}=Mn(e,md),o={id:i.id||"_fc:"+it(),parentId:i.parentId||t,title:i.title||"",businessHours:i.businessHours?jr(i.businessHours,r):null,ui:Tr({editable:i.eventEditable,startEditable:i.eventStartEditable,durationEditable:i.eventDurationEditable,constraint:i.eventConstraint,overlap:i.eventOverlap,allow:i.eventAllow,classNames:i.eventClassNames,backgroundColor:i.eventBackgroundColor,borderColor:i.eventBorderColor,textColor:i.eventTextColor,color:i.eventColor},r),extendedProps:Object.assign(Object.assign({},s),i.extendedProps)};if(Object.freeze(o.ui.classNames),Object.freeze(o.extendedProps),n[o.id]);else if(n[o.id]=o,i.children)for(let e of i.children)vd(e,o.id,n,r);return o}function yd(e){return 0===e.indexOf("_fc:")?"":e}class bd{constructor(e,t){this._context=e,this._resource=t}setProp(e,t){let n=this._resource;this._context.dispatch({type:"SET_RESOURCE_PROP",resourceId:n.id,propName:e,propValue:t}),this.sync(n)}setExtendedProp(e,t){let n=this._resource;this._context.dispatch({type:"SET_RESOURCE_EXTENDED_PROP",resourceId:n.id,propName:e,propValue:t}),this.sync(n)}sync(e){let t=this._context,n=e.id;this._resource=t.getCurrentData().resourceStore[n],t.emitter.trigger("resourceChange",{oldResource:new bd(t,e),resource:this,revert(){t.dispatch({type:"ADD_RESOURCE",resourceHash:{[n]:e}})}})}remove(){let e=this._context,t=this._resource,n=t.id;e.dispatch({type:"REMOVE_RESOURCE",resourceId:n}),e.emitter.trigger("resourceRemove",{resource:this,revert(){e.dispatch({type:"ADD_RESOURCE",resourceHash:{[n]:t}})}})}getParent(){let e=this._context,t=this._resource.parentId;return t?new bd(e,e.getCurrentData().resourceSource[t]):null}getChildren(){let e=this._resource.id,t=this._context,{resourceStore:n}=t.getCurrentData(),r=[];for(let i in n)n[i].parentId===e&&r.push(new bd(t,n[i]));return r}getEvents(){let e=this._resource.id,t=this._context,{defs:n,instances:r}=t.getCurrentData().eventStore,i=[];for(let s in r){let o=r[s],l=n[o.defId];-1!==l.resourceIds.indexOf(e)&&i.push(new Yr(t,l,o))}return i}get id(){return yd(this._resource.id)}get title(){return this._resource.title}get eventConstraint(){return this._resource.ui.constraints[0]||null}get eventOverlap(){return this._resource.ui.overlap}get eventAllow(){return this._resource.ui.allows[0]||null}get eventBackgroundColor(){return this._resource.ui.backgroundColor}get eventBorderColor(){return this._resource.ui.borderColor}get eventTextColor(){return this._resource.ui.textColor}get eventClassNames(){return this._resource.ui.classNames}get extendedProps(){return this._resource.extendedProps}toPlainObject(e={}){let t=this._resource,{ui:n}=t,r=this.id,i={};return r&&(i.id=r),t.title&&(i.title=t.title),e.collapseEventColor&&n.backgroundColor&&n.backgroundColor===n.borderColor?i.eventColor=n.backgroundColor:(n.backgroundColor&&(i.eventBackgroundColor=n.backgroundColor),n.borderColor&&(i.eventBorderColor=n.borderColor)),n.textColor&&(i.eventTextColor=n.textColor),n.classNames.length&&(i.eventClassNames=n.classNames),Object.keys(t.extendedProps).length&&(e.collapseExtendedProps?Object.assign(i,t.extendedProps):i.extendedProps=t.extendedProps),i}toJSON(){return this.toPlainObject()}}class Sd extends Ni{getKeyInfo(e){return Object.assign({"":{}},e.resourceStore)}getKeysForDateSpan(e){return[e.resourceId||""]}getKeysForEventDef(e){let t=e.resourceIds;return t.length?t:[""]}}const Ed=ut("id,title");function Cd(e){return{resource:new bd(e.context,e.resource)}}class wd extends Ln{constructor(){super(...arguments),this.refineRenderProps=He(Rd)}render(){const{props:e}=this;return f(Wn.Consumer,null,t=>{let{options:n}=t,r=this.refineRenderProps({resource:e.resource,date:e.date,context:t});return f(qn,Object.assign({},e,{elAttrs:Object.assign(Object.assign({},e.elAttrs),{"data-resource-id":e.resource.id,"data-date":e.date?tn(e.date):void 0}),renderProps:r,generatorName:"resourceLabelContent",generator:n.resourceLabelContent||Dd,classNameGenerator:n.resourceLabelClassNames,didMount:n.resourceLabelDidMount,willUnmount:n.resourceLabelWillUnmount}))})}}function Dd(e){return e.resource.title||e.resource.id}function Rd(e){return{resource:new bd(e.context,e.resource),date:e.date?e.context.dateEnv.toDate(e.date):null,view:e.context.viewApi}}class Ad extends Ln{render(){let{props:e}=this;return f(wd,{elTag:"th",elClasses:["fc-col-header-cell","fc-resource"],elAttrs:{role:"columnheader",colSpan:e.colSpan},resource:e.resource,date:e.date},t=>f("div",{className:"fc-scrollgrid-sync-inner"},f(t,{elTag:"span",elClasses:["fc-col-header-cell-cushion",e.isSticky&&"fc-sticky"]})))}}class xd extends Ln{constructor(){super(...arguments),this.buildDateFormat=Pe(Td)}render(){let{props:e,context:t}=this,n=this.buildDateFormat(t.options.dayHeaderFormat,e.datesRepDistinctDays,e.dates.length);return f(bs,{unit:"day"},(r,i)=>1===e.dates.length?this.renderResourceRow(e.resources,e.dates[0]):t.options.datesAboveResources?this.renderDayAndResourceRows(e.dates,n,i,e.resources):this.renderResourceAndDayRows(e.resources,e.dates,n,i))}renderResourceRow(e,t){let n=e.map(e=>f(Ad,{key:e.id,resource:e,colSpan:1,date:t}));return this.buildTr(n,"resources")}renderDayAndResourceRows(e,t,n,r){let i=[],s=[];for(let o of e){i.push(this.renderDateCell(o,t,n,r.length,null,!0));for(let e of r)s.push(f(Ad,{key:e.id+":"+o.toISOString(),resource:e,colSpan:1,date:o}))}return f(g,null,this.buildTr(i,"day"),this.buildTr(s,"resources"))}renderResourceAndDayRows(e,t,n,r){let i=[],s=[];for(let o of e){i.push(f(Ad,{key:o.id,resource:o,colSpan:t.length,isSticky:!0}));for(let e of t)s.push(this.renderDateCell(e,n,r,1,o))}return f(g,null,this.buildTr(i,"resources"),this.buildTr(s,"day"))}renderDateCell(e,t,n,r,i,s){let{props:o}=this,l=i?":"+i.id:"",a=i?{resource:new bd(this.context,i)}:{},c=i?{"data-resource-id":i.id}:{};return o.datesRepDistinctDays?f(ms,{key:e.toISOString()+l,date:e,dateProfile:o.dateProfile,todayRange:n,colCnt:o.dates.length*o.resources.length,dayHeaderFormat:t,colSpan:r,isSticky:s,extraRenderProps:a,extraDataAttrs:c}):f(ys,{key:e.getUTCDay()+l,dow:e.getUTCDay(),dayHeaderFormat:t,colSpan:r,isSticky:s,extraRenderProps:a,extraDataAttrs:c})}buildTr(e,t){let{renderIntro:n}=this.props;return e.length||(e=[f("td",{key:0}," ")]),f("tr",{key:t,role:"row"},n&&n(t),e)}}function Td(e,t,n){return e||fs(t,n)}class _d{constructor(e){let t={},n=[];for(let r=0;r<e.length;r+=1){let i=e[r].id;n.push(i),t[i]=r}this.ids=n,this.indicesById=t,this.length=e.length}}class kd{constructor(e,t,n){this.dayTableModel=e,this.resources=t,this.context=n,this.resourceIndex=new _d(t),this.rowCnt=e.rowCnt,this.colCnt=e.colCnt*t.length,this.cells=this.buildCells()}buildCells(){let{rowCnt:e,dayTableModel:t,resources:n}=this,r=[];for(let i=0;i<e;i+=1){let e=[];for(let r=0;r<t.colCnt;r+=1)for(let s=0;s<n.length;s+=1){let o=n[s],l={resource:new bd(this.context,o)},a={"data-resource-id":o.id},c=["fc-resource"],d={resourceId:o.id},u=t.cells[i][r].date;e[this.computeCol(r,s)]={key:o.id+":"+u.toISOString(),date:u,extraRenderProps:l,extraDataAttrs:a,extraClassNames:c,extraDateSpan:d}}r.push(e)}return r}}class Md extends kd{computeCol(e,t){return t*this.dayTableModel.colCnt+e}computeColRanges(e,t,n){return[{firstCol:this.computeCol(e,n),lastCol:this.computeCol(t,n),isStart:!0,isEnd:!0}]}}class Id extends kd{computeCol(e,t){return e*this.resources.length+t}computeColRanges(e,t,n){let r=[];for(let i=e;i<=t;i+=1){let s=this.computeCol(i,n);r.push({firstCol:s,lastCol:s,isStart:i===e,isEnd:i===t})}return r}}const Od=[];class Nd{constructor(){this.joinDateSelection=Pe(this.joinSegs),this.joinBusinessHours=Pe(this.joinSegs),this.joinFgEvents=Pe(this.joinSegs),this.joinBgEvents=Pe(this.joinSegs),this.joinEventDrags=Pe(this.joinInteractions),this.joinEventResizes=Pe(this.joinInteractions)}joinProps(e,t){let n=[],r=[],i=[],s=[],o=[],l=[],a="",c=t.resourceIndex.ids.concat([""]);for(let t of c){let c=e[t];n.push(c.dateSelectionSegs),r.push(t?c.businessHourSegs:Od),i.push(t?c.fgEventSegs:Od),s.push(c.bgEventSegs),o.push(c.eventDrag),l.push(c.eventResize),a=a||c.eventSelection}return{dateSelectionSegs:this.joinDateSelection(t,...n),businessHourSegs:this.joinBusinessHours(t,...r),fgEventSegs:this.joinFgEvents(t,...i),bgEventSegs:this.joinBgEvents(t,...s),eventDrag:this.joinEventDrags(t,...o),eventResize:this.joinEventResizes(t,...l),eventSelection:a}}joinSegs(e,...t){let n=e.resources.length,r=[];for(let i=0;i<n;i+=1){for(let n of t[i])r.push(...this.transformSeg(n,e,i));for(let s of t[n])r.push(...this.transformSeg(s,e,i))}return r}expandSegs(e,t){let n=e.resources.length,r=[];for(let i=0;i<n;i+=1)for(let n of t)r.push(...this.transformSeg(n,e,i));return r}joinInteractions(e,...t){let n=e.resources.length,r={},i=[],s=!1,o=!1;for(let l=0;l<n;l+=1){let a=t[l];if(a){s=!0;for(let t of a.segs)i.push(...this.transformSeg(t,e,l));Object.assign(r,a.affectedInstances),o=o||a.isEvent}if(t[n])for(let r of t[n].segs)i.push(...this.transformSeg(r,e,l))}return s?{affectedInstances:r,segs:i,isEvent:o}:null}}class Pd extends Ni{getKeyInfo(e){let{resourceDayTableModel:t}=e,n=De(t.resourceIndex.indicesById,e=>t.resources[e]);return n[""]={},n}getKeysForDateSpan(e){return[e.resourceId||""]}getKeysForEventDef(e){let t=e.resourceIds;return t.length?t:[""]}}function Hd(e,t){return Wd(e,[],t,!1,{},!0).map(e=>e.resource)}function Wd(e,t,n,r,i,s){let o=[];return function e(t,n,r,i,s,o,l){for(let a=0;a<t.length;a+=1){let c=t[a],d=c.group;if(d)if(r){let t=n.length,a=i.length;if(e(c.children,n,r,i.concat(0),s,o,l),t<n.length){let e=n[t];(e.rowSpans=e.rowSpans.slice())[a]=n.length-t}}else{let t=d.spec.field+":"+d.value,a=null!=o[t]?o[t]:l;n.push({id:t,group:d,isExpanded:a}),a&&e(c.children,n,r,i,s+1,o,l)}else if(c.resource){let t=c.resource.id,a=null!=o[t]?o[t]:l;n.push({id:t,rowSpans:i,depth:s,isExpanded:a,hasChildren:Boolean(c.children.length),resource:c.resource,resourceFields:c.resourceFields}),a&&e(c.children,n,r,i,s+1,o,l)}}}(function(e,t,n,r){let i=function(e,t){let n={};for(let t in e){let r=e[t];n[t]={resource:r,resourceFields:Ld(r),children:[]}}for(let r in e){let i=e[r];if(i.parentId){let e=n[i.parentId];e&&jd(n[r],e.children,t)}}return n}(e,r),s=[];for(let e in i){let o=i[e];o.resource.parentId||Bd(o,s,n,0,t,r)}return s}(e,r?-1:1,t,n),o,r,[],0,i,s),o}function Bd(e,t,n,r,i,s){if(n.length&&(-1===i||r<=i)){Bd(e,function(e,t,n){let r,i,s=e.resourceFields[n.field];if(n.order)for(i=0;i<t.length;i+=1){let e=t[i];if(e.group){let t=pt(s,e.group.value)*n.order;if(0===t){r=e;break}if(t<0)break}}else for(i=0;i<t.length;i+=1){let e=t[i];if(e.group&&s===e.group.value){r=e;break}}r||(r={group:{value:s,spec:n},children:[]},t.splice(i,0,r));return r}(e,t,n[0]).children,n.slice(1),r+1,i,s)}else jd(e,t,s)}function jd(e,t,n){let r;for(r=0;r<t.length;r+=1){if(ht(t[r].resourceFields,e.resourceFields,n)>0)break}t.splice(r,0,e)}function Ld(e){let t=Object.assign(Object.assign(Object.assign({},e.extendedProps),e.ui),e);return delete t.ui,delete t.extendedProps,t}function zd(e,t){let{resourceEditable:n}=e;if(null==n){let r=e.sourceId&&t.getCurrentData().eventSources[e.sourceId];r&&(n=r.extendedProps.resourceEditable),null==n&&(n=t.options.eventResourceEditable,null==n&&(n=t.options.editable))}return n}function Ud(e,t,n,r){if(t){let t=function(e,t){let n={};for(let r in e){let i=e[r];for(let e of t[i.defId].resourceIds)n[e]=!0}return n}(function(e,t){return we(e,e=>er(e.range,t))}(n.instances,r),n.defs);return Object.assign(t,function(e,t){let n={};for(let r in e){let e;for(;(e=t[r])&&(r=e.parentId,r);)n[r]=!0}return n}(t,e)),we(e,(e,n)=>t[n])}return e}function Gd(e){return De(e,e=>e.ui)}function Fd(e,t,n){return De(e,(e,r)=>r?function(e,t,n){let r=[];for(let e of t.resourceIds)n[e]&&r.unshift(n[e]);return r.unshift(e),_r(r)}(e,t[r],n):e)}let Vd=[];function qd(e){Vd.push(e)}function Yd(e){return Vd[e]}function Qd(){return Vd}const Zd={id:String,resources:In,url:String,method:String,startParam:String,endParam:String,timeZoneParam:String,extraParams:In};function Xd(e){let t;if("string"==typeof e?t={url:e}:"function"==typeof e||Array.isArray(e)?t={resources:e}:"object"==typeof e&&e&&(t=e),t){let{refined:n,extra:r}=Mn(t,Zd);!function(e){for(let t in e)console.warn(`Unknown resource prop '${t}'`)}(r);let i=function(e){let t=Qd();for(let n=t.length-1;n>=0;n-=1){let r=t[n].parseMeta(e);if(r)return{meta:r,sourceDefId:n}}return null}(n);if(i)return{_raw:e,sourceId:it(),sourceDefId:i.sourceDefId,meta:i.meta,publicId:n.id||"",isFetching:!1,latestFetchId:"",fetchRange:null}}return null}function Jd(e,t,n){let{options:r,dateProfile:i}=n;if(!e||!t)return $d(r.initialResources||r.resources,i.activeRange,r.refetchResourcesOnNavigate,n);switch(t.type){case"RESET_RESOURCE_SOURCE":return $d(t.resourceSourceInput,i.activeRange,r.refetchResourcesOnNavigate,n);case"PREV":case"NEXT":case"CHANGE_DATE":case"CHANGE_VIEW_TYPE":return function(e,t,n,r){if(n&&!function(e){return Boolean(Yd(e.sourceDefId).ignoreRange)}(e)&&(!e.fetchRange||!Kn(e.fetchRange,t)))return Kd(e,t,r);return e}(e,i.activeRange,r.refetchResourcesOnNavigate,n);case"RECEIVE_RESOURCES":case"RECEIVE_RESOURCE_ERROR":return function(e,t,n){if(t===e.latestFetchId)return Object.assign(Object.assign({},e),{isFetching:!1,fetchRange:n});return e}(e,t.fetchId,t.fetchRange);case"REFETCH_RESOURCES":return Kd(e,i.activeRange,n);default:return e}}function $d(e,t,n,r){if(e){let i=Xd(e);return i=Kd(i,n?t:null,r),i}return null}function Kd(e,t,n){let r=Yd(e.sourceDefId),i=it();return r.fetch({resourceSource:e,range:t,context:n},e=>{n.dispatch({type:"RECEIVE_RESOURCES",fetchId:i,fetchRange:t,rawResources:e.rawResources})},e=>{n.dispatch({type:"RECEIVE_RESOURCE_ERROR",fetchId:i,fetchRange:t,error:e})}),Object.assign(Object.assign({},e),{isFetching:!0,latestFetchId:i})}function eu(e,t,n,r){if(!e||!t)return{};switch(t.type){case"RECEIVE_RESOURCES":return function(e,t,n,r,i){if(r.latestFetchId===n){let e={};for(let n of t)vd(n,"",e,i);return e}return e}(e,t.rawResources,t.fetchId,n,r);case"ADD_RESOURCE":return i=e,s=t.resourceHash,Object.assign(Object.assign({},i),s);case"REMOVE_RESOURCE":return function(e,t){let n=Object.assign({},e);delete n[t];for(let e in n)n[e].parentId===t&&(n[e]=Object.assign(Object.assign({},n[e]),{parentId:""}));return n}(e,t.resourceId);case"SET_RESOURCE_PROP":return function(e,t,n,r){let i=e[t];if(i)return Object.assign(Object.assign({},e),{[t]:Object.assign(Object.assign({},i),{[n]:r})});return e}(e,t.resourceId,t.propName,t.propValue);case"SET_RESOURCE_EXTENDED_PROP":return function(e,t,n,r){let i=e[t];if(i)return Object.assign(Object.assign({},e),{[t]:Object.assign(Object.assign({},i),{extendedProps:Object.assign(Object.assign({},i.extendedProps),{[n]:r})})});return e}(e,t.resourceId,t.propName,t.propValue);default:return e}var i,s}const tu={resourceId:String,resourceIds:In,resourceEditable:Boolean};function nu(e,t){return Object.assign(Object.assign({},t),{constraints:ru(e,t.constraints)})}function ru(e,t){return t.map(t=>{let n=t.defs;if(n)for(let t in n){let r=n[t].resourceIds;if(r.length&&-1===r.indexOf(e))return!1}return t})}Ai.prototype.addResource=function(e,t=!0){let n,r,i=this.getCurrentData();e instanceof bd?(r=e._resource,n={[r.id]:r}):(n={},r=vd(e,"",n,i)),this.dispatch({type:"ADD_RESOURCE",resourceHash:n}),t&&this.trigger("_scrollRequest",{resourceId:r.id});let s=new bd(i,r);return i.emitter.trigger("resourceAdd",{resource:s,revert:()=>{this.dispatch({type:"REMOVE_RESOURCE",resourceId:r.id})}}),s},Ai.prototype.getResourceById=function(e){e=String(e);let t=this.getCurrentData();if(t.resourceStore){let n=t.resourceStore[e];if(n)return new bd(t,n)}return null},Ai.prototype.getResources=function(){let e=this.getCurrentData(),{resourceStore:t}=e,n=[];if(t)for(let r in t)n.push(new bd(e,t[r]));return n},Ai.prototype.getTopLevelResources=function(){let e=this.getCurrentData(),{resourceStore:t}=e,n=[];if(t)for(let r in t)t[r].parentId||n.push(new bd(e,t[r]));return n},Ai.prototype.refetchResources=function(){this.dispatch({type:"REFETCH_RESOURCES"})};const iu={resources:function(e,t){t.getCurrentData().resourceSource._raw!==e&&t.dispatch({type:"RESET_RESOURCE_SOURCE",resourceSourceInput:e})}};const su={initialResources:In,resources:In,eventResourceEditable:Boolean,refetchResourcesOnNavigate:Boolean,resourceOrder:ut,filterResourcesWithEvents:Boolean,resourceGroupField:String,resourceAreaWidth:In,resourceAreaColumns:In,resourcesInitiallyExpanded:Boolean,datesAboveResources:Boolean,needsResourceData:Boolean,resourceAreaHeaderClassNames:In,resourceAreaHeaderContent:In,resourceAreaHeaderDidMount:In,resourceAreaHeaderWillUnmount:In,resourceGroupLabelClassNames:In,resourceGroupLabelContent:In,resourceGroupLabelDidMount:In,resourceGroupLabelWillUnmount:In,resourceLabelClassNames:In,resourceLabelContent:In,resourceLabelDidMount:In,resourceLabelWillUnmount:In,resourceLaneClassNames:In,resourceLaneContent:In,resourceLaneDidMount:In,resourceLaneWillUnmount:In,resourceGroupLaneClassNames:In,resourceGroupLaneContent:In,resourceGroupLaneDidMount:In,resourceGroupLaneWillUnmount:In},ou={resourcesSet:In,resourceAdd:In,resourceChange:In,resourceRemove:In};Yr.prototype.getResources=function(){let{calendarApi:e}=this._context;return this._def.resourceIds.map(t=>e.getResourceById(t))},Yr.prototype.setResources=function(e){let t=[];for(let n of e){let e=null;"string"==typeof n?e=n:"number"==typeof n?e=String(n):n instanceof bd?e=n.id:console.warn("unknown resource type: "+n),e&&t.push(e)}this.mutate({standardProps:{resourceIds:t}})},qd({ignoreRange:!0,parseMeta:e=>Array.isArray(e.resources)?e.resources:null,fetch(e,t){t({rawResources:e.resourceSource.meta})}}),qd({parseMeta:e=>"function"==typeof e.resources?e.resources:null,fetch(e,t,n){const r=e.context.dateEnv,i=e.resourceSource.meta,s=e.range?{start:r.toDate(e.range.start),end:r.toDate(e.range.end),startStr:r.formatIso(e.range.start),endStr:r.formatIso(e.range.end),timeZone:r.timeZone}:{};vi(i.bind(null,s),e=>t({rawResources:e}),n)}}),qd({parseMeta:e=>e.url?{url:e.url,method:(e.method||"GET").toUpperCase(),extraParams:e.extraParams}:null,fetch(e,t,n){const r=e.resourceSource.meta,i=function(e,t,n){let r,i,s,o,{dateEnv:l,options:a}=n,c={};t&&(r=e.startParam,null==r&&(r=a.startParam),i=e.endParam,null==i&&(i=a.endParam),s=e.timeZoneParam,null==s&&(s=a.timeZoneParam),c[r]=l.formatIso(t.start),c[i]=l.formatIso(t.end),"local"!==l.timeZone&&(c[s]=l.timeZone));o="function"==typeof e.extraParams?e.extraParams():e.extraParams||{};return Object.assign(c,o),c}(r,e.range,e.context);bi(r.method,r.url,i).then(([e,n])=>{t({rawResources:e,response:n})},n)}});var lu=xo({name:"@fullcalendar/resource",premiumReleaseDate:"2022-12-27",deps:[uc],reducers:[function(e,t,n){let r=Jd(e&&e.resourceSource,t,n);return{resourceSource:r,resourceStore:eu(e&&e.resourceStore,t,r,n),resourceEntityExpansions:function(e,t){if(!e||!t)return{};switch(t.type){case"SET_RESOURCE_ENTITY_EXPANDED":return Object.assign(Object.assign({},e),{[t.id]:t.isExpanded});default:return e}}(e&&e.resourceEntityExpansions,t)}}],isLoadingFuncs:[e=>e.resourceSource&&e.resourceSource.isFetching],eventRefiners:tu,eventDefMemberAdders:[function(e){return{resourceIds:(t=e.resourceIds,(t||[]).map(e=>String(e))).concat(e.resourceId?[e.resourceId]:[]),resourceEditable:e.resourceEditable};var t}],isDraggableTransformers:[function(e,t,n,r){if(!e){let e=r.getCurrentData();if(e.viewSpecs[e.currentViewType].optionDefaults.needsResourceData&&zd(t,r))return!0}return e}],eventDragMutationMassagers:[function(e,t,n){let r=t.dateSpan.resourceId,i=n.dateSpan.resourceId;r&&i&&r!==i&&(e.resourceMutation={matchResourceId:r,setResourceId:i})}],eventDefMutationAppliers:[function(e,t,n){let r=t.resourceMutation;if(r&&zd(e,n)){let t=e.resourceIds.indexOf(r.matchResourceId);if(-1!==t){let n=e.resourceIds.slice();n.splice(t,1),-1===n.indexOf(r.setResourceId)&&n.push(r.setResourceId),e.resourceIds=n}}}],dateSelectionTransformers:[function(e,t){let n=e.dateSpan.resourceId,r=t.dateSpan.resourceId;return n&&r?{resourceId:n}:null}],datePointTransforms:[function(e,t){return e.resourceId?{resource:t.calendarApi.getResourceById(e.resourceId)}:{}}],dateSpanTransforms:[function(e,t){return e.resourceId?{resource:t.calendarApi.getResourceById(e.resourceId)}:{}}],viewPropsTransformers:[class{constructor(){this.filterResources=Pe(Ud)}transform(e,t){return t.viewSpec.optionDefaults.needsResourceData?{resourceStore:this.filterResources(t.resourceStore,t.options.filterResourcesWithEvents,t.eventStore,t.dateProfile.activeRange),resourceEntityExpansions:t.resourceEntityExpansions}:null}},class{constructor(){this.buildResourceEventUis=Pe(Gd,xe),this.injectResourceEventUis=Pe(Fd)}transform(e,t){return t.viewSpec.optionDefaults.needsResourceData?null:{eventUiBases:this.injectResourceEventUis(e.eventUiBases,e.eventStore.defs,this.buildResourceEventUis(t.resourceStore))}}}],isPropsValid:function(e,t){let n=(new Sd).splitProps(Object.assign(Object.assign({},e),{resourceStore:t.getCurrentData().resourceStore}));for(let e in n){let r=n[e];if(e&&n[""]&&(r=Object.assign(Object.assign({},r),{eventStore:wr(n[""].eventStore,r.eventStore),eventUiBases:Object.assign(Object.assign({},n[""].eventUiBases),r.eventUiBases)})),!ks(r,t,{resourceId:e},nu.bind(null,e)))return!1}return!0},externalDefTransforms:[function(e){return e.resourceId?{resourceId:e.resourceId}:{}}],eventDropTransformers:[function(e,t){let{resourceMutation:n}=e;if(n){let{calendarApi:e}=t;return{oldResource:e.getResourceById(n.matchResourceId),newResource:e.getResourceById(n.setResourceId)}}return{oldResource:null,newResource:null}}],optionChangeHandlers:iu,optionRefiners:su,listenerRefiners:ou,propSetHandlers:{resourceStore:function(e,t){let{emitter:n}=t;n.hasHandlers("resourcesSet")&&n.trigger("resourcesSet",function(e,t){let n=[];for(let r in e)n.push(new bd(t,e[r]));return n}(e,t))}}});class au extends Nd{transformSeg(e,t,n){return t.computeColRanges(e.firstCol,e.lastCol,n).map(t=>Object.assign(Object.assign(Object.assign({},e),t),{isStart:e.isStart&&t.isStart,isEnd:e.isEnd&&t.isEnd}))}}class cu extends ts{constructor(){super(...arguments),this.splitter=new Pd,this.slicers={},this.joiner=new au,this.tableRef={current:null},this.isHitComboAllowed=(e,t)=>1===this.props.resourceDayTableModel.dayTableModel.colCnt||e.dateSpan.resourceId===t.dateSpan.resourceId}render(){let{props:e,context:t}=this,{resourceDayTableModel:n,nextDayThreshold:r,dateProfile:i}=e,s=this.splitter.splitProps(e);this.slicers=De(s,(e,t)=>this.slicers[t]||new ha);let o=De(this.slicers,(e,o)=>e.sliceProps(s[o],i,r,t,n.dayTableModel));return f(da,Object.assign({forPrint:e.forPrint,ref:this.tableRef},this.joiner.joinProps(o,n),{cells:n.cells,dateProfile:i,colGroupNode:e.colGroupNode,tableMinWidth:e.tableMinWidth,renderRowIntro:e.renderRowIntro,dayMaxEvents:e.dayMaxEvents,dayMaxEventRows:e.dayMaxEventRows,showWeekNumbers:e.showWeekNumbers,expandRows:e.expandRows,headerAlignElRef:e.headerAlignElRef,clientWidth:e.clientWidth,clientHeight:e.clientHeight,isHitComboAllowed:this.isHitComboAllowed}))}}function du(e,t,n,r,i){let s=pa(e,t);return r?new Id(s,n,i):new Md(s,n,i)}var uu=xo({name:"@fullcalendar/resource-daygrid",premiumReleaseDate:"2022-12-27",deps:[uc,lu,ga],initialView:"resourceDayGridDay",views:{resourceDayGrid:{type:"dayGrid",component:class extends ql{constructor(){super(...arguments),this.flattenResources=Pe(Hd),this.buildResourceDayTableModel=Pe(du),this.headerRef={current:null},this.tableRef={current:null}}render(){let{props:e,context:t}=this,{options:n}=t,r=n.resourceOrder||Ed,i=this.flattenResources(e.resourceStore,r),s=this.buildResourceDayTableModel(e.dateProfile,t.dateProfileGenerator,i,n.datesAboveResources,t),o=n.dayHeaders&&f(xd,{ref:this.headerRef,resources:i,dateProfile:e.dateProfile,dates:s.dayTableModel.headerDates,datesRepDistinctDays:!0}),l=t=>f(cu,{ref:this.tableRef,dateProfile:e.dateProfile,resourceDayTableModel:s,businessHours:e.businessHours,eventStore:e.eventStore,eventUiBases:e.eventUiBases,dateSelection:e.dateSelection,eventSelection:e.eventSelection,eventDrag:e.eventDrag,eventResize:e.eventResize,nextDayThreshold:n.nextDayThreshold,tableMinWidth:t.tableMinWidth,colGroupNode:t.tableColGroupNode,dayMaxEvents:n.dayMaxEvents,dayMaxEventRows:n.dayMaxEventRows,showWeekNumbers:n.weekNumbers,expandRows:!e.isHeightAuto,headerAlignElRef:this.headerElRef,clientWidth:t.clientWidth,clientHeight:t.clientHeight,forPrint:e.forPrint});return n.dayMinWidth?this.renderHScrollLayout(o,l,s.colCnt,n.dayMinWidth):this.renderSimpleLayout(o,l)}},needsResourceData:!0},resourceDayGridDay:{type:"resourceDayGrid",duration:{days:1}},resourceDayGridWeek:{type:"resourceDayGrid",duration:{weeks:1}},resourceDayGridMonth:{type:"resourceDayGrid",duration:{months:1},monthMode:!0,fixedWeekCount:!0}}});class hu extends Nd{transformSeg(e,t,n){return[Object.assign(Object.assign({},e),{col:t.computeCol(e.col,n)})]}}class fu extends ts{constructor(){super(...arguments),this.buildDayRanges=Pe(Ya),this.splitter=new Pd,this.slicers={},this.joiner=new hu,this.timeColsRef={current:null},this.isHitComboAllowed=(e,t)=>1===this.dayRanges.length||e.dateSpan.resourceId===t.dateSpan.resourceId}render(){let{props:e,context:t}=this,{dateEnv:n,options:r}=t,{dateProfile:i,resourceDayTableModel:s}=e,o=this.dayRanges=this.buildDayRanges(s.dayTableModel,i,n),l=this.splitter.splitProps(e);this.slicers=De(l,(e,t)=>this.slicers[t]||new Va);let a=De(this.slicers,(e,n)=>e.sliceProps(l[n],i,null,t,o));return f(bs,{unit:r.nowIndicator?"minute":"day"},(t,n)=>f(Ga,Object.assign({ref:this.timeColsRef},this.joiner.joinProps(a,s),{dateProfile:i,axis:e.axis,slotDuration:e.slotDuration,slatMetas:e.slatMetas,cells:s.cells[0],tableColGroupNode:e.tableColGroupNode,tableMinWidth:e.tableMinWidth,clientWidth:e.clientWidth,clientHeight:e.clientHeight,expandRows:e.expandRows,nowDate:t,nowIndicatorSegs:r.nowIndicator&&this.buildNowIndicatorSegs(t),todayRange:n,onScrollTopRequest:e.onScrollTopRequest,forPrint:e.forPrint,onSlatCoords:e.onSlatCoords,isHitComboAllowed:this.isHitComboAllowed})))}buildNowIndicatorSegs(e){let t=this.slicers[""].sliceNowDate(e,this.context,this.dayRanges);return this.joiner.expandSegs(this.props.resourceDayTableModel,t)}}function pu(e,t,n,r,i){let s=Xa(e,t);return r?new Id(s,n,i):new Md(s,n,i)}var gu=xo({name:"@fullcalendar/resource-timegrid",premiumReleaseDate:"2022-12-27",deps:[uc,lu,$a],initialView:"resourceTimeGridDay",views:{resourceTimeGrid:{type:"timeGrid",component:class extends Ca{constructor(){super(...arguments),this.flattenResources=Pe(Hd),this.buildResourceTimeColsModel=Pe(pu),this.buildSlatMetas=Pe(Za)}render(){let{props:e,context:t}=this,{options:n,dateEnv:r}=t,{dateProfile:i}=e,s=this.allDaySplitter.splitProps(e),o=n.resourceOrder||Ed,l=this.flattenResources(e.resourceStore,o),a=this.buildResourceTimeColsModel(i,t.dateProfileGenerator,l,n.datesAboveResources,t),c=this.buildSlatMetas(i.slotMinTime,i.slotMaxTime,n.slotLabelInterval,n.slotDuration,r),{dayMinWidth:d}=n,u=!d,h=d,p=n.dayHeaders&&f(xd,{resources:l,dates:a.dayTableModel.headerDates,dateProfile:i,datesRepDistinctDays:!0,renderIntro:u?this.renderHeadAxis:null}),g=!1!==n.allDaySlot&&(t=>f(cu,Object.assign({},s.allDay,{dateProfile:i,resourceDayTableModel:a,nextDayThreshold:n.nextDayThreshold,tableMinWidth:t.tableMinWidth,colGroupNode:t.tableColGroupNode,renderRowIntro:u?this.renderTableRowAxis:null,showWeekNumbers:!1,expandRows:!1,headerAlignElRef:this.headerElRef,clientWidth:t.clientWidth,clientHeight:t.clientHeight,forPrint:e.forPrint},this.getAllDayMaxEventProps()))),m=t=>f(fu,Object.assign({},s.timed,{dateProfile:i,axis:u,slotDuration:n.slotDuration,slatMetas:c,resourceDayTableModel:a,tableColGroupNode:t.tableColGroupNode,tableMinWidth:t.tableMinWidth,clientWidth:t.clientWidth,clientHeight:t.clientHeight,onSlatCoords:this.handleSlatCoords,expandRows:t.expandRows,forPrint:e.forPrint,onScrollTopRequest:this.handleScrollTopRequest}));return h?this.renderHScrollLayout(p,g,m,a.colCnt,d,c,this.state.slatCoords):this.renderSimpleLayout(p,g,m)}},needsResourceData:!0},resourceTimeGridDay:{type:"resourceTimeGrid",duration:{days:1}},resourceTimeGridWeek:{type:"resourceTimeGrid",duration:{weeks:1}}}});function mu({depth:e,hasChildren:t,isExpanded:n,onExpanderClick:r}){let i=[];for(let t=0;t<e;t+=1)i.push(f("span",{className:"fc-icon"}));let s=["fc-icon"];return t&&(n?s.push("fc-icon-minus-square"):s.push("fc-icon-plus-square")),i.push(f("span",{className:"fc-datagrid-expander"+(t?"":" fc-datagrid-expander-placeholder"),onClick:r},f("span",{className:s.join(" ")}))),f(g,{},...i)}class vu extends Ln{constructor(){super(...arguments),this.refineRenderProps=He(bu),this.onExpanderClick=e=>{let{props:t}=this;t.hasChildren&&this.context.dispatch({type:"SET_RESOURCE_ENTITY_EXPANDED",id:t.resource.id,isExpanded:!t.isExpanded})}}render(){let{props:e,context:t}=this,{colSpec:n}=e,r=this.refineRenderProps({resource:e.resource,fieldValue:e.fieldValue,context:t});return f(qn,{elTag:"td",elClasses:["fc-datagrid-cell","fc-resource"],elAttrs:{role:"gridcell","data-resource-id":e.resource.id},renderProps:r,generatorName:n.isMain?"resourceLabelContent":void 0,generator:n.cellContent||yu,classNameGenerator:n.cellClassNames,didMount:n.cellDidMount,willUnmount:n.cellWillUnmount},t=>f("div",{className:"fc-datagrid-cell-frame",style:{height:e.innerHeight}},f("div",{className:"fc-datagrid-cell-cushion fc-scrollgrid-sync-inner"},n.isMain&&f(mu,{depth:e.depth,hasChildren:e.hasChildren,isExpanded:e.isExpanded,onExpanderClick:this.onExpanderClick}),f(t,{elTag:"span",elClasses:["fc-datagrid-cell-main"]}))))}}function yu(e){return e.fieldValue||f(g,null," ")}function bu(e){return{resource:new bd(e.context,e.resource),fieldValue:e.fieldValue,view:e.context.viewApi}}class Su extends Ln{render(){let{props:e,context:t}=this,{colSpec:n}=e,r={groupValue:e.fieldValue,view:t.viewApi};return f(qn,{elTag:"td",elClasses:["fc-datagrid-cell","fc-resource-group"],elAttrs:{role:"gridcell",rowSpan:e.rowSpan},renderProps:r,generatorName:"resourceGroupLabelContent",generator:n.cellContent||Eu,classNameGenerator:n.cellClassNames,didMount:n.cellDidMount,willUnmount:n.cellWillUnmount},e=>f("div",{className:"fc-datagrid-cell-frame fc-datagrid-cell-frame-liquid"},f(e,{elTag:"div",elClasses:["fc-datagrid-cell-cushion","fc-sticky"]})))}}function Eu(e){return e.groupValue||f(g,null," ")}class Cu extends Ln{render(){let{props:e}=this,{resource:t,rowSpans:n,depth:r}=e,i=Ld(t);return f("tr",{role:"row"},e.colSpecs.map((s,o)=>{let l=n[o];if(0===l)return null;null==l&&(l=1);let a=s.field?i[s.field]:t.title||yd(t.id);return l>1?f(Su,{key:o,colSpec:s,fieldValue:a,rowSpan:l}):f(vu,{key:o,colSpec:s,resource:t,fieldValue:a,depth:r,hasChildren:e.hasChildren,isExpanded:e.isExpanded,innerHeight:e.innerHeight})}))}}Cu.addPropsEquality({rowSpans:Ne});class wu extends Ln{constructor(){super(...arguments),this.innerInnerRef={current:null},this.onExpanderClick=()=>{let{props:e}=this;this.context.dispatch({type:"SET_RESOURCE_ENTITY_EXPANDED",id:e.id,isExpanded:!e.isExpanded})}}render(){let{props:e,context:t}=this,n={groupValue:e.group.value,view:t.viewApi},r=e.group.spec;return f("tr",{role:"row"},f(qn,{elTag:"th",elClasses:["fc-datagrid-cell","fc-resource-group",t.theme.getClass("tableCellShaded")],elAttrs:{role:"columnheader",scope:"colgroup",colSpan:e.spreadsheetColCnt},renderProps:n,generatorName:"resourceGroupLabelContent",generator:r.labelContent||Du,classNameGenerator:r.labelClassNames,didMount:r.labelDidMount,willUnmount:r.labelWillUnmount},t=>f("div",{className:"fc-datagrid-cell-frame",style:{height:e.innerHeight}},f("div",{className:"fc-datagrid-cell-cushion fc-scrollgrid-sync-inner",ref:this.innerInnerRef},f(mu,{depth:0,hasChildren:!0,isExpanded:e.isExpanded,onExpanderClick:this.onExpanderClick}),f(t,{elTag:"span",elClasses:["fc-datagrid-cell-main"]})))))}}function Du(e){return e.groupValue||f(g,null," ")}wu.addPropsEquality({group:function(e,t){return e.spec===t.spec&&e.value===t.value}});class Ru extends Ln{constructor(){super(...arguments),this.resizerElRefs=new Ws(this._handleColResizerEl.bind(this)),this.colDraggings={}}render(){let{colSpecs:e,superHeaderRendering:t,rowInnerHeights:n}=this.props,r={view:this.context.viewApi},i=[];if(n=n.slice(),t){let s=n.shift();i.push(f("tr",{key:"row-super",role:"row"},f(qn,{elTag:"th",elClasses:["fc-datagrid-cell","fc-datagrid-cell-super"],elAttrs:{role:"columnheader",scope:"colgroup",colSpan:e.length},renderProps:r,generatorName:"resourceAreaHeaderContent",generator:t.headerContent,classNameGenerator:t.headerClassNames,didMount:t.headerDidMount,willUnmount:t.headerWillUnmount},e=>f("div",{className:"fc-datagrid-cell-frame",style:{height:s}},f(e,{elTag:"div",elClasses:["fc-datagrid-cell-cushion","fc-scrollgrid-sync-inner"]})))))}let s=n.shift();return i.push(f("tr",{key:"row",role:"row"},e.map((t,n)=>{let i=n===e.length-1;return f(qn,{key:n,elTag:"th",elClasses:["fc-datagrid-cell"],elAttrs:{role:"columnheader"},renderProps:r,generatorName:"resourceAreaHeaderContent",generator:t.headerContent,classNameGenerator:t.headerClassNames,didMount:t.headerDidMount,willUnmount:t.headerWillUnmount},e=>f("div",{className:"fc-datagrid-cell-frame",style:{height:s}},f("div",{className:"fc-datagrid-cell-cushion fc-scrollgrid-sync-inner"},t.isMain&&f("span",{className:"fc-datagrid-expander fc-datagrid-expander-placeholder"},f("span",{className:"fc-icon"})),f(e,{elTag:"span",elClasses:["fc-datagrid-cell-main"]})),!i&&f("div",{className:"fc-datagrid-cell-resizer",ref:this.resizerElRefs.createRef(n)})))}))),f(g,null,i)}_handleColResizerEl(e,t){let{colDraggings:n}=this;if(e){let r=this.initColResizing(e,parseInt(t,10));r&&(n[t]=r)}else{let e=n[t];e&&(e.destroy(),delete n[t])}}initColResizing(e,t){let{pluginHooks:n,isRtl:r}=this.context,{onColWidthChange:i}=this.props,s=n.elementDraggingImpl;if(s){let n,o,l=new s(e);return l.emitter.on("dragstart",()=>{let r=Ue(Le(e,"tr"),"th");o=r.map(e=>e.getBoundingClientRect().width),n=o[t]}),l.emitter.on("dragmove",e=>{o[t]=Math.max(n+e.deltaX*(r?-1:1),20),i&&i(o.slice())}),l.setAutoScrollEnabled(!1),l}return null}}class Au extends Ln{constructor(){super(...arguments),this.refineRenderProps=He(Cd),this.handleHeightChange=(e,t)=>{this.props.onHeightChange&&this.props.onHeightChange(Le(e,"tr"),t)}}render(){let{props:e,context:t}=this,{options:n}=t,r=this.refineRenderProps({resource:e.resource,context:t});return f("tr",{ref:e.elRef},f(qn,{elTag:"td",elClasses:["fc-timeline-lane","fc-resource"],elAttrs:{"data-resource-id":e.resource.id},renderProps:r,generatorName:"resourceLaneContent",generator:n.resourceLaneContent,classNameGenerator:n.resourceLaneClassNames,didMount:n.resourceLaneDidMount,willUnmount:n.resourceLaneWillUnmount},t=>f("div",{className:"fc-timeline-lane-frame",style:{height:e.innerHeight}},f(t,{elTag:"div",elClasses:["fc-timeline-lane-misc"]}),f(hd,{dateProfile:e.dateProfile,tDateProfile:e.tDateProfile,nowDate:e.nowDate,todayRange:e.todayRange,nextDayThreshold:e.nextDayThreshold,businessHours:e.businessHours,eventStore:e.eventStore,eventUiBases:e.eventUiBases,dateSelection:e.dateSelection,eventSelection:e.eventSelection,eventDrag:e.eventDrag,eventResize:e.eventResize,timelineCoords:e.timelineCoords,onHeightChange:this.handleHeightChange,resourceId:e.resource.id}))))}}class xu extends Ln{render(){let{props:e,context:t}=this,{renderHooks:n}=e,r={groupValue:e.groupValue,view:t.viewApi};return f("tr",{ref:e.elRef},f(qn,{elTag:"td",elRef:e.elRef,elClasses:["fc-timeline-lane","fc-resource-group",t.theme.getClass("tableCellShaded")],renderProps:r,generatorName:"resourceGroupLaneContent",generator:n.laneContent,classNameGenerator:n.laneClassNames,didMount:n.laneDidMount,willUnmount:n.laneWillUnmount},t=>f(t,{elTag:"div",elStyle:{height:e.innerHeight}})))}}class Tu extends Ln{render(){let{props:e,context:t}=this,{rowElRefs:n,innerHeights:r}=e;return f("tbody",null,e.rowNodes.map((i,s)=>{if(i.group)return f(xu,{key:i.id,elRef:n.createRef(i.id),groupValue:i.group.value,renderHooks:i.group.spec,innerHeight:r[s]||""});if(i.resource){let o=i.resource;return f(Au,Object.assign({key:i.id,elRef:n.createRef(i.id)},e.splitProps[o.id],{resource:o,dateProfile:e.dateProfile,tDateProfile:e.tDateProfile,nowDate:e.nowDate,todayRange:e.todayRange,nextDayThreshold:t.options.nextDayThreshold,businessHours:o.businessHours||e.fallbackBusinessHours,innerHeight:r[s]||"",timelineCoords:e.slatCoords,onHeightChange:e.onRowHeightChange}))}return null}))}}class _u extends Ln{constructor(){super(...arguments),this.rootElRef={current:null},this.rowElRefs=new Ws}render(){let{props:e,context:t}=this;return f("table",{ref:this.rootElRef,"aria-hidden":!0,className:"fc-scrollgrid-sync-table "+t.theme.getClass("table"),style:{minWidth:e.tableMinWidth,width:e.clientWidth,height:e.minHeight}},f(Tu,{rowElRefs:this.rowElRefs,rowNodes:e.rowNodes,dateProfile:e.dateProfile,tDateProfile:e.tDateProfile,nowDate:e.nowDate,todayRange:e.todayRange,splitProps:e.splitProps,fallbackBusinessHours:e.fallbackBusinessHours,slatCoords:e.slatCoords,innerHeights:e.innerHeights,onRowHeightChange:e.onRowHeightChange}))}componentDidMount(){this.updateCoords()}componentDidUpdate(){this.updateCoords()}componentWillUnmount(){this.props.onRowCoords&&this.props.onRowCoords(null)}updateCoords(){let{props:e}=this;var t;e.onRowCoords&&null!==e.clientWidth&&this.props.onRowCoords(new Ji(this.rootElRef.current,(t=this.rowElRefs.currentMap,e.rowNodes.map(e=>t[e.id])),!1,!0))}}class ku extends ts{constructor(){super(...arguments),this.computeHasResourceBusinessHours=Pe(Mu),this.resourceSplitter=new Sd,this.bgSlicer=new ad,this.slatsRef={current:null},this.state={slatCoords:null},this.handleEl=e=>{e?this.context.registerInteractiveComponent(this,{el:e}):this.context.unregisterInteractiveComponent(this)},this.handleSlatCoords=e=>{this.setState({slatCoords:e}),this.props.onSlatCoords&&this.props.onSlatCoords(e)},this.handleRowCoords=e=>{this.rowCoords=e,this.props.onRowCoords&&this.props.onRowCoords(e)}}render(){let{props:e,state:t,context:n}=this,{dateProfile:r,tDateProfile:i}=e,s=Kt(i.slotDuration).unit,o=this.computeHasResourceBusinessHours(e.rowNodes),l=this.resourceSplitter.splitProps(e),a=l[""],c=this.bgSlicer.sliceProps(a,r,i.isTimeScale?null:e.nextDayThreshold,n,r,n.dateProfileGenerator,i,n.dateEnv),d=t.slatCoords&&t.slatCoords.dateProfile===e.dateProfile?t.slatCoords:null;return f("div",{ref:this.handleEl,className:["fc-timeline-body",e.expandRows?"fc-timeline-body-expandrows":""].join(" "),style:{minWidth:e.tableMinWidth}},f(bs,{unit:s},(t,s)=>f(g,null,f(sd,{ref:this.slatsRef,dateProfile:r,tDateProfile:i,nowDate:t,todayRange:s,clientWidth:e.clientWidth,tableColGroupNode:e.tableColGroupNode,tableMinWidth:e.tableMinWidth,onCoords:this.handleSlatCoords,onScrollLeftRequest:e.onScrollLeftRequest}),f(ld,{businessHourSegs:o?null:c.businessHourSegs,bgEventSegs:c.bgEventSegs,timelineCoords:d,eventResizeSegs:c.eventResize?c.eventResize.segs:[],dateSelectionSegs:c.dateSelectionSegs,nowDate:t,todayRange:s}),f(_u,{rowNodes:e.rowNodes,dateProfile:r,tDateProfile:e.tDateProfile,nowDate:t,todayRange:s,splitProps:l,fallbackBusinessHours:o?e.businessHours:null,clientWidth:e.clientWidth,minHeight:e.expandRows?e.clientHeight:"",tableMinWidth:e.tableMinWidth,innerHeights:e.rowInnerHeights,slatCoords:d,onRowCoords:this.handleRowCoords,onRowHeightChange:e.onRowHeightChange}),n.options.nowIndicator&&d&&d.isDateInRange(t)&&f("div",{className:"fc-timeline-now-indicator-container"},f(to,{elClasses:["fc-timeline-now-indicator-line"],elStyle:ed(d.dateToCoord(t),n.isRtl),isAxis:!1,date:t})))))}queryHit(e,t){let n=this.rowCoords,r=n.topToIndex(t);if(null!=r){let t=this.props.rowNodes[r].resource;if(t){let i=this.slatsRef.current.positionToHit(e);if(i)return{dateProfile:this.props.dateProfile,dateSpan:{range:i.dateSpan.range,allDay:i.dateSpan.allDay,resourceId:t.id},rect:{left:i.left,right:i.right,top:n.tops[r],bottom:n.bottoms[r]},dayEl:i.dayEl,layer:0}}}return null}}function Mu(e){for(let t of e){let e=t.resource;if(e&&e.businessHours)return!0}return!1}class Iu extends Ln{constructor(){super(...arguments),this.scrollGridRef={current:null},this.timeBodyScrollerElRef={current:null},this.spreadsheetHeaderChunkElRef={current:null},this.rootElRef={current:null},this.ensureScrollGridResizeId=0,this.state={resourceAreaWidthOverride:null},this.ensureScrollGridResize=()=>{this.ensureScrollGridResizeId&&clearTimeout(this.ensureScrollGridResizeId),this.ensureScrollGridResizeId=setTimeout(()=>{this.scrollGridRef.current.handleSizing(!1)},ds.SCROLLGRID_RESIZE_INTERVAL+1)}}render(){let{props:e,state:t,context:n}=this,{options:r}=n,i=!e.forPrint&&Zs(r),s=!e.forPrint&&Xs(r),o=[{type:"header",key:"header",syncRowHeights:!0,isSticky:i,chunks:[{key:"datagrid",elRef:this.spreadsheetHeaderChunkElRef,tableClassName:"fc-datagrid-header",rowContent:e.spreadsheetHeaderRows},{key:"divider",outerContent:f("td",{role:"presentation",className:"fc-resource-timeline-divider "+n.theme.getClass("tableCellShaded")})},{key:"timeline",content:e.timeHeaderContent}]},{type:"body",key:"body",syncRowHeights:!0,liquid:!0,expandRows:Boolean(r.expandRows),chunks:[{key:"datagrid",tableClassName:"fc-datagrid-body",rowContent:e.spreadsheetBodyRows},{key:"divider",outerContent:f("td",{role:"presentation",className:"fc-resource-timeline-divider "+n.theme.getClass("tableCellShaded")})},{key:"timeline",scrollerElRef:this.timeBodyScrollerElRef,content:e.timeBodyContent}]}];s&&o.push({type:"footer",key:"footer",isSticky:!0,chunks:[{key:"datagrid",content:Qs},{key:"divider",outerContent:f("td",{role:"presentation",className:"fc-resource-timeline-divider "+n.theme.getClass("tableCellShaded")})},{key:"timeline",content:Qs}]});let l=null!=t.resourceAreaWidthOverride?t.resourceAreaWidthOverride:r.resourceAreaWidth;return f(Ec,{ref:this.scrollGridRef,elRef:this.rootElRef,liquid:!e.isHeightAuto&&!e.forPrint,collapsibleWidth:!1,colGroups:[{cols:e.spreadsheetCols,width:l},{cols:[]},{cols:e.timeCols}],sections:o})}forceTimeScroll(e){this.scrollGridRef.current.forceScrollLeft(2,e)}forceResourceScroll(e){this.scrollGridRef.current.forceScrollTop(1,e)}getResourceScroll(){return this.timeBodyScrollerElRef.current.scrollTop}componentDidMount(){this.initSpreadsheetResizing()}componentWillUnmount(){this.destroySpreadsheetResizing()}initSpreadsheetResizing(){let{isRtl:e,pluginHooks:t}=this.context,n=t.elementDraggingImpl,r=this.spreadsheetHeaderChunkElRef.current;if(n){let t,i,s=this.rootElRef.current,o=this.spreadsheetResizerDragging=new n(s,".fc-resource-timeline-divider");o.emitter.on("dragstart",()=>{t=r.getBoundingClientRect().width,i=s.getBoundingClientRect().width}),o.emitter.on("dragmove",n=>{let r=t+n.deltaX*(e?-1:1);r=Math.max(r,30),r=Math.min(r,i-30),this.setState({resourceAreaWidthOverride:r},this.ensureScrollGridResize)}),o.setAutoScrollEnabled(!1)}}destroySpreadsheetResizing(){this.spreadsheetResizerDragging&&this.spreadsheetResizerDragging.destroy()}}class Ou extends Ln{constructor(e,t){super(e,t),this.processColOptions=Pe(Wu),this.buildTimelineDateProfile=Pe(zc),this.hasNesting=Pe(Hu),this.buildRowNodes=Pe(Wd),this.layoutRef={current:null},this.rowNodes=[],this.renderedRowNodes=[],this.buildRowIndex=Pe(Nu),this.handleSlatCoords=e=>{this.setState({slatCoords:e})},this.handleRowCoords=e=>{this.rowCoords=e,this.scrollResponder.update(!1)},this.handleMaxCushionWidth=e=>{this.setState({slotCushionMaxWidth:Math.ceil(e)})},this.handleScrollLeftRequest=e=>{this.layoutRef.current.forceTimeScroll(e)},this.handleScrollRequest=e=>{let{rowCoords:t}=this,n=this.layoutRef.current,r=e.rowId||e.resourceId;if(t){if(r){let i=this.buildRowIndex(this.renderedRowNodes)[r];if(null!=i){let r=null!=e.fromBottom?t.bottoms[i]-e.fromBottom:t.tops[i];n.forceResourceScroll(r)}}return!0}return null},this.handleColWidthChange=e=>{this.setState({spreadsheetColWidths:e})},this.state={resourceAreaWidth:t.options.resourceAreaWidth,spreadsheetColWidths:[]}}render(){let{props:e,state:t,context:n}=this,{options:r,viewSpec:i}=n,{superHeaderRendering:s,groupSpecs:o,orderSpecs:l,isVGrouping:a,colSpecs:c}=this.processColOptions(n.options),d=this.buildTimelineDateProfile(e.dateProfile,n.dateEnv,r,n.dateProfileGenerator),u=this.rowNodes=this.buildRowNodes(e.resourceStore,o,l,a,e.resourceEntityExpansions,r.resourcesInitiallyExpanded),{slotMinWidth:h}=r,p=pd(d,h||this.computeFallbackSlotMinWidth(d));return f(Qn,{elClasses:["fc-resource-timeline",!this.hasNesting(u)&&"fc-resource-timeline-flat","fc-timeline",!1===r.eventOverlap?"fc-timeline-overlap-disabled":"fc-timeline-overlap-enabled"],viewSpec:i},f(Iu,{ref:this.layoutRef,forPrint:e.forPrint,isHeightAuto:e.isHeightAuto,spreadsheetCols:Pu(c,t.spreadsheetColWidths,""),spreadsheetHeaderRows:e=>f(Ru,{superHeaderRendering:s,colSpecs:c,onColWidthChange:this.handleColWidthChange,rowInnerHeights:e.rowSyncHeights}),spreadsheetBodyRows:e=>f(g,null,this.renderSpreadsheetRows(u,c,e.rowSyncHeights)),timeCols:p,timeHeaderContent:n=>f(nd,{clientWidth:n.clientWidth,clientHeight:n.clientHeight,tableMinWidth:n.tableMinWidth,tableColGroupNode:n.tableColGroupNode,dateProfile:e.dateProfile,tDateProfile:d,slatCoords:t.slatCoords,rowInnerHeights:n.rowSyncHeights,onMaxCushionWidth:h?null:this.handleMaxCushionWidth}),timeBodyContent:t=>f(ku,{dateProfile:e.dateProfile,clientWidth:t.clientWidth,clientHeight:t.clientHeight,tableMinWidth:t.tableMinWidth,tableColGroupNode:t.tableColGroupNode,expandRows:t.expandRows,tDateProfile:d,rowNodes:u,businessHours:e.businessHours,dateSelection:e.dateSelection,eventStore:e.eventStore,eventUiBases:e.eventUiBases,eventSelection:e.eventSelection,eventDrag:e.eventDrag,eventResize:e.eventResize,resourceStore:e.resourceStore,nextDayThreshold:n.options.nextDayThreshold,rowInnerHeights:t.rowSyncHeights,onSlatCoords:this.handleSlatCoords,onRowCoords:this.handleRowCoords,onScrollLeftRequest:this.handleScrollLeftRequest,onRowHeightChange:t.reportRowHeightChange})}))}renderSpreadsheetRows(e,t,n){return e.map((e,r)=>e.group?f(wu,{key:e.id,id:e.id,spreadsheetColCnt:t.length,isExpanded:e.isExpanded,group:e.group,innerHeight:n[r]||""}):e.resource?f(Cu,{key:e.id,colSpecs:t,rowSpans:e.rowSpans,depth:e.depth,isExpanded:e.isExpanded,hasChildren:e.hasChildren,resource:e.resource,innerHeight:n[r]||""}):null)}componentDidMount(){this.renderedRowNodes=this.rowNodes,this.scrollResponder=this.context.createScrollResponder(this.handleScrollRequest)}getSnapshotBeforeUpdate(){return this.props.forPrint?{}:{resourceScroll:this.queryResourceScroll()}}componentDidUpdate(e,t,n){this.renderedRowNodes=this.rowNodes,this.scrollResponder.update(e.dateProfile!==this.props.dateProfile),n.resourceScroll&&this.handleScrollRequest(n.resourceScroll)}componentWillUnmount(){this.scrollResponder.detach()}computeFallbackSlotMinWidth(e){return Math.max(30,(this.state.slotCushionMaxWidth||0)/e.slotsPerLabel)}queryResourceScroll(){let{rowCoords:e,renderedRowNodes:t}=this;if(e){let n=this.layoutRef.current,r=e.bottoms,i=n.getResourceScroll(),s={};for(let e=0;e<r.length;e+=1){let n=t[e],o=r[e]-i;if(o>0){s.rowId=n.id,s.fromBottom=o;break}}return s}return null}}function Nu(e){let t={};for(let n=0;n<e.length;n+=1)t[e[n].id]=n;return t}function Pu(e,t,n=""){return e.map((e,r)=>({className:e.isMain?"fc-main-col":"",width:t[r]||e.width||n}))}function Hu(e){for(let t of e){if(t.group)return!0;if(t.resource&&t.hasChildren)return!0}return!1}function Wu(e){let t=e.resourceAreaColumns||[],n=null;t.length?e.resourceAreaHeaderContent&&(n={headerClassNames:e.resourceAreaHeaderClassNames,headerContent:e.resourceAreaHeaderContent,headerDidMount:e.resourceAreaHeaderDidMount,headerWillUnmount:e.resourceAreaHeaderWillUnmount}):t.push({headerClassNames:e.resourceAreaHeaderClassNames,headerContent:e.resourceAreaHeaderContent||"Resources",headerDidMount:e.resourceAreaHeaderDidMount,headerWillUnmount:e.resourceAreaHeaderWillUnmount});let r=[],i=[],s=[],o=!1;for(let n of t)n.group?i.push(Object.assign(Object.assign({},n),{cellClassNames:n.cellClassNames||e.resourceGroupLabelClassNames,cellContent:n.cellContent||e.resourceGroupLabelContent,cellDidMount:n.cellDidMount||e.resourceGroupLabelDidMount,cellWillUnmount:n.cellWillUnmount||e.resourceGroupLaneWillUnmount})):r.push(n);let l=r[0];if(l.isMain=!0,l.cellClassNames=l.cellClassNames||e.resourceLabelClassNames,l.cellContent=l.cellContent||e.resourceLabelContent,l.cellDidMount=l.cellDidMount||e.resourceLabelDidMount,l.cellWillUnmount=l.cellWillUnmount||e.resourceLabelWillUnmount,i.length)s=i,o=!0;else{let t=e.resourceGroupField;t&&s.push({field:t,labelClassNames:e.resourceGroupLabelClassNames,labelContent:e.resourceGroupLabelContent,labelDidMount:e.resourceGroupLabelDidMount,labelWillUnmount:e.resourceGroupLabelWillUnmount,laneClassNames:e.resourceGroupLaneClassNames,laneContent:e.resourceGroupLaneContent,laneDidMount:e.resourceGroupLaneDidMount,laneWillUnmount:e.resourceGroupLaneWillUnmount})}let a=e.resourceOrder||Ed,c=[];for(let e of a){let t=!1;for(let n of s)if(n.field===e.field){n.order=e.order,t=!0;break}t||c.push(e)}return{superHeaderRendering:n,isVGrouping:o,groupSpecs:s,colSpecs:i.concat(r),orderSpecs:c}}Ou.addStateEquality({spreadsheetColWidths:Ne});be(".fc .fc-resource-timeline-divider{cursor:col-resize;width:3px}.fc .fc-resource-group{font-weight:inherit;text-align:inherit}.fc .fc-resource-timeline .fc-resource-group:not([rowspan]){background:var(--fc-neutral-bg-color)}.fc .fc-timeline-lane-frame{position:relative}.fc .fc-timeline-overlap-enabled .fc-timeline-lane-frame .fc-timeline-events{box-sizing:content-box;padding-bottom:10px}.fc-timeline-body-expandrows td.fc-timeline-lane{position:relative}.fc-timeline-body-expandrows .fc-timeline-lane-frame{position:static}.fc-datagrid-cell-frame-liquid{height:100%}.fc-liquid-hack .fc-datagrid-cell-frame-liquid{bottom:0;height:auto;left:0;position:absolute;right:0;top:0}.fc .fc-datagrid-header .fc-datagrid-cell-frame{align-items:center;display:flex;justify-content:flex-start;position:relative}.fc .fc-datagrid-cell-resizer{bottom:0;cursor:col-resize;position:absolute;top:0;width:5px;z-index:1}.fc .fc-datagrid-cell-cushion{overflow:hidden;padding:8px;white-space:nowrap}.fc .fc-datagrid-expander{cursor:pointer;opacity:.65}.fc .fc-datagrid-expander .fc-icon{display:inline-block;width:1em}.fc .fc-datagrid-expander-placeholder{cursor:auto}.fc .fc-resource-timeline-flat .fc-datagrid-expander-placeholder{display:none}.fc-direction-ltr .fc-datagrid-cell-resizer{right:-3px}.fc-direction-rtl .fc-datagrid-cell-resizer{left:-3px}.fc-direction-ltr .fc-datagrid-expander{margin-right:3px}.fc-direction-rtl .fc-datagrid-expander{margin-left:3px}");var Bu=xo({name:"@fullcalendar/resource-timeline",premiumReleaseDate:"2022-12-27",deps:[uc,lu,gd],initialView:"resourceTimelineDay",views:{resourceTimeline:{type:"timeline",component:Ou,needsResourceData:!0,resourceAreaWidth:"30%",resourcesInitiallyExpanded:!0,eventResizableFromStart:!0},resourceTimelineDay:{type:"resourceTimeline",duration:{days:1}},resourceTimelineWeek:{type:"resourceTimeline",duration:{weeks:1}},resourceTimelineMonth:{type:"resourceTimeline",duration:{months:1}},resourceTimelineYear:{type:"resourceTimeline",duration:{years:1}}}});return el.push(Vl,ga,$a,ac,Ic,jc,gd,lu,uu,gu,Bu),e.Calendar=class extends Ai{constructor(e,t={}){super(),this.isRendering=!1,this.isRendered=!1,this.currentClassNames=[],this.customContentRenderId=0,this.handleAction=e=>{switch(e.type){case"SET_EVENT_DRAG":case"SET_EVENT_RESIZE":this.renderRunner.tryDrain()}},this.handleData=e=>{this.currentData=e,this.renderRunner.request(e.calendarOptions.rerenderDelay)},this.handleRenderRequest=()=>{if(this.isRendering){this.isRendered=!0;let{currentData:e}=this;On(()=>{P(f(Ci,{options:e.calendarOptions,theme:e.theme,emitter:e.emitter},(t,n,r,i)=>(this.setClassNames(t),this.setHeight(n),f(Vn.Provider,{value:this.customContentRenderId},f(bl,Object.assign({isHeightAuto:r,forPrint:i},e))))),this.el)})}else this.isRendered&&(this.isRendered=!1,P(null,this.el),this.setClassNames([]),this.setHeight(""))},this.el=e,this.renderRunner=new Se(this.handleRenderRequest),new rl({optionOverrides:t,calendarApi:this,onAction:this.handleAction,onData:this.handleData})}render(){let e=this.isRendering;e?this.customContentRenderId+=1:this.isRendering=!0,this.renderRunner.request(),e&&this.updateSize()}destroy(){this.isRendering&&(this.isRendering=!1,this.renderRunner.request())}updateSize(){On(()=>{super.updateSize()})}batchRendering(e){this.renderRunner.pause("batchRendering"),e(),this.renderRunner.resume("batchRendering")}pauseRendering(){this.renderRunner.pause("pauseRendering")}resumeRendering(){this.renderRunner.resume("pauseRendering",!0)}resetOptions(e,t){this.currentDataManager.resetOptions(e,t)}setClassNames(e){if(!Ne(e,this.currentClassNames)){let{classList:t}=this.el;for(let e of this.currentClassNames)t.remove(e);for(let n of e)t.add(n);this.currentClassNames=e}}setHeight(e){qe(this.el,"height",e)}},e.Draggable=class{constructor(e,t={}){this.handlePointerDown=e=>{let{dragging:t}=this,{minDistance:n,longPressDelay:r}=this.settings;t.minDistance=null!=n?n:e.isTouch?0:Dn.eventDragMinDistance,t.delay=e.isTouch?null!=r?r:Dn.longPressDelay:0},this.handleDragStart=e=>{e.isTouch&&this.dragging.delay&&e.subjectEl.classList.contains("fc-event")&&this.dragging.mirror.getMirrorEl().classList.add("fc-event-selected")},this.settings=t;let n=this.dragging=new Nl(e);n.touchScrollAllowed=!1,null!=t.itemSelector&&(n.pointer.selector=t.itemSelector),null!=t.appendTo&&(n.mirror.parentNode=t.appendTo),n.emitter.on("pointerdown",this.handlePointerDown),n.emitter.on("dragstart",this.handleDragStart),new Gl(n,t.eventData)}destroy(){this.dragging.destroy()}},e.Internal=So,e.JsonRequestError=yi,e.ThirdPartyDraggable=class{constructor(e,t){let n=document;e===document||e instanceof Element?(n=e,t=t||{}):t=e||{};let r=this.dragging=new Fl(n);"string"==typeof t.itemSelector?r.pointer.selector=t.itemSelector:n===document&&(r.pointer.selector="[data-event]"),"string"==typeof t.mirrorSelector&&(r.mirrorSelector=t.mirrorSelector),new Gl(r,t.eventData)}destroy(){this.dragging.destroy()}},e.createPlugin=xo,e.formatDate=function(e,t={}){let n=Cl(t),r=Cn(t),i=n.createMarkerMeta(e);return i?n.format(i.marker,r,{forcedTzo:i.forcedTzo}):""},e.formatRange=function(e,t,n){let r=Cl("object"==typeof n&&n?n:{}),i=Cn(n),s=r.createMarkerMeta(e),o=r.createMarkerMeta(t);return s&&o?r.formatRange(s.marker,o.marker,i,{forcedStartTzo:s.forcedTzo,forcedEndTzo:o.forcedTzo,isEndExclusive:n.isEndExclusive,defaultSeparator:Dn.defaultRangeSeparator}):""},e.globalLocales=Eo,e.globalPlugins=el,e.sliceEvents=function(e,t){return Xr(e.eventStore,e.eventUiBases,e.dateProfile.activeRange,t?e.nextDayThreshold:null).fg},e.version="6.0.2",Object.defineProperty(e,"__esModule",{value:!0}),e}({}); \ No newline at end of file diff --git a/static_common/common/vendor/fullcalendar-scheduler/locales/de.js b/static_common/common/vendor/fullcalendar-scheduler/locales/de.js index a03d5451..b3ed7129 100644 --- a/static_common/common/vendor/fullcalendar-scheduler/locales/de.js +++ b/static_common/common/vendor/fullcalendar-scheduler/locales/de.js @@ -1,30 +1,69 @@ -FullCalendar.globalLocales.push(function () { - 'use strict'; +/*! +FullCalendar Core v6.0.2 +Docs & License: https://fullcalendar.io +(c) 2022 Adam Shaw +*/ +(function (index_js) { + 'use strict'; - var de = { - code: 'de', - week: { - dow: 1, // Monday is the first day of the week. - doy: 4, // The week that contains Jan 4th is the first week of the year. - }, - buttonText: { - prev: 'Zurück', - next: 'Vor', - today: 'Heute', - year: 'Jahr', - month: 'Monat', - week: 'Woche', - day: 'Tag', - list: 'Terminübersicht', - }, - weekText: 'KW', - allDayText: 'Ganztägig', - moreLinkText: function(n) { - return '+ weitere ' + n - }, - noEventsText: 'Keine Ereignisse anzuzeigen', - }; + function affix(buttonText) { + return (buttonText === 'Tag' || buttonText === 'Monat') ? 'r' : + buttonText === 'Jahr' ? 's' : ''; + } + var locale = { + code: 'de', + week: { + dow: 1, + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: 'Zurück', + next: 'Vor', + today: 'Heute', + year: 'Jahr', + month: 'Monat', + week: 'Woche', + day: 'Tag', + list: 'Terminübersicht', + }, + weekText: 'KW', + weekTextLong: 'Woche', + allDayText: 'Ganztägig', + moreLinkText(n) { + return '+ weitere ' + n; + }, + noEventsText: 'Keine Ereignisse anzuzeigen', + buttonHints: { + prev(buttonText) { + return `Vorherige${affix(buttonText)} ${buttonText}`; + }, + next(buttonText) { + return `Nächste${affix(buttonText)} ${buttonText}`; + }, + today(buttonText) { + // → Heute, Diese Woche, Dieser Monat, Dieses Jahr + if (buttonText === 'Tag') { + return 'Heute'; + } + return `Diese${affix(buttonText)} ${buttonText}`; + }, + }, + viewHint(buttonText) { + // → Tagesansicht, Wochenansicht, Monatsansicht, Jahresansicht + const glue = buttonText === 'Woche' ? 'n' : buttonText === 'Monat' ? 's' : 'es'; + return buttonText + glue + 'ansicht'; + }, + navLinkHint: 'Gehe zu $0', + moreLinkHint(eventCnt) { + return 'Zeige ' + (eventCnt === 1 ? + 'ein weiteres Ereignis' : + eventCnt + ' weitere Ereignisse'); + }, + closeHint: 'Schließen', + timeHint: 'Uhrzeit', + eventHint: 'Ereignis', + }; - return de; + index_js.globalLocales.push(locale); -}()); +})(FullCalendar); diff --git a/static_common/common/vendor/fullcalendar-scheduler/locales/de.min.js b/static_common/common/vendor/fullcalendar-scheduler/locales/de.min.js new file mode 100644 index 00000000..35b55cca --- /dev/null +++ b/static_common/common/vendor/fullcalendar-scheduler/locales/de.min.js @@ -0,0 +1,6 @@ +/*! +FullCalendar Core v6.0.2 +Docs & License: https://fullcalendar.io +(c) 2022 Adam Shaw +*/ +!function(e){"use strict";function t(e){return"Tag"===e||"Monat"===e?"r":"Jahr"===e?"s":""}var n={code:"de",week:{dow:1,doy:4},buttonText:{prev:"Zurück",next:"Vor",today:"Heute",year:"Jahr",month:"Monat",week:"Woche",day:"Tag",list:"Terminübersicht"},weekText:"KW",weekTextLong:"Woche",allDayText:"Ganztägig",moreLinkText:e=>"+ weitere "+e,noEventsText:"Keine Ereignisse anzuzeigen",buttonHints:{prev:e=>`Vorherige${t(e)} ${e}`,next:e=>`Nächste${t(e)} ${e}`,today:e=>"Tag"===e?"Heute":`Diese${t(e)} ${e}`},viewHint:e=>e+("Woche"===e?"n":"Monat"===e?"s":"es")+"ansicht",navLinkHint:"Gehe zu $0",moreLinkHint:e=>"Zeige "+(1===e?"ein weiteres Ereignis":e+" weitere Ereignisse"),closeHint:"Schließen",timeHint:"Uhrzeit",eventHint:"Ereignis"};FullCalendar.globalLocales.push(n)}(); \ No newline at end of file diff --git a/static_common/common/vendor/fullcalendar-scheduler/main.css b/static_common/common/vendor/fullcalendar-scheduler/main.css deleted file mode 100644 index 89692d34..00000000 --- a/static_common/common/vendor/fullcalendar-scheduler/main.css +++ /dev/null @@ -1,1756 +0,0 @@ - -/* classes attached to <body> */ - -.fc-not-allowed, -.fc-not-allowed .fc-event { /* override events' custom cursors */ - cursor: not-allowed; -} - -.fc-unselectable { - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - -webkit-touch-callout: none; - -webkit-tap-highlight-color: rgba(0, 0, 0, 0); -} -.fc { - /* layout of immediate children */ - display: flex; - flex-direction: column; - - font-size: 1em -} -.fc, - .fc *, - .fc *:before, - .fc *:after { - box-sizing: border-box; - } -.fc table { - border-collapse: collapse; - border-spacing: 0; - font-size: 1em; /* normalize cross-browser */ - } -.fc th { - text-align: center; - } -.fc th, - .fc td { - vertical-align: top; - padding: 0; - } -.fc a[data-navlink] { - cursor: pointer; - } -.fc a[data-navlink]:hover { - text-decoration: underline; - } -.fc-direction-ltr { - direction: ltr; - text-align: left; -} -.fc-direction-rtl { - direction: rtl; - text-align: right; -} -.fc-theme-standard td, - .fc-theme-standard th { - border: 1px solid #ddd; - border: 1px solid var(--fc-border-color, #ddd); - } -/* for FF, which doesn't expand a 100% div within a table cell. use absolute positioning */ -/* inner-wrappers are responsible for being absolute */ -/* TODO: best place for this? */ -.fc-liquid-hack td, - .fc-liquid-hack th { - position: relative; - } - -@font-face { - font-family: 'fcicons'; - src: url("data:application/x-font-ttf;charset=utf-8;base64,AAEAAAALAIAAAwAwT1MvMg8SBfAAAAC8AAAAYGNtYXAXVtKNAAABHAAAAFRnYXNwAAAAEAAAAXAAAAAIZ2x5ZgYydxIAAAF4AAAFNGhlYWQUJ7cIAAAGrAAAADZoaGVhB20DzAAABuQAAAAkaG10eCIABhQAAAcIAAAALGxvY2ED4AU6AAAHNAAAABhtYXhwAA8AjAAAB0wAAAAgbmFtZXsr690AAAdsAAABhnBvc3QAAwAAAAAI9AAAACAAAwPAAZAABQAAApkCzAAAAI8CmQLMAAAB6wAzAQkAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAAADpBgPA/8AAQAPAAEAAAAABAAAAAAAAAAAAAAAgAAAAAAADAAAAAwAAABwAAQADAAAAHAADAAEAAAAcAAQAOAAAAAoACAACAAIAAQAg6Qb//f//AAAAAAAg6QD//f//AAH/4xcEAAMAAQAAAAAAAAAAAAAAAQAB//8ADwABAAAAAAAAAAAAAgAANzkBAAAAAAEAAAAAAAAAAAACAAA3OQEAAAAAAQAAAAAAAAAAAAIAADc5AQAAAAABAWIAjQKeAskAEwAAJSc3NjQnJiIHAQYUFwEWMjc2NCcCnuLiDQ0MJAz/AA0NAQAMJAwNDcni4gwjDQwM/wANIwz/AA0NDCMNAAAAAQFiAI0CngLJABMAACUBNjQnASYiBwYUHwEHBhQXFjI3AZ4BAA0N/wAMJAwNDeLiDQ0MJAyNAQAMIw0BAAwMDSMM4uINIwwNDQAAAAIA4gC3Ax4CngATACcAACUnNzY0JyYiDwEGFB8BFjI3NjQnISc3NjQnJiIPAQYUHwEWMjc2NCcB87e3DQ0MIw3VDQ3VDSMMDQ0BK7e3DQ0MJAzVDQ3VDCQMDQ3zuLcMJAwNDdUNIwzWDAwNIwy4twwkDA0N1Q0jDNYMDA0jDAAAAgDiALcDHgKeABMAJwAAJTc2NC8BJiIHBhQfAQcGFBcWMjchNzY0LwEmIgcGFB8BBwYUFxYyNwJJ1Q0N1Q0jDA0Nt7cNDQwjDf7V1Q0N1QwkDA0Nt7cNDQwkDLfWDCMN1Q0NDCQMt7gMIw0MDNYMIw3VDQ0MJAy3uAwjDQwMAAADAFUAAAOrA1UAMwBoAHcAABMiBgcOAQcOAQcOARURFBYXHgEXHgEXHgEzITI2Nz4BNz4BNz4BNRE0JicuAScuAScuASMFITIWFx4BFx4BFx4BFREUBgcOAQcOAQcOASMhIiYnLgEnLgEnLgE1ETQ2Nz4BNz4BNz4BMxMhMjY1NCYjISIGFRQWM9UNGAwLFQkJDgUFBQUFBQ4JCRULDBgNAlYNGAwLFQkJDgUFBQUFBQ4JCRULDBgN/aoCVgQIBAQHAwMFAQIBAQIBBQMDBwQECAT9qgQIBAQHAwMFAQIBAQIBBQMDBwQECASAAVYRGRkR/qoRGRkRA1UFBAUOCQkVDAsZDf2rDRkLDBUJCA4FBQUFBQUOCQgVDAsZDQJVDRkLDBUJCQ4FBAVVAgECBQMCBwQECAX9qwQJAwQHAwMFAQICAgIBBQMDBwQDCQQCVQUIBAQHAgMFAgEC/oAZEhEZGRESGQAAAAADAFUAAAOrA1UAMwBoAIkAABMiBgcOAQcOAQcOARURFBYXHgEXHgEXHgEzITI2Nz4BNz4BNz4BNRE0JicuAScuAScuASMFITIWFx4BFx4BFx4BFREUBgcOAQcOAQcOASMhIiYnLgEnLgEnLgE1ETQ2Nz4BNz4BNz4BMxMzFRQWMzI2PQEzMjY1NCYrATU0JiMiBh0BIyIGFRQWM9UNGAwLFQkJDgUFBQUFBQ4JCRULDBgNAlYNGAwLFQkJDgUFBQUFBQ4JCRULDBgN/aoCVgQIBAQHAwMFAQIBAQIBBQMDBwQECAT9qgQIBAQHAwMFAQIBAQIBBQMDBwQECASAgBkSEhmAERkZEYAZEhIZgBEZGREDVQUEBQ4JCRUMCxkN/asNGQsMFQkIDgUFBQUFBQ4JCBUMCxkNAlUNGQsMFQkJDgUEBVUCAQIFAwIHBAQIBf2rBAkDBAcDAwUBAgICAgEFAwMHBAMJBAJVBQgEBAcCAwUCAQL+gIASGRkSgBkSERmAEhkZEoAZERIZAAABAOIAjQMeAskAIAAAExcHBhQXFjI/ARcWMjc2NC8BNzY0JyYiDwEnJiIHBhQX4uLiDQ0MJAzi4gwkDA0N4uINDQwkDOLiDCQMDQ0CjeLiDSMMDQ3h4Q0NDCMN4uIMIw0MDOLiDAwNIwwAAAABAAAAAQAAa5n0y18PPPUACwQAAAAAANivOVsAAAAA2K85WwAAAAADqwNVAAAACAACAAAAAAAAAAEAAAPA/8AAAAQAAAAAAAOrAAEAAAAAAAAAAAAAAAAAAAALBAAAAAAAAAAAAAAAAgAAAAQAAWIEAAFiBAAA4gQAAOIEAABVBAAAVQQAAOIAAAAAAAoAFAAeAEQAagCqAOoBngJkApoAAQAAAAsAigADAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAA4ArgABAAAAAAABAAcAAAABAAAAAAACAAcAYAABAAAAAAADAAcANgABAAAAAAAEAAcAdQABAAAAAAAFAAsAFQABAAAAAAAGAAcASwABAAAAAAAKABoAigADAAEECQABAA4ABwADAAEECQACAA4AZwADAAEECQADAA4APQADAAEECQAEAA4AfAADAAEECQAFABYAIAADAAEECQAGAA4AUgADAAEECQAKADQApGZjaWNvbnMAZgBjAGkAYwBvAG4Ac1ZlcnNpb24gMS4wAFYAZQByAHMAaQBvAG4AIAAxAC4AMGZjaWNvbnMAZgBjAGkAYwBvAG4Ac2ZjaWNvbnMAZgBjAGkAYwBvAG4Ac1JlZ3VsYXIAUgBlAGcAdQBsAGEAcmZjaWNvbnMAZgBjAGkAYwBvAG4Ac0ZvbnQgZ2VuZXJhdGVkIGJ5IEljb01vb24uAEYAbwBuAHQAIABnAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAEkAYwBvAE0AbwBvAG4ALgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=") format('truetype'); - font-weight: normal; - font-style: normal; -} - -.fc-icon { - /* added for fc */ - display: inline-block; - width: 1em; - height: 1em; - text-align: center; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - - /* use !important to prevent issues with browser extensions that change fonts */ - font-family: 'fcicons' !important; - speak: none; - font-style: normal; - font-weight: normal; - font-variant: normal; - text-transform: none; - line-height: 1; - - /* Better Font Rendering =========== */ - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -.fc-icon-chevron-left:before { - content: "\e900"; -} - -.fc-icon-chevron-right:before { - content: "\e901"; -} - -.fc-icon-chevrons-left:before { - content: "\e902"; -} - -.fc-icon-chevrons-right:before { - content: "\e903"; -} - -.fc-icon-minus-square:before { - content: "\e904"; -} - -.fc-icon-plus-square:before { - content: "\e905"; -} - -.fc-icon-x:before { - content: "\e906"; -} -/* -Lots taken from Flatly (MIT): https://bootswatch.com/4/flatly/bootstrap.css - -These styles only apply when the standard-theme is activated. -When it's NOT activated, the fc-button classes won't even be in the DOM. -*/ -.fc { - - /* reset */ - -} -.fc .fc-button { - border-radius: 0; - overflow: visible; - text-transform: none; - margin: 0; - font-family: inherit; - font-size: inherit; - line-height: inherit; - } -.fc .fc-button:focus { - outline: 1px dotted; - outline: 5px auto -webkit-focus-ring-color; - } -.fc .fc-button { - -webkit-appearance: button; - } -.fc .fc-button:not(:disabled) { - cursor: pointer; - } -.fc .fc-button::-moz-focus-inner { - padding: 0; - border-style: none; - } -.fc { - - /* theme */ - -} -.fc .fc-button { - display: inline-block; - font-weight: 400; - text-align: center; - vertical-align: middle; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - background-color: transparent; - border: 1px solid transparent; - padding: 0.4em 0.65em; - font-size: 1em; - line-height: 1.5; - border-radius: 0.25em; - } -.fc .fc-button:hover { - text-decoration: none; - } -.fc .fc-button:focus { - outline: 0; - box-shadow: 0 0 0 0.2rem rgba(44, 62, 80, 0.25); - } -.fc .fc-button:disabled { - opacity: 0.65; - } -.fc { - - /* "primary" coloring */ - -} -.fc .fc-button-primary { - color: #fff; - color: var(--fc-button-text-color, #fff); - background-color: #2C3E50; - background-color: var(--fc-button-bg-color, #2C3E50); - border-color: #2C3E50; - border-color: var(--fc-button-border-color, #2C3E50); - } -.fc .fc-button-primary:hover { - color: #fff; - color: var(--fc-button-text-color, #fff); - background-color: #1e2b37; - background-color: var(--fc-button-hover-bg-color, #1e2b37); - border-color: #1a252f; - border-color: var(--fc-button-hover-border-color, #1a252f); - } -.fc .fc-button-primary:disabled { /* not DRY */ - color: #fff; - color: var(--fc-button-text-color, #fff); - background-color: #2C3E50; - background-color: var(--fc-button-bg-color, #2C3E50); - border-color: #2C3E50; - border-color: var(--fc-button-border-color, #2C3E50); /* overrides :hover */ - } -.fc .fc-button-primary:focus { - box-shadow: 0 0 0 0.2rem rgba(76, 91, 106, 0.5); - } -.fc .fc-button-primary:not(:disabled):active, - .fc .fc-button-primary:not(:disabled).fc-button-active { - color: #fff; - color: var(--fc-button-text-color, #fff); - background-color: #1a252f; - background-color: var(--fc-button-active-bg-color, #1a252f); - border-color: #151e27; - border-color: var(--fc-button-active-border-color, #151e27); - } -.fc .fc-button-primary:not(:disabled):active:focus, - .fc .fc-button-primary:not(:disabled).fc-button-active:focus { - box-shadow: 0 0 0 0.2rem rgba(76, 91, 106, 0.5); - } -.fc { - - /* icons within buttons */ - -} -.fc .fc-button .fc-icon { - vertical-align: middle; - font-size: 1.5em; /* bump up the size (but don't make it bigger than line-height of button, which is 1.5em also) */ - } -.fc .fc-button-group { - position: relative; - display: inline-flex; - vertical-align: middle; - } -.fc .fc-button-group > .fc-button { - position: relative; - flex: 1 1 auto; - } -.fc .fc-button-group > .fc-button:hover { - z-index: 1; - } -.fc .fc-button-group > .fc-button:focus, - .fc .fc-button-group > .fc-button:active, - .fc .fc-button-group > .fc-button.fc-button-active { - z-index: 1; - } -.fc-direction-ltr .fc-button-group > .fc-button:not(:first-child) { - margin-left: -1px; - border-top-left-radius: 0; - border-bottom-left-radius: 0; - } -.fc-direction-ltr .fc-button-group > .fc-button:not(:last-child) { - border-top-right-radius: 0; - border-bottom-right-radius: 0; - } -.fc-direction-rtl .fc-button-group > .fc-button:not(:first-child) { - margin-right: -1px; - border-top-right-radius: 0; - border-bottom-right-radius: 0; - } -.fc-direction-rtl .fc-button-group > .fc-button:not(:last-child) { - border-top-left-radius: 0; - border-bottom-left-radius: 0; - } -.fc .fc-toolbar { - display: flex; - justify-content: space-between; - align-items: center; - } -.fc .fc-toolbar.fc-header-toolbar { - margin-bottom: 1.5em; - } -.fc .fc-toolbar.fc-footer-toolbar { - margin-top: 1.5em; - } -.fc .fc-toolbar-title { - font-size: 1.75em; - margin: 0; - } -.fc-direction-ltr .fc-toolbar > * > :not(:first-child) { - margin-left: .75em; /* space between */ - } -.fc-direction-rtl .fc-toolbar > * > :not(:first-child) { - margin-right: .75em; /* space between */ - } -.fc-direction-rtl .fc-toolbar-ltr { /* when the toolbar-chunk positioning system is explicitly left-to-right */ - flex-direction: row-reverse; - } -.fc .fc-scroller { - -webkit-overflow-scrolling: touch; - position: relative; /* for abs-positioned elements within */ - } -.fc .fc-scroller-liquid { - height: 100%; - } -.fc .fc-scroller-liquid-absolute { - position: absolute; - top: 0; - right: 0; - left: 0; - bottom: 0; - } -.fc .fc-scroller-harness { - position: relative; - overflow: hidden; - direction: ltr; - /* hack for chrome computing the scroller's right/left wrong for rtl. undone below... */ - /* TODO: demonstrate in codepen */ - } -.fc .fc-scroller-harness-liquid { - height: 100%; - } -.fc-direction-rtl .fc-scroller-harness > .fc-scroller { /* undo above hack */ - direction: rtl; - } -.fc-theme-standard .fc-scrollgrid { - border: 1px solid #ddd; - border: 1px solid var(--fc-border-color, #ddd); /* bootstrap does this. match */ - } -.fc .fc-scrollgrid, - .fc .fc-scrollgrid table { /* all tables (self included) */ - width: 100%; /* because tables don't normally do this */ - table-layout: fixed; - } -.fc .fc-scrollgrid table { /* inner tables */ - border-top-style: hidden; - border-left-style: hidden; - border-right-style: hidden; - } -.fc .fc-scrollgrid { - - border-collapse: separate; - border-right-width: 0; - border-bottom-width: 0; - - } -.fc .fc-scrollgrid-liquid { - height: 100%; - } -.fc .fc-scrollgrid-section { /* a <tr> */ - height: 1px /* better than 0, for firefox */ - - } -.fc .fc-scrollgrid-section > td { - height: 1px; /* needs a height so inner div within grow. better than 0, for firefox */ - } -.fc .fc-scrollgrid-section table { - height: 1px; - /* for most browsers, if a height isn't set on the table, can't do liquid-height within cells */ - /* serves as a min-height. harmless */ - } -.fc .fc-scrollgrid-section-liquid { - height: auto - - } -.fc .fc-scrollgrid-section-liquid > td { - height: 100%; /* better than `auto`, for firefox */ - } -.fc .fc-scrollgrid-section > * { - border-top-width: 0; - border-left-width: 0; - } -.fc .fc-scrollgrid-section-header > *, - .fc .fc-scrollgrid-section-footer > * { - border-bottom-width: 0; - } -.fc .fc-scrollgrid-section-body table, - .fc .fc-scrollgrid-section-footer table { - border-bottom-style: hidden; /* head keeps its bottom border tho */ - } -.fc { - - /* stickiness */ - -} -.fc .fc-scrollgrid-section-sticky > * { - background: #fff; - background: var(--fc-page-bg-color, #fff); - position: -webkit-sticky; - position: sticky; - z-index: 2; /* TODO: var */ - /* TODO: box-shadow when sticking */ - } -.fc .fc-scrollgrid-section-header.fc-scrollgrid-section-sticky > * { - top: 0; /* because border-sharing causes a gap at the top */ - /* TODO: give safari -1. has bug */ - } -.fc .fc-scrollgrid-section-footer.fc-scrollgrid-section-sticky > * { - bottom: 0; /* known bug: bottom-stickiness doesn't work in safari */ - } -.fc .fc-scrollgrid-sticky-shim { /* for horizontal scrollbar */ - height: 1px; /* needs height to create scrollbars */ - margin-bottom: -1px; - } -.fc-sticky { /* no .fc wrap because used as child of body */ - position: -webkit-sticky; - position: sticky; -} -.fc .fc-view-harness { - flex-grow: 1; /* because this harness is WITHIN the .fc's flexbox */ - position: relative; - } -.fc { - - /* when the harness controls the height, make the view liquid */ - -} -.fc .fc-view-harness-active > .fc-view { - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - } -.fc .fc-col-header-cell-cushion { - display: inline-block; /* x-browser for when sticky (when multi-tier header) */ - padding: 2px 4px; - } -.fc .fc-bg-event, - .fc .fc-non-business, - .fc .fc-highlight { - /* will always have a harness with position:relative/absolute, so absolutely expand */ - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - } -.fc .fc-non-business { - background: rgba(215, 215, 215, 0.3); - background: var(--fc-non-business-color, rgba(215, 215, 215, 0.3)); - } -.fc .fc-bg-event { - background: rgb(143, 223, 130); - background: var(--fc-bg-event-color, rgb(143, 223, 130)); - opacity: 0.3; - opacity: var(--fc-bg-event-opacity, 0.3) - } -.fc .fc-bg-event .fc-event-title { - margin: .5em; - font-size: .85em; - font-size: var(--fc-small-font-size, .85em); - font-style: italic; - } -.fc .fc-highlight { - background: rgba(188, 232, 241, 0.3); - background: var(--fc-highlight-color, rgba(188, 232, 241, 0.3)); - } -.fc .fc-cell-shaded, - .fc .fc-day-disabled { - background: rgba(208, 208, 208, 0.3); - background: var(--fc-neutral-bg-color, rgba(208, 208, 208, 0.3)); - } -/* link resets */ -/* ---------------------------------------------------------------------------------------------------- */ -a.fc-event, -a.fc-event:hover { - text-decoration: none; -} -/* cursor */ -.fc-event[href], -.fc-event.fc-event-draggable { - cursor: pointer; -} -/* event text content */ -/* ---------------------------------------------------------------------------------------------------- */ -.fc-event .fc-event-main { - position: relative; - z-index: 2; - } -/* dragging */ -/* ---------------------------------------------------------------------------------------------------- */ -.fc-event-dragging:not(.fc-event-selected) { /* MOUSE */ - opacity: 0.75; - } -.fc-event-dragging.fc-event-selected { /* TOUCH */ - box-shadow: 0 2px 7px rgba(0, 0, 0, 0.3); - } -/* resizing */ -/* ---------------------------------------------------------------------------------------------------- */ -/* (subclasses should hone positioning for touch and non-touch) */ -.fc-event .fc-event-resizer { - display: none; - position: absolute; - z-index: 4; - } -.fc-event:hover, /* MOUSE */ -.fc-event-selected { /* TOUCH */ - -} -.fc-event:hover .fc-event-resizer, .fc-event-selected .fc-event-resizer { - display: block; - } -.fc-event-selected .fc-event-resizer { - border-radius: 4px; - border-radius: calc(var(--fc-event-resizer-dot-total-width, 8px) / 2); - border-width: 1px; - border-width: var(--fc-event-resizer-dot-border-width, 1px); - width: 8px; - width: var(--fc-event-resizer-dot-total-width, 8px); - height: 8px; - height: var(--fc-event-resizer-dot-total-width, 8px); - border-style: solid; - border-color: inherit; - background: #fff; - background: var(--fc-page-bg-color, #fff) - - /* expand hit area */ - - } -.fc-event-selected .fc-event-resizer:before { - content: ''; - position: absolute; - top: -20px; - left: -20px; - right: -20px; - bottom: -20px; - } -/* selecting (always TOUCH) */ -/* ---------------------------------------------------------------------------------------------------- */ -.fc-event-selected { - box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2) - - /* expand hit area (subclasses should expand) */ - -} -.fc-event-selected:before { - content: ""; - position: absolute; - z-index: 3; - top: 0; - left: 0; - right: 0; - bottom: 0; - } -.fc-event-selected { - - /* dimmer effect */ - -} -.fc-event-selected:after { - content: ""; - background: rgba(0, 0, 0, 0.25); - background: var(--fc-event-selected-overlay-color, rgba(0, 0, 0, 0.25)); - position: absolute; - z-index: 1; - - /* assume there's a border on all sides. overcome it. */ - /* sometimes there's NOT a border, in which case the dimmer will go over */ - /* an adjacent border, which looks fine. */ - top: -1px; - left: -1px; - right: -1px; - bottom: -1px; - } -/* -A HORIZONTAL event -*/ -.fc-h-event { /* allowed to be top-level */ - display: block; - border: 1px solid #3788d8; - border: 1px solid var(--fc-event-border-color, #3788d8); - background-color: #3788d8; - background-color: var(--fc-event-bg-color, #3788d8) - -} -.fc-h-event .fc-event-main { - color: #fff; - color: var(--fc-event-text-color, #fff); - } -.fc-h-event .fc-event-main-frame { - display: flex; /* for make fc-event-title-container expand */ - } -.fc-h-event .fc-event-time { - max-width: 100%; /* clip overflow on this element */ - overflow: hidden; - } -.fc-h-event .fc-event-title-container { /* serves as a container for the sticky cushion */ - flex-grow: 1; - flex-shrink: 1; - min-width: 0; /* important for allowing to shrink all the way */ - } -.fc-h-event .fc-event-title { - display: inline-block; /* need this to be sticky cross-browser */ - vertical-align: top; /* for not messing up line-height */ - left: 0; /* for sticky */ - right: 0; /* for sticky */ - max-width: 100%; /* clip overflow on this element */ - overflow: hidden; - } -.fc-h-event.fc-event-selected:before { - /* expand hit area */ - top: -10px; - bottom: -10px; - } -/* adjust border and border-radius (if there is any) for non-start/end */ -.fc-direction-ltr .fc-daygrid-block-event:not(.fc-event-start), -.fc-direction-rtl .fc-daygrid-block-event:not(.fc-event-end) { - border-top-left-radius: 0; - border-bottom-left-radius: 0; - border-left-width: 0; -} -.fc-direction-ltr .fc-daygrid-block-event:not(.fc-event-end), -.fc-direction-rtl .fc-daygrid-block-event:not(.fc-event-start) { - border-top-right-radius: 0; - border-bottom-right-radius: 0; - border-right-width: 0; -} -/* resizers */ -.fc-h-event:not(.fc-event-selected) .fc-event-resizer { - top: 0; - bottom: 0; - width: 8px; - width: var(--fc-event-resizer-thickness, 8px); -} -.fc-direction-ltr .fc-h-event:not(.fc-event-selected) .fc-event-resizer-start, -.fc-direction-rtl .fc-h-event:not(.fc-event-selected) .fc-event-resizer-end { - cursor: w-resize; - left: -4px; - left: calc(var(--fc-event-resizer-thickness, 8px) / -2); -} -.fc-direction-ltr .fc-h-event:not(.fc-event-selected) .fc-event-resizer-end, -.fc-direction-rtl .fc-h-event:not(.fc-event-selected) .fc-event-resizer-start { - cursor: e-resize; - right: -4px; - right: calc(var(--fc-event-resizer-thickness, 8px) / -2); -} -/* resizers for TOUCH */ -.fc-h-event.fc-event-selected .fc-event-resizer { - top: 50%; - margin-top: -4px; - margin-top: calc(var(--fc-event-resizer-dot-total-width, 8px) / -2); -} -.fc-direction-ltr .fc-h-event.fc-event-selected .fc-event-resizer-start, -.fc-direction-rtl .fc-h-event.fc-event-selected .fc-event-resizer-end { - left: -4px; - left: calc(var(--fc-event-resizer-dot-total-width, 8px) / -2); -} -.fc-direction-ltr .fc-h-event.fc-event-selected .fc-event-resizer-end, -.fc-direction-rtl .fc-h-event.fc-event-selected .fc-event-resizer-start { - right: -4px; - right: calc(var(--fc-event-resizer-dot-total-width, 8px) / -2); -} - - -:root { - --fc-daygrid-event-dot-width: 8px; -} -.fc .fc-popover { - position: fixed; - top: 0; /* for when not positioned yet */ - box-shadow: 0 2px 6px rgba(0,0,0,.15); - } -.fc .fc-popover-header { - display: flex; - flex-direction: row; - justify-content: space-between; - align-items: center; - padding: 3px 4px; - } -.fc .fc-popover-title { - margin: 0 2px; - } -.fc .fc-popover-close { - cursor: pointer; - opacity: 0.65; - font-size: 1.1em; - } -.fc-theme-standard .fc-popover { - border: 1px solid #ddd; - border: 1px solid var(--fc-border-color, #ddd); - background: #fff; - background: var(--fc-page-bg-color, #fff); - } -.fc-theme-standard .fc-popover-header { - background: rgba(208, 208, 208, 0.3); - background: var(--fc-neutral-bg-color, rgba(208, 208, 208, 0.3)); - } -/* help things clear margins of inner content */ -.fc-daygrid-day-frame, -.fc-daygrid-day-events, -.fc-daygrid-event-harness { /* for event top/bottom margins */ -} -.fc-daygrid-day-frame:before, .fc-daygrid-day-events:before, .fc-daygrid-event-harness:before { - content: ""; - clear: both; - display: table; } -.fc-daygrid-day-frame:after, .fc-daygrid-day-events:after, .fc-daygrid-event-harness:after { - content: ""; - clear: both; - display: table; } -.fc .fc-daygrid-body { /* a <div> that wraps the table */ - position: relative; - z-index: 1; /* container inner z-index's because <tr>s can't do it */ - } -.fc .fc-daygrid-day.fc-day-today { - background-color: rgba(255, 220, 40, 0.15); - background-color: var(--fc-today-bg-color, rgba(255, 220, 40, 0.15)); - } -.fc .fc-daygrid-day-frame { - position: relative; - min-height: 100%; /* seems to work better than `height` because sets height after rows/cells naturally do it */ - } -.fc { - - /* cell top */ - -} -.fc .fc-daygrid-day-top { - display: flex; - flex-direction: row-reverse; - } -.fc .fc-day-other .fc-daygrid-day-top { - opacity: 0.3; - } -.fc { - - /* day number (within cell top) */ - -} -.fc .fc-daygrid-day-number { - position: relative; - z-index: 4; - padding: 4px; - } -.fc { - - /* event container */ - -} -.fc .fc-daygrid-day-events { - margin-top: 1px; /* needs to be margin, not padding, so that available cell height can be computed */ - } -.fc { - - /* positioning for balanced vs natural */ - -} -.fc .fc-daygrid-body-balanced .fc-daygrid-day-events { - position: absolute; - left: 0; - right: 0; - } -.fc .fc-daygrid-body-unbalanced .fc-daygrid-day-events { - position: relative; /* for containing abs positioned event harnesses */ - min-height: 2em; /* in addition to being a min-height during natural height, equalizes the heights a little bit */ - } -.fc .fc-daygrid-body-natural { /* can coexist with -unbalanced */ - } -.fc .fc-daygrid-body-natural .fc-daygrid-day-events { - margin-bottom: 1em; - } -.fc { - - /* event harness */ - -} -.fc .fc-daygrid-event-harness { - position: relative; - } -.fc .fc-daygrid-event-harness-abs { - position: absolute; - top: 0; /* fallback coords for when cannot yet be computed */ - left: 0; /* */ - right: 0; /* */ - } -.fc .fc-daygrid-bg-harness { - position: absolute; - top: 0; - bottom: 0; - } -.fc { - - /* bg content */ - -} -.fc .fc-daygrid-day-bg .fc-non-business { z-index: 1 } -.fc .fc-daygrid-day-bg .fc-bg-event { z-index: 2 } -.fc .fc-daygrid-day-bg .fc-highlight { z-index: 3 } -.fc { - - /* events */ - -} -.fc .fc-daygrid-event { - z-index: 6; - margin-top: 1px; - } -.fc .fc-daygrid-event.fc-event-mirror { - z-index: 7; - } -.fc { - - /* cell bottom (within day-events) */ - -} -.fc .fc-daygrid-day-bottom { - font-size: .85em; - margin: 2px 3px 0; - } -.fc .fc-daygrid-more-link { - position: relative; - z-index: 4; - cursor: pointer; - } -.fc { - - /* week number (within frame) */ - -} -.fc .fc-daygrid-week-number { - position: absolute; - z-index: 5; - top: 0; - padding: 2px; - min-width: 1.5em; - text-align: center; - background-color: rgba(208, 208, 208, 0.3); - background-color: var(--fc-neutral-bg-color, rgba(208, 208, 208, 0.3)); - color: #808080; - color: var(--fc-neutral-text-color, #808080); - } -.fc { - - /* popover */ - -} -.fc .fc-more-popover { - z-index: 8; - } -.fc .fc-more-popover .fc-popover-body { - min-width: 220px; - padding: 10px; - } -.fc-direction-ltr .fc-daygrid-event.fc-event-start, -.fc-direction-rtl .fc-daygrid-event.fc-event-end { - margin-left: 2px; -} -.fc-direction-ltr .fc-daygrid-event.fc-event-end, -.fc-direction-rtl .fc-daygrid-event.fc-event-start { - margin-right: 2px; -} -.fc-direction-ltr .fc-daygrid-week-number { - left: 0; - border-radius: 0 0 3px 0; - } -.fc-direction-rtl .fc-daygrid-week-number { - right: 0; - border-radius: 0 0 0 3px; - } -.fc-liquid-hack .fc-daygrid-day-frame { - position: static; /* will cause inner absolute stuff to expand to <td> */ - } -.fc-daygrid-event { /* make root-level, because will be dragged-and-dropped outside of a component root */ - position: relative; /* for z-indexes assigned later */ - white-space: nowrap; - border-radius: 3px; /* dot event needs this to when selected */ - font-size: .85em; - font-size: var(--fc-small-font-size, .85em); -} -/* --- the rectangle ("block") style of event --- */ -.fc-daygrid-block-event .fc-event-time { - font-weight: bold; - } -.fc-daygrid-block-event .fc-event-time, - .fc-daygrid-block-event .fc-event-title { - padding: 1px; - } -/* --- the dot style of event --- */ -.fc-daygrid-dot-event { - display: flex; - align-items: center; - padding: 2px 0 - -} -.fc-daygrid-dot-event .fc-event-title { - flex-grow: 1; - flex-shrink: 1; - min-width: 0; /* important for allowing to shrink all the way */ - overflow: hidden; - font-weight: bold; - } -.fc-daygrid-dot-event:hover, - .fc-daygrid-dot-event.fc-event-mirror { - background: rgba(0, 0, 0, 0.1); - } -.fc-daygrid-dot-event.fc-event-selected:before { - /* expand hit area */ - top: -10px; - bottom: -10px; - } -.fc-daygrid-event-dot { /* the actual dot */ - margin: 0 4px; - box-sizing: content-box; - width: 0; - height: 0; - border: 4px solid #3788d8; - border: calc(var(--fc-daygrid-event-dot-width, 8px) / 2) solid var(--fc-event-border-color, #3788d8); - border-radius: 4px; - border-radius: calc(var(--fc-daygrid-event-dot-width, 8px) / 2); -} -/* --- spacing between time and title --- */ -.fc-direction-ltr .fc-daygrid-event .fc-event-time { - margin-right: 3px; - } -.fc-direction-rtl .fc-daygrid-event .fc-event-time { - margin-left: 3px; - } - - -/* -A VERTICAL event -*/ - -.fc-v-event { /* allowed to be top-level */ - display: block; - border: 1px solid #3788d8; - border: 1px solid var(--fc-event-border-color, #3788d8); - background-color: #3788d8; - background-color: var(--fc-event-bg-color, #3788d8) - -} - -.fc-v-event .fc-event-main { - color: #fff; - color: var(--fc-event-text-color, #fff); - height: 100%; - } - -.fc-v-event .fc-event-main-frame { - height: 100%; - display: flex; - flex-direction: column; - } - -.fc-v-event .fc-event-time { - flex-grow: 0; - flex-shrink: 0; - max-height: 100%; - overflow: hidden; - } - -.fc-v-event .fc-event-title-container { /* a container for the sticky cushion */ - flex-grow: 1; - flex-shrink: 1; - min-height: 0; /* important for allowing to shrink all the way */ - } - -.fc-v-event .fc-event-title { /* will have fc-sticky on it */ - top: 0; - bottom: 0; - max-height: 100%; /* clip overflow */ - overflow: hidden; - } - -.fc-v-event:not(.fc-event-start) { - border-top-width: 0; - border-top-left-radius: 0; - border-top-right-radius: 0; - } - -.fc-v-event:not(.fc-event-end) { - border-bottom-width: 0; - border-bottom-left-radius: 0; - border-bottom-right-radius: 0; - } - -.fc-v-event.fc-event-selected:before { - /* expand hit area */ - left: -10px; - right: -10px; - } - -.fc-v-event { - - /* resizer (mouse AND touch) */ - -} - -.fc-v-event .fc-event-resizer-start { - cursor: n-resize; - } - -.fc-v-event .fc-event-resizer-end { - cursor: s-resize; - } - -.fc-v-event { - - /* resizer for MOUSE */ - -} - -.fc-v-event:not(.fc-event-selected) .fc-event-resizer { - height: 8px; - height: var(--fc-event-resizer-thickness, 8px); - left: 0; - right: 0; - } - -.fc-v-event:not(.fc-event-selected) .fc-event-resizer-start { - top: -4px; - top: calc(var(--fc-event-resizer-thickness, 8px) / -2); - } - -.fc-v-event:not(.fc-event-selected) .fc-event-resizer-end { - bottom: -4px; - bottom: calc(var(--fc-event-resizer-thickness, 8px) / -2); - } - -.fc-v-event { - - /* resizer for TOUCH (when event is "selected") */ - -} - -.fc-v-event.fc-event-selected .fc-event-resizer { - left: 50%; - margin-left: -4px; - margin-left: calc(var(--fc-event-resizer-dot-total-width, 8px) / -2); - } - -.fc-v-event.fc-event-selected .fc-event-resizer-start { - top: -4px; - top: calc(var(--fc-event-resizer-dot-total-width, 8px) / -2); - } - -.fc-v-event.fc-event-selected .fc-event-resizer-end { - bottom: -4px; - bottom: calc(var(--fc-event-resizer-dot-total-width, 8px) / -2); - } -.fc .fc-timegrid .fc-daygrid-body { /* the all-day daygrid within the timegrid view */ - z-index: 2; /* put above the timegrid-body so that more-popover is above everything. TODO: better solution */ - } -.fc .fc-timegrid-divider { - padding: 0 0 2px; /* browsers get confused when you set height. use padding instead */ - } -.fc .fc-timegrid-body { - position: relative; - z-index: 1; /* scope the z-indexes of slots and cols */ - min-height: 100%; /* fill height always, even when slat table doesn't grow */ - } -.fc .fc-timegrid-axis-chunk { /* for advanced ScrollGrid */ - position: relative /* offset parent for now-indicator-container */ - - } -.fc .fc-timegrid-axis-chunk > table { - position: relative; - z-index: 1; /* above the now-indicator-container */ - } -.fc .fc-timegrid-slots { - position: relative; - z-index: 1; - } -.fc .fc-timegrid-slot { /* a <td> */ - height: 1.5em; - border-bottom: 0 /* each cell owns its top border */ - } -.fc .fc-timegrid-slot:empty:before { - content: '\00a0'; /* make sure there's at least an empty space to create height for height syncing */ - } -.fc .fc-timegrid-slot-minor { - border-top-style: dotted; - } -.fc .fc-timegrid-slot-label-cushion { - display: inline-block; - white-space: nowrap; - } -.fc .fc-timegrid-slot-label { - vertical-align: middle; /* vertical align the slots */ - } -.fc { - - - /* slots AND axis cells (top-left corner of view including the "all-day" text) */ - -} -.fc .fc-timegrid-axis-cushion, - .fc .fc-timegrid-slot-label-cushion { - padding: 0 4px; - } -.fc { - - - /* axis cells (top-left corner of view including the "all-day" text) */ - /* vertical align is more complicated, uses flexbox */ - -} -.fc .fc-timegrid-axis-frame-liquid { - height: 100%; /* will need liquid-hack in FF */ - } -.fc .fc-timegrid-axis-frame { - overflow: hidden; - display: flex; - align-items: center; /* vertical align */ - justify-content: flex-end; /* horizontal align. matches text-align below */ - } -.fc .fc-timegrid-axis-cushion { - max-width: 60px; /* limits the width of the "all-day" text */ - flex-shrink: 0; /* allows text to expand how it normally would, regardless of constrained width */ - } -.fc-direction-ltr .fc-timegrid-slot-label-frame { - text-align: right; - } -.fc-direction-rtl .fc-timegrid-slot-label-frame { - text-align: left; - } -.fc-liquid-hack .fc-timegrid-axis-frame-liquid { - height: auto; - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - } -.fc .fc-timegrid-col.fc-day-today { - background-color: rgba(255, 220, 40, 0.15); - background-color: var(--fc-today-bg-color, rgba(255, 220, 40, 0.15)); - } -.fc .fc-timegrid-col-frame { - min-height: 100%; /* liquid-hack is below */ - position: relative; - } -.fc-liquid-hack .fc-timegrid-col-frame { - height: auto; - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - } -.fc-media-screen .fc-timegrid-cols { - position: absolute; /* no z-index. children will decide and go above slots */ - top: 0; - left: 0; - right: 0; - bottom: 0 - } -.fc-media-screen .fc-timegrid-cols > table { - height: 100%; - } -.fc-media-screen .fc-timegrid-col-bg, - .fc-media-screen .fc-timegrid-col-events, - .fc-media-screen .fc-timegrid-now-indicator-container { - position: absolute; - top: 0; - left: 0; - right: 0; - } -.fc-media-screen .fc-timegrid-event-harness { - position: absolute; /* top/left/right/bottom will all be set by JS */ - } -.fc { - - /* bg */ - -} -.fc .fc-timegrid-col-bg { - z-index: 2; /* TODO: kill */ - } -.fc .fc-timegrid-col-bg .fc-non-business { z-index: 1 } -.fc .fc-timegrid-col-bg .fc-bg-event { z-index: 2 } -.fc .fc-timegrid-col-bg .fc-highlight { z-index: 3 } -.fc .fc-timegrid-bg-harness { - position: absolute; /* top/bottom will be set by JS */ - left: 0; - right: 0; - } -.fc { - - /* fg events */ - /* (the mirror segs are put into a separate container with same classname, */ - /* and they must be after the normal seg container to appear at a higher z-index) */ - -} -.fc .fc-timegrid-col-events { - z-index: 3; - /* child event segs have z-indexes that are scoped within this div */ - } -.fc { - - /* now indicator */ - -} -.fc .fc-timegrid-now-indicator-container { - bottom: 0; - overflow: hidden; /* don't let overflow of lines/arrows cause unnecessary scrolling */ - /* z-index is set on the individual elements */ - } -.fc-direction-ltr .fc-timegrid-col-events { - margin: 0 2.5% 0 2px; - } -.fc-direction-rtl .fc-timegrid-col-events { - margin: 0 2px 0 2.5%; - } -.fc-timegrid-event-harness-inset .fc-timegrid-event, -.fc-timegrid-event.fc-event-mirror { - box-shadow: 0px 0px 0px 1px #fff; - box-shadow: 0px 0px 0px 1px var(--fc-page-bg-color, #fff); -} -.fc-timegrid-event { /* events need to be root */ - - font-size: .85em; - - font-size: var(--fc-small-font-size, .85em); - border-radius: 3px - -} -.fc-timegrid-event .fc-event-main { - padding: 1px 1px 0; - } -.fc-timegrid-event .fc-event-time { - white-space: nowrap; - font-size: .85em; - font-size: var(--fc-small-font-size, .85em); - margin-bottom: 1px; - } -.fc-timegrid-event-condensed .fc-event-main-frame { - flex-direction: row; - overflow: hidden; - } -.fc-timegrid-event-condensed .fc-event-time:after { - content: '\00a0-\00a0'; /* dash surrounded by non-breaking spaces */ - } -.fc-timegrid-event-condensed .fc-event-title { - font-size: .85em; - font-size: var(--fc-small-font-size, .85em) - } -.fc-media-screen .fc-timegrid-event { - position: absolute; /* absolute WITHIN the harness */ - top: 0; - bottom: 1px; /* stay away from bottom slot line */ - left: 0; - right: 0; - } -.fc { - - /* line */ - -} -.fc .fc-timegrid-now-indicator-line { - position: absolute; - z-index: 4; - left: 0; - right: 0; - border-style: solid; - border-color: red; - border-color: var(--fc-now-indicator-color, red); - border-width: 1px 0 0; - } -.fc { - - /* arrow */ - -} -.fc .fc-timegrid-now-indicator-arrow { - position: absolute; - z-index: 4; - margin-top: -5px; /* vertically center on top coordinate */ - border-style: solid; - border-color: red; - border-color: var(--fc-now-indicator-color, red); - } -.fc-direction-ltr .fc-timegrid-now-indicator-arrow { - left: 0; - - /* triangle pointing right. TODO: mixin */ - border-width: 5px 0 5px 6px; - border-top-color: transparent; - border-bottom-color: transparent; - } -.fc-direction-rtl .fc-timegrid-now-indicator-arrow { - right: 0; - - /* triangle pointing left. TODO: mixin */ - border-width: 5px 6px 5px 0; - border-top-color: transparent; - border-bottom-color: transparent; - } - - -:root { - --fc-list-event-dot-width: 10px; - --fc-list-event-hover-bg-color: #f5f5f5; -} -.fc-theme-standard .fc-list { - border: 1px solid #ddd; - border: 1px solid var(--fc-border-color, #ddd); - } -.fc { - - /* message when no events */ - -} -.fc .fc-list-empty { - background-color: rgba(208, 208, 208, 0.3); - background-color: var(--fc-neutral-bg-color, rgba(208, 208, 208, 0.3)); - height: 100%; - display: flex; - justify-content: center; - align-items: center; /* vertically aligns fc-list-empty-inner */ - } -.fc .fc-list-empty-cushion { - margin: 5em 0; - } -.fc { - - /* table within the scroller */ - /* ---------------------------------------------------------------------------------------------------- */ - -} -.fc .fc-list-table { - width: 100%; - border-style: hidden; /* kill outer border on theme */ - } -.fc .fc-list-table tr > * { - border-left: 0; - border-right: 0; - } -.fc .fc-list-sticky .fc-list-day > * { /* the cells */ - position: -webkit-sticky; - position: sticky; - top: 0; - background: #fff; - background: var(--fc-page-bg-color, #fff); /* for when headers are styled to be transparent and sticky */ - } -.fc .fc-list-table th { - padding: 0; /* uses an inner-wrapper instead... */ - } -.fc .fc-list-table td, - .fc .fc-list-day-cushion { - padding: 8px 14px; - } -.fc { - - - /* date heading rows */ - /* ---------------------------------------------------------------------------------------------------- */ - -} -.fc .fc-list-day-cushion:after { - content: ""; - clear: both; - display: table; /* clear floating */ - } -.fc-theme-standard .fc-list-day-cushion { - background-color: rgba(208, 208, 208, 0.3); - background-color: var(--fc-neutral-bg-color, rgba(208, 208, 208, 0.3)); - } -.fc-direction-ltr .fc-list-day-text, -.fc-direction-rtl .fc-list-day-side-text { - float: left; -} -.fc-direction-ltr .fc-list-day-side-text, -.fc-direction-rtl .fc-list-day-text { - float: right; -} -/* make the dot closer to the event title */ -.fc-direction-ltr .fc-list-table .fc-list-event-graphic { padding-right: 0 } -.fc-direction-rtl .fc-list-table .fc-list-event-graphic { padding-left: 0 } -.fc .fc-list-event.fc-event-forced-url { - cursor: pointer; /* whole row will seem clickable */ - } -.fc .fc-list-event:hover td { - background-color: #f5f5f5; - background-color: var(--fc-list-event-hover-bg-color, #f5f5f5); - } -.fc { - - /* shrink certain cols */ - -} -.fc .fc-list-event-graphic, - .fc .fc-list-event-time { - white-space: nowrap; - width: 1px; - } -.fc .fc-list-event-dot { - display: inline-block; - box-sizing: content-box; - width: 0; - height: 0; - border: 5px solid #3788d8; - border: calc(var(--fc-list-event-dot-width, 10px) / 2) solid var(--fc-event-border-color, #3788d8); - border-radius: 5px; - border-radius: calc(var(--fc-list-event-dot-width, 10px) / 2); - } -.fc { - - /* reset <a> styling */ - -} -.fc .fc-list-event-title a { - color: inherit; - text-decoration: none; - } -.fc { - - /* underline link when hovering over any part of row */ - -} -.fc .fc-list-event.fc-event-forced-url:hover a { - text-decoration: underline; - } - - - - .fc-theme-bootstrap a:not([href]) { - color: inherit; /* natural color for navlinks */ - } - - - - .fc .fc-event, - .fc .fc-scrollgrid table tr { - -moz-column-break-inside: avoid; - break-inside: avoid; - } - -.fc-media-print { - display: block; /* undo flexbox. FF doesn't know how to flow */ - max-width: 100% /* width will be hardcoded too */ -} - -.fc-media-print .fc-timegrid-slots, - .fc-media-print .fc-timegrid-axis-chunk, - .fc-media-print .fc-timeline-slots, - .fc-media-print .fc-non-business, - .fc-media-print .fc-bg-event { - display: none; - } - -.fc-media-print .fc-toolbar button, - .fc-media-print .fc-h-event, - .fc-media-print .fc-v-event { - color: #000 !important; - background: #fff !important; - } - -.fc-media-print .fc-event, - .fc-media-print .fc-event-main { /* often controls the text-color */ - color: #000 !important; - } - -.fc-media-print .fc-timegrid-event { - margin: 0.5em 0; - } - - - - .fc .fc-timeline-body { - min-height: 100%; - position: relative; - z-index: 1; /* scope slots, bg, etc */ - } -/* -vertical slots in both the header AND the body -*/ -.fc .fc-timeline-slots { - position: absolute; - z-index: 1; - top: 0; - bottom: 0 - } -.fc .fc-timeline-slots > table { - height: 100%; - } -.fc { - - /* border for both header AND body cells */ - -} -.fc .fc-timeline-slot-minor { - border-style: dotted; - } -.fc { - - /* header cells (aka "label") */ - -} -.fc .fc-timeline-slot-frame { - display: flex; - align-items: center; /* vertical align */ - justify-content: center; /* horizontal align */ - } -.fc .fc-timeline-header-row-chrono { /* a row of times */ - } -.fc .fc-timeline-header-row-chrono .fc-timeline-slot-frame { - justify-content: flex-start; /* horizontal align left or right */ - } -.fc .fc-timeline-slot-cushion { - padding: 4px 5px; /* TODO: unify with fc-col-header? */ - white-space: nowrap; - } -.fc { - - /* NOTE: how does the top row of cells get horizontally centered? */ - /* for the non-chrono-row, the fc-sticky system looks for text-align center, */ - /* and it's a fluke that the default browser stylesheet already does this for <th> */ - /* TODO: have StickyScrolling look at natural left coord to detect centeredness. */ - -} -/* only owns one side, so can do dotted */ -.fc-direction-ltr .fc-timeline-slot { border-right: 0 !important } -.fc-direction-rtl .fc-timeline-slot { border-left: 0 !important } -.fc .fc-timeline-now-indicator-container { - position: absolute; - z-index: 4; - top: 0; - bottom: 0; - left: 0; - right: 0; - width: 0; - } -.fc .fc-timeline-now-indicator-arrow, - .fc .fc-timeline-now-indicator-line { - position: absolute; - top: 0; - border-style: solid; - border-color: red; - border-color: var(--fc-now-indicator-color, red); - } -.fc .fc-timeline-now-indicator-arrow { - margin: 0 -6px; /* 5, then one more to counteract scroller's negative margins */ - - /* triangle pointing down. TODO: mixin */ - border-width: 6px 5px 0 5px; - border-left-color: transparent; - border-right-color: transparent; - } -.fc .fc-timeline-now-indicator-line { - margin: 0 -1px; /* counteract scroller's negative margins */ - bottom: 0; - border-width: 0 0 0 1px; - } -.fc { - - /* container */ - -} -.fc .fc-timeline-events { - position: relative; - z-index: 3; - width: 0; /* for event positioning. will end up on correct side based on dir */ - } -.fc { - - /* harness */ - -} -.fc .fc-timeline-event-harness { - position: absolute; - top: 0; /* for when when top can't be computed yet */ - /* JS will set tht left/right */ - } -/* z-index, scoped within fc-timeline-events */ -.fc-timeline-event { z-index: 1 } -.fc-timeline-event.fc-event-mirror { z-index: 2 } -.fc-timeline-event { - position: relative; /* contains things. TODO: make part of fc-h-event and fc-v-event */ - display: flex; /* for v-aligning start/end arrows and making fc-event-main stretch all the way */ - align-items: center; - border-radius: 0; - padding: 2px 1px; - margin-bottom: 1px; - font-size: .85em; - font-size: var(--fc-small-font-size, .85em) - - /* time and title spacing */ - /* ---------------------------------------------------------------------------------------------------- */ - -} -.fc-timeline-event .fc-event-main { - flex-grow: 1; - flex-shrink: 1; - min-width: 0; /* important for allowing to shrink all the way */ - } -.fc-timeline-event .fc-event-time { - font-weight: bold; - } -.fc-timeline-event .fc-event-time, - .fc-timeline-event .fc-event-title { - white-space: nowrap; - padding: 0 2px; - } -/* move 1px away from slot line */ -.fc-direction-ltr .fc-timeline-event.fc-event-end { margin-right: 1px } -.fc-direction-rtl .fc-timeline-event.fc-event-end { margin-left: 1px } -/* make event beefier when overlap not allowed */ -.fc-timeline-overlap-disabled .fc-timeline-event { - padding-top: 5px; - padding-bottom: 5px; - margin-bottom: 0; -} -/* arrows indicating the event continues into past/future */ -/* ---------------------------------------------------------------------------------------------------- */ -/* part of the flexbox flow */ -.fc-timeline-event:not(.fc-event-start):before, -.fc-timeline-event:not(.fc-event-end):after { - content: ""; - flex-grow: 0; - flex-shrink: 0; - opacity: .5; - - /* triangle. TODO: mixin */ - width: 0; - height: 0; - margin: 0 1px; - border: 5px solid #000; /* TODO: var */ - border-top-color: transparent; - border-bottom-color: transparent; -} -/* pointing left */ -.fc-direction-ltr .fc-timeline-event:not(.fc-event-start):before, -.fc-direction-rtl .fc-timeline-event:not(.fc-event-end):after { - border-left: 0; -} -/* pointing right */ -.fc-direction-ltr .fc-timeline-event:not(.fc-event-end):after, -.fc-direction-rtl .fc-timeline-event:not(.fc-event-start):before { - border-right: 0; -} -.fc .fc-timeline-bg { /* a container for bg content */ - position: absolute; - z-index: 2; - top: 0; - bottom: 0; - width: 0; - left: 0; /* will take precedence when LTR */ - right: 0; /* will take precedence when RTL */ /* TODO: kill */ - } -.fc .fc-timeline-bg .fc-non-business { z-index: 1 } -.fc .fc-timeline-bg .fc-bg-event { z-index: 2 } -.fc .fc-timeline-bg .fc-highlight { z-index: 3 } -.fc .fc-timeline-bg-harness { - position: absolute; - top: 0; - bottom: 0; - } - - - - - .fc .fc-resource-timeline-divider { - width: 3px; /* important to have width to shrink this cell. no cross-browser problems */ - cursor: col-resize; - } -.fc { - - - /* will match horizontal groups in the datagrid AND group lanes in the timeline area */ - -} -.fc .fc-resource-timeline .fc-resource-group:not([rowspan]) { - background: rgba(208, 208, 208, 0.3); - background: var(--fc-neutral-bg-color, rgba(208, 208, 208, 0.3)); - } -.fc .fc-timeline-lane-frame { - position: relative; /* contains the fc-timeline-bg container, which liquidly expands */ - /* the height is explicitly set by row-height-sync */ - } -.fc .fc-timeline-overlap-enabled .fc-timeline-lane-frame .fc-timeline-events { /* has height set on it */ - box-sizing: content-box; /* padding no longer part of height */ - padding-bottom: 10px; /* give extra spacing underneath for selecting */ - } -/* the "frame" */ -.fc-datagrid-cell-frame-liquid { - height: 100%; /* needs liquid hack */ -} -.fc-liquid-hack .fc-datagrid-cell-frame-liquid { - height: auto; - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - } -.fc { - - /* the "frame" in a HEADER */ - /* needs to position the column resizer */ - /* needs to vertically center content */ - -} -.fc .fc-datagrid-header .fc-datagrid-cell-frame { - position: relative; /* for resizer */ - display: flex; - justify-content: flex-start; /* horizontal align (natural left/right) */ - align-items: center; /* vertical align */ - } -.fc { - - /* the column resizer (only in HEADER) */ - -} -.fc .fc-datagrid-cell-resizer { - position: absolute; - z-index: 1; - top: 0; - bottom: 0; - width: 5px; - cursor: col-resize; - } -.fc { - - /* the cushion */ - -} -.fc .fc-datagrid-cell-cushion { - padding: 8px; - white-space: nowrap; - overflow: hidden; /* problem for col resizer :( */ - } -.fc { - - /* expander icons */ - -} -.fc .fc-datagrid-expander { - cursor: pointer; - opacity: 0.65 - - } -.fc .fc-datagrid-expander .fc-icon { /* the expander and spacers before the expander */ - display: inline-block; - width: 1em; /* ensure constant width, esp for empty icons */ - } -.fc .fc-datagrid-expander-placeholder { - cursor: auto; - } -.fc .fc-resource-timeline-flat .fc-datagrid-expander-placeholder { - display: none; - } -.fc-direction-ltr .fc-datagrid-cell-resizer { right: -3px } -.fc-direction-rtl .fc-datagrid-cell-resizer { left: -3px } -.fc-direction-ltr .fc-datagrid-expander { margin-right: 3px } -.fc-direction-rtl .fc-datagrid-expander { margin-left: 3px } - diff --git a/static_common/common/vendor/fullcalendar-scheduler/main.js b/static_common/common/vendor/fullcalendar-scheduler/main.js deleted file mode 100644 index 4ee282f4..00000000 --- a/static_common/common/vendor/fullcalendar-scheduler/main.js +++ /dev/null @@ -1,19554 +0,0 @@ -/*! -FullCalendar Scheduler v5.5.1 -Docs & License: https://fullcalendar.io/scheduler -(c) 2020 Adam Shaw -*/ -var FullCalendar = (function (exports) { - 'use strict'; - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - - function __extends(d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - var __assign = function() { - __assign = Object.assign || function __assign(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); - }; - - function __spreadArrays() { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; - } - - var n,u,i,t,o,r,f={},e=[],c=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function s(n,l){for(var u in l)n[u]=l[u];return n}function a(n){var l=n.parentNode;l&&l.removeChild(n);}function v(n,l,u){var i,t,o,r=arguments,f={};for(o in l)"key"==o?i=l[o]:"ref"==o?t=l[o]:f[o]=l[o];if(arguments.length>3)for(u=[u],o=3;o<arguments.length;o++)u.push(r[o]);if(null!=u&&(f.children=u),"function"==typeof n&&null!=n.defaultProps)for(o in n.defaultProps)void 0===f[o]&&(f[o]=n.defaultProps[o]);return h(n,f,i,t,null)}function h(l,u,i,t,o){var r={type:l,props:u,key:i,ref:t,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==o?++n.__v:o};return null!=n.vnode&&n.vnode(r),r}function y(){return {current:null}}function p(n){return n.children}function d(n,l){this.props=n,this.context=l;}function _(n,l){if(null==l)return n.__?_(n.__,n.__.__k.indexOf(n)+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return "function"==typeof n.type?_(n):null}function w(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return w(n)}}function k(l){(!l.__d&&(l.__d=!0)&&u.push(l)&&!g.__r++||t!==n.debounceRendering)&&((t=n.debounceRendering)||i)(g);}function g(){for(var n;g.__r=u.length;)n=u.sort(function(n,l){return n.__v.__b-l.__v.__b}),u=[],n.some(function(n){var l,u,i,t,o,r,f;n.__d&&(r=(o=(l=n).__v).__e,(f=l.__P)&&(u=[],(i=s({},o)).__v=o.__v+1,t=$(f,o,i,l.__n,void 0!==f.ownerSVGElement,null!=o.__h?[r]:null,u,null==r?_(o):r,o.__h),j(u,o),t!=r&&w(o)));});}function m(n,l,u,i,t,o,r,c,s,v){var y,d,w,k,g,m,b,A=i&&i.__k||e,P=A.length;for(s==f&&(s=null!=r?r[0]:P?_(i,0):null),u.__k=[],y=0;y<l.length;y++)if(null!=(k=u.__k[y]=null==(k=l[y])||"boolean"==typeof k?null:"string"==typeof k||"number"==typeof k?h(null,k,null,null,k):Array.isArray(k)?h(p,{children:k},null,null,null):null!=k.__e||null!=k.__c?h(k.type,k.props,k.key,null,k.__v):k)){if(k.__=u,k.__b=u.__b+1,null===(w=A[y])||w&&k.key==w.key&&k.type===w.type)A[y]=void 0;else for(d=0;d<P;d++){if((w=A[d])&&k.key==w.key&&k.type===w.type){A[d]=void 0;break}w=null;}g=$(n,k,w=w||f,t,o,r,c,s,v),(d=k.ref)&&w.ref!=d&&(b||(b=[]),w.ref&&b.push(w.ref,null,k),b.push(d,k.__c||g,k)),null!=g?(null==m&&(m=g),s=x(n,k,w,A,r,g,s),v||"option"!=u.type?"function"==typeof u.type&&(u.__d=s):n.value=""):s&&w.__e==s&&s.parentNode!=n&&(s=_(w));}if(u.__e=m,null!=r&&"function"!=typeof u.type)for(y=r.length;y--;)null!=r[y]&&a(r[y]);for(y=P;y--;)null!=A[y]&&L(A[y],A[y]);if(b)for(y=0;y<b.length;y++)I(b[y],b[++y],b[++y]);}function x(n,l,u,i,t,o,r){var f,e,c;if(void 0!==l.__d)f=l.__d,l.__d=void 0;else if(t==u||o!=r||null==o.parentNode)n:if(null==r||r.parentNode!==n)n.appendChild(o),f=null;else {for(e=r,c=0;(e=e.nextSibling)&&c<i.length;c+=2)if(e==o)break n;n.insertBefore(o,r),f=r;}return void 0!==f?f:o.nextSibling}function A(n,l,u,i,t){var o;for(o in u)"children"===o||"key"===o||o in l||C(n,o,null,u[o],i);for(o in l)t&&"function"!=typeof l[o]||"children"===o||"key"===o||"value"===o||"checked"===o||u[o]===l[o]||C(n,o,l[o],u[o],i);}function P(n,l,u){"-"===l[0]?n.setProperty(l,u):n[l]=null==u?"":"number"!=typeof u||c.test(l)?u:u+"px";}function C(n,l,u,i,t){var o,r,f;if(t&&"className"==l&&(l="class"),"style"===l)if("string"==typeof u)n.style.cssText=u;else {if("string"==typeof i&&(n.style.cssText=i=""),i)for(l in i)u&&l in u||P(n.style,l,"");if(u)for(l in u)i&&u[l]===i[l]||P(n.style,l,u[l]);}else "o"===l[0]&&"n"===l[1]?(o=l!==(l=l.replace(/Capture$/,"")),(r=l.toLowerCase())in n&&(l=r),l=l.slice(2),n.l||(n.l={}),n.l[l+o]=u,f=o?N:z,u?i||n.addEventListener(l,f,o):n.removeEventListener(l,f,o)):"list"!==l&&"tagName"!==l&&"form"!==l&&"type"!==l&&"size"!==l&&"download"!==l&&"href"!==l&&!t&&l in n?n[l]=null==u?"":u:"function"!=typeof u&&"dangerouslySetInnerHTML"!==l&&(l!==(l=l.replace(/xlink:?/,""))?null==u||!1===u?n.removeAttributeNS("http://www.w3.org/1999/xlink",l.toLowerCase()):n.setAttributeNS("http://www.w3.org/1999/xlink",l.toLowerCase(),u):null==u||!1===u&&!/^ar/.test(l)?n.removeAttribute(l):n.setAttribute(l,u));}function z(l){this.l[l.type+!1](n.event?n.event(l):l);}function N(l){this.l[l.type+!0](n.event?n.event(l):l);}function T(n,l,u){var i,t;for(i=0;i<n.__k.length;i++)(t=n.__k[i])&&(t.__=n,t.__e&&("function"==typeof t.type&&t.__k.length>1&&T(t,l,u),l=x(u,t,t,n.__k,null,t.__e,l),"function"==typeof n.type&&(n.__d=l)));}function $(l,u,i,t,o,r,f,e,c){var a,v,h,y,_,w,k,g,b,x,A,P=u.type;if(void 0!==u.constructor)return null;null!=i.__h&&(c=i.__h,e=u.__e=i.__e,u.__h=null,r=[e]),(a=n.__b)&&a(u);try{n:if("function"==typeof P){if(g=u.props,b=(a=P.contextType)&&t[a.__c],x=a?b?b.props.value:a.__:t,i.__c?k=(v=u.__c=i.__c).__=v.__E:("prototype"in P&&P.prototype.render?u.__c=v=new P(g,x):(u.__c=v=new d(g,x),v.constructor=P,v.render=M),b&&b.sub(v),v.props=g,v.state||(v.state={}),v.context=x,v.__n=t,h=v.__d=!0,v.__h=[]),null==v.__s&&(v.__s=v.state),null!=P.getDerivedStateFromProps&&(v.__s==v.state&&(v.__s=s({},v.__s)),s(v.__s,P.getDerivedStateFromProps(g,v.__s))),y=v.props,_=v.state,h)null==P.getDerivedStateFromProps&&null!=v.componentWillMount&&v.componentWillMount(),null!=v.componentDidMount&&v.__h.push(v.componentDidMount);else {if(null==P.getDerivedStateFromProps&&g!==y&&null!=v.componentWillReceiveProps&&v.componentWillReceiveProps(g,x),!v.__e&&null!=v.shouldComponentUpdate&&!1===v.shouldComponentUpdate(g,v.__s,x)||u.__v===i.__v){v.props=g,v.state=v.__s,u.__v!==i.__v&&(v.__d=!1),v.__v=u,u.__e=i.__e,u.__k=i.__k,v.__h.length&&f.push(v),T(u,e,l);break n}null!=v.componentWillUpdate&&v.componentWillUpdate(g,v.__s,x),null!=v.componentDidUpdate&&v.__h.push(function(){v.componentDidUpdate(y,_,w);});}v.context=x,v.props=g,v.state=v.__s,(a=n.__r)&&a(u),v.__d=!1,v.__v=u,v.__P=l,a=v.render(v.props,v.state,v.context),v.state=v.__s,null!=v.getChildContext&&(t=s(s({},t),v.getChildContext())),h||null==v.getSnapshotBeforeUpdate||(w=v.getSnapshotBeforeUpdate(y,_)),A=null!=a&&a.type==p&&null==a.key?a.props.children:a,m(l,Array.isArray(A)?A:[A],u,i,t,o,r,f,e,c),v.base=u.__e,u.__h=null,v.__h.length&&f.push(v),k&&(v.__E=v.__=null),v.__e=!1;}else null==r&&u.__v===i.__v?(u.__k=i.__k,u.__e=i.__e):u.__e=H(i.__e,u,i,t,o,r,f,c);(a=n.diffed)&&a(u);}catch(l){u.__v=null,(c||null!=r)&&(u.__e=e,u.__h=!!c,r[r.indexOf(e)]=null),n.__e(l,u,i);}return u.__e}function j(l,u){n.__c&&n.__c(u,l),l.some(function(u){try{l=u.__h,u.__h=[],l.some(function(n){n.call(u);});}catch(l){n.__e(l,u.__v);}});}function H(n,l,u,i,t,o,r,c){var s,a,v,h,y,p=u.props,d=l.props;if(t="svg"===l.type||t,null!=o)for(s=0;s<o.length;s++)if(null!=(a=o[s])&&((null===l.type?3===a.nodeType:a.localName===l.type)||n==a)){n=a,o[s]=null;break}if(null==n){if(null===l.type)return document.createTextNode(d);n=t?document.createElementNS("http://www.w3.org/2000/svg",l.type):document.createElement(l.type,d.is&&{is:d.is}),o=null,c=!1;}if(null===l.type)p===d||c&&n.data===d||(n.data=d);else {if(null!=o&&(o=e.slice.call(n.childNodes)),v=(p=u.props||f).dangerouslySetInnerHTML,h=d.dangerouslySetInnerHTML,!c){if(null!=o)for(p={},y=0;y<n.attributes.length;y++)p[n.attributes[y].name]=n.attributes[y].value;(h||v)&&(h&&(v&&h.__html==v.__html||h.__html===n.innerHTML)||(n.innerHTML=h&&h.__html||""));}A(n,d,p,t,c),h?l.__k=[]:(s=l.props.children,m(n,Array.isArray(s)?s:[s],l,u,i,"foreignObject"!==l.type&&t,o,r,f,c)),c||("value"in d&&void 0!==(s=d.value)&&(s!==n.value||"progress"===l.type&&!s)&&C(n,"value",s,p.value,!1),"checked"in d&&void 0!==(s=d.checked)&&s!==n.checked&&C(n,"checked",s,p.checked,!1));}return n}function I(l,u,i){try{"function"==typeof l?l(u):l.current=u;}catch(l){n.__e(l,i);}}function L(l,u,i){var t,o,r;if(n.unmount&&n.unmount(l),(t=l.ref)&&(t.current&&t.current!==l.__e||I(t,null,u)),i||"function"==typeof l.type||(i=null!=(o=l.__e)),l.__e=l.__d=void 0,null!=(t=l.__c)){if(t.componentWillUnmount)try{t.componentWillUnmount();}catch(l){n.__e(l,u);}t.base=t.__P=null;}if(t=l.__k)for(r=0;r<t.length;r++)t[r]&&L(t[r],u,i);null!=o&&a(o);}function M(n,l,u){return this.constructor(n,u)}function O(l,u,i){var t,r,c;n.__&&n.__(l,u),r=(t=i===o)?null:i&&i.__k||u.__k,l=v(p,null,[l]),c=[],$(u,(t?u:i||u).__k=l,r||f,f,void 0!==u.ownerSVGElement,i&&!t?[i]:r?null:u.childNodes.length?e.slice.call(u.childNodes):null,c,i||f,t),j(c,l);}function B(n,l){var u={__c:l="__cC"+r++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n,u,i){return this.getChildContext||(u=[],(i={})[l]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(n){this.props.value!==n.value&&u.some(k);},this.sub=function(n){u.push(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u.splice(u.indexOf(n),1),l&&l.call(n);};}),n.children}};return u.Provider.__=u.Consumer.contextType=u}n={__e:function(n,l){for(var u,i,t,o=l.__h;l=l.__;)if((u=l.__c)&&!u.__)try{if((i=u.constructor)&&null!=i.getDerivedStateFromError&&(u.setState(i.getDerivedStateFromError(n)),t=u.__d),null!=u.componentDidCatch&&(u.componentDidCatch(n),t=u.__d),t)return l.__h=o,u.__E=u}catch(l){n=l;}throw n},__v:0},d.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=s({},this.state),"function"==typeof n&&(n=n(s({},u),this.props)),n&&s(u,n),null!=n&&this.__v&&(l&&this.__h.push(l),k(this));},d.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),k(this));},d.prototype.render=p,u=[],i="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,g.__r=0,o=f,r=0; - - var globalObj = typeof globalThis !== 'undefined' ? globalThis : window; // // TODO: streamline when killing IE11 support - if (globalObj.FullCalendarVDom) { - console.warn('FullCalendar VDOM already loaded'); - } - else { - globalObj.FullCalendarVDom = { - Component: d, - createElement: v, - render: O, - createRef: y, - Fragment: p, - createContext: createContext, - flushToDom: flushToDom, - unmountComponentAtNode: unmountComponentAtNode, - }; - } - // HACKS... - // TODO: lock version - // TODO: link gh issues - function flushToDom() { - var oldDebounceRendering = n.debounceRendering; // orig - var callbackQ = []; - function execCallbackSync(callback) { - callbackQ.push(callback); - } - n.debounceRendering = execCallbackSync; - O(v(FakeComponent, {}), document.createElement('div')); - while (callbackQ.length) { - callbackQ.shift()(); - } - n.debounceRendering = oldDebounceRendering; - } - var FakeComponent = /** @class */ (function (_super) { - __extends(FakeComponent, _super); - function FakeComponent() { - return _super !== null && _super.apply(this, arguments) || this; - } - FakeComponent.prototype.render = function () { return v('div', {}); }; - FakeComponent.prototype.componentDidMount = function () { this.setState({}); }; - return FakeComponent; - }(d)); - function createContext(defaultValue) { - var ContextType = B(defaultValue); - var origProvider = ContextType.Provider; - ContextType.Provider = function () { - var _this = this; - var isNew = !this.getChildContext; - var children = origProvider.apply(this, arguments); // eslint-disable-line prefer-rest-params - if (isNew) { - var subs_1 = []; - this.shouldComponentUpdate = function (_props) { - if (_this.props.value !== _props.value) { - subs_1.forEach(function (c) { - c.context = _props.value; - c.forceUpdate(); - }); - } - }; - this.sub = function (c) { - subs_1.push(c); - var old = c.componentWillUnmount; - c.componentWillUnmount = function () { - subs_1.splice(subs_1.indexOf(c), 1); - old && old.call(c); - }; - }; - } - return children; - }; - return ContextType; - } - function unmountComponentAtNode(node) { - O(null, node); - } - - // no public types yet. when there are, export from: - // import {} from './api-type-deps' - var EventSourceApi = /** @class */ (function () { - function EventSourceApi(context, internalEventSource) { - this.context = context; - this.internalEventSource = internalEventSource; - } - EventSourceApi.prototype.remove = function () { - this.context.dispatch({ - type: 'REMOVE_EVENT_SOURCE', - sourceId: this.internalEventSource.sourceId, - }); - }; - EventSourceApi.prototype.refetch = function () { - this.context.dispatch({ - type: 'FETCH_EVENT_SOURCES', - sourceIds: [this.internalEventSource.sourceId], - }); - }; - Object.defineProperty(EventSourceApi.prototype, "id", { - get: function () { - return this.internalEventSource.publicId; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(EventSourceApi.prototype, "url", { - get: function () { - return this.internalEventSource.meta.url; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(EventSourceApi.prototype, "format", { - get: function () { - return this.internalEventSource.meta.format; // TODO: bad. not guaranteed - }, - enumerable: false, - configurable: true - }); - return EventSourceApi; - }()); - - function removeElement(el) { - if (el.parentNode) { - el.parentNode.removeChild(el); - } - } - // Querying - // ---------------------------------------------------------------------------------------------------------------- - function elementClosest(el, selector) { - if (el.closest) { - return el.closest(selector); - // really bad fallback for IE - // from https://developer.mozilla.org/en-US/docs/Web/API/Element/closest - } - if (!document.documentElement.contains(el)) { - return null; - } - do { - if (elementMatches(el, selector)) { - return el; - } - el = (el.parentElement || el.parentNode); - } while (el !== null && el.nodeType === 1); - return null; - } - function elementMatches(el, selector) { - var method = el.matches || el.matchesSelector || el.msMatchesSelector; - return method.call(el, selector); - } - // accepts multiple subject els - // returns a real array. good for methods like forEach - // TODO: accept the document - function findElements(container, selector) { - var containers = container instanceof HTMLElement ? [container] : container; - var allMatches = []; - for (var i = 0; i < containers.length; i += 1) { - var matches = containers[i].querySelectorAll(selector); - for (var j = 0; j < matches.length; j += 1) { - allMatches.push(matches[j]); - } - } - return allMatches; - } - // accepts multiple subject els - // only queries direct child elements // TODO: rename to findDirectChildren! - function findDirectChildren(parent, selector) { - var parents = parent instanceof HTMLElement ? [parent] : parent; - var allMatches = []; - for (var i = 0; i < parents.length; i += 1) { - var childNodes = parents[i].children; // only ever elements - for (var j = 0; j < childNodes.length; j += 1) { - var childNode = childNodes[j]; - if (!selector || elementMatches(childNode, selector)) { - allMatches.push(childNode); - } - } - } - return allMatches; - } - // Style - // ---------------------------------------------------------------------------------------------------------------- - var PIXEL_PROP_RE = /(top|left|right|bottom|width|height)$/i; - function applyStyle(el, props) { - for (var propName in props) { - applyStyleProp(el, propName, props[propName]); - } - } - function applyStyleProp(el, name, val) { - if (val == null) { - el.style[name] = ''; - } - else if (typeof val === 'number' && PIXEL_PROP_RE.test(name)) { - el.style[name] = val + "px"; - } - else { - el.style[name] = val; - } - } - - // Stops a mouse/touch event from doing it's native browser action - function preventDefault(ev) { - ev.preventDefault(); - } - // Event Delegation - // ---------------------------------------------------------------------------------------------------------------- - function buildDelegationHandler(selector, handler) { - return function (ev) { - var matchedChild = elementClosest(ev.target, selector); - if (matchedChild) { - handler.call(matchedChild, ev, matchedChild); - } - }; - } - function listenBySelector(container, eventType, selector, handler) { - var attachedHandler = buildDelegationHandler(selector, handler); - container.addEventListener(eventType, attachedHandler); - return function () { - container.removeEventListener(eventType, attachedHandler); - }; - } - function listenToHoverBySelector(container, selector, onMouseEnter, onMouseLeave) { - var currentMatchedChild; - return listenBySelector(container, 'mouseover', selector, function (mouseOverEv, matchedChild) { - if (matchedChild !== currentMatchedChild) { - currentMatchedChild = matchedChild; - onMouseEnter(mouseOverEv, matchedChild); - var realOnMouseLeave_1 = function (mouseLeaveEv) { - currentMatchedChild = null; - onMouseLeave(mouseLeaveEv, matchedChild); - matchedChild.removeEventListener('mouseleave', realOnMouseLeave_1); - }; - // listen to the next mouseleave, and then unattach - matchedChild.addEventListener('mouseleave', realOnMouseLeave_1); - } - }); - } - // Animation - // ---------------------------------------------------------------------------------------------------------------- - var transitionEventNames = [ - 'webkitTransitionEnd', - 'otransitionend', - 'oTransitionEnd', - 'msTransitionEnd', - 'transitionend', - ]; - // triggered only when the next single subsequent transition finishes - function whenTransitionDone(el, callback) { - var realCallback = function (ev) { - callback(ev); - transitionEventNames.forEach(function (eventName) { - el.removeEventListener(eventName, realCallback); - }); - }; - transitionEventNames.forEach(function (eventName) { - el.addEventListener(eventName, realCallback); // cross-browser way to determine when the transition finishes - }); - } - - var guidNumber = 0; - function guid() { - guidNumber += 1; - return String(guidNumber); - } - /* FullCalendar-specific DOM Utilities - ----------------------------------------------------------------------------------------------------------------------*/ - // Make the mouse cursor express that an event is not allowed in the current area - function disableCursor() { - document.body.classList.add('fc-not-allowed'); - } - // Returns the mouse cursor to its original look - function enableCursor() { - document.body.classList.remove('fc-not-allowed'); - } - /* Selection - ----------------------------------------------------------------------------------------------------------------------*/ - function preventSelection(el) { - el.classList.add('fc-unselectable'); - el.addEventListener('selectstart', preventDefault); - } - function allowSelection(el) { - el.classList.remove('fc-unselectable'); - el.removeEventListener('selectstart', preventDefault); - } - /* Context Menu - ----------------------------------------------------------------------------------------------------------------------*/ - function preventContextMenu(el) { - el.addEventListener('contextmenu', preventDefault); - } - function allowContextMenu(el) { - el.removeEventListener('contextmenu', preventDefault); - } - function parseFieldSpecs(input) { - var specs = []; - var tokens = []; - var i; - var token; - if (typeof input === 'string') { - tokens = input.split(/\s*,\s*/); - } - else if (typeof input === 'function') { - tokens = [input]; - } - else if (Array.isArray(input)) { - tokens = input; - } - for (i = 0; i < tokens.length; i += 1) { - token = tokens[i]; - if (typeof token === 'string') { - specs.push(token.charAt(0) === '-' ? - { field: token.substring(1), order: -1 } : - { field: token, order: 1 }); - } - else if (typeof token === 'function') { - specs.push({ func: token }); - } - } - return specs; - } - function compareByFieldSpecs(obj0, obj1, fieldSpecs) { - var i; - var cmp; - for (i = 0; i < fieldSpecs.length; i += 1) { - cmp = compareByFieldSpec(obj0, obj1, fieldSpecs[i]); - if (cmp) { - return cmp; - } - } - return 0; - } - function compareByFieldSpec(obj0, obj1, fieldSpec) { - if (fieldSpec.func) { - return fieldSpec.func(obj0, obj1); - } - return flexibleCompare(obj0[fieldSpec.field], obj1[fieldSpec.field]) - * (fieldSpec.order || 1); - } - function flexibleCompare(a, b) { - if (!a && !b) { - return 0; - } - if (b == null) { - return -1; - } - if (a == null) { - return 1; - } - if (typeof a === 'string' || typeof b === 'string') { - return String(a).localeCompare(String(b)); - } - return a - b; - } - /* String Utilities - ----------------------------------------------------------------------------------------------------------------------*/ - function padStart(val, len) { - var s = String(val); - return '000'.substr(0, len - s.length) + s; - } - /* Number Utilities - ----------------------------------------------------------------------------------------------------------------------*/ - function compareNumbers(a, b) { - return a - b; - } - function isInt(n) { - return n % 1 === 0; - } - /* FC-specific DOM dimension stuff - ----------------------------------------------------------------------------------------------------------------------*/ - function computeSmallestCellWidth(cellEl) { - var allWidthEl = cellEl.querySelector('.fc-scrollgrid-shrink-frame'); - var contentWidthEl = cellEl.querySelector('.fc-scrollgrid-shrink-cushion'); - if (!allWidthEl) { - throw new Error('needs fc-scrollgrid-shrink-frame className'); // TODO: use const - } - if (!contentWidthEl) { - throw new Error('needs fc-scrollgrid-shrink-cushion className'); - } - return cellEl.getBoundingClientRect().width - allWidthEl.getBoundingClientRect().width + // the cell padding+border - contentWidthEl.getBoundingClientRect().width; - } - - var DAY_IDS = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat']; - // Adding - function addWeeks(m, n) { - var a = dateToUtcArray(m); - a[2] += n * 7; - return arrayToUtcDate(a); - } - function addDays(m, n) { - var a = dateToUtcArray(m); - a[2] += n; - return arrayToUtcDate(a); - } - function addMs(m, n) { - var a = dateToUtcArray(m); - a[6] += n; - return arrayToUtcDate(a); - } - // Diffing (all return floats) - // TODO: why not use ranges? - function diffWeeks(m0, m1) { - return diffDays(m0, m1) / 7; - } - function diffDays(m0, m1) { - return (m1.valueOf() - m0.valueOf()) / (1000 * 60 * 60 * 24); - } - function diffHours(m0, m1) { - return (m1.valueOf() - m0.valueOf()) / (1000 * 60 * 60); - } - function diffMinutes(m0, m1) { - return (m1.valueOf() - m0.valueOf()) / (1000 * 60); - } - function diffSeconds(m0, m1) { - return (m1.valueOf() - m0.valueOf()) / 1000; - } - function diffDayAndTime(m0, m1) { - var m0day = startOfDay(m0); - var m1day = startOfDay(m1); - return { - years: 0, - months: 0, - days: Math.round(diffDays(m0day, m1day)), - milliseconds: (m1.valueOf() - m1day.valueOf()) - (m0.valueOf() - m0day.valueOf()), - }; - } - // Diffing Whole Units - function diffWholeWeeks(m0, m1) { - var d = diffWholeDays(m0, m1); - if (d !== null && d % 7 === 0) { - return d / 7; - } - return null; - } - function diffWholeDays(m0, m1) { - if (timeAsMs(m0) === timeAsMs(m1)) { - return Math.round(diffDays(m0, m1)); - } - return null; - } - // Start-Of - function startOfDay(m) { - return arrayToUtcDate([ - m.getUTCFullYear(), - m.getUTCMonth(), - m.getUTCDate(), - ]); - } - function startOfHour(m) { - return arrayToUtcDate([ - m.getUTCFullYear(), - m.getUTCMonth(), - m.getUTCDate(), - m.getUTCHours(), - ]); - } - function startOfMinute(m) { - return arrayToUtcDate([ - m.getUTCFullYear(), - m.getUTCMonth(), - m.getUTCDate(), - m.getUTCHours(), - m.getUTCMinutes(), - ]); - } - function startOfSecond(m) { - return arrayToUtcDate([ - m.getUTCFullYear(), - m.getUTCMonth(), - m.getUTCDate(), - m.getUTCHours(), - m.getUTCMinutes(), - m.getUTCSeconds(), - ]); - } - // Week Computation - function weekOfYear(marker, dow, doy) { - var y = marker.getUTCFullYear(); - var w = weekOfGivenYear(marker, y, dow, doy); - if (w < 1) { - return weekOfGivenYear(marker, y - 1, dow, doy); - } - var nextW = weekOfGivenYear(marker, y + 1, dow, doy); - if (nextW >= 1) { - return Math.min(w, nextW); - } - return w; - } - function weekOfGivenYear(marker, year, dow, doy) { - var firstWeekStart = arrayToUtcDate([year, 0, 1 + firstWeekOffset(year, dow, doy)]); - var dayStart = startOfDay(marker); - var days = Math.round(diffDays(firstWeekStart, dayStart)); - return Math.floor(days / 7) + 1; // zero-indexed - } - // start-of-first-week - start-of-year - function firstWeekOffset(year, dow, doy) { - // first-week day -- which january is always in the first week (4 for iso, 1 for other) - var fwd = 7 + dow - doy; - // first-week day local weekday -- which local weekday is fwd - var fwdlw = (7 + arrayToUtcDate([year, 0, fwd]).getUTCDay() - dow) % 7; - return -fwdlw + fwd - 1; - } - // Array Conversion - function dateToLocalArray(date) { - return [ - date.getFullYear(), - date.getMonth(), - date.getDate(), - date.getHours(), - date.getMinutes(), - date.getSeconds(), - date.getMilliseconds(), - ]; - } - function arrayToLocalDate(a) { - return new Date(a[0], a[1] || 0, a[2] == null ? 1 : a[2], // day of month - a[3] || 0, a[4] || 0, a[5] || 0); - } - function dateToUtcArray(date) { - return [ - date.getUTCFullYear(), - date.getUTCMonth(), - date.getUTCDate(), - date.getUTCHours(), - date.getUTCMinutes(), - date.getUTCSeconds(), - date.getUTCMilliseconds(), - ]; - } - function arrayToUtcDate(a) { - // according to web standards (and Safari), a month index is required. - // massage if only given a year. - if (a.length === 1) { - a = a.concat([0]); - } - return new Date(Date.UTC.apply(Date, a)); - } - // Other Utils - function isValidDate(m) { - return !isNaN(m.valueOf()); - } - function timeAsMs(m) { - return m.getUTCHours() * 1000 * 60 * 60 + - m.getUTCMinutes() * 1000 * 60 + - m.getUTCSeconds() * 1000 + - m.getUTCMilliseconds(); - } - - function createEventInstance(defId, range, forcedStartTzo, forcedEndTzo) { - return { - instanceId: guid(), - defId: defId, - range: range, - forcedStartTzo: forcedStartTzo == null ? null : forcedStartTzo, - forcedEndTzo: forcedEndTzo == null ? null : forcedEndTzo, - }; - } - - var hasOwnProperty = Object.prototype.hasOwnProperty; - // Merges an array of objects into a single object. - // The second argument allows for an array of property names who's object values will be merged together. - function mergeProps(propObjs, complexPropsMap) { - var dest = {}; - if (complexPropsMap) { - for (var name_1 in complexPropsMap) { - var complexObjs = []; - // collect the trailing object values, stopping when a non-object is discovered - for (var i = propObjs.length - 1; i >= 0; i -= 1) { - var val = propObjs[i][name_1]; - if (typeof val === 'object' && val) { // non-null object - complexObjs.unshift(val); - } - else if (val !== undefined) { - dest[name_1] = val; // if there were no objects, this value will be used - break; - } - } - // if the trailing values were objects, use the merged value - if (complexObjs.length) { - dest[name_1] = mergeProps(complexObjs); - } - } - } - // copy values into the destination, going from last to first - for (var i = propObjs.length - 1; i >= 0; i -= 1) { - var props = propObjs[i]; - for (var name_2 in props) { - if (!(name_2 in dest)) { // if already assigned by previous props or complex props, don't reassign - dest[name_2] = props[name_2]; - } - } - } - return dest; - } - function filterHash(hash, func) { - var filtered = {}; - for (var key in hash) { - if (func(hash[key], key)) { - filtered[key] = hash[key]; - } - } - return filtered; - } - function mapHash(hash, func) { - var newHash = {}; - for (var key in hash) { - newHash[key] = func(hash[key], key); - } - return newHash; - } - function arrayToHash(a) { - var hash = {}; - for (var _i = 0, a_1 = a; _i < a_1.length; _i++) { - var item = a_1[_i]; - hash[item] = true; - } - return hash; - } - function buildHashFromArray(a, func) { - var hash = {}; - for (var i = 0; i < a.length; i += 1) { - var tuple = func(a[i], i); - hash[tuple[0]] = tuple[1]; - } - return hash; - } - function hashValuesToArray(obj) { - var a = []; - for (var key in obj) { - a.push(obj[key]); - } - return a; - } - function isPropsEqual(obj0, obj1) { - if (obj0 === obj1) { - return true; - } - for (var key in obj0) { - if (hasOwnProperty.call(obj0, key)) { - if (!(key in obj1)) { - return false; - } - } - } - for (var key in obj1) { - if (hasOwnProperty.call(obj1, key)) { - if (obj0[key] !== obj1[key]) { - return false; - } - } - } - return true; - } - function getUnequalProps(obj0, obj1) { - var keys = []; - for (var key in obj0) { - if (hasOwnProperty.call(obj0, key)) { - if (!(key in obj1)) { - keys.push(key); - } - } - } - for (var key in obj1) { - if (hasOwnProperty.call(obj1, key)) { - if (obj0[key] !== obj1[key]) { - keys.push(key); - } - } - } - return keys; - } - function compareObjs(oldProps, newProps, equalityFuncs) { - if (equalityFuncs === void 0) { equalityFuncs = {}; } - if (oldProps === newProps) { - return true; - } - for (var key in newProps) { - if (key in oldProps && isObjValsEqual(oldProps[key], newProps[key], equalityFuncs[key])) ; - else { - return false; - } - } - // check for props that were omitted in the new - for (var key in oldProps) { - if (!(key in newProps)) { - return false; - } - } - return true; - } - /* - assumed "true" equality for handler names like "onReceiveSomething" - */ - function isObjValsEqual(val0, val1, comparator) { - if (val0 === val1 || comparator === true) { - return true; - } - if (comparator) { - return comparator(val0, val1); - } - return false; - } - function collectFromHash(hash, startIndex, endIndex, step) { - if (startIndex === void 0) { startIndex = 0; } - if (step === void 0) { step = 1; } - var res = []; - if (endIndex == null) { - endIndex = Object.keys(hash).length; - } - for (var i = startIndex; i < endIndex; i += step) { - var val = hash[i]; - if (val !== undefined) { // will disregard undefined for sparse arrays - res.push(val); - } - } - return res; - } - - function parseRecurring(refined, defaultAllDay, dateEnv, recurringTypes) { - for (var i = 0; i < recurringTypes.length; i += 1) { - var parsed = recurringTypes[i].parse(refined, dateEnv); - if (parsed) { - var allDay = refined.allDay; - if (allDay == null) { - allDay = defaultAllDay; - if (allDay == null) { - allDay = parsed.allDayGuess; - if (allDay == null) { - allDay = false; - } - } - } - return { - allDay: allDay, - duration: parsed.duration, - typeData: parsed.typeData, - typeId: i, - }; - } - } - return null; - } - function expandRecurring(eventStore, framingRange, context) { - var dateEnv = context.dateEnv, pluginHooks = context.pluginHooks, options = context.options; - var defs = eventStore.defs, instances = eventStore.instances; - // remove existing recurring instances - // TODO: bad. always expand events as a second step - instances = filterHash(instances, function (instance) { return !defs[instance.defId].recurringDef; }); - for (var defId in defs) { - var def = defs[defId]; - if (def.recurringDef) { - var duration = def.recurringDef.duration; - if (!duration) { - duration = def.allDay ? - options.defaultAllDayEventDuration : - options.defaultTimedEventDuration; - } - var starts = expandRecurringRanges(def, duration, framingRange, dateEnv, pluginHooks.recurringTypes); - for (var _i = 0, starts_1 = starts; _i < starts_1.length; _i++) { - var start = starts_1[_i]; - var instance = createEventInstance(defId, { - start: start, - end: dateEnv.add(start, duration), - }); - instances[instance.instanceId] = instance; - } - } - } - return { defs: defs, instances: instances }; - } - /* - Event MUST have a recurringDef - */ - function expandRecurringRanges(eventDef, duration, framingRange, dateEnv, recurringTypes) { - var typeDef = recurringTypes[eventDef.recurringDef.typeId]; - var markers = typeDef.expand(eventDef.recurringDef.typeData, { - start: dateEnv.subtract(framingRange.start, duration), - end: framingRange.end, - }, dateEnv); - // the recurrence plugins don't guarantee that all-day events are start-of-day, so we have to - if (eventDef.allDay) { - markers = markers.map(startOfDay); - } - return markers; - } - - var INTERNAL_UNITS = ['years', 'months', 'days', 'milliseconds']; - var PARSE_RE = /^(-?)(?:(\d+)\.)?(\d+):(\d\d)(?::(\d\d)(?:\.(\d\d\d))?)?/; - // Parsing and Creation - function createDuration(input, unit) { - var _a; - if (typeof input === 'string') { - return parseString(input); - } - if (typeof input === 'object' && input) { // non-null object - return parseObject(input); - } - if (typeof input === 'number') { - return parseObject((_a = {}, _a[unit || 'milliseconds'] = input, _a)); - } - return null; - } - function parseString(s) { - var m = PARSE_RE.exec(s); - if (m) { - var sign = m[1] ? -1 : 1; - return { - years: 0, - months: 0, - days: sign * (m[2] ? parseInt(m[2], 10) : 0), - milliseconds: sign * ((m[3] ? parseInt(m[3], 10) : 0) * 60 * 60 * 1000 + // hours - (m[4] ? parseInt(m[4], 10) : 0) * 60 * 1000 + // minutes - (m[5] ? parseInt(m[5], 10) : 0) * 1000 + // seconds - (m[6] ? parseInt(m[6], 10) : 0) // ms - ), - }; - } - return null; - } - function parseObject(obj) { - var duration = { - years: obj.years || obj.year || 0, - months: obj.months || obj.month || 0, - days: obj.days || obj.day || 0, - milliseconds: (obj.hours || obj.hour || 0) * 60 * 60 * 1000 + // hours - (obj.minutes || obj.minute || 0) * 60 * 1000 + // minutes - (obj.seconds || obj.second || 0) * 1000 + // seconds - (obj.milliseconds || obj.millisecond || obj.ms || 0), - }; - var weeks = obj.weeks || obj.week; - if (weeks) { - duration.days += weeks * 7; - duration.specifiedWeeks = true; - } - return duration; - } - // Equality - function durationsEqual(d0, d1) { - return d0.years === d1.years && - d0.months === d1.months && - d0.days === d1.days && - d0.milliseconds === d1.milliseconds; - } - function asCleanDays(dur) { - if (!dur.years && !dur.months && !dur.milliseconds) { - return dur.days; - } - return 0; - } - // Simple Math - function addDurations(d0, d1) { - return { - years: d0.years + d1.years, - months: d0.months + d1.months, - days: d0.days + d1.days, - milliseconds: d0.milliseconds + d1.milliseconds, - }; - } - function subtractDurations(d1, d0) { - return { - years: d1.years - d0.years, - months: d1.months - d0.months, - days: d1.days - d0.days, - milliseconds: d1.milliseconds - d0.milliseconds, - }; - } - function multiplyDuration(d, n) { - return { - years: d.years * n, - months: d.months * n, - days: d.days * n, - milliseconds: d.milliseconds * n, - }; - } - // Conversions - // "Rough" because they are based on average-case Gregorian months/years - function asRoughYears(dur) { - return asRoughDays(dur) / 365; - } - function asRoughMonths(dur) { - return asRoughDays(dur) / 30; - } - function asRoughDays(dur) { - return asRoughMs(dur) / 864e5; - } - function asRoughMinutes(dur) { - return asRoughMs(dur) / (1000 * 60); - } - function asRoughSeconds(dur) { - return asRoughMs(dur) / 1000; - } - function asRoughMs(dur) { - return dur.years * (365 * 864e5) + - dur.months * (30 * 864e5) + - dur.days * 864e5 + - dur.milliseconds; - } - // Advanced Math - function wholeDivideDurations(numerator, denominator) { - var res = null; - for (var i = 0; i < INTERNAL_UNITS.length; i += 1) { - var unit = INTERNAL_UNITS[i]; - if (denominator[unit]) { - var localRes = numerator[unit] / denominator[unit]; - if (!isInt(localRes) || (res !== null && res !== localRes)) { - return null; - } - res = localRes; - } - else if (numerator[unit]) { - // needs to divide by something but can't! - return null; - } - } - return res; - } - function greatestDurationDenominator(dur) { - var ms = dur.milliseconds; - if (ms) { - if (ms % 1000 !== 0) { - return { unit: 'millisecond', value: ms }; - } - if (ms % (1000 * 60) !== 0) { - return { unit: 'second', value: ms / 1000 }; - } - if (ms % (1000 * 60 * 60) !== 0) { - return { unit: 'minute', value: ms / (1000 * 60) }; - } - if (ms) { - return { unit: 'hour', value: ms / (1000 * 60 * 60) }; - } - } - if (dur.days) { - if (dur.specifiedWeeks && dur.days % 7 === 0) { - return { unit: 'week', value: dur.days / 7 }; - } - return { unit: 'day', value: dur.days }; - } - if (dur.months) { - return { unit: 'month', value: dur.months }; - } - if (dur.years) { - return { unit: 'year', value: dur.years }; - } - return { unit: 'millisecond', value: 0 }; - } - - // timeZoneOffset is in minutes - function buildIsoString(marker, timeZoneOffset, stripZeroTime) { - if (stripZeroTime === void 0) { stripZeroTime = false; } - var s = marker.toISOString(); - s = s.replace('.000', ''); - if (stripZeroTime) { - s = s.replace('T00:00:00Z', ''); - } - if (s.length > 10) { // time part wasn't stripped, can add timezone info - if (timeZoneOffset == null) { - s = s.replace('Z', ''); - } - else if (timeZoneOffset !== 0) { - s = s.replace('Z', formatTimeZoneOffset(timeZoneOffset, true)); - } - // otherwise, its UTC-0 and we want to keep the Z - } - return s; - } - // formats the date, but with no time part - // TODO: somehow merge with buildIsoString and stripZeroTime - // TODO: rename. omit "string" - function formatDayString(marker) { - return marker.toISOString().replace(/T.*$/, ''); - } - // TODO: use Date::toISOString and use everything after the T? - function formatIsoTimeString(marker) { - return padStart(marker.getUTCHours(), 2) + ':' + - padStart(marker.getUTCMinutes(), 2) + ':' + - padStart(marker.getUTCSeconds(), 2); - } - function formatTimeZoneOffset(minutes, doIso) { - if (doIso === void 0) { doIso = false; } - var sign = minutes < 0 ? '-' : '+'; - var abs = Math.abs(minutes); - var hours = Math.floor(abs / 60); - var mins = Math.round(abs % 60); - if (doIso) { - return sign + padStart(hours, 2) + ":" + padStart(mins, 2); - } - return "GMT" + sign + hours + (mins ? ":" + padStart(mins, 2) : ''); - } - - // TODO: new util arrayify? - function removeExact(array, exactVal) { - var removeCnt = 0; - var i = 0; - while (i < array.length) { - if (array[i] === exactVal) { - array.splice(i, 1); - removeCnt += 1; - } - else { - i += 1; - } - } - return removeCnt; - } - function isArraysEqual(a0, a1, equalityFunc) { - if (a0 === a1) { - return true; - } - var len = a0.length; - var i; - if (len !== a1.length) { // not array? or not same length? - return false; - } - for (i = 0; i < len; i += 1) { - if (!(equalityFunc ? equalityFunc(a0[i], a1[i]) : a0[i] === a1[i])) { - return false; - } - } - return true; - } - - function memoize(workerFunc, resEquality, teardownFunc) { - var currentArgs; - var currentRes; - return function () { - var newArgs = []; - for (var _i = 0; _i < arguments.length; _i++) { - newArgs[_i] = arguments[_i]; - } - if (!currentArgs) { - currentRes = workerFunc.apply(this, newArgs); - } - else if (!isArraysEqual(currentArgs, newArgs)) { - if (teardownFunc) { - teardownFunc(currentRes); - } - var res = workerFunc.apply(this, newArgs); - if (!resEquality || !resEquality(res, currentRes)) { - currentRes = res; - } - } - currentArgs = newArgs; - return currentRes; - }; - } - function memoizeObjArg(workerFunc, resEquality, teardownFunc) { - var _this = this; - var currentArg; - var currentRes; - return function (newArg) { - if (!currentArg) { - currentRes = workerFunc.call(_this, newArg); - } - else if (!isPropsEqual(currentArg, newArg)) { - if (teardownFunc) { - teardownFunc(currentRes); - } - var res = workerFunc.call(_this, newArg); - if (!resEquality || !resEquality(res, currentRes)) { - currentRes = res; - } - } - currentArg = newArg; - return currentRes; - }; - } - function memoizeArraylike(// used at all? - workerFunc, resEquality, teardownFunc) { - var _this = this; - var currentArgSets = []; - var currentResults = []; - return function (newArgSets) { - var currentLen = currentArgSets.length; - var newLen = newArgSets.length; - var i = 0; - for (; i < currentLen; i += 1) { - if (!newArgSets[i]) { // one of the old sets no longer exists - if (teardownFunc) { - teardownFunc(currentResults[i]); - } - } - else if (!isArraysEqual(currentArgSets[i], newArgSets[i])) { - if (teardownFunc) { - teardownFunc(currentResults[i]); - } - var res = workerFunc.apply(_this, newArgSets[i]); - if (!resEquality || !resEquality(res, currentResults[i])) { - currentResults[i] = res; - } - } - } - for (; i < newLen; i += 1) { - currentResults[i] = workerFunc.apply(_this, newArgSets[i]); - } - currentArgSets = newArgSets; - currentResults.splice(newLen); // remove excess - return currentResults; - }; - } - function memoizeHashlike(// used? - workerFunc, resEquality, teardownFunc) { - var _this = this; - var currentArgHash = {}; - var currentResHash = {}; - return function (newArgHash) { - var newResHash = {}; - for (var key in newArgHash) { - if (!currentResHash[key]) { - newResHash[key] = workerFunc.apply(_this, newArgHash[key]); - } - else if (!isArraysEqual(currentArgHash[key], newArgHash[key])) { - if (teardownFunc) { - teardownFunc(currentResHash[key]); - } - var res = workerFunc.apply(_this, newArgHash[key]); - newResHash[key] = (resEquality && resEquality(res, currentResHash[key])) - ? currentResHash[key] - : res; - } - else { - newResHash[key] = currentResHash[key]; - } - } - currentArgHash = newArgHash; - currentResHash = newResHash; - return newResHash; - }; - } - - var EXTENDED_SETTINGS_AND_SEVERITIES = { - week: 3, - separator: 0, - omitZeroMinute: 0, - meridiem: 0, - omitCommas: 0, - }; - var STANDARD_DATE_PROP_SEVERITIES = { - timeZoneName: 7, - era: 6, - year: 5, - month: 4, - day: 2, - weekday: 2, - hour: 1, - minute: 1, - second: 1, - }; - var MERIDIEM_RE = /\s*([ap])\.?m\.?/i; // eats up leading spaces too - var COMMA_RE = /,/g; // we need re for globalness - var MULTI_SPACE_RE = /\s+/g; - var LTR_RE = /\u200e/g; // control character - var UTC_RE = /UTC|GMT/; - var NativeFormatter = /** @class */ (function () { - function NativeFormatter(formatSettings) { - var standardDateProps = {}; - var extendedSettings = {}; - var severity = 0; - for (var name_1 in formatSettings) { - if (name_1 in EXTENDED_SETTINGS_AND_SEVERITIES) { - extendedSettings[name_1] = formatSettings[name_1]; - severity = Math.max(EXTENDED_SETTINGS_AND_SEVERITIES[name_1], severity); - } - else { - standardDateProps[name_1] = formatSettings[name_1]; - if (name_1 in STANDARD_DATE_PROP_SEVERITIES) { // TODO: what about hour12? no severity - severity = Math.max(STANDARD_DATE_PROP_SEVERITIES[name_1], severity); - } - } - } - this.standardDateProps = standardDateProps; - this.extendedSettings = extendedSettings; - this.severity = severity; - this.buildFormattingFunc = memoize(buildFormattingFunc); - } - NativeFormatter.prototype.format = function (date, context) { - return this.buildFormattingFunc(this.standardDateProps, this.extendedSettings, context)(date); - }; - NativeFormatter.prototype.formatRange = function (start, end, context, betterDefaultSeparator) { - var _a = this, standardDateProps = _a.standardDateProps, extendedSettings = _a.extendedSettings; - var diffSeverity = computeMarkerDiffSeverity(start.marker, end.marker, context.calendarSystem); - if (!diffSeverity) { - return this.format(start, context); - } - var biggestUnitForPartial = diffSeverity; - if (biggestUnitForPartial > 1 && // the two dates are different in a way that's larger scale than time - (standardDateProps.year === 'numeric' || standardDateProps.year === '2-digit') && - (standardDateProps.month === 'numeric' || standardDateProps.month === '2-digit') && - (standardDateProps.day === 'numeric' || standardDateProps.day === '2-digit')) { - biggestUnitForPartial = 1; // make it look like the dates are only different in terms of time - } - var full0 = this.format(start, context); - var full1 = this.format(end, context); - if (full0 === full1) { - return full0; - } - var partialDateProps = computePartialFormattingOptions(standardDateProps, biggestUnitForPartial); - var partialFormattingFunc = buildFormattingFunc(partialDateProps, extendedSettings, context); - var partial0 = partialFormattingFunc(start); - var partial1 = partialFormattingFunc(end); - var insertion = findCommonInsertion(full0, partial0, full1, partial1); - var separator = extendedSettings.separator || betterDefaultSeparator || context.defaultSeparator || ''; - if (insertion) { - return insertion.before + partial0 + separator + partial1 + insertion.after; - } - return full0 + separator + full1; - }; - NativeFormatter.prototype.getLargestUnit = function () { - switch (this.severity) { - case 7: - case 6: - case 5: - return 'year'; - case 4: - return 'month'; - case 3: - return 'week'; - case 2: - return 'day'; - default: - return 'time'; // really? - } - }; - return NativeFormatter; - }()); - function buildFormattingFunc(standardDateProps, extendedSettings, context) { - var standardDatePropCnt = Object.keys(standardDateProps).length; - if (standardDatePropCnt === 1 && standardDateProps.timeZoneName === 'short') { - return function (date) { return (formatTimeZoneOffset(date.timeZoneOffset)); }; - } - if (standardDatePropCnt === 0 && extendedSettings.week) { - return function (date) { return (formatWeekNumber(context.computeWeekNumber(date.marker), context.weekText, context.locale, extendedSettings.week)); }; - } - return buildNativeFormattingFunc(standardDateProps, extendedSettings, context); - } - function buildNativeFormattingFunc(standardDateProps, extendedSettings, context) { - standardDateProps = __assign({}, standardDateProps); // copy - extendedSettings = __assign({}, extendedSettings); // copy - sanitizeSettings(standardDateProps, extendedSettings); - standardDateProps.timeZone = 'UTC'; // we leverage the only guaranteed timeZone for our UTC markers - var normalFormat = new Intl.DateTimeFormat(context.locale.codes, standardDateProps); - var zeroFormat; // needed? - if (extendedSettings.omitZeroMinute) { - var zeroProps = __assign({}, standardDateProps); - delete zeroProps.minute; // seconds and ms were already considered in sanitizeSettings - zeroFormat = new Intl.DateTimeFormat(context.locale.codes, zeroProps); - } - return function (date) { - var marker = date.marker; - var format; - if (zeroFormat && !marker.getUTCMinutes()) { - format = zeroFormat; - } - else { - format = normalFormat; - } - var s = format.format(marker); - return postProcess(s, date, standardDateProps, extendedSettings, context); - }; - } - function sanitizeSettings(standardDateProps, extendedSettings) { - // deal with a browser inconsistency where formatting the timezone - // requires that the hour/minute be present. - if (standardDateProps.timeZoneName) { - if (!standardDateProps.hour) { - standardDateProps.hour = '2-digit'; - } - if (!standardDateProps.minute) { - standardDateProps.minute = '2-digit'; - } - } - // only support short timezone names - if (standardDateProps.timeZoneName === 'long') { - standardDateProps.timeZoneName = 'short'; - } - // if requesting to display seconds, MUST display minutes - if (extendedSettings.omitZeroMinute && (standardDateProps.second || standardDateProps.millisecond)) { - delete extendedSettings.omitZeroMinute; - } - } - function postProcess(s, date, standardDateProps, extendedSettings, context) { - s = s.replace(LTR_RE, ''); // remove left-to-right control chars. do first. good for other regexes - if (standardDateProps.timeZoneName === 'short') { - s = injectTzoStr(s, (context.timeZone === 'UTC' || date.timeZoneOffset == null) ? - 'UTC' : // important to normalize for IE, which does "GMT" - formatTimeZoneOffset(date.timeZoneOffset)); - } - if (extendedSettings.omitCommas) { - s = s.replace(COMMA_RE, '').trim(); - } - if (extendedSettings.omitZeroMinute) { - s = s.replace(':00', ''); // zeroFormat doesn't always achieve this - } - // ^ do anything that might create adjacent spaces before this point, - // because MERIDIEM_RE likes to eat up loading spaces - if (extendedSettings.meridiem === false) { - s = s.replace(MERIDIEM_RE, '').trim(); - } - else if (extendedSettings.meridiem === 'narrow') { // a/p - s = s.replace(MERIDIEM_RE, function (m0, m1) { return m1.toLocaleLowerCase(); }); - } - else if (extendedSettings.meridiem === 'short') { // am/pm - s = s.replace(MERIDIEM_RE, function (m0, m1) { return m1.toLocaleLowerCase() + "m"; }); - } - else if (extendedSettings.meridiem === 'lowercase') { // other meridiem transformers already converted to lowercase - s = s.replace(MERIDIEM_RE, function (m0) { return m0.toLocaleLowerCase(); }); - } - s = s.replace(MULTI_SPACE_RE, ' '); - s = s.trim(); - return s; - } - function injectTzoStr(s, tzoStr) { - var replaced = false; - s = s.replace(UTC_RE, function () { - replaced = true; - return tzoStr; - }); - // IE11 doesn't include UTC/GMT in the original string, so append to end - if (!replaced) { - s += " " + tzoStr; - } - return s; - } - function formatWeekNumber(num, weekText, locale, display) { - var parts = []; - if (display === 'narrow') { - parts.push(weekText); - } - else if (display === 'short') { - parts.push(weekText, ' '); - } - // otherwise, considered 'numeric' - parts.push(locale.simpleNumberFormat.format(num)); - if (locale.options.direction === 'rtl') { // TODO: use control characters instead? - parts.reverse(); - } - return parts.join(''); - } - // Range Formatting Utils - // 0 = exactly the same - // 1 = different by time - // and bigger - function computeMarkerDiffSeverity(d0, d1, ca) { - if (ca.getMarkerYear(d0) !== ca.getMarkerYear(d1)) { - return 5; - } - if (ca.getMarkerMonth(d0) !== ca.getMarkerMonth(d1)) { - return 4; - } - if (ca.getMarkerDay(d0) !== ca.getMarkerDay(d1)) { - return 2; - } - if (timeAsMs(d0) !== timeAsMs(d1)) { - return 1; - } - return 0; - } - function computePartialFormattingOptions(options, biggestUnit) { - var partialOptions = {}; - for (var name_2 in options) { - if (!(name_2 in STANDARD_DATE_PROP_SEVERITIES) || // not a date part prop (like timeZone) - STANDARD_DATE_PROP_SEVERITIES[name_2] <= biggestUnit) { - partialOptions[name_2] = options[name_2]; - } - } - return partialOptions; - } - function findCommonInsertion(full0, partial0, full1, partial1) { - var i0 = 0; - while (i0 < full0.length) { - var found0 = full0.indexOf(partial0, i0); - if (found0 === -1) { - break; - } - var before0 = full0.substr(0, found0); - i0 = found0 + partial0.length; - var after0 = full0.substr(i0); - var i1 = 0; - while (i1 < full1.length) { - var found1 = full1.indexOf(partial1, i1); - if (found1 === -1) { - break; - } - var before1 = full1.substr(0, found1); - i1 = found1 + partial1.length; - var after1 = full1.substr(i1); - if (before0 === before1 && after0 === after1) { - return { - before: before0, - after: after0, - }; - } - } - } - return null; - } - - function expandZonedMarker(dateInfo, calendarSystem) { - var a = calendarSystem.markerToArray(dateInfo.marker); - return { - marker: dateInfo.marker, - timeZoneOffset: dateInfo.timeZoneOffset, - array: a, - year: a[0], - month: a[1], - day: a[2], - hour: a[3], - minute: a[4], - second: a[5], - millisecond: a[6], - }; - } - - function createVerboseFormattingArg(start, end, context, betterDefaultSeparator) { - var startInfo = expandZonedMarker(start, context.calendarSystem); - var endInfo = end ? expandZonedMarker(end, context.calendarSystem) : null; - return { - date: startInfo, - start: startInfo, - end: endInfo, - timeZone: context.timeZone, - localeCodes: context.locale.codes, - defaultSeparator: betterDefaultSeparator || context.defaultSeparator, - }; - } - - /* - TODO: fix the terminology of "formatter" vs "formatting func" - */ - /* - At the time of instantiation, this object does not know which cmd-formatting system it will use. - It receives this at the time of formatting, as a setting. - */ - var CmdFormatter = /** @class */ (function () { - function CmdFormatter(cmdStr) { - this.cmdStr = cmdStr; - } - CmdFormatter.prototype.format = function (date, context, betterDefaultSeparator) { - return context.cmdFormatter(this.cmdStr, createVerboseFormattingArg(date, null, context, betterDefaultSeparator)); - }; - CmdFormatter.prototype.formatRange = function (start, end, context, betterDefaultSeparator) { - return context.cmdFormatter(this.cmdStr, createVerboseFormattingArg(start, end, context, betterDefaultSeparator)); - }; - return CmdFormatter; - }()); - - var FuncFormatter = /** @class */ (function () { - function FuncFormatter(func) { - this.func = func; - } - FuncFormatter.prototype.format = function (date, context, betterDefaultSeparator) { - return this.func(createVerboseFormattingArg(date, null, context, betterDefaultSeparator)); - }; - FuncFormatter.prototype.formatRange = function (start, end, context, betterDefaultSeparator) { - return this.func(createVerboseFormattingArg(start, end, context, betterDefaultSeparator)); - }; - return FuncFormatter; - }()); - - function createFormatter(input) { - if (typeof input === 'object' && input) { // non-null object - return new NativeFormatter(input); - } - if (typeof input === 'string') { - return new CmdFormatter(input); - } - if (typeof input === 'function') { - return new FuncFormatter(input); - } - return null; - } - - // base options - // ------------ - var BASE_OPTION_REFINERS = { - navLinkDayClick: identity, - navLinkWeekClick: identity, - duration: createDuration, - bootstrapFontAwesome: identity, - buttonIcons: identity, - customButtons: identity, - defaultAllDayEventDuration: createDuration, - defaultTimedEventDuration: createDuration, - nextDayThreshold: createDuration, - scrollTime: createDuration, - slotMinTime: createDuration, - slotMaxTime: createDuration, - dayPopoverFormat: createFormatter, - slotDuration: createDuration, - snapDuration: createDuration, - headerToolbar: identity, - footerToolbar: identity, - defaultRangeSeparator: String, - titleRangeSeparator: String, - forceEventDuration: Boolean, - dayHeaders: Boolean, - dayHeaderFormat: createFormatter, - dayHeaderClassNames: identity, - dayHeaderContent: identity, - dayHeaderDidMount: identity, - dayHeaderWillUnmount: identity, - dayCellClassNames: identity, - dayCellContent: identity, - dayCellDidMount: identity, - dayCellWillUnmount: identity, - initialView: String, - aspectRatio: Number, - weekends: Boolean, - weekNumberCalculation: identity, - weekNumbers: Boolean, - weekNumberClassNames: identity, - weekNumberContent: identity, - weekNumberDidMount: identity, - weekNumberWillUnmount: identity, - editable: Boolean, - viewClassNames: identity, - viewDidMount: identity, - viewWillUnmount: identity, - nowIndicator: Boolean, - nowIndicatorClassNames: identity, - nowIndicatorContent: identity, - nowIndicatorDidMount: identity, - nowIndicatorWillUnmount: identity, - showNonCurrentDates: Boolean, - lazyFetching: Boolean, - startParam: String, - endParam: String, - timeZoneParam: String, - timeZone: String, - locales: identity, - locale: identity, - themeSystem: String, - dragRevertDuration: Number, - dragScroll: Boolean, - allDayMaintainDuration: Boolean, - unselectAuto: Boolean, - dropAccept: identity, - eventOrder: parseFieldSpecs, - handleWindowResize: Boolean, - windowResizeDelay: Number, - longPressDelay: Number, - eventDragMinDistance: Number, - expandRows: Boolean, - height: identity, - contentHeight: identity, - direction: String, - weekNumberFormat: createFormatter, - eventResizableFromStart: Boolean, - displayEventTime: Boolean, - displayEventEnd: Boolean, - weekText: String, - progressiveEventRendering: Boolean, - businessHours: identity, - initialDate: identity, - now: identity, - eventDataTransform: identity, - stickyHeaderDates: identity, - stickyFooterScrollbar: identity, - viewHeight: identity, - defaultAllDay: Boolean, - eventSourceFailure: identity, - eventSourceSuccess: identity, - eventDisplay: String, - eventStartEditable: Boolean, - eventDurationEditable: Boolean, - eventOverlap: identity, - eventConstraint: identity, - eventAllow: identity, - eventBackgroundColor: String, - eventBorderColor: String, - eventTextColor: String, - eventColor: String, - eventClassNames: identity, - eventContent: identity, - eventDidMount: identity, - eventWillUnmount: identity, - selectConstraint: identity, - selectOverlap: identity, - selectAllow: identity, - droppable: Boolean, - unselectCancel: String, - slotLabelFormat: identity, - slotLaneClassNames: identity, - slotLaneContent: identity, - slotLaneDidMount: identity, - slotLaneWillUnmount: identity, - slotLabelClassNames: identity, - slotLabelContent: identity, - slotLabelDidMount: identity, - slotLabelWillUnmount: identity, - dayMaxEvents: identity, - dayMaxEventRows: identity, - dayMinWidth: Number, - slotLabelInterval: createDuration, - allDayText: String, - allDayClassNames: identity, - allDayContent: identity, - allDayDidMount: identity, - allDayWillUnmount: identity, - slotMinWidth: Number, - navLinks: Boolean, - eventTimeFormat: createFormatter, - rerenderDelay: Number, - moreLinkText: identity, - selectMinDistance: Number, - selectable: Boolean, - selectLongPressDelay: Number, - eventLongPressDelay: Number, - selectMirror: Boolean, - eventMinHeight: Number, - slotEventOverlap: Boolean, - plugins: identity, - firstDay: Number, - dayCount: Number, - dateAlignment: String, - dateIncrement: createDuration, - hiddenDays: identity, - monthMode: Boolean, - fixedWeekCount: Boolean, - validRange: identity, - visibleRange: identity, - titleFormat: identity, - // only used by list-view, but languages define the value, so we need it in base options - noEventsText: String, - }; - // do NOT give a type here. need `typeof BASE_OPTION_DEFAULTS` to give real results. - // raw values. - var BASE_OPTION_DEFAULTS = { - eventDisplay: 'auto', - defaultRangeSeparator: ' - ', - titleRangeSeparator: ' \u2013 ', - defaultTimedEventDuration: '01:00:00', - defaultAllDayEventDuration: { day: 1 }, - forceEventDuration: false, - nextDayThreshold: '00:00:00', - dayHeaders: true, - initialView: '', - aspectRatio: 1.35, - headerToolbar: { - start: 'title', - center: '', - end: 'today prev,next', - }, - weekends: true, - weekNumbers: false, - weekNumberCalculation: 'local', - editable: false, - nowIndicator: false, - scrollTime: '06:00:00', - slotMinTime: '00:00:00', - slotMaxTime: '24:00:00', - showNonCurrentDates: true, - lazyFetching: true, - startParam: 'start', - endParam: 'end', - timeZoneParam: 'timeZone', - timeZone: 'local', - locales: [], - locale: '', - themeSystem: 'standard', - dragRevertDuration: 500, - dragScroll: true, - allDayMaintainDuration: false, - unselectAuto: true, - dropAccept: '*', - eventOrder: 'start,-duration,allDay,title', - dayPopoverFormat: { month: 'long', day: 'numeric', year: 'numeric' }, - handleWindowResize: true, - windowResizeDelay: 100, - longPressDelay: 1000, - eventDragMinDistance: 5, - expandRows: false, - navLinks: false, - selectable: false, - }; - // calendar listeners - // ------------------ - var CALENDAR_LISTENER_REFINERS = { - datesSet: identity, - eventsSet: identity, - eventAdd: identity, - eventChange: identity, - eventRemove: identity, - windowResize: identity, - eventClick: identity, - eventMouseEnter: identity, - eventMouseLeave: identity, - select: identity, - unselect: identity, - loading: identity, - // internal - _unmount: identity, - _beforeprint: identity, - _afterprint: identity, - _noEventDrop: identity, - _noEventResize: identity, - _resize: identity, - _scrollRequest: identity, - }; - // calendar-specific options - // ------------------------- - var CALENDAR_OPTION_REFINERS = { - buttonText: identity, - views: identity, - plugins: identity, - initialEvents: identity, - events: identity, - eventSources: identity, - }; - var COMPLEX_OPTION_COMPARATORS = { - headerToolbar: isBoolComplexEqual, - footerToolbar: isBoolComplexEqual, - buttonText: isBoolComplexEqual, - buttonIcons: isBoolComplexEqual, - }; - function isBoolComplexEqual(a, b) { - if (typeof a === 'object' && typeof b === 'object' && a && b) { // both non-null objects - return isPropsEqual(a, b); - } - return a === b; - } - // view-specific options - // --------------------- - var VIEW_OPTION_REFINERS = { - type: String, - component: identity, - buttonText: String, - buttonTextKey: String, - dateProfileGeneratorClass: identity, - usesMinMaxTime: Boolean, - classNames: identity, - content: identity, - didMount: identity, - willUnmount: identity, - }; - // util funcs - // ---------------------------------------------------------------------------------------------------- - function mergeRawOptions(optionSets) { - return mergeProps(optionSets, COMPLEX_OPTION_COMPARATORS); - } - function refineProps(input, refiners) { - var refined = {}; - var extra = {}; - for (var propName in refiners) { - if (propName in input) { - refined[propName] = refiners[propName](input[propName]); - } - } - for (var propName in input) { - if (!(propName in refiners)) { - extra[propName] = input[propName]; - } - } - return { refined: refined, extra: extra }; - } - function identity(raw) { - return raw; - } - - function parseEvents(rawEvents, eventSource, context, allowOpenRange) { - var eventStore = createEmptyEventStore(); - var eventRefiners = buildEventRefiners(context); - for (var _i = 0, rawEvents_1 = rawEvents; _i < rawEvents_1.length; _i++) { - var rawEvent = rawEvents_1[_i]; - var tuple = parseEvent(rawEvent, eventSource, context, allowOpenRange, eventRefiners); - if (tuple) { - eventTupleToStore(tuple, eventStore); - } - } - return eventStore; - } - function eventTupleToStore(tuple, eventStore) { - if (eventStore === void 0) { eventStore = createEmptyEventStore(); } - eventStore.defs[tuple.def.defId] = tuple.def; - if (tuple.instance) { - eventStore.instances[tuple.instance.instanceId] = tuple.instance; - } - return eventStore; - } - // retrieves events that have the same groupId as the instance specified by `instanceId` - // or they are the same as the instance. - // why might instanceId not be in the store? an event from another calendar? - function getRelevantEvents(eventStore, instanceId) { - var instance = eventStore.instances[instanceId]; - if (instance) { - var def_1 = eventStore.defs[instance.defId]; - // get events/instances with same group - var newStore = filterEventStoreDefs(eventStore, function (lookDef) { return isEventDefsGrouped(def_1, lookDef); }); - // add the original - // TODO: wish we could use eventTupleToStore or something like it - newStore.defs[def_1.defId] = def_1; - newStore.instances[instance.instanceId] = instance; - return newStore; - } - return createEmptyEventStore(); - } - function isEventDefsGrouped(def0, def1) { - return Boolean(def0.groupId && def0.groupId === def1.groupId); - } - function createEmptyEventStore() { - return { defs: {}, instances: {} }; - } - function mergeEventStores(store0, store1) { - return { - defs: __assign(__assign({}, store0.defs), store1.defs), - instances: __assign(__assign({}, store0.instances), store1.instances), - }; - } - function filterEventStoreDefs(eventStore, filterFunc) { - var defs = filterHash(eventStore.defs, filterFunc); - var instances = filterHash(eventStore.instances, function (instance) { return (defs[instance.defId] // still exists? - ); }); - return { defs: defs, instances: instances }; - } - function excludeSubEventStore(master, sub) { - var defs = master.defs, instances = master.instances; - var filteredDefs = {}; - var filteredInstances = {}; - for (var defId in defs) { - if (!sub.defs[defId]) { // not explicitly excluded - filteredDefs[defId] = defs[defId]; - } - } - for (var instanceId in instances) { - if (!sub.instances[instanceId] && // not explicitly excluded - filteredDefs[instances[instanceId].defId] // def wasn't filtered away - ) { - filteredInstances[instanceId] = instances[instanceId]; - } - } - return { - defs: filteredDefs, - instances: filteredInstances, - }; - } - - function normalizeConstraint(input, context) { - if (Array.isArray(input)) { - return parseEvents(input, null, context, true); // allowOpenRange=true - } - if (typeof input === 'object' && input) { // non-null object - return parseEvents([input], null, context, true); // allowOpenRange=true - } - if (input != null) { - return String(input); - } - return null; - } - - function parseClassNames(raw) { - if (Array.isArray(raw)) { - return raw; - } - if (typeof raw === 'string') { - return raw.split(/\s+/); - } - return []; - } - - // TODO: better called "EventSettings" or "EventConfig" - // TODO: move this file into structs - // TODO: separate constraint/overlap/allow, because selection uses only that, not other props - var EVENT_UI_REFINERS = { - display: String, - editable: Boolean, - startEditable: Boolean, - durationEditable: Boolean, - constraint: identity, - overlap: identity, - allow: identity, - className: parseClassNames, - classNames: parseClassNames, - color: String, - backgroundColor: String, - borderColor: String, - textColor: String, - }; - var EMPTY_EVENT_UI = { - display: null, - startEditable: null, - durationEditable: null, - constraints: [], - overlap: null, - allows: [], - backgroundColor: '', - borderColor: '', - textColor: '', - classNames: [], - }; - function createEventUi(refined, context) { - var constraint = normalizeConstraint(refined.constraint, context); - return { - display: refined.display || null, - startEditable: refined.startEditable != null ? refined.startEditable : refined.editable, - durationEditable: refined.durationEditable != null ? refined.durationEditable : refined.editable, - constraints: constraint != null ? [constraint] : [], - overlap: refined.overlap != null ? refined.overlap : null, - allows: refined.allow != null ? [refined.allow] : [], - backgroundColor: refined.backgroundColor || refined.color || '', - borderColor: refined.borderColor || refined.color || '', - textColor: refined.textColor || '', - classNames: (refined.className || []).concat(refined.classNames || []), - }; - } - // TODO: prevent against problems with <2 args! - function combineEventUis(uis) { - return uis.reduce(combineTwoEventUis, EMPTY_EVENT_UI); - } - function combineTwoEventUis(item0, item1) { - return { - display: item1.display != null ? item1.display : item0.display, - startEditable: item1.startEditable != null ? item1.startEditable : item0.startEditable, - durationEditable: item1.durationEditable != null ? item1.durationEditable : item0.durationEditable, - constraints: item0.constraints.concat(item1.constraints), - overlap: typeof item1.overlap === 'boolean' ? item1.overlap : item0.overlap, - allows: item0.allows.concat(item1.allows), - backgroundColor: item1.backgroundColor || item0.backgroundColor, - borderColor: item1.borderColor || item0.borderColor, - textColor: item1.textColor || item0.textColor, - classNames: item0.classNames.concat(item1.classNames), - }; - } - - var EVENT_NON_DATE_REFINERS = { - id: String, - groupId: String, - title: String, - url: String, - }; - var EVENT_DATE_REFINERS = { - start: identity, - end: identity, - date: identity, - allDay: Boolean, - }; - var EVENT_REFINERS = __assign(__assign(__assign({}, EVENT_NON_DATE_REFINERS), EVENT_DATE_REFINERS), { extendedProps: identity }); - function parseEvent(raw, eventSource, context, allowOpenRange, refiners) { - if (refiners === void 0) { refiners = buildEventRefiners(context); } - var _a = refineEventDef(raw, context, refiners), refined = _a.refined, extra = _a.extra; - var defaultAllDay = computeIsDefaultAllDay(eventSource, context); - var recurringRes = parseRecurring(refined, defaultAllDay, context.dateEnv, context.pluginHooks.recurringTypes); - if (recurringRes) { - var def = parseEventDef(refined, extra, eventSource ? eventSource.sourceId : '', recurringRes.allDay, Boolean(recurringRes.duration), context); - def.recurringDef = { - typeId: recurringRes.typeId, - typeData: recurringRes.typeData, - duration: recurringRes.duration, - }; - return { def: def, instance: null }; - } - var singleRes = parseSingle(refined, defaultAllDay, context, allowOpenRange); - if (singleRes) { - var def = parseEventDef(refined, extra, eventSource ? eventSource.sourceId : '', singleRes.allDay, singleRes.hasEnd, context); - var instance = createEventInstance(def.defId, singleRes.range, singleRes.forcedStartTzo, singleRes.forcedEndTzo); - return { def: def, instance: instance }; - } - return null; - } - function refineEventDef(raw, context, refiners) { - if (refiners === void 0) { refiners = buildEventRefiners(context); } - return refineProps(raw, refiners); - } - function buildEventRefiners(context) { - return __assign(__assign(__assign({}, EVENT_UI_REFINERS), EVENT_REFINERS), context.pluginHooks.eventRefiners); - } - /* - Will NOT populate extendedProps with the leftover properties. - Will NOT populate date-related props. - */ - function parseEventDef(refined, extra, sourceId, allDay, hasEnd, context) { - var def = { - title: refined.title || '', - groupId: refined.groupId || '', - publicId: refined.id || '', - url: refined.url || '', - recurringDef: null, - defId: guid(), - sourceId: sourceId, - allDay: allDay, - hasEnd: hasEnd, - ui: createEventUi(refined, context), - extendedProps: __assign(__assign({}, (refined.extendedProps || {})), extra), - }; - for (var _i = 0, _a = context.pluginHooks.eventDefMemberAdders; _i < _a.length; _i++) { - var memberAdder = _a[_i]; - __assign(def, memberAdder(refined)); - } - // help out EventApi from having user modify props - Object.freeze(def.ui.classNames); - Object.freeze(def.extendedProps); - return def; - } - function parseSingle(refined, defaultAllDay, context, allowOpenRange) { - var allDay = refined.allDay; - var startMeta; - var startMarker = null; - var hasEnd = false; - var endMeta; - var endMarker = null; - var startInput = refined.start != null ? refined.start : refined.date; - startMeta = context.dateEnv.createMarkerMeta(startInput); - if (startMeta) { - startMarker = startMeta.marker; - } - else if (!allowOpenRange) { - return null; - } - if (refined.end != null) { - endMeta = context.dateEnv.createMarkerMeta(refined.end); - } - if (allDay == null) { - if (defaultAllDay != null) { - allDay = defaultAllDay; - } - else { - // fall back to the date props LAST - allDay = (!startMeta || startMeta.isTimeUnspecified) && - (!endMeta || endMeta.isTimeUnspecified); - } - } - if (allDay && startMarker) { - startMarker = startOfDay(startMarker); - } - if (endMeta) { - endMarker = endMeta.marker; - if (allDay) { - endMarker = startOfDay(endMarker); - } - if (startMarker && endMarker <= startMarker) { - endMarker = null; - } - } - if (endMarker) { - hasEnd = true; - } - else if (!allowOpenRange) { - hasEnd = context.options.forceEventDuration || false; - endMarker = context.dateEnv.add(startMarker, allDay ? - context.options.defaultAllDayEventDuration : - context.options.defaultTimedEventDuration); - } - return { - allDay: allDay, - hasEnd: hasEnd, - range: { start: startMarker, end: endMarker }, - forcedStartTzo: startMeta ? startMeta.forcedTzo : null, - forcedEndTzo: endMeta ? endMeta.forcedTzo : null, - }; - } - function computeIsDefaultAllDay(eventSource, context) { - var res = null; - if (eventSource) { - res = eventSource.defaultAllDay; - } - if (res == null) { - res = context.options.defaultAllDay; - } - return res; - } - - /* Date stuff that doesn't belong in datelib core - ----------------------------------------------------------------------------------------------------------------------*/ - // given a timed range, computes an all-day range that has the same exact duration, - // but whose start time is aligned with the start of the day. - function computeAlignedDayRange(timedRange) { - var dayCnt = Math.floor(diffDays(timedRange.start, timedRange.end)) || 1; - var start = startOfDay(timedRange.start); - var end = addDays(start, dayCnt); - return { start: start, end: end }; - } - // given a timed range, computes an all-day range based on how for the end date bleeds into the next day - // TODO: give nextDayThreshold a default arg - function computeVisibleDayRange(timedRange, nextDayThreshold) { - if (nextDayThreshold === void 0) { nextDayThreshold = createDuration(0); } - var startDay = null; - var endDay = null; - if (timedRange.end) { - endDay = startOfDay(timedRange.end); - var endTimeMS = timedRange.end.valueOf() - endDay.valueOf(); // # of milliseconds into `endDay` - // If the end time is actually inclusively part of the next day and is equal to or - // beyond the next day threshold, adjust the end to be the exclusive end of `endDay`. - // Otherwise, leaving it as inclusive will cause it to exclude `endDay`. - if (endTimeMS && endTimeMS >= asRoughMs(nextDayThreshold)) { - endDay = addDays(endDay, 1); - } - } - if (timedRange.start) { - startDay = startOfDay(timedRange.start); // the beginning of the day the range starts - // If end is within `startDay` but not past nextDayThreshold, assign the default duration of one day. - if (endDay && endDay <= startDay) { - endDay = addDays(startDay, 1); - } - } - return { start: startDay, end: endDay }; - } - // spans from one day into another? - function isMultiDayRange(range) { - var visibleRange = computeVisibleDayRange(range); - return diffDays(visibleRange.start, visibleRange.end) > 1; - } - function diffDates(date0, date1, dateEnv, largeUnit) { - if (largeUnit === 'year') { - return createDuration(dateEnv.diffWholeYears(date0, date1), 'year'); - } - if (largeUnit === 'month') { - return createDuration(dateEnv.diffWholeMonths(date0, date1), 'month'); - } - return diffDayAndTime(date0, date1); // returns a duration - } - - function parseRange(input, dateEnv) { - var start = null; - var end = null; - if (input.start) { - start = dateEnv.createMarker(input.start); - } - if (input.end) { - end = dateEnv.createMarker(input.end); - } - if (!start && !end) { - return null; - } - if (start && end && end < start) { - return null; - } - return { start: start, end: end }; - } - // SIDE-EFFECT: will mutate ranges. - // Will return a new array result. - function invertRanges(ranges, constraintRange) { - var invertedRanges = []; - var start = constraintRange.start; // the end of the previous range. the start of the new range - var i; - var dateRange; - // ranges need to be in order. required for our date-walking algorithm - ranges.sort(compareRanges); - for (i = 0; i < ranges.length; i += 1) { - dateRange = ranges[i]; - // add the span of time before the event (if there is any) - if (dateRange.start > start) { // compare millisecond time (skip any ambig logic) - invertedRanges.push({ start: start, end: dateRange.start }); - } - if (dateRange.end > start) { - start = dateRange.end; - } - } - // add the span of time after the last event (if there is any) - if (start < constraintRange.end) { // compare millisecond time (skip any ambig logic) - invertedRanges.push({ start: start, end: constraintRange.end }); - } - return invertedRanges; - } - function compareRanges(range0, range1) { - return range0.start.valueOf() - range1.start.valueOf(); // earlier ranges go first - } - function intersectRanges(range0, range1) { - var start = range0.start, end = range0.end; - var newRange = null; - if (range1.start !== null) { - if (start === null) { - start = range1.start; - } - else { - start = new Date(Math.max(start.valueOf(), range1.start.valueOf())); - } - } - if (range1.end != null) { - if (end === null) { - end = range1.end; - } - else { - end = new Date(Math.min(end.valueOf(), range1.end.valueOf())); - } - } - if (start === null || end === null || start < end) { - newRange = { start: start, end: end }; - } - return newRange; - } - function rangesEqual(range0, range1) { - return (range0.start === null ? null : range0.start.valueOf()) === (range1.start === null ? null : range1.start.valueOf()) && - (range0.end === null ? null : range0.end.valueOf()) === (range1.end === null ? null : range1.end.valueOf()); - } - function rangesIntersect(range0, range1) { - return (range0.end === null || range1.start === null || range0.end > range1.start) && - (range0.start === null || range1.end === null || range0.start < range1.end); - } - function rangeContainsRange(outerRange, innerRange) { - return (outerRange.start === null || (innerRange.start !== null && innerRange.start >= outerRange.start)) && - (outerRange.end === null || (innerRange.end !== null && innerRange.end <= outerRange.end)); - } - function rangeContainsMarker(range, date) { - return (range.start === null || date >= range.start) && - (range.end === null || date < range.end); - } - // If the given date is not within the given range, move it inside. - // (If it's past the end, make it one millisecond before the end). - function constrainMarkerToRange(date, range) { - if (range.start != null && date < range.start) { - return range.start; - } - if (range.end != null && date >= range.end) { - return new Date(range.end.valueOf() - 1); - } - return date; - } - - /* - Specifying nextDayThreshold signals that all-day ranges should be sliced. - */ - function sliceEventStore(eventStore, eventUiBases, framingRange, nextDayThreshold) { - var inverseBgByGroupId = {}; - var inverseBgByDefId = {}; - var defByGroupId = {}; - var bgRanges = []; - var fgRanges = []; - var eventUis = compileEventUis(eventStore.defs, eventUiBases); - for (var defId in eventStore.defs) { - var def = eventStore.defs[defId]; - var ui = eventUis[def.defId]; - if (ui.display === 'inverse-background') { - if (def.groupId) { - inverseBgByGroupId[def.groupId] = []; - if (!defByGroupId[def.groupId]) { - defByGroupId[def.groupId] = def; - } - } - else { - inverseBgByDefId[defId] = []; - } - } - } - for (var instanceId in eventStore.instances) { - var instance = eventStore.instances[instanceId]; - var def = eventStore.defs[instance.defId]; - var ui = eventUis[def.defId]; - var origRange = instance.range; - var normalRange = (!def.allDay && nextDayThreshold) ? - computeVisibleDayRange(origRange, nextDayThreshold) : - origRange; - var slicedRange = intersectRanges(normalRange, framingRange); - if (slicedRange) { - if (ui.display === 'inverse-background') { - if (def.groupId) { - inverseBgByGroupId[def.groupId].push(slicedRange); - } - else { - inverseBgByDefId[instance.defId].push(slicedRange); - } - } - else if (ui.display !== 'none') { - (ui.display === 'background' ? bgRanges : fgRanges).push({ - def: def, - ui: ui, - instance: instance, - range: slicedRange, - isStart: normalRange.start && normalRange.start.valueOf() === slicedRange.start.valueOf(), - isEnd: normalRange.end && normalRange.end.valueOf() === slicedRange.end.valueOf(), - }); - } - } - } - for (var groupId in inverseBgByGroupId) { // BY GROUP - var ranges = inverseBgByGroupId[groupId]; - var invertedRanges = invertRanges(ranges, framingRange); - for (var _i = 0, invertedRanges_1 = invertedRanges; _i < invertedRanges_1.length; _i++) { - var invertedRange = invertedRanges_1[_i]; - var def = defByGroupId[groupId]; - var ui = eventUis[def.defId]; - bgRanges.push({ - def: def, - ui: ui, - instance: null, - range: invertedRange, - isStart: false, - isEnd: false, - }); - } - } - for (var defId in inverseBgByDefId) { - var ranges = inverseBgByDefId[defId]; - var invertedRanges = invertRanges(ranges, framingRange); - for (var _a = 0, invertedRanges_2 = invertedRanges; _a < invertedRanges_2.length; _a++) { - var invertedRange = invertedRanges_2[_a]; - bgRanges.push({ - def: eventStore.defs[defId], - ui: eventUis[defId], - instance: null, - range: invertedRange, - isStart: false, - isEnd: false, - }); - } - } - return { bg: bgRanges, fg: fgRanges }; - } - function hasBgRendering(def) { - return def.ui.display === 'background' || def.ui.display === 'inverse-background'; - } - function setElSeg(el, seg) { - el.fcSeg = seg; - } - function getElSeg(el) { - return el.fcSeg || - el.parentNode.fcSeg || // for the harness - null; - } - // event ui computation - function compileEventUis(eventDefs, eventUiBases) { - return mapHash(eventDefs, function (eventDef) { return compileEventUi(eventDef, eventUiBases); }); - } - function compileEventUi(eventDef, eventUiBases) { - var uis = []; - if (eventUiBases['']) { - uis.push(eventUiBases['']); - } - if (eventUiBases[eventDef.defId]) { - uis.push(eventUiBases[eventDef.defId]); - } - uis.push(eventDef.ui); - return combineEventUis(uis); - } - function sortEventSegs(segs, eventOrderSpecs) { - var objs = segs.map(buildSegCompareObj); - objs.sort(function (obj0, obj1) { return compareByFieldSpecs(obj0, obj1, eventOrderSpecs); }); - return objs.map(function (c) { return c._seg; }); - } - // returns a object with all primitive props that can be compared - function buildSegCompareObj(seg) { - var eventRange = seg.eventRange; - var eventDef = eventRange.def; - var range = eventRange.instance ? eventRange.instance.range : eventRange.range; - var start = range.start ? range.start.valueOf() : 0; // TODO: better support for open-range events - var end = range.end ? range.end.valueOf() : 0; // " - return __assign(__assign(__assign({}, eventDef.extendedProps), eventDef), { id: eventDef.publicId, start: start, - end: end, duration: end - start, allDay: Number(eventDef.allDay), _seg: seg }); - } - function computeSegDraggable(seg, context) { - var pluginHooks = context.pluginHooks; - var transformers = pluginHooks.isDraggableTransformers; - var _a = seg.eventRange, def = _a.def, ui = _a.ui; - var val = ui.startEditable; - for (var _i = 0, transformers_1 = transformers; _i < transformers_1.length; _i++) { - var transformer = transformers_1[_i]; - val = transformer(val, def, ui, context); - } - return val; - } - function computeSegStartResizable(seg, context) { - return seg.isStart && seg.eventRange.ui.durationEditable && context.options.eventResizableFromStart; - } - function computeSegEndResizable(seg, context) { - return seg.isEnd && seg.eventRange.ui.durationEditable; - } - function buildSegTimeText(seg, timeFormat, context, defaultDisplayEventTime, // defaults to true - defaultDisplayEventEnd, // defaults to true - startOverride, endOverride) { - var dateEnv = context.dateEnv, options = context.options; - var displayEventTime = options.displayEventTime, displayEventEnd = options.displayEventEnd; - var eventDef = seg.eventRange.def; - var eventInstance = seg.eventRange.instance; - if (displayEventTime == null) { - displayEventTime = defaultDisplayEventTime !== false; - } - if (displayEventEnd == null) { - displayEventEnd = defaultDisplayEventEnd !== false; - } - if (displayEventTime && !eventDef.allDay && (seg.isStart || seg.isEnd)) { - var segStart = startOverride || (seg.isStart ? eventInstance.range.start : (seg.start || seg.eventRange.range.start)); - var segEnd = endOverride || (seg.isEnd ? eventInstance.range.end : (seg.end || seg.eventRange.range.end)); - if (displayEventEnd && eventDef.hasEnd) { - return dateEnv.formatRange(segStart, segEnd, timeFormat, { - forcedStartTzo: startOverride ? null : eventInstance.forcedStartTzo, - forcedEndTzo: endOverride ? null : eventInstance.forcedEndTzo, - }); - } - return dateEnv.format(segStart, timeFormat, { - forcedTzo: startOverride ? null : eventInstance.forcedStartTzo, - }); - } - return ''; - } - function getSegMeta(seg, todayRange, nowDate) { - var segRange = seg.eventRange.range; - return { - isPast: segRange.end < (nowDate || todayRange.start), - isFuture: segRange.start >= (nowDate || todayRange.end), - isToday: todayRange && rangeContainsMarker(todayRange, segRange.start), - }; - } - function getEventClassNames(props) { - var classNames = ['fc-event']; - if (props.isMirror) { - classNames.push('fc-event-mirror'); - } - if (props.isDraggable) { - classNames.push('fc-event-draggable'); - } - if (props.isStartResizable || props.isEndResizable) { - classNames.push('fc-event-resizable'); - } - if (props.isDragging) { - classNames.push('fc-event-dragging'); - } - if (props.isResizing) { - classNames.push('fc-event-resizing'); - } - if (props.isSelected) { - classNames.push('fc-event-selected'); - } - if (props.isStart) { - classNames.push('fc-event-start'); - } - if (props.isEnd) { - classNames.push('fc-event-end'); - } - if (props.isPast) { - classNames.push('fc-event-past'); - } - if (props.isToday) { - classNames.push('fc-event-today'); - } - if (props.isFuture) { - classNames.push('fc-event-future'); - } - return classNames; - } - function buildEventRangeKey(eventRange) { - return eventRange.instance - ? eventRange.instance.instanceId - : eventRange.def.defId + ":" + eventRange.range.start.toISOString(); - // inverse-background events don't have specific instances. TODO: better solution - } - - var STANDARD_PROPS = { - start: identity, - end: identity, - allDay: Boolean, - }; - function parseDateSpan(raw, dateEnv, defaultDuration) { - var span = parseOpenDateSpan(raw, dateEnv); - var range = span.range; - if (!range.start) { - return null; - } - if (!range.end) { - if (defaultDuration == null) { - return null; - } - range.end = dateEnv.add(range.start, defaultDuration); - } - return span; - } - /* - TODO: somehow combine with parseRange? - Will return null if the start/end props were present but parsed invalidly. - */ - function parseOpenDateSpan(raw, dateEnv) { - var _a = refineProps(raw, STANDARD_PROPS), standardProps = _a.refined, extra = _a.extra; - var startMeta = standardProps.start ? dateEnv.createMarkerMeta(standardProps.start) : null; - var endMeta = standardProps.end ? dateEnv.createMarkerMeta(standardProps.end) : null; - var allDay = standardProps.allDay; - if (allDay == null) { - allDay = (startMeta && startMeta.isTimeUnspecified) && - (!endMeta || endMeta.isTimeUnspecified); - } - return __assign({ range: { - start: startMeta ? startMeta.marker : null, - end: endMeta ? endMeta.marker : null, - }, allDay: allDay }, extra); - } - function isDateSpansEqual(span0, span1) { - return rangesEqual(span0.range, span1.range) && - span0.allDay === span1.allDay && - isSpanPropsEqual(span0, span1); - } - // the NON-DATE-RELATED props - function isSpanPropsEqual(span0, span1) { - for (var propName in span1) { - if (propName !== 'range' && propName !== 'allDay') { - if (span0[propName] !== span1[propName]) { - return false; - } - } - } - // are there any props that span0 has that span1 DOESN'T have? - // both have range/allDay, so no need to special-case. - for (var propName in span0) { - if (!(propName in span1)) { - return false; - } - } - return true; - } - function buildDateSpanApi(span, dateEnv) { - return __assign(__assign({}, buildRangeApi(span.range, dateEnv, span.allDay)), { allDay: span.allDay }); - } - function buildRangeApiWithTimeZone(range, dateEnv, omitTime) { - return __assign(__assign({}, buildRangeApi(range, dateEnv, omitTime)), { timeZone: dateEnv.timeZone }); - } - function buildRangeApi(range, dateEnv, omitTime) { - return { - start: dateEnv.toDate(range.start), - end: dateEnv.toDate(range.end), - startStr: dateEnv.formatIso(range.start, { omitTime: omitTime }), - endStr: dateEnv.formatIso(range.end, { omitTime: omitTime }), - }; - } - function fabricateEventRange(dateSpan, eventUiBases, context) { - var res = refineEventDef({ editable: false }, context); - var def = parseEventDef(res.refined, res.extra, '', // sourceId - dateSpan.allDay, true, // hasEnd - context); - return { - def: def, - ui: compileEventUi(def, eventUiBases), - instance: createEventInstance(def.defId, dateSpan.range), - range: dateSpan.range, - isStart: true, - isEnd: true, - }; - } - - function triggerDateSelect(selection, pev, context) { - context.emitter.trigger('select', __assign(__assign({}, buildDateSpanApiWithContext(selection, context)), { jsEvent: pev ? pev.origEvent : null, view: context.viewApi || context.calendarApi.view })); - } - function triggerDateUnselect(pev, context) { - context.emitter.trigger('unselect', { - jsEvent: pev ? pev.origEvent : null, - view: context.viewApi || context.calendarApi.view, - }); - } - function buildDateSpanApiWithContext(dateSpan, context) { - var props = {}; - for (var _i = 0, _a = context.pluginHooks.dateSpanTransforms; _i < _a.length; _i++) { - var transform = _a[_i]; - __assign(props, transform(dateSpan, context)); - } - __assign(props, buildDateSpanApi(dateSpan, context.dateEnv)); - return props; - } - // Given an event's allDay status and start date, return what its fallback end date should be. - // TODO: rename to computeDefaultEventEnd - function getDefaultEventEnd(allDay, marker, context) { - var dateEnv = context.dateEnv, options = context.options; - var end = marker; - if (allDay) { - end = startOfDay(end); - end = dateEnv.add(end, options.defaultAllDayEventDuration); - } - else { - end = dateEnv.add(end, options.defaultTimedEventDuration); - } - return end; - } - - // applies the mutation to ALL defs/instances within the event store - function applyMutationToEventStore(eventStore, eventConfigBase, mutation, context) { - var eventConfigs = compileEventUis(eventStore.defs, eventConfigBase); - var dest = createEmptyEventStore(); - for (var defId in eventStore.defs) { - var def = eventStore.defs[defId]; - dest.defs[defId] = applyMutationToEventDef(def, eventConfigs[defId], mutation, context); - } - for (var instanceId in eventStore.instances) { - var instance = eventStore.instances[instanceId]; - var def = dest.defs[instance.defId]; // important to grab the newly modified def - dest.instances[instanceId] = applyMutationToEventInstance(instance, def, eventConfigs[instance.defId], mutation, context); - } - return dest; - } - function applyMutationToEventDef(eventDef, eventConfig, mutation, context) { - var standardProps = mutation.standardProps || {}; - // if hasEnd has not been specified, guess a good value based on deltas. - // if duration will change, there's no way the default duration will persist, - // and thus, we need to mark the event as having a real end - if (standardProps.hasEnd == null && - eventConfig.durationEditable && - (mutation.startDelta || mutation.endDelta)) { - standardProps.hasEnd = true; // TODO: is this mutation okay? - } - var copy = __assign(__assign(__assign({}, eventDef), standardProps), { ui: __assign(__assign({}, eventDef.ui), standardProps.ui) }); - if (mutation.extendedProps) { - copy.extendedProps = __assign(__assign({}, copy.extendedProps), mutation.extendedProps); - } - for (var _i = 0, _a = context.pluginHooks.eventDefMutationAppliers; _i < _a.length; _i++) { - var applier = _a[_i]; - applier(copy, mutation, context); - } - if (!copy.hasEnd && context.options.forceEventDuration) { - copy.hasEnd = true; - } - return copy; - } - function applyMutationToEventInstance(eventInstance, eventDef, // must first be modified by applyMutationToEventDef - eventConfig, mutation, context) { - var dateEnv = context.dateEnv; - var forceAllDay = mutation.standardProps && mutation.standardProps.allDay === true; - var clearEnd = mutation.standardProps && mutation.standardProps.hasEnd === false; - var copy = __assign({}, eventInstance); - if (forceAllDay) { - copy.range = computeAlignedDayRange(copy.range); - } - if (mutation.datesDelta && eventConfig.startEditable) { - copy.range = { - start: dateEnv.add(copy.range.start, mutation.datesDelta), - end: dateEnv.add(copy.range.end, mutation.datesDelta), - }; - } - if (mutation.startDelta && eventConfig.durationEditable) { - copy.range = { - start: dateEnv.add(copy.range.start, mutation.startDelta), - end: copy.range.end, - }; - } - if (mutation.endDelta && eventConfig.durationEditable) { - copy.range = { - start: copy.range.start, - end: dateEnv.add(copy.range.end, mutation.endDelta), - }; - } - if (clearEnd) { - copy.range = { - start: copy.range.start, - end: getDefaultEventEnd(eventDef.allDay, copy.range.start, context), - }; - } - // in case event was all-day but the supplied deltas were not - // better util for this? - if (eventDef.allDay) { - copy.range = { - start: startOfDay(copy.range.start), - end: startOfDay(copy.range.end), - }; - } - // handle invalid durations - if (copy.range.end < copy.range.start) { - copy.range.end = getDefaultEventEnd(eventDef.allDay, copy.range.start, context); - } - return copy; - } - - // no public types yet. when there are, export from: - // import {} from './api-type-deps' - var ViewApi = /** @class */ (function () { - function ViewApi(type, getCurrentData, dateEnv) { - this.type = type; - this.getCurrentData = getCurrentData; - this.dateEnv = dateEnv; - } - Object.defineProperty(ViewApi.prototype, "calendar", { - get: function () { - return this.getCurrentData().calendarApi; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ViewApi.prototype, "title", { - get: function () { - return this.getCurrentData().viewTitle; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ViewApi.prototype, "activeStart", { - get: function () { - return this.dateEnv.toDate(this.getCurrentData().dateProfile.activeRange.start); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ViewApi.prototype, "activeEnd", { - get: function () { - return this.dateEnv.toDate(this.getCurrentData().dateProfile.activeRange.end); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ViewApi.prototype, "currentStart", { - get: function () { - return this.dateEnv.toDate(this.getCurrentData().dateProfile.currentRange.start); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ViewApi.prototype, "currentEnd", { - get: function () { - return this.dateEnv.toDate(this.getCurrentData().dateProfile.currentRange.end); - }, - enumerable: false, - configurable: true - }); - ViewApi.prototype.getOption = function (name) { - return this.getCurrentData().options[name]; // are the view-specific options - }; - return ViewApi; - }()); - - var EVENT_SOURCE_REFINERS = { - id: String, - defaultAllDay: Boolean, - url: String, - format: String, - events: identity, - eventDataTransform: identity, - // for any network-related sources - success: identity, - failure: identity, - }; - function parseEventSource(raw, context, refiners) { - if (refiners === void 0) { refiners = buildEventSourceRefiners(context); } - var rawObj; - if (typeof raw === 'string') { - rawObj = { url: raw }; - } - else if (typeof raw === 'function' || Array.isArray(raw)) { - rawObj = { events: raw }; - } - else if (typeof raw === 'object' && raw) { // not null - rawObj = raw; - } - if (rawObj) { - var _a = refineProps(rawObj, refiners), refined = _a.refined, extra = _a.extra; - var metaRes = buildEventSourceMeta(refined, context); - if (metaRes) { - return { - _raw: raw, - isFetching: false, - latestFetchId: '', - fetchRange: null, - defaultAllDay: refined.defaultAllDay, - eventDataTransform: refined.eventDataTransform, - success: refined.success, - failure: refined.failure, - publicId: refined.id || '', - sourceId: guid(), - sourceDefId: metaRes.sourceDefId, - meta: metaRes.meta, - ui: createEventUi(refined, context), - extendedProps: extra, - }; - } - } - return null; - } - function buildEventSourceRefiners(context) { - return __assign(__assign(__assign({}, EVENT_UI_REFINERS), EVENT_SOURCE_REFINERS), context.pluginHooks.eventSourceRefiners); - } - function buildEventSourceMeta(raw, context) { - var defs = context.pluginHooks.eventSourceDefs; - for (var i = defs.length - 1; i >= 0; i -= 1) { // later-added plugins take precedence - var def = defs[i]; - var meta = def.parseMeta(raw); - if (meta) { - return { sourceDefId: i, meta: meta }; - } - } - return null; - } - - function reduceCurrentDate(currentDate, action) { - switch (action.type) { - case 'CHANGE_DATE': - return action.dateMarker; - default: - return currentDate; - } - } - function getInitialDate(options, dateEnv) { - var initialDateInput = options.initialDate; - // compute the initial ambig-timezone date - if (initialDateInput != null) { - return dateEnv.createMarker(initialDateInput); - } - return getNow(options.now, dateEnv); // getNow already returns unzoned - } - function getNow(nowInput, dateEnv) { - if (typeof nowInput === 'function') { - nowInput = nowInput(); - } - if (nowInput == null) { - return dateEnv.createNowMarker(); - } - return dateEnv.createMarker(nowInput); - } - - var CalendarApi = /** @class */ (function () { - function CalendarApi() { - } - CalendarApi.prototype.getCurrentData = function () { - return this.currentDataManager.getCurrentData(); - }; - CalendarApi.prototype.dispatch = function (action) { - return this.currentDataManager.dispatch(action); - }; - Object.defineProperty(CalendarApi.prototype, "view", { - get: function () { return this.getCurrentData().viewApi; } // for public API - , - enumerable: false, - configurable: true - }); - CalendarApi.prototype.batchRendering = function (callback) { - callback(); - }; - CalendarApi.prototype.updateSize = function () { - this.trigger('_resize', true); - }; - // Options - // ----------------------------------------------------------------------------------------------------------------- - CalendarApi.prototype.setOption = function (name, val) { - this.dispatch({ - type: 'SET_OPTION', - optionName: name, - rawOptionValue: val, - }); - }; - CalendarApi.prototype.getOption = function (name) { - return this.currentDataManager.currentCalendarOptionsInput[name]; - }; - CalendarApi.prototype.getAvailableLocaleCodes = function () { - return Object.keys(this.getCurrentData().availableRawLocales); - }; - // Trigger - // ----------------------------------------------------------------------------------------------------------------- - CalendarApi.prototype.on = function (handlerName, handler) { - var currentDataManager = this.currentDataManager; - if (currentDataManager.currentCalendarOptionsRefiners[handlerName]) { - currentDataManager.emitter.on(handlerName, handler); - } - else { - console.warn("Unknown listener name '" + handlerName + "'"); - } - }; - CalendarApi.prototype.off = function (handlerName, handler) { - this.currentDataManager.emitter.off(handlerName, handler); - }; - // not meant for public use - CalendarApi.prototype.trigger = function (handlerName) { - var _a; - var args = []; - for (var _i = 1; _i < arguments.length; _i++) { - args[_i - 1] = arguments[_i]; - } - (_a = this.currentDataManager.emitter).trigger.apply(_a, __spreadArrays([handlerName], args)); - }; - // View - // ----------------------------------------------------------------------------------------------------------------- - CalendarApi.prototype.changeView = function (viewType, dateOrRange) { - var _this = this; - this.batchRendering(function () { - _this.unselect(); - if (dateOrRange) { - if (dateOrRange.start && dateOrRange.end) { // a range - _this.dispatch({ - type: 'CHANGE_VIEW_TYPE', - viewType: viewType, - }); - _this.dispatch({ - type: 'SET_OPTION', - optionName: 'visibleRange', - rawOptionValue: dateOrRange, - }); - } - else { - var dateEnv = _this.getCurrentData().dateEnv; - _this.dispatch({ - type: 'CHANGE_VIEW_TYPE', - viewType: viewType, - dateMarker: dateEnv.createMarker(dateOrRange), - }); - } - } - else { - _this.dispatch({ - type: 'CHANGE_VIEW_TYPE', - viewType: viewType, - }); - } - }); - }; - // Forces navigation to a view for the given date. - // `viewType` can be a specific view name or a generic one like "week" or "day". - // needs to change - CalendarApi.prototype.zoomTo = function (dateMarker, viewType) { - var state = this.getCurrentData(); - var spec; - viewType = viewType || 'day'; // day is default zoom - spec = state.viewSpecs[viewType] || this.getUnitViewSpec(viewType); - this.unselect(); - if (spec) { - this.dispatch({ - type: 'CHANGE_VIEW_TYPE', - viewType: spec.type, - dateMarker: dateMarker, - }); - } - else { - this.dispatch({ - type: 'CHANGE_DATE', - dateMarker: dateMarker, - }); - } - }; - // Given a duration singular unit, like "week" or "day", finds a matching view spec. - // Preference is given to views that have corresponding buttons. - CalendarApi.prototype.getUnitViewSpec = function (unit) { - var _a = this.getCurrentData(), viewSpecs = _a.viewSpecs, toolbarConfig = _a.toolbarConfig; - var viewTypes = [].concat(toolbarConfig.viewsWithButtons); - var i; - var spec; - for (var viewType in viewSpecs) { - viewTypes.push(viewType); - } - for (i = 0; i < viewTypes.length; i += 1) { - spec = viewSpecs[viewTypes[i]]; - if (spec) { - if (spec.singleUnit === unit) { - return spec; - } - } - } - return null; - }; - // Current Date - // ----------------------------------------------------------------------------------------------------------------- - CalendarApi.prototype.prev = function () { - this.unselect(); - this.dispatch({ type: 'PREV' }); - }; - CalendarApi.prototype.next = function () { - this.unselect(); - this.dispatch({ type: 'NEXT' }); - }; - CalendarApi.prototype.prevYear = function () { - var state = this.getCurrentData(); - this.unselect(); - this.dispatch({ - type: 'CHANGE_DATE', - dateMarker: state.dateEnv.addYears(state.currentDate, -1), - }); - }; - CalendarApi.prototype.nextYear = function () { - var state = this.getCurrentData(); - this.unselect(); - this.dispatch({ - type: 'CHANGE_DATE', - dateMarker: state.dateEnv.addYears(state.currentDate, 1), - }); - }; - CalendarApi.prototype.today = function () { - var state = this.getCurrentData(); - this.unselect(); - this.dispatch({ - type: 'CHANGE_DATE', - dateMarker: getNow(state.calendarOptions.now, state.dateEnv), - }); - }; - CalendarApi.prototype.gotoDate = function (zonedDateInput) { - var state = this.getCurrentData(); - this.unselect(); - this.dispatch({ - type: 'CHANGE_DATE', - dateMarker: state.dateEnv.createMarker(zonedDateInput), - }); - }; - CalendarApi.prototype.incrementDate = function (deltaInput) { - var state = this.getCurrentData(); - var delta = createDuration(deltaInput); - if (delta) { // else, warn about invalid input? - this.unselect(); - this.dispatch({ - type: 'CHANGE_DATE', - dateMarker: state.dateEnv.add(state.currentDate, delta), - }); - } - }; - // for external API - CalendarApi.prototype.getDate = function () { - var state = this.getCurrentData(); - return state.dateEnv.toDate(state.currentDate); - }; - // Date Formatting Utils - // ----------------------------------------------------------------------------------------------------------------- - CalendarApi.prototype.formatDate = function (d, formatter) { - var dateEnv = this.getCurrentData().dateEnv; - return dateEnv.format(dateEnv.createMarker(d), createFormatter(formatter)); - }; - // `settings` is for formatter AND isEndExclusive - CalendarApi.prototype.formatRange = function (d0, d1, settings) { - var dateEnv = this.getCurrentData().dateEnv; - return dateEnv.formatRange(dateEnv.createMarker(d0), dateEnv.createMarker(d1), createFormatter(settings), settings); - }; - CalendarApi.prototype.formatIso = function (d, omitTime) { - var dateEnv = this.getCurrentData().dateEnv; - return dateEnv.formatIso(dateEnv.createMarker(d), { omitTime: omitTime }); - }; - // Date Selection / Event Selection / DayClick - // ----------------------------------------------------------------------------------------------------------------- - // this public method receives start/end dates in any format, with any timezone - // NOTE: args were changed from v3 - CalendarApi.prototype.select = function (dateOrObj, endDate) { - var selectionInput; - if (endDate == null) { - if (dateOrObj.start != null) { - selectionInput = dateOrObj; - } - else { - selectionInput = { - start: dateOrObj, - end: null, - }; - } - } - else { - selectionInput = { - start: dateOrObj, - end: endDate, - }; - } - var state = this.getCurrentData(); - var selection = parseDateSpan(selectionInput, state.dateEnv, createDuration({ days: 1 })); - if (selection) { // throw parse error otherwise? - this.dispatch({ type: 'SELECT_DATES', selection: selection }); - triggerDateSelect(selection, null, state); - } - }; - // public method - CalendarApi.prototype.unselect = function (pev) { - var state = this.getCurrentData(); - if (state.dateSelection) { - this.dispatch({ type: 'UNSELECT_DATES' }); - triggerDateUnselect(pev, state); - } - }; - // Public Events API - // ----------------------------------------------------------------------------------------------------------------- - CalendarApi.prototype.addEvent = function (eventInput, sourceInput) { - if (eventInput instanceof EventApi) { - var def = eventInput._def; - var instance = eventInput._instance; - var currentData = this.getCurrentData(); - // not already present? don't want to add an old snapshot - if (!currentData.eventStore.defs[def.defId]) { - this.dispatch({ - type: 'ADD_EVENTS', - eventStore: eventTupleToStore({ def: def, instance: instance }), - }); - this.triggerEventAdd(eventInput); - } - return eventInput; - } - var state = this.getCurrentData(); - var eventSource; - if (sourceInput instanceof EventSourceApi) { - eventSource = sourceInput.internalEventSource; - } - else if (typeof sourceInput === 'boolean') { - if (sourceInput) { // true. part of the first event source - eventSource = hashValuesToArray(state.eventSources)[0]; - } - } - else if (sourceInput != null) { // an ID. accepts a number too - var sourceApi = this.getEventSourceById(sourceInput); // TODO: use an internal function - if (!sourceApi) { - console.warn("Could not find an event source with ID \"" + sourceInput + "\""); // TODO: test - return null; - } - eventSource = sourceApi.internalEventSource; - } - var tuple = parseEvent(eventInput, eventSource, state, false); - if (tuple) { - var newEventApi = new EventApi(state, tuple.def, tuple.def.recurringDef ? null : tuple.instance); - this.dispatch({ - type: 'ADD_EVENTS', - eventStore: eventTupleToStore(tuple), - }); - this.triggerEventAdd(newEventApi); - return newEventApi; - } - return null; - }; - CalendarApi.prototype.triggerEventAdd = function (eventApi) { - var _this = this; - var emitter = this.getCurrentData().emitter; - emitter.trigger('eventAdd', { - event: eventApi, - relatedEvents: [], - revert: function () { - _this.dispatch({ - type: 'REMOVE_EVENTS', - eventStore: eventApiToStore(eventApi), - }); - }, - }); - }; - // TODO: optimize - CalendarApi.prototype.getEventById = function (id) { - var state = this.getCurrentData(); - var _a = state.eventStore, defs = _a.defs, instances = _a.instances; - id = String(id); - for (var defId in defs) { - var def = defs[defId]; - if (def.publicId === id) { - if (def.recurringDef) { - return new EventApi(state, def, null); - } - for (var instanceId in instances) { - var instance = instances[instanceId]; - if (instance.defId === def.defId) { - return new EventApi(state, def, instance); - } - } - } - } - return null; - }; - CalendarApi.prototype.getEvents = function () { - var currentData = this.getCurrentData(); - return buildEventApis(currentData.eventStore, currentData); - }; - CalendarApi.prototype.removeAllEvents = function () { - this.dispatch({ type: 'REMOVE_ALL_EVENTS' }); - }; - // Public Event Sources API - // ----------------------------------------------------------------------------------------------------------------- - CalendarApi.prototype.getEventSources = function () { - var state = this.getCurrentData(); - var sourceHash = state.eventSources; - var sourceApis = []; - for (var internalId in sourceHash) { - sourceApis.push(new EventSourceApi(state, sourceHash[internalId])); - } - return sourceApis; - }; - CalendarApi.prototype.getEventSourceById = function (id) { - var state = this.getCurrentData(); - var sourceHash = state.eventSources; - id = String(id); - for (var sourceId in sourceHash) { - if (sourceHash[sourceId].publicId === id) { - return new EventSourceApi(state, sourceHash[sourceId]); - } - } - return null; - }; - CalendarApi.prototype.addEventSource = function (sourceInput) { - var state = this.getCurrentData(); - if (sourceInput instanceof EventSourceApi) { - // not already present? don't want to add an old snapshot - if (!state.eventSources[sourceInput.internalEventSource.sourceId]) { - this.dispatch({ - type: 'ADD_EVENT_SOURCES', - sources: [sourceInput.internalEventSource], - }); - } - return sourceInput; - } - var eventSource = parseEventSource(sourceInput, state); - if (eventSource) { // TODO: error otherwise? - this.dispatch({ type: 'ADD_EVENT_SOURCES', sources: [eventSource] }); - return new EventSourceApi(state, eventSource); - } - return null; - }; - CalendarApi.prototype.removeAllEventSources = function () { - this.dispatch({ type: 'REMOVE_ALL_EVENT_SOURCES' }); - }; - CalendarApi.prototype.refetchEvents = function () { - this.dispatch({ type: 'FETCH_EVENT_SOURCES' }); - }; - // Scroll - // ----------------------------------------------------------------------------------------------------------------- - CalendarApi.prototype.scrollToTime = function (timeInput) { - var time = createDuration(timeInput); - if (time) { - this.trigger('_scrollRequest', { time: time }); - } - }; - return CalendarApi; - }()); - - var EventApi = /** @class */ (function () { - // instance will be null if expressing a recurring event that has no current instances, - // OR if trying to validate an incoming external event that has no dates assigned - function EventApi(context, def, instance) { - this._context = context; - this._def = def; - this._instance = instance || null; - } - /* - TODO: make event struct more responsible for this - */ - EventApi.prototype.setProp = function (name, val) { - var _a, _b; - if (name in EVENT_DATE_REFINERS) { - console.warn('Could not set date-related prop \'name\'. Use one of the date-related methods instead.'); - } - else if (name in EVENT_NON_DATE_REFINERS) { - val = EVENT_NON_DATE_REFINERS[name](val); - this.mutate({ - standardProps: (_a = {}, _a[name] = val, _a), - }); - } - else if (name in EVENT_UI_REFINERS) { - var ui = EVENT_UI_REFINERS[name](val); - if (name === 'color') { - ui = { backgroundColor: val, borderColor: val }; - } - else if (name === 'editable') { - ui = { startEditable: val, durationEditable: val }; - } - else { - ui = (_b = {}, _b[name] = val, _b); - } - this.mutate({ - standardProps: { ui: ui }, - }); - } - else { - console.warn("Could not set prop '" + name + "'. Use setExtendedProp instead."); - } - }; - EventApi.prototype.setExtendedProp = function (name, val) { - var _a; - this.mutate({ - extendedProps: (_a = {}, _a[name] = val, _a), - }); - }; - EventApi.prototype.setStart = function (startInput, options) { - if (options === void 0) { options = {}; } - var dateEnv = this._context.dateEnv; - var start = dateEnv.createMarker(startInput); - if (start && this._instance) { // TODO: warning if parsed bad - var instanceRange = this._instance.range; - var startDelta = diffDates(instanceRange.start, start, dateEnv, options.granularity); // what if parsed bad!? - if (options.maintainDuration) { - this.mutate({ datesDelta: startDelta }); - } - else { - this.mutate({ startDelta: startDelta }); - } - } - }; - EventApi.prototype.setEnd = function (endInput, options) { - if (options === void 0) { options = {}; } - var dateEnv = this._context.dateEnv; - var end; - if (endInput != null) { - end = dateEnv.createMarker(endInput); - if (!end) { - return; // TODO: warning if parsed bad - } - } - if (this._instance) { - if (end) { - var endDelta = diffDates(this._instance.range.end, end, dateEnv, options.granularity); - this.mutate({ endDelta: endDelta }); - } - else { - this.mutate({ standardProps: { hasEnd: false } }); - } - } - }; - EventApi.prototype.setDates = function (startInput, endInput, options) { - if (options === void 0) { options = {}; } - var dateEnv = this._context.dateEnv; - var standardProps = { allDay: options.allDay }; - var start = dateEnv.createMarker(startInput); - var end; - if (!start) { - return; // TODO: warning if parsed bad - } - if (endInput != null) { - end = dateEnv.createMarker(endInput); - if (!end) { // TODO: warning if parsed bad - return; - } - } - if (this._instance) { - var instanceRange = this._instance.range; - // when computing the diff for an event being converted to all-day, - // compute diff off of the all-day values the way event-mutation does. - if (options.allDay === true) { - instanceRange = computeAlignedDayRange(instanceRange); - } - var startDelta = diffDates(instanceRange.start, start, dateEnv, options.granularity); - if (end) { - var endDelta = diffDates(instanceRange.end, end, dateEnv, options.granularity); - if (durationsEqual(startDelta, endDelta)) { - this.mutate({ datesDelta: startDelta, standardProps: standardProps }); - } - else { - this.mutate({ startDelta: startDelta, endDelta: endDelta, standardProps: standardProps }); - } - } - else { // means "clear the end" - standardProps.hasEnd = false; - this.mutate({ datesDelta: startDelta, standardProps: standardProps }); - } - } - }; - EventApi.prototype.moveStart = function (deltaInput) { - var delta = createDuration(deltaInput); - if (delta) { // TODO: warning if parsed bad - this.mutate({ startDelta: delta }); - } - }; - EventApi.prototype.moveEnd = function (deltaInput) { - var delta = createDuration(deltaInput); - if (delta) { // TODO: warning if parsed bad - this.mutate({ endDelta: delta }); - } - }; - EventApi.prototype.moveDates = function (deltaInput) { - var delta = createDuration(deltaInput); - if (delta) { // TODO: warning if parsed bad - this.mutate({ datesDelta: delta }); - } - }; - EventApi.prototype.setAllDay = function (allDay, options) { - if (options === void 0) { options = {}; } - var standardProps = { allDay: allDay }; - var maintainDuration = options.maintainDuration; - if (maintainDuration == null) { - maintainDuration = this._context.options.allDayMaintainDuration; - } - if (this._def.allDay !== allDay) { - standardProps.hasEnd = maintainDuration; - } - this.mutate({ standardProps: standardProps }); - }; - EventApi.prototype.formatRange = function (formatInput) { - var dateEnv = this._context.dateEnv; - var instance = this._instance; - var formatter = createFormatter(formatInput); - if (this._def.hasEnd) { - return dateEnv.formatRange(instance.range.start, instance.range.end, formatter, { - forcedStartTzo: instance.forcedStartTzo, - forcedEndTzo: instance.forcedEndTzo, - }); - } - return dateEnv.format(instance.range.start, formatter, { - forcedTzo: instance.forcedStartTzo, - }); - }; - EventApi.prototype.mutate = function (mutation) { - var instance = this._instance; - if (instance) { - var def = this._def; - var context_1 = this._context; - var eventStore_1 = context_1.getCurrentData().eventStore; - var relevantEvents = getRelevantEvents(eventStore_1, instance.instanceId); - var eventConfigBase = { - '': { - display: '', - startEditable: true, - durationEditable: true, - constraints: [], - overlap: null, - allows: [], - backgroundColor: '', - borderColor: '', - textColor: '', - classNames: [], - }, - }; - relevantEvents = applyMutationToEventStore(relevantEvents, eventConfigBase, mutation, context_1); - var oldEvent = new EventApi(context_1, def, instance); // snapshot - this._def = relevantEvents.defs[def.defId]; - this._instance = relevantEvents.instances[instance.instanceId]; - context_1.dispatch({ - type: 'MERGE_EVENTS', - eventStore: relevantEvents, - }); - context_1.emitter.trigger('eventChange', { - oldEvent: oldEvent, - event: this, - relatedEvents: buildEventApis(relevantEvents, context_1, instance), - revert: function () { - context_1.dispatch({ - type: 'RESET_EVENTS', - eventStore: eventStore_1, - }); - }, - }); - } - }; - EventApi.prototype.remove = function () { - var context = this._context; - var asStore = eventApiToStore(this); - context.dispatch({ - type: 'REMOVE_EVENTS', - eventStore: asStore, - }); - context.emitter.trigger('eventRemove', { - event: this, - relatedEvents: [], - revert: function () { - context.dispatch({ - type: 'MERGE_EVENTS', - eventStore: asStore, - }); - }, - }); - }; - Object.defineProperty(EventApi.prototype, "source", { - get: function () { - var sourceId = this._def.sourceId; - if (sourceId) { - return new EventSourceApi(this._context, this._context.getCurrentData().eventSources[sourceId]); - } - return null; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(EventApi.prototype, "start", { - get: function () { - return this._instance ? - this._context.dateEnv.toDate(this._instance.range.start) : - null; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(EventApi.prototype, "end", { - get: function () { - return (this._instance && this._def.hasEnd) ? - this._context.dateEnv.toDate(this._instance.range.end) : - null; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(EventApi.prototype, "startStr", { - get: function () { - var instance = this._instance; - if (instance) { - return this._context.dateEnv.formatIso(instance.range.start, { - omitTime: this._def.allDay, - forcedTzo: instance.forcedStartTzo, - }); - } - return ''; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(EventApi.prototype, "endStr", { - get: function () { - var instance = this._instance; - if (instance && this._def.hasEnd) { - return this._context.dateEnv.formatIso(instance.range.end, { - omitTime: this._def.allDay, - forcedTzo: instance.forcedEndTzo, - }); - } - return ''; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(EventApi.prototype, "id", { - // computable props that all access the def - // TODO: find a TypeScript-compatible way to do this at scale - get: function () { return this._def.publicId; }, - enumerable: false, - configurable: true - }); - Object.defineProperty(EventApi.prototype, "groupId", { - get: function () { return this._def.groupId; }, - enumerable: false, - configurable: true - }); - Object.defineProperty(EventApi.prototype, "allDay", { - get: function () { return this._def.allDay; }, - enumerable: false, - configurable: true - }); - Object.defineProperty(EventApi.prototype, "title", { - get: function () { return this._def.title; }, - enumerable: false, - configurable: true - }); - Object.defineProperty(EventApi.prototype, "url", { - get: function () { return this._def.url; }, - enumerable: false, - configurable: true - }); - Object.defineProperty(EventApi.prototype, "display", { - get: function () { return this._def.ui.display || 'auto'; } // bad. just normalize the type earlier - , - enumerable: false, - configurable: true - }); - Object.defineProperty(EventApi.prototype, "startEditable", { - get: function () { return this._def.ui.startEditable; }, - enumerable: false, - configurable: true - }); - Object.defineProperty(EventApi.prototype, "durationEditable", { - get: function () { return this._def.ui.durationEditable; }, - enumerable: false, - configurable: true - }); - Object.defineProperty(EventApi.prototype, "constraint", { - get: function () { return this._def.ui.constraints[0] || null; }, - enumerable: false, - configurable: true - }); - Object.defineProperty(EventApi.prototype, "overlap", { - get: function () { return this._def.ui.overlap; }, - enumerable: false, - configurable: true - }); - Object.defineProperty(EventApi.prototype, "allow", { - get: function () { return this._def.ui.allows[0] || null; }, - enumerable: false, - configurable: true - }); - Object.defineProperty(EventApi.prototype, "backgroundColor", { - get: function () { return this._def.ui.backgroundColor; }, - enumerable: false, - configurable: true - }); - Object.defineProperty(EventApi.prototype, "borderColor", { - get: function () { return this._def.ui.borderColor; }, - enumerable: false, - configurable: true - }); - Object.defineProperty(EventApi.prototype, "textColor", { - get: function () { return this._def.ui.textColor; }, - enumerable: false, - configurable: true - }); - Object.defineProperty(EventApi.prototype, "classNames", { - // NOTE: user can't modify these because Object.freeze was called in event-def parsing - get: function () { return this._def.ui.classNames; }, - enumerable: false, - configurable: true - }); - Object.defineProperty(EventApi.prototype, "extendedProps", { - get: function () { return this._def.extendedProps; }, - enumerable: false, - configurable: true - }); - EventApi.prototype.toPlainObject = function (settings) { - if (settings === void 0) { settings = {}; } - var def = this._def; - var ui = def.ui; - var _a = this, startStr = _a.startStr, endStr = _a.endStr; - var res = {}; - if (def.title) { - res.title = def.title; - } - if (startStr) { - res.start = startStr; - } - if (endStr) { - res.end = endStr; - } - if (def.publicId) { - res.id = def.publicId; - } - if (def.groupId) { - res.groupId = def.groupId; - } - if (def.url) { - res.url = def.url; - } - if (ui.display && ui.display !== 'auto') { - res.display = ui.display; - } - // TODO: what about recurring-event properties??? - // TODO: include startEditable/durationEditable/constraint/overlap/allow - if (settings.collapseColor && ui.backgroundColor && ui.backgroundColor === ui.borderColor) { - res.color = ui.backgroundColor; - } - else { - if (ui.backgroundColor) { - res.backgroundColor = ui.backgroundColor; - } - if (ui.borderColor) { - res.borderColor = ui.borderColor; - } - } - if (ui.textColor) { - res.textColor = ui.textColor; - } - if (ui.classNames.length) { - res.classNames = ui.classNames; - } - if (Object.keys(def.extendedProps).length) { - if (settings.collapseExtendedProps) { - __assign(res, def.extendedProps); - } - else { - res.extendedProps = def.extendedProps; - } - } - return res; - }; - EventApi.prototype.toJSON = function () { - return this.toPlainObject(); - }; - return EventApi; - }()); - function eventApiToStore(eventApi) { - var _a, _b; - var def = eventApi._def; - var instance = eventApi._instance; - return { - defs: (_a = {}, _a[def.defId] = def, _a), - instances: instance - ? (_b = {}, _b[instance.instanceId] = instance, _b) : {}, - }; - } - function buildEventApis(eventStore, context, excludeInstance) { - var defs = eventStore.defs, instances = eventStore.instances; - var eventApis = []; - var excludeInstanceId = excludeInstance ? excludeInstance.instanceId : ''; - for (var id in instances) { - var instance = instances[id]; - var def = defs[instance.defId]; - if (instance.instanceId !== excludeInstanceId) { - eventApis.push(new EventApi(context, def, instance)); - } - } - return eventApis; - } - - var calendarSystemClassMap = {}; - function registerCalendarSystem(name, theClass) { - calendarSystemClassMap[name] = theClass; - } - function createCalendarSystem(name) { - return new calendarSystemClassMap[name](); - } - var GregorianCalendarSystem = /** @class */ (function () { - function GregorianCalendarSystem() { - } - GregorianCalendarSystem.prototype.getMarkerYear = function (d) { - return d.getUTCFullYear(); - }; - GregorianCalendarSystem.prototype.getMarkerMonth = function (d) { - return d.getUTCMonth(); - }; - GregorianCalendarSystem.prototype.getMarkerDay = function (d) { - return d.getUTCDate(); - }; - GregorianCalendarSystem.prototype.arrayToMarker = function (arr) { - return arrayToUtcDate(arr); - }; - GregorianCalendarSystem.prototype.markerToArray = function (marker) { - return dateToUtcArray(marker); - }; - return GregorianCalendarSystem; - }()); - registerCalendarSystem('gregory', GregorianCalendarSystem); - - var ISO_RE = /^\s*(\d{4})(-?(\d{2})(-?(\d{2})([T ](\d{2}):?(\d{2})(:?(\d{2})(\.(\d+))?)?(Z|(([-+])(\d{2})(:?(\d{2}))?))?)?)?)?$/; - function parse(str) { - var m = ISO_RE.exec(str); - if (m) { - var marker = new Date(Date.UTC(Number(m[1]), m[3] ? Number(m[3]) - 1 : 0, Number(m[5] || 1), Number(m[7] || 0), Number(m[8] || 0), Number(m[10] || 0), m[12] ? Number("0." + m[12]) * 1000 : 0)); - if (isValidDate(marker)) { - var timeZoneOffset = null; - if (m[13]) { - timeZoneOffset = (m[15] === '-' ? -1 : 1) * (Number(m[16] || 0) * 60 + - Number(m[18] || 0)); - } - return { - marker: marker, - isTimeUnspecified: !m[6], - timeZoneOffset: timeZoneOffset, - }; - } - } - return null; - } - - var DateEnv = /** @class */ (function () { - function DateEnv(settings) { - var timeZone = this.timeZone = settings.timeZone; - var isNamedTimeZone = timeZone !== 'local' && timeZone !== 'UTC'; - if (settings.namedTimeZoneImpl && isNamedTimeZone) { - this.namedTimeZoneImpl = new settings.namedTimeZoneImpl(timeZone); - } - this.canComputeOffset = Boolean(!isNamedTimeZone || this.namedTimeZoneImpl); - this.calendarSystem = createCalendarSystem(settings.calendarSystem); - this.locale = settings.locale; - this.weekDow = settings.locale.week.dow; - this.weekDoy = settings.locale.week.doy; - if (settings.weekNumberCalculation === 'ISO') { - this.weekDow = 1; - this.weekDoy = 4; - } - if (typeof settings.firstDay === 'number') { - this.weekDow = settings.firstDay; - } - if (typeof settings.weekNumberCalculation === 'function') { - this.weekNumberFunc = settings.weekNumberCalculation; - } - this.weekText = settings.weekText != null ? settings.weekText : settings.locale.options.weekText; - this.cmdFormatter = settings.cmdFormatter; - this.defaultSeparator = settings.defaultSeparator; - } - // Creating / Parsing - DateEnv.prototype.createMarker = function (input) { - var meta = this.createMarkerMeta(input); - if (meta === null) { - return null; - } - return meta.marker; - }; - DateEnv.prototype.createNowMarker = function () { - if (this.canComputeOffset) { - return this.timestampToMarker(new Date().valueOf()); - } - // if we can't compute the current date val for a timezone, - // better to give the current local date vals than UTC - return arrayToUtcDate(dateToLocalArray(new Date())); - }; - DateEnv.prototype.createMarkerMeta = function (input) { - if (typeof input === 'string') { - return this.parse(input); - } - var marker = null; - if (typeof input === 'number') { - marker = this.timestampToMarker(input); - } - else if (input instanceof Date) { - input = input.valueOf(); - if (!isNaN(input)) { - marker = this.timestampToMarker(input); - } - } - else if (Array.isArray(input)) { - marker = arrayToUtcDate(input); - } - if (marker === null || !isValidDate(marker)) { - return null; - } - return { marker: marker, isTimeUnspecified: false, forcedTzo: null }; - }; - DateEnv.prototype.parse = function (s) { - var parts = parse(s); - if (parts === null) { - return null; - } - var marker = parts.marker; - var forcedTzo = null; - if (parts.timeZoneOffset !== null) { - if (this.canComputeOffset) { - marker = this.timestampToMarker(marker.valueOf() - parts.timeZoneOffset * 60 * 1000); - } - else { - forcedTzo = parts.timeZoneOffset; - } - } - return { marker: marker, isTimeUnspecified: parts.isTimeUnspecified, forcedTzo: forcedTzo }; - }; - // Accessors - DateEnv.prototype.getYear = function (marker) { - return this.calendarSystem.getMarkerYear(marker); - }; - DateEnv.prototype.getMonth = function (marker) { - return this.calendarSystem.getMarkerMonth(marker); - }; - // Adding / Subtracting - DateEnv.prototype.add = function (marker, dur) { - var a = this.calendarSystem.markerToArray(marker); - a[0] += dur.years; - a[1] += dur.months; - a[2] += dur.days; - a[6] += dur.milliseconds; - return this.calendarSystem.arrayToMarker(a); - }; - DateEnv.prototype.subtract = function (marker, dur) { - var a = this.calendarSystem.markerToArray(marker); - a[0] -= dur.years; - a[1] -= dur.months; - a[2] -= dur.days; - a[6] -= dur.milliseconds; - return this.calendarSystem.arrayToMarker(a); - }; - DateEnv.prototype.addYears = function (marker, n) { - var a = this.calendarSystem.markerToArray(marker); - a[0] += n; - return this.calendarSystem.arrayToMarker(a); - }; - DateEnv.prototype.addMonths = function (marker, n) { - var a = this.calendarSystem.markerToArray(marker); - a[1] += n; - return this.calendarSystem.arrayToMarker(a); - }; - // Diffing Whole Units - DateEnv.prototype.diffWholeYears = function (m0, m1) { - var calendarSystem = this.calendarSystem; - if (timeAsMs(m0) === timeAsMs(m1) && - calendarSystem.getMarkerDay(m0) === calendarSystem.getMarkerDay(m1) && - calendarSystem.getMarkerMonth(m0) === calendarSystem.getMarkerMonth(m1)) { - return calendarSystem.getMarkerYear(m1) - calendarSystem.getMarkerYear(m0); - } - return null; - }; - DateEnv.prototype.diffWholeMonths = function (m0, m1) { - var calendarSystem = this.calendarSystem; - if (timeAsMs(m0) === timeAsMs(m1) && - calendarSystem.getMarkerDay(m0) === calendarSystem.getMarkerDay(m1)) { - return (calendarSystem.getMarkerMonth(m1) - calendarSystem.getMarkerMonth(m0)) + - (calendarSystem.getMarkerYear(m1) - calendarSystem.getMarkerYear(m0)) * 12; - } - return null; - }; - // Range / Duration - DateEnv.prototype.greatestWholeUnit = function (m0, m1) { - var n = this.diffWholeYears(m0, m1); - if (n !== null) { - return { unit: 'year', value: n }; - } - n = this.diffWholeMonths(m0, m1); - if (n !== null) { - return { unit: 'month', value: n }; - } - n = diffWholeWeeks(m0, m1); - if (n !== null) { - return { unit: 'week', value: n }; - } - n = diffWholeDays(m0, m1); - if (n !== null) { - return { unit: 'day', value: n }; - } - n = diffHours(m0, m1); - if (isInt(n)) { - return { unit: 'hour', value: n }; - } - n = diffMinutes(m0, m1); - if (isInt(n)) { - return { unit: 'minute', value: n }; - } - n = diffSeconds(m0, m1); - if (isInt(n)) { - return { unit: 'second', value: n }; - } - return { unit: 'millisecond', value: m1.valueOf() - m0.valueOf() }; - }; - DateEnv.prototype.countDurationsBetween = function (m0, m1, d) { - // TODO: can use greatestWholeUnit - var diff; - if (d.years) { - diff = this.diffWholeYears(m0, m1); - if (diff !== null) { - return diff / asRoughYears(d); - } - } - if (d.months) { - diff = this.diffWholeMonths(m0, m1); - if (diff !== null) { - return diff / asRoughMonths(d); - } - } - if (d.days) { - diff = diffWholeDays(m0, m1); - if (diff !== null) { - return diff / asRoughDays(d); - } - } - return (m1.valueOf() - m0.valueOf()) / asRoughMs(d); - }; - // Start-Of - // these DON'T return zoned-dates. only UTC start-of dates - DateEnv.prototype.startOf = function (m, unit) { - if (unit === 'year') { - return this.startOfYear(m); - } - if (unit === 'month') { - return this.startOfMonth(m); - } - if (unit === 'week') { - return this.startOfWeek(m); - } - if (unit === 'day') { - return startOfDay(m); - } - if (unit === 'hour') { - return startOfHour(m); - } - if (unit === 'minute') { - return startOfMinute(m); - } - if (unit === 'second') { - return startOfSecond(m); - } - return null; - }; - DateEnv.prototype.startOfYear = function (m) { - return this.calendarSystem.arrayToMarker([ - this.calendarSystem.getMarkerYear(m), - ]); - }; - DateEnv.prototype.startOfMonth = function (m) { - return this.calendarSystem.arrayToMarker([ - this.calendarSystem.getMarkerYear(m), - this.calendarSystem.getMarkerMonth(m), - ]); - }; - DateEnv.prototype.startOfWeek = function (m) { - return this.calendarSystem.arrayToMarker([ - this.calendarSystem.getMarkerYear(m), - this.calendarSystem.getMarkerMonth(m), - m.getUTCDate() - ((m.getUTCDay() - this.weekDow + 7) % 7), - ]); - }; - // Week Number - DateEnv.prototype.computeWeekNumber = function (marker) { - if (this.weekNumberFunc) { - return this.weekNumberFunc(this.toDate(marker)); - } - return weekOfYear(marker, this.weekDow, this.weekDoy); - }; - // TODO: choke on timeZoneName: long - DateEnv.prototype.format = function (marker, formatter, dateOptions) { - if (dateOptions === void 0) { dateOptions = {}; } - return formatter.format({ - marker: marker, - timeZoneOffset: dateOptions.forcedTzo != null ? - dateOptions.forcedTzo : - this.offsetForMarker(marker), - }, this); - }; - DateEnv.prototype.formatRange = function (start, end, formatter, dateOptions) { - if (dateOptions === void 0) { dateOptions = {}; } - if (dateOptions.isEndExclusive) { - end = addMs(end, -1); - } - return formatter.formatRange({ - marker: start, - timeZoneOffset: dateOptions.forcedStartTzo != null ? - dateOptions.forcedStartTzo : - this.offsetForMarker(start), - }, { - marker: end, - timeZoneOffset: dateOptions.forcedEndTzo != null ? - dateOptions.forcedEndTzo : - this.offsetForMarker(end), - }, this, dateOptions.defaultSeparator); - }; - /* - DUMB: the omitTime arg is dumb. if we omit the time, we want to omit the timezone offset. and if we do that, - might as well use buildIsoString or some other util directly - */ - DateEnv.prototype.formatIso = function (marker, extraOptions) { - if (extraOptions === void 0) { extraOptions = {}; } - var timeZoneOffset = null; - if (!extraOptions.omitTimeZoneOffset) { - if (extraOptions.forcedTzo != null) { - timeZoneOffset = extraOptions.forcedTzo; - } - else { - timeZoneOffset = this.offsetForMarker(marker); - } - } - return buildIsoString(marker, timeZoneOffset, extraOptions.omitTime); - }; - // TimeZone - DateEnv.prototype.timestampToMarker = function (ms) { - if (this.timeZone === 'local') { - return arrayToUtcDate(dateToLocalArray(new Date(ms))); - } - if (this.timeZone === 'UTC' || !this.namedTimeZoneImpl) { - return new Date(ms); - } - return arrayToUtcDate(this.namedTimeZoneImpl.timestampToArray(ms)); - }; - DateEnv.prototype.offsetForMarker = function (m) { - if (this.timeZone === 'local') { - return -arrayToLocalDate(dateToUtcArray(m)).getTimezoneOffset(); // convert "inverse" offset to "normal" offset - } - if (this.timeZone === 'UTC') { - return 0; - } - if (this.namedTimeZoneImpl) { - return this.namedTimeZoneImpl.offsetForArray(dateToUtcArray(m)); - } - return null; - }; - // Conversion - DateEnv.prototype.toDate = function (m, forcedTzo) { - if (this.timeZone === 'local') { - return arrayToLocalDate(dateToUtcArray(m)); - } - if (this.timeZone === 'UTC') { - return new Date(m.valueOf()); // make sure it's a copy - } - if (!this.namedTimeZoneImpl) { - return new Date(m.valueOf() - (forcedTzo || 0)); - } - return new Date(m.valueOf() - - this.namedTimeZoneImpl.offsetForArray(dateToUtcArray(m)) * 1000 * 60); - }; - return DateEnv; - }()); - - var globalLocales = []; - - var RAW_EN_LOCALE = { - code: 'en', - week: { - dow: 0, - doy: 4, - }, - direction: 'ltr', - buttonText: { - prev: 'prev', - next: 'next', - prevYear: 'prev year', - nextYear: 'next year', - year: 'year', - today: 'today', - month: 'month', - week: 'week', - day: 'day', - list: 'list', - }, - weekText: 'W', - allDayText: 'all-day', - moreLinkText: 'more', - noEventsText: 'No events to display', - }; - function organizeRawLocales(explicitRawLocales) { - var defaultCode = explicitRawLocales.length > 0 ? explicitRawLocales[0].code : 'en'; - var allRawLocales = globalLocales.concat(explicitRawLocales); - var rawLocaleMap = { - en: RAW_EN_LOCALE, - }; - for (var _i = 0, allRawLocales_1 = allRawLocales; _i < allRawLocales_1.length; _i++) { - var rawLocale = allRawLocales_1[_i]; - rawLocaleMap[rawLocale.code] = rawLocale; - } - return { - map: rawLocaleMap, - defaultCode: defaultCode, - }; - } - function buildLocale(inputSingular, available) { - if (typeof inputSingular === 'object' && !Array.isArray(inputSingular)) { - return parseLocale(inputSingular.code, [inputSingular.code], inputSingular); - } - return queryLocale(inputSingular, available); - } - function queryLocale(codeArg, available) { - var codes = [].concat(codeArg || []); // will convert to array - var raw = queryRawLocale(codes, available) || RAW_EN_LOCALE; - return parseLocale(codeArg, codes, raw); - } - function queryRawLocale(codes, available) { - for (var i = 0; i < codes.length; i += 1) { - var parts = codes[i].toLocaleLowerCase().split('-'); - for (var j = parts.length; j > 0; j -= 1) { - var simpleId = parts.slice(0, j).join('-'); - if (available[simpleId]) { - return available[simpleId]; - } - } - } - return null; - } - function parseLocale(codeArg, codes, raw) { - var merged = mergeProps([RAW_EN_LOCALE, raw], ['buttonText']); - delete merged.code; // don't want this part of the options - var week = merged.week; - delete merged.week; - return { - codeArg: codeArg, - codes: codes, - week: week, - simpleNumberFormat: new Intl.NumberFormat(codeArg), - options: merged, - }; - } - - function formatDate(dateInput, options) { - if (options === void 0) { options = {}; } - var dateEnv = buildDateEnv(options); - var formatter = createFormatter(options); - var dateMeta = dateEnv.createMarkerMeta(dateInput); - if (!dateMeta) { // TODO: warning? - return ''; - } - return dateEnv.format(dateMeta.marker, formatter, { - forcedTzo: dateMeta.forcedTzo, - }); - } - function formatRange(startInput, endInput, options) { - var dateEnv = buildDateEnv(typeof options === 'object' && options ? options : {}); // pass in if non-null object - var formatter = createFormatter(options); - var startMeta = dateEnv.createMarkerMeta(startInput); - var endMeta = dateEnv.createMarkerMeta(endInput); - if (!startMeta || !endMeta) { // TODO: warning? - return ''; - } - return dateEnv.formatRange(startMeta.marker, endMeta.marker, formatter, { - forcedStartTzo: startMeta.forcedTzo, - forcedEndTzo: endMeta.forcedTzo, - isEndExclusive: options.isEndExclusive, - defaultSeparator: BASE_OPTION_DEFAULTS.defaultRangeSeparator, - }); - } - // TODO: more DRY and optimized - function buildDateEnv(settings) { - var locale = buildLocale(settings.locale || 'en', organizeRawLocales([]).map); // TODO: don't hardcode 'en' everywhere - return new DateEnv(__assign(__assign({ timeZone: BASE_OPTION_DEFAULTS.timeZone, calendarSystem: 'gregory' }, settings), { locale: locale })); - } - - var DEF_DEFAULTS = { - startTime: '09:00', - endTime: '17:00', - daysOfWeek: [1, 2, 3, 4, 5], - display: 'inverse-background', - classNames: 'fc-non-business', - groupId: '_businessHours', - }; - /* - TODO: pass around as EventDefHash!!! - */ - function parseBusinessHours(input, context) { - return parseEvents(refineInputs(input), null, context); - } - function refineInputs(input) { - var rawDefs; - if (input === true) { - rawDefs = [{}]; // will get DEF_DEFAULTS verbatim - } - else if (Array.isArray(input)) { - // if specifying an array, every sub-definition NEEDS a day-of-week - rawDefs = input.filter(function (rawDef) { return rawDef.daysOfWeek; }); - } - else if (typeof input === 'object' && input) { // non-null object - rawDefs = [input]; - } - else { // is probably false - rawDefs = []; - } - rawDefs = rawDefs.map(function (rawDef) { return (__assign(__assign({}, DEF_DEFAULTS), rawDef)); }); - return rawDefs; - } - - function pointInsideRect(point, rect) { - return point.left >= rect.left && - point.left < rect.right && - point.top >= rect.top && - point.top < rect.bottom; - } - // Returns a new rectangle that is the intersection of the two rectangles. If they don't intersect, returns false - function intersectRects(rect1, rect2) { - var res = { - left: Math.max(rect1.left, rect2.left), - right: Math.min(rect1.right, rect2.right), - top: Math.max(rect1.top, rect2.top), - bottom: Math.min(rect1.bottom, rect2.bottom), - }; - if (res.left < res.right && res.top < res.bottom) { - return res; - } - return false; - } - function translateRect(rect, deltaX, deltaY) { - return { - left: rect.left + deltaX, - right: rect.right + deltaX, - top: rect.top + deltaY, - bottom: rect.bottom + deltaY, - }; - } - // Returns a new point that will have been moved to reside within the given rectangle - function constrainPoint(point, rect) { - return { - left: Math.min(Math.max(point.left, rect.left), rect.right), - top: Math.min(Math.max(point.top, rect.top), rect.bottom), - }; - } - // Returns a point that is the center of the given rectangle - function getRectCenter(rect) { - return { - left: (rect.left + rect.right) / 2, - top: (rect.top + rect.bottom) / 2, - }; - } - // Subtracts point2's coordinates from point1's coordinates, returning a delta - function diffPoints(point1, point2) { - return { - left: point1.left - point2.left, - top: point1.top - point2.top, - }; - } - - var canVGrowWithinCell; - function getCanVGrowWithinCell() { - if (canVGrowWithinCell == null) { - canVGrowWithinCell = computeCanVGrowWithinCell(); - } - return canVGrowWithinCell; - } - function computeCanVGrowWithinCell() { - // for SSR, because this function is call immediately at top-level - // TODO: just make this logic execute top-level, immediately, instead of doing lazily - if (typeof document === 'undefined') { - return true; - } - var el = document.createElement('div'); - el.style.position = 'absolute'; - el.style.top = '0px'; - el.style.left = '0px'; - el.innerHTML = '<table><tr><td><div></div></td></tr></table>'; - el.querySelector('table').style.height = '100px'; - el.querySelector('div').style.height = '100%'; - document.body.appendChild(el); - var div = el.querySelector('div'); - var possible = div.offsetHeight > 0; - document.body.removeChild(el); - return possible; - } - - var EMPTY_EVENT_STORE = createEmptyEventStore(); // for purecomponents. TODO: keep elsewhere - var Splitter = /** @class */ (function () { - function Splitter() { - this.getKeysForEventDefs = memoize(this._getKeysForEventDefs); - this.splitDateSelection = memoize(this._splitDateSpan); - this.splitEventStore = memoize(this._splitEventStore); - this.splitIndividualUi = memoize(this._splitIndividualUi); - this.splitEventDrag = memoize(this._splitInteraction); - this.splitEventResize = memoize(this._splitInteraction); - this.eventUiBuilders = {}; // TODO: typescript protection - } - Splitter.prototype.splitProps = function (props) { - var _this = this; - var keyInfos = this.getKeyInfo(props); - var defKeys = this.getKeysForEventDefs(props.eventStore); - var dateSelections = this.splitDateSelection(props.dateSelection); - var individualUi = this.splitIndividualUi(props.eventUiBases, defKeys); // the individual *bases* - var eventStores = this.splitEventStore(props.eventStore, defKeys); - var eventDrags = this.splitEventDrag(props.eventDrag); - var eventResizes = this.splitEventResize(props.eventResize); - var splitProps = {}; - this.eventUiBuilders = mapHash(keyInfos, function (info, key) { return _this.eventUiBuilders[key] || memoize(buildEventUiForKey); }); - for (var key in keyInfos) { - var keyInfo = keyInfos[key]; - var eventStore = eventStores[key] || EMPTY_EVENT_STORE; - var buildEventUi = this.eventUiBuilders[key]; - splitProps[key] = { - businessHours: keyInfo.businessHours || props.businessHours, - dateSelection: dateSelections[key] || null, - eventStore: eventStore, - eventUiBases: buildEventUi(props.eventUiBases[''], keyInfo.ui, individualUi[key]), - eventSelection: eventStore.instances[props.eventSelection] ? props.eventSelection : '', - eventDrag: eventDrags[key] || null, - eventResize: eventResizes[key] || null, - }; - } - return splitProps; - }; - Splitter.prototype._splitDateSpan = function (dateSpan) { - var dateSpans = {}; - if (dateSpan) { - var keys = this.getKeysForDateSpan(dateSpan); - for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) { - var key = keys_1[_i]; - dateSpans[key] = dateSpan; - } - } - return dateSpans; - }; - Splitter.prototype._getKeysForEventDefs = function (eventStore) { - var _this = this; - return mapHash(eventStore.defs, function (eventDef) { return _this.getKeysForEventDef(eventDef); }); - }; - Splitter.prototype._splitEventStore = function (eventStore, defKeys) { - var defs = eventStore.defs, instances = eventStore.instances; - var splitStores = {}; - for (var defId in defs) { - for (var _i = 0, _a = defKeys[defId]; _i < _a.length; _i++) { - var key = _a[_i]; - if (!splitStores[key]) { - splitStores[key] = createEmptyEventStore(); - } - splitStores[key].defs[defId] = defs[defId]; - } - } - for (var instanceId in instances) { - var instance = instances[instanceId]; - for (var _b = 0, _c = defKeys[instance.defId]; _b < _c.length; _b++) { - var key = _c[_b]; - if (splitStores[key]) { // must have already been created - splitStores[key].instances[instanceId] = instance; - } - } - } - return splitStores; - }; - Splitter.prototype._splitIndividualUi = function (eventUiBases, defKeys) { - var splitHashes = {}; - for (var defId in eventUiBases) { - if (defId) { // not the '' key - for (var _i = 0, _a = defKeys[defId]; _i < _a.length; _i++) { - var key = _a[_i]; - if (!splitHashes[key]) { - splitHashes[key] = {}; - } - splitHashes[key][defId] = eventUiBases[defId]; - } - } - } - return splitHashes; - }; - Splitter.prototype._splitInteraction = function (interaction) { - var splitStates = {}; - if (interaction) { - var affectedStores_1 = this._splitEventStore(interaction.affectedEvents, this._getKeysForEventDefs(interaction.affectedEvents)); - // can't rely on defKeys because event data is mutated - var mutatedKeysByDefId = this._getKeysForEventDefs(interaction.mutatedEvents); - var mutatedStores_1 = this._splitEventStore(interaction.mutatedEvents, mutatedKeysByDefId); - var populate = function (key) { - if (!splitStates[key]) { - splitStates[key] = { - affectedEvents: affectedStores_1[key] || EMPTY_EVENT_STORE, - mutatedEvents: mutatedStores_1[key] || EMPTY_EVENT_STORE, - isEvent: interaction.isEvent, - }; - } - }; - for (var key in affectedStores_1) { - populate(key); - } - for (var key in mutatedStores_1) { - populate(key); - } - } - return splitStates; - }; - return Splitter; - }()); - function buildEventUiForKey(allUi, eventUiForKey, individualUi) { - var baseParts = []; - if (allUi) { - baseParts.push(allUi); - } - if (eventUiForKey) { - baseParts.push(eventUiForKey); - } - var stuff = { - '': combineEventUis(baseParts), - }; - if (individualUi) { - __assign(stuff, individualUi); - } - return stuff; - } - - function getDateMeta(date, todayRange, nowDate, dateProfile) { - return { - dow: date.getUTCDay(), - isDisabled: Boolean(dateProfile && !rangeContainsMarker(dateProfile.activeRange, date)), - isOther: Boolean(dateProfile && !rangeContainsMarker(dateProfile.currentRange, date)), - isToday: Boolean(todayRange && rangeContainsMarker(todayRange, date)), - isPast: Boolean(nowDate ? (date < nowDate) : todayRange ? (date < todayRange.start) : false), - isFuture: Boolean(nowDate ? (date > nowDate) : todayRange ? (date >= todayRange.end) : false), - }; - } - function getDayClassNames(meta, theme) { - var classNames = [ - 'fc-day', - "fc-day-" + DAY_IDS[meta.dow], - ]; - if (meta.isDisabled) { - classNames.push('fc-day-disabled'); - } - else { - if (meta.isToday) { - classNames.push('fc-day-today'); - classNames.push(theme.getClass('today')); - } - if (meta.isPast) { - classNames.push('fc-day-past'); - } - if (meta.isFuture) { - classNames.push('fc-day-future'); - } - if (meta.isOther) { - classNames.push('fc-day-other'); - } - } - return classNames; - } - function getSlotClassNames(meta, theme) { - var classNames = [ - 'fc-slot', - "fc-slot-" + DAY_IDS[meta.dow], - ]; - if (meta.isDisabled) { - classNames.push('fc-slot-disabled'); - } - else { - if (meta.isToday) { - classNames.push('fc-slot-today'); - classNames.push(theme.getClass('today')); - } - if (meta.isPast) { - classNames.push('fc-slot-past'); - } - if (meta.isFuture) { - classNames.push('fc-slot-future'); - } - } - return classNames; - } - - function buildNavLinkData(date, type) { - if (type === void 0) { type = 'day'; } - return JSON.stringify({ - date: formatDayString(date), - type: type, - }); - } - - var _isRtlScrollbarOnLeft = null; - function getIsRtlScrollbarOnLeft() { - if (_isRtlScrollbarOnLeft === null) { - _isRtlScrollbarOnLeft = computeIsRtlScrollbarOnLeft(); - } - return _isRtlScrollbarOnLeft; - } - function computeIsRtlScrollbarOnLeft() { - var outerEl = document.createElement('div'); - applyStyle(outerEl, { - position: 'absolute', - top: -1000, - left: 0, - border: 0, - padding: 0, - overflow: 'scroll', - direction: 'rtl', - }); - outerEl.innerHTML = '<div></div>'; - document.body.appendChild(outerEl); - var innerEl = outerEl.firstChild; - var res = innerEl.getBoundingClientRect().left > outerEl.getBoundingClientRect().left; - removeElement(outerEl); - return res; - } - - var _scrollbarWidths; - function getScrollbarWidths() { - if (!_scrollbarWidths) { - _scrollbarWidths = computeScrollbarWidths(); - } - return _scrollbarWidths; - } - function computeScrollbarWidths() { - var el = document.createElement('div'); - el.style.overflow = 'scroll'; - el.style.position = 'absolute'; - el.style.top = '-9999px'; - el.style.left = '-9999px'; - document.body.appendChild(el); - var res = computeScrollbarWidthsForEl(el); - document.body.removeChild(el); - return res; - } - // WARNING: will include border - function computeScrollbarWidthsForEl(el) { - return { - x: el.offsetHeight - el.clientHeight, - y: el.offsetWidth - el.clientWidth, - }; - } - - function computeEdges(el, getPadding) { - if (getPadding === void 0) { getPadding = false; } - var computedStyle = window.getComputedStyle(el); - var borderLeft = parseInt(computedStyle.borderLeftWidth, 10) || 0; - var borderRight = parseInt(computedStyle.borderRightWidth, 10) || 0; - var borderTop = parseInt(computedStyle.borderTopWidth, 10) || 0; - var borderBottom = parseInt(computedStyle.borderBottomWidth, 10) || 0; - var badScrollbarWidths = computeScrollbarWidthsForEl(el); // includes border! - var scrollbarLeftRight = badScrollbarWidths.y - borderLeft - borderRight; - var scrollbarBottom = badScrollbarWidths.x - borderTop - borderBottom; - var res = { - borderLeft: borderLeft, - borderRight: borderRight, - borderTop: borderTop, - borderBottom: borderBottom, - scrollbarBottom: scrollbarBottom, - scrollbarLeft: 0, - scrollbarRight: 0, - }; - if (getIsRtlScrollbarOnLeft() && computedStyle.direction === 'rtl') { // is the scrollbar on the left side? - res.scrollbarLeft = scrollbarLeftRight; - } - else { - res.scrollbarRight = scrollbarLeftRight; - } - if (getPadding) { - res.paddingLeft = parseInt(computedStyle.paddingLeft, 10) || 0; - res.paddingRight = parseInt(computedStyle.paddingRight, 10) || 0; - res.paddingTop = parseInt(computedStyle.paddingTop, 10) || 0; - res.paddingBottom = parseInt(computedStyle.paddingBottom, 10) || 0; - } - return res; - } - function computeInnerRect(el, goWithinPadding, doFromWindowViewport) { - if (goWithinPadding === void 0) { goWithinPadding = false; } - var outerRect = doFromWindowViewport ? el.getBoundingClientRect() : computeRect(el); - var edges = computeEdges(el, goWithinPadding); - var res = { - left: outerRect.left + edges.borderLeft + edges.scrollbarLeft, - right: outerRect.right - edges.borderRight - edges.scrollbarRight, - top: outerRect.top + edges.borderTop, - bottom: outerRect.bottom - edges.borderBottom - edges.scrollbarBottom, - }; - if (goWithinPadding) { - res.left += edges.paddingLeft; - res.right -= edges.paddingRight; - res.top += edges.paddingTop; - res.bottom -= edges.paddingBottom; - } - return res; - } - function computeRect(el) { - var rect = el.getBoundingClientRect(); - return { - left: rect.left + window.pageXOffset, - top: rect.top + window.pageYOffset, - right: rect.right + window.pageXOffset, - bottom: rect.bottom + window.pageYOffset, - }; - } - function computeHeightAndMargins(el) { - return el.getBoundingClientRect().height + computeVMargins(el); - } - function computeVMargins(el) { - var computed = window.getComputedStyle(el); - return parseInt(computed.marginTop, 10) + - parseInt(computed.marginBottom, 10); - } - // does not return window - function getClippingParents(el) { - var parents = []; - while (el instanceof HTMLElement) { // will stop when gets to document or null - var computedStyle = window.getComputedStyle(el); - if (computedStyle.position === 'fixed') { - break; - } - if ((/(auto|scroll)/).test(computedStyle.overflow + computedStyle.overflowY + computedStyle.overflowX)) { - parents.push(el); - } - el = el.parentNode; - } - return parents; - } - - // given a function that resolves a result asynchronously. - // the function can either call passed-in success and failure callbacks, - // or it can return a promise. - // if you need to pass additional params to func, bind them first. - function unpromisify(func, success, failure) { - // guard against success/failure callbacks being called more than once - // and guard against a promise AND callback being used together. - var isResolved = false; - var wrappedSuccess = function () { - if (!isResolved) { - isResolved = true; - success.apply(this, arguments); // eslint-disable-line prefer-rest-params - } - }; - var wrappedFailure = function () { - if (!isResolved) { - isResolved = true; - if (failure) { - failure.apply(this, arguments); // eslint-disable-line prefer-rest-params - } - } - }; - var res = func(wrappedSuccess, wrappedFailure); - if (res && typeof res.then === 'function') { - res.then(wrappedSuccess, wrappedFailure); - } - } - - var Emitter = /** @class */ (function () { - function Emitter() { - this.handlers = {}; - this.thisContext = null; - } - Emitter.prototype.setThisContext = function (thisContext) { - this.thisContext = thisContext; - }; - Emitter.prototype.setOptions = function (options) { - this.options = options; - }; - Emitter.prototype.on = function (type, handler) { - addToHash(this.handlers, type, handler); - }; - Emitter.prototype.off = function (type, handler) { - removeFromHash(this.handlers, type, handler); - }; - Emitter.prototype.trigger = function (type) { - var args = []; - for (var _i = 1; _i < arguments.length; _i++) { - args[_i - 1] = arguments[_i]; - } - var attachedHandlers = this.handlers[type] || []; - var optionHandler = this.options && this.options[type]; - var handlers = [].concat(optionHandler || [], attachedHandlers); - for (var _a = 0, handlers_1 = handlers; _a < handlers_1.length; _a++) { - var handler = handlers_1[_a]; - handler.apply(this.thisContext, args); - } - }; - Emitter.prototype.hasHandlers = function (type) { - return (this.handlers[type] && this.handlers[type].length) || - (this.options && this.options[type]); - }; - return Emitter; - }()); - function addToHash(hash, type, handler) { - (hash[type] || (hash[type] = [])) - .push(handler); - } - function removeFromHash(hash, type, handler) { - if (handler) { - if (hash[type]) { - hash[type] = hash[type].filter(function (func) { return func !== handler; }); - } - } - else { - delete hash[type]; // remove all handler funcs for this type - } - } - - /* - Records offset information for a set of elements, relative to an origin element. - Can record the left/right OR the top/bottom OR both. - Provides methods for querying the cache by position. - */ - var PositionCache = /** @class */ (function () { - function PositionCache(originEl, els, isHorizontal, isVertical) { - this.els = els; - var originClientRect = this.originClientRect = originEl.getBoundingClientRect(); // relative to viewport top-left - if (isHorizontal) { - this.buildElHorizontals(originClientRect.left); - } - if (isVertical) { - this.buildElVerticals(originClientRect.top); - } - } - // Populates the left/right internal coordinate arrays - PositionCache.prototype.buildElHorizontals = function (originClientLeft) { - var lefts = []; - var rights = []; - for (var _i = 0, _a = this.els; _i < _a.length; _i++) { - var el = _a[_i]; - var rect = el.getBoundingClientRect(); - lefts.push(rect.left - originClientLeft); - rights.push(rect.right - originClientLeft); - } - this.lefts = lefts; - this.rights = rights; - }; - // Populates the top/bottom internal coordinate arrays - PositionCache.prototype.buildElVerticals = function (originClientTop) { - var tops = []; - var bottoms = []; - for (var _i = 0, _a = this.els; _i < _a.length; _i++) { - var el = _a[_i]; - var rect = el.getBoundingClientRect(); - tops.push(rect.top - originClientTop); - bottoms.push(rect.bottom - originClientTop); - } - this.tops = tops; - this.bottoms = bottoms; - }; - // Given a left offset (from document left), returns the index of the el that it horizontally intersects. - // If no intersection is made, returns undefined. - PositionCache.prototype.leftToIndex = function (leftPosition) { - var _a = this, lefts = _a.lefts, rights = _a.rights; - var len = lefts.length; - var i; - for (i = 0; i < len; i += 1) { - if (leftPosition >= lefts[i] && leftPosition < rights[i]) { - return i; - } - } - return undefined; // TODO: better - }; - // Given a top offset (from document top), returns the index of the el that it vertically intersects. - // If no intersection is made, returns undefined. - PositionCache.prototype.topToIndex = function (topPosition) { - var _a = this, tops = _a.tops, bottoms = _a.bottoms; - var len = tops.length; - var i; - for (i = 0; i < len; i += 1) { - if (topPosition >= tops[i] && topPosition < bottoms[i]) { - return i; - } - } - return undefined; // TODO: better - }; - // Gets the width of the element at the given index - PositionCache.prototype.getWidth = function (leftIndex) { - return this.rights[leftIndex] - this.lefts[leftIndex]; - }; - // Gets the height of the element at the given index - PositionCache.prototype.getHeight = function (topIndex) { - return this.bottoms[topIndex] - this.tops[topIndex]; - }; - return PositionCache; - }()); - - /* eslint max-classes-per-file: "off" */ - /* - An object for getting/setting scroll-related information for an element. - Internally, this is done very differently for window versus DOM element, - so this object serves as a common interface. - */ - var ScrollController = /** @class */ (function () { - function ScrollController() { - } - ScrollController.prototype.getMaxScrollTop = function () { - return this.getScrollHeight() - this.getClientHeight(); - }; - ScrollController.prototype.getMaxScrollLeft = function () { - return this.getScrollWidth() - this.getClientWidth(); - }; - ScrollController.prototype.canScrollVertically = function () { - return this.getMaxScrollTop() > 0; - }; - ScrollController.prototype.canScrollHorizontally = function () { - return this.getMaxScrollLeft() > 0; - }; - ScrollController.prototype.canScrollUp = function () { - return this.getScrollTop() > 0; - }; - ScrollController.prototype.canScrollDown = function () { - return this.getScrollTop() < this.getMaxScrollTop(); - }; - ScrollController.prototype.canScrollLeft = function () { - return this.getScrollLeft() > 0; - }; - ScrollController.prototype.canScrollRight = function () { - return this.getScrollLeft() < this.getMaxScrollLeft(); - }; - return ScrollController; - }()); - var ElementScrollController = /** @class */ (function (_super) { - __extends(ElementScrollController, _super); - function ElementScrollController(el) { - var _this = _super.call(this) || this; - _this.el = el; - return _this; - } - ElementScrollController.prototype.getScrollTop = function () { - return this.el.scrollTop; - }; - ElementScrollController.prototype.getScrollLeft = function () { - return this.el.scrollLeft; - }; - ElementScrollController.prototype.setScrollTop = function (top) { - this.el.scrollTop = top; - }; - ElementScrollController.prototype.setScrollLeft = function (left) { - this.el.scrollLeft = left; - }; - ElementScrollController.prototype.getScrollWidth = function () { - return this.el.scrollWidth; - }; - ElementScrollController.prototype.getScrollHeight = function () { - return this.el.scrollHeight; - }; - ElementScrollController.prototype.getClientHeight = function () { - return this.el.clientHeight; - }; - ElementScrollController.prototype.getClientWidth = function () { - return this.el.clientWidth; - }; - return ElementScrollController; - }(ScrollController)); - var WindowScrollController = /** @class */ (function (_super) { - __extends(WindowScrollController, _super); - function WindowScrollController() { - return _super !== null && _super.apply(this, arguments) || this; - } - WindowScrollController.prototype.getScrollTop = function () { - return window.pageYOffset; - }; - WindowScrollController.prototype.getScrollLeft = function () { - return window.pageXOffset; - }; - WindowScrollController.prototype.setScrollTop = function (n) { - window.scroll(window.pageXOffset, n); - }; - WindowScrollController.prototype.setScrollLeft = function (n) { - window.scroll(n, window.pageYOffset); - }; - WindowScrollController.prototype.getScrollWidth = function () { - return document.documentElement.scrollWidth; - }; - WindowScrollController.prototype.getScrollHeight = function () { - return document.documentElement.scrollHeight; - }; - WindowScrollController.prototype.getClientHeight = function () { - return document.documentElement.clientHeight; - }; - WindowScrollController.prototype.getClientWidth = function () { - return document.documentElement.clientWidth; - }; - return WindowScrollController; - }(ScrollController)); - - var Theme = /** @class */ (function () { - function Theme(calendarOptions) { - if (this.iconOverrideOption) { - this.setIconOverride(calendarOptions[this.iconOverrideOption]); - } - } - Theme.prototype.setIconOverride = function (iconOverrideHash) { - var iconClassesCopy; - var buttonName; - if (typeof iconOverrideHash === 'object' && iconOverrideHash) { // non-null object - iconClassesCopy = __assign({}, this.iconClasses); - for (buttonName in iconOverrideHash) { - iconClassesCopy[buttonName] = this.applyIconOverridePrefix(iconOverrideHash[buttonName]); - } - this.iconClasses = iconClassesCopy; - } - else if (iconOverrideHash === false) { - this.iconClasses = {}; - } - }; - Theme.prototype.applyIconOverridePrefix = function (className) { - var prefix = this.iconOverridePrefix; - if (prefix && className.indexOf(prefix) !== 0) { // if not already present - className = prefix + className; - } - return className; - }; - Theme.prototype.getClass = function (key) { - return this.classes[key] || ''; - }; - Theme.prototype.getIconClass = function (buttonName, isRtl) { - var className; - if (isRtl && this.rtlIconClasses) { - className = this.rtlIconClasses[buttonName] || this.iconClasses[buttonName]; - } - else { - className = this.iconClasses[buttonName]; - } - if (className) { - return this.baseIconClass + " " + className; - } - return ''; - }; - Theme.prototype.getCustomButtonIconClass = function (customButtonProps) { - var className; - if (this.iconOverrideCustomButtonOption) { - className = customButtonProps[this.iconOverrideCustomButtonOption]; - if (className) { - return this.baseIconClass + " " + this.applyIconOverridePrefix(className); - } - } - return ''; - }; - return Theme; - }()); - Theme.prototype.classes = {}; - Theme.prototype.iconClasses = {}; - Theme.prototype.baseIconClass = ''; - Theme.prototype.iconOverridePrefix = ''; - - /// <reference types="@fullcalendar/core-preact" /> - if (typeof FullCalendarVDom === 'undefined') { - throw new Error('Please import the top-level fullcalendar lib before attempting to import a plugin.'); - } - var Component = FullCalendarVDom.Component; - var createElement = FullCalendarVDom.createElement; - var render = FullCalendarVDom.render; - var createRef = FullCalendarVDom.createRef; - var Fragment = FullCalendarVDom.Fragment; - var createContext$1 = FullCalendarVDom.createContext; - var flushToDom$1 = FullCalendarVDom.flushToDom; - var unmountComponentAtNode$1 = FullCalendarVDom.unmountComponentAtNode; - - var ScrollResponder = /** @class */ (function () { - function ScrollResponder(execFunc, emitter, scrollTime) { - var _this = this; - this.execFunc = execFunc; - this.emitter = emitter; - this.scrollTime = scrollTime; - this.handleScrollRequest = function (request) { - _this.queuedRequest = __assign({}, _this.queuedRequest || {}, request); - _this.drain(); - }; - emitter.on('_scrollRequest', this.handleScrollRequest); - this.fireInitialScroll(); - } - ScrollResponder.prototype.detach = function () { - this.emitter.off('_scrollRequest', this.handleScrollRequest); - }; - ScrollResponder.prototype.update = function (isDatesNew) { - if (isDatesNew) { - this.fireInitialScroll(); // will drain - } - else { - this.drain(); - } - }; - ScrollResponder.prototype.fireInitialScroll = function () { - this.handleScrollRequest({ - time: this.scrollTime, - }); - }; - ScrollResponder.prototype.drain = function () { - if (this.queuedRequest && this.execFunc(this.queuedRequest)) { - this.queuedRequest = null; - } - }; - return ScrollResponder; - }()); - - var ViewContextType = createContext$1({}); // for Components - function buildViewContext(viewSpec, viewApi, viewOptions, dateProfileGenerator, dateEnv, theme, pluginHooks, dispatch, getCurrentData, emitter, calendarApi, registerInteractiveComponent, unregisterInteractiveComponent) { - return { - dateEnv: dateEnv, - options: viewOptions, - pluginHooks: pluginHooks, - emitter: emitter, - dispatch: dispatch, - getCurrentData: getCurrentData, - calendarApi: calendarApi, - viewSpec: viewSpec, - viewApi: viewApi, - dateProfileGenerator: dateProfileGenerator, - theme: theme, - isRtl: viewOptions.direction === 'rtl', - addResizeHandler: function (handler) { - emitter.on('_resize', handler); - }, - removeResizeHandler: function (handler) { - emitter.off('_resize', handler); - }, - createScrollResponder: function (execFunc) { - return new ScrollResponder(execFunc, emitter, createDuration(viewOptions.scrollTime)); - }, - registerInteractiveComponent: registerInteractiveComponent, - unregisterInteractiveComponent: unregisterInteractiveComponent, - }; - } - - /* eslint max-classes-per-file: off */ - var PureComponent = /** @class */ (function (_super) { - __extends(PureComponent, _super); - function PureComponent() { - return _super !== null && _super.apply(this, arguments) || this; - } - PureComponent.prototype.shouldComponentUpdate = function (nextProps, nextState) { - if (this.debug) { - // eslint-disable-next-line no-console - console.log(getUnequalProps(nextProps, this.props), getUnequalProps(nextState, this.state)); - } - return !compareObjs(this.props, nextProps, this.propEquality) || - !compareObjs(this.state, nextState, this.stateEquality); - }; - PureComponent.addPropsEquality = addPropsEquality; - PureComponent.addStateEquality = addStateEquality; - PureComponent.contextType = ViewContextType; - return PureComponent; - }(Component)); - PureComponent.prototype.propEquality = {}; - PureComponent.prototype.stateEquality = {}; - var BaseComponent = /** @class */ (function (_super) { - __extends(BaseComponent, _super); - function BaseComponent() { - return _super !== null && _super.apply(this, arguments) || this; - } - BaseComponent.contextType = ViewContextType; - return BaseComponent; - }(PureComponent)); - function addPropsEquality(propEquality) { - var hash = Object.create(this.prototype.propEquality); - __assign(hash, propEquality); - this.prototype.propEquality = hash; - } - function addStateEquality(stateEquality) { - var hash = Object.create(this.prototype.stateEquality); - __assign(hash, stateEquality); - this.prototype.stateEquality = hash; - } - // use other one - function setRef(ref, current) { - if (typeof ref === 'function') { - ref(current); - } - else if (ref) { - // see https://github.com/facebook/react/issues/13029 - ref.current = current; - } - } - - function reduceEventStore(eventStore, action, eventSources, dateProfile, context) { - switch (action.type) { - case 'RECEIVE_EVENTS': // raw - return receiveRawEvents(eventStore, eventSources[action.sourceId], action.fetchId, action.fetchRange, action.rawEvents, context); - case 'ADD_EVENTS': // already parsed, but not expanded - return addEvent(eventStore, action.eventStore, // new ones - dateProfile ? dateProfile.activeRange : null, context); - case 'RESET_EVENTS': - return action.eventStore; - case 'MERGE_EVENTS': // already parsed and expanded - return mergeEventStores(eventStore, action.eventStore); - case 'PREV': // TODO: how do we track all actions that affect dateProfile :( - case 'NEXT': - case 'CHANGE_DATE': - case 'CHANGE_VIEW_TYPE': - if (dateProfile) { - return expandRecurring(eventStore, dateProfile.activeRange, context); - } - return eventStore; - case 'REMOVE_EVENTS': - return excludeSubEventStore(eventStore, action.eventStore); - case 'REMOVE_EVENT_SOURCE': - return excludeEventsBySourceId(eventStore, action.sourceId); - case 'REMOVE_ALL_EVENT_SOURCES': - return filterEventStoreDefs(eventStore, function (eventDef) { return (!eventDef.sourceId // only keep events with no source id - ); }); - case 'REMOVE_ALL_EVENTS': - return createEmptyEventStore(); - default: - return eventStore; - } - } - function receiveRawEvents(eventStore, eventSource, fetchId, fetchRange, rawEvents, context) { - if (eventSource && // not already removed - fetchId === eventSource.latestFetchId // TODO: wish this logic was always in event-sources - ) { - var subset = parseEvents(transformRawEvents(rawEvents, eventSource, context), eventSource, context); - if (fetchRange) { - subset = expandRecurring(subset, fetchRange, context); - } - return mergeEventStores(excludeEventsBySourceId(eventStore, eventSource.sourceId), subset); - } - return eventStore; - } - function transformRawEvents(rawEvents, eventSource, context) { - var calEachTransform = context.options.eventDataTransform; - var sourceEachTransform = eventSource ? eventSource.eventDataTransform : null; - if (sourceEachTransform) { - rawEvents = transformEachRawEvent(rawEvents, sourceEachTransform); - } - if (calEachTransform) { - rawEvents = transformEachRawEvent(rawEvents, calEachTransform); - } - return rawEvents; - } - function transformEachRawEvent(rawEvents, func) { - var refinedEvents; - if (!func) { - refinedEvents = rawEvents; - } - else { - refinedEvents = []; - for (var _i = 0, rawEvents_1 = rawEvents; _i < rawEvents_1.length; _i++) { - var rawEvent = rawEvents_1[_i]; - var refinedEvent = func(rawEvent); - if (refinedEvent) { - refinedEvents.push(refinedEvent); - } - else if (refinedEvent == null) { - refinedEvents.push(rawEvent); - } // if a different falsy value, do nothing - } - } - return refinedEvents; - } - function addEvent(eventStore, subset, expandRange, context) { - if (expandRange) { - subset = expandRecurring(subset, expandRange, context); - } - return mergeEventStores(eventStore, subset); - } - function rezoneEventStoreDates(eventStore, oldDateEnv, newDateEnv) { - var defs = eventStore.defs; - var instances = mapHash(eventStore.instances, function (instance) { - var def = defs[instance.defId]; - if (def.allDay || def.recurringDef) { - return instance; // isn't dependent on timezone - } - return __assign(__assign({}, instance), { range: { - start: newDateEnv.createMarker(oldDateEnv.toDate(instance.range.start, instance.forcedStartTzo)), - end: newDateEnv.createMarker(oldDateEnv.toDate(instance.range.end, instance.forcedEndTzo)), - }, forcedStartTzo: newDateEnv.canComputeOffset ? null : instance.forcedStartTzo, forcedEndTzo: newDateEnv.canComputeOffset ? null : instance.forcedEndTzo }); - }); - return { defs: defs, instances: instances }; - } - function excludeEventsBySourceId(eventStore, sourceId) { - return filterEventStoreDefs(eventStore, function (eventDef) { return eventDef.sourceId !== sourceId; }); - } - // QUESTION: why not just return instances? do a general object-property-exclusion util - function excludeInstances(eventStore, removals) { - return { - defs: eventStore.defs, - instances: filterHash(eventStore.instances, function (instance) { return !removals[instance.instanceId]; }), - }; - } - - // high-level segmenting-aware tester functions - // ------------------------------------------------------------------------------------------------------------------------ - function isInteractionValid(interaction, context) { - return isNewPropsValid({ eventDrag: interaction }, context); // HACK: the eventDrag props is used for ALL interactions - } - function isDateSelectionValid(dateSelection, context) { - return isNewPropsValid({ dateSelection: dateSelection }, context); - } - function isNewPropsValid(newProps, context) { - var calendarState = context.getCurrentData(); - var props = __assign({ businessHours: calendarState.businessHours, dateSelection: '', eventStore: calendarState.eventStore, eventUiBases: calendarState.eventUiBases, eventSelection: '', eventDrag: null, eventResize: null }, newProps); - return (context.pluginHooks.isPropsValid || isPropsValid)(props, context); - } - function isPropsValid(state, context, dateSpanMeta, filterConfig) { - if (dateSpanMeta === void 0) { dateSpanMeta = {}; } - if (state.eventDrag && !isInteractionPropsValid(state, context, dateSpanMeta, filterConfig)) { - return false; - } - if (state.dateSelection && !isDateSelectionPropsValid(state, context, dateSpanMeta, filterConfig)) { - return false; - } - return true; - } - // Moving Event Validation - // ------------------------------------------------------------------------------------------------------------------------ - function isInteractionPropsValid(state, context, dateSpanMeta, filterConfig) { - var currentState = context.getCurrentData(); - var interaction = state.eventDrag; // HACK: the eventDrag props is used for ALL interactions - var subjectEventStore = interaction.mutatedEvents; - var subjectDefs = subjectEventStore.defs; - var subjectInstances = subjectEventStore.instances; - var subjectConfigs = compileEventUis(subjectDefs, interaction.isEvent ? - state.eventUiBases : - { '': currentState.selectionConfig }); - if (filterConfig) { - subjectConfigs = mapHash(subjectConfigs, filterConfig); - } - // exclude the subject events. TODO: exclude defs too? - var otherEventStore = excludeInstances(state.eventStore, interaction.affectedEvents.instances); - var otherDefs = otherEventStore.defs; - var otherInstances = otherEventStore.instances; - var otherConfigs = compileEventUis(otherDefs, state.eventUiBases); - for (var subjectInstanceId in subjectInstances) { - var subjectInstance = subjectInstances[subjectInstanceId]; - var subjectRange = subjectInstance.range; - var subjectConfig = subjectConfigs[subjectInstance.defId]; - var subjectDef = subjectDefs[subjectInstance.defId]; - // constraint - if (!allConstraintsPass(subjectConfig.constraints, subjectRange, otherEventStore, state.businessHours, context)) { - return false; - } - // overlap - var eventOverlap = context.options.eventOverlap; - var eventOverlapFunc = typeof eventOverlap === 'function' ? eventOverlap : null; - for (var otherInstanceId in otherInstances) { - var otherInstance = otherInstances[otherInstanceId]; - // intersect! evaluate - if (rangesIntersect(subjectRange, otherInstance.range)) { - var otherOverlap = otherConfigs[otherInstance.defId].overlap; - // consider the other event's overlap. only do this if the subject event is a "real" event - if (otherOverlap === false && interaction.isEvent) { - return false; - } - if (subjectConfig.overlap === false) { - return false; - } - if (eventOverlapFunc && !eventOverlapFunc(new EventApi(context, otherDefs[otherInstance.defId], otherInstance), // still event - new EventApi(context, subjectDef, subjectInstance))) { - return false; - } - } - } - // allow (a function) - var calendarEventStore = currentState.eventStore; // need global-to-calendar, not local to component (splittable)state - for (var _i = 0, _a = subjectConfig.allows; _i < _a.length; _i++) { - var subjectAllow = _a[_i]; - var subjectDateSpan = __assign(__assign({}, dateSpanMeta), { range: subjectInstance.range, allDay: subjectDef.allDay }); - var origDef = calendarEventStore.defs[subjectDef.defId]; - var origInstance = calendarEventStore.instances[subjectInstanceId]; - var eventApi = void 0; - if (origDef) { // was previously in the calendar - eventApi = new EventApi(context, origDef, origInstance); - } - else { // was an external event - eventApi = new EventApi(context, subjectDef); // no instance, because had no dates - } - if (!subjectAllow(buildDateSpanApiWithContext(subjectDateSpan, context), eventApi)) { - return false; - } - } - } - return true; - } - // Date Selection Validation - // ------------------------------------------------------------------------------------------------------------------------ - function isDateSelectionPropsValid(state, context, dateSpanMeta, filterConfig) { - var relevantEventStore = state.eventStore; - var relevantDefs = relevantEventStore.defs; - var relevantInstances = relevantEventStore.instances; - var selection = state.dateSelection; - var selectionRange = selection.range; - var selectionConfig = context.getCurrentData().selectionConfig; - if (filterConfig) { - selectionConfig = filterConfig(selectionConfig); - } - // constraint - if (!allConstraintsPass(selectionConfig.constraints, selectionRange, relevantEventStore, state.businessHours, context)) { - return false; - } - // overlap - var selectOverlap = context.options.selectOverlap; - var selectOverlapFunc = typeof selectOverlap === 'function' ? selectOverlap : null; - for (var relevantInstanceId in relevantInstances) { - var relevantInstance = relevantInstances[relevantInstanceId]; - // intersect! evaluate - if (rangesIntersect(selectionRange, relevantInstance.range)) { - if (selectionConfig.overlap === false) { - return false; - } - if (selectOverlapFunc && !selectOverlapFunc(new EventApi(context, relevantDefs[relevantInstance.defId], relevantInstance), null)) { - return false; - } - } - } - // allow (a function) - for (var _i = 0, _a = selectionConfig.allows; _i < _a.length; _i++) { - var selectionAllow = _a[_i]; - var fullDateSpan = __assign(__assign({}, dateSpanMeta), selection); - if (!selectionAllow(buildDateSpanApiWithContext(fullDateSpan, context), null)) { - return false; - } - } - return true; - } - // Constraint Utils - // ------------------------------------------------------------------------------------------------------------------------ - function allConstraintsPass(constraints, subjectRange, otherEventStore, businessHoursUnexpanded, context) { - for (var _i = 0, constraints_1 = constraints; _i < constraints_1.length; _i++) { - var constraint = constraints_1[_i]; - if (!anyRangesContainRange(constraintToRanges(constraint, subjectRange, otherEventStore, businessHoursUnexpanded, context), subjectRange)) { - return false; - } - } - return true; - } - function constraintToRanges(constraint, subjectRange, // for expanding a recurring constraint, or expanding business hours - otherEventStore, // for if constraint is an even group ID - businessHoursUnexpanded, // for if constraint is 'businessHours' - context) { - if (constraint === 'businessHours') { - return eventStoreToRanges(expandRecurring(businessHoursUnexpanded, subjectRange, context)); - } - if (typeof constraint === 'string') { // an group ID - return eventStoreToRanges(filterEventStoreDefs(otherEventStore, function (eventDef) { return eventDef.groupId === constraint; })); - } - if (typeof constraint === 'object' && constraint) { // non-null object - return eventStoreToRanges(expandRecurring(constraint, subjectRange, context)); - } - return []; // if it's false - } - // TODO: move to event-store file? - function eventStoreToRanges(eventStore) { - var instances = eventStore.instances; - var ranges = []; - for (var instanceId in instances) { - ranges.push(instances[instanceId].range); - } - return ranges; - } - // TODO: move to geom file? - function anyRangesContainRange(outerRanges, innerRange) { - for (var _i = 0, outerRanges_1 = outerRanges; _i < outerRanges_1.length; _i++) { - var outerRange = outerRanges_1[_i]; - if (rangeContainsRange(outerRange, innerRange)) { - return true; - } - } - return false; - } - - /* - an INTERACTABLE date component - - PURPOSES: - - hook up to fg, fill, and mirror renderers - - interface for dragging and hits - */ - var DateComponent = /** @class */ (function (_super) { - __extends(DateComponent, _super); - function DateComponent() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.uid = guid(); - return _this; - } - // Hit System - // ----------------------------------------------------------------------------------------------------------------- - DateComponent.prototype.prepareHits = function () { - }; - DateComponent.prototype.queryHit = function (positionLeft, positionTop, elWidth, elHeight) { - return null; // this should be abstract - }; - // Validation - // ----------------------------------------------------------------------------------------------------------------- - DateComponent.prototype.isInteractionValid = function (interaction) { - var dateProfile = this.props.dateProfile; // HACK - var instances = interaction.mutatedEvents.instances; - if (dateProfile) { // HACK for MorePopover - for (var instanceId in instances) { - if (!rangeContainsRange(dateProfile.validRange, instances[instanceId].range)) { - return false; - } - } - } - return isInteractionValid(interaction, this.context); - }; - DateComponent.prototype.isDateSelectionValid = function (selection) { - var dateProfile = this.props.dateProfile; // HACK - if (dateProfile && // HACK for MorePopover - !rangeContainsRange(dateProfile.validRange, selection.range)) { - return false; - } - return isDateSelectionValid(selection, this.context); - }; - // Pointer Interaction Utils - // ----------------------------------------------------------------------------------------------------------------- - DateComponent.prototype.isValidSegDownEl = function (el) { - return !this.props.eventDrag && // HACK - !this.props.eventResize && // HACK - !elementClosest(el, '.fc-event-mirror'); - }; - DateComponent.prototype.isValidDateDownEl = function (el) { - return !elementClosest(el, '.fc-event:not(.fc-bg-event)') && - !elementClosest(el, '.fc-daygrid-more-link') && // a "more.." link - !elementClosest(el, 'a[data-navlink]') && // a clickable nav link - !elementClosest(el, '.fc-popover'); // hack - }; - return DateComponent; - }(BaseComponent)); - - // TODO: easier way to add new hooks? need to update a million things - function createPlugin(input) { - return { - id: guid(), - deps: input.deps || [], - reducers: input.reducers || [], - isLoadingFuncs: input.isLoadingFuncs || [], - contextInit: [].concat(input.contextInit || []), - eventRefiners: input.eventRefiners || {}, - eventDefMemberAdders: input.eventDefMemberAdders || [], - eventSourceRefiners: input.eventSourceRefiners || {}, - isDraggableTransformers: input.isDraggableTransformers || [], - eventDragMutationMassagers: input.eventDragMutationMassagers || [], - eventDefMutationAppliers: input.eventDefMutationAppliers || [], - dateSelectionTransformers: input.dateSelectionTransformers || [], - datePointTransforms: input.datePointTransforms || [], - dateSpanTransforms: input.dateSpanTransforms || [], - views: input.views || {}, - viewPropsTransformers: input.viewPropsTransformers || [], - isPropsValid: input.isPropsValid || null, - externalDefTransforms: input.externalDefTransforms || [], - eventResizeJoinTransforms: input.eventResizeJoinTransforms || [], - viewContainerAppends: input.viewContainerAppends || [], - eventDropTransformers: input.eventDropTransformers || [], - componentInteractions: input.componentInteractions || [], - calendarInteractions: input.calendarInteractions || [], - themeClasses: input.themeClasses || {}, - eventSourceDefs: input.eventSourceDefs || [], - cmdFormatter: input.cmdFormatter, - recurringTypes: input.recurringTypes || [], - namedTimeZonedImpl: input.namedTimeZonedImpl, - initialView: input.initialView || '', - elementDraggingImpl: input.elementDraggingImpl, - optionChangeHandlers: input.optionChangeHandlers || {}, - scrollGridImpl: input.scrollGridImpl || null, - contentTypeHandlers: input.contentTypeHandlers || {}, - listenerRefiners: input.listenerRefiners || {}, - optionRefiners: input.optionRefiners || {}, - propSetHandlers: input.propSetHandlers || {}, - }; - } - function buildPluginHooks(pluginDefs, globalDefs) { - var isAdded = {}; - var hooks = { - reducers: [], - isLoadingFuncs: [], - contextInit: [], - eventRefiners: {}, - eventDefMemberAdders: [], - eventSourceRefiners: {}, - isDraggableTransformers: [], - eventDragMutationMassagers: [], - eventDefMutationAppliers: [], - dateSelectionTransformers: [], - datePointTransforms: [], - dateSpanTransforms: [], - views: {}, - viewPropsTransformers: [], - isPropsValid: null, - externalDefTransforms: [], - eventResizeJoinTransforms: [], - viewContainerAppends: [], - eventDropTransformers: [], - componentInteractions: [], - calendarInteractions: [], - themeClasses: {}, - eventSourceDefs: [], - cmdFormatter: null, - recurringTypes: [], - namedTimeZonedImpl: null, - initialView: '', - elementDraggingImpl: null, - optionChangeHandlers: {}, - scrollGridImpl: null, - contentTypeHandlers: {}, - listenerRefiners: {}, - optionRefiners: {}, - propSetHandlers: {}, - }; - function addDefs(defs) { - for (var _i = 0, defs_1 = defs; _i < defs_1.length; _i++) { - var def = defs_1[_i]; - if (!isAdded[def.id]) { - isAdded[def.id] = true; - addDefs(def.deps); - hooks = combineHooks(hooks, def); - } - } - } - if (pluginDefs) { - addDefs(pluginDefs); - } - addDefs(globalDefs); - return hooks; - } - function buildBuildPluginHooks() { - var currentOverrideDefs = []; - var currentGlobalDefs = []; - var currentHooks; - return function (overrideDefs, globalDefs) { - if (!currentHooks || !isArraysEqual(overrideDefs, currentOverrideDefs) || !isArraysEqual(globalDefs, currentGlobalDefs)) { - currentHooks = buildPluginHooks(overrideDefs, globalDefs); - } - currentOverrideDefs = overrideDefs; - currentGlobalDefs = globalDefs; - return currentHooks; - }; - } - function combineHooks(hooks0, hooks1) { - return { - reducers: hooks0.reducers.concat(hooks1.reducers), - isLoadingFuncs: hooks0.isLoadingFuncs.concat(hooks1.isLoadingFuncs), - contextInit: hooks0.contextInit.concat(hooks1.contextInit), - eventRefiners: __assign(__assign({}, hooks0.eventRefiners), hooks1.eventRefiners), - eventDefMemberAdders: hooks0.eventDefMemberAdders.concat(hooks1.eventDefMemberAdders), - eventSourceRefiners: __assign(__assign({}, hooks0.eventSourceRefiners), hooks1.eventSourceRefiners), - isDraggableTransformers: hooks0.isDraggableTransformers.concat(hooks1.isDraggableTransformers), - eventDragMutationMassagers: hooks0.eventDragMutationMassagers.concat(hooks1.eventDragMutationMassagers), - eventDefMutationAppliers: hooks0.eventDefMutationAppliers.concat(hooks1.eventDefMutationAppliers), - dateSelectionTransformers: hooks0.dateSelectionTransformers.concat(hooks1.dateSelectionTransformers), - datePointTransforms: hooks0.datePointTransforms.concat(hooks1.datePointTransforms), - dateSpanTransforms: hooks0.dateSpanTransforms.concat(hooks1.dateSpanTransforms), - views: __assign(__assign({}, hooks0.views), hooks1.views), - viewPropsTransformers: hooks0.viewPropsTransformers.concat(hooks1.viewPropsTransformers), - isPropsValid: hooks1.isPropsValid || hooks0.isPropsValid, - externalDefTransforms: hooks0.externalDefTransforms.concat(hooks1.externalDefTransforms), - eventResizeJoinTransforms: hooks0.eventResizeJoinTransforms.concat(hooks1.eventResizeJoinTransforms), - viewContainerAppends: hooks0.viewContainerAppends.concat(hooks1.viewContainerAppends), - eventDropTransformers: hooks0.eventDropTransformers.concat(hooks1.eventDropTransformers), - calendarInteractions: hooks0.calendarInteractions.concat(hooks1.calendarInteractions), - componentInteractions: hooks0.componentInteractions.concat(hooks1.componentInteractions), - themeClasses: __assign(__assign({}, hooks0.themeClasses), hooks1.themeClasses), - eventSourceDefs: hooks0.eventSourceDefs.concat(hooks1.eventSourceDefs), - cmdFormatter: hooks1.cmdFormatter || hooks0.cmdFormatter, - recurringTypes: hooks0.recurringTypes.concat(hooks1.recurringTypes), - namedTimeZonedImpl: hooks1.namedTimeZonedImpl || hooks0.namedTimeZonedImpl, - initialView: hooks0.initialView || hooks1.initialView, - elementDraggingImpl: hooks0.elementDraggingImpl || hooks1.elementDraggingImpl, - optionChangeHandlers: __assign(__assign({}, hooks0.optionChangeHandlers), hooks1.optionChangeHandlers), - scrollGridImpl: hooks1.scrollGridImpl || hooks0.scrollGridImpl, - contentTypeHandlers: __assign(__assign({}, hooks0.contentTypeHandlers), hooks1.contentTypeHandlers), - listenerRefiners: __assign(__assign({}, hooks0.listenerRefiners), hooks1.listenerRefiners), - optionRefiners: __assign(__assign({}, hooks0.optionRefiners), hooks1.optionRefiners), - propSetHandlers: __assign(__assign({}, hooks0.propSetHandlers), hooks1.propSetHandlers), - }; - } - - var StandardTheme = /** @class */ (function (_super) { - __extends(StandardTheme, _super); - function StandardTheme() { - return _super !== null && _super.apply(this, arguments) || this; - } - return StandardTheme; - }(Theme)); - StandardTheme.prototype.classes = { - root: 'fc-theme-standard', - tableCellShaded: 'fc-cell-shaded', - buttonGroup: 'fc-button-group', - button: 'fc-button fc-button-primary', - buttonActive: 'fc-button-active', - }; - StandardTheme.prototype.baseIconClass = 'fc-icon'; - StandardTheme.prototype.iconClasses = { - close: 'fc-icon-x', - prev: 'fc-icon-chevron-left', - next: 'fc-icon-chevron-right', - prevYear: 'fc-icon-chevrons-left', - nextYear: 'fc-icon-chevrons-right', - }; - StandardTheme.prototype.rtlIconClasses = { - prev: 'fc-icon-chevron-right', - next: 'fc-icon-chevron-left', - prevYear: 'fc-icon-chevrons-right', - nextYear: 'fc-icon-chevrons-left', - }; - StandardTheme.prototype.iconOverrideOption = 'buttonIcons'; // TODO: make TS-friendly - StandardTheme.prototype.iconOverrideCustomButtonOption = 'icon'; - StandardTheme.prototype.iconOverridePrefix = 'fc-icon-'; - - function compileViewDefs(defaultConfigs, overrideConfigs) { - var hash = {}; - var viewType; - for (viewType in defaultConfigs) { - ensureViewDef(viewType, hash, defaultConfigs, overrideConfigs); - } - for (viewType in overrideConfigs) { - ensureViewDef(viewType, hash, defaultConfigs, overrideConfigs); - } - return hash; - } - function ensureViewDef(viewType, hash, defaultConfigs, overrideConfigs) { - if (hash[viewType]) { - return hash[viewType]; - } - var viewDef = buildViewDef(viewType, hash, defaultConfigs, overrideConfigs); - if (viewDef) { - hash[viewType] = viewDef; - } - return viewDef; - } - function buildViewDef(viewType, hash, defaultConfigs, overrideConfigs) { - var defaultConfig = defaultConfigs[viewType]; - var overrideConfig = overrideConfigs[viewType]; - var queryProp = function (name) { return ((defaultConfig && defaultConfig[name] !== null) ? defaultConfig[name] : - ((overrideConfig && overrideConfig[name] !== null) ? overrideConfig[name] : null)); }; - var theComponent = queryProp('component'); - var superType = queryProp('superType'); - var superDef = null; - if (superType) { - if (superType === viewType) { - throw new Error('Can\'t have a custom view type that references itself'); - } - superDef = ensureViewDef(superType, hash, defaultConfigs, overrideConfigs); - } - if (!theComponent && superDef) { - theComponent = superDef.component; - } - if (!theComponent) { - return null; // don't throw a warning, might be settings for a single-unit view - } - return { - type: viewType, - component: theComponent, - defaults: __assign(__assign({}, (superDef ? superDef.defaults : {})), (defaultConfig ? defaultConfig.rawOptions : {})), - overrides: __assign(__assign({}, (superDef ? superDef.overrides : {})), (overrideConfig ? overrideConfig.rawOptions : {})), - }; - } - - /* eslint max-classes-per-file: off */ - // NOTE: in JSX, you should always use this class with <HookProps> arg. otherwise, will default to any??? - var RenderHook = /** @class */ (function (_super) { - __extends(RenderHook, _super); - function RenderHook() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.rootElRef = createRef(); - _this.handleRootEl = function (el) { - setRef(_this.rootElRef, el); - if (_this.props.elRef) { - setRef(_this.props.elRef, el); - } - }; - return _this; - } - RenderHook.prototype.render = function () { - var _this = this; - var props = this.props; - var hookProps = props.hookProps; - return (createElement(MountHook, { hookProps: hookProps, didMount: props.didMount, willUnmount: props.willUnmount, elRef: this.handleRootEl }, function (rootElRef) { return (createElement(ContentHook, { hookProps: hookProps, content: props.content, defaultContent: props.defaultContent, backupElRef: _this.rootElRef }, function (innerElRef, innerContent) { return props.children(rootElRef, normalizeClassNames(props.classNames, hookProps), innerElRef, innerContent); })); })); - }; - return RenderHook; - }(BaseComponent)); - // TODO: rename to be about function, not default. use in above type - // for forcing rerender of components that use the ContentHook - var CustomContentRenderContext = createContext$1(0); - function ContentHook(props) { - return (createElement(CustomContentRenderContext.Consumer, null, function (renderId) { return (createElement(ContentHookInner, __assign({ renderId: renderId }, props))); })); - } - var ContentHookInner = /** @class */ (function (_super) { - __extends(ContentHookInner, _super); - function ContentHookInner() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.innerElRef = createRef(); - return _this; - } - ContentHookInner.prototype.render = function () { - return this.props.children(this.innerElRef, this.renderInnerContent()); - }; - ContentHookInner.prototype.componentDidMount = function () { - this.updateCustomContent(); - }; - ContentHookInner.prototype.componentDidUpdate = function () { - this.updateCustomContent(); - }; - ContentHookInner.prototype.componentWillUnmount = function () { - if (this.customContentInfo && this.customContentInfo.destroy) { - this.customContentInfo.destroy(); - } - }; - ContentHookInner.prototype.renderInnerContent = function () { - var contentTypeHandlers = this.context.pluginHooks.contentTypeHandlers; - var _a = this, props = _a.props, customContentInfo = _a.customContentInfo; - var rawVal = props.content; - var innerContent = normalizeContent(rawVal, props.hookProps); - var innerContentVDom = null; - if (innerContent === undefined) { // use the default - innerContent = normalizeContent(props.defaultContent, props.hookProps); - } - if (innerContent !== undefined) { // we allow custom content handlers to return nothing - if (customContentInfo) { - customContentInfo.contentVal = innerContent[customContentInfo.contentKey]; - } - else if (typeof innerContent === 'object') { - // look for a prop that would indicate a custom content handler is needed - for (var contentKey in contentTypeHandlers) { - if (innerContent[contentKey] !== undefined) { - var stuff = contentTypeHandlers[contentKey](); - customContentInfo = this.customContentInfo = __assign({ contentKey: contentKey, contentVal: innerContent[contentKey] }, stuff); - break; - } - } - } - if (customContentInfo) { - innerContentVDom = []; // signal that something was specified - } - else { - innerContentVDom = innerContent; // assume a [p]react vdom node. use it - } - } - return innerContentVDom; - }; - ContentHookInner.prototype.updateCustomContent = function () { - if (this.customContentInfo) { - this.customContentInfo.render(this.innerElRef.current || this.props.backupElRef.current, // the element to render into - this.customContentInfo.contentVal); - } - }; - return ContentHookInner; - }(BaseComponent)); - var MountHook = /** @class */ (function (_super) { - __extends(MountHook, _super); - function MountHook() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.handleRootEl = function (rootEl) { - _this.rootEl = rootEl; - if (_this.props.elRef) { - setRef(_this.props.elRef, rootEl); - } - }; - return _this; - } - MountHook.prototype.render = function () { - return this.props.children(this.handleRootEl); - }; - MountHook.prototype.componentDidMount = function () { - var callback = this.props.didMount; - if (callback) { - callback(__assign(__assign({}, this.props.hookProps), { el: this.rootEl })); - } - }; - MountHook.prototype.componentWillUnmount = function () { - var callback = this.props.willUnmount; - if (callback) { - callback(__assign(__assign({}, this.props.hookProps), { el: this.rootEl })); - } - }; - return MountHook; - }(BaseComponent)); - function buildClassNameNormalizer() { - var currentGenerator; - var currentHookProps; - var currentClassNames = []; - return function (generator, hookProps) { - if (!currentHookProps || !isPropsEqual(currentHookProps, hookProps) || generator !== currentGenerator) { - currentGenerator = generator; - currentHookProps = hookProps; - currentClassNames = normalizeClassNames(generator, hookProps); - } - return currentClassNames; - }; - } - function normalizeClassNames(classNames, hookProps) { - if (typeof classNames === 'function') { - classNames = classNames(hookProps); - } - return parseClassNames(classNames); - } - function normalizeContent(input, hookProps) { - if (typeof input === 'function') { - return input(hookProps, createElement); // give the function the vdom-creation func - } - return input; - } - - var ViewRoot = /** @class */ (function (_super) { - __extends(ViewRoot, _super); - function ViewRoot() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.normalizeClassNames = buildClassNameNormalizer(); - return _this; - } - ViewRoot.prototype.render = function () { - var _a = this, props = _a.props, context = _a.context; - var options = context.options; - var hookProps = { view: context.viewApi }; - var customClassNames = this.normalizeClassNames(options.viewClassNames, hookProps); - return (createElement(MountHook, { hookProps: hookProps, didMount: options.viewDidMount, willUnmount: options.viewWillUnmount, elRef: props.elRef }, function (rootElRef) { return props.children(rootElRef, ["fc-" + props.viewSpec.type + "-view", 'fc-view'].concat(customClassNames)); })); - }; - return ViewRoot; - }(BaseComponent)); - - function parseViewConfigs(inputs) { - return mapHash(inputs, parseViewConfig); - } - function parseViewConfig(input) { - var rawOptions = typeof input === 'function' ? - { component: input } : - input; - var component = rawOptions.component; - if (rawOptions.content) { - component = createViewHookComponent(rawOptions); - // TODO: remove content/classNames/didMount/etc from options? - } - return { - superType: rawOptions.type, - component: component, - rawOptions: rawOptions, - }; - } - function createViewHookComponent(options) { - return function (viewProps) { return (createElement(ViewContextType.Consumer, null, function (context) { return (createElement(ViewRoot, { viewSpec: context.viewSpec }, function (viewElRef, viewClassNames) { - var hookProps = __assign(__assign({}, viewProps), { nextDayThreshold: context.options.nextDayThreshold }); - return (createElement(RenderHook, { hookProps: hookProps, classNames: options.classNames, content: options.content, didMount: options.didMount, willUnmount: options.willUnmount, elRef: viewElRef }, function (rootElRef, customClassNames, innerElRef, innerContent) { return (createElement("div", { className: viewClassNames.concat(customClassNames).join(' '), ref: rootElRef }, innerContent)); })); - })); })); }; - } - - function buildViewSpecs(defaultInputs, optionOverrides, dynamicOptionOverrides, localeDefaults) { - var defaultConfigs = parseViewConfigs(defaultInputs); - var overrideConfigs = parseViewConfigs(optionOverrides.views); - var viewDefs = compileViewDefs(defaultConfigs, overrideConfigs); - return mapHash(viewDefs, function (viewDef) { return buildViewSpec(viewDef, overrideConfigs, optionOverrides, dynamicOptionOverrides, localeDefaults); }); - } - function buildViewSpec(viewDef, overrideConfigs, optionOverrides, dynamicOptionOverrides, localeDefaults) { - var durationInput = viewDef.overrides.duration || - viewDef.defaults.duration || - dynamicOptionOverrides.duration || - optionOverrides.duration; - var duration = null; - var durationUnit = ''; - var singleUnit = ''; - var singleUnitOverrides = {}; - if (durationInput) { - duration = createDurationCached(durationInput); - if (duration) { // valid? - var denom = greatestDurationDenominator(duration); - durationUnit = denom.unit; - if (denom.value === 1) { - singleUnit = durationUnit; - singleUnitOverrides = overrideConfigs[durationUnit] ? overrideConfigs[durationUnit].rawOptions : {}; - } - } - } - var queryButtonText = function (optionsSubset) { - var buttonTextMap = optionsSubset.buttonText || {}; - var buttonTextKey = viewDef.defaults.buttonTextKey; - if (buttonTextKey != null && buttonTextMap[buttonTextKey] != null) { - return buttonTextMap[buttonTextKey]; - } - if (buttonTextMap[viewDef.type] != null) { - return buttonTextMap[viewDef.type]; - } - if (buttonTextMap[singleUnit] != null) { - return buttonTextMap[singleUnit]; - } - return null; - }; - return { - type: viewDef.type, - component: viewDef.component, - duration: duration, - durationUnit: durationUnit, - singleUnit: singleUnit, - optionDefaults: viewDef.defaults, - optionOverrides: __assign(__assign({}, singleUnitOverrides), viewDef.overrides), - buttonTextOverride: queryButtonText(dynamicOptionOverrides) || - queryButtonText(optionOverrides) || // constructor-specified buttonText lookup hash takes precedence - viewDef.overrides.buttonText, - buttonTextDefault: queryButtonText(localeDefaults) || - viewDef.defaults.buttonText || - queryButtonText(BASE_OPTION_DEFAULTS) || - viewDef.type, - }; - } - // hack to get memoization working - var durationInputMap = {}; - function createDurationCached(durationInput) { - var json = JSON.stringify(durationInput); - var res = durationInputMap[json]; - if (res === undefined) { - res = createDuration(durationInput); - durationInputMap[json] = res; - } - return res; - } - - var DateProfileGenerator = /** @class */ (function () { - function DateProfileGenerator(props) { - this.props = props; - this.nowDate = getNow(props.nowInput, props.dateEnv); - this.initHiddenDays(); - } - /* Date Range Computation - ------------------------------------------------------------------------------------------------------------------*/ - // Builds a structure with info about what the dates/ranges will be for the "prev" view. - DateProfileGenerator.prototype.buildPrev = function (currentDateProfile, currentDate, forceToValid) { - var dateEnv = this.props.dateEnv; - var prevDate = dateEnv.subtract(dateEnv.startOf(currentDate, currentDateProfile.currentRangeUnit), // important for start-of-month - currentDateProfile.dateIncrement); - return this.build(prevDate, -1, forceToValid); - }; - // Builds a structure with info about what the dates/ranges will be for the "next" view. - DateProfileGenerator.prototype.buildNext = function (currentDateProfile, currentDate, forceToValid) { - var dateEnv = this.props.dateEnv; - var nextDate = dateEnv.add(dateEnv.startOf(currentDate, currentDateProfile.currentRangeUnit), // important for start-of-month - currentDateProfile.dateIncrement); - return this.build(nextDate, 1, forceToValid); - }; - // Builds a structure holding dates/ranges for rendering around the given date. - // Optional direction param indicates whether the date is being incremented/decremented - // from its previous value. decremented = -1, incremented = 1 (default). - DateProfileGenerator.prototype.build = function (currentDate, direction, forceToValid) { - if (forceToValid === void 0) { forceToValid = true; } - var props = this.props; - var validRange; - var currentInfo; - var isRangeAllDay; - var renderRange; - var activeRange; - var isValid; - validRange = this.buildValidRange(); - validRange = this.trimHiddenDays(validRange); - if (forceToValid) { - currentDate = constrainMarkerToRange(currentDate, validRange); - } - currentInfo = this.buildCurrentRangeInfo(currentDate, direction); - isRangeAllDay = /^(year|month|week|day)$/.test(currentInfo.unit); - renderRange = this.buildRenderRange(this.trimHiddenDays(currentInfo.range), currentInfo.unit, isRangeAllDay); - renderRange = this.trimHiddenDays(renderRange); - activeRange = renderRange; - if (!props.showNonCurrentDates) { - activeRange = intersectRanges(activeRange, currentInfo.range); - } - activeRange = this.adjustActiveRange(activeRange); - activeRange = intersectRanges(activeRange, validRange); // might return null - // it's invalid if the originally requested date is not contained, - // or if the range is completely outside of the valid range. - isValid = rangesIntersect(currentInfo.range, validRange); - return { - // constraint for where prev/next operations can go and where events can be dragged/resized to. - // an object with optional start and end properties. - validRange: validRange, - // range the view is formally responsible for. - // for example, a month view might have 1st-31st, excluding padded dates - currentRange: currentInfo.range, - // name of largest unit being displayed, like "month" or "week" - currentRangeUnit: currentInfo.unit, - isRangeAllDay: isRangeAllDay, - // dates that display events and accept drag-n-drop - // will be `null` if no dates accept events - activeRange: activeRange, - // date range with a rendered skeleton - // includes not-active days that need some sort of DOM - renderRange: renderRange, - // Duration object that denotes the first visible time of any given day - slotMinTime: props.slotMinTime, - // Duration object that denotes the exclusive visible end time of any given day - slotMaxTime: props.slotMaxTime, - isValid: isValid, - // how far the current date will move for a prev/next operation - dateIncrement: this.buildDateIncrement(currentInfo.duration), - }; - }; - // Builds an object with optional start/end properties. - // Indicates the minimum/maximum dates to display. - // not responsible for trimming hidden days. - DateProfileGenerator.prototype.buildValidRange = function () { - var input = this.props.validRangeInput; - var simpleInput = typeof input === 'function' - ? input.call(this.props.calendarApi, this.nowDate) - : input; - return this.refineRange(simpleInput) || - { start: null, end: null }; // completely open-ended - }; - // Builds a structure with info about the "current" range, the range that is - // highlighted as being the current month for example. - // See build() for a description of `direction`. - // Guaranteed to have `range` and `unit` properties. `duration` is optional. - DateProfileGenerator.prototype.buildCurrentRangeInfo = function (date, direction) { - var props = this.props; - var duration = null; - var unit = null; - var range = null; - var dayCount; - if (props.duration) { - duration = props.duration; - unit = props.durationUnit; - range = this.buildRangeFromDuration(date, direction, duration, unit); - } - else if ((dayCount = this.props.dayCount)) { - unit = 'day'; - range = this.buildRangeFromDayCount(date, direction, dayCount); - } - else if ((range = this.buildCustomVisibleRange(date))) { - unit = props.dateEnv.greatestWholeUnit(range.start, range.end).unit; - } - else { - duration = this.getFallbackDuration(); - unit = greatestDurationDenominator(duration).unit; - range = this.buildRangeFromDuration(date, direction, duration, unit); - } - return { duration: duration, unit: unit, range: range }; - }; - DateProfileGenerator.prototype.getFallbackDuration = function () { - return createDuration({ day: 1 }); - }; - // Returns a new activeRange to have time values (un-ambiguate) - // slotMinTime or slotMaxTime causes the range to expand. - DateProfileGenerator.prototype.adjustActiveRange = function (range) { - var _a = this.props, dateEnv = _a.dateEnv, usesMinMaxTime = _a.usesMinMaxTime, slotMinTime = _a.slotMinTime, slotMaxTime = _a.slotMaxTime; - var start = range.start, end = range.end; - if (usesMinMaxTime) { - // expand active range if slotMinTime is negative (why not when positive?) - if (asRoughDays(slotMinTime) < 0) { - start = startOfDay(start); // necessary? - start = dateEnv.add(start, slotMinTime); - } - // expand active range if slotMaxTime is beyond one day (why not when negative?) - if (asRoughDays(slotMaxTime) > 1) { - end = startOfDay(end); // necessary? - end = addDays(end, -1); - end = dateEnv.add(end, slotMaxTime); - } - } - return { start: start, end: end }; - }; - // Builds the "current" range when it is specified as an explicit duration. - // `unit` is the already-computed greatestDurationDenominator unit of duration. - DateProfileGenerator.prototype.buildRangeFromDuration = function (date, direction, duration, unit) { - var _a = this.props, dateEnv = _a.dateEnv, dateAlignment = _a.dateAlignment; - var start; - var end; - var res; - // compute what the alignment should be - if (!dateAlignment) { - var dateIncrement = this.props.dateIncrement; - if (dateIncrement) { - // use the smaller of the two units - if (asRoughMs(dateIncrement) < asRoughMs(duration)) { - dateAlignment = greatestDurationDenominator(dateIncrement).unit; - } - else { - dateAlignment = unit; - } - } - else { - dateAlignment = unit; - } - } - // if the view displays a single day or smaller - if (asRoughDays(duration) <= 1) { - if (this.isHiddenDay(start)) { - start = this.skipHiddenDays(start, direction); - start = startOfDay(start); - } - } - function computeRes() { - start = dateEnv.startOf(date, dateAlignment); - end = dateEnv.add(start, duration); - res = { start: start, end: end }; - } - computeRes(); - // if range is completely enveloped by hidden days, go past the hidden days - if (!this.trimHiddenDays(res)) { - date = this.skipHiddenDays(date, direction); - computeRes(); - } - return res; - }; - // Builds the "current" range when a dayCount is specified. - DateProfileGenerator.prototype.buildRangeFromDayCount = function (date, direction, dayCount) { - var _a = this.props, dateEnv = _a.dateEnv, dateAlignment = _a.dateAlignment; - var runningCount = 0; - var start = date; - var end; - if (dateAlignment) { - start = dateEnv.startOf(start, dateAlignment); - } - start = startOfDay(start); - start = this.skipHiddenDays(start, direction); - end = start; - do { - end = addDays(end, 1); - if (!this.isHiddenDay(end)) { - runningCount += 1; - } - } while (runningCount < dayCount); - return { start: start, end: end }; - }; - // Builds a normalized range object for the "visible" range, - // which is a way to define the currentRange and activeRange at the same time. - DateProfileGenerator.prototype.buildCustomVisibleRange = function (date) { - var props = this.props; - var input = props.visibleRangeInput; - var simpleInput = typeof input === 'function' - ? input.call(props.calendarApi, props.dateEnv.toDate(date)) - : input; - var range = this.refineRange(simpleInput); - if (range && (range.start == null || range.end == null)) { - return null; - } - return range; - }; - // Computes the range that will represent the element/cells for *rendering*, - // but which may have voided days/times. - // not responsible for trimming hidden days. - DateProfileGenerator.prototype.buildRenderRange = function (currentRange, currentRangeUnit, isRangeAllDay) { - return currentRange; - }; - // Compute the duration value that should be added/substracted to the current date - // when a prev/next operation happens. - DateProfileGenerator.prototype.buildDateIncrement = function (fallback) { - var dateIncrement = this.props.dateIncrement; - var customAlignment; - if (dateIncrement) { - return dateIncrement; - } - if ((customAlignment = this.props.dateAlignment)) { - return createDuration(1, customAlignment); - } - if (fallback) { - return fallback; - } - return createDuration({ days: 1 }); - }; - DateProfileGenerator.prototype.refineRange = function (rangeInput) { - if (rangeInput) { - var range = parseRange(rangeInput, this.props.dateEnv); - if (range) { - range = computeVisibleDayRange(range); - } - return range; - } - return null; - }; - /* Hidden Days - ------------------------------------------------------------------------------------------------------------------*/ - // Initializes internal variables related to calculating hidden days-of-week - DateProfileGenerator.prototype.initHiddenDays = function () { - var hiddenDays = this.props.hiddenDays || []; // array of day-of-week indices that are hidden - var isHiddenDayHash = []; // is the day-of-week hidden? (hash with day-of-week-index -> bool) - var dayCnt = 0; - var i; - if (this.props.weekends === false) { - hiddenDays.push(0, 6); // 0=sunday, 6=saturday - } - for (i = 0; i < 7; i += 1) { - if (!(isHiddenDayHash[i] = hiddenDays.indexOf(i) !== -1)) { - dayCnt += 1; - } - } - if (!dayCnt) { - throw new Error('invalid hiddenDays'); // all days were hidden? bad. - } - this.isHiddenDayHash = isHiddenDayHash; - }; - // Remove days from the beginning and end of the range that are computed as hidden. - // If the whole range is trimmed off, returns null - DateProfileGenerator.prototype.trimHiddenDays = function (range) { - var start = range.start, end = range.end; - if (start) { - start = this.skipHiddenDays(start); - } - if (end) { - end = this.skipHiddenDays(end, -1, true); - } - if (start == null || end == null || start < end) { - return { start: start, end: end }; - } - return null; - }; - // Is the current day hidden? - // `day` is a day-of-week index (0-6), or a Date (used for UTC) - DateProfileGenerator.prototype.isHiddenDay = function (day) { - if (day instanceof Date) { - day = day.getUTCDay(); - } - return this.isHiddenDayHash[day]; - }; - // Incrementing the current day until it is no longer a hidden day, returning a copy. - // DOES NOT CONSIDER validRange! - // If the initial value of `date` is not a hidden day, don't do anything. - // Pass `isExclusive` as `true` if you are dealing with an end date. - // `inc` defaults to `1` (increment one day forward each time) - DateProfileGenerator.prototype.skipHiddenDays = function (date, inc, isExclusive) { - if (inc === void 0) { inc = 1; } - if (isExclusive === void 0) { isExclusive = false; } - while (this.isHiddenDayHash[(date.getUTCDay() + (isExclusive ? inc : 0) + 7) % 7]) { - date = addDays(date, inc); - } - return date; - }; - return DateProfileGenerator; - }()); - - function reduceViewType(viewType, action) { - switch (action.type) { - case 'CHANGE_VIEW_TYPE': - viewType = action.viewType; - } - return viewType; - } - - function reduceDynamicOptionOverrides(dynamicOptionOverrides, action) { - var _a; - switch (action.type) { - case 'SET_OPTION': - return __assign(__assign({}, dynamicOptionOverrides), (_a = {}, _a[action.optionName] = action.rawOptionValue, _a)); - default: - return dynamicOptionOverrides; - } - } - - function reduceDateProfile(currentDateProfile, action, currentDate, dateProfileGenerator) { - var dp; - switch (action.type) { - case 'CHANGE_VIEW_TYPE': - return dateProfileGenerator.build(action.dateMarker || currentDate); - case 'CHANGE_DATE': - if (!currentDateProfile.activeRange || - !rangeContainsMarker(currentDateProfile.currentRange, action.dateMarker) // don't move if date already in view - ) { - return dateProfileGenerator.build(action.dateMarker); - } - break; - case 'PREV': - dp = dateProfileGenerator.buildPrev(currentDateProfile, currentDate); - if (dp.isValid) { - return dp; - } - break; - case 'NEXT': - dp = dateProfileGenerator.buildNext(currentDateProfile, currentDate); - if (dp.isValid) { - return dp; - } - break; - } - return currentDateProfile; - } - - function initEventSources(calendarOptions, dateProfile, context) { - var activeRange = dateProfile ? dateProfile.activeRange : null; - return addSources({}, parseInitialSources(calendarOptions, context), activeRange, context); - } - function reduceEventSources(eventSources, action, dateProfile, context) { - var activeRange = dateProfile ? dateProfile.activeRange : null; // need this check? - switch (action.type) { - case 'ADD_EVENT_SOURCES': // already parsed - return addSources(eventSources, action.sources, activeRange, context); - case 'REMOVE_EVENT_SOURCE': - return removeSource(eventSources, action.sourceId); - case 'PREV': // TODO: how do we track all actions that affect dateProfile :( - case 'NEXT': - case 'CHANGE_DATE': - case 'CHANGE_VIEW_TYPE': - if (dateProfile) { - return fetchDirtySources(eventSources, activeRange, context); - } - return eventSources; - case 'FETCH_EVENT_SOURCES': - return fetchSourcesByIds(eventSources, action.sourceIds ? // why no type? - arrayToHash(action.sourceIds) : - excludeStaticSources(eventSources, context), activeRange, context); - case 'RECEIVE_EVENTS': - case 'RECEIVE_EVENT_ERROR': - return receiveResponse(eventSources, action.sourceId, action.fetchId, action.fetchRange); - case 'REMOVE_ALL_EVENT_SOURCES': - return {}; - default: - return eventSources; - } - } - function reduceEventSourcesNewTimeZone(eventSources, dateProfile, context) { - var activeRange = dateProfile ? dateProfile.activeRange : null; // need this check? - return fetchSourcesByIds(eventSources, excludeStaticSources(eventSources, context), activeRange, context); - } - function computeEventSourcesLoading(eventSources) { - for (var sourceId in eventSources) { - if (eventSources[sourceId].isFetching) { - return true; - } - } - return false; - } - function addSources(eventSourceHash, sources, fetchRange, context) { - var hash = {}; - for (var _i = 0, sources_1 = sources; _i < sources_1.length; _i++) { - var source = sources_1[_i]; - hash[source.sourceId] = source; - } - if (fetchRange) { - hash = fetchDirtySources(hash, fetchRange, context); - } - return __assign(__assign({}, eventSourceHash), hash); - } - function removeSource(eventSourceHash, sourceId) { - return filterHash(eventSourceHash, function (eventSource) { return eventSource.sourceId !== sourceId; }); - } - function fetchDirtySources(sourceHash, fetchRange, context) { - return fetchSourcesByIds(sourceHash, filterHash(sourceHash, function (eventSource) { return isSourceDirty(eventSource, fetchRange, context); }), fetchRange, context); - } - function isSourceDirty(eventSource, fetchRange, context) { - if (!doesSourceNeedRange(eventSource, context)) { - return !eventSource.latestFetchId; - } - return !context.options.lazyFetching || - !eventSource.fetchRange || - eventSource.isFetching || // always cancel outdated in-progress fetches - fetchRange.start < eventSource.fetchRange.start || - fetchRange.end > eventSource.fetchRange.end; - } - function fetchSourcesByIds(prevSources, sourceIdHash, fetchRange, context) { - var nextSources = {}; - for (var sourceId in prevSources) { - var source = prevSources[sourceId]; - if (sourceIdHash[sourceId]) { - nextSources[sourceId] = fetchSource(source, fetchRange, context); - } - else { - nextSources[sourceId] = source; - } - } - return nextSources; - } - function fetchSource(eventSource, fetchRange, context) { - var options = context.options, calendarApi = context.calendarApi; - var sourceDef = context.pluginHooks.eventSourceDefs[eventSource.sourceDefId]; - var fetchId = guid(); - sourceDef.fetch({ - eventSource: eventSource, - range: fetchRange, - context: context, - }, function (res) { - var rawEvents = res.rawEvents; - if (options.eventSourceSuccess) { - rawEvents = options.eventSourceSuccess.call(calendarApi, rawEvents, res.xhr) || rawEvents; - } - if (eventSource.success) { - rawEvents = eventSource.success.call(calendarApi, rawEvents, res.xhr) || rawEvents; - } - context.dispatch({ - type: 'RECEIVE_EVENTS', - sourceId: eventSource.sourceId, - fetchId: fetchId, - fetchRange: fetchRange, - rawEvents: rawEvents, - }); - }, function (error) { - console.warn(error.message, error); - if (options.eventSourceFailure) { - options.eventSourceFailure.call(calendarApi, error); - } - if (eventSource.failure) { - eventSource.failure(error); - } - context.dispatch({ - type: 'RECEIVE_EVENT_ERROR', - sourceId: eventSource.sourceId, - fetchId: fetchId, - fetchRange: fetchRange, - error: error, - }); - }); - return __assign(__assign({}, eventSource), { isFetching: true, latestFetchId: fetchId }); - } - function receiveResponse(sourceHash, sourceId, fetchId, fetchRange) { - var _a; - var eventSource = sourceHash[sourceId]; - if (eventSource && // not already removed - fetchId === eventSource.latestFetchId) { - return __assign(__assign({}, sourceHash), (_a = {}, _a[sourceId] = __assign(__assign({}, eventSource), { isFetching: false, fetchRange: fetchRange }), _a)); - } - return sourceHash; - } - function excludeStaticSources(eventSources, context) { - return filterHash(eventSources, function (eventSource) { return doesSourceNeedRange(eventSource, context); }); - } - function parseInitialSources(rawOptions, context) { - var refiners = buildEventSourceRefiners(context); - var rawSources = [].concat(rawOptions.eventSources || []); - var sources = []; // parsed - if (rawOptions.initialEvents) { - rawSources.unshift(rawOptions.initialEvents); - } - if (rawOptions.events) { - rawSources.unshift(rawOptions.events); - } - for (var _i = 0, rawSources_1 = rawSources; _i < rawSources_1.length; _i++) { - var rawSource = rawSources_1[_i]; - var source = parseEventSource(rawSource, context, refiners); - if (source) { - sources.push(source); - } - } - return sources; - } - function doesSourceNeedRange(eventSource, context) { - var defs = context.pluginHooks.eventSourceDefs; - return !defs[eventSource.sourceDefId].ignoreRange; - } - - function reduceDateSelection(currentSelection, action) { - switch (action.type) { - case 'UNSELECT_DATES': - return null; - case 'SELECT_DATES': - return action.selection; - default: - return currentSelection; - } - } - - function reduceSelectedEvent(currentInstanceId, action) { - switch (action.type) { - case 'UNSELECT_EVENT': - return ''; - case 'SELECT_EVENT': - return action.eventInstanceId; - default: - return currentInstanceId; - } - } - - function reduceEventDrag(currentDrag, action) { - var newDrag; - switch (action.type) { - case 'UNSET_EVENT_DRAG': - return null; - case 'SET_EVENT_DRAG': - newDrag = action.state; - return { - affectedEvents: newDrag.affectedEvents, - mutatedEvents: newDrag.mutatedEvents, - isEvent: newDrag.isEvent, - }; - default: - return currentDrag; - } - } - - function reduceEventResize(currentResize, action) { - var newResize; - switch (action.type) { - case 'UNSET_EVENT_RESIZE': - return null; - case 'SET_EVENT_RESIZE': - newResize = action.state; - return { - affectedEvents: newResize.affectedEvents, - mutatedEvents: newResize.mutatedEvents, - isEvent: newResize.isEvent, - }; - default: - return currentResize; - } - } - - function parseToolbars(calendarOptions, calendarOptionOverrides, theme, viewSpecs, calendarApi) { - var viewsWithButtons = []; - var headerToolbar = calendarOptions.headerToolbar ? parseToolbar(calendarOptions.headerToolbar, calendarOptions, calendarOptionOverrides, theme, viewSpecs, calendarApi, viewsWithButtons) : null; - var footerToolbar = calendarOptions.footerToolbar ? parseToolbar(calendarOptions.footerToolbar, calendarOptions, calendarOptionOverrides, theme, viewSpecs, calendarApi, viewsWithButtons) : null; - return { headerToolbar: headerToolbar, footerToolbar: footerToolbar, viewsWithButtons: viewsWithButtons }; - } - function parseToolbar(sectionStrHash, calendarOptions, calendarOptionOverrides, theme, viewSpecs, calendarApi, viewsWithButtons) { - return mapHash(sectionStrHash, function (sectionStr) { return parseSection(sectionStr, calendarOptions, calendarOptionOverrides, theme, viewSpecs, calendarApi, viewsWithButtons); }); - } - /* - BAD: querying icons and text here. should be done at render time - */ - function parseSection(sectionStr, calendarOptions, calendarOptionOverrides, theme, viewSpecs, calendarApi, viewsWithButtons) { - var isRtl = calendarOptions.direction === 'rtl'; - var calendarCustomButtons = calendarOptions.customButtons || {}; - var calendarButtonTextOverrides = calendarOptionOverrides.buttonText || {}; - var calendarButtonText = calendarOptions.buttonText || {}; - var sectionSubstrs = sectionStr ? sectionStr.split(' ') : []; - return sectionSubstrs.map(function (buttonGroupStr) { return (buttonGroupStr.split(',').map(function (buttonName) { - if (buttonName === 'title') { - return { buttonName: buttonName }; - } - var customButtonProps; - var viewSpec; - var buttonClick; - var buttonIcon; // only one of these will be set - var buttonText; // " - if ((customButtonProps = calendarCustomButtons[buttonName])) { - buttonClick = function (ev) { - if (customButtonProps.click) { - customButtonProps.click.call(ev.target, ev, ev.target); - } - }; - (buttonIcon = theme.getCustomButtonIconClass(customButtonProps)) || - (buttonIcon = theme.getIconClass(buttonName, isRtl)) || - (buttonText = customButtonProps.text); - } - else if ((viewSpec = viewSpecs[buttonName])) { - viewsWithButtons.push(buttonName); - buttonClick = function () { - calendarApi.changeView(buttonName); - }; - (buttonText = viewSpec.buttonTextOverride) || - (buttonIcon = theme.getIconClass(buttonName, isRtl)) || - (buttonText = viewSpec.buttonTextDefault); - } - else if (calendarApi[buttonName]) { // a calendarApi method - buttonClick = function () { - calendarApi[buttonName](); - }; - (buttonText = calendarButtonTextOverrides[buttonName]) || - (buttonIcon = theme.getIconClass(buttonName, isRtl)) || - (buttonText = calendarButtonText[buttonName]); - // ^ everything else is considered default - } - return { buttonName: buttonName, buttonClick: buttonClick, buttonIcon: buttonIcon, buttonText: buttonText }; - })); }); - } - - var eventSourceDef = { - ignoreRange: true, - parseMeta: function (refined) { - if (Array.isArray(refined.events)) { - return refined.events; - } - return null; - }, - fetch: function (arg, success) { - success({ - rawEvents: arg.eventSource.meta, - }); - }, - }; - var arrayEventSourcePlugin = createPlugin({ - eventSourceDefs: [eventSourceDef], - }); - - var eventSourceDef$1 = { - parseMeta: function (refined) { - if (typeof refined.events === 'function') { - return refined.events; - } - return null; - }, - fetch: function (arg, success, failure) { - var dateEnv = arg.context.dateEnv; - var func = arg.eventSource.meta; - unpromisify(func.bind(null, buildRangeApiWithTimeZone(arg.range, dateEnv)), function (rawEvents) { - success({ rawEvents: rawEvents }); // needs an object response - }, failure); - }, - }; - var funcEventSourcePlugin = createPlugin({ - eventSourceDefs: [eventSourceDef$1], - }); - - function requestJson(method, url, params, successCallback, failureCallback) { - method = method.toUpperCase(); - var body = null; - if (method === 'GET') { - url = injectQueryStringParams(url, params); - } - else { - body = encodeParams(params); - } - var xhr = new XMLHttpRequest(); - xhr.open(method, url, true); - if (method !== 'GET') { - xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); - } - xhr.onload = function () { - if (xhr.status >= 200 && xhr.status < 400) { - var parsed = false; - var res = void 0; - try { - res = JSON.parse(xhr.responseText); - parsed = true; - } - catch (err) { - // will handle parsed=false - } - if (parsed) { - successCallback(res, xhr); - } - else { - failureCallback('Failure parsing JSON', xhr); - } - } - else { - failureCallback('Request failed', xhr); - } - }; - xhr.onerror = function () { - failureCallback('Request failed', xhr); - }; - xhr.send(body); - } - function injectQueryStringParams(url, params) { - return url + - (url.indexOf('?') === -1 ? '?' : '&') + - encodeParams(params); - } - function encodeParams(params) { - var parts = []; - for (var key in params) { - parts.push(encodeURIComponent(key) + "=" + encodeURIComponent(params[key])); - } - return parts.join('&'); - } - - var JSON_FEED_EVENT_SOURCE_REFINERS = { - method: String, - extraParams: identity, - startParam: String, - endParam: String, - timeZoneParam: String, - }; - - var eventSourceDef$2 = { - parseMeta: function (refined) { - if (refined.url && (refined.format === 'json' || !refined.format)) { - return { - url: refined.url, - format: 'json', - method: (refined.method || 'GET').toUpperCase(), - extraParams: refined.extraParams, - startParam: refined.startParam, - endParam: refined.endParam, - timeZoneParam: refined.timeZoneParam, - }; - } - return null; - }, - fetch: function (arg, success, failure) { - var meta = arg.eventSource.meta; - var requestParams = buildRequestParams(meta, arg.range, arg.context); - requestJson(meta.method, meta.url, requestParams, function (rawEvents, xhr) { - success({ rawEvents: rawEvents, xhr: xhr }); - }, function (errorMessage, xhr) { - failure({ message: errorMessage, xhr: xhr }); - }); - }, - }; - var jsonFeedEventSourcePlugin = createPlugin({ - eventSourceRefiners: JSON_FEED_EVENT_SOURCE_REFINERS, - eventSourceDefs: [eventSourceDef$2], - }); - function buildRequestParams(meta, range, context) { - var dateEnv = context.dateEnv, options = context.options; - var startParam; - var endParam; - var timeZoneParam; - var customRequestParams; - var params = {}; - startParam = meta.startParam; - if (startParam == null) { - startParam = options.startParam; - } - endParam = meta.endParam; - if (endParam == null) { - endParam = options.endParam; - } - timeZoneParam = meta.timeZoneParam; - if (timeZoneParam == null) { - timeZoneParam = options.timeZoneParam; - } - // retrieve any outbound GET/POST data from the options - if (typeof meta.extraParams === 'function') { - // supplied as a function that returns a key/value object - customRequestParams = meta.extraParams(); - } - else { - // probably supplied as a straight key/value object - customRequestParams = meta.extraParams || {}; - } - __assign(params, customRequestParams); - params[startParam] = dateEnv.formatIso(range.start); - params[endParam] = dateEnv.formatIso(range.end); - if (dateEnv.timeZone !== 'local') { - params[timeZoneParam] = dateEnv.timeZone; - } - return params; - } - - var SIMPLE_RECURRING_REFINERS = { - daysOfWeek: identity, - startTime: createDuration, - endTime: createDuration, - duration: createDuration, - startRecur: identity, - endRecur: identity, - }; - - var recurring = { - parse: function (refined, dateEnv) { - if (refined.daysOfWeek || refined.startTime || refined.endTime || refined.startRecur || refined.endRecur) { - var recurringData = { - daysOfWeek: refined.daysOfWeek || null, - startTime: refined.startTime || null, - endTime: refined.endTime || null, - startRecur: refined.startRecur ? dateEnv.createMarker(refined.startRecur) : null, - endRecur: refined.endRecur ? dateEnv.createMarker(refined.endRecur) : null, - }; - var duration = void 0; - if (refined.duration) { - duration = refined.duration; - } - if (!duration && refined.startTime && refined.endTime) { - duration = subtractDurations(refined.endTime, refined.startTime); - } - return { - allDayGuess: Boolean(!refined.startTime && !refined.endTime), - duration: duration, - typeData: recurringData, - }; - } - return null; - }, - expand: function (typeData, framingRange, dateEnv) { - var clippedFramingRange = intersectRanges(framingRange, { start: typeData.startRecur, end: typeData.endRecur }); - if (clippedFramingRange) { - return expandRanges(typeData.daysOfWeek, typeData.startTime, clippedFramingRange, dateEnv); - } - return []; - }, - }; - var simpleRecurringEventsPlugin = createPlugin({ - recurringTypes: [recurring], - eventRefiners: SIMPLE_RECURRING_REFINERS, - }); - function expandRanges(daysOfWeek, startTime, framingRange, dateEnv) { - var dowHash = daysOfWeek ? arrayToHash(daysOfWeek) : null; - var dayMarker = startOfDay(framingRange.start); - var endMarker = framingRange.end; - var instanceStarts = []; - while (dayMarker < endMarker) { - var instanceStart - // if everyday, or this particular day-of-week - = void 0; - // if everyday, or this particular day-of-week - if (!dowHash || dowHash[dayMarker.getUTCDay()]) { - if (startTime) { - instanceStart = dateEnv.add(dayMarker, startTime); - } - else { - instanceStart = dayMarker; - } - instanceStarts.push(instanceStart); - } - dayMarker = addDays(dayMarker, 1); - } - return instanceStarts; - } - - var changeHandlerPlugin = createPlugin({ - optionChangeHandlers: { - events: function (events, context) { - handleEventSources([events], context); - }, - eventSources: handleEventSources, - }, - }); - /* - BUG: if `event` was supplied, all previously-given `eventSources` will be wiped out - */ - function handleEventSources(inputs, context) { - var unfoundSources = hashValuesToArray(context.getCurrentData().eventSources); - var newInputs = []; - for (var _i = 0, inputs_1 = inputs; _i < inputs_1.length; _i++) { - var input = inputs_1[_i]; - var inputFound = false; - for (var i = 0; i < unfoundSources.length; i += 1) { - if (unfoundSources[i]._raw === input) { - unfoundSources.splice(i, 1); // delete - inputFound = true; - break; - } - } - if (!inputFound) { - newInputs.push(input); - } - } - for (var _a = 0, unfoundSources_1 = unfoundSources; _a < unfoundSources_1.length; _a++) { - var unfoundSource = unfoundSources_1[_a]; - context.dispatch({ - type: 'REMOVE_EVENT_SOURCE', - sourceId: unfoundSource.sourceId, - }); - } - for (var _b = 0, newInputs_1 = newInputs; _b < newInputs_1.length; _b++) { - var newInput = newInputs_1[_b]; - context.calendarApi.addEventSource(newInput); - } - } - - function handleDateProfile(dateProfile, context) { - context.emitter.trigger('datesSet', __assign(__assign({}, buildRangeApiWithTimeZone(dateProfile.activeRange, context.dateEnv)), { view: context.viewApi })); - } - - function handleEventStore(eventStore, context) { - var emitter = context.emitter; - if (emitter.hasHandlers('eventsSet')) { - emitter.trigger('eventsSet', buildEventApis(eventStore, context)); - } - } - - /* - this array is exposed on the root namespace so that UMD plugins can add to it. - see the rollup-bundles script. - */ - var globalPlugins = [ - arrayEventSourcePlugin, - funcEventSourcePlugin, - jsonFeedEventSourcePlugin, - simpleRecurringEventsPlugin, - changeHandlerPlugin, - createPlugin({ - isLoadingFuncs: [ - function (state) { return computeEventSourcesLoading(state.eventSources); }, - ], - contentTypeHandlers: { - html: function () { return ({ render: injectHtml }); }, - domNodes: function () { return ({ render: injectDomNodes }); }, - }, - propSetHandlers: { - dateProfile: handleDateProfile, - eventStore: handleEventStore, - }, - }), - ]; - function injectHtml(el, html) { - el.innerHTML = html; - } - function injectDomNodes(el, domNodes) { - var oldNodes = Array.prototype.slice.call(el.childNodes); // TODO: use array util - var newNodes = Array.prototype.slice.call(domNodes); // TODO: use array util - if (!isArraysEqual(oldNodes, newNodes)) { - for (var _i = 0, newNodes_1 = newNodes; _i < newNodes_1.length; _i++) { - var newNode = newNodes_1[_i]; - el.appendChild(newNode); - } - oldNodes.forEach(removeElement); - } - } - - var DelayedRunner = /** @class */ (function () { - function DelayedRunner(drainedOption) { - this.drainedOption = drainedOption; - this.isRunning = false; - this.isDirty = false; - this.pauseDepths = {}; - this.timeoutId = 0; - } - DelayedRunner.prototype.request = function (delay) { - this.isDirty = true; - if (!this.isPaused()) { - this.clearTimeout(); - if (delay == null) { - this.tryDrain(); - } - else { - this.timeoutId = setTimeout(// NOT OPTIMAL! TODO: look at debounce - this.tryDrain.bind(this), delay); - } - } - }; - DelayedRunner.prototype.pause = function (scope) { - if (scope === void 0) { scope = ''; } - var pauseDepths = this.pauseDepths; - pauseDepths[scope] = (pauseDepths[scope] || 0) + 1; - this.clearTimeout(); - }; - DelayedRunner.prototype.resume = function (scope, force) { - if (scope === void 0) { scope = ''; } - var pauseDepths = this.pauseDepths; - if (scope in pauseDepths) { - if (force) { - delete pauseDepths[scope]; - } - else { - pauseDepths[scope] -= 1; - var depth = pauseDepths[scope]; - if (depth <= 0) { - delete pauseDepths[scope]; - } - } - this.tryDrain(); - } - }; - DelayedRunner.prototype.isPaused = function () { - return Object.keys(this.pauseDepths).length; - }; - DelayedRunner.prototype.tryDrain = function () { - if (!this.isRunning && !this.isPaused()) { - this.isRunning = true; - while (this.isDirty) { - this.isDirty = false; - this.drained(); // might set isDirty to true again - } - this.isRunning = false; - } - }; - DelayedRunner.prototype.clear = function () { - this.clearTimeout(); - this.isDirty = false; - this.pauseDepths = {}; - }; - DelayedRunner.prototype.clearTimeout = function () { - if (this.timeoutId) { - clearTimeout(this.timeoutId); - this.timeoutId = 0; - } - }; - DelayedRunner.prototype.drained = function () { - if (this.drainedOption) { - this.drainedOption(); - } - }; - return DelayedRunner; - }()); - - var TaskRunner = /** @class */ (function () { - function TaskRunner(runTaskOption, drainedOption) { - this.runTaskOption = runTaskOption; - this.drainedOption = drainedOption; - this.queue = []; - this.delayedRunner = new DelayedRunner(this.drain.bind(this)); - } - TaskRunner.prototype.request = function (task, delay) { - this.queue.push(task); - this.delayedRunner.request(delay); - }; - TaskRunner.prototype.pause = function (scope) { - this.delayedRunner.pause(scope); - }; - TaskRunner.prototype.resume = function (scope, force) { - this.delayedRunner.resume(scope, force); - }; - TaskRunner.prototype.drain = function () { - var queue = this.queue; - while (queue.length) { - var completedTasks = []; - var task = void 0; - while ((task = queue.shift())) { - this.runTask(task); - completedTasks.push(task); - } - this.drained(completedTasks); - } // keep going, in case new tasks were added in the drained handler - }; - TaskRunner.prototype.runTask = function (task) { - if (this.runTaskOption) { - this.runTaskOption(task); - } - }; - TaskRunner.prototype.drained = function (completedTasks) { - if (this.drainedOption) { - this.drainedOption(completedTasks); - } - }; - return TaskRunner; - }()); - - // Computes what the title at the top of the calendarApi should be for this view - function buildTitle(dateProfile, viewOptions, dateEnv) { - var range; - // for views that span a large unit of time, show the proper interval, ignoring stray days before and after - if (/^(year|month)$/.test(dateProfile.currentRangeUnit)) { - range = dateProfile.currentRange; - } - else { // for day units or smaller, use the actual day range - range = dateProfile.activeRange; - } - return dateEnv.formatRange(range.start, range.end, createFormatter(viewOptions.titleFormat || buildTitleFormat(dateProfile)), { - isEndExclusive: dateProfile.isRangeAllDay, - defaultSeparator: viewOptions.titleRangeSeparator, - }); - } - // Generates the format string that should be used to generate the title for the current date range. - // Attempts to compute the most appropriate format if not explicitly specified with `titleFormat`. - function buildTitleFormat(dateProfile) { - var currentRangeUnit = dateProfile.currentRangeUnit; - if (currentRangeUnit === 'year') { - return { year: 'numeric' }; - } - if (currentRangeUnit === 'month') { - return { year: 'numeric', month: 'long' }; // like "September 2014" - } - var days = diffWholeDays(dateProfile.currentRange.start, dateProfile.currentRange.end); - if (days !== null && days > 1) { - // multi-day range. shorter, like "Sep 9 - 10 2014" - return { year: 'numeric', month: 'short', day: 'numeric' }; - } - // one day. longer, like "September 9 2014" - return { year: 'numeric', month: 'long', day: 'numeric' }; - } - - // in future refactor, do the redux-style function(state=initial) for initial-state - // also, whatever is happening in constructor, have it happen in action queue too - var CalendarDataManager = /** @class */ (function () { - function CalendarDataManager(props) { - var _this = this; - this.computeOptionsData = memoize(this._computeOptionsData); - this.computeCurrentViewData = memoize(this._computeCurrentViewData); - this.organizeRawLocales = memoize(organizeRawLocales); - this.buildLocale = memoize(buildLocale); - this.buildPluginHooks = buildBuildPluginHooks(); - this.buildDateEnv = memoize(buildDateEnv$1); - this.buildTheme = memoize(buildTheme); - this.parseToolbars = memoize(parseToolbars); - this.buildViewSpecs = memoize(buildViewSpecs); - this.buildDateProfileGenerator = memoizeObjArg(buildDateProfileGenerator); - this.buildViewApi = memoize(buildViewApi); - this.buildViewUiProps = memoizeObjArg(buildViewUiProps); - this.buildEventUiBySource = memoize(buildEventUiBySource, isPropsEqual); - this.buildEventUiBases = memoize(buildEventUiBases); - this.parseContextBusinessHours = memoizeObjArg(parseContextBusinessHours); - this.buildTitle = memoize(buildTitle); - this.emitter = new Emitter(); - this.actionRunner = new TaskRunner(this._handleAction.bind(this), this.updateData.bind(this)); - this.currentCalendarOptionsInput = {}; - this.currentCalendarOptionsRefined = {}; - this.currentViewOptionsInput = {}; - this.currentViewOptionsRefined = {}; - this.currentCalendarOptionsRefiners = {}; - this.getCurrentData = function () { return _this.data; }; - this.dispatch = function (action) { - _this.actionRunner.request(action); // protects against recursive calls to _handleAction - }; - this.props = props; - this.actionRunner.pause(); - var dynamicOptionOverrides = {}; - var optionsData = this.computeOptionsData(props.optionOverrides, dynamicOptionOverrides, props.calendarApi); - var currentViewType = optionsData.calendarOptions.initialView || optionsData.pluginHooks.initialView; - var currentViewData = this.computeCurrentViewData(currentViewType, optionsData, props.optionOverrides, dynamicOptionOverrides); - // wire things up - // TODO: not DRY - props.calendarApi.currentDataManager = this; - this.emitter.setThisContext(props.calendarApi); - this.emitter.setOptions(currentViewData.options); - var currentDate = getInitialDate(optionsData.calendarOptions, optionsData.dateEnv); - var dateProfile = currentViewData.dateProfileGenerator.build(currentDate); - if (!rangeContainsMarker(dateProfile.activeRange, currentDate)) { - currentDate = dateProfile.currentRange.start; - } - var calendarContext = { - dateEnv: optionsData.dateEnv, - options: optionsData.calendarOptions, - pluginHooks: optionsData.pluginHooks, - calendarApi: props.calendarApi, - dispatch: this.dispatch, - emitter: this.emitter, - getCurrentData: this.getCurrentData, - }; - // needs to be after setThisContext - for (var _i = 0, _a = optionsData.pluginHooks.contextInit; _i < _a.length; _i++) { - var callback = _a[_i]; - callback(calendarContext); - } - // NOT DRY - var eventSources = initEventSources(optionsData.calendarOptions, dateProfile, calendarContext); - var initialState = { - dynamicOptionOverrides: dynamicOptionOverrides, - currentViewType: currentViewType, - currentDate: currentDate, - dateProfile: dateProfile, - businessHours: this.parseContextBusinessHours(calendarContext), - eventSources: eventSources, - eventUiBases: {}, - eventStore: createEmptyEventStore(), - renderableEventStore: createEmptyEventStore(), - dateSelection: null, - eventSelection: '', - eventDrag: null, - eventResize: null, - selectionConfig: this.buildViewUiProps(calendarContext).selectionConfig, - }; - var contextAndState = __assign(__assign({}, calendarContext), initialState); - for (var _b = 0, _c = optionsData.pluginHooks.reducers; _b < _c.length; _b++) { - var reducer = _c[_b]; - __assign(initialState, reducer(null, null, contextAndState)); - } - if (computeIsLoading(initialState, calendarContext)) { - this.emitter.trigger('loading', true); // NOT DRY - } - this.state = initialState; - this.updateData(); - this.actionRunner.resume(); - } - CalendarDataManager.prototype.resetOptions = function (optionOverrides, append) { - var props = this.props; - props.optionOverrides = append - ? __assign(__assign({}, props.optionOverrides), optionOverrides) : optionOverrides; - this.actionRunner.request({ - type: 'NOTHING', - }); - }; - CalendarDataManager.prototype._handleAction = function (action) { - var _a = this, props = _a.props, state = _a.state, emitter = _a.emitter; - var dynamicOptionOverrides = reduceDynamicOptionOverrides(state.dynamicOptionOverrides, action); - var optionsData = this.computeOptionsData(props.optionOverrides, dynamicOptionOverrides, props.calendarApi); - var currentViewType = reduceViewType(state.currentViewType, action); - var currentViewData = this.computeCurrentViewData(currentViewType, optionsData, props.optionOverrides, dynamicOptionOverrides); - // wire things up - // TODO: not DRY - props.calendarApi.currentDataManager = this; - emitter.setThisContext(props.calendarApi); - emitter.setOptions(currentViewData.options); - var calendarContext = { - dateEnv: optionsData.dateEnv, - options: optionsData.calendarOptions, - pluginHooks: optionsData.pluginHooks, - calendarApi: props.calendarApi, - dispatch: this.dispatch, - emitter: emitter, - getCurrentData: this.getCurrentData, - }; - var currentDate = state.currentDate, dateProfile = state.dateProfile; - if (this.data && this.data.dateProfileGenerator !== currentViewData.dateProfileGenerator) { // hack - dateProfile = currentViewData.dateProfileGenerator.build(currentDate); - } - currentDate = reduceCurrentDate(currentDate, action); - dateProfile = reduceDateProfile(dateProfile, action, currentDate, currentViewData.dateProfileGenerator); - if (!rangeContainsMarker(dateProfile.currentRange, currentDate)) { - currentDate = dateProfile.currentRange.start; - } - var eventSources = reduceEventSources(state.eventSources, action, dateProfile, calendarContext); - var eventStore = reduceEventStore(state.eventStore, action, eventSources, dateProfile, calendarContext); - var isEventsLoading = computeEventSourcesLoading(eventSources); // BAD. also called in this func in computeIsLoading - var renderableEventStore = (isEventsLoading && !currentViewData.options.progressiveEventRendering) ? - (state.renderableEventStore || eventStore) : // try from previous state - eventStore; - var _b = this.buildViewUiProps(calendarContext), eventUiSingleBase = _b.eventUiSingleBase, selectionConfig = _b.selectionConfig; // will memoize obj - var eventUiBySource = this.buildEventUiBySource(eventSources); - var eventUiBases = this.buildEventUiBases(renderableEventStore.defs, eventUiSingleBase, eventUiBySource); - var newState = { - dynamicOptionOverrides: dynamicOptionOverrides, - currentViewType: currentViewType, - currentDate: currentDate, - dateProfile: dateProfile, - eventSources: eventSources, - eventStore: eventStore, - renderableEventStore: renderableEventStore, - selectionConfig: selectionConfig, - eventUiBases: eventUiBases, - businessHours: this.parseContextBusinessHours(calendarContext), - dateSelection: reduceDateSelection(state.dateSelection, action), - eventSelection: reduceSelectedEvent(state.eventSelection, action), - eventDrag: reduceEventDrag(state.eventDrag, action), - eventResize: reduceEventResize(state.eventResize, action), - }; - var contextAndState = __assign(__assign({}, calendarContext), newState); - for (var _i = 0, _c = optionsData.pluginHooks.reducers; _i < _c.length; _i++) { - var reducer = _c[_i]; - __assign(newState, reducer(state, action, contextAndState)); // give the OLD state, for old value - } - var wasLoading = computeIsLoading(state, calendarContext); - var isLoading = computeIsLoading(newState, calendarContext); - // TODO: use propSetHandlers in plugin system - if (!wasLoading && isLoading) { - emitter.trigger('loading', true); - } - else if (wasLoading && !isLoading) { - emitter.trigger('loading', false); - } - this.state = newState; - if (props.onAction) { - props.onAction(action); - } - }; - CalendarDataManager.prototype.updateData = function () { - var _a = this, props = _a.props, state = _a.state; - var oldData = this.data; - var optionsData = this.computeOptionsData(props.optionOverrides, state.dynamicOptionOverrides, props.calendarApi); - var currentViewData = this.computeCurrentViewData(state.currentViewType, optionsData, props.optionOverrides, state.dynamicOptionOverrides); - var data = this.data = __assign(__assign(__assign({ viewTitle: this.buildTitle(state.dateProfile, currentViewData.options, optionsData.dateEnv), calendarApi: props.calendarApi, dispatch: this.dispatch, emitter: this.emitter, getCurrentData: this.getCurrentData }, optionsData), currentViewData), state); - var changeHandlers = optionsData.pluginHooks.optionChangeHandlers; - var oldCalendarOptions = oldData && oldData.calendarOptions; - var newCalendarOptions = optionsData.calendarOptions; - if (oldCalendarOptions && oldCalendarOptions !== newCalendarOptions) { - if (oldCalendarOptions.timeZone !== newCalendarOptions.timeZone) { - // hack - state.eventSources = data.eventSources = reduceEventSourcesNewTimeZone(data.eventSources, state.dateProfile, data); - state.eventStore = data.eventStore = rezoneEventStoreDates(data.eventStore, oldData.dateEnv, data.dateEnv); - } - for (var optionName in changeHandlers) { - if (oldCalendarOptions[optionName] !== newCalendarOptions[optionName]) { - changeHandlers[optionName](newCalendarOptions[optionName], data); - } - } - } - if (props.onData) { - props.onData(data); - } - }; - CalendarDataManager.prototype._computeOptionsData = function (optionOverrides, dynamicOptionOverrides, calendarApi) { - // TODO: blacklist options that are handled by optionChangeHandlers - var _a = this.processRawCalendarOptions(optionOverrides, dynamicOptionOverrides), refinedOptions = _a.refinedOptions, pluginHooks = _a.pluginHooks, localeDefaults = _a.localeDefaults, availableLocaleData = _a.availableLocaleData, extra = _a.extra; - warnUnknownOptions(extra); - var dateEnv = this.buildDateEnv(refinedOptions.timeZone, refinedOptions.locale, refinedOptions.weekNumberCalculation, refinedOptions.firstDay, refinedOptions.weekText, pluginHooks, availableLocaleData, refinedOptions.defaultRangeSeparator); - var viewSpecs = this.buildViewSpecs(pluginHooks.views, optionOverrides, dynamicOptionOverrides, localeDefaults); - var theme = this.buildTheme(refinedOptions, pluginHooks); - var toolbarConfig = this.parseToolbars(refinedOptions, optionOverrides, theme, viewSpecs, calendarApi); - return { - calendarOptions: refinedOptions, - pluginHooks: pluginHooks, - dateEnv: dateEnv, - viewSpecs: viewSpecs, - theme: theme, - toolbarConfig: toolbarConfig, - localeDefaults: localeDefaults, - availableRawLocales: availableLocaleData.map, - }; - }; - // always called from behind a memoizer - CalendarDataManager.prototype.processRawCalendarOptions = function (optionOverrides, dynamicOptionOverrides) { - var _a = mergeRawOptions([ - BASE_OPTION_DEFAULTS, - optionOverrides, - dynamicOptionOverrides, - ]), locales = _a.locales, locale = _a.locale; - var availableLocaleData = this.organizeRawLocales(locales); - var availableRawLocales = availableLocaleData.map; - var localeDefaults = this.buildLocale(locale || availableLocaleData.defaultCode, availableRawLocales).options; - var pluginHooks = this.buildPluginHooks(optionOverrides.plugins || [], globalPlugins); - var refiners = this.currentCalendarOptionsRefiners = __assign(__assign(__assign(__assign(__assign({}, BASE_OPTION_REFINERS), CALENDAR_LISTENER_REFINERS), CALENDAR_OPTION_REFINERS), pluginHooks.listenerRefiners), pluginHooks.optionRefiners); - var extra = {}; - var raw = mergeRawOptions([ - BASE_OPTION_DEFAULTS, - localeDefaults, - optionOverrides, - dynamicOptionOverrides, - ]); - var refined = {}; - var currentRaw = this.currentCalendarOptionsInput; - var currentRefined = this.currentCalendarOptionsRefined; - var anyChanges = false; - for (var optionName in raw) { - if (optionName !== 'plugins') { // because plugins is special-cased - if (raw[optionName] === currentRaw[optionName] || - (COMPLEX_OPTION_COMPARATORS[optionName] && - (optionName in currentRaw) && - COMPLEX_OPTION_COMPARATORS[optionName](currentRaw[optionName], raw[optionName]))) { - refined[optionName] = currentRefined[optionName]; - } - else if (refiners[optionName]) { - refined[optionName] = refiners[optionName](raw[optionName]); - anyChanges = true; - } - else { - extra[optionName] = currentRaw[optionName]; - } - } - } - if (anyChanges) { - this.currentCalendarOptionsInput = raw; - this.currentCalendarOptionsRefined = refined; - } - return { - rawOptions: this.currentCalendarOptionsInput, - refinedOptions: this.currentCalendarOptionsRefined, - pluginHooks: pluginHooks, - availableLocaleData: availableLocaleData, - localeDefaults: localeDefaults, - extra: extra, - }; - }; - CalendarDataManager.prototype._computeCurrentViewData = function (viewType, optionsData, optionOverrides, dynamicOptionOverrides) { - var viewSpec = optionsData.viewSpecs[viewType]; - if (!viewSpec) { - throw new Error("viewType \"" + viewType + "\" is not available. Please make sure you've loaded all neccessary plugins"); - } - var _a = this.processRawViewOptions(viewSpec, optionsData.pluginHooks, optionsData.localeDefaults, optionOverrides, dynamicOptionOverrides), refinedOptions = _a.refinedOptions, extra = _a.extra; - warnUnknownOptions(extra); - var dateProfileGenerator = this.buildDateProfileGenerator({ - dateProfileGeneratorClass: viewSpec.optionDefaults.dateProfileGeneratorClass, - duration: viewSpec.duration, - durationUnit: viewSpec.durationUnit, - usesMinMaxTime: viewSpec.optionDefaults.usesMinMaxTime, - dateEnv: optionsData.dateEnv, - calendarApi: this.props.calendarApi, - slotMinTime: refinedOptions.slotMinTime, - slotMaxTime: refinedOptions.slotMaxTime, - showNonCurrentDates: refinedOptions.showNonCurrentDates, - dayCount: refinedOptions.dayCount, - dateAlignment: refinedOptions.dateAlignment, - dateIncrement: refinedOptions.dateIncrement, - hiddenDays: refinedOptions.hiddenDays, - weekends: refinedOptions.weekends, - nowInput: refinedOptions.now, - validRangeInput: refinedOptions.validRange, - visibleRangeInput: refinedOptions.visibleRange, - monthMode: refinedOptions.monthMode, - fixedWeekCount: refinedOptions.fixedWeekCount, - }); - var viewApi = this.buildViewApi(viewType, this.getCurrentData, optionsData.dateEnv); - return { viewSpec: viewSpec, options: refinedOptions, dateProfileGenerator: dateProfileGenerator, viewApi: viewApi }; - }; - CalendarDataManager.prototype.processRawViewOptions = function (viewSpec, pluginHooks, localeDefaults, optionOverrides, dynamicOptionOverrides) { - var raw = mergeRawOptions([ - BASE_OPTION_DEFAULTS, - viewSpec.optionDefaults, - localeDefaults, - optionOverrides, - viewSpec.optionOverrides, - dynamicOptionOverrides, - ]); - var refiners = __assign(__assign(__assign(__assign(__assign(__assign({}, BASE_OPTION_REFINERS), CALENDAR_LISTENER_REFINERS), CALENDAR_OPTION_REFINERS), VIEW_OPTION_REFINERS), pluginHooks.listenerRefiners), pluginHooks.optionRefiners); - var refined = {}; - var currentRaw = this.currentViewOptionsInput; - var currentRefined = this.currentViewOptionsRefined; - var anyChanges = false; - var extra = {}; - for (var optionName in raw) { - if (raw[optionName] === currentRaw[optionName]) { - refined[optionName] = currentRefined[optionName]; - } - else { - if (raw[optionName] === this.currentCalendarOptionsInput[optionName]) { - if (optionName in this.currentCalendarOptionsRefined) { // might be an "extra" prop - refined[optionName] = this.currentCalendarOptionsRefined[optionName]; - } - } - else if (refiners[optionName]) { - refined[optionName] = refiners[optionName](raw[optionName]); - } - else { - extra[optionName] = raw[optionName]; - } - anyChanges = true; - } - } - if (anyChanges) { - this.currentViewOptionsInput = raw; - this.currentViewOptionsRefined = refined; - } - return { - rawOptions: this.currentViewOptionsInput, - refinedOptions: this.currentViewOptionsRefined, - extra: extra, - }; - }; - return CalendarDataManager; - }()); - function buildDateEnv$1(timeZone, explicitLocale, weekNumberCalculation, firstDay, weekText, pluginHooks, availableLocaleData, defaultSeparator) { - var locale = buildLocale(explicitLocale || availableLocaleData.defaultCode, availableLocaleData.map); - return new DateEnv({ - calendarSystem: 'gregory', - timeZone: timeZone, - namedTimeZoneImpl: pluginHooks.namedTimeZonedImpl, - locale: locale, - weekNumberCalculation: weekNumberCalculation, - firstDay: firstDay, - weekText: weekText, - cmdFormatter: pluginHooks.cmdFormatter, - defaultSeparator: defaultSeparator, - }); - } - function buildTheme(options, pluginHooks) { - var ThemeClass = pluginHooks.themeClasses[options.themeSystem] || StandardTheme; - return new ThemeClass(options); - } - function buildDateProfileGenerator(props) { - var DateProfileGeneratorClass = props.dateProfileGeneratorClass || DateProfileGenerator; - return new DateProfileGeneratorClass(props); - } - function buildViewApi(type, getCurrentData, dateEnv) { - return new ViewApi(type, getCurrentData, dateEnv); - } - function buildEventUiBySource(eventSources) { - return mapHash(eventSources, function (eventSource) { return eventSource.ui; }); - } - function buildEventUiBases(eventDefs, eventUiSingleBase, eventUiBySource) { - var eventUiBases = { '': eventUiSingleBase }; - for (var defId in eventDefs) { - var def = eventDefs[defId]; - if (def.sourceId && eventUiBySource[def.sourceId]) { - eventUiBases[defId] = eventUiBySource[def.sourceId]; - } - } - return eventUiBases; - } - function buildViewUiProps(calendarContext) { - var options = calendarContext.options; - return { - eventUiSingleBase: createEventUi({ - display: options.eventDisplay, - editable: options.editable, - startEditable: options.eventStartEditable, - durationEditable: options.eventDurationEditable, - constraint: options.eventConstraint, - overlap: typeof options.eventOverlap === 'boolean' ? options.eventOverlap : undefined, - allow: options.eventAllow, - backgroundColor: options.eventBackgroundColor, - borderColor: options.eventBorderColor, - textColor: options.eventTextColor, - color: options.eventColor, - }, calendarContext), - selectionConfig: createEventUi({ - constraint: options.selectConstraint, - overlap: typeof options.selectOverlap === 'boolean' ? options.selectOverlap : undefined, - allow: options.selectAllow, - }, calendarContext), - }; - } - function computeIsLoading(state, context) { - for (var _i = 0, _a = context.pluginHooks.isLoadingFuncs; _i < _a.length; _i++) { - var isLoadingFunc = _a[_i]; - if (isLoadingFunc(state)) { - return true; - } - } - return false; - } - function parseContextBusinessHours(calendarContext) { - return parseBusinessHours(calendarContext.options.businessHours, calendarContext); - } - function warnUnknownOptions(options, viewName) { - for (var optionName in options) { - console.warn("Unknown option '" + optionName + "'" + - (viewName ? " for view '" + viewName + "'" : '')); - } - } - - // TODO: move this to react plugin? - var CalendarDataProvider = /** @class */ (function (_super) { - __extends(CalendarDataProvider, _super); - function CalendarDataProvider(props) { - var _this = _super.call(this, props) || this; - _this.handleData = function (data) { - if (!_this.dataManager) { // still within initial run, before assignment in constructor - // eslint-disable-next-line react/no-direct-mutation-state - _this.state = data; // can't use setState yet - } - else { - _this.setState(data); - } - }; - _this.dataManager = new CalendarDataManager({ - optionOverrides: props.optionOverrides, - calendarApi: props.calendarApi, - onData: _this.handleData, - }); - return _this; - } - CalendarDataProvider.prototype.render = function () { - return this.props.children(this.state); - }; - CalendarDataProvider.prototype.componentDidUpdate = function (prevProps) { - var newOptionOverrides = this.props.optionOverrides; - if (newOptionOverrides !== prevProps.optionOverrides) { // prevent recursive handleData - this.dataManager.resetOptions(newOptionOverrides); - } - }; - return CalendarDataProvider; - }(Component)); - - // HELPERS - /* - if nextDayThreshold is specified, slicing is done in an all-day fashion. - you can get nextDayThreshold from context.nextDayThreshold - */ - function sliceEvents(props, allDay) { - return sliceEventStore(props.eventStore, props.eventUiBases, props.dateProfile.activeRange, allDay ? props.nextDayThreshold : null).fg; - } - - var NamedTimeZoneImpl = /** @class */ (function () { - function NamedTimeZoneImpl(timeZoneName) { - this.timeZoneName = timeZoneName; - } - return NamedTimeZoneImpl; - }()); - - var Interaction = /** @class */ (function () { - function Interaction(settings) { - this.component = settings.component; - } - Interaction.prototype.destroy = function () { - }; - return Interaction; - }()); - function parseInteractionSettings(component, input) { - return { - component: component, - el: input.el, - useEventCenter: input.useEventCenter != null ? input.useEventCenter : true, - }; - } - function interactionSettingsToStore(settings) { - var _a; - return _a = {}, - _a[settings.component.uid] = settings, - _a; - } - // global state - var interactionSettingsStore = {}; - - /* - An abstraction for a dragging interaction originating on an event. - Does higher-level things than PointerDragger, such as possibly: - - a "mirror" that moves with the pointer - - a minimum number of pixels or other criteria for a true drag to begin - - subclasses must emit: - - pointerdown - - dragstart - - dragmove - - pointerup - - dragend - */ - var ElementDragging = /** @class */ (function () { - function ElementDragging(el, selector) { - this.emitter = new Emitter(); - } - ElementDragging.prototype.destroy = function () { - }; - ElementDragging.prototype.setMirrorIsVisible = function (bool) { - // optional if subclass doesn't want to support a mirror - }; - ElementDragging.prototype.setMirrorNeedsRevert = function (bool) { - // optional if subclass doesn't want to support a mirror - }; - ElementDragging.prototype.setAutoScrollEnabled = function (bool) { - // optional - }; - return ElementDragging; - }()); - - // TODO: get rid of this in favor of options system, - // tho it's really easy to access this globally rather than pass thru options. - var config = {}; - - /* - Information about what will happen when an external element is dragged-and-dropped - onto a calendar. Contains information for creating an event. - */ - var DRAG_META_REFINERS = { - startTime: createDuration, - duration: createDuration, - create: Boolean, - sourceId: String, - }; - function parseDragMeta(raw) { - var _a = refineProps(raw, DRAG_META_REFINERS), refined = _a.refined, extra = _a.extra; - return { - startTime: refined.startTime || null, - duration: refined.duration || null, - create: refined.create != null ? refined.create : true, - sourceId: refined.sourceId, - leftoverProps: extra, - }; - } - - var ToolbarSection = /** @class */ (function (_super) { - __extends(ToolbarSection, _super); - function ToolbarSection() { - return _super !== null && _super.apply(this, arguments) || this; - } - ToolbarSection.prototype.render = function () { - var _this = this; - var children = this.props.widgetGroups.map(function (widgetGroup) { return _this.renderWidgetGroup(widgetGroup); }); - return createElement.apply(void 0, __spreadArrays(['div', { className: 'fc-toolbar-chunk' }], children)); - }; - ToolbarSection.prototype.renderWidgetGroup = function (widgetGroup) { - var props = this.props; - var theme = this.context.theme; - var children = []; - var isOnlyButtons = true; - for (var _i = 0, widgetGroup_1 = widgetGroup; _i < widgetGroup_1.length; _i++) { - var widget = widgetGroup_1[_i]; - var buttonName = widget.buttonName, buttonClick = widget.buttonClick, buttonText = widget.buttonText, buttonIcon = widget.buttonIcon; - if (buttonName === 'title') { - isOnlyButtons = false; - children.push(createElement("h2", { className: "fc-toolbar-title" }, props.title)); - } - else { - var ariaAttrs = buttonIcon ? { 'aria-label': buttonName } : {}; - var buttonClasses = ["fc-" + buttonName + "-button", theme.getClass('button')]; - if (buttonName === props.activeButton) { - buttonClasses.push(theme.getClass('buttonActive')); - } - var isDisabled = (!props.isTodayEnabled && buttonName === 'today') || - (!props.isPrevEnabled && buttonName === 'prev') || - (!props.isNextEnabled && buttonName === 'next'); - children.push(createElement("button", __assign({ disabled: isDisabled, className: buttonClasses.join(' '), onClick: buttonClick, type: "button" }, ariaAttrs), buttonText || (buttonIcon ? createElement("span", { className: buttonIcon }) : ''))); - } - } - if (children.length > 1) { - var groupClassName = (isOnlyButtons && theme.getClass('buttonGroup')) || ''; - return createElement.apply(void 0, __spreadArrays(['div', { className: groupClassName }], children)); - } - return children[0]; - }; - return ToolbarSection; - }(BaseComponent)); - - var Toolbar = /** @class */ (function (_super) { - __extends(Toolbar, _super); - function Toolbar() { - return _super !== null && _super.apply(this, arguments) || this; - } - Toolbar.prototype.render = function () { - var _a = this.props, model = _a.model, extraClassName = _a.extraClassName; - var forceLtr = false; - var startContent; - var endContent; - var centerContent = model.center; - if (model.left) { - forceLtr = true; - startContent = model.left; - } - else { - startContent = model.start; - } - if (model.right) { - forceLtr = true; - endContent = model.right; - } - else { - endContent = model.end; - } - var classNames = [ - extraClassName || '', - 'fc-toolbar', - forceLtr ? 'fc-toolbar-ltr' : '', - ]; - return (createElement("div", { className: classNames.join(' ') }, - this.renderSection('start', startContent || []), - this.renderSection('center', centerContent || []), - this.renderSection('end', endContent || []))); - }; - Toolbar.prototype.renderSection = function (key, widgetGroups) { - var props = this.props; - return (createElement(ToolbarSection, { key: key, widgetGroups: widgetGroups, title: props.title, activeButton: props.activeButton, isTodayEnabled: props.isTodayEnabled, isPrevEnabled: props.isPrevEnabled, isNextEnabled: props.isNextEnabled })); - }; - return Toolbar; - }(BaseComponent)); - - // TODO: do function component? - var ViewContainer = /** @class */ (function (_super) { - __extends(ViewContainer, _super); - function ViewContainer() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.state = { - availableWidth: null, - }; - _this.handleEl = function (el) { - _this.el = el; - setRef(_this.props.elRef, el); - _this.updateAvailableWidth(); - }; - _this.handleResize = function () { - _this.updateAvailableWidth(); - }; - return _this; - } - ViewContainer.prototype.render = function () { - var _a = this, props = _a.props, state = _a.state; - var aspectRatio = props.aspectRatio; - var classNames = [ - 'fc-view-harness', - (aspectRatio || props.liquid || props.height) - ? 'fc-view-harness-active' // harness controls the height - : 'fc-view-harness-passive', - ]; - var height = ''; - var paddingBottom = ''; - if (aspectRatio) { - if (state.availableWidth !== null) { - height = state.availableWidth / aspectRatio; - } - else { - // while waiting to know availableWidth, we can't set height to *zero* - // because will cause lots of unnecessary scrollbars within scrollgrid. - // BETTER: don't start rendering ANYTHING yet until we know container width - // NOTE: why not always use paddingBottom? Causes height oscillation (issue 5606) - paddingBottom = (1 / aspectRatio) * 100 + "%"; - } - } - else { - height = props.height || ''; - } - return (createElement("div", { ref: this.handleEl, onClick: props.onClick, className: classNames.join(' '), style: { height: height, paddingBottom: paddingBottom } }, props.children)); - }; - ViewContainer.prototype.componentDidMount = function () { - this.context.addResizeHandler(this.handleResize); - }; - ViewContainer.prototype.componentWillUnmount = function () { - this.context.removeResizeHandler(this.handleResize); - }; - ViewContainer.prototype.updateAvailableWidth = function () { - if (this.el && // needed. but why? - this.props.aspectRatio // aspectRatio is the only height setting that needs availableWidth - ) { - this.setState({ availableWidth: this.el.offsetWidth }); - } - }; - return ViewContainer; - }(BaseComponent)); - - /* - Detects when the user clicks on an event within a DateComponent - */ - var EventClicking = /** @class */ (function (_super) { - __extends(EventClicking, _super); - function EventClicking(settings) { - var _this = _super.call(this, settings) || this; - _this.handleSegClick = function (ev, segEl) { - var component = _this.component; - var context = component.context; - var seg = getElSeg(segEl); - if (seg && // might be the <div> surrounding the more link - component.isValidSegDownEl(ev.target)) { - // our way to simulate a link click for elements that can't be <a> tags - // grab before trigger fired in case trigger trashes DOM thru rerendering - var hasUrlContainer = elementClosest(ev.target, '.fc-event-forced-url'); - var url = hasUrlContainer ? hasUrlContainer.querySelector('a[href]').href : ''; - context.emitter.trigger('eventClick', { - el: segEl, - event: new EventApi(component.context, seg.eventRange.def, seg.eventRange.instance), - jsEvent: ev, - view: context.viewApi, - }); - if (url && !ev.defaultPrevented) { - window.location.href = url; - } - } - }; - _this.destroy = listenBySelector(settings.el, 'click', '.fc-event', // on both fg and bg events - _this.handleSegClick); - return _this; - } - return EventClicking; - }(Interaction)); - - /* - Triggers events and adds/removes core classNames when the user's pointer - enters/leaves event-elements of a component. - */ - var EventHovering = /** @class */ (function (_super) { - __extends(EventHovering, _super); - function EventHovering(settings) { - var _this = _super.call(this, settings) || this; - // for simulating an eventMouseLeave when the event el is destroyed while mouse is over it - _this.handleEventElRemove = function (el) { - if (el === _this.currentSegEl) { - _this.handleSegLeave(null, _this.currentSegEl); - } - }; - _this.handleSegEnter = function (ev, segEl) { - if (getElSeg(segEl)) { // TODO: better way to make sure not hovering over more+ link or its wrapper - _this.currentSegEl = segEl; - _this.triggerEvent('eventMouseEnter', ev, segEl); - } - }; - _this.handleSegLeave = function (ev, segEl) { - if (_this.currentSegEl) { - _this.currentSegEl = null; - _this.triggerEvent('eventMouseLeave', ev, segEl); - } - }; - _this.removeHoverListeners = listenToHoverBySelector(settings.el, '.fc-event', // on both fg and bg events - _this.handleSegEnter, _this.handleSegLeave); - return _this; - } - EventHovering.prototype.destroy = function () { - this.removeHoverListeners(); - }; - EventHovering.prototype.triggerEvent = function (publicEvName, ev, segEl) { - var component = this.component; - var context = component.context; - var seg = getElSeg(segEl); - if (!ev || component.isValidSegDownEl(ev.target)) { - context.emitter.trigger(publicEvName, { - el: segEl, - event: new EventApi(context, seg.eventRange.def, seg.eventRange.instance), - jsEvent: ev, - view: context.viewApi, - }); - } - }; - return EventHovering; - }(Interaction)); - - var CalendarContent = /** @class */ (function (_super) { - __extends(CalendarContent, _super); - function CalendarContent() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.buildViewContext = memoize(buildViewContext); - _this.buildViewPropTransformers = memoize(buildViewPropTransformers); - _this.buildToolbarProps = memoize(buildToolbarProps); - _this.handleNavLinkClick = buildDelegationHandler('a[data-navlink]', _this._handleNavLinkClick.bind(_this)); - _this.headerRef = createRef(); - _this.footerRef = createRef(); - _this.interactionsStore = {}; - // Component Registration - // ----------------------------------------------------------------------------------------------------------------- - _this.registerInteractiveComponent = function (component, settingsInput) { - var settings = parseInteractionSettings(component, settingsInput); - var DEFAULT_INTERACTIONS = [ - EventClicking, - EventHovering, - ]; - var interactionClasses = DEFAULT_INTERACTIONS.concat(_this.props.pluginHooks.componentInteractions); - var interactions = interactionClasses.map(function (TheInteractionClass) { return new TheInteractionClass(settings); }); - _this.interactionsStore[component.uid] = interactions; - interactionSettingsStore[component.uid] = settings; - }; - _this.unregisterInteractiveComponent = function (component) { - for (var _i = 0, _a = _this.interactionsStore[component.uid]; _i < _a.length; _i++) { - var listener = _a[_i]; - listener.destroy(); - } - delete _this.interactionsStore[component.uid]; - delete interactionSettingsStore[component.uid]; - }; - // Resizing - // ----------------------------------------------------------------------------------------------------------------- - _this.resizeRunner = new DelayedRunner(function () { - _this.props.emitter.trigger('_resize', true); // should window resizes be considered "forced" ? - _this.props.emitter.trigger('windowResize', { view: _this.props.viewApi }); - }); - _this.handleWindowResize = function (ev) { - var options = _this.props.options; - if (options.handleWindowResize && - ev.target === window // avoid jqui events - ) { - _this.resizeRunner.request(options.windowResizeDelay); - } - }; - return _this; - } - /* - renders INSIDE of an outer div - */ - CalendarContent.prototype.render = function () { - var props = this.props; - var toolbarConfig = props.toolbarConfig, options = props.options; - var toolbarProps = this.buildToolbarProps(props.viewSpec, props.dateProfile, props.dateProfileGenerator, props.currentDate, getNow(props.options.now, props.dateEnv), // TODO: use NowTimer???? - props.viewTitle); - var viewVGrow = false; - var viewHeight = ''; - var viewAspectRatio; - if (props.isHeightAuto || props.forPrint) { - viewHeight = ''; - } - else if (options.height != null) { - viewVGrow = true; - } - else if (options.contentHeight != null) { - viewHeight = options.contentHeight; - } - else { - viewAspectRatio = Math.max(options.aspectRatio, 0.5); // prevent from getting too tall - } - var viewContext = this.buildViewContext(props.viewSpec, props.viewApi, props.options, props.dateProfileGenerator, props.dateEnv, props.theme, props.pluginHooks, props.dispatch, props.getCurrentData, props.emitter, props.calendarApi, this.registerInteractiveComponent, this.unregisterInteractiveComponent); - return (createElement(ViewContextType.Provider, { value: viewContext }, - toolbarConfig.headerToolbar && (createElement(Toolbar, __assign({ ref: this.headerRef, extraClassName: "fc-header-toolbar", model: toolbarConfig.headerToolbar }, toolbarProps))), - createElement(ViewContainer, { liquid: viewVGrow, height: viewHeight, aspectRatio: viewAspectRatio, onClick: this.handleNavLinkClick }, - this.renderView(props), - this.buildAppendContent()), - toolbarConfig.footerToolbar && (createElement(Toolbar, __assign({ ref: this.footerRef, extraClassName: "fc-footer-toolbar", model: toolbarConfig.footerToolbar }, toolbarProps))))); - }; - CalendarContent.prototype.componentDidMount = function () { - var props = this.props; - this.calendarInteractions = props.pluginHooks.calendarInteractions - .map(function (CalendarInteractionClass) { return new CalendarInteractionClass(props); }); - window.addEventListener('resize', this.handleWindowResize); - var propSetHandlers = props.pluginHooks.propSetHandlers; - for (var propName in propSetHandlers) { - propSetHandlers[propName](props[propName], props); - } - }; - CalendarContent.prototype.componentDidUpdate = function (prevProps) { - var props = this.props; - var propSetHandlers = props.pluginHooks.propSetHandlers; - for (var propName in propSetHandlers) { - if (props[propName] !== prevProps[propName]) { - propSetHandlers[propName](props[propName], props); - } - } - }; - CalendarContent.prototype.componentWillUnmount = function () { - window.removeEventListener('resize', this.handleWindowResize); - this.resizeRunner.clear(); - for (var _i = 0, _a = this.calendarInteractions; _i < _a.length; _i++) { - var interaction = _a[_i]; - interaction.destroy(); - } - this.props.emitter.trigger('_unmount'); - }; - CalendarContent.prototype._handleNavLinkClick = function (ev, anchorEl) { - var _a = this.props, dateEnv = _a.dateEnv, options = _a.options, calendarApi = _a.calendarApi; - var navLinkOptions = anchorEl.getAttribute('data-navlink'); - navLinkOptions = navLinkOptions ? JSON.parse(navLinkOptions) : {}; - var dateMarker = dateEnv.createMarker(navLinkOptions.date); - var viewType = navLinkOptions.type; - var customAction = viewType === 'day' ? options.navLinkDayClick : - viewType === 'week' ? options.navLinkWeekClick : null; - if (typeof customAction === 'function') { - customAction.call(calendarApi, dateEnv.toDate(dateMarker), ev); - } - else { - if (typeof customAction === 'string') { - viewType = customAction; - } - calendarApi.zoomTo(dateMarker, viewType); - } - }; - CalendarContent.prototype.buildAppendContent = function () { - var props = this.props; - var children = props.pluginHooks.viewContainerAppends.map(function (buildAppendContent) { return buildAppendContent(props); }); - return createElement.apply(void 0, __spreadArrays([Fragment, {}], children)); - }; - CalendarContent.prototype.renderView = function (props) { - var pluginHooks = props.pluginHooks; - var viewSpec = props.viewSpec; - var viewProps = { - dateProfile: props.dateProfile, - businessHours: props.businessHours, - eventStore: props.renderableEventStore, - eventUiBases: props.eventUiBases, - dateSelection: props.dateSelection, - eventSelection: props.eventSelection, - eventDrag: props.eventDrag, - eventResize: props.eventResize, - isHeightAuto: props.isHeightAuto, - forPrint: props.forPrint, - }; - var transformers = this.buildViewPropTransformers(pluginHooks.viewPropsTransformers); - for (var _i = 0, transformers_1 = transformers; _i < transformers_1.length; _i++) { - var transformer = transformers_1[_i]; - __assign(viewProps, transformer.transform(viewProps, props)); - } - var ViewComponent = viewSpec.component; - return (createElement(ViewComponent, __assign({}, viewProps))); - }; - return CalendarContent; - }(PureComponent)); - function buildToolbarProps(viewSpec, dateProfile, dateProfileGenerator, currentDate, now, title) { - // don't force any date-profiles to valid date profiles (the `false`) so that we can tell if it's invalid - var todayInfo = dateProfileGenerator.build(now, undefined, false); // TODO: need `undefined` or else INFINITE LOOP for some reason - var prevInfo = dateProfileGenerator.buildPrev(dateProfile, currentDate, false); - var nextInfo = dateProfileGenerator.buildNext(dateProfile, currentDate, false); - return { - title: title, - activeButton: viewSpec.type, - isTodayEnabled: todayInfo.isValid && !rangeContainsMarker(dateProfile.currentRange, now), - isPrevEnabled: prevInfo.isValid, - isNextEnabled: nextInfo.isValid, - }; - } - // Plugin - // ----------------------------------------------------------------------------------------------------------------- - function buildViewPropTransformers(theClasses) { - return theClasses.map(function (TheClass) { return new TheClass(); }); - } - - var CalendarRoot = /** @class */ (function (_super) { - __extends(CalendarRoot, _super); - function CalendarRoot() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.state = { - forPrint: false, - }; - _this.handleBeforePrint = function () { - _this.setState({ forPrint: true }); - }; - _this.handleAfterPrint = function () { - _this.setState({ forPrint: false }); - }; - return _this; - } - CalendarRoot.prototype.render = function () { - var props = this.props; - var options = props.options; - var forPrint = this.state.forPrint; - var isHeightAuto = forPrint || options.height === 'auto' || options.contentHeight === 'auto'; - var height = (!isHeightAuto && options.height != null) ? options.height : ''; - var classNames = [ - 'fc', - forPrint ? 'fc-media-print' : 'fc-media-screen', - "fc-direction-" + options.direction, - props.theme.getClass('root'), - ]; - if (!getCanVGrowWithinCell()) { - classNames.push('fc-liquid-hack'); - } - return props.children(classNames, height, isHeightAuto, forPrint); - }; - CalendarRoot.prototype.componentDidMount = function () { - var emitter = this.props.emitter; - emitter.on('_beforeprint', this.handleBeforePrint); - emitter.on('_afterprint', this.handleAfterPrint); - }; - CalendarRoot.prototype.componentWillUnmount = function () { - var emitter = this.props.emitter; - emitter.off('_beforeprint', this.handleBeforePrint); - emitter.off('_afterprint', this.handleAfterPrint); - }; - return CalendarRoot; - }(BaseComponent)); - - // Computes a default column header formatting string if `colFormat` is not explicitly defined - function computeFallbackHeaderFormat(datesRepDistinctDays, dayCnt) { - // if more than one week row, or if there are a lot of columns with not much space, - // put just the day numbers will be in each cell - if (!datesRepDistinctDays || dayCnt > 10) { - return createFormatter({ weekday: 'short' }); // "Sat" - } - if (dayCnt > 1) { - return createFormatter({ weekday: 'short', month: 'numeric', day: 'numeric', omitCommas: true }); // "Sat 11/12" - } - return createFormatter({ weekday: 'long' }); // "Saturday" - } - - var CLASS_NAME = 'fc-col-header-cell'; // do the cushion too? no - function renderInner(hookProps) { - return hookProps.text; - } - - var TableDateCell = /** @class */ (function (_super) { - __extends(TableDateCell, _super); - function TableDateCell() { - return _super !== null && _super.apply(this, arguments) || this; - } - TableDateCell.prototype.render = function () { - var _a = this.context, dateEnv = _a.dateEnv, options = _a.options, theme = _a.theme, viewApi = _a.viewApi; - var props = this.props; - var date = props.date, dateProfile = props.dateProfile; - var dayMeta = getDateMeta(date, props.todayRange, null, dateProfile); - var classNames = [CLASS_NAME].concat(getDayClassNames(dayMeta, theme)); - var text = dateEnv.format(date, props.dayHeaderFormat); - // if colCnt is 1, we are already in a day-view and don't need a navlink - var navLinkAttrs = (options.navLinks && !dayMeta.isDisabled && props.colCnt > 1) - ? { 'data-navlink': buildNavLinkData(date), tabIndex: 0 } - : {}; - var hookProps = __assign(__assign(__assign({ date: dateEnv.toDate(date), view: viewApi }, props.extraHookProps), { text: text }), dayMeta); - return (createElement(RenderHook, { hookProps: hookProps, classNames: options.dayHeaderClassNames, content: options.dayHeaderContent, defaultContent: renderInner, didMount: options.dayHeaderDidMount, willUnmount: options.dayHeaderWillUnmount }, function (rootElRef, customClassNames, innerElRef, innerContent) { return (createElement("th", __assign({ ref: rootElRef, className: classNames.concat(customClassNames).join(' '), "data-date": !dayMeta.isDisabled ? formatDayString(date) : undefined, colSpan: props.colSpan }, props.extraDataAttrs), - createElement("div", { className: "fc-scrollgrid-sync-inner" }, !dayMeta.isDisabled && (createElement("a", __assign({ ref: innerElRef, className: [ - 'fc-col-header-cell-cushion', - props.isSticky ? 'fc-sticky' : '', - ].join(' ') }, navLinkAttrs), innerContent))))); })); - }; - return TableDateCell; - }(BaseComponent)); - - var TableDowCell = /** @class */ (function (_super) { - __extends(TableDowCell, _super); - function TableDowCell() { - return _super !== null && _super.apply(this, arguments) || this; - } - TableDowCell.prototype.render = function () { - var props = this.props; - var _a = this.context, dateEnv = _a.dateEnv, theme = _a.theme, viewApi = _a.viewApi, options = _a.options; - var date = addDays(new Date(259200000), props.dow); // start with Sun, 04 Jan 1970 00:00:00 GMT - var dateMeta = { - dow: props.dow, - isDisabled: false, - isFuture: false, - isPast: false, - isToday: false, - isOther: false, - }; - var classNames = [CLASS_NAME].concat(getDayClassNames(dateMeta, theme), props.extraClassNames || []); - var text = dateEnv.format(date, props.dayHeaderFormat); - var hookProps = __assign(__assign(__assign(__assign({ // TODO: make this public? - date: date }, dateMeta), { view: viewApi }), props.extraHookProps), { text: text }); - return (createElement(RenderHook, { hookProps: hookProps, classNames: options.dayHeaderClassNames, content: options.dayHeaderContent, defaultContent: renderInner, didMount: options.dayHeaderDidMount, willUnmount: options.dayHeaderWillUnmount }, function (rootElRef, customClassNames, innerElRef, innerContent) { return (createElement("th", __assign({ ref: rootElRef, className: classNames.concat(customClassNames).join(' '), colSpan: props.colSpan }, props.extraDataAttrs), - createElement("div", { className: "fc-scrollgrid-sync-inner" }, - createElement("a", { className: [ - 'fc-col-header-cell-cushion', - props.isSticky ? 'fc-sticky' : '', - ].join(' '), ref: innerElRef }, innerContent)))); })); - }; - return TableDowCell; - }(BaseComponent)); - - var NowTimer = /** @class */ (function (_super) { - __extends(NowTimer, _super); - function NowTimer(props, context) { - var _this = _super.call(this, props, context) || this; - _this.initialNowDate = getNow(context.options.now, context.dateEnv); - _this.initialNowQueriedMs = new Date().valueOf(); - _this.state = _this.computeTiming().currentState; - return _this; - } - NowTimer.prototype.render = function () { - var _a = this, props = _a.props, state = _a.state; - return props.children(state.nowDate, state.todayRange); - }; - NowTimer.prototype.componentDidMount = function () { - this.setTimeout(); - }; - NowTimer.prototype.componentDidUpdate = function (prevProps) { - if (prevProps.unit !== this.props.unit) { - this.clearTimeout(); - this.setTimeout(); - } - }; - NowTimer.prototype.componentWillUnmount = function () { - this.clearTimeout(); - }; - NowTimer.prototype.computeTiming = function () { - var _a = this, props = _a.props, context = _a.context; - var unroundedNow = addMs(this.initialNowDate, new Date().valueOf() - this.initialNowQueriedMs); - var currentUnitStart = context.dateEnv.startOf(unroundedNow, props.unit); - var nextUnitStart = context.dateEnv.add(currentUnitStart, createDuration(1, props.unit)); - var waitMs = nextUnitStart.valueOf() - unroundedNow.valueOf(); - // there is a max setTimeout ms value (https://stackoverflow.com/a/3468650/96342) - // ensure no longer than a day - waitMs = Math.min(1000 * 60 * 60 * 24, waitMs); - return { - currentState: { nowDate: currentUnitStart, todayRange: buildDayRange(currentUnitStart) }, - nextState: { nowDate: nextUnitStart, todayRange: buildDayRange(nextUnitStart) }, - waitMs: waitMs, - }; - }; - NowTimer.prototype.setTimeout = function () { - var _this = this; - var _a = this.computeTiming(), nextState = _a.nextState, waitMs = _a.waitMs; - this.timeoutId = setTimeout(function () { - _this.setState(nextState, function () { - _this.setTimeout(); - }); - }, waitMs); - }; - NowTimer.prototype.clearTimeout = function () { - if (this.timeoutId) { - clearTimeout(this.timeoutId); - } - }; - NowTimer.contextType = ViewContextType; - return NowTimer; - }(Component)); - function buildDayRange(date) { - var start = startOfDay(date); - var end = addDays(start, 1); - return { start: start, end: end }; - } - - var DayHeader = /** @class */ (function (_super) { - __extends(DayHeader, _super); - function DayHeader() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.createDayHeaderFormatter = memoize(createDayHeaderFormatter); - return _this; - } - DayHeader.prototype.render = function () { - var context = this.context; - var _a = this.props, dates = _a.dates, dateProfile = _a.dateProfile, datesRepDistinctDays = _a.datesRepDistinctDays, renderIntro = _a.renderIntro; - var dayHeaderFormat = this.createDayHeaderFormatter(context.options.dayHeaderFormat, datesRepDistinctDays, dates.length); - return (createElement(NowTimer, { unit: "day" }, function (nowDate, todayRange) { return (createElement("tr", null, - renderIntro && renderIntro('day'), - dates.map(function (date) { return (datesRepDistinctDays ? (createElement(TableDateCell, { key: date.toISOString(), date: date, dateProfile: dateProfile, todayRange: todayRange, colCnt: dates.length, dayHeaderFormat: dayHeaderFormat })) : (createElement(TableDowCell, { key: date.getUTCDay(), dow: date.getUTCDay(), dayHeaderFormat: dayHeaderFormat }))); }))); })); - }; - return DayHeader; - }(BaseComponent)); - function createDayHeaderFormatter(explicitFormat, datesRepDistinctDays, dateCnt) { - return explicitFormat || computeFallbackHeaderFormat(datesRepDistinctDays, dateCnt); - } - - var DaySeriesModel = /** @class */ (function () { - function DaySeriesModel(range, dateProfileGenerator) { - var date = range.start; - var end = range.end; - var indices = []; - var dates = []; - var dayIndex = -1; - while (date < end) { // loop each day from start to end - if (dateProfileGenerator.isHiddenDay(date)) { - indices.push(dayIndex + 0.5); // mark that it's between indices - } - else { - dayIndex += 1; - indices.push(dayIndex); - dates.push(date); - } - date = addDays(date, 1); - } - this.dates = dates; - this.indices = indices; - this.cnt = dates.length; - } - DaySeriesModel.prototype.sliceRange = function (range) { - var firstIndex = this.getDateDayIndex(range.start); // inclusive first index - var lastIndex = this.getDateDayIndex(addDays(range.end, -1)); // inclusive last index - var clippedFirstIndex = Math.max(0, firstIndex); - var clippedLastIndex = Math.min(this.cnt - 1, lastIndex); - // deal with in-between indices - clippedFirstIndex = Math.ceil(clippedFirstIndex); // in-between starts round to next cell - clippedLastIndex = Math.floor(clippedLastIndex); // in-between ends round to prev cell - if (clippedFirstIndex <= clippedLastIndex) { - return { - firstIndex: clippedFirstIndex, - lastIndex: clippedLastIndex, - isStart: firstIndex === clippedFirstIndex, - isEnd: lastIndex === clippedLastIndex, - }; - } - return null; - }; - // Given a date, returns its chronolocial cell-index from the first cell of the grid. - // If the date lies between cells (because of hiddenDays), returns a floating-point value between offsets. - // If before the first offset, returns a negative number. - // If after the last offset, returns an offset past the last cell offset. - // Only works for *start* dates of cells. Will not work for exclusive end dates for cells. - DaySeriesModel.prototype.getDateDayIndex = function (date) { - var indices = this.indices; - var dayOffset = Math.floor(diffDays(this.dates[0], date)); - if (dayOffset < 0) { - return indices[0] - 1; - } - if (dayOffset >= indices.length) { - return indices[indices.length - 1] + 1; - } - return indices[dayOffset]; - }; - return DaySeriesModel; - }()); - - var DayTableModel = /** @class */ (function () { - function DayTableModel(daySeries, breakOnWeeks) { - var dates = daySeries.dates; - var daysPerRow; - var firstDay; - var rowCnt; - if (breakOnWeeks) { - // count columns until the day-of-week repeats - firstDay = dates[0].getUTCDay(); - for (daysPerRow = 1; daysPerRow < dates.length; daysPerRow += 1) { - if (dates[daysPerRow].getUTCDay() === firstDay) { - break; - } - } - rowCnt = Math.ceil(dates.length / daysPerRow); - } - else { - rowCnt = 1; - daysPerRow = dates.length; - } - this.rowCnt = rowCnt; - this.colCnt = daysPerRow; - this.daySeries = daySeries; - this.cells = this.buildCells(); - this.headerDates = this.buildHeaderDates(); - } - DayTableModel.prototype.buildCells = function () { - var rows = []; - for (var row = 0; row < this.rowCnt; row += 1) { - var cells = []; - for (var col = 0; col < this.colCnt; col += 1) { - cells.push(this.buildCell(row, col)); - } - rows.push(cells); - } - return rows; - }; - DayTableModel.prototype.buildCell = function (row, col) { - var date = this.daySeries.dates[row * this.colCnt + col]; - return { - key: date.toISOString(), - date: date, - }; - }; - DayTableModel.prototype.buildHeaderDates = function () { - var dates = []; - for (var col = 0; col < this.colCnt; col += 1) { - dates.push(this.cells[0][col].date); - } - return dates; - }; - DayTableModel.prototype.sliceRange = function (range) { - var colCnt = this.colCnt; - var seriesSeg = this.daySeries.sliceRange(range); - var segs = []; - if (seriesSeg) { - var firstIndex = seriesSeg.firstIndex, lastIndex = seriesSeg.lastIndex; - var index = firstIndex; - while (index <= lastIndex) { - var row = Math.floor(index / colCnt); - var nextIndex = Math.min((row + 1) * colCnt, lastIndex + 1); - segs.push({ - row: row, - firstCol: index % colCnt, - lastCol: (nextIndex - 1) % colCnt, - isStart: seriesSeg.isStart && index === firstIndex, - isEnd: seriesSeg.isEnd && (nextIndex - 1) === lastIndex, - }); - index = nextIndex; - } - } - return segs; - }; - return DayTableModel; - }()); - - var Slicer = /** @class */ (function () { - function Slicer() { - this.sliceBusinessHours = memoize(this._sliceBusinessHours); - this.sliceDateSelection = memoize(this._sliceDateSpan); - this.sliceEventStore = memoize(this._sliceEventStore); - this.sliceEventDrag = memoize(this._sliceInteraction); - this.sliceEventResize = memoize(this._sliceInteraction); - this.forceDayIfListItem = false; // hack - } - Slicer.prototype.sliceProps = function (props, dateProfile, nextDayThreshold, context) { - var extraArgs = []; - for (var _i = 4; _i < arguments.length; _i++) { - extraArgs[_i - 4] = arguments[_i]; - } - var eventUiBases = props.eventUiBases; - var eventSegs = this.sliceEventStore.apply(this, __spreadArrays([props.eventStore, eventUiBases, dateProfile, nextDayThreshold], extraArgs)); - return { - dateSelectionSegs: this.sliceDateSelection.apply(this, __spreadArrays([props.dateSelection, eventUiBases, context], extraArgs)), - businessHourSegs: this.sliceBusinessHours.apply(this, __spreadArrays([props.businessHours, dateProfile, nextDayThreshold, context], extraArgs)), - fgEventSegs: eventSegs.fg, - bgEventSegs: eventSegs.bg, - eventDrag: this.sliceEventDrag.apply(this, __spreadArrays([props.eventDrag, eventUiBases, dateProfile, nextDayThreshold], extraArgs)), - eventResize: this.sliceEventResize.apply(this, __spreadArrays([props.eventResize, eventUiBases, dateProfile, nextDayThreshold], extraArgs)), - eventSelection: props.eventSelection, - }; // TODO: give interactionSegs? - }; - Slicer.prototype.sliceNowDate = function (// does not memoize - date, context) { - var extraArgs = []; - for (var _i = 2; _i < arguments.length; _i++) { - extraArgs[_i - 2] = arguments[_i]; - } - return this._sliceDateSpan.apply(this, __spreadArrays([{ range: { start: date, end: addMs(date, 1) }, allDay: false }, - {}, - context], extraArgs)); - }; - Slicer.prototype._sliceBusinessHours = function (businessHours, dateProfile, nextDayThreshold, context) { - var extraArgs = []; - for (var _i = 4; _i < arguments.length; _i++) { - extraArgs[_i - 4] = arguments[_i]; - } - if (!businessHours) { - return []; - } - return this._sliceEventStore.apply(this, __spreadArrays([expandRecurring(businessHours, computeActiveRange(dateProfile, Boolean(nextDayThreshold)), context), - {}, - dateProfile, - nextDayThreshold], extraArgs)).bg; - }; - Slicer.prototype._sliceEventStore = function (eventStore, eventUiBases, dateProfile, nextDayThreshold) { - var extraArgs = []; - for (var _i = 4; _i < arguments.length; _i++) { - extraArgs[_i - 4] = arguments[_i]; - } - if (eventStore) { - var rangeRes = sliceEventStore(eventStore, eventUiBases, computeActiveRange(dateProfile, Boolean(nextDayThreshold)), nextDayThreshold); - return { - bg: this.sliceEventRanges(rangeRes.bg, extraArgs), - fg: this.sliceEventRanges(rangeRes.fg, extraArgs), - }; - } - return { bg: [], fg: [] }; - }; - Slicer.prototype._sliceInteraction = function (interaction, eventUiBases, dateProfile, nextDayThreshold) { - var extraArgs = []; - for (var _i = 4; _i < arguments.length; _i++) { - extraArgs[_i - 4] = arguments[_i]; - } - if (!interaction) { - return null; - } - var rangeRes = sliceEventStore(interaction.mutatedEvents, eventUiBases, computeActiveRange(dateProfile, Boolean(nextDayThreshold)), nextDayThreshold); - return { - segs: this.sliceEventRanges(rangeRes.fg, extraArgs), - affectedInstances: interaction.affectedEvents.instances, - isEvent: interaction.isEvent, - }; - }; - Slicer.prototype._sliceDateSpan = function (dateSpan, eventUiBases, context) { - var extraArgs = []; - for (var _i = 3; _i < arguments.length; _i++) { - extraArgs[_i - 3] = arguments[_i]; - } - if (!dateSpan) { - return []; - } - var eventRange = fabricateEventRange(dateSpan, eventUiBases, context); - var segs = this.sliceRange.apply(this, __spreadArrays([dateSpan.range], extraArgs)); - for (var _a = 0, segs_1 = segs; _a < segs_1.length; _a++) { - var seg = segs_1[_a]; - seg.eventRange = eventRange; - } - return segs; - }; - /* - "complete" seg means it has component and eventRange - */ - Slicer.prototype.sliceEventRanges = function (eventRanges, extraArgs) { - var segs = []; - for (var _i = 0, eventRanges_1 = eventRanges; _i < eventRanges_1.length; _i++) { - var eventRange = eventRanges_1[_i]; - segs.push.apply(segs, this.sliceEventRange(eventRange, extraArgs)); - } - return segs; - }; - /* - "complete" seg means it has component and eventRange - */ - Slicer.prototype.sliceEventRange = function (eventRange, extraArgs) { - var dateRange = eventRange.range; - // hack to make multi-day events that are being force-displayed as list-items to take up only one day - if (this.forceDayIfListItem && eventRange.ui.display === 'list-item') { - dateRange = { - start: dateRange.start, - end: addDays(dateRange.start, 1), - }; - } - var segs = this.sliceRange.apply(this, __spreadArrays([dateRange], extraArgs)); - for (var _i = 0, segs_2 = segs; _i < segs_2.length; _i++) { - var seg = segs_2[_i]; - seg.eventRange = eventRange; - seg.isStart = eventRange.isStart && seg.isStart; - seg.isEnd = eventRange.isEnd && seg.isEnd; - } - return segs; - }; - return Slicer; - }()); - /* - for incorporating slotMinTime/slotMaxTime if appropriate - TODO: should be part of DateProfile! - TimelineDateProfile already does this btw - */ - function computeActiveRange(dateProfile, isComponentAllDay) { - var range = dateProfile.activeRange; - if (isComponentAllDay) { - return range; - } - return { - start: addMs(range.start, dateProfile.slotMinTime.milliseconds), - end: addMs(range.end, dateProfile.slotMaxTime.milliseconds - 864e5), - }; - } - - var VISIBLE_HIDDEN_RE = /^(visible|hidden)$/; - var Scroller = /** @class */ (function (_super) { - __extends(Scroller, _super); - function Scroller() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.handleEl = function (el) { - _this.el = el; - setRef(_this.props.elRef, el); - }; - return _this; - } - Scroller.prototype.render = function () { - var props = this.props; - var liquid = props.liquid, liquidIsAbsolute = props.liquidIsAbsolute; - var isAbsolute = liquid && liquidIsAbsolute; - var className = ['fc-scroller']; - if (liquid) { - if (liquidIsAbsolute) { - className.push('fc-scroller-liquid-absolute'); - } - else { - className.push('fc-scroller-liquid'); - } - } - return (createElement("div", { ref: this.handleEl, className: className.join(' '), style: { - overflowX: props.overflowX, - overflowY: props.overflowY, - left: (isAbsolute && -(props.overcomeLeft || 0)) || '', - right: (isAbsolute && -(props.overcomeRight || 0)) || '', - bottom: (isAbsolute && -(props.overcomeBottom || 0)) || '', - marginLeft: (!isAbsolute && -(props.overcomeLeft || 0)) || '', - marginRight: (!isAbsolute && -(props.overcomeRight || 0)) || '', - marginBottom: (!isAbsolute && -(props.overcomeBottom || 0)) || '', - maxHeight: props.maxHeight || '', - } }, props.children)); - }; - Scroller.prototype.needsXScrolling = function () { - if (VISIBLE_HIDDEN_RE.test(this.props.overflowX)) { - return false; - } - // testing scrollWidth>clientWidth is unreliable cross-browser when pixel heights aren't integers. - // much more reliable to see if children are taller than the scroller, even tho doesn't account for - // inner-child margins and absolute positioning - var el = this.el; - var realClientWidth = this.el.getBoundingClientRect().width - this.getYScrollbarWidth(); - var children = el.children; - for (var i = 0; i < children.length; i += 1) { - var childEl = children[i]; - if (childEl.getBoundingClientRect().width > realClientWidth) { - return true; - } - } - return false; - }; - Scroller.prototype.needsYScrolling = function () { - if (VISIBLE_HIDDEN_RE.test(this.props.overflowY)) { - return false; - } - // testing scrollHeight>clientHeight is unreliable cross-browser when pixel heights aren't integers. - // much more reliable to see if children are taller than the scroller, even tho doesn't account for - // inner-child margins and absolute positioning - var el = this.el; - var realClientHeight = this.el.getBoundingClientRect().height - this.getXScrollbarWidth(); - var children = el.children; - for (var i = 0; i < children.length; i += 1) { - var childEl = children[i]; - if (childEl.getBoundingClientRect().height > realClientHeight) { - return true; - } - } - return false; - }; - Scroller.prototype.getXScrollbarWidth = function () { - if (VISIBLE_HIDDEN_RE.test(this.props.overflowX)) { - return 0; - } - return this.el.offsetHeight - this.el.clientHeight; // only works because we guarantee no borders. TODO: add to CSS with important? - }; - Scroller.prototype.getYScrollbarWidth = function () { - if (VISIBLE_HIDDEN_RE.test(this.props.overflowY)) { - return 0; - } - return this.el.offsetWidth - this.el.clientWidth; // only works because we guarantee no borders. TODO: add to CSS with important? - }; - return Scroller; - }(BaseComponent)); - - /* - TODO: somehow infer OtherArgs from masterCallback? - TODO: infer RefType from masterCallback if provided - */ - var RefMap = /** @class */ (function () { - function RefMap(masterCallback) { - var _this = this; - this.masterCallback = masterCallback; - this.currentMap = {}; - this.depths = {}; - this.callbackMap = {}; - this.handleValue = function (val, key) { - var _a = _this, depths = _a.depths, currentMap = _a.currentMap; - var removed = false; - var added = false; - if (val !== null) { - // for bug... ACTUALLY: can probably do away with this now that callers don't share numeric indices anymore - removed = (key in currentMap); - currentMap[key] = val; - depths[key] = (depths[key] || 0) + 1; - added = true; - } - else { - depths[key] -= 1; - if (!depths[key]) { - delete currentMap[key]; - delete _this.callbackMap[key]; - removed = true; - } - } - if (_this.masterCallback) { - if (removed) { - _this.masterCallback(null, String(key)); - } - if (added) { - _this.masterCallback(val, String(key)); - } - } - }; - } - RefMap.prototype.createRef = function (key) { - var _this = this; - var refCallback = this.callbackMap[key]; - if (!refCallback) { - refCallback = this.callbackMap[key] = function (val) { - _this.handleValue(val, String(key)); - }; - } - return refCallback; - }; - // TODO: check callers that don't care about order. should use getAll instead - // NOTE: this method has become less valuable now that we are encouraged to map order by some other index - // TODO: provide ONE array-export function, buildArray, which fails on non-numeric indexes. caller can manipulate and "collect" - RefMap.prototype.collect = function (startIndex, endIndex, step) { - return collectFromHash(this.currentMap, startIndex, endIndex, step); - }; - RefMap.prototype.getAll = function () { - return hashValuesToArray(this.currentMap); - }; - return RefMap; - }()); - - function computeShrinkWidth(chunkEls) { - var shrinkCells = findElements(chunkEls, '.fc-scrollgrid-shrink'); - var largestWidth = 0; - for (var _i = 0, shrinkCells_1 = shrinkCells; _i < shrinkCells_1.length; _i++) { - var shrinkCell = shrinkCells_1[_i]; - largestWidth = Math.max(largestWidth, computeSmallestCellWidth(shrinkCell)); - } - return Math.ceil(largestWidth); // <table> elements work best with integers. round up to ensure contents fits - } - function getSectionHasLiquidHeight(props, sectionConfig) { - return props.liquid && sectionConfig.liquid; // does the section do liquid-height? (need to have whole scrollgrid liquid-height as well) - } - function getAllowYScrolling(props, sectionConfig) { - return sectionConfig.maxHeight != null || // if its possible for the height to max out, we might need scrollbars - getSectionHasLiquidHeight(props, sectionConfig); // if the section is liquid height, it might condense enough to require scrollbars - } - // TODO: ONLY use `arg`. force out internal function to use same API - function renderChunkContent(sectionConfig, chunkConfig, arg) { - var expandRows = arg.expandRows; - var content = typeof chunkConfig.content === 'function' ? - chunkConfig.content(arg) : - createElement('table', { - className: [ - chunkConfig.tableClassName, - sectionConfig.syncRowHeights ? 'fc-scrollgrid-sync-table' : '', - ].join(' '), - style: { - minWidth: arg.tableMinWidth, - width: arg.clientWidth, - height: expandRows ? arg.clientHeight : '', - }, - }, arg.tableColGroupNode, createElement('tbody', {}, typeof chunkConfig.rowContent === 'function' ? chunkConfig.rowContent(arg) : chunkConfig.rowContent)); - return content; - } - function isColPropsEqual(cols0, cols1) { - return isArraysEqual(cols0, cols1, isPropsEqual); - } - function renderMicroColGroup(cols, shrinkWidth) { - var colNodes = []; - /* - for ColProps with spans, it would have been great to make a single <col span=""> - HOWEVER, Chrome was getting messing up distributing the width to <td>/<th> elements with colspans. - SOLUTION: making individual <col> elements makes Chrome behave. - */ - for (var _i = 0, cols_1 = cols; _i < cols_1.length; _i++) { - var colProps = cols_1[_i]; - var span = colProps.span || 1; - for (var i = 0; i < span; i += 1) { - colNodes.push(createElement("col", { style: { - width: colProps.width === 'shrink' ? sanitizeShrinkWidth(shrinkWidth) : (colProps.width || ''), - minWidth: colProps.minWidth || '', - } })); - } - } - return createElement.apply(void 0, __spreadArrays(['colgroup', {}], colNodes)); - } - function sanitizeShrinkWidth(shrinkWidth) { - /* why 4? if we do 0, it will kill any border, which are needed for computeSmallestCellWidth - 4 accounts for 2 2-pixel borders. TODO: better solution? */ - return shrinkWidth == null ? 4 : shrinkWidth; - } - function hasShrinkWidth(cols) { - for (var _i = 0, cols_2 = cols; _i < cols_2.length; _i++) { - var col = cols_2[_i]; - if (col.width === 'shrink') { - return true; - } - } - return false; - } - function getScrollGridClassNames(liquid, context) { - var classNames = [ - 'fc-scrollgrid', - context.theme.getClass('table'), - ]; - if (liquid) { - classNames.push('fc-scrollgrid-liquid'); - } - return classNames; - } - function getSectionClassNames(sectionConfig, wholeTableVGrow) { - var classNames = [ - 'fc-scrollgrid-section', - "fc-scrollgrid-section-" + sectionConfig.type, - sectionConfig.className, - ]; - if (wholeTableVGrow && sectionConfig.liquid && sectionConfig.maxHeight == null) { - classNames.push('fc-scrollgrid-section-liquid'); - } - if (sectionConfig.isSticky) { - classNames.push('fc-scrollgrid-section-sticky'); - } - return classNames; - } - function renderScrollShim(arg) { - return (createElement("div", { className: "fc-scrollgrid-sticky-shim", style: { - width: arg.clientWidth, - minWidth: arg.tableMinWidth, - } })); - } - function getStickyHeaderDates(options) { - var stickyHeaderDates = options.stickyHeaderDates; - if (stickyHeaderDates == null || stickyHeaderDates === 'auto') { - stickyHeaderDates = options.height === 'auto' || options.viewHeight === 'auto'; - } - return stickyHeaderDates; - } - function getStickyFooterScrollbar(options) { - var stickyFooterScrollbar = options.stickyFooterScrollbar; - if (stickyFooterScrollbar == null || stickyFooterScrollbar === 'auto') { - stickyFooterScrollbar = options.height === 'auto' || options.viewHeight === 'auto'; - } - return stickyFooterScrollbar; - } - - var SimpleScrollGrid = /** @class */ (function (_super) { - __extends(SimpleScrollGrid, _super); - function SimpleScrollGrid() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.processCols = memoize(function (a) { return a; }, isColPropsEqual); // so we get same `cols` props every time - // yucky to memoize VNodes, but much more efficient for consumers - _this.renderMicroColGroup = memoize(renderMicroColGroup); - _this.scrollerRefs = new RefMap(); - _this.scrollerElRefs = new RefMap(_this._handleScrollerEl.bind(_this)); - _this.state = { - shrinkWidth: null, - forceYScrollbars: false, - scrollerClientWidths: {}, - scrollerClientHeights: {}, - }; - // TODO: can do a really simple print-view. dont need to join rows - _this.handleSizing = function () { - _this.setState(__assign({ shrinkWidth: _this.computeShrinkWidth() }, _this.computeScrollerDims())); - }; - return _this; - } - SimpleScrollGrid.prototype.render = function () { - var _a = this, props = _a.props, state = _a.state, context = _a.context; - var sectionConfigs = props.sections || []; - var cols = this.processCols(props.cols); - var microColGroupNode = this.renderMicroColGroup(cols, state.shrinkWidth); - var classNames = getScrollGridClassNames(props.liquid, context); - // TODO: make DRY - var configCnt = sectionConfigs.length; - var configI = 0; - var currentConfig; - var headSectionNodes = []; - var bodySectionNodes = []; - var footSectionNodes = []; - while (configI < configCnt && (currentConfig = sectionConfigs[configI]).type === 'header') { - headSectionNodes.push(this.renderSection(currentConfig, microColGroupNode)); - configI += 1; - } - while (configI < configCnt && (currentConfig = sectionConfigs[configI]).type === 'body') { - bodySectionNodes.push(this.renderSection(currentConfig, microColGroupNode)); - configI += 1; - } - while (configI < configCnt && (currentConfig = sectionConfigs[configI]).type === 'footer') { - footSectionNodes.push(this.renderSection(currentConfig, microColGroupNode)); - configI += 1; - } - // firefox bug: when setting height on table and there is a thead or tfoot, - // the necessary height:100% on the liquid-height body section forces the *whole* table to be taller. (bug #5524) - // use getCanVGrowWithinCell as a way to detect table-stupid firefox. - // if so, use a simpler dom structure, jam everything into a lone tbody. - var isBuggy = !getCanVGrowWithinCell(); - return createElement('table', { - className: classNames.join(' '), - style: { height: props.height }, - }, Boolean(!isBuggy && headSectionNodes.length) && createElement.apply(void 0, __spreadArrays(['thead', {}], headSectionNodes)), Boolean(!isBuggy && bodySectionNodes.length) && createElement.apply(void 0, __spreadArrays(['tbody', {}], bodySectionNodes)), Boolean(!isBuggy && footSectionNodes.length) && createElement.apply(void 0, __spreadArrays(['tfoot', {}], footSectionNodes)), isBuggy && createElement.apply(void 0, __spreadArrays(['tbody', {}], headSectionNodes, bodySectionNodes, footSectionNodes))); - }; - SimpleScrollGrid.prototype.renderSection = function (sectionConfig, microColGroupNode) { - if ('outerContent' in sectionConfig) { - return (createElement(Fragment, { key: sectionConfig.key }, sectionConfig.outerContent)); - } - return (createElement("tr", { key: sectionConfig.key, className: getSectionClassNames(sectionConfig, this.props.liquid).join(' ') }, this.renderChunkTd(sectionConfig, microColGroupNode, sectionConfig.chunk))); - }; - SimpleScrollGrid.prototype.renderChunkTd = function (sectionConfig, microColGroupNode, chunkConfig) { - if ('outerContent' in chunkConfig) { - return chunkConfig.outerContent; - } - var props = this.props; - var _a = this.state, forceYScrollbars = _a.forceYScrollbars, scrollerClientWidths = _a.scrollerClientWidths, scrollerClientHeights = _a.scrollerClientHeights; - var needsYScrolling = getAllowYScrolling(props, sectionConfig); // TODO: do lazily. do in section config? - var isLiquid = getSectionHasLiquidHeight(props, sectionConfig); - // for `!props.liquid` - is WHOLE scrollgrid natural height? - // TODO: do same thing in advanced scrollgrid? prolly not b/c always has horizontal scrollbars - var overflowY = !props.liquid ? 'visible' : - forceYScrollbars ? 'scroll' : - !needsYScrolling ? 'hidden' : - 'auto'; - var sectionKey = sectionConfig.key; - var content = renderChunkContent(sectionConfig, chunkConfig, { - tableColGroupNode: microColGroupNode, - tableMinWidth: '', - clientWidth: scrollerClientWidths[sectionKey] !== undefined ? scrollerClientWidths[sectionKey] : null, - clientHeight: scrollerClientHeights[sectionKey] !== undefined ? scrollerClientHeights[sectionKey] : null, - expandRows: sectionConfig.expandRows, - syncRowHeights: false, - rowSyncHeights: [], - reportRowHeightChange: function () { }, - }); - return (createElement("td", { ref: chunkConfig.elRef }, - createElement("div", { className: "fc-scroller-harness" + (isLiquid ? ' fc-scroller-harness-liquid' : '') }, - createElement(Scroller, { ref: this.scrollerRefs.createRef(sectionKey), elRef: this.scrollerElRefs.createRef(sectionKey), overflowY: overflowY, overflowX: !props.liquid ? 'visible' : 'hidden' /* natural height? */, maxHeight: sectionConfig.maxHeight, liquid: isLiquid, liquidIsAbsolute // because its within a harness - : true }, content)))); - }; - SimpleScrollGrid.prototype._handleScrollerEl = function (scrollerEl, key) { - var section = getSectionByKey(this.props.sections, key); - if (section) { - setRef(section.chunk.scrollerElRef, scrollerEl); - } - }; - SimpleScrollGrid.prototype.componentDidMount = function () { - this.handleSizing(); - this.context.addResizeHandler(this.handleSizing); - }; - SimpleScrollGrid.prototype.componentDidUpdate = function () { - // TODO: need better solution when state contains non-sizing things - this.handleSizing(); - }; - SimpleScrollGrid.prototype.componentWillUnmount = function () { - this.context.removeResizeHandler(this.handleSizing); - }; - SimpleScrollGrid.prototype.computeShrinkWidth = function () { - return hasShrinkWidth(this.props.cols) - ? computeShrinkWidth(this.scrollerElRefs.getAll()) - : 0; - }; - SimpleScrollGrid.prototype.computeScrollerDims = function () { - var scrollbarWidth = getScrollbarWidths(); - var _a = this, scrollerRefs = _a.scrollerRefs, scrollerElRefs = _a.scrollerElRefs; - var forceYScrollbars = false; - var scrollerClientWidths = {}; - var scrollerClientHeights = {}; - for (var sectionKey in scrollerRefs.currentMap) { - var scroller = scrollerRefs.currentMap[sectionKey]; - if (scroller && scroller.needsYScrolling()) { - forceYScrollbars = true; - break; - } - } - for (var _i = 0, _b = this.props.sections; _i < _b.length; _i++) { - var section = _b[_i]; - var sectionKey = section.key; - var scrollerEl = scrollerElRefs.currentMap[sectionKey]; - if (scrollerEl) { - var harnessEl = scrollerEl.parentNode; // TODO: weird way to get this. need harness b/c doesn't include table borders - scrollerClientWidths[sectionKey] = Math.floor(harnessEl.getBoundingClientRect().width - (forceYScrollbars - ? scrollbarWidth.y // use global because scroller might not have scrollbars yet but will need them in future - : 0)); - scrollerClientHeights[sectionKey] = Math.floor(harnessEl.getBoundingClientRect().height); - } - } - return { forceYScrollbars: forceYScrollbars, scrollerClientWidths: scrollerClientWidths, scrollerClientHeights: scrollerClientHeights }; - }; - return SimpleScrollGrid; - }(BaseComponent)); - SimpleScrollGrid.addStateEquality({ - scrollerClientWidths: isPropsEqual, - scrollerClientHeights: isPropsEqual, - }); - function getSectionByKey(sections, key) { - for (var _i = 0, sections_1 = sections; _i < sections_1.length; _i++) { - var section = sections_1[_i]; - if (section.key === key) { - return section; - } - } - return null; - } - - var EventRoot = /** @class */ (function (_super) { - __extends(EventRoot, _super); - function EventRoot() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.elRef = createRef(); - return _this; - } - EventRoot.prototype.render = function () { - var _a = this, props = _a.props, context = _a.context; - var options = context.options; - var seg = props.seg; - var eventRange = seg.eventRange; - var ui = eventRange.ui; - var hookProps = { - event: new EventApi(context, eventRange.def, eventRange.instance), - view: context.viewApi, - timeText: props.timeText, - textColor: ui.textColor, - backgroundColor: ui.backgroundColor, - borderColor: ui.borderColor, - isDraggable: !props.disableDragging && computeSegDraggable(seg, context), - isStartResizable: !props.disableResizing && computeSegStartResizable(seg, context), - isEndResizable: !props.disableResizing && computeSegEndResizable(seg), - isMirror: Boolean(props.isDragging || props.isResizing || props.isDateSelecting), - isStart: Boolean(seg.isStart), - isEnd: Boolean(seg.isEnd), - isPast: Boolean(props.isPast), - isFuture: Boolean(props.isFuture), - isToday: Boolean(props.isToday), - isSelected: Boolean(props.isSelected), - isDragging: Boolean(props.isDragging), - isResizing: Boolean(props.isResizing), - }; - var standardClassNames = getEventClassNames(hookProps).concat(ui.classNames); - return (createElement(RenderHook, { hookProps: hookProps, classNames: options.eventClassNames, content: options.eventContent, defaultContent: props.defaultContent, didMount: options.eventDidMount, willUnmount: options.eventWillUnmount, elRef: this.elRef }, function (rootElRef, customClassNames, innerElRef, innerContent) { return props.children(rootElRef, standardClassNames.concat(customClassNames), innerElRef, innerContent, hookProps); })); - }; - EventRoot.prototype.componentDidMount = function () { - setElSeg(this.elRef.current, this.props.seg); - }; - /* - need to re-assign seg to the element if seg changes, even if the element is the same - */ - EventRoot.prototype.componentDidUpdate = function (prevProps) { - var seg = this.props.seg; - if (seg !== prevProps.seg) { - setElSeg(this.elRef.current, seg); - } - }; - return EventRoot; - }(BaseComponent)); - - // should not be a purecomponent - var StandardEvent = /** @class */ (function (_super) { - __extends(StandardEvent, _super); - function StandardEvent() { - return _super !== null && _super.apply(this, arguments) || this; - } - StandardEvent.prototype.render = function () { - var _a = this, props = _a.props, context = _a.context; - var seg = props.seg; - var timeFormat = context.options.eventTimeFormat || props.defaultTimeFormat; - var timeText = buildSegTimeText(seg, timeFormat, context, props.defaultDisplayEventTime, props.defaultDisplayEventEnd); - return (createElement(EventRoot, { seg: seg, timeText: timeText, disableDragging: props.disableDragging, disableResizing: props.disableResizing, defaultContent: props.defaultContent || renderInnerContent, isDragging: props.isDragging, isResizing: props.isResizing, isDateSelecting: props.isDateSelecting, isSelected: props.isSelected, isPast: props.isPast, isFuture: props.isFuture, isToday: props.isToday }, function (rootElRef, classNames, innerElRef, innerContent, hookProps) { return (createElement("a", __assign({ className: props.extraClassNames.concat(classNames).join(' '), style: { - borderColor: hookProps.borderColor, - backgroundColor: hookProps.backgroundColor, - }, ref: rootElRef }, getSegAnchorAttrs(seg)), - createElement("div", { className: "fc-event-main", ref: innerElRef, style: { color: hookProps.textColor } }, innerContent), - hookProps.isStartResizable && - createElement("div", { className: "fc-event-resizer fc-event-resizer-start" }), - hookProps.isEndResizable && - createElement("div", { className: "fc-event-resizer fc-event-resizer-end" }))); })); - }; - return StandardEvent; - }(BaseComponent)); - function renderInnerContent(innerProps) { - return (createElement("div", { className: "fc-event-main-frame" }, - innerProps.timeText && (createElement("div", { className: "fc-event-time" }, innerProps.timeText)), - createElement("div", { className: "fc-event-title-container" }, - createElement("div", { className: "fc-event-title fc-sticky" }, innerProps.event.title || createElement(Fragment, null, "\u00A0"))))); - } - function getSegAnchorAttrs(seg) { - var url = seg.eventRange.def.url; - return url ? { href: url } : {}; - } - - var NowIndicatorRoot = function (props) { return (createElement(ViewContextType.Consumer, null, function (context) { - var options = context.options; - var hookProps = { - isAxis: props.isAxis, - date: context.dateEnv.toDate(props.date), - view: context.viewApi, - }; - return (createElement(RenderHook, { hookProps: hookProps, classNames: options.nowIndicatorClassNames, content: options.nowIndicatorContent, didMount: options.nowIndicatorDidMount, willUnmount: options.nowIndicatorWillUnmount }, props.children)); - })); }; - - var DAY_NUM_FORMAT = createFormatter({ day: 'numeric' }); - var DayCellContent = /** @class */ (function (_super) { - __extends(DayCellContent, _super); - function DayCellContent() { - return _super !== null && _super.apply(this, arguments) || this; - } - DayCellContent.prototype.render = function () { - var _a = this, props = _a.props, context = _a.context; - var options = context.options; - var hookProps = refineDayCellHookProps({ - date: props.date, - dateProfile: props.dateProfile, - todayRange: props.todayRange, - showDayNumber: props.showDayNumber, - extraProps: props.extraHookProps, - viewApi: context.viewApi, - dateEnv: context.dateEnv, - }); - return (createElement(ContentHook, { hookProps: hookProps, content: options.dayCellContent, defaultContent: props.defaultContent }, props.children)); - }; - return DayCellContent; - }(BaseComponent)); - function refineDayCellHookProps(raw) { - var date = raw.date, dateEnv = raw.dateEnv; - var dayMeta = getDateMeta(date, raw.todayRange, null, raw.dateProfile); - return __assign(__assign(__assign({ date: dateEnv.toDate(date), view: raw.viewApi }, dayMeta), { dayNumberText: raw.showDayNumber ? dateEnv.format(date, DAY_NUM_FORMAT) : '' }), raw.extraProps); - } - - var DayCellRoot = /** @class */ (function (_super) { - __extends(DayCellRoot, _super); - function DayCellRoot() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.refineHookProps = memoizeObjArg(refineDayCellHookProps); - _this.normalizeClassNames = buildClassNameNormalizer(); - return _this; - } - DayCellRoot.prototype.render = function () { - var _a = this, props = _a.props, context = _a.context; - var options = context.options; - var hookProps = this.refineHookProps({ - date: props.date, - dateProfile: props.dateProfile, - todayRange: props.todayRange, - showDayNumber: props.showDayNumber, - extraProps: props.extraHookProps, - viewApi: context.viewApi, - dateEnv: context.dateEnv, - }); - var classNames = getDayClassNames(hookProps, context.theme).concat(hookProps.isDisabled - ? [] // don't use custom classNames if disabled - : this.normalizeClassNames(options.dayCellClassNames, hookProps)); - var dataAttrs = hookProps.isDisabled ? {} : { - 'data-date': formatDayString(props.date), - }; - return (createElement(MountHook, { hookProps: hookProps, didMount: options.dayCellDidMount, willUnmount: options.dayCellWillUnmount, elRef: props.elRef }, function (rootElRef) { return props.children(rootElRef, classNames, dataAttrs, hookProps.isDisabled); })); - }; - return DayCellRoot; - }(BaseComponent)); - - function renderFill(fillType) { - return (createElement("div", { className: "fc-" + fillType })); - } - var BgEvent = function (props) { return (createElement(EventRoot, { defaultContent: renderInnerContent$1, seg: props.seg /* uselesss i think */, timeText: "", disableDragging: true, disableResizing: true, isDragging: false, isResizing: false, isDateSelecting: false, isSelected: false, isPast: props.isPast, isFuture: props.isFuture, isToday: props.isToday }, function (rootElRef, classNames, innerElRef, innerContent, hookProps) { return (createElement("div", { ref: rootElRef, className: ['fc-bg-event'].concat(classNames).join(' '), style: { - backgroundColor: hookProps.backgroundColor, - } }, innerContent)); })); }; - function renderInnerContent$1(props) { - var title = props.event.title; - return title && (createElement("div", { className: "fc-event-title" }, props.event.title)); - } - - var WeekNumberRoot = function (props) { return (createElement(ViewContextType.Consumer, null, function (context) { - var dateEnv = context.dateEnv, options = context.options; - var date = props.date; - var format = options.weekNumberFormat || props.defaultFormat; - var num = dateEnv.computeWeekNumber(date); // TODO: somehow use for formatting as well? - var text = dateEnv.format(date, format); - var hookProps = { num: num, text: text, date: date }; - return (createElement(RenderHook, { hookProps: hookProps, classNames: options.weekNumberClassNames, content: options.weekNumberContent, defaultContent: renderInner$1, didMount: options.weekNumberDidMount, willUnmount: options.weekNumberWillUnmount }, props.children)); - })); }; - function renderInner$1(innerProps) { - return innerProps.text; - } - - // exports - // -------------------------------------------------------------------------------------------------- - var version = '5.5.1'; // important to type it, so .d.ts has generic string - - var Calendar = /** @class */ (function (_super) { - __extends(Calendar, _super); - function Calendar(el, optionOverrides) { - if (optionOverrides === void 0) { optionOverrides = {}; } - var _this = _super.call(this) || this; - _this.isRendering = false; - _this.isRendered = false; - _this.currentClassNames = []; - _this.customContentRenderId = 0; // will affect custom generated classNames? - _this.handleAction = function (action) { - // actions we know we want to render immediately - switch (action.type) { - case 'SET_EVENT_DRAG': - case 'SET_EVENT_RESIZE': - _this.renderRunner.tryDrain(); - } - }; - _this.handleData = function (data) { - _this.currentData = data; - _this.renderRunner.request(data.calendarOptions.rerenderDelay); - }; - _this.handleRenderRequest = function () { - if (_this.isRendering) { - _this.isRendered = true; - var currentData_1 = _this.currentData; - render(createElement(CalendarRoot, { options: currentData_1.calendarOptions, theme: currentData_1.theme, emitter: currentData_1.emitter }, function (classNames, height, isHeightAuto, forPrint) { - _this.setClassNames(classNames); - _this.setHeight(height); - return (createElement(CustomContentRenderContext.Provider, { value: _this.customContentRenderId }, - createElement(CalendarContent, __assign({ isHeightAuto: isHeightAuto, forPrint: forPrint }, currentData_1)))); - }), _this.el); - } - else if (_this.isRendered) { - _this.isRendered = false; - unmountComponentAtNode$1(_this.el); - _this.setClassNames([]); - _this.setHeight(''); - } - flushToDom$1(); - }; - _this.el = el; - _this.renderRunner = new DelayedRunner(_this.handleRenderRequest); - new CalendarDataManager({ - optionOverrides: optionOverrides, - calendarApi: _this, - onAction: _this.handleAction, - onData: _this.handleData, - }); - return _this; - } - Object.defineProperty(Calendar.prototype, "view", { - get: function () { return this.currentData.viewApi; } // for public API - , - enumerable: false, - configurable: true - }); - Calendar.prototype.render = function () { - var wasRendering = this.isRendering; - if (!wasRendering) { - this.isRendering = true; - } - else { - this.customContentRenderId += 1; - } - this.renderRunner.request(); - if (wasRendering) { - this.updateSize(); - } - }; - Calendar.prototype.destroy = function () { - if (this.isRendering) { - this.isRendering = false; - this.renderRunner.request(); - } - }; - Calendar.prototype.updateSize = function () { - _super.prototype.updateSize.call(this); - flushToDom$1(); - }; - Calendar.prototype.batchRendering = function (func) { - this.renderRunner.pause('batchRendering'); - func(); - this.renderRunner.resume('batchRendering'); - }; - Calendar.prototype.pauseRendering = function () { - this.renderRunner.pause('pauseRendering'); - }; - Calendar.prototype.resumeRendering = function () { - this.renderRunner.resume('pauseRendering', true); - }; - Calendar.prototype.resetOptions = function (optionOverrides, append) { - this.currentDataManager.resetOptions(optionOverrides, append); - }; - Calendar.prototype.setClassNames = function (classNames) { - if (!isArraysEqual(classNames, this.currentClassNames)) { - var classList = this.el.classList; - for (var _i = 0, _a = this.currentClassNames; _i < _a.length; _i++) { - var className = _a[_i]; - classList.remove(className); - } - for (var _b = 0, classNames_1 = classNames; _b < classNames_1.length; _b++) { - var className = classNames_1[_b]; - classList.add(className); - } - this.currentClassNames = classNames; - } - }; - Calendar.prototype.setHeight = function (height) { - applyStyleProp(this.el, 'height', height); - }; - return Calendar; - }(CalendarApi)); - - config.touchMouseIgnoreWait = 500; - var ignoreMouseDepth = 0; - var listenerCnt = 0; - var isWindowTouchMoveCancelled = false; - /* - Uses a "pointer" abstraction, which monitors UI events for both mouse and touch. - Tracks when the pointer "drags" on a certain element, meaning down+move+up. - - Also, tracks if there was touch-scrolling. - Also, can prevent touch-scrolling from happening. - Also, can fire pointermove events when scrolling happens underneath, even when no real pointer movement. - - emits: - - pointerdown - - pointermove - - pointerup - */ - var PointerDragging = /** @class */ (function () { - function PointerDragging(containerEl) { - var _this = this; - this.subjectEl = null; - // options that can be directly assigned by caller - this.selector = ''; // will cause subjectEl in all emitted events to be this element - this.handleSelector = ''; - this.shouldIgnoreMove = false; - this.shouldWatchScroll = true; // for simulating pointermove on scroll - // internal states - this.isDragging = false; - this.isTouchDragging = false; - this.wasTouchScroll = false; - // Mouse - // ---------------------------------------------------------------------------------------------------- - this.handleMouseDown = function (ev) { - if (!_this.shouldIgnoreMouse() && - isPrimaryMouseButton(ev) && - _this.tryStart(ev)) { - var pev = _this.createEventFromMouse(ev, true); - _this.emitter.trigger('pointerdown', pev); - _this.initScrollWatch(pev); - if (!_this.shouldIgnoreMove) { - document.addEventListener('mousemove', _this.handleMouseMove); - } - document.addEventListener('mouseup', _this.handleMouseUp); - } - }; - this.handleMouseMove = function (ev) { - var pev = _this.createEventFromMouse(ev); - _this.recordCoords(pev); - _this.emitter.trigger('pointermove', pev); - }; - this.handleMouseUp = function (ev) { - document.removeEventListener('mousemove', _this.handleMouseMove); - document.removeEventListener('mouseup', _this.handleMouseUp); - _this.emitter.trigger('pointerup', _this.createEventFromMouse(ev)); - _this.cleanup(); // call last so that pointerup has access to props - }; - // Touch - // ---------------------------------------------------------------------------------------------------- - this.handleTouchStart = function (ev) { - if (_this.tryStart(ev)) { - _this.isTouchDragging = true; - var pev = _this.createEventFromTouch(ev, true); - _this.emitter.trigger('pointerdown', pev); - _this.initScrollWatch(pev); - // unlike mouse, need to attach to target, not document - // https://stackoverflow.com/a/45760014 - var targetEl = ev.target; - if (!_this.shouldIgnoreMove) { - targetEl.addEventListener('touchmove', _this.handleTouchMove); - } - targetEl.addEventListener('touchend', _this.handleTouchEnd); - targetEl.addEventListener('touchcancel', _this.handleTouchEnd); // treat it as a touch end - // attach a handler to get called when ANY scroll action happens on the page. - // this was impossible to do with normal on/off because 'scroll' doesn't bubble. - // http://stackoverflow.com/a/32954565/96342 - window.addEventListener('scroll', _this.handleTouchScroll, true); - } - }; - this.handleTouchMove = function (ev) { - var pev = _this.createEventFromTouch(ev); - _this.recordCoords(pev); - _this.emitter.trigger('pointermove', pev); - }; - this.handleTouchEnd = function (ev) { - if (_this.isDragging) { // done to guard against touchend followed by touchcancel - var targetEl = ev.target; - targetEl.removeEventListener('touchmove', _this.handleTouchMove); - targetEl.removeEventListener('touchend', _this.handleTouchEnd); - targetEl.removeEventListener('touchcancel', _this.handleTouchEnd); - window.removeEventListener('scroll', _this.handleTouchScroll, true); // useCaptured=true - _this.emitter.trigger('pointerup', _this.createEventFromTouch(ev)); - _this.cleanup(); // call last so that pointerup has access to props - _this.isTouchDragging = false; - startIgnoringMouse(); - } - }; - this.handleTouchScroll = function () { - _this.wasTouchScroll = true; - }; - this.handleScroll = function (ev) { - if (!_this.shouldIgnoreMove) { - var pageX = (window.pageXOffset - _this.prevScrollX) + _this.prevPageX; - var pageY = (window.pageYOffset - _this.prevScrollY) + _this.prevPageY; - _this.emitter.trigger('pointermove', { - origEvent: ev, - isTouch: _this.isTouchDragging, - subjectEl: _this.subjectEl, - pageX: pageX, - pageY: pageY, - deltaX: pageX - _this.origPageX, - deltaY: pageY - _this.origPageY, - }); - } - }; - this.containerEl = containerEl; - this.emitter = new Emitter(); - containerEl.addEventListener('mousedown', this.handleMouseDown); - containerEl.addEventListener('touchstart', this.handleTouchStart, { passive: true }); - listenerCreated(); - } - PointerDragging.prototype.destroy = function () { - this.containerEl.removeEventListener('mousedown', this.handleMouseDown); - this.containerEl.removeEventListener('touchstart', this.handleTouchStart, { passive: true }); - listenerDestroyed(); - }; - PointerDragging.prototype.tryStart = function (ev) { - var subjectEl = this.querySubjectEl(ev); - var downEl = ev.target; - if (subjectEl && - (!this.handleSelector || elementClosest(downEl, this.handleSelector))) { - this.subjectEl = subjectEl; - this.isDragging = true; // do this first so cancelTouchScroll will work - this.wasTouchScroll = false; - return true; - } - return false; - }; - PointerDragging.prototype.cleanup = function () { - isWindowTouchMoveCancelled = false; - this.isDragging = false; - this.subjectEl = null; - // keep wasTouchScroll around for later access - this.destroyScrollWatch(); - }; - PointerDragging.prototype.querySubjectEl = function (ev) { - if (this.selector) { - return elementClosest(ev.target, this.selector); - } - return this.containerEl; - }; - PointerDragging.prototype.shouldIgnoreMouse = function () { - return ignoreMouseDepth || this.isTouchDragging; - }; - // can be called by user of this class, to cancel touch-based scrolling for the current drag - PointerDragging.prototype.cancelTouchScroll = function () { - if (this.isDragging) { - isWindowTouchMoveCancelled = true; - } - }; - // Scrolling that simulates pointermoves - // ---------------------------------------------------------------------------------------------------- - PointerDragging.prototype.initScrollWatch = function (ev) { - if (this.shouldWatchScroll) { - this.recordCoords(ev); - window.addEventListener('scroll', this.handleScroll, true); // useCapture=true - } - }; - PointerDragging.prototype.recordCoords = function (ev) { - if (this.shouldWatchScroll) { - this.prevPageX = ev.pageX; - this.prevPageY = ev.pageY; - this.prevScrollX = window.pageXOffset; - this.prevScrollY = window.pageYOffset; - } - }; - PointerDragging.prototype.destroyScrollWatch = function () { - if (this.shouldWatchScroll) { - window.removeEventListener('scroll', this.handleScroll, true); // useCaptured=true - } - }; - // Event Normalization - // ---------------------------------------------------------------------------------------------------- - PointerDragging.prototype.createEventFromMouse = function (ev, isFirst) { - var deltaX = 0; - var deltaY = 0; - // TODO: repeat code - if (isFirst) { - this.origPageX = ev.pageX; - this.origPageY = ev.pageY; - } - else { - deltaX = ev.pageX - this.origPageX; - deltaY = ev.pageY - this.origPageY; - } - return { - origEvent: ev, - isTouch: false, - subjectEl: this.subjectEl, - pageX: ev.pageX, - pageY: ev.pageY, - deltaX: deltaX, - deltaY: deltaY, - }; - }; - PointerDragging.prototype.createEventFromTouch = function (ev, isFirst) { - var touches = ev.touches; - var pageX; - var pageY; - var deltaX = 0; - var deltaY = 0; - // if touch coords available, prefer, - // because FF would give bad ev.pageX ev.pageY - if (touches && touches.length) { - pageX = touches[0].pageX; - pageY = touches[0].pageY; - } - else { - pageX = ev.pageX; - pageY = ev.pageY; - } - // TODO: repeat code - if (isFirst) { - this.origPageX = pageX; - this.origPageY = pageY; - } - else { - deltaX = pageX - this.origPageX; - deltaY = pageY - this.origPageY; - } - return { - origEvent: ev, - isTouch: true, - subjectEl: this.subjectEl, - pageX: pageX, - pageY: pageY, - deltaX: deltaX, - deltaY: deltaY, - }; - }; - return PointerDragging; - }()); - // Returns a boolean whether this was a left mouse click and no ctrl key (which means right click on Mac) - function isPrimaryMouseButton(ev) { - return ev.button === 0 && !ev.ctrlKey; - } - // Ignoring fake mouse events generated by touch - // ---------------------------------------------------------------------------------------------------- - function startIgnoringMouse() { - ignoreMouseDepth += 1; - setTimeout(function () { - ignoreMouseDepth -= 1; - }, config.touchMouseIgnoreWait); - } - // We want to attach touchmove as early as possible for Safari - // ---------------------------------------------------------------------------------------------------- - function listenerCreated() { - listenerCnt += 1; - if (listenerCnt === 1) { - window.addEventListener('touchmove', onWindowTouchMove, { passive: false }); - } - } - function listenerDestroyed() { - listenerCnt -= 1; - if (!listenerCnt) { - window.removeEventListener('touchmove', onWindowTouchMove, { passive: false }); - } - } - function onWindowTouchMove(ev) { - if (isWindowTouchMoveCancelled) { - ev.preventDefault(); - } - } - - /* - An effect in which an element follows the movement of a pointer across the screen. - The moving element is a clone of some other element. - Must call start + handleMove + stop. - */ - var ElementMirror = /** @class */ (function () { - function ElementMirror() { - this.isVisible = false; // must be explicitly enabled - this.sourceEl = null; - this.mirrorEl = null; - this.sourceElRect = null; // screen coords relative to viewport - // options that can be set directly by caller - this.parentNode = document.body; - this.zIndex = 9999; - this.revertDuration = 0; - } - ElementMirror.prototype.start = function (sourceEl, pageX, pageY) { - this.sourceEl = sourceEl; - this.sourceElRect = this.sourceEl.getBoundingClientRect(); - this.origScreenX = pageX - window.pageXOffset; - this.origScreenY = pageY - window.pageYOffset; - this.deltaX = 0; - this.deltaY = 0; - this.updateElPosition(); - }; - ElementMirror.prototype.handleMove = function (pageX, pageY) { - this.deltaX = (pageX - window.pageXOffset) - this.origScreenX; - this.deltaY = (pageY - window.pageYOffset) - this.origScreenY; - this.updateElPosition(); - }; - // can be called before start - ElementMirror.prototype.setIsVisible = function (bool) { - if (bool) { - if (!this.isVisible) { - if (this.mirrorEl) { - this.mirrorEl.style.display = ''; - } - this.isVisible = bool; // needs to happen before updateElPosition - this.updateElPosition(); // because was not updating the position while invisible - } - } - else if (this.isVisible) { - if (this.mirrorEl) { - this.mirrorEl.style.display = 'none'; - } - this.isVisible = bool; - } - }; - // always async - ElementMirror.prototype.stop = function (needsRevertAnimation, callback) { - var _this = this; - var done = function () { - _this.cleanup(); - callback(); - }; - if (needsRevertAnimation && - this.mirrorEl && - this.isVisible && - this.revertDuration && // if 0, transition won't work - (this.deltaX || this.deltaY) // if same coords, transition won't work - ) { - this.doRevertAnimation(done, this.revertDuration); - } - else { - setTimeout(done, 0); - } - }; - ElementMirror.prototype.doRevertAnimation = function (callback, revertDuration) { - var mirrorEl = this.mirrorEl; - var finalSourceElRect = this.sourceEl.getBoundingClientRect(); // because autoscrolling might have happened - mirrorEl.style.transition = - 'top ' + revertDuration + 'ms,' + - 'left ' + revertDuration + 'ms'; - applyStyle(mirrorEl, { - left: finalSourceElRect.left, - top: finalSourceElRect.top, - }); - whenTransitionDone(mirrorEl, function () { - mirrorEl.style.transition = ''; - callback(); - }); - }; - ElementMirror.prototype.cleanup = function () { - if (this.mirrorEl) { - removeElement(this.mirrorEl); - this.mirrorEl = null; - } - this.sourceEl = null; - }; - ElementMirror.prototype.updateElPosition = function () { - if (this.sourceEl && this.isVisible) { - applyStyle(this.getMirrorEl(), { - left: this.sourceElRect.left + this.deltaX, - top: this.sourceElRect.top + this.deltaY, - }); - } - }; - ElementMirror.prototype.getMirrorEl = function () { - var sourceElRect = this.sourceElRect; - var mirrorEl = this.mirrorEl; - if (!mirrorEl) { - mirrorEl = this.mirrorEl = this.sourceEl.cloneNode(true); // cloneChildren=true - // we don't want long taps or any mouse interaction causing selection/menus. - // would use preventSelection(), but that prevents selectstart, causing problems. - mirrorEl.classList.add('fc-unselectable'); - mirrorEl.classList.add('fc-event-dragging'); - applyStyle(mirrorEl, { - position: 'fixed', - zIndex: this.zIndex, - visibility: '', - boxSizing: 'border-box', - width: sourceElRect.right - sourceElRect.left, - height: sourceElRect.bottom - sourceElRect.top, - right: 'auto', - bottom: 'auto', - margin: 0, - }); - this.parentNode.appendChild(mirrorEl); - } - return mirrorEl; - }; - return ElementMirror; - }()); - - /* - Is a cache for a given element's scroll information (all the info that ScrollController stores) - in addition the "client rectangle" of the element.. the area within the scrollbars. - - The cache can be in one of two modes: - - doesListening:false - ignores when the container is scrolled by someone else - - doesListening:true - watch for scrolling and update the cache - */ - var ScrollGeomCache = /** @class */ (function (_super) { - __extends(ScrollGeomCache, _super); - function ScrollGeomCache(scrollController, doesListening) { - var _this = _super.call(this) || this; - _this.handleScroll = function () { - _this.scrollTop = _this.scrollController.getScrollTop(); - _this.scrollLeft = _this.scrollController.getScrollLeft(); - _this.handleScrollChange(); - }; - _this.scrollController = scrollController; - _this.doesListening = doesListening; - _this.scrollTop = _this.origScrollTop = scrollController.getScrollTop(); - _this.scrollLeft = _this.origScrollLeft = scrollController.getScrollLeft(); - _this.scrollWidth = scrollController.getScrollWidth(); - _this.scrollHeight = scrollController.getScrollHeight(); - _this.clientWidth = scrollController.getClientWidth(); - _this.clientHeight = scrollController.getClientHeight(); - _this.clientRect = _this.computeClientRect(); // do last in case it needs cached values - if (_this.doesListening) { - _this.getEventTarget().addEventListener('scroll', _this.handleScroll); - } - return _this; - } - ScrollGeomCache.prototype.destroy = function () { - if (this.doesListening) { - this.getEventTarget().removeEventListener('scroll', this.handleScroll); - } - }; - ScrollGeomCache.prototype.getScrollTop = function () { - return this.scrollTop; - }; - ScrollGeomCache.prototype.getScrollLeft = function () { - return this.scrollLeft; - }; - ScrollGeomCache.prototype.setScrollTop = function (top) { - this.scrollController.setScrollTop(top); - if (!this.doesListening) { - // we are not relying on the element to normalize out-of-bounds scroll values - // so we need to sanitize ourselves - this.scrollTop = Math.max(Math.min(top, this.getMaxScrollTop()), 0); - this.handleScrollChange(); - } - }; - ScrollGeomCache.prototype.setScrollLeft = function (top) { - this.scrollController.setScrollLeft(top); - if (!this.doesListening) { - // we are not relying on the element to normalize out-of-bounds scroll values - // so we need to sanitize ourselves - this.scrollLeft = Math.max(Math.min(top, this.getMaxScrollLeft()), 0); - this.handleScrollChange(); - } - }; - ScrollGeomCache.prototype.getClientWidth = function () { - return this.clientWidth; - }; - ScrollGeomCache.prototype.getClientHeight = function () { - return this.clientHeight; - }; - ScrollGeomCache.prototype.getScrollWidth = function () { - return this.scrollWidth; - }; - ScrollGeomCache.prototype.getScrollHeight = function () { - return this.scrollHeight; - }; - ScrollGeomCache.prototype.handleScrollChange = function () { - }; - return ScrollGeomCache; - }(ScrollController)); - - var ElementScrollGeomCache = /** @class */ (function (_super) { - __extends(ElementScrollGeomCache, _super); - function ElementScrollGeomCache(el, doesListening) { - return _super.call(this, new ElementScrollController(el), doesListening) || this; - } - ElementScrollGeomCache.prototype.getEventTarget = function () { - return this.scrollController.el; - }; - ElementScrollGeomCache.prototype.computeClientRect = function () { - return computeInnerRect(this.scrollController.el); - }; - return ElementScrollGeomCache; - }(ScrollGeomCache)); - - var WindowScrollGeomCache = /** @class */ (function (_super) { - __extends(WindowScrollGeomCache, _super); - function WindowScrollGeomCache(doesListening) { - return _super.call(this, new WindowScrollController(), doesListening) || this; - } - WindowScrollGeomCache.prototype.getEventTarget = function () { - return window; - }; - WindowScrollGeomCache.prototype.computeClientRect = function () { - return { - left: this.scrollLeft, - right: this.scrollLeft + this.clientWidth, - top: this.scrollTop, - bottom: this.scrollTop + this.clientHeight, - }; - }; - // the window is the only scroll object that changes it's rectangle relative - // to the document's topleft as it scrolls - WindowScrollGeomCache.prototype.handleScrollChange = function () { - this.clientRect = this.computeClientRect(); - }; - return WindowScrollGeomCache; - }(ScrollGeomCache)); - - // If available we are using native "performance" API instead of "Date" - // Read more about it on MDN: - // https://developer.mozilla.org/en-US/docs/Web/API/Performance - var getTime = typeof performance === 'function' ? performance.now : Date.now; - /* - For a pointer interaction, automatically scrolls certain scroll containers when the pointer - approaches the edge. - - The caller must call start + handleMove + stop. - */ - var AutoScroller = /** @class */ (function () { - function AutoScroller() { - var _this = this; - // options that can be set by caller - this.isEnabled = true; - this.scrollQuery = [window, '.fc-scroller']; - this.edgeThreshold = 50; // pixels - this.maxVelocity = 300; // pixels per second - // internal state - this.pointerScreenX = null; - this.pointerScreenY = null; - this.isAnimating = false; - this.scrollCaches = null; - // protect against the initial pointerdown being too close to an edge and starting the scroll - this.everMovedUp = false; - this.everMovedDown = false; - this.everMovedLeft = false; - this.everMovedRight = false; - this.animate = function () { - if (_this.isAnimating) { // wasn't cancelled between animation calls - var edge = _this.computeBestEdge(_this.pointerScreenX + window.pageXOffset, _this.pointerScreenY + window.pageYOffset); - if (edge) { - var now = getTime(); - _this.handleSide(edge, (now - _this.msSinceRequest) / 1000); - _this.requestAnimation(now); - } - else { - _this.isAnimating = false; // will stop animation - } - } - }; - } - AutoScroller.prototype.start = function (pageX, pageY) { - if (this.isEnabled) { - this.scrollCaches = this.buildCaches(); - this.pointerScreenX = null; - this.pointerScreenY = null; - this.everMovedUp = false; - this.everMovedDown = false; - this.everMovedLeft = false; - this.everMovedRight = false; - this.handleMove(pageX, pageY); - } - }; - AutoScroller.prototype.handleMove = function (pageX, pageY) { - if (this.isEnabled) { - var pointerScreenX = pageX - window.pageXOffset; - var pointerScreenY = pageY - window.pageYOffset; - var yDelta = this.pointerScreenY === null ? 0 : pointerScreenY - this.pointerScreenY; - var xDelta = this.pointerScreenX === null ? 0 : pointerScreenX - this.pointerScreenX; - if (yDelta < 0) { - this.everMovedUp = true; - } - else if (yDelta > 0) { - this.everMovedDown = true; - } - if (xDelta < 0) { - this.everMovedLeft = true; - } - else if (xDelta > 0) { - this.everMovedRight = true; - } - this.pointerScreenX = pointerScreenX; - this.pointerScreenY = pointerScreenY; - if (!this.isAnimating) { - this.isAnimating = true; - this.requestAnimation(getTime()); - } - } - }; - AutoScroller.prototype.stop = function () { - if (this.isEnabled) { - this.isAnimating = false; // will stop animation - for (var _i = 0, _a = this.scrollCaches; _i < _a.length; _i++) { - var scrollCache = _a[_i]; - scrollCache.destroy(); - } - this.scrollCaches = null; - } - }; - AutoScroller.prototype.requestAnimation = function (now) { - this.msSinceRequest = now; - requestAnimationFrame(this.animate); - }; - AutoScroller.prototype.handleSide = function (edge, seconds) { - var scrollCache = edge.scrollCache; - var edgeThreshold = this.edgeThreshold; - var invDistance = edgeThreshold - edge.distance; - var velocity = // the closer to the edge, the faster we scroll - ((invDistance * invDistance) / (edgeThreshold * edgeThreshold)) * // quadratic - this.maxVelocity * seconds; - var sign = 1; - switch (edge.name) { - case 'left': - sign = -1; - // falls through - case 'right': - scrollCache.setScrollLeft(scrollCache.getScrollLeft() + velocity * sign); - break; - case 'top': - sign = -1; - // falls through - case 'bottom': - scrollCache.setScrollTop(scrollCache.getScrollTop() + velocity * sign); - break; - } - }; - // left/top are relative to document topleft - AutoScroller.prototype.computeBestEdge = function (left, top) { - var edgeThreshold = this.edgeThreshold; - var bestSide = null; - for (var _i = 0, _a = this.scrollCaches; _i < _a.length; _i++) { - var scrollCache = _a[_i]; - var rect = scrollCache.clientRect; - var leftDist = left - rect.left; - var rightDist = rect.right - left; - var topDist = top - rect.top; - var bottomDist = rect.bottom - top; - // completely within the rect? - if (leftDist >= 0 && rightDist >= 0 && topDist >= 0 && bottomDist >= 0) { - if (topDist <= edgeThreshold && this.everMovedUp && scrollCache.canScrollUp() && - (!bestSide || bestSide.distance > topDist)) { - bestSide = { scrollCache: scrollCache, name: 'top', distance: topDist }; - } - if (bottomDist <= edgeThreshold && this.everMovedDown && scrollCache.canScrollDown() && - (!bestSide || bestSide.distance > bottomDist)) { - bestSide = { scrollCache: scrollCache, name: 'bottom', distance: bottomDist }; - } - if (leftDist <= edgeThreshold && this.everMovedLeft && scrollCache.canScrollLeft() && - (!bestSide || bestSide.distance > leftDist)) { - bestSide = { scrollCache: scrollCache, name: 'left', distance: leftDist }; - } - if (rightDist <= edgeThreshold && this.everMovedRight && scrollCache.canScrollRight() && - (!bestSide || bestSide.distance > rightDist)) { - bestSide = { scrollCache: scrollCache, name: 'right', distance: rightDist }; - } - } - } - return bestSide; - }; - AutoScroller.prototype.buildCaches = function () { - return this.queryScrollEls().map(function (el) { - if (el === window) { - return new WindowScrollGeomCache(false); // false = don't listen to user-generated scrolls - } - return new ElementScrollGeomCache(el, false); // false = don't listen to user-generated scrolls - }); - }; - AutoScroller.prototype.queryScrollEls = function () { - var els = []; - for (var _i = 0, _a = this.scrollQuery; _i < _a.length; _i++) { - var query = _a[_i]; - if (typeof query === 'object') { - els.push(query); - } - else { - els.push.apply(els, Array.prototype.slice.call(document.querySelectorAll(query))); - } - } - return els; - }; - return AutoScroller; - }()); - - /* - Monitors dragging on an element. Has a number of high-level features: - - minimum distance required before dragging - - minimum wait time ("delay") before dragging - - a mirror element that follows the pointer - */ - var FeaturefulElementDragging = /** @class */ (function (_super) { - __extends(FeaturefulElementDragging, _super); - function FeaturefulElementDragging(containerEl, selector) { - var _this = _super.call(this, containerEl) || this; - // options that can be directly set by caller - // the caller can also set the PointerDragging's options as well - _this.delay = null; - _this.minDistance = 0; - _this.touchScrollAllowed = true; // prevents drag from starting and blocks scrolling during drag - _this.mirrorNeedsRevert = false; - _this.isInteracting = false; // is the user validly moving the pointer? lasts until pointerup - _this.isDragging = false; // is it INTENTFULLY dragging? lasts until after revert animation - _this.isDelayEnded = false; - _this.isDistanceSurpassed = false; - _this.delayTimeoutId = null; - _this.onPointerDown = function (ev) { - if (!_this.isDragging) { // so new drag doesn't happen while revert animation is going - _this.isInteracting = true; - _this.isDelayEnded = false; - _this.isDistanceSurpassed = false; - preventSelection(document.body); - preventContextMenu(document.body); - // prevent links from being visited if there's an eventual drag. - // also prevents selection in older browsers (maybe?). - // not necessary for touch, besides, browser would complain about passiveness. - if (!ev.isTouch) { - ev.origEvent.preventDefault(); - } - _this.emitter.trigger('pointerdown', ev); - if (_this.isInteracting && // not destroyed via pointerdown handler - !_this.pointer.shouldIgnoreMove) { - // actions related to initiating dragstart+dragmove+dragend... - _this.mirror.setIsVisible(false); // reset. caller must set-visible - _this.mirror.start(ev.subjectEl, ev.pageX, ev.pageY); // must happen on first pointer down - _this.startDelay(ev); - if (!_this.minDistance) { - _this.handleDistanceSurpassed(ev); - } - } - } - }; - _this.onPointerMove = function (ev) { - if (_this.isInteracting) { - _this.emitter.trigger('pointermove', ev); - if (!_this.isDistanceSurpassed) { - var minDistance = _this.minDistance; - var distanceSq = void 0; // current distance from the origin, squared - var deltaX = ev.deltaX, deltaY = ev.deltaY; - distanceSq = deltaX * deltaX + deltaY * deltaY; - if (distanceSq >= minDistance * minDistance) { // use pythagorean theorem - _this.handleDistanceSurpassed(ev); - } - } - if (_this.isDragging) { - // a real pointer move? (not one simulated by scrolling) - if (ev.origEvent.type !== 'scroll') { - _this.mirror.handleMove(ev.pageX, ev.pageY); - _this.autoScroller.handleMove(ev.pageX, ev.pageY); - } - _this.emitter.trigger('dragmove', ev); - } - } - }; - _this.onPointerUp = function (ev) { - if (_this.isInteracting) { - _this.isInteracting = false; - allowSelection(document.body); - allowContextMenu(document.body); - _this.emitter.trigger('pointerup', ev); // can potentially set mirrorNeedsRevert - if (_this.isDragging) { - _this.autoScroller.stop(); - _this.tryStopDrag(ev); // which will stop the mirror - } - if (_this.delayTimeoutId) { - clearTimeout(_this.delayTimeoutId); - _this.delayTimeoutId = null; - } - } - }; - var pointer = _this.pointer = new PointerDragging(containerEl); - pointer.emitter.on('pointerdown', _this.onPointerDown); - pointer.emitter.on('pointermove', _this.onPointerMove); - pointer.emitter.on('pointerup', _this.onPointerUp); - if (selector) { - pointer.selector = selector; - } - _this.mirror = new ElementMirror(); - _this.autoScroller = new AutoScroller(); - return _this; - } - FeaturefulElementDragging.prototype.destroy = function () { - this.pointer.destroy(); - // HACK: simulate a pointer-up to end the current drag - // TODO: fire 'dragend' directly and stop interaction. discourage use of pointerup event (b/c might not fire) - this.onPointerUp({}); - }; - FeaturefulElementDragging.prototype.startDelay = function (ev) { - var _this = this; - if (typeof this.delay === 'number') { - this.delayTimeoutId = setTimeout(function () { - _this.delayTimeoutId = null; - _this.handleDelayEnd(ev); - }, this.delay); // not assignable to number! - } - else { - this.handleDelayEnd(ev); - } - }; - FeaturefulElementDragging.prototype.handleDelayEnd = function (ev) { - this.isDelayEnded = true; - this.tryStartDrag(ev); - }; - FeaturefulElementDragging.prototype.handleDistanceSurpassed = function (ev) { - this.isDistanceSurpassed = true; - this.tryStartDrag(ev); - }; - FeaturefulElementDragging.prototype.tryStartDrag = function (ev) { - if (this.isDelayEnded && this.isDistanceSurpassed) { - if (!this.pointer.wasTouchScroll || this.touchScrollAllowed) { - this.isDragging = true; - this.mirrorNeedsRevert = false; - this.autoScroller.start(ev.pageX, ev.pageY); - this.emitter.trigger('dragstart', ev); - if (this.touchScrollAllowed === false) { - this.pointer.cancelTouchScroll(); - } - } - } - }; - FeaturefulElementDragging.prototype.tryStopDrag = function (ev) { - // .stop() is ALWAYS asynchronous, which we NEED because we want all pointerup events - // that come from the document to fire beforehand. much more convenient this way. - this.mirror.stop(this.mirrorNeedsRevert, this.stopDrag.bind(this, ev)); - }; - FeaturefulElementDragging.prototype.stopDrag = function (ev) { - this.isDragging = false; - this.emitter.trigger('dragend', ev); - }; - // fill in the implementations... - FeaturefulElementDragging.prototype.setIgnoreMove = function (bool) { - this.pointer.shouldIgnoreMove = bool; - }; - FeaturefulElementDragging.prototype.setMirrorIsVisible = function (bool) { - this.mirror.setIsVisible(bool); - }; - FeaturefulElementDragging.prototype.setMirrorNeedsRevert = function (bool) { - this.mirrorNeedsRevert = bool; - }; - FeaturefulElementDragging.prototype.setAutoScrollEnabled = function (bool) { - this.autoScroller.isEnabled = bool; - }; - return FeaturefulElementDragging; - }(ElementDragging)); - - /* - When this class is instantiated, it records the offset of an element (relative to the document topleft), - and continues to monitor scrolling, updating the cached coordinates if it needs to. - Does not access the DOM after instantiation, so highly performant. - - Also keeps track of all scrolling/overflow:hidden containers that are parents of the given element - and an determine if a given point is inside the combined clipping rectangle. - */ - var OffsetTracker = /** @class */ (function () { - function OffsetTracker(el) { - this.origRect = computeRect(el); - // will work fine for divs that have overflow:hidden - this.scrollCaches = getClippingParents(el).map(function (scrollEl) { return new ElementScrollGeomCache(scrollEl, true); }); - } - OffsetTracker.prototype.destroy = function () { - for (var _i = 0, _a = this.scrollCaches; _i < _a.length; _i++) { - var scrollCache = _a[_i]; - scrollCache.destroy(); - } - }; - OffsetTracker.prototype.computeLeft = function () { - var left = this.origRect.left; - for (var _i = 0, _a = this.scrollCaches; _i < _a.length; _i++) { - var scrollCache = _a[_i]; - left += scrollCache.origScrollLeft - scrollCache.getScrollLeft(); - } - return left; - }; - OffsetTracker.prototype.computeTop = function () { - var top = this.origRect.top; - for (var _i = 0, _a = this.scrollCaches; _i < _a.length; _i++) { - var scrollCache = _a[_i]; - top += scrollCache.origScrollTop - scrollCache.getScrollTop(); - } - return top; - }; - OffsetTracker.prototype.isWithinClipping = function (pageX, pageY) { - var point = { left: pageX, top: pageY }; - for (var _i = 0, _a = this.scrollCaches; _i < _a.length; _i++) { - var scrollCache = _a[_i]; - if (!isIgnoredClipping(scrollCache.getEventTarget()) && - !pointInsideRect(point, scrollCache.clientRect)) { - return false; - } - } - return true; - }; - return OffsetTracker; - }()); - // certain clipping containers should never constrain interactions, like <html> and <body> - // https://github.com/fullcalendar/fullcalendar/issues/3615 - function isIgnoredClipping(node) { - var tagName = node.tagName; - return tagName === 'HTML' || tagName === 'BODY'; - } - - /* - Tracks movement over multiple droppable areas (aka "hits") - that exist in one or more DateComponents. - Relies on an existing draggable. - - emits: - - pointerdown - - dragstart - - hitchange - fires initially, even if not over a hit - - pointerup - - (hitchange - again, to null, if ended over a hit) - - dragend - */ - var HitDragging = /** @class */ (function () { - function HitDragging(dragging, droppableStore) { - var _this = this; - // options that can be set by caller - this.useSubjectCenter = false; - this.requireInitial = true; // if doesn't start out on a hit, won't emit any events - this.initialHit = null; - this.movingHit = null; - this.finalHit = null; // won't ever be populated if shouldIgnoreMove - this.handlePointerDown = function (ev) { - var dragging = _this.dragging; - _this.initialHit = null; - _this.movingHit = null; - _this.finalHit = null; - _this.prepareHits(); - _this.processFirstCoord(ev); - if (_this.initialHit || !_this.requireInitial) { - dragging.setIgnoreMove(false); - // TODO: fire this before computing processFirstCoord, so listeners can cancel. this gets fired by almost every handler :( - _this.emitter.trigger('pointerdown', ev); - } - else { - dragging.setIgnoreMove(true); - } - }; - this.handleDragStart = function (ev) { - _this.emitter.trigger('dragstart', ev); - _this.handleMove(ev, true); // force = fire even if initially null - }; - this.handleDragMove = function (ev) { - _this.emitter.trigger('dragmove', ev); - _this.handleMove(ev); - }; - this.handlePointerUp = function (ev) { - _this.releaseHits(); - _this.emitter.trigger('pointerup', ev); - }; - this.handleDragEnd = function (ev) { - if (_this.movingHit) { - _this.emitter.trigger('hitupdate', null, true, ev); - } - _this.finalHit = _this.movingHit; - _this.movingHit = null; - _this.emitter.trigger('dragend', ev); - }; - this.droppableStore = droppableStore; - dragging.emitter.on('pointerdown', this.handlePointerDown); - dragging.emitter.on('dragstart', this.handleDragStart); - dragging.emitter.on('dragmove', this.handleDragMove); - dragging.emitter.on('pointerup', this.handlePointerUp); - dragging.emitter.on('dragend', this.handleDragEnd); - this.dragging = dragging; - this.emitter = new Emitter(); - } - // sets initialHit - // sets coordAdjust - HitDragging.prototype.processFirstCoord = function (ev) { - var origPoint = { left: ev.pageX, top: ev.pageY }; - var adjustedPoint = origPoint; - var subjectEl = ev.subjectEl; - var subjectRect; - if (subjectEl !== document) { - subjectRect = computeRect(subjectEl); - adjustedPoint = constrainPoint(adjustedPoint, subjectRect); - } - var initialHit = this.initialHit = this.queryHitForOffset(adjustedPoint.left, adjustedPoint.top); - if (initialHit) { - if (this.useSubjectCenter && subjectRect) { - var slicedSubjectRect = intersectRects(subjectRect, initialHit.rect); - if (slicedSubjectRect) { - adjustedPoint = getRectCenter(slicedSubjectRect); - } - } - this.coordAdjust = diffPoints(adjustedPoint, origPoint); - } - else { - this.coordAdjust = { left: 0, top: 0 }; - } - }; - HitDragging.prototype.handleMove = function (ev, forceHandle) { - var hit = this.queryHitForOffset(ev.pageX + this.coordAdjust.left, ev.pageY + this.coordAdjust.top); - if (forceHandle || !isHitsEqual(this.movingHit, hit)) { - this.movingHit = hit; - this.emitter.trigger('hitupdate', hit, false, ev); - } - }; - HitDragging.prototype.prepareHits = function () { - this.offsetTrackers = mapHash(this.droppableStore, function (interactionSettings) { - interactionSettings.component.prepareHits(); - return new OffsetTracker(interactionSettings.el); - }); - }; - HitDragging.prototype.releaseHits = function () { - var offsetTrackers = this.offsetTrackers; - for (var id in offsetTrackers) { - offsetTrackers[id].destroy(); - } - this.offsetTrackers = {}; - }; - HitDragging.prototype.queryHitForOffset = function (offsetLeft, offsetTop) { - var _a = this, droppableStore = _a.droppableStore, offsetTrackers = _a.offsetTrackers; - var bestHit = null; - for (var id in droppableStore) { - var component = droppableStore[id].component; - var offsetTracker = offsetTrackers[id]; - if (offsetTracker && // wasn't destroyed mid-drag - offsetTracker.isWithinClipping(offsetLeft, offsetTop)) { - var originLeft = offsetTracker.computeLeft(); - var originTop = offsetTracker.computeTop(); - var positionLeft = offsetLeft - originLeft; - var positionTop = offsetTop - originTop; - var origRect = offsetTracker.origRect; - var width = origRect.right - origRect.left; - var height = origRect.bottom - origRect.top; - if ( - // must be within the element's bounds - positionLeft >= 0 && positionLeft < width && - positionTop >= 0 && positionTop < height) { - var hit = component.queryHit(positionLeft, positionTop, width, height); - var dateProfile = component.context.getCurrentData().dateProfile; - if (hit && - ( - // make sure the hit is within activeRange, meaning it's not a deal cell - rangeContainsRange(dateProfile.activeRange, hit.dateSpan.range)) && - (!bestHit || hit.layer > bestHit.layer)) { - // TODO: better way to re-orient rectangle - hit.rect.left += originLeft; - hit.rect.right += originLeft; - hit.rect.top += originTop; - hit.rect.bottom += originTop; - bestHit = hit; - } - } - } - } - return bestHit; - }; - return HitDragging; - }()); - function isHitsEqual(hit0, hit1) { - if (!hit0 && !hit1) { - return true; - } - if (Boolean(hit0) !== Boolean(hit1)) { - return false; - } - return isDateSpansEqual(hit0.dateSpan, hit1.dateSpan); - } - - function buildDatePointApiWithContext(dateSpan, context) { - var props = {}; - for (var _i = 0, _a = context.pluginHooks.datePointTransforms; _i < _a.length; _i++) { - var transform = _a[_i]; - __assign(props, transform(dateSpan, context)); - } - __assign(props, buildDatePointApi(dateSpan, context.dateEnv)); - return props; - } - function buildDatePointApi(span, dateEnv) { - return { - date: dateEnv.toDate(span.range.start), - dateStr: dateEnv.formatIso(span.range.start, { omitTime: span.allDay }), - allDay: span.allDay, - }; - } - - /* - Monitors when the user clicks on a specific date/time of a component. - A pointerdown+pointerup on the same "hit" constitutes a click. - */ - var DateClicking = /** @class */ (function (_super) { - __extends(DateClicking, _super); - function DateClicking(settings) { - var _this = _super.call(this, settings) || this; - _this.handlePointerDown = function (pev) { - var dragging = _this.dragging; - var downEl = pev.origEvent.target; - // do this in pointerdown (not dragend) because DOM might be mutated by the time dragend is fired - dragging.setIgnoreMove(!_this.component.isValidDateDownEl(downEl)); - }; - // won't even fire if moving was ignored - _this.handleDragEnd = function (ev) { - var component = _this.component; - var pointer = _this.dragging.pointer; - if (!pointer.wasTouchScroll) { - var _a = _this.hitDragging, initialHit = _a.initialHit, finalHit = _a.finalHit; - if (initialHit && finalHit && isHitsEqual(initialHit, finalHit)) { - var context = component.context; - var arg = __assign(__assign({}, buildDatePointApiWithContext(initialHit.dateSpan, context)), { dayEl: initialHit.dayEl, jsEvent: ev.origEvent, view: context.viewApi || context.calendarApi.view }); - context.emitter.trigger('dateClick', arg); - } - } - }; - // we DO want to watch pointer moves because otherwise finalHit won't get populated - _this.dragging = new FeaturefulElementDragging(settings.el); - _this.dragging.autoScroller.isEnabled = false; - var hitDragging = _this.hitDragging = new HitDragging(_this.dragging, interactionSettingsToStore(settings)); - hitDragging.emitter.on('pointerdown', _this.handlePointerDown); - hitDragging.emitter.on('dragend', _this.handleDragEnd); - return _this; - } - DateClicking.prototype.destroy = function () { - this.dragging.destroy(); - }; - return DateClicking; - }(Interaction)); - - /* - Tracks when the user selects a portion of time of a component, - constituted by a drag over date cells, with a possible delay at the beginning of the drag. - */ - var DateSelecting = /** @class */ (function (_super) { - __extends(DateSelecting, _super); - function DateSelecting(settings) { - var _this = _super.call(this, settings) || this; - _this.dragSelection = null; - _this.handlePointerDown = function (ev) { - var _a = _this, component = _a.component, dragging = _a.dragging; - var options = component.context.options; - var canSelect = options.selectable && - component.isValidDateDownEl(ev.origEvent.target); - // don't bother to watch expensive moves if component won't do selection - dragging.setIgnoreMove(!canSelect); - // if touch, require user to hold down - dragging.delay = ev.isTouch ? getComponentTouchDelay(component) : null; - }; - _this.handleDragStart = function (ev) { - _this.component.context.calendarApi.unselect(ev); // unselect previous selections - }; - _this.handleHitUpdate = function (hit, isFinal) { - var context = _this.component.context; - var dragSelection = null; - var isInvalid = false; - if (hit) { - dragSelection = joinHitsIntoSelection(_this.hitDragging.initialHit, hit, context.pluginHooks.dateSelectionTransformers); - if (!dragSelection || !_this.component.isDateSelectionValid(dragSelection)) { - isInvalid = true; - dragSelection = null; - } - } - if (dragSelection) { - context.dispatch({ type: 'SELECT_DATES', selection: dragSelection }); - } - else if (!isFinal) { // only unselect if moved away while dragging - context.dispatch({ type: 'UNSELECT_DATES' }); - } - if (!isInvalid) { - enableCursor(); - } - else { - disableCursor(); - } - if (!isFinal) { - _this.dragSelection = dragSelection; // only clear if moved away from all hits while dragging - } - }; - _this.handlePointerUp = function (pev) { - if (_this.dragSelection) { - // selection is already rendered, so just need to report selection - triggerDateSelect(_this.dragSelection, pev, _this.component.context); - _this.dragSelection = null; - } - }; - var component = settings.component; - var options = component.context.options; - var dragging = _this.dragging = new FeaturefulElementDragging(settings.el); - dragging.touchScrollAllowed = false; - dragging.minDistance = options.selectMinDistance || 0; - dragging.autoScroller.isEnabled = options.dragScroll; - var hitDragging = _this.hitDragging = new HitDragging(_this.dragging, interactionSettingsToStore(settings)); - hitDragging.emitter.on('pointerdown', _this.handlePointerDown); - hitDragging.emitter.on('dragstart', _this.handleDragStart); - hitDragging.emitter.on('hitupdate', _this.handleHitUpdate); - hitDragging.emitter.on('pointerup', _this.handlePointerUp); - return _this; - } - DateSelecting.prototype.destroy = function () { - this.dragging.destroy(); - }; - return DateSelecting; - }(Interaction)); - function getComponentTouchDelay(component) { - var options = component.context.options; - var delay = options.selectLongPressDelay; - if (delay == null) { - delay = options.longPressDelay; - } - return delay; - } - function joinHitsIntoSelection(hit0, hit1, dateSelectionTransformers) { - var dateSpan0 = hit0.dateSpan; - var dateSpan1 = hit1.dateSpan; - var ms = [ - dateSpan0.range.start, - dateSpan0.range.end, - dateSpan1.range.start, - dateSpan1.range.end, - ]; - ms.sort(compareNumbers); - var props = {}; - for (var _i = 0, dateSelectionTransformers_1 = dateSelectionTransformers; _i < dateSelectionTransformers_1.length; _i++) { - var transformer = dateSelectionTransformers_1[_i]; - var res = transformer(hit0, hit1); - if (res === false) { - return null; - } - if (res) { - __assign(props, res); - } - } - props.range = { start: ms[0], end: ms[3] }; - props.allDay = dateSpan0.allDay; - return props; - } - - var EventDragging = /** @class */ (function (_super) { - __extends(EventDragging, _super); - function EventDragging(settings) { - var _this = _super.call(this, settings) || this; - // internal state - _this.subjectEl = null; - _this.subjectSeg = null; // the seg being selected/dragged - _this.isDragging = false; - _this.eventRange = null; - _this.relevantEvents = null; // the events being dragged - _this.receivingContext = null; - _this.validMutation = null; - _this.mutatedRelevantEvents = null; - _this.handlePointerDown = function (ev) { - var origTarget = ev.origEvent.target; - var _a = _this, component = _a.component, dragging = _a.dragging; - var mirror = dragging.mirror; - var options = component.context.options; - var initialContext = component.context; - _this.subjectEl = ev.subjectEl; - var subjectSeg = _this.subjectSeg = getElSeg(ev.subjectEl); - var eventRange = _this.eventRange = subjectSeg.eventRange; - var eventInstanceId = eventRange.instance.instanceId; - _this.relevantEvents = getRelevantEvents(initialContext.getCurrentData().eventStore, eventInstanceId); - dragging.minDistance = ev.isTouch ? 0 : options.eventDragMinDistance; - dragging.delay = - // only do a touch delay if touch and this event hasn't been selected yet - (ev.isTouch && eventInstanceId !== component.props.eventSelection) ? - getComponentTouchDelay$1(component) : - null; - if (options.fixedMirrorParent) { - mirror.parentNode = options.fixedMirrorParent; - } - else { - mirror.parentNode = elementClosest(origTarget, '.fc'); - } - mirror.revertDuration = options.dragRevertDuration; - var isValid = component.isValidSegDownEl(origTarget) && - !elementClosest(origTarget, '.fc-event-resizer'); // NOT on a resizer - dragging.setIgnoreMove(!isValid); - // disable dragging for elements that are resizable (ie, selectable) - // but are not draggable - _this.isDragging = isValid && - ev.subjectEl.classList.contains('fc-event-draggable'); - }; - _this.handleDragStart = function (ev) { - var initialContext = _this.component.context; - var eventRange = _this.eventRange; - var eventInstanceId = eventRange.instance.instanceId; - if (ev.isTouch) { - // need to select a different event? - if (eventInstanceId !== _this.component.props.eventSelection) { - initialContext.dispatch({ type: 'SELECT_EVENT', eventInstanceId: eventInstanceId }); - } - } - else { - // if now using mouse, but was previous touch interaction, clear selected event - initialContext.dispatch({ type: 'UNSELECT_EVENT' }); - } - if (_this.isDragging) { - initialContext.calendarApi.unselect(ev); // unselect *date* selection - initialContext.emitter.trigger('eventDragStart', { - el: _this.subjectEl, - event: new EventApi(initialContext, eventRange.def, eventRange.instance), - jsEvent: ev.origEvent, - view: initialContext.viewApi, - }); - } - }; - _this.handleHitUpdate = function (hit, isFinal) { - if (!_this.isDragging) { - return; - } - var relevantEvents = _this.relevantEvents; - var initialHit = _this.hitDragging.initialHit; - var initialContext = _this.component.context; - // states based on new hit - var receivingContext = null; - var mutation = null; - var mutatedRelevantEvents = null; - var isInvalid = false; - var interaction = { - affectedEvents: relevantEvents, - mutatedEvents: createEmptyEventStore(), - isEvent: true, - }; - if (hit) { - var receivingComponent = hit.component; - receivingContext = receivingComponent.context; - var receivingOptions = receivingContext.options; - if (initialContext === receivingContext || - (receivingOptions.editable && receivingOptions.droppable)) { - mutation = computeEventMutation(initialHit, hit, receivingContext.getCurrentData().pluginHooks.eventDragMutationMassagers); - if (mutation) { - mutatedRelevantEvents = applyMutationToEventStore(relevantEvents, receivingContext.getCurrentData().eventUiBases, mutation, receivingContext); - interaction.mutatedEvents = mutatedRelevantEvents; - if (!receivingComponent.isInteractionValid(interaction)) { - isInvalid = true; - mutation = null; - mutatedRelevantEvents = null; - interaction.mutatedEvents = createEmptyEventStore(); - } - } - } - else { - receivingContext = null; - } - } - _this.displayDrag(receivingContext, interaction); - if (!isInvalid) { - enableCursor(); - } - else { - disableCursor(); - } - if (!isFinal) { - if (initialContext === receivingContext && // TODO: write test for this - isHitsEqual(initialHit, hit)) { - mutation = null; - } - _this.dragging.setMirrorNeedsRevert(!mutation); - // render the mirror if no already-rendered mirror - // TODO: wish we could somehow wait for dispatch to guarantee render - _this.dragging.setMirrorIsVisible(!hit || !document.querySelector('.fc-event-mirror')); - // assign states based on new hit - _this.receivingContext = receivingContext; - _this.validMutation = mutation; - _this.mutatedRelevantEvents = mutatedRelevantEvents; - } - }; - _this.handlePointerUp = function () { - if (!_this.isDragging) { - _this.cleanup(); // because handleDragEnd won't fire - } - }; - _this.handleDragEnd = function (ev) { - if (_this.isDragging) { - var initialContext_1 = _this.component.context; - var initialView = initialContext_1.viewApi; - var _a = _this, receivingContext_1 = _a.receivingContext, validMutation = _a.validMutation; - var eventDef = _this.eventRange.def; - var eventInstance = _this.eventRange.instance; - var eventApi = new EventApi(initialContext_1, eventDef, eventInstance); - var relevantEvents_1 = _this.relevantEvents; - var mutatedRelevantEvents_1 = _this.mutatedRelevantEvents; - var finalHit = _this.hitDragging.finalHit; - _this.clearDrag(); // must happen after revert animation - initialContext_1.emitter.trigger('eventDragStop', { - el: _this.subjectEl, - event: eventApi, - jsEvent: ev.origEvent, - view: initialView, - }); - if (validMutation) { - // dropped within same calendar - if (receivingContext_1 === initialContext_1) { - var updatedEventApi = new EventApi(initialContext_1, mutatedRelevantEvents_1.defs[eventDef.defId], eventInstance ? mutatedRelevantEvents_1.instances[eventInstance.instanceId] : null); - initialContext_1.dispatch({ - type: 'MERGE_EVENTS', - eventStore: mutatedRelevantEvents_1, - }); - var eventChangeArg = { - oldEvent: eventApi, - event: updatedEventApi, - relatedEvents: buildEventApis(mutatedRelevantEvents_1, initialContext_1, eventInstance), - revert: function () { - initialContext_1.dispatch({ - type: 'MERGE_EVENTS', - eventStore: relevantEvents_1, - }); - }, - }; - var transformed = {}; - for (var _i = 0, _b = initialContext_1.getCurrentData().pluginHooks.eventDropTransformers; _i < _b.length; _i++) { - var transformer = _b[_i]; - __assign(transformed, transformer(validMutation, initialContext_1)); - } - initialContext_1.emitter.trigger('eventDrop', __assign(__assign(__assign({}, eventChangeArg), transformed), { el: ev.subjectEl, delta: validMutation.datesDelta, jsEvent: ev.origEvent, view: initialView })); - initialContext_1.emitter.trigger('eventChange', eventChangeArg); - // dropped in different calendar - } - else if (receivingContext_1) { - var eventRemoveArg = { - event: eventApi, - relatedEvents: buildEventApis(relevantEvents_1, initialContext_1, eventInstance), - revert: function () { - initialContext_1.dispatch({ - type: 'MERGE_EVENTS', - eventStore: relevantEvents_1, - }); - }, - }; - initialContext_1.emitter.trigger('eventLeave', __assign(__assign({}, eventRemoveArg), { draggedEl: ev.subjectEl, view: initialView })); - initialContext_1.dispatch({ - type: 'REMOVE_EVENTS', - eventStore: relevantEvents_1, - }); - initialContext_1.emitter.trigger('eventRemove', eventRemoveArg); - var addedEventDef = mutatedRelevantEvents_1.defs[eventDef.defId]; - var addedEventInstance = mutatedRelevantEvents_1.instances[eventInstance.instanceId]; - var addedEventApi = new EventApi(receivingContext_1, addedEventDef, addedEventInstance); - receivingContext_1.dispatch({ - type: 'MERGE_EVENTS', - eventStore: mutatedRelevantEvents_1, - }); - var eventAddArg = { - event: addedEventApi, - relatedEvents: buildEventApis(mutatedRelevantEvents_1, receivingContext_1, addedEventInstance), - revert: function () { - receivingContext_1.dispatch({ - type: 'REMOVE_EVENTS', - eventStore: mutatedRelevantEvents_1, - }); - }, - }; - receivingContext_1.emitter.trigger('eventAdd', eventAddArg); - if (ev.isTouch) { - receivingContext_1.dispatch({ - type: 'SELECT_EVENT', - eventInstanceId: eventInstance.instanceId, - }); - } - receivingContext_1.emitter.trigger('drop', __assign(__assign({}, buildDatePointApiWithContext(finalHit.dateSpan, receivingContext_1)), { draggedEl: ev.subjectEl, jsEvent: ev.origEvent, view: finalHit.component.context.viewApi })); - receivingContext_1.emitter.trigger('eventReceive', __assign(__assign({}, eventAddArg), { draggedEl: ev.subjectEl, view: finalHit.component.context.viewApi })); - } - } - else { - initialContext_1.emitter.trigger('_noEventDrop'); - } - } - _this.cleanup(); - }; - var component = _this.component; - var options = component.context.options; - var dragging = _this.dragging = new FeaturefulElementDragging(settings.el); - dragging.pointer.selector = EventDragging.SELECTOR; - dragging.touchScrollAllowed = false; - dragging.autoScroller.isEnabled = options.dragScroll; - var hitDragging = _this.hitDragging = new HitDragging(_this.dragging, interactionSettingsStore); - hitDragging.useSubjectCenter = settings.useEventCenter; - hitDragging.emitter.on('pointerdown', _this.handlePointerDown); - hitDragging.emitter.on('dragstart', _this.handleDragStart); - hitDragging.emitter.on('hitupdate', _this.handleHitUpdate); - hitDragging.emitter.on('pointerup', _this.handlePointerUp); - hitDragging.emitter.on('dragend', _this.handleDragEnd); - return _this; - } - EventDragging.prototype.destroy = function () { - this.dragging.destroy(); - }; - // render a drag state on the next receivingCalendar - EventDragging.prototype.displayDrag = function (nextContext, state) { - var initialContext = this.component.context; - var prevContext = this.receivingContext; - // does the previous calendar need to be cleared? - if (prevContext && prevContext !== nextContext) { - // does the initial calendar need to be cleared? - // if so, don't clear all the way. we still need to to hide the affectedEvents - if (prevContext === initialContext) { - prevContext.dispatch({ - type: 'SET_EVENT_DRAG', - state: { - affectedEvents: state.affectedEvents, - mutatedEvents: createEmptyEventStore(), - isEvent: true, - }, - }); - // completely clear the old calendar if it wasn't the initial - } - else { - prevContext.dispatch({ type: 'UNSET_EVENT_DRAG' }); - } - } - if (nextContext) { - nextContext.dispatch({ type: 'SET_EVENT_DRAG', state: state }); - } - }; - EventDragging.prototype.clearDrag = function () { - var initialCalendar = this.component.context; - var receivingContext = this.receivingContext; - if (receivingContext) { - receivingContext.dispatch({ type: 'UNSET_EVENT_DRAG' }); - } - // the initial calendar might have an dummy drag state from displayDrag - if (initialCalendar !== receivingContext) { - initialCalendar.dispatch({ type: 'UNSET_EVENT_DRAG' }); - } - }; - EventDragging.prototype.cleanup = function () { - this.subjectSeg = null; - this.isDragging = false; - this.eventRange = null; - this.relevantEvents = null; - this.receivingContext = null; - this.validMutation = null; - this.mutatedRelevantEvents = null; - }; - // TODO: test this in IE11 - // QUESTION: why do we need it on the resizable??? - EventDragging.SELECTOR = '.fc-event-draggable, .fc-event-resizable'; - return EventDragging; - }(Interaction)); - function computeEventMutation(hit0, hit1, massagers) { - var dateSpan0 = hit0.dateSpan; - var dateSpan1 = hit1.dateSpan; - var date0 = dateSpan0.range.start; - var date1 = dateSpan1.range.start; - var standardProps = {}; - if (dateSpan0.allDay !== dateSpan1.allDay) { - standardProps.allDay = dateSpan1.allDay; - standardProps.hasEnd = hit1.component.context.options.allDayMaintainDuration; - if (dateSpan1.allDay) { - // means date1 is already start-of-day, - // but date0 needs to be converted - date0 = startOfDay(date0); - } - } - var delta = diffDates(date0, date1, hit0.component.context.dateEnv, hit0.component === hit1.component ? - hit0.component.largeUnit : - null); - if (delta.milliseconds) { // has hours/minutes/seconds - standardProps.allDay = false; - } - var mutation = { - datesDelta: delta, - standardProps: standardProps, - }; - for (var _i = 0, massagers_1 = massagers; _i < massagers_1.length; _i++) { - var massager = massagers_1[_i]; - massager(mutation, hit0, hit1); - } - return mutation; - } - function getComponentTouchDelay$1(component) { - var options = component.context.options; - var delay = options.eventLongPressDelay; - if (delay == null) { - delay = options.longPressDelay; - } - return delay; - } - - var EventResizing = /** @class */ (function (_super) { - __extends(EventResizing, _super); - function EventResizing(settings) { - var _this = _super.call(this, settings) || this; - // internal state - _this.draggingSegEl = null; - _this.draggingSeg = null; // TODO: rename to resizingSeg? subjectSeg? - _this.eventRange = null; - _this.relevantEvents = null; - _this.validMutation = null; - _this.mutatedRelevantEvents = null; - _this.handlePointerDown = function (ev) { - var component = _this.component; - var segEl = _this.querySegEl(ev); - var seg = getElSeg(segEl); - var eventRange = _this.eventRange = seg.eventRange; - _this.dragging.minDistance = component.context.options.eventDragMinDistance; - // if touch, need to be working with a selected event - _this.dragging.setIgnoreMove(!_this.component.isValidSegDownEl(ev.origEvent.target) || - (ev.isTouch && _this.component.props.eventSelection !== eventRange.instance.instanceId)); - }; - _this.handleDragStart = function (ev) { - var context = _this.component.context; - var eventRange = _this.eventRange; - _this.relevantEvents = getRelevantEvents(context.getCurrentData().eventStore, _this.eventRange.instance.instanceId); - var segEl = _this.querySegEl(ev); - _this.draggingSegEl = segEl; - _this.draggingSeg = getElSeg(segEl); - context.calendarApi.unselect(); - context.emitter.trigger('eventResizeStart', { - el: segEl, - event: new EventApi(context, eventRange.def, eventRange.instance), - jsEvent: ev.origEvent, - view: context.viewApi, - }); - }; - _this.handleHitUpdate = function (hit, isFinal, ev) { - var context = _this.component.context; - var relevantEvents = _this.relevantEvents; - var initialHit = _this.hitDragging.initialHit; - var eventInstance = _this.eventRange.instance; - var mutation = null; - var mutatedRelevantEvents = null; - var isInvalid = false; - var interaction = { - affectedEvents: relevantEvents, - mutatedEvents: createEmptyEventStore(), - isEvent: true, - }; - if (hit) { - mutation = computeMutation(initialHit, hit, ev.subjectEl.classList.contains('fc-event-resizer-start'), eventInstance.range, context.pluginHooks.eventResizeJoinTransforms); - } - if (mutation) { - mutatedRelevantEvents = applyMutationToEventStore(relevantEvents, context.getCurrentData().eventUiBases, mutation, context); - interaction.mutatedEvents = mutatedRelevantEvents; - if (!_this.component.isInteractionValid(interaction)) { - isInvalid = true; - mutation = null; - mutatedRelevantEvents = null; - interaction.mutatedEvents = null; - } - } - if (mutatedRelevantEvents) { - context.dispatch({ - type: 'SET_EVENT_RESIZE', - state: interaction, - }); - } - else { - context.dispatch({ type: 'UNSET_EVENT_RESIZE' }); - } - if (!isInvalid) { - enableCursor(); - } - else { - disableCursor(); - } - if (!isFinal) { - if (mutation && isHitsEqual(initialHit, hit)) { - mutation = null; - } - _this.validMutation = mutation; - _this.mutatedRelevantEvents = mutatedRelevantEvents; - } - }; - _this.handleDragEnd = function (ev) { - var context = _this.component.context; - var eventDef = _this.eventRange.def; - var eventInstance = _this.eventRange.instance; - var eventApi = new EventApi(context, eventDef, eventInstance); - var relevantEvents = _this.relevantEvents; - var mutatedRelevantEvents = _this.mutatedRelevantEvents; - context.emitter.trigger('eventResizeStop', { - el: _this.draggingSegEl, - event: eventApi, - jsEvent: ev.origEvent, - view: context.viewApi, - }); - if (_this.validMutation) { - var updatedEventApi = new EventApi(context, mutatedRelevantEvents.defs[eventDef.defId], eventInstance ? mutatedRelevantEvents.instances[eventInstance.instanceId] : null); - context.dispatch({ - type: 'MERGE_EVENTS', - eventStore: mutatedRelevantEvents, - }); - var eventChangeArg = { - oldEvent: eventApi, - event: updatedEventApi, - relatedEvents: buildEventApis(mutatedRelevantEvents, context, eventInstance), - revert: function () { - context.dispatch({ - type: 'MERGE_EVENTS', - eventStore: relevantEvents, - }); - }, - }; - context.emitter.trigger('eventResize', __assign(__assign({}, eventChangeArg), { el: _this.draggingSegEl, startDelta: _this.validMutation.startDelta || createDuration(0), endDelta: _this.validMutation.endDelta || createDuration(0), jsEvent: ev.origEvent, view: context.viewApi })); - context.emitter.trigger('eventChange', eventChangeArg); - } - else { - context.emitter.trigger('_noEventResize'); - } - // reset all internal state - _this.draggingSeg = null; - _this.relevantEvents = null; - _this.validMutation = null; - // okay to keep eventInstance around. useful to set it in handlePointerDown - }; - var component = settings.component; - var dragging = _this.dragging = new FeaturefulElementDragging(settings.el); - dragging.pointer.selector = '.fc-event-resizer'; - dragging.touchScrollAllowed = false; - dragging.autoScroller.isEnabled = component.context.options.dragScroll; - var hitDragging = _this.hitDragging = new HitDragging(_this.dragging, interactionSettingsToStore(settings)); - hitDragging.emitter.on('pointerdown', _this.handlePointerDown); - hitDragging.emitter.on('dragstart', _this.handleDragStart); - hitDragging.emitter.on('hitupdate', _this.handleHitUpdate); - hitDragging.emitter.on('dragend', _this.handleDragEnd); - return _this; - } - EventResizing.prototype.destroy = function () { - this.dragging.destroy(); - }; - EventResizing.prototype.querySegEl = function (ev) { - return elementClosest(ev.subjectEl, '.fc-event'); - }; - return EventResizing; - }(Interaction)); - function computeMutation(hit0, hit1, isFromStart, instanceRange, transforms) { - var dateEnv = hit0.component.context.dateEnv; - var date0 = hit0.dateSpan.range.start; - var date1 = hit1.dateSpan.range.start; - var delta = diffDates(date0, date1, dateEnv, hit0.component.largeUnit); - var props = {}; - for (var _i = 0, transforms_1 = transforms; _i < transforms_1.length; _i++) { - var transform = transforms_1[_i]; - var res = transform(hit0, hit1); - if (res === false) { - return null; - } - if (res) { - __assign(props, res); - } - } - if (isFromStart) { - if (dateEnv.add(instanceRange.start, delta) < instanceRange.end) { - props.startDelta = delta; - return props; - } - } - else if (dateEnv.add(instanceRange.end, delta) > instanceRange.start) { - props.endDelta = delta; - return props; - } - return null; - } - - var UnselectAuto = /** @class */ (function () { - function UnselectAuto(context) { - var _this = this; - this.context = context; - this.isRecentPointerDateSelect = false; // wish we could use a selector to detect date selection, but uses hit system - this.matchesCancel = false; - this.matchesEvent = false; - this.onSelect = function (selectInfo) { - if (selectInfo.jsEvent) { - _this.isRecentPointerDateSelect = true; - } - }; - this.onDocumentPointerDown = function (pev) { - var unselectCancel = _this.context.options.unselectCancel; - var downEl = pev.origEvent.target; - _this.matchesCancel = !!elementClosest(downEl, unselectCancel); - _this.matchesEvent = !!elementClosest(downEl, EventDragging.SELECTOR); // interaction started on an event? - }; - this.onDocumentPointerUp = function (pev) { - var context = _this.context; - var documentPointer = _this.documentPointer; - var calendarState = context.getCurrentData(); - // touch-scrolling should never unfocus any type of selection - if (!documentPointer.wasTouchScroll) { - if (calendarState.dateSelection && // an existing date selection? - !_this.isRecentPointerDateSelect // a new pointer-initiated date selection since last onDocumentPointerUp? - ) { - var unselectAuto = context.options.unselectAuto; - if (unselectAuto && (!unselectAuto || !_this.matchesCancel)) { - context.calendarApi.unselect(pev); - } - } - if (calendarState.eventSelection && // an existing event selected? - !_this.matchesEvent // interaction DIDN'T start on an event - ) { - context.dispatch({ type: 'UNSELECT_EVENT' }); - } - } - _this.isRecentPointerDateSelect = false; - }; - var documentPointer = this.documentPointer = new PointerDragging(document); - documentPointer.shouldIgnoreMove = true; - documentPointer.shouldWatchScroll = false; - documentPointer.emitter.on('pointerdown', this.onDocumentPointerDown); - documentPointer.emitter.on('pointerup', this.onDocumentPointerUp); - /* - TODO: better way to know about whether there was a selection with the pointer - */ - context.emitter.on('select', this.onSelect); - } - UnselectAuto.prototype.destroy = function () { - this.context.emitter.off('select', this.onSelect); - this.documentPointer.destroy(); - }; - return UnselectAuto; - }()); - - var OPTION_REFINERS = { - fixedMirrorParent: identity, - }; - var LISTENER_REFINERS = { - dateClick: identity, - eventDragStart: identity, - eventDragStop: identity, - eventDrop: identity, - eventResizeStart: identity, - eventResizeStop: identity, - eventResize: identity, - drop: identity, - eventReceive: identity, - eventLeave: identity, - }; - - /* - Given an already instantiated draggable object for one-or-more elements, - Interprets any dragging as an attempt to drag an events that lives outside - of a calendar onto a calendar. - */ - var ExternalElementDragging = /** @class */ (function () { - function ExternalElementDragging(dragging, suppliedDragMeta) { - var _this = this; - this.receivingContext = null; - this.droppableEvent = null; // will exist for all drags, even if create:false - this.suppliedDragMeta = null; - this.dragMeta = null; - this.handleDragStart = function (ev) { - _this.dragMeta = _this.buildDragMeta(ev.subjectEl); - }; - this.handleHitUpdate = function (hit, isFinal, ev) { - var dragging = _this.hitDragging.dragging; - var receivingContext = null; - var droppableEvent = null; - var isInvalid = false; - var interaction = { - affectedEvents: createEmptyEventStore(), - mutatedEvents: createEmptyEventStore(), - isEvent: _this.dragMeta.create, - }; - if (hit) { - receivingContext = hit.component.context; - if (_this.canDropElOnCalendar(ev.subjectEl, receivingContext)) { - droppableEvent = computeEventForDateSpan(hit.dateSpan, _this.dragMeta, receivingContext); - interaction.mutatedEvents = eventTupleToStore(droppableEvent); - isInvalid = !isInteractionValid(interaction, receivingContext); - if (isInvalid) { - interaction.mutatedEvents = createEmptyEventStore(); - droppableEvent = null; - } - } - } - _this.displayDrag(receivingContext, interaction); - // show mirror if no already-rendered mirror element OR if we are shutting down the mirror (?) - // TODO: wish we could somehow wait for dispatch to guarantee render - dragging.setMirrorIsVisible(isFinal || !droppableEvent || !document.querySelector('.fc-event-mirror')); - if (!isInvalid) { - enableCursor(); - } - else { - disableCursor(); - } - if (!isFinal) { - dragging.setMirrorNeedsRevert(!droppableEvent); - _this.receivingContext = receivingContext; - _this.droppableEvent = droppableEvent; - } - }; - this.handleDragEnd = function (pev) { - var _a = _this, receivingContext = _a.receivingContext, droppableEvent = _a.droppableEvent; - _this.clearDrag(); - if (receivingContext && droppableEvent) { - var finalHit = _this.hitDragging.finalHit; - var finalView = finalHit.component.context.viewApi; - var dragMeta = _this.dragMeta; - receivingContext.emitter.trigger('drop', __assign(__assign({}, buildDatePointApiWithContext(finalHit.dateSpan, receivingContext)), { draggedEl: pev.subjectEl, jsEvent: pev.origEvent, view: finalView })); - if (dragMeta.create) { - var addingEvents_1 = eventTupleToStore(droppableEvent); - receivingContext.dispatch({ - type: 'MERGE_EVENTS', - eventStore: addingEvents_1, - }); - if (pev.isTouch) { - receivingContext.dispatch({ - type: 'SELECT_EVENT', - eventInstanceId: droppableEvent.instance.instanceId, - }); - } - // signal that an external event landed - receivingContext.emitter.trigger('eventReceive', { - event: new EventApi(receivingContext, droppableEvent.def, droppableEvent.instance), - relatedEvents: [], - revert: function () { - receivingContext.dispatch({ - type: 'REMOVE_EVENTS', - eventStore: addingEvents_1, - }); - }, - draggedEl: pev.subjectEl, - view: finalView, - }); - } - } - _this.receivingContext = null; - _this.droppableEvent = null; - }; - var hitDragging = this.hitDragging = new HitDragging(dragging, interactionSettingsStore); - hitDragging.requireInitial = false; // will start outside of a component - hitDragging.emitter.on('dragstart', this.handleDragStart); - hitDragging.emitter.on('hitupdate', this.handleHitUpdate); - hitDragging.emitter.on('dragend', this.handleDragEnd); - this.suppliedDragMeta = suppliedDragMeta; - } - ExternalElementDragging.prototype.buildDragMeta = function (subjectEl) { - if (typeof this.suppliedDragMeta === 'object') { - return parseDragMeta(this.suppliedDragMeta); - } - if (typeof this.suppliedDragMeta === 'function') { - return parseDragMeta(this.suppliedDragMeta(subjectEl)); - } - return getDragMetaFromEl(subjectEl); - }; - ExternalElementDragging.prototype.displayDrag = function (nextContext, state) { - var prevContext = this.receivingContext; - if (prevContext && prevContext !== nextContext) { - prevContext.dispatch({ type: 'UNSET_EVENT_DRAG' }); - } - if (nextContext) { - nextContext.dispatch({ type: 'SET_EVENT_DRAG', state: state }); - } - }; - ExternalElementDragging.prototype.clearDrag = function () { - if (this.receivingContext) { - this.receivingContext.dispatch({ type: 'UNSET_EVENT_DRAG' }); - } - }; - ExternalElementDragging.prototype.canDropElOnCalendar = function (el, receivingContext) { - var dropAccept = receivingContext.options.dropAccept; - if (typeof dropAccept === 'function') { - return dropAccept.call(receivingContext.calendarApi, el); - } - if (typeof dropAccept === 'string' && dropAccept) { - return Boolean(elementMatches(el, dropAccept)); - } - return true; - }; - return ExternalElementDragging; - }()); - // Utils for computing event store from the DragMeta - // ---------------------------------------------------------------------------------------------------- - function computeEventForDateSpan(dateSpan, dragMeta, context) { - var defProps = __assign({}, dragMeta.leftoverProps); - for (var _i = 0, _a = context.pluginHooks.externalDefTransforms; _i < _a.length; _i++) { - var transform = _a[_i]; - __assign(defProps, transform(dateSpan, dragMeta)); - } - var _b = refineEventDef(defProps, context), refined = _b.refined, extra = _b.extra; - var def = parseEventDef(refined, extra, dragMeta.sourceId, dateSpan.allDay, context.options.forceEventDuration || Boolean(dragMeta.duration), // hasEnd - context); - var start = dateSpan.range.start; - // only rely on time info if drop zone is all-day, - // otherwise, we already know the time - if (dateSpan.allDay && dragMeta.startTime) { - start = context.dateEnv.add(start, dragMeta.startTime); - } - var end = dragMeta.duration ? - context.dateEnv.add(start, dragMeta.duration) : - getDefaultEventEnd(dateSpan.allDay, start, context); - var instance = createEventInstance(def.defId, { start: start, end: end }); - return { def: def, instance: instance }; - } - // Utils for extracting data from element - // ---------------------------------------------------------------------------------------------------- - function getDragMetaFromEl(el) { - var str = getEmbeddedElData(el, 'event'); - var obj = str ? - JSON.parse(str) : - { create: false }; // if no embedded data, assume no event creation - return parseDragMeta(obj); - } - config.dataAttrPrefix = ''; - function getEmbeddedElData(el, name) { - var prefix = config.dataAttrPrefix; - var prefixedName = (prefix ? prefix + '-' : '') + name; - return el.getAttribute('data-' + prefixedName) || ''; - } - - /* - Makes an element (that is *external* to any calendar) draggable. - Can pass in data that determines how an event will be created when dropped onto a calendar. - Leverages FullCalendar's internal drag-n-drop functionality WITHOUT a third-party drag system. - */ - var ExternalDraggable = /** @class */ (function () { - function ExternalDraggable(el, settings) { - var _this = this; - if (settings === void 0) { settings = {}; } - this.handlePointerDown = function (ev) { - var dragging = _this.dragging; - var _a = _this.settings, minDistance = _a.minDistance, longPressDelay = _a.longPressDelay; - dragging.minDistance = - minDistance != null ? - minDistance : - (ev.isTouch ? 0 : BASE_OPTION_DEFAULTS.eventDragMinDistance); - dragging.delay = - ev.isTouch ? // TODO: eventually read eventLongPressDelay instead vvv - (longPressDelay != null ? longPressDelay : BASE_OPTION_DEFAULTS.longPressDelay) : - 0; - }; - this.handleDragStart = function (ev) { - if (ev.isTouch && - _this.dragging.delay && - ev.subjectEl.classList.contains('fc-event')) { - _this.dragging.mirror.getMirrorEl().classList.add('fc-event-selected'); - } - }; - this.settings = settings; - var dragging = this.dragging = new FeaturefulElementDragging(el); - dragging.touchScrollAllowed = false; - if (settings.itemSelector != null) { - dragging.pointer.selector = settings.itemSelector; - } - if (settings.appendTo != null) { - dragging.mirror.parentNode = settings.appendTo; // TODO: write tests - } - dragging.emitter.on('pointerdown', this.handlePointerDown); - dragging.emitter.on('dragstart', this.handleDragStart); - new ExternalElementDragging(dragging, settings.eventData); // eslint-disable-line no-new - } - ExternalDraggable.prototype.destroy = function () { - this.dragging.destroy(); - }; - return ExternalDraggable; - }()); - - /* - Detects when a *THIRD-PARTY* drag-n-drop system interacts with elements. - The third-party system is responsible for drawing the visuals effects of the drag. - This class simply monitors for pointer movements and fires events. - It also has the ability to hide the moving element (the "mirror") during the drag. - */ - var InferredElementDragging = /** @class */ (function (_super) { - __extends(InferredElementDragging, _super); - function InferredElementDragging(containerEl) { - var _this = _super.call(this, containerEl) || this; - _this.shouldIgnoreMove = false; - _this.mirrorSelector = ''; - _this.currentMirrorEl = null; - _this.handlePointerDown = function (ev) { - _this.emitter.trigger('pointerdown', ev); - if (!_this.shouldIgnoreMove) { - // fire dragstart right away. does not support delay or min-distance - _this.emitter.trigger('dragstart', ev); - } - }; - _this.handlePointerMove = function (ev) { - if (!_this.shouldIgnoreMove) { - _this.emitter.trigger('dragmove', ev); - } - }; - _this.handlePointerUp = function (ev) { - _this.emitter.trigger('pointerup', ev); - if (!_this.shouldIgnoreMove) { - // fire dragend right away. does not support a revert animation - _this.emitter.trigger('dragend', ev); - } - }; - var pointer = _this.pointer = new PointerDragging(containerEl); - pointer.emitter.on('pointerdown', _this.handlePointerDown); - pointer.emitter.on('pointermove', _this.handlePointerMove); - pointer.emitter.on('pointerup', _this.handlePointerUp); - return _this; - } - InferredElementDragging.prototype.destroy = function () { - this.pointer.destroy(); - }; - InferredElementDragging.prototype.setIgnoreMove = function (bool) { - this.shouldIgnoreMove = bool; - }; - InferredElementDragging.prototype.setMirrorIsVisible = function (bool) { - if (bool) { - // restore a previously hidden element. - // use the reference in case the selector class has already been removed. - if (this.currentMirrorEl) { - this.currentMirrorEl.style.visibility = ''; - this.currentMirrorEl = null; - } - } - else { - var mirrorEl = this.mirrorSelector ? - document.querySelector(this.mirrorSelector) : - null; - if (mirrorEl) { - this.currentMirrorEl = mirrorEl; - mirrorEl.style.visibility = 'hidden'; - } - } - }; - return InferredElementDragging; - }(ElementDragging)); - - /* - Bridges third-party drag-n-drop systems with FullCalendar. - Must be instantiated and destroyed by caller. - */ - var ThirdPartyDraggable = /** @class */ (function () { - function ThirdPartyDraggable(containerOrSettings, settings) { - var containerEl = document; - if ( - // wish we could just test instanceof EventTarget, but doesn't work in IE11 - containerOrSettings === document || - containerOrSettings instanceof Element) { - containerEl = containerOrSettings; - settings = settings || {}; - } - else { - settings = (containerOrSettings || {}); - } - var dragging = this.dragging = new InferredElementDragging(containerEl); - if (typeof settings.itemSelector === 'string') { - dragging.pointer.selector = settings.itemSelector; - } - else if (containerEl === document) { - dragging.pointer.selector = '[data-event]'; - } - if (typeof settings.mirrorSelector === 'string') { - dragging.mirrorSelector = settings.mirrorSelector; - } - new ExternalElementDragging(dragging, settings.eventData); // eslint-disable-line no-new - } - ThirdPartyDraggable.prototype.destroy = function () { - this.dragging.destroy(); - }; - return ThirdPartyDraggable; - }()); - - var interactionPlugin = createPlugin({ - componentInteractions: [DateClicking, DateSelecting, EventDragging, EventResizing], - calendarInteractions: [UnselectAuto], - elementDraggingImpl: FeaturefulElementDragging, - optionRefiners: OPTION_REFINERS, - listenerRefiners: LISTENER_REFINERS, - }); - - /* An abstract class for the daygrid views, as well as month view. Renders one or more rows of day cells. - ----------------------------------------------------------------------------------------------------------------------*/ - // It is a manager for a Table subcomponent, which does most of the heavy lifting. - // It is responsible for managing width/height. - var TableView = /** @class */ (function (_super) { - __extends(TableView, _super); - function TableView() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.headerElRef = createRef(); - return _this; - } - TableView.prototype.renderSimpleLayout = function (headerRowContent, bodyContent) { - var _a = this, props = _a.props, context = _a.context; - var sections = []; - var stickyHeaderDates = getStickyHeaderDates(context.options); - if (headerRowContent) { - sections.push({ - type: 'header', - key: 'header', - isSticky: stickyHeaderDates, - chunk: { - elRef: this.headerElRef, - tableClassName: 'fc-col-header', - rowContent: headerRowContent, - }, - }); - } - sections.push({ - type: 'body', - key: 'body', - liquid: true, - chunk: { content: bodyContent }, - }); - return (createElement(ViewRoot, { viewSpec: context.viewSpec }, function (rootElRef, classNames) { return (createElement("div", { ref: rootElRef, className: ['fc-daygrid'].concat(classNames).join(' ') }, - createElement(SimpleScrollGrid, { liquid: !props.isHeightAuto && !props.forPrint, cols: [] /* TODO: make optional? */, sections: sections }))); })); - }; - TableView.prototype.renderHScrollLayout = function (headerRowContent, bodyContent, colCnt, dayMinWidth) { - var ScrollGrid = this.context.pluginHooks.scrollGridImpl; - if (!ScrollGrid) { - throw new Error('No ScrollGrid implementation'); - } - var _a = this, props = _a.props, context = _a.context; - var stickyHeaderDates = !props.forPrint && getStickyHeaderDates(context.options); - var stickyFooterScrollbar = !props.forPrint && getStickyFooterScrollbar(context.options); - var sections = []; - if (headerRowContent) { - sections.push({ - type: 'header', - key: 'header', - isSticky: stickyHeaderDates, - chunks: [{ - key: 'main', - elRef: this.headerElRef, - tableClassName: 'fc-col-header', - rowContent: headerRowContent, - }], - }); - } - sections.push({ - type: 'body', - key: 'body', - liquid: true, - chunks: [{ - key: 'main', - content: bodyContent, - }], - }); - if (stickyFooterScrollbar) { - sections.push({ - type: 'footer', - key: 'footer', - isSticky: true, - chunks: [{ - key: 'main', - content: renderScrollShim, - }], - }); - } - return (createElement(ViewRoot, { viewSpec: context.viewSpec }, function (rootElRef, classNames) { return (createElement("div", { ref: rootElRef, className: ['fc-daygrid'].concat(classNames).join(' ') }, - createElement(ScrollGrid, { liquid: !props.isHeightAuto && !props.forPrint, colGroups: [{ cols: [{ span: colCnt, minWidth: dayMinWidth }] }], sections: sections }))); })); - }; - return TableView; - }(DateComponent)); - - function splitSegsByRow(segs, rowCnt) { - var byRow = []; - for (var i = 0; i < rowCnt; i += 1) { - byRow[i] = []; - } - for (var _i = 0, segs_1 = segs; _i < segs_1.length; _i++) { - var seg = segs_1[_i]; - byRow[seg.row].push(seg); - } - return byRow; - } - function splitSegsByFirstCol(segs, colCnt) { - var byCol = []; - for (var i = 0; i < colCnt; i += 1) { - byCol[i] = []; - } - for (var _i = 0, segs_2 = segs; _i < segs_2.length; _i++) { - var seg = segs_2[_i]; - byCol[seg.firstCol].push(seg); - } - return byCol; - } - function splitInteractionByRow(ui, rowCnt) { - var byRow = []; - if (!ui) { - for (var i = 0; i < rowCnt; i += 1) { - byRow[i] = null; - } - } - else { - for (var i = 0; i < rowCnt; i += 1) { - byRow[i] = { - affectedInstances: ui.affectedInstances, - isEvent: ui.isEvent, - segs: [], - }; - } - for (var _i = 0, _a = ui.segs; _i < _a.length; _i++) { - var seg = _a[_i]; - byRow[seg.row].segs.push(seg); - } - } - return byRow; - } - - var TableCellTop = /** @class */ (function (_super) { - __extends(TableCellTop, _super); - function TableCellTop() { - return _super !== null && _super.apply(this, arguments) || this; - } - TableCellTop.prototype.render = function () { - var props = this.props; - var navLinkAttrs = this.context.options.navLinks - ? { 'data-navlink': buildNavLinkData(props.date), tabIndex: 0 } - : {}; - return (createElement(DayCellContent, { date: props.date, dateProfile: props.dateProfile, todayRange: props.todayRange, showDayNumber: props.showDayNumber, extraHookProps: props.extraHookProps, defaultContent: renderTopInner }, function (innerElRef, innerContent) { return ((innerContent || props.forceDayTop) && (createElement("div", { className: "fc-daygrid-day-top", ref: innerElRef }, - createElement("a", __assign({ className: "fc-daygrid-day-number" }, navLinkAttrs), innerContent || createElement(Fragment, null, "\u00A0"))))); })); - }; - return TableCellTop; - }(BaseComponent)); - function renderTopInner(props) { - return props.dayNumberText; - } - - var DEFAULT_WEEK_NUM_FORMAT = createFormatter({ week: 'narrow' }); - var TableCell = /** @class */ (function (_super) { - __extends(TableCell, _super); - function TableCell() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.handleRootEl = function (el) { - _this.rootEl = el; - setRef(_this.props.elRef, el); - }; - _this.handleMoreLinkClick = function (ev) { - var props = _this.props; - if (props.onMoreClick) { - var allSegs = props.segsByEachCol; - var hiddenSegs = allSegs.filter(function (seg) { return props.segIsHidden[seg.eventRange.instance.instanceId]; }); - props.onMoreClick({ - date: props.date, - allSegs: allSegs, - hiddenSegs: hiddenSegs, - moreCnt: props.moreCnt, - dayEl: _this.rootEl, - ev: ev, - }); - } - }; - return _this; - } - TableCell.prototype.render = function () { - var _this = this; - var _a = this.context, options = _a.options, viewApi = _a.viewApi; - var props = this.props; - var date = props.date, dateProfile = props.dateProfile; - var hookProps = { - num: props.moreCnt, - text: props.buildMoreLinkText(props.moreCnt), - view: viewApi, - }; - var navLinkAttrs = options.navLinks - ? { 'data-navlink': buildNavLinkData(date, 'week'), tabIndex: 0 } - : {}; - return (createElement(DayCellRoot, { date: date, dateProfile: dateProfile, todayRange: props.todayRange, showDayNumber: props.showDayNumber, extraHookProps: props.extraHookProps, elRef: this.handleRootEl }, function (dayElRef, dayClassNames, rootDataAttrs, isDisabled) { return (createElement("td", __assign({ ref: dayElRef, className: ['fc-daygrid-day'].concat(dayClassNames, props.extraClassNames || []).join(' ') }, rootDataAttrs, props.extraDataAttrs), - createElement("div", { className: "fc-daygrid-day-frame fc-scrollgrid-sync-inner", ref: props.innerElRef /* different from hook system! RENAME */ }, - props.showWeekNumber && (createElement(WeekNumberRoot, { date: date, defaultFormat: DEFAULT_WEEK_NUM_FORMAT }, function (weekElRef, weekClassNames, innerElRef, innerContent) { return (createElement("a", __assign({ ref: weekElRef, className: ['fc-daygrid-week-number'].concat(weekClassNames).join(' ') }, navLinkAttrs), innerContent)); })), - !isDisabled && (createElement(TableCellTop, { date: date, dateProfile: dateProfile, showDayNumber: props.showDayNumber, forceDayTop: props.forceDayTop, todayRange: props.todayRange, extraHookProps: props.extraHookProps })), - createElement("div", { className: "fc-daygrid-day-events", ref: props.fgContentElRef, style: { paddingBottom: props.fgPaddingBottom } }, - props.fgContent, - Boolean(props.moreCnt) && (createElement("div", { className: "fc-daygrid-day-bottom", style: { marginTop: props.moreMarginTop } }, - createElement(RenderHook, { hookProps: hookProps, classNames: options.moreLinkClassNames, content: options.moreLinkContent, defaultContent: renderMoreLinkInner, didMount: options.moreLinkDidMount, willUnmount: options.moreLinkWillUnmount }, function (rootElRef, classNames, innerElRef, innerContent) { return (createElement("a", { ref: rootElRef, className: ['fc-daygrid-more-link'].concat(classNames).join(' '), onClick: _this.handleMoreLinkClick }, innerContent)); })))), - createElement("div", { className: "fc-daygrid-day-bg" }, props.bgContent)))); })); - }; - return TableCell; - }(DateComponent)); - TableCell.addPropsEquality({ - onMoreClick: true, - }); - function renderMoreLinkInner(props) { - return props.text; - } - - var DEFAULT_TABLE_EVENT_TIME_FORMAT = createFormatter({ - hour: 'numeric', - minute: '2-digit', - omitZeroMinute: true, - meridiem: 'narrow', - }); - function hasListItemDisplay(seg) { - var display = seg.eventRange.ui.display; - return display === 'list-item' || (display === 'auto' && - !seg.eventRange.def.allDay && - seg.firstCol === seg.lastCol && // can't be multi-day - seg.isStart && // " - seg.isEnd // " - ); - } - - var TableListItemEvent = /** @class */ (function (_super) { - __extends(TableListItemEvent, _super); - function TableListItemEvent() { - return _super !== null && _super.apply(this, arguments) || this; - } - TableListItemEvent.prototype.render = function () { - var _a = this, props = _a.props, context = _a.context; - var timeFormat = context.options.eventTimeFormat || DEFAULT_TABLE_EVENT_TIME_FORMAT; - var timeText = buildSegTimeText(props.seg, timeFormat, context, true, props.defaultDisplayEventEnd); - return (createElement(EventRoot, { seg: props.seg, timeText: timeText, defaultContent: renderInnerContent$2, isDragging: props.isDragging, isResizing: false, isDateSelecting: false, isSelected: props.isSelected, isPast: props.isPast, isFuture: props.isFuture, isToday: props.isToday }, function (rootElRef, classNames, innerElRef, innerContent) { return ( // we don't use styles! - createElement("a", __assign({ className: ['fc-daygrid-event', 'fc-daygrid-dot-event'].concat(classNames).join(' '), ref: rootElRef }, getSegAnchorAttrs$1(props.seg)), innerContent)); })); - }; - return TableListItemEvent; - }(BaseComponent)); - function renderInnerContent$2(innerProps) { - return (createElement(Fragment, null, - createElement("div", { className: "fc-daygrid-event-dot", style: { borderColor: innerProps.borderColor || innerProps.backgroundColor } }), - innerProps.timeText && (createElement("div", { className: "fc-event-time" }, innerProps.timeText)), - createElement("div", { className: "fc-event-title" }, innerProps.event.title || createElement(Fragment, null, "\u00A0")))); - } - function getSegAnchorAttrs$1(seg) { - var url = seg.eventRange.def.url; - return url ? { href: url } : {}; - } - - var TableBlockEvent = /** @class */ (function (_super) { - __extends(TableBlockEvent, _super); - function TableBlockEvent() { - return _super !== null && _super.apply(this, arguments) || this; - } - TableBlockEvent.prototype.render = function () { - var props = this.props; - return (createElement(StandardEvent, __assign({}, props, { extraClassNames: ['fc-daygrid-event', 'fc-daygrid-block-event', 'fc-h-event'], defaultTimeFormat: DEFAULT_TABLE_EVENT_TIME_FORMAT, defaultDisplayEventEnd: props.defaultDisplayEventEnd, disableResizing: !props.seg.eventRange.def.allDay }))); - }; - return TableBlockEvent; - }(BaseComponent)); - - function computeFgSegPlacement(// for one row. TODO: print mode? - cellModels, segs, dayMaxEvents, dayMaxEventRows, eventHeights, maxContentHeight, colCnt, eventOrderSpecs) { - var colPlacements = []; // if event spans multiple cols, its present in each col - var moreCnts = []; // by-col - var segIsHidden = {}; - var segTops = {}; // always populated for each seg - var segMarginTops = {}; // simetimes populated for each seg - var moreTops = {}; - var paddingBottoms = {}; // for each cell's inner-wrapper div - for (var i = 0; i < colCnt; i += 1) { - colPlacements.push([]); - moreCnts.push(0); - } - segs = sortEventSegs(segs, eventOrderSpecs); - for (var _i = 0, segs_1 = segs; _i < segs_1.length; _i++) { - var seg = segs_1[_i]; - var instanceId = seg.eventRange.instance.instanceId; - var eventHeight = eventHeights[instanceId + ':' + seg.firstCol]; - placeSeg(seg, eventHeight || 0); // will keep colPlacements sorted by top - } - if (dayMaxEvents === true || dayMaxEventRows === true) { - limitByMaxHeight(moreCnts, segIsHidden, colPlacements, maxContentHeight); // populates moreCnts/segIsHidden - } - else if (typeof dayMaxEvents === 'number') { - limitByMaxEvents(moreCnts, segIsHidden, colPlacements, dayMaxEvents); // populates moreCnts/segIsHidden - } - else if (typeof dayMaxEventRows === 'number') { - limitByMaxRows(moreCnts, segIsHidden, colPlacements, dayMaxEventRows); // populates moreCnts/segIsHidden - } - // computes segTops/segMarginTops/moreTops/paddingBottoms - for (var col = 0; col < colCnt; col += 1) { - var placements = colPlacements[col]; - var currentNonAbsBottom = 0; - var currentAbsHeight = 0; - for (var _a = 0, placements_1 = placements; _a < placements_1.length; _a++) { - var placement = placements_1[_a]; - var seg = placement.seg; - if (!segIsHidden[seg.eventRange.instance.instanceId]) { - segTops[seg.eventRange.instance.instanceId] = placement.top; // from top of container - if (seg.firstCol === seg.lastCol && seg.isStart && seg.isEnd) { // TODO: simpler way? NOT DRY - segMarginTops[seg.eventRange.instance.instanceId] = - placement.top - currentNonAbsBottom; // from previous seg bottom - currentAbsHeight = 0; - currentNonAbsBottom = placement.bottom; - } - else { // multi-col event, abs positioned - currentAbsHeight = placement.bottom - currentNonAbsBottom; - } - } - } - if (currentAbsHeight) { - if (moreCnts[col]) { - moreTops[col] = currentAbsHeight; - } - else { - paddingBottoms[col] = currentAbsHeight; - } - } - } - function placeSeg(seg, segHeight) { - if (!tryPlaceSegAt(seg, segHeight, 0)) { - for (var col = seg.firstCol; col <= seg.lastCol; col += 1) { - for (var _i = 0, _a = colPlacements[col]; _i < _a.length; _i++) { // will repeat multi-day segs!!!!!!! bad!!!!!! - var placement = _a[_i]; - if (tryPlaceSegAt(seg, segHeight, placement.bottom)) { - return; - } - } - } - } - } - function tryPlaceSegAt(seg, segHeight, top) { - if (canPlaceSegAt(seg, segHeight, top)) { - for (var col = seg.firstCol; col <= seg.lastCol; col += 1) { - var placements = colPlacements[col]; - var insertionIndex = 0; - while (insertionIndex < placements.length && - top >= placements[insertionIndex].top) { - insertionIndex += 1; - } - placements.splice(insertionIndex, 0, { - seg: seg, - top: top, - bottom: top + segHeight, - }); - } - return true; - } - return false; - } - function canPlaceSegAt(seg, segHeight, top) { - for (var col = seg.firstCol; col <= seg.lastCol; col += 1) { - for (var _i = 0, _a = colPlacements[col]; _i < _a.length; _i++) { - var placement = _a[_i]; - if (top < placement.bottom && top + segHeight > placement.top) { // collide? - return false; - } - } - } - return true; - } - // what does this do!? - for (var instanceIdAndFirstCol in eventHeights) { - if (!eventHeights[instanceIdAndFirstCol]) { - segIsHidden[instanceIdAndFirstCol.split(':')[0]] = true; - } - } - var segsByFirstCol = colPlacements.map(extractFirstColSegs); // operates on the sorted cols - var segsByEachCol = colPlacements.map(function (placements, col) { - var segsForCols = extractAllColSegs(placements); - segsForCols = resliceDaySegs(segsForCols, cellModels[col].date, col); - return segsForCols; - }); - return { - segsByFirstCol: segsByFirstCol, - segsByEachCol: segsByEachCol, - segIsHidden: segIsHidden, - segTops: segTops, - segMarginTops: segMarginTops, - moreCnts: moreCnts, - moreTops: moreTops, - paddingBottoms: paddingBottoms, - }; - } - function extractFirstColSegs(oneColPlacements, col) { - var segs = []; - for (var _i = 0, oneColPlacements_1 = oneColPlacements; _i < oneColPlacements_1.length; _i++) { - var placement = oneColPlacements_1[_i]; - if (placement.seg.firstCol === col) { - segs.push(placement.seg); - } - } - return segs; - } - function extractAllColSegs(oneColPlacements) { - var segs = []; - for (var _i = 0, oneColPlacements_2 = oneColPlacements; _i < oneColPlacements_2.length; _i++) { - var placement = oneColPlacements_2[_i]; - segs.push(placement.seg); - } - return segs; - } - function limitByMaxHeight(hiddenCnts, segIsHidden, colPlacements, maxContentHeight) { - limitEvents(hiddenCnts, segIsHidden, colPlacements, true, function (placement) { return placement.bottom <= maxContentHeight; }); - } - function limitByMaxEvents(hiddenCnts, segIsHidden, colPlacements, dayMaxEvents) { - limitEvents(hiddenCnts, segIsHidden, colPlacements, false, function (placement, levelIndex) { return levelIndex < dayMaxEvents; }); - } - function limitByMaxRows(hiddenCnts, segIsHidden, colPlacements, dayMaxEventRows) { - limitEvents(hiddenCnts, segIsHidden, colPlacements, true, function (placement, levelIndex) { return levelIndex < dayMaxEventRows; }); - } - /* - populates the given hiddenCnts/segIsHidden, which are supplied empty. - TODO: return them instead - */ - function limitEvents(hiddenCnts, segIsHidden, colPlacements, _moreLinkConsumesLevel, isPlacementInBounds) { - var colCnt = hiddenCnts.length; - var segIsVisible = {}; // TODO: instead, use segIsHidden with true/false? - var visibleColPlacements = []; // will mirror colPlacements - for (var col = 0; col < colCnt; col += 1) { - visibleColPlacements.push([]); - } - for (var col = 0; col < colCnt; col += 1) { - var placements = colPlacements[col]; - var level = 0; - for (var _i = 0, placements_2 = placements; _i < placements_2.length; _i++) { - var placement = placements_2[_i]; - if (isPlacementInBounds(placement, level)) { - recordVisible(placement); - } - else { - recordHidden(placement, level, _moreLinkConsumesLevel); - } - // only considered a level if the seg had height - if (placement.top !== placement.bottom) { - level += 1; - } - } - } - function recordVisible(placement) { - var seg = placement.seg; - var instanceId = seg.eventRange.instance.instanceId; - if (!segIsVisible[instanceId]) { - segIsVisible[instanceId] = true; - for (var col = seg.firstCol; col <= seg.lastCol; col += 1) { - var destPlacements = visibleColPlacements[col]; - var newPosition = 0; - // insert while keeping top sorted in each column - while (newPosition < destPlacements.length && - placement.top >= destPlacements[newPosition].top) { - newPosition += 1; - } - destPlacements.splice(newPosition, 0, placement); - } - } - } - function recordHidden(placement, currentLevel, moreLinkConsumesLevel) { - var seg = placement.seg; - var instanceId = seg.eventRange.instance.instanceId; - if (!segIsHidden[instanceId]) { - segIsHidden[instanceId] = true; - for (var col = seg.firstCol; col <= seg.lastCol; col += 1) { - hiddenCnts[col] += 1; - var hiddenCnt = hiddenCnts[col]; - if (moreLinkConsumesLevel && hiddenCnt === 1 && currentLevel > 0) { - var doomedLevel = currentLevel - 1; - while (visibleColPlacements[col].length > doomedLevel) { - recordHidden(visibleColPlacements[col].pop(), // removes - visibleColPlacements[col].length, // will execute after the pop. will be the index of the removed placement - false); - } - } - } - } - } - } - // Given the events within an array of segment objects, reslice them to be in a single day - function resliceDaySegs(segs, dayDate, colIndex) { - var dayStart = dayDate; - var dayEnd = addDays(dayStart, 1); - var dayRange = { start: dayStart, end: dayEnd }; - var newSegs = []; - for (var _i = 0, segs_2 = segs; _i < segs_2.length; _i++) { - var seg = segs_2[_i]; - var eventRange = seg.eventRange; - var origRange = eventRange.range; - var slicedRange = intersectRanges(origRange, dayRange); - if (slicedRange) { - newSegs.push(__assign(__assign({}, seg), { firstCol: colIndex, lastCol: colIndex, eventRange: { - def: eventRange.def, - ui: __assign(__assign({}, eventRange.ui), { durationEditable: false }), - instance: eventRange.instance, - range: slicedRange, - }, isStart: seg.isStart && slicedRange.start.valueOf() === origRange.start.valueOf(), isEnd: seg.isEnd && slicedRange.end.valueOf() === origRange.end.valueOf() })); - } - } - return newSegs; - } - - var TableRow = /** @class */ (function (_super) { - __extends(TableRow, _super); - function TableRow() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.cellElRefs = new RefMap(); // the <td> - _this.frameElRefs = new RefMap(); // the fc-daygrid-day-frame - _this.fgElRefs = new RefMap(); // the fc-daygrid-day-events - _this.segHarnessRefs = new RefMap(); // indexed by "instanceId:firstCol" - _this.rootElRef = createRef(); - _this.state = { - framePositions: null, - maxContentHeight: null, - segHeights: {}, - }; - return _this; - } - TableRow.prototype.render = function () { - var _this = this; - var _a = this, props = _a.props, state = _a.state, context = _a.context; - var colCnt = props.cells.length; - var businessHoursByCol = splitSegsByFirstCol(props.businessHourSegs, colCnt); - var bgEventSegsByCol = splitSegsByFirstCol(props.bgEventSegs, colCnt); - var highlightSegsByCol = splitSegsByFirstCol(this.getHighlightSegs(), colCnt); - var mirrorSegsByCol = splitSegsByFirstCol(this.getMirrorSegs(), colCnt); - var _b = computeFgSegPlacement(props.cells, props.fgEventSegs, props.dayMaxEvents, props.dayMaxEventRows, state.segHeights, state.maxContentHeight, colCnt, context.options.eventOrder), paddingBottoms = _b.paddingBottoms, segsByFirstCol = _b.segsByFirstCol, segsByEachCol = _b.segsByEachCol, segIsHidden = _b.segIsHidden, segTops = _b.segTops, segMarginTops = _b.segMarginTops, moreCnts = _b.moreCnts, moreTops = _b.moreTops; - var selectedInstanceHash = // TODO: messy way to compute this - (props.eventDrag && props.eventDrag.affectedInstances) || - (props.eventResize && props.eventResize.affectedInstances) || - {}; - return (createElement("tr", { ref: this.rootElRef }, - props.renderIntro && props.renderIntro(), - props.cells.map(function (cell, col) { - var normalFgNodes = _this.renderFgSegs(segsByFirstCol[col], segIsHidden, segTops, segMarginTops, selectedInstanceHash, props.todayRange); - var mirrorFgNodes = _this.renderFgSegs(mirrorSegsByCol[col], {}, segTops, // use same tops as real rendering - {}, {}, props.todayRange, Boolean(props.eventDrag), Boolean(props.eventResize), false); - return (createElement(TableCell, { key: cell.key, elRef: _this.cellElRefs.createRef(cell.key), innerElRef: _this.frameElRefs.createRef(cell.key) /* FF <td> problem, but okay to use for left/right. TODO: rename prop */, dateProfile: props.dateProfile, date: cell.date, showDayNumber: props.showDayNumbers, showWeekNumber: props.showWeekNumbers && col === 0, forceDayTop: props.showWeekNumbers /* even displaying weeknum for row, not necessarily day */, todayRange: props.todayRange, extraHookProps: cell.extraHookProps, extraDataAttrs: cell.extraDataAttrs, extraClassNames: cell.extraClassNames, moreCnt: moreCnts[col], buildMoreLinkText: props.buildMoreLinkText, onMoreClick: function (arg) { - props.onMoreClick(__assign(__assign({}, arg), { fromCol: col })); - }, segIsHidden: segIsHidden, moreMarginTop: moreTops[col] /* rename */, segsByEachCol: segsByEachCol[col], fgPaddingBottom: paddingBottoms[col], fgContentElRef: _this.fgElRefs.createRef(cell.key), fgContent: ( // Fragment scopes the keys - createElement(Fragment, null, - createElement(Fragment, null, normalFgNodes), - createElement(Fragment, null, mirrorFgNodes))), bgContent: ( // Fragment scopes the keys - createElement(Fragment, null, - _this.renderFillSegs(highlightSegsByCol[col], 'highlight'), - _this.renderFillSegs(businessHoursByCol[col], 'non-business'), - _this.renderFillSegs(bgEventSegsByCol[col], 'bg-event'))) })); - }))); - }; - TableRow.prototype.componentDidMount = function () { - this.updateSizing(true); - }; - TableRow.prototype.componentDidUpdate = function (prevProps, prevState) { - var currentProps = this.props; - this.updateSizing(!isPropsEqual(prevProps, currentProps)); - }; - TableRow.prototype.getHighlightSegs = function () { - var props = this.props; - if (props.eventDrag && props.eventDrag.segs.length) { // messy check - return props.eventDrag.segs; - } - if (props.eventResize && props.eventResize.segs.length) { // messy check - return props.eventResize.segs; - } - return props.dateSelectionSegs; - }; - TableRow.prototype.getMirrorSegs = function () { - var props = this.props; - if (props.eventResize && props.eventResize.segs.length) { // messy check - return props.eventResize.segs; - } - return []; - }; - TableRow.prototype.renderFgSegs = function (segs, segIsHidden, // does NOT mean display:hidden - segTops, segMarginTops, selectedInstanceHash, todayRange, isDragging, isResizing, isDateSelecting) { - var context = this.context; - var eventSelection = this.props.eventSelection; - var framePositions = this.state.framePositions; - var defaultDisplayEventEnd = this.props.cells.length === 1; // colCnt === 1 - var nodes = []; - if (framePositions) { - for (var _i = 0, segs_1 = segs; _i < segs_1.length; _i++) { - var seg = segs_1[_i]; - var instanceId = seg.eventRange.instance.instanceId; - var isMirror = isDragging || isResizing || isDateSelecting; - var isSelected = selectedInstanceHash[instanceId]; - var isInvisible = segIsHidden[instanceId] || isSelected; - // TODO: simpler way? NOT DRY - var isAbsolute = segIsHidden[instanceId] || isMirror || seg.firstCol !== seg.lastCol || !seg.isStart || !seg.isEnd; - var marginTop = void 0; - var top_1 = void 0; - var left = void 0; - var right = void 0; - if (isAbsolute) { - top_1 = segTops[instanceId]; - if (context.isRtl) { - right = 0; - left = framePositions.lefts[seg.lastCol] - framePositions.lefts[seg.firstCol]; - } - else { - left = 0; - right = framePositions.rights[seg.firstCol] - framePositions.rights[seg.lastCol]; - } - } - else { - marginTop = segMarginTops[instanceId]; - } - /* - known bug: events that are force to be list-item but span multiple days still take up space in later columns - */ - nodes.push(createElement("div", { className: 'fc-daygrid-event-harness' + (isAbsolute ? ' fc-daygrid-event-harness-abs' : ''), key: instanceId, - // in print mode when in mult cols, could collide - ref: isMirror ? null : this.segHarnessRefs.createRef(instanceId + ':' + seg.firstCol), style: { - visibility: isInvisible ? 'hidden' : '', - marginTop: marginTop || '', - top: top_1 || '', - left: left || '', - right: right || '', - } }, hasListItemDisplay(seg) ? (createElement(TableListItemEvent, __assign({ seg: seg, isDragging: isDragging, isSelected: instanceId === eventSelection, defaultDisplayEventEnd: defaultDisplayEventEnd }, getSegMeta(seg, todayRange)))) : (createElement(TableBlockEvent, __assign({ seg: seg, isDragging: isDragging, isResizing: isResizing, isDateSelecting: isDateSelecting, isSelected: instanceId === eventSelection, defaultDisplayEventEnd: defaultDisplayEventEnd }, getSegMeta(seg, todayRange)))))); - } - } - return nodes; - }; - TableRow.prototype.renderFillSegs = function (segs, fillType) { - var isRtl = this.context.isRtl; - var todayRange = this.props.todayRange; - var framePositions = this.state.framePositions; - var nodes = []; - if (framePositions) { - for (var _i = 0, segs_2 = segs; _i < segs_2.length; _i++) { - var seg = segs_2[_i]; - var leftRightCss = isRtl ? { - right: 0, - left: framePositions.lefts[seg.lastCol] - framePositions.lefts[seg.firstCol], - } : { - left: 0, - right: framePositions.rights[seg.firstCol] - framePositions.rights[seg.lastCol], - }; - nodes.push(createElement("div", { key: buildEventRangeKey(seg.eventRange), className: "fc-daygrid-bg-harness", style: leftRightCss }, fillType === 'bg-event' ? - createElement(BgEvent, __assign({ seg: seg }, getSegMeta(seg, todayRange))) : - renderFill(fillType))); - } - } - return createElement.apply(void 0, __spreadArrays([Fragment, {}], nodes)); - }; - TableRow.prototype.updateSizing = function (isExternalSizingChange) { - var _a = this, props = _a.props, frameElRefs = _a.frameElRefs; - if (props.clientWidth !== null) { // positioning ready? - if (isExternalSizingChange) { - var frameEls = props.cells.map(function (cell) { return frameElRefs.currentMap[cell.key]; }); - if (frameEls.length) { - var originEl = this.rootElRef.current; - this.setState({ - framePositions: new PositionCache(originEl, frameEls, true, // isHorizontal - false), - }); - } - } - var limitByContentHeight = props.dayMaxEvents === true || props.dayMaxEventRows === true; - this.setState({ - segHeights: this.computeSegHeights(), - maxContentHeight: limitByContentHeight ? this.computeMaxContentHeight() : null, - }); - } - }; - TableRow.prototype.computeSegHeights = function () { - return mapHash(this.segHarnessRefs.currentMap, function (eventHarnessEl) { return (eventHarnessEl.getBoundingClientRect().height); }); - }; - TableRow.prototype.computeMaxContentHeight = function () { - var firstKey = this.props.cells[0].key; - var cellEl = this.cellElRefs.currentMap[firstKey]; - var fcContainerEl = this.fgElRefs.currentMap[firstKey]; - return cellEl.getBoundingClientRect().bottom - fcContainerEl.getBoundingClientRect().top; - }; - TableRow.prototype.getCellEls = function () { - var elMap = this.cellElRefs.currentMap; - return this.props.cells.map(function (cell) { return elMap[cell.key]; }); - }; - return TableRow; - }(DateComponent)); - TableRow.addPropsEquality({ - onMoreClick: true, - }); - TableRow.addStateEquality({ - segHeights: isPropsEqual, - }); - - var PADDING_FROM_VIEWPORT = 10; - var SCROLL_DEBOUNCE = 10; - var Popover = /** @class */ (function (_super) { - __extends(Popover, _super); - function Popover() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.repositioner = new DelayedRunner(_this.updateSize.bind(_this)); - _this.handleRootEl = function (el) { - _this.rootEl = el; - if (_this.props.elRef) { - setRef(_this.props.elRef, el); - } - }; - // Triggered when the user clicks *anywhere* in the document, for the autoHide feature - _this.handleDocumentMousedown = function (ev) { - var onClose = _this.props.onClose; - // only hide the popover if the click happened outside the popover - if (onClose && !_this.rootEl.contains(ev.target)) { - onClose(); - } - }; - _this.handleDocumentScroll = function () { - _this.repositioner.request(SCROLL_DEBOUNCE); - }; - _this.handleCloseClick = function () { - var onClose = _this.props.onClose; - if (onClose) { - onClose(); - } - }; - return _this; - } - Popover.prototype.render = function () { - var theme = this.context.theme; - var props = this.props; - var classNames = [ - 'fc-popover', - theme.getClass('popover'), - ].concat(props.extraClassNames || []); - return (createElement("div", __assign({ className: classNames.join(' ') }, props.extraAttrs, { ref: this.handleRootEl }), - createElement("div", { className: 'fc-popover-header ' + theme.getClass('popoverHeader') }, - createElement("span", { className: "fc-popover-title" }, props.title), - createElement("span", { className: 'fc-popover-close ' + theme.getIconClass('close'), onClick: this.handleCloseClick })), - createElement("div", { className: 'fc-popover-body ' + theme.getClass('popoverContent') }, props.children))); - }; - Popover.prototype.componentDidMount = function () { - document.addEventListener('mousedown', this.handleDocumentMousedown); - document.addEventListener('scroll', this.handleDocumentScroll); - this.updateSize(); - }; - Popover.prototype.componentWillUnmount = function () { - document.removeEventListener('mousedown', this.handleDocumentMousedown); - document.removeEventListener('scroll', this.handleDocumentScroll); - }; - // TODO: adjust on window resize - /* - NOTE: the popover is position:fixed, so coordinates are relative to the viewport - NOTE: the PARENT calls this as well, on window resize. we would have wanted to use the repositioner, - but need to ensure that all other components have updated size first (for alignmentEl) - */ - Popover.prototype.updateSize = function () { - var _a = this.props, alignmentEl = _a.alignmentEl, topAlignmentEl = _a.topAlignmentEl; - var rootEl = this.rootEl; - if (!rootEl) { - return; // not sure why this was null, but we shouldn't let external components call updateSize() anyway - } - var dims = rootEl.getBoundingClientRect(); // only used for width,height - var alignment = alignmentEl.getBoundingClientRect(); - var top = topAlignmentEl ? topAlignmentEl.getBoundingClientRect().top : alignment.top; - top = Math.min(top, window.innerHeight - dims.height - PADDING_FROM_VIEWPORT); - top = Math.max(top, PADDING_FROM_VIEWPORT); - var left; - if (this.context.isRtl) { - left = alignment.right - dims.width; - } - else { - left = alignment.left; - } - left = Math.min(left, window.innerWidth - dims.width - PADDING_FROM_VIEWPORT); - left = Math.max(left, PADDING_FROM_VIEWPORT); - applyStyle(rootEl, { top: top, left: left }); - }; - return Popover; - }(BaseComponent)); - - var MorePopover = /** @class */ (function (_super) { - __extends(MorePopover, _super); - function MorePopover() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.rootElRef = createRef(); - return _this; - } - MorePopover.prototype.render = function () { - var _a = this.context, options = _a.options, dateEnv = _a.dateEnv; - var props = this.props; - var date = props.date, hiddenInstances = props.hiddenInstances, todayRange = props.todayRange, dateProfile = props.dateProfile, selectedInstanceId = props.selectedInstanceId; - var title = dateEnv.format(date, options.dayPopoverFormat); - return (createElement(DayCellRoot, { date: date, dateProfile: dateProfile, todayRange: todayRange, elRef: this.rootElRef }, function (rootElRef, dayClassNames, dataAttrs) { return (createElement(Popover, { elRef: rootElRef, title: title, extraClassNames: ['fc-more-popover'].concat(dayClassNames), extraAttrs: dataAttrs, onClose: props.onCloseClick, alignmentEl: props.alignmentEl, topAlignmentEl: props.topAlignmentEl }, - createElement(DayCellContent, { date: date, dateProfile: dateProfile, todayRange: todayRange }, function (innerElRef, innerContent) { return (innerContent && - createElement("div", { className: "fc-more-popover-misc", ref: innerElRef }, innerContent)); }), - props.segs.map(function (seg) { - var instanceId = seg.eventRange.instance.instanceId; - return (createElement("div", { className: "fc-daygrid-event-harness", key: instanceId, style: { - visibility: hiddenInstances[instanceId] ? 'hidden' : '', - } }, hasListItemDisplay(seg) ? (createElement(TableListItemEvent, __assign({ seg: seg, isDragging: false, isSelected: instanceId === selectedInstanceId, defaultDisplayEventEnd: false }, getSegMeta(seg, todayRange)))) : (createElement(TableBlockEvent, __assign({ seg: seg, isDragging: false, isResizing: false, isDateSelecting: false, isSelected: instanceId === selectedInstanceId, defaultDisplayEventEnd: false }, getSegMeta(seg, todayRange)))))); - }))); })); - }; - MorePopover.prototype.positionToHit = function (positionLeft, positionTop, originEl) { - var rootEl = this.rootElRef.current; - if (!originEl || !rootEl) { // why? - return null; - } - var originRect = originEl.getBoundingClientRect(); - var elRect = rootEl.getBoundingClientRect(); - var newOriginLeft = elRect.left - originRect.left; - var newOriginTop = elRect.top - originRect.top; - var localLeft = positionLeft - newOriginLeft; - var localTop = positionTop - newOriginTop; - var date = this.props.date; - if ( // ugly way to detect intersection - localLeft >= 0 && localLeft < elRect.width && - localTop >= 0 && localTop < elRect.height) { - return { - dateSpan: { - allDay: true, - range: { start: date, end: addDays(date, 1) }, - }, - dayEl: rootEl, - relativeRect: { - left: newOriginLeft, - top: newOriginTop, - right: elRect.width, - bottom: elRect.height, - }, - layer: 1, - }; - } - return null; - }; - return MorePopover; - }(DateComponent)); - - var Table = /** @class */ (function (_super) { - __extends(Table, _super); - function Table() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.splitBusinessHourSegs = memoize(splitSegsByRow); - _this.splitBgEventSegs = memoize(splitSegsByRow); - _this.splitFgEventSegs = memoize(splitSegsByRow); - _this.splitDateSelectionSegs = memoize(splitSegsByRow); - _this.splitEventDrag = memoize(splitInteractionByRow); - _this.splitEventResize = memoize(splitInteractionByRow); - _this.buildBuildMoreLinkText = memoize(buildBuildMoreLinkText); - _this.morePopoverRef = createRef(); - _this.rowRefs = new RefMap(); - _this.state = { - morePopoverState: null, - }; - _this.handleRootEl = function (rootEl) { - _this.rootEl = rootEl; - setRef(_this.props.elRef, rootEl); - }; - // TODO: bad names "more link click" versus "more click" - _this.handleMoreLinkClick = function (arg) { - var context = _this.context; - var dateEnv = context.dateEnv; - var clickOption = context.options.moreLinkClick; - function segForPublic(seg) { - var _a = seg.eventRange, def = _a.def, instance = _a.instance, range = _a.range; - return { - event: new EventApi(context, def, instance), - start: dateEnv.toDate(range.start), - end: dateEnv.toDate(range.end), - isStart: seg.isStart, - isEnd: seg.isEnd, - }; - } - if (typeof clickOption === 'function') { - clickOption = clickOption({ - date: dateEnv.toDate(arg.date), - allDay: true, - allSegs: arg.allSegs.map(segForPublic), - hiddenSegs: arg.hiddenSegs.map(segForPublic), - jsEvent: arg.ev, - view: context.viewApi, - }); // hack to handle void - } - if (!clickOption || clickOption === 'popover') { - _this.setState({ - morePopoverState: __assign(__assign({}, arg), { currentFgEventSegs: _this.props.fgEventSegs, fromRow: arg.fromRow, fromCol: arg.fromCol }), - }); - } - else if (typeof clickOption === 'string') { // a view name - context.calendarApi.zoomTo(arg.date, clickOption); - } - }; - _this.handleMorePopoverClose = function () { - _this.setState({ - morePopoverState: null, - }); - }; - return _this; - } - Table.prototype.render = function () { - var _this = this; - var props = this.props; - var dateProfile = props.dateProfile, dayMaxEventRows = props.dayMaxEventRows, dayMaxEvents = props.dayMaxEvents, expandRows = props.expandRows; - var morePopoverState = this.state.morePopoverState; - var rowCnt = props.cells.length; - var businessHourSegsByRow = this.splitBusinessHourSegs(props.businessHourSegs, rowCnt); - var bgEventSegsByRow = this.splitBgEventSegs(props.bgEventSegs, rowCnt); - var fgEventSegsByRow = this.splitFgEventSegs(props.fgEventSegs, rowCnt); - var dateSelectionSegsByRow = this.splitDateSelectionSegs(props.dateSelectionSegs, rowCnt); - var eventDragByRow = this.splitEventDrag(props.eventDrag, rowCnt); - var eventResizeByRow = this.splitEventResize(props.eventResize, rowCnt); - var buildMoreLinkText = this.buildBuildMoreLinkText(this.context.options.moreLinkText); - var limitViaBalanced = dayMaxEvents === true || dayMaxEventRows === true; - // if rows can't expand to fill fixed height, can't do balanced-height event limit - // TODO: best place to normalize these options? - if (limitViaBalanced && !expandRows) { - limitViaBalanced = false; - dayMaxEventRows = null; - dayMaxEvents = null; - } - var classNames = [ - 'fc-daygrid-body', - limitViaBalanced ? 'fc-daygrid-body-balanced' : 'fc-daygrid-body-unbalanced', - expandRows ? '' : 'fc-daygrid-body-natural', - ]; - return (createElement("div", { className: classNames.join(' '), ref: this.handleRootEl, style: { - // these props are important to give this wrapper correct dimensions for interactions - // TODO: if we set it here, can we avoid giving to inner tables? - width: props.clientWidth, - minWidth: props.tableMinWidth, - } }, - createElement(NowTimer, { unit: "day" }, function (nowDate, todayRange) { return (createElement(Fragment, null, - createElement("table", { className: "fc-scrollgrid-sync-table", style: { - width: props.clientWidth, - minWidth: props.tableMinWidth, - height: expandRows ? props.clientHeight : '', - } }, - props.colGroupNode, - createElement("tbody", null, props.cells.map(function (cells, row) { return (createElement(TableRow, { ref: _this.rowRefs.createRef(row), key: cells.length - ? cells[0].date.toISOString() /* best? or put key on cell? or use diff formatter? */ - : row // in case there are no cells (like when resource view is loading) - , showDayNumbers: rowCnt > 1, showWeekNumbers: props.showWeekNumbers, todayRange: todayRange, dateProfile: dateProfile, cells: cells, renderIntro: props.renderRowIntro, businessHourSegs: businessHourSegsByRow[row], eventSelection: props.eventSelection, bgEventSegs: bgEventSegsByRow[row].filter(isSegAllDay) /* hack */, fgEventSegs: fgEventSegsByRow[row], dateSelectionSegs: dateSelectionSegsByRow[row], eventDrag: eventDragByRow[row], eventResize: eventResizeByRow[row], dayMaxEvents: dayMaxEvents, dayMaxEventRows: dayMaxEventRows, clientWidth: props.clientWidth, clientHeight: props.clientHeight, buildMoreLinkText: buildMoreLinkText, onMoreClick: function (arg) { - _this.handleMoreLinkClick(__assign(__assign({}, arg), { fromRow: row })); - } })); }))), - (!props.forPrint && morePopoverState && morePopoverState.currentFgEventSegs === props.fgEventSegs) && (createElement(MorePopover, { ref: _this.morePopoverRef, date: morePopoverState.date, dateProfile: dateProfile, segs: morePopoverState.allSegs, alignmentEl: morePopoverState.dayEl, topAlignmentEl: rowCnt === 1 ? props.headerAlignElRef.current : null, onCloseClick: _this.handleMorePopoverClose, selectedInstanceId: props.eventSelection, hiddenInstances: // yuck - (props.eventDrag ? props.eventDrag.affectedInstances : null) || - (props.eventResize ? props.eventResize.affectedInstances : null) || - {}, todayRange: todayRange })))); }))); - }; - // Hit System - // ---------------------------------------------------------------------------------------------------- - Table.prototype.prepareHits = function () { - this.rowPositions = new PositionCache(this.rootEl, this.rowRefs.collect().map(function (rowObj) { return rowObj.getCellEls()[0]; }), // first cell el in each row. TODO: not optimal - false, true); - this.colPositions = new PositionCache(this.rootEl, this.rowRefs.currentMap[0].getCellEls(), // cell els in first row - true, // horizontal - false); - }; - Table.prototype.positionToHit = function (leftPosition, topPosition) { - var morePopover = this.morePopoverRef.current; - var morePopoverHit = morePopover ? morePopover.positionToHit(leftPosition, topPosition, this.rootEl) : null; - var morePopoverState = this.state.morePopoverState; - if (morePopoverHit) { - return __assign({ row: morePopoverState.fromRow, col: morePopoverState.fromCol }, morePopoverHit); - } - var _a = this, colPositions = _a.colPositions, rowPositions = _a.rowPositions; - var col = colPositions.leftToIndex(leftPosition); - var row = rowPositions.topToIndex(topPosition); - if (row != null && col != null) { - return { - row: row, - col: col, - dateSpan: { - range: this.getCellRange(row, col), - allDay: true, - }, - dayEl: this.getCellEl(row, col), - relativeRect: { - left: colPositions.lefts[col], - right: colPositions.rights[col], - top: rowPositions.tops[row], - bottom: rowPositions.bottoms[row], - }, - }; - } - return null; - }; - Table.prototype.getCellEl = function (row, col) { - return this.rowRefs.currentMap[row].getCellEls()[col]; // TODO: not optimal - }; - Table.prototype.getCellRange = function (row, col) { - var start = this.props.cells[row][col].date; - var end = addDays(start, 1); - return { start: start, end: end }; - }; - return Table; - }(DateComponent)); - function buildBuildMoreLinkText(moreLinkTextInput) { - if (typeof moreLinkTextInput === 'function') { - return moreLinkTextInput; - } - return function (num) { return "+" + num + " " + moreLinkTextInput; }; - } - function isSegAllDay(seg) { - return seg.eventRange.def.allDay; - } - - var DayTableSlicer = /** @class */ (function (_super) { - __extends(DayTableSlicer, _super); - function DayTableSlicer() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.forceDayIfListItem = true; - return _this; - } - DayTableSlicer.prototype.sliceRange = function (dateRange, dayTableModel) { - return dayTableModel.sliceRange(dateRange); - }; - return DayTableSlicer; - }(Slicer)); - - var DayTable = /** @class */ (function (_super) { - __extends(DayTable, _super); - function DayTable() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.slicer = new DayTableSlicer(); - _this.tableRef = createRef(); - _this.handleRootEl = function (rootEl) { - if (rootEl) { - _this.context.registerInteractiveComponent(_this, { el: rootEl }); - } - else { - _this.context.unregisterInteractiveComponent(_this); - } - }; - return _this; - } - DayTable.prototype.render = function () { - var _a = this, props = _a.props, context = _a.context; - return (createElement(Table, __assign({ ref: this.tableRef, elRef: this.handleRootEl }, this.slicer.sliceProps(props, props.dateProfile, props.nextDayThreshold, context, props.dayTableModel), { dateProfile: props.dateProfile, cells: props.dayTableModel.cells, colGroupNode: props.colGroupNode, tableMinWidth: props.tableMinWidth, renderRowIntro: props.renderRowIntro, dayMaxEvents: props.dayMaxEvents, dayMaxEventRows: props.dayMaxEventRows, showWeekNumbers: props.showWeekNumbers, expandRows: props.expandRows, headerAlignElRef: props.headerAlignElRef, clientWidth: props.clientWidth, clientHeight: props.clientHeight, forPrint: props.forPrint }))); - }; - DayTable.prototype.prepareHits = function () { - this.tableRef.current.prepareHits(); - }; - DayTable.prototype.queryHit = function (positionLeft, positionTop) { - var rawHit = this.tableRef.current.positionToHit(positionLeft, positionTop); - if (rawHit) { - return { - component: this, - dateSpan: rawHit.dateSpan, - dayEl: rawHit.dayEl, - rect: { - left: rawHit.relativeRect.left, - right: rawHit.relativeRect.right, - top: rawHit.relativeRect.top, - bottom: rawHit.relativeRect.bottom, - }, - layer: 0, - }; - } - return null; - }; - return DayTable; - }(DateComponent)); - - var DayTableView = /** @class */ (function (_super) { - __extends(DayTableView, _super); - function DayTableView() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.buildDayTableModel = memoize(buildDayTableModel); - _this.headerRef = createRef(); - _this.tableRef = createRef(); - return _this; - } - DayTableView.prototype.render = function () { - var _this = this; - var _a = this.context, options = _a.options, dateProfileGenerator = _a.dateProfileGenerator; - var props = this.props; - var dayTableModel = this.buildDayTableModel(props.dateProfile, dateProfileGenerator); - var headerContent = options.dayHeaders && (createElement(DayHeader, { ref: this.headerRef, dateProfile: props.dateProfile, dates: dayTableModel.headerDates, datesRepDistinctDays: dayTableModel.rowCnt === 1 })); - var bodyContent = function (contentArg) { return (createElement(DayTable, { ref: _this.tableRef, dateProfile: props.dateProfile, dayTableModel: dayTableModel, businessHours: props.businessHours, dateSelection: props.dateSelection, eventStore: props.eventStore, eventUiBases: props.eventUiBases, eventSelection: props.eventSelection, eventDrag: props.eventDrag, eventResize: props.eventResize, nextDayThreshold: options.nextDayThreshold, colGroupNode: contentArg.tableColGroupNode, tableMinWidth: contentArg.tableMinWidth, dayMaxEvents: options.dayMaxEvents, dayMaxEventRows: options.dayMaxEventRows, showWeekNumbers: options.weekNumbers, expandRows: !props.isHeightAuto, headerAlignElRef: _this.headerElRef, clientWidth: contentArg.clientWidth, clientHeight: contentArg.clientHeight, forPrint: props.forPrint })); }; - return options.dayMinWidth - ? this.renderHScrollLayout(headerContent, bodyContent, dayTableModel.colCnt, options.dayMinWidth) - : this.renderSimpleLayout(headerContent, bodyContent); - }; - return DayTableView; - }(TableView)); - function buildDayTableModel(dateProfile, dateProfileGenerator) { - var daySeries = new DaySeriesModel(dateProfile.renderRange, dateProfileGenerator); - return new DayTableModel(daySeries, /year|month|week/.test(dateProfile.currentRangeUnit)); - } - - var TableDateProfileGenerator = /** @class */ (function (_super) { - __extends(TableDateProfileGenerator, _super); - function TableDateProfileGenerator() { - return _super !== null && _super.apply(this, arguments) || this; - } - // Computes the date range that will be rendered. - TableDateProfileGenerator.prototype.buildRenderRange = function (currentRange, currentRangeUnit, isRangeAllDay) { - var dateEnv = this.props.dateEnv; - var renderRange = _super.prototype.buildRenderRange.call(this, currentRange, currentRangeUnit, isRangeAllDay); - var start = renderRange.start; - var end = renderRange.end; - var endOfWeek; - // year and month views should be aligned with weeks. this is already done for week - if (/^(year|month)$/.test(currentRangeUnit)) { - start = dateEnv.startOfWeek(start); - // make end-of-week if not already - endOfWeek = dateEnv.startOfWeek(end); - if (endOfWeek.valueOf() !== end.valueOf()) { - end = addWeeks(endOfWeek, 1); - } - } - // ensure 6 weeks - if (this.props.monthMode && - this.props.fixedWeekCount) { - var rowCnt = Math.ceil(// could be partial weeks due to hiddenDays - diffWeeks(start, end)); - end = addWeeks(end, 6 - rowCnt); - } - return { start: start, end: end }; - }; - return TableDateProfileGenerator; - }(DateProfileGenerator)); - - var OPTION_REFINERS$1 = { - moreLinkClick: identity, - moreLinkClassNames: identity, - moreLinkContent: identity, - moreLinkDidMount: identity, - moreLinkWillUnmount: identity, - }; - - var dayGridPlugin = createPlugin({ - initialView: 'dayGridMonth', - optionRefiners: OPTION_REFINERS$1, - views: { - dayGrid: { - component: DayTableView, - dateProfileGeneratorClass: TableDateProfileGenerator, - }, - dayGridDay: { - type: 'dayGrid', - duration: { days: 1 }, - }, - dayGridWeek: { - type: 'dayGrid', - duration: { weeks: 1 }, - }, - dayGridMonth: { - type: 'dayGrid', - duration: { months: 1 }, - monthMode: true, - fixedWeekCount: true, - }, - }, - }); - - var AllDaySplitter = /** @class */ (function (_super) { - __extends(AllDaySplitter, _super); - function AllDaySplitter() { - return _super !== null && _super.apply(this, arguments) || this; - } - AllDaySplitter.prototype.getKeyInfo = function () { - return { - allDay: {}, - timed: {}, - }; - }; - AllDaySplitter.prototype.getKeysForDateSpan = function (dateSpan) { - if (dateSpan.allDay) { - return ['allDay']; - } - return ['timed']; - }; - AllDaySplitter.prototype.getKeysForEventDef = function (eventDef) { - if (!eventDef.allDay) { - return ['timed']; - } - if (hasBgRendering(eventDef)) { - return ['timed', 'allDay']; - } - return ['allDay']; - }; - return AllDaySplitter; - }(Splitter)); - - var DEFAULT_SLAT_LABEL_FORMAT = createFormatter({ - hour: 'numeric', - minute: '2-digit', - omitZeroMinute: true, - meridiem: 'short', - }); - function TimeColsAxisCell(props) { - var classNames = [ - 'fc-timegrid-slot', - 'fc-timegrid-slot-label', - props.isLabeled ? 'fc-scrollgrid-shrink' : 'fc-timegrid-slot-minor', - ]; - return (createElement(ViewContextType.Consumer, null, function (context) { - if (!props.isLabeled) { - return (createElement("td", { className: classNames.join(' '), "data-time": props.isoTimeStr })); - } - var dateEnv = context.dateEnv, options = context.options, viewApi = context.viewApi; - var labelFormat = // TODO: fully pre-parse - options.slotLabelFormat == null ? DEFAULT_SLAT_LABEL_FORMAT : - Array.isArray(options.slotLabelFormat) ? createFormatter(options.slotLabelFormat[0]) : - createFormatter(options.slotLabelFormat); - var hookProps = { - level: 0, - time: props.time, - date: dateEnv.toDate(props.date), - view: viewApi, - text: dateEnv.format(props.date, labelFormat), - }; - return (createElement(RenderHook, { hookProps: hookProps, classNames: options.slotLabelClassNames, content: options.slotLabelContent, defaultContent: renderInnerContent$3, didMount: options.slotLabelDidMount, willUnmount: options.slotLabelWillUnmount }, function (rootElRef, customClassNames, innerElRef, innerContent) { return (createElement("td", { ref: rootElRef, className: classNames.concat(customClassNames).join(' '), "data-time": props.isoTimeStr }, - createElement("div", { className: "fc-timegrid-slot-label-frame fc-scrollgrid-shrink-frame" }, - createElement("div", { className: "fc-timegrid-slot-label-cushion fc-scrollgrid-shrink-cushion", ref: innerElRef }, innerContent)))); })); - })); - } - function renderInnerContent$3(props) { - return props.text; - } - - var TimeBodyAxis = /** @class */ (function (_super) { - __extends(TimeBodyAxis, _super); - function TimeBodyAxis() { - return _super !== null && _super.apply(this, arguments) || this; - } - TimeBodyAxis.prototype.render = function () { - return this.props.slatMetas.map(function (slatMeta) { return (createElement("tr", { key: slatMeta.key }, - createElement(TimeColsAxisCell, __assign({}, slatMeta)))); }); - }; - return TimeBodyAxis; - }(BaseComponent)); - - var DEFAULT_WEEK_NUM_FORMAT$1 = createFormatter({ week: 'short' }); - var AUTO_ALL_DAY_MAX_EVENT_ROWS = 5; - var TimeColsView = /** @class */ (function (_super) { - __extends(TimeColsView, _super); - function TimeColsView() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.allDaySplitter = new AllDaySplitter(); // for use by subclasses - _this.headerElRef = createRef(); - _this.rootElRef = createRef(); - _this.scrollerElRef = createRef(); - _this.state = { - slatCoords: null, - }; - _this.handleScrollTopRequest = function (scrollTop) { - var scrollerEl = _this.scrollerElRef.current; - if (scrollerEl) { // TODO: not sure how this could ever be null. weirdness with the reducer - scrollerEl.scrollTop = scrollTop; - } - }; - /* Header Render Methods - ------------------------------------------------------------------------------------------------------------------*/ - _this.renderHeadAxis = function (rowKey, frameHeight) { - if (frameHeight === void 0) { frameHeight = ''; } - var options = _this.context.options; - var dateProfile = _this.props.dateProfile; - var range = dateProfile.renderRange; - var dayCnt = diffDays(range.start, range.end); - var navLinkAttrs = (options.navLinks && dayCnt === 1) // only do in day views (to avoid doing in week views that dont need it) - ? { 'data-navlink': buildNavLinkData(range.start, 'week'), tabIndex: 0 } - : {}; - if (options.weekNumbers && rowKey === 'day') { - return (createElement(WeekNumberRoot, { date: range.start, defaultFormat: DEFAULT_WEEK_NUM_FORMAT$1 }, function (rootElRef, classNames, innerElRef, innerContent) { return (createElement("th", { ref: rootElRef, className: [ - 'fc-timegrid-axis', - 'fc-scrollgrid-shrink', - ].concat(classNames).join(' ') }, - createElement("div", { className: "fc-timegrid-axis-frame fc-scrollgrid-shrink-frame fc-timegrid-axis-frame-liquid", style: { height: frameHeight } }, - createElement("a", __assign({ ref: innerElRef, className: "fc-timegrid-axis-cushion fc-scrollgrid-shrink-cushion fc-scrollgrid-sync-inner" }, navLinkAttrs), innerContent)))); })); - } - return (createElement("th", { className: "fc-timegrid-axis" }, - createElement("div", { className: "fc-timegrid-axis-frame", style: { height: frameHeight } }))); - }; - /* Table Component Render Methods - ------------------------------------------------------------------------------------------------------------------*/ - // only a one-way height sync. we don't send the axis inner-content height to the DayGrid, - // but DayGrid still needs to have classNames on inner elements in order to measure. - _this.renderTableRowAxis = function (rowHeight) { - var _a = _this.context, options = _a.options, viewApi = _a.viewApi; - var hookProps = { - text: options.allDayText, - view: viewApi, - }; - return ( - // TODO: make reusable hook. used in list view too - createElement(RenderHook, { hookProps: hookProps, classNames: options.allDayClassNames, content: options.allDayContent, defaultContent: renderAllDayInner, didMount: options.allDayDidMount, willUnmount: options.allDayWillUnmount }, function (rootElRef, classNames, innerElRef, innerContent) { return (createElement("td", { ref: rootElRef, className: [ - 'fc-timegrid-axis', - 'fc-scrollgrid-shrink', - ].concat(classNames).join(' ') }, - createElement("div", { className: 'fc-timegrid-axis-frame fc-scrollgrid-shrink-frame' + (rowHeight == null ? ' fc-timegrid-axis-frame-liquid' : ''), style: { height: rowHeight } }, - createElement("span", { className: "fc-timegrid-axis-cushion fc-scrollgrid-shrink-cushion fc-scrollgrid-sync-inner", ref: innerElRef }, innerContent)))); })); - }; - _this.handleSlatCoords = function (slatCoords) { - _this.setState({ slatCoords: slatCoords }); - }; - return _this; - } - // rendering - // ---------------------------------------------------------------------------------------------------- - TimeColsView.prototype.renderSimpleLayout = function (headerRowContent, allDayContent, timeContent) { - var _a = this, context = _a.context, props = _a.props; - var sections = []; - var stickyHeaderDates = getStickyHeaderDates(context.options); - if (headerRowContent) { - sections.push({ - type: 'header', - key: 'header', - isSticky: stickyHeaderDates, - chunk: { - elRef: this.headerElRef, - tableClassName: 'fc-col-header', - rowContent: headerRowContent, - }, - }); - } - if (allDayContent) { - sections.push({ - type: 'body', - key: 'all-day', - chunk: { content: allDayContent }, - }); - sections.push({ - type: 'body', - key: 'all-day-divider', - outerContent: ( // TODO: rename to cellContent so don't need to define <tr>? - createElement("tr", { className: "fc-scrollgrid-section" }, - createElement("td", { className: 'fc-timegrid-divider ' + context.theme.getClass('tableCellShaded') }))), - }); - } - sections.push({ - type: 'body', - key: 'body', - liquid: true, - expandRows: Boolean(context.options.expandRows), - chunk: { - scrollerElRef: this.scrollerElRef, - content: timeContent, - }, - }); - return (createElement(ViewRoot, { viewSpec: context.viewSpec, elRef: this.rootElRef }, function (rootElRef, classNames) { return (createElement("div", { className: ['fc-timegrid'].concat(classNames).join(' '), ref: rootElRef }, - createElement(SimpleScrollGrid, { liquid: !props.isHeightAuto && !props.forPrint, cols: [{ width: 'shrink' }], sections: sections }))); })); - }; - TimeColsView.prototype.renderHScrollLayout = function (headerRowContent, allDayContent, timeContent, colCnt, dayMinWidth, slatMetas, slatCoords) { - var _this = this; - var ScrollGrid = this.context.pluginHooks.scrollGridImpl; - if (!ScrollGrid) { - throw new Error('No ScrollGrid implementation'); - } - var _a = this, context = _a.context, props = _a.props; - var stickyHeaderDates = !props.forPrint && getStickyHeaderDates(context.options); - var stickyFooterScrollbar = !props.forPrint && getStickyFooterScrollbar(context.options); - var sections = []; - if (headerRowContent) { - sections.push({ - type: 'header', - key: 'header', - isSticky: stickyHeaderDates, - syncRowHeights: true, - chunks: [ - { - key: 'axis', - rowContent: function (arg) { return (createElement("tr", null, _this.renderHeadAxis('day', arg.rowSyncHeights[0]))); }, - }, - { - key: 'cols', - elRef: this.headerElRef, - tableClassName: 'fc-col-header', - rowContent: headerRowContent, - }, - ], - }); - } - if (allDayContent) { - sections.push({ - type: 'body', - key: 'all-day', - syncRowHeights: true, - chunks: [ - { - key: 'axis', - rowContent: function (contentArg) { return (createElement("tr", null, _this.renderTableRowAxis(contentArg.rowSyncHeights[0]))); }, - }, - { - key: 'cols', - content: allDayContent, - }, - ], - }); - sections.push({ - key: 'all-day-divider', - type: 'body', - outerContent: ( // TODO: rename to cellContent so don't need to define <tr>? - createElement("tr", { className: "fc-scrollgrid-section" }, - createElement("td", { colSpan: 2, className: 'fc-timegrid-divider ' + context.theme.getClass('tableCellShaded') }))), - }); - } - var isNowIndicator = context.options.nowIndicator; - sections.push({ - type: 'body', - key: 'body', - liquid: true, - expandRows: Boolean(context.options.expandRows), - chunks: [ - { - key: 'axis', - content: function (arg) { return ( - // TODO: make this now-indicator arrow more DRY with TimeColsContent - createElement("div", { className: "fc-timegrid-axis-chunk" }, - createElement("table", { style: { height: arg.expandRows ? arg.clientHeight : '' } }, - arg.tableColGroupNode, - createElement("tbody", null, - createElement(TimeBodyAxis, { slatMetas: slatMetas }))), - createElement("div", { className: "fc-timegrid-now-indicator-container" }, - createElement(NowTimer, { unit: isNowIndicator ? 'minute' : 'day' /* hacky */ }, function (nowDate) { - var nowIndicatorTop = isNowIndicator && - slatCoords && - slatCoords.safeComputeTop(nowDate); // might return void - if (typeof nowIndicatorTop === 'number') { - return (createElement(NowIndicatorRoot, { isAxis: true, date: nowDate }, function (rootElRef, classNames, innerElRef, innerContent) { return (createElement("div", { ref: rootElRef, className: ['fc-timegrid-now-indicator-arrow'].concat(classNames).join(' '), style: { top: nowIndicatorTop } }, innerContent)); })); - } - return null; - })))); }, - }, - { - key: 'cols', - scrollerElRef: this.scrollerElRef, - content: timeContent, - }, - ], - }); - if (stickyFooterScrollbar) { - sections.push({ - key: 'footer', - type: 'footer', - isSticky: true, - chunks: [ - { - key: 'axis', - content: renderScrollShim, - }, - { - key: 'cols', - content: renderScrollShim, - }, - ], - }); - } - return (createElement(ViewRoot, { viewSpec: context.viewSpec, elRef: this.rootElRef }, function (rootElRef, classNames) { return (createElement("div", { className: ['fc-timegrid'].concat(classNames).join(' '), ref: rootElRef }, - createElement(ScrollGrid, { liquid: !props.isHeightAuto && !props.forPrint, colGroups: [ - { width: 'shrink', cols: [{ width: 'shrink' }] }, - { cols: [{ span: colCnt, minWidth: dayMinWidth }] }, - ], sections: sections }))); })); - }; - /* Dimensions - ------------------------------------------------------------------------------------------------------------------*/ - TimeColsView.prototype.getAllDayMaxEventProps = function () { - var _a = this.context.options, dayMaxEvents = _a.dayMaxEvents, dayMaxEventRows = _a.dayMaxEventRows; - if (dayMaxEvents === true || dayMaxEventRows === true) { // is auto? - dayMaxEvents = undefined; - dayMaxEventRows = AUTO_ALL_DAY_MAX_EVENT_ROWS; // make sure "auto" goes to a real number - } - return { dayMaxEvents: dayMaxEvents, dayMaxEventRows: dayMaxEventRows }; - }; - return TimeColsView; - }(DateComponent)); - function renderAllDayInner(hookProps) { - return hookProps.text; - } - - var TimeColsSlatsCoords = /** @class */ (function () { - function TimeColsSlatsCoords(positions, dateProfile, slotDuration) { - this.positions = positions; - this.dateProfile = dateProfile; - this.slotDuration = slotDuration; - } - TimeColsSlatsCoords.prototype.safeComputeTop = function (date) { - var dateProfile = this.dateProfile; - if (rangeContainsMarker(dateProfile.currentRange, date)) { - var startOfDayDate = startOfDay(date); - var timeMs = date.valueOf() - startOfDayDate.valueOf(); - if (timeMs >= asRoughMs(dateProfile.slotMinTime) && - timeMs < asRoughMs(dateProfile.slotMaxTime)) { - return this.computeTimeTop(createDuration(timeMs)); - } - } - return null; - }; - // Computes the top coordinate, relative to the bounds of the grid, of the given date. - // A `startOfDayDate` must be given for avoiding ambiguity over how to treat midnight. - TimeColsSlatsCoords.prototype.computeDateTop = function (when, startOfDayDate) { - if (!startOfDayDate) { - startOfDayDate = startOfDay(when); - } - return this.computeTimeTop(createDuration(when.valueOf() - startOfDayDate.valueOf())); - }; - // Computes the top coordinate, relative to the bounds of the grid, of the given time (a Duration). - // This is a makeshify way to compute the time-top. Assumes all slatMetas dates are uniform. - // Eventually allow computation with arbirary slat dates. - TimeColsSlatsCoords.prototype.computeTimeTop = function (duration) { - var _a = this, positions = _a.positions, dateProfile = _a.dateProfile; - var len = positions.els.length; - // floating-point value of # of slots covered - var slatCoverage = (duration.milliseconds - asRoughMs(dateProfile.slotMinTime)) / asRoughMs(this.slotDuration); - var slatIndex; - var slatRemainder; - // compute a floating-point number for how many slats should be progressed through. - // from 0 to number of slats (inclusive) - // constrained because slotMinTime/slotMaxTime might be customized. - slatCoverage = Math.max(0, slatCoverage); - slatCoverage = Math.min(len, slatCoverage); - // an integer index of the furthest whole slat - // from 0 to number slats (*exclusive*, so len-1) - slatIndex = Math.floor(slatCoverage); - slatIndex = Math.min(slatIndex, len - 1); - // how much further through the slatIndex slat (from 0.0-1.0) must be covered in addition. - // could be 1.0 if slatCoverage is covering *all* the slots - slatRemainder = slatCoverage - slatIndex; - return positions.tops[slatIndex] + - positions.getHeight(slatIndex) * slatRemainder; - }; - return TimeColsSlatsCoords; - }()); - - var TimeColsSlatsBody = /** @class */ (function (_super) { - __extends(TimeColsSlatsBody, _super); - function TimeColsSlatsBody() { - return _super !== null && _super.apply(this, arguments) || this; - } - TimeColsSlatsBody.prototype.render = function () { - var _a = this, props = _a.props, context = _a.context; - var options = context.options; - var slatElRefs = props.slatElRefs; - return (createElement("tbody", null, props.slatMetas.map(function (slatMeta, i) { - var hookProps = { - time: slatMeta.time, - date: context.dateEnv.toDate(slatMeta.date), - view: context.viewApi, - }; - var classNames = [ - 'fc-timegrid-slot', - 'fc-timegrid-slot-lane', - slatMeta.isLabeled ? '' : 'fc-timegrid-slot-minor', - ]; - return (createElement("tr", { key: slatMeta.key, ref: slatElRefs.createRef(slatMeta.key) }, - props.axis && (createElement(TimeColsAxisCell, __assign({}, slatMeta))), - createElement(RenderHook, { hookProps: hookProps, classNames: options.slotLaneClassNames, content: options.slotLaneContent, didMount: options.slotLaneDidMount, willUnmount: options.slotLaneWillUnmount }, function (rootElRef, customClassNames, innerElRef, innerContent) { return (createElement("td", { ref: rootElRef, className: classNames.concat(customClassNames).join(' '), "data-time": slatMeta.isoTimeStr }, innerContent)); }))); - }))); - }; - return TimeColsSlatsBody; - }(BaseComponent)); - - /* - for the horizontal "slats" that run width-wise. Has a time axis on a side. Depends on RTL. - */ - var TimeColsSlats = /** @class */ (function (_super) { - __extends(TimeColsSlats, _super); - function TimeColsSlats() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.rootElRef = createRef(); - _this.slatElRefs = new RefMap(); - return _this; - } - TimeColsSlats.prototype.render = function () { - var _a = this, props = _a.props, context = _a.context; - return (createElement("div", { className: "fc-timegrid-slots", ref: this.rootElRef }, - createElement("table", { className: context.theme.getClass('table'), style: { - minWidth: props.tableMinWidth, - width: props.clientWidth, - height: props.minHeight, - } }, - props.tableColGroupNode /* relies on there only being a single <col> for the axis */, - createElement(TimeColsSlatsBody, { slatElRefs: this.slatElRefs, axis: props.axis, slatMetas: props.slatMetas })))); - }; - TimeColsSlats.prototype.componentDidMount = function () { - this.updateSizing(); - }; - TimeColsSlats.prototype.componentDidUpdate = function () { - this.updateSizing(); - }; - TimeColsSlats.prototype.componentWillUnmount = function () { - if (this.props.onCoords) { - this.props.onCoords(null); - } - }; - TimeColsSlats.prototype.updateSizing = function () { - var _a = this, context = _a.context, props = _a.props; - if (props.onCoords && - props.clientWidth !== null // means sizing has stabilized - ) { - var rootEl = this.rootElRef.current; - if (rootEl.offsetHeight) { // not hidden by css - props.onCoords(new TimeColsSlatsCoords(new PositionCache(this.rootElRef.current, collectSlatEls(this.slatElRefs.currentMap, props.slatMetas), false, true), this.props.dateProfile, context.options.slotDuration)); - } - } - }; - return TimeColsSlats; - }(BaseComponent)); - function collectSlatEls(elMap, slatMetas) { - return slatMetas.map(function (slatMeta) { return elMap[slatMeta.key]; }); - } - - function splitSegsByCol(segs, colCnt) { - var segsByCol = []; - var i; - for (i = 0; i < colCnt; i += 1) { - segsByCol.push([]); - } - if (segs) { - for (i = 0; i < segs.length; i += 1) { - segsByCol[segs[i].col].push(segs[i]); - } - } - return segsByCol; - } - function splitInteractionByCol(ui, colCnt) { - var byRow = []; - if (!ui) { - for (var i = 0; i < colCnt; i += 1) { - byRow[i] = null; - } - } - else { - for (var i = 0; i < colCnt; i += 1) { - byRow[i] = { - affectedInstances: ui.affectedInstances, - isEvent: ui.isEvent, - segs: [], - }; - } - for (var _i = 0, _a = ui.segs; _i < _a.length; _i++) { - var seg = _a[_i]; - byRow[seg.col].segs.push(seg); - } - } - return byRow; - } - - // UNFORTUNATELY, assigns results to the top/bottom/level/forwardCoord/backwardCoord props of the actual segs. - // TODO: return hash (by instanceId) of results - function computeSegCoords(segs, dayDate, slatCoords, eventMinHeight, eventOrderSpecs) { - computeSegVerticals(segs, dayDate, slatCoords, eventMinHeight); - return computeSegHorizontals(segs, eventOrderSpecs); // requires top/bottom from computeSegVerticals - } - // For each segment in an array, computes and assigns its top and bottom properties - function computeSegVerticals(segs, dayDate, slatCoords, eventMinHeight) { - for (var _i = 0, segs_1 = segs; _i < segs_1.length; _i++) { - var seg = segs_1[_i]; - seg.top = slatCoords.computeDateTop(seg.start, dayDate); - seg.bottom = Math.max(seg.top + (eventMinHeight || 0), // yuck - slatCoords.computeDateTop(seg.end, dayDate)); - } - } - // Given an array of segments that are all in the same column, sets the backwardCoord and forwardCoord on each. - // Assumed the segs are already ordered. - // NOTE: Also reorders the given array by date! - function computeSegHorizontals(segs, eventOrderSpecs) { - // IMPORTANT TO CLEAR OLD RESULTS :( - for (var _i = 0, segs_2 = segs; _i < segs_2.length; _i++) { - var seg = segs_2[_i]; - seg.level = null; - seg.forwardCoord = null; - seg.backwardCoord = null; - seg.forwardPressure = null; - } - segs = sortEventSegs(segs, eventOrderSpecs); - var level0; - var levels = buildSlotSegLevels(segs); - computeForwardSlotSegs(levels); - if ((level0 = levels[0])) { - for (var _a = 0, level0_1 = level0; _a < level0_1.length; _a++) { - var seg = level0_1[_a]; - computeSlotSegPressures(seg); - } - for (var _b = 0, level0_2 = level0; _b < level0_2.length; _b++) { - var seg = level0_2[_b]; - computeSegForwardBack(seg, 0, 0, eventOrderSpecs); - } - } - return segs; - } - // Builds an array of segments "levels". The first level will be the leftmost tier of segments if the calendar is - // left-to-right, or the rightmost if the calendar is right-to-left. Assumes the segments are already ordered by date. - function buildSlotSegLevels(segs) { - var levels = []; - var i; - var seg; - var j; - for (i = 0; i < segs.length; i += 1) { - seg = segs[i]; - // go through all the levels and stop on the first level where there are no collisions - for (j = 0; j < levels.length; j += 1) { - if (!computeSlotSegCollisions(seg, levels[j]).length) { - break; - } - } - seg.level = j; - (levels[j] || (levels[j] = [])).push(seg); - } - return levels; - } - // Find all the segments in `otherSegs` that vertically collide with `seg`. - // Append into an optionally-supplied `results` array and return. - function computeSlotSegCollisions(seg, otherSegs, results) { - if (results === void 0) { results = []; } - for (var i = 0; i < otherSegs.length; i += 1) { - if (isSlotSegCollision(seg, otherSegs[i])) { - results.push(otherSegs[i]); - } - } - return results; - } - // Do these segments occupy the same vertical space? - function isSlotSegCollision(seg1, seg2) { - return seg1.bottom > seg2.top && seg1.top < seg2.bottom; - } - // For every segment, figure out the other segments that are in subsequent - // levels that also occupy the same vertical space. Accumulate in seg.forwardSegs - function computeForwardSlotSegs(levels) { - var i; - var level; - var j; - var seg; - var k; - for (i = 0; i < levels.length; i += 1) { - level = levels[i]; - for (j = 0; j < level.length; j += 1) { - seg = level[j]; - seg.forwardSegs = []; - for (k = i + 1; k < levels.length; k += 1) { - computeSlotSegCollisions(seg, levels[k], seg.forwardSegs); - } - } - } - } - // Figure out which path forward (via seg.forwardSegs) results in the longest path until - // the furthest edge is reached. The number of segments in this path will be seg.forwardPressure - function computeSlotSegPressures(seg) { - var forwardSegs = seg.forwardSegs; - var forwardPressure = 0; - var i; - var forwardSeg; - if (seg.forwardPressure == null) { // not already computed - for (i = 0; i < forwardSegs.length; i += 1) { - forwardSeg = forwardSegs[i]; - // figure out the child's maximum forward path - computeSlotSegPressures(forwardSeg); - // either use the existing maximum, or use the child's forward pressure - // plus one (for the forwardSeg itself) - forwardPressure = Math.max(forwardPressure, 1 + forwardSeg.forwardPressure); - } - seg.forwardPressure = forwardPressure; - } - } - // Calculate seg.forwardCoord and seg.backwardCoord for the segment, where both values range - // from 0 to 1. If the calendar is left-to-right, the seg.backwardCoord maps to "left" and - // seg.forwardCoord maps to "right" (via percentage). Vice-versa if the calendar is right-to-left. - // - // The segment might be part of a "series", which means consecutive segments with the same pressure - // who's width is unknown until an edge has been hit. `seriesBackwardPressure` is the number of - // segments behind this one in the current series, and `seriesBackwardCoord` is the starting - // coordinate of the first segment in the series. - function computeSegForwardBack(seg, seriesBackwardPressure, seriesBackwardCoord, eventOrderSpecs) { - var forwardSegs = seg.forwardSegs; - var i; - if (seg.forwardCoord == null) { // not already computed - if (!forwardSegs.length) { - // if there are no forward segments, this segment should butt up against the edge - seg.forwardCoord = 1; - } - else { - // sort highest pressure first - sortForwardSegs(forwardSegs, eventOrderSpecs); - // this segment's forwardCoord will be calculated from the backwardCoord of the - // highest-pressure forward segment. - computeSegForwardBack(forwardSegs[0], seriesBackwardPressure + 1, seriesBackwardCoord, eventOrderSpecs); - seg.forwardCoord = forwardSegs[0].backwardCoord; - } - // calculate the backwardCoord from the forwardCoord. consider the series - seg.backwardCoord = seg.forwardCoord - - (seg.forwardCoord - seriesBackwardCoord) / // available width for series - (seriesBackwardPressure + 1); // # of segments in the series - // use this segment's coordinates to computed the coordinates of the less-pressurized - // forward segments - for (i = 0; i < forwardSegs.length; i += 1) { - computeSegForwardBack(forwardSegs[i], 0, seg.forwardCoord, eventOrderSpecs); - } - } - } - function sortForwardSegs(forwardSegs, eventOrderSpecs) { - var objs = forwardSegs.map(buildTimeGridSegCompareObj); - var specs = [ - // put higher-pressure first - { field: 'forwardPressure', order: -1 }, - // put segments that are closer to initial edge first (and favor ones with no coords yet) - { field: 'backwardCoord', order: 1 }, - ].concat(eventOrderSpecs); - objs.sort(function (obj0, obj1) { return compareByFieldSpecs(obj0, obj1, specs); }); - return objs.map(function (c) { return c._seg; }); - } - function buildTimeGridSegCompareObj(seg) { - var obj = buildSegCompareObj(seg); - obj.forwardPressure = seg.forwardPressure; - obj.backwardCoord = seg.backwardCoord; - return obj; - } - - var DEFAULT_TIME_FORMAT = createFormatter({ - hour: 'numeric', - minute: '2-digit', - meridiem: false, - }); - var TimeColEvent = /** @class */ (function (_super) { - __extends(TimeColEvent, _super); - function TimeColEvent() { - return _super !== null && _super.apply(this, arguments) || this; - } - TimeColEvent.prototype.render = function () { - var classNames = [ - 'fc-timegrid-event', - 'fc-v-event', - ]; - if (this.props.isCondensed) { - classNames.push('fc-timegrid-event-condensed'); - } - return (createElement(StandardEvent, __assign({}, this.props, { defaultTimeFormat: DEFAULT_TIME_FORMAT, extraClassNames: classNames }))); - }; - return TimeColEvent; - }(BaseComponent)); - - var TimeColMisc = /** @class */ (function (_super) { - __extends(TimeColMisc, _super); - function TimeColMisc() { - return _super !== null && _super.apply(this, arguments) || this; - } - TimeColMisc.prototype.render = function () { - var props = this.props; - return (createElement(DayCellContent, { date: props.date, dateProfile: props.dateProfile, todayRange: props.todayRange, extraHookProps: props.extraHookProps }, function (innerElRef, innerContent) { return (innerContent && - createElement("div", { className: "fc-timegrid-col-misc", ref: innerElRef }, innerContent)); })); - }; - return TimeColMisc; - }(BaseComponent)); - - config.timeGridEventCondensedHeight = 30; - var TimeCol = /** @class */ (function (_super) { - __extends(TimeCol, _super); - function TimeCol() { - return _super !== null && _super.apply(this, arguments) || this; - } - TimeCol.prototype.render = function () { - var _this = this; - var _a = this, props = _a.props, context = _a.context; - var isSelectMirror = context.options.selectMirror; - var mirrorSegs = (props.eventDrag && props.eventDrag.segs) || - (props.eventResize && props.eventResize.segs) || - (isSelectMirror && props.dateSelectionSegs) || - []; - var interactionAffectedInstances = // TODO: messy way to compute this - (props.eventDrag && props.eventDrag.affectedInstances) || - (props.eventResize && props.eventResize.affectedInstances) || - {}; - return (createElement(DayCellRoot, { elRef: props.elRef, date: props.date, dateProfile: props.dateProfile, todayRange: props.todayRange, extraHookProps: props.extraHookProps }, function (rootElRef, classNames, dataAttrs) { return (createElement("td", __assign({ ref: rootElRef, className: ['fc-timegrid-col'].concat(classNames, props.extraClassNames || []).join(' ') }, dataAttrs, props.extraDataAttrs), - createElement("div", { className: "fc-timegrid-col-frame" }, - createElement("div", { className: "fc-timegrid-col-bg" }, - _this.renderFillSegs(props.businessHourSegs, 'non-business'), - _this.renderFillSegs(props.bgEventSegs, 'bg-event'), - _this.renderFillSegs(props.dateSelectionSegs, 'highlight')), - createElement("div", { className: "fc-timegrid-col-events" }, _this.renderFgSegs(props.fgEventSegs, interactionAffectedInstances)), - createElement("div", { className: "fc-timegrid-col-events" }, _this.renderFgSegs(mirrorSegs, {}, Boolean(props.eventDrag), Boolean(props.eventResize), Boolean(isSelectMirror))), - createElement("div", { className: "fc-timegrid-now-indicator-container" }, _this.renderNowIndicator(props.nowIndicatorSegs)), - createElement(TimeColMisc, { date: props.date, dateProfile: props.dateProfile, todayRange: props.todayRange, extraHookProps: props.extraHookProps })))); })); - }; - TimeCol.prototype.renderFgSegs = function (segs, segIsInvisible, isDragging, isResizing, isDateSelecting) { - var props = this.props; - if (props.forPrint) { - return this.renderPrintFgSegs(segs); - } - if (props.slatCoords) { - return this.renderPositionedFgSegs(segs, segIsInvisible, isDragging, isResizing, isDateSelecting); - } - return null; - }; - TimeCol.prototype.renderPrintFgSegs = function (segs) { - var _a = this, props = _a.props, context = _a.context; - // not DRY - segs = sortEventSegs(segs, context.options.eventOrder); - return segs.map(function (seg) { return (createElement("div", { className: "fc-timegrid-event-harness", key: seg.eventRange.instance.instanceId }, - createElement(TimeColEvent, __assign({ seg: seg, isDragging: false, isResizing: false, isDateSelecting: false, isSelected: false, isCondensed: false }, getSegMeta(seg, props.todayRange, props.nowDate))))); }); - }; - TimeCol.prototype.renderPositionedFgSegs = function (segs, segIsInvisible, isDragging, isResizing, isDateSelecting) { - var _this = this; - var _a = this, context = _a.context, props = _a.props; - // assigns TO THE SEGS THEMSELVES - // also, receives resorted array - segs = computeSegCoords(segs, props.date, props.slatCoords, context.options.eventMinHeight, context.options.eventOrder); - return segs.map(function (seg) { - var instanceId = seg.eventRange.instance.instanceId; - var isMirror = isDragging || isResizing || isDateSelecting; - var positionCss = isMirror - // will span entire column width - // also, won't assign z-index, which is good, fc-event-mirror will overpower other harnesses - ? __assign({ left: 0, right: 0 }, _this.computeSegTopBottomCss(seg)) : _this.computeFgSegPositionCss(seg); - return (createElement("div", { className: 'fc-timegrid-event-harness' + (seg.level > 0 ? ' fc-timegrid-event-harness-inset' : ''), key: instanceId, style: __assign({ visibility: segIsInvisible[instanceId] ? 'hidden' : '' }, positionCss) }, - createElement(TimeColEvent, __assign({ seg: seg, isDragging: isDragging, isResizing: isResizing, isDateSelecting: isDateSelecting, isSelected: instanceId === props.eventSelection, isCondensed: (seg.bottom - seg.top) < config.timeGridEventCondensedHeight }, getSegMeta(seg, props.todayRange, props.nowDate))))); - }); - }; - TimeCol.prototype.renderFillSegs = function (segs, fillType) { - var _this = this; - var _a = this, context = _a.context, props = _a.props; - if (!props.slatCoords) { - return null; - } - // BAD: assigns TO THE SEGS THEMSELVES - computeSegVerticals(segs, props.date, props.slatCoords, context.options.eventMinHeight); - var children = segs.map(function (seg) { return (createElement("div", { key: buildEventRangeKey(seg.eventRange), className: "fc-timegrid-bg-harness", style: _this.computeSegTopBottomCss(seg) }, fillType === 'bg-event' ? - createElement(BgEvent, __assign({ seg: seg }, getSegMeta(seg, props.todayRange, props.nowDate))) : - renderFill(fillType))); }); - return createElement(Fragment, null, children); - }; - TimeCol.prototype.renderNowIndicator = function (segs) { - var _a = this.props, slatCoords = _a.slatCoords, date = _a.date; - if (!slatCoords) { - return null; - } - return segs.map(function (seg, i) { return (createElement(NowIndicatorRoot, { isAxis: false, date: date, - // key doesn't matter. will only ever be one - key: i }, function (rootElRef, classNames, innerElRef, innerContent) { return (createElement("div", { ref: rootElRef, className: ['fc-timegrid-now-indicator-line'].concat(classNames).join(' '), style: { top: slatCoords.computeDateTop(seg.start, date) } }, innerContent)); })); }); - }; - TimeCol.prototype.computeFgSegPositionCss = function (seg) { - var _a = this.context, isRtl = _a.isRtl, options = _a.options; - var shouldOverlap = options.slotEventOverlap; - var backwardCoord = seg.backwardCoord; // the left side if LTR. the right side if RTL. floating-point - var forwardCoord = seg.forwardCoord; // the right side if LTR. the left side if RTL. floating-point - var left; // amount of space from left edge, a fraction of the total width - var right; // amount of space from right edge, a fraction of the total width - if (shouldOverlap) { - // double the width, but don't go beyond the maximum forward coordinate (1.0) - forwardCoord = Math.min(1, backwardCoord + (forwardCoord - backwardCoord) * 2); - } - if (isRtl) { - left = 1 - forwardCoord; - right = backwardCoord; - } - else { - left = backwardCoord; - right = 1 - forwardCoord; - } - var props = { - zIndex: seg.level + 1, - left: left * 100 + '%', - right: right * 100 + '%', - }; - if (shouldOverlap && seg.forwardPressure) { - // add padding to the edge so that forward stacked events don't cover the resizer's icon - props[isRtl ? 'marginLeft' : 'marginRight'] = 10 * 2; // 10 is a guesstimate of the icon's width - } - return __assign(__assign({}, props), this.computeSegTopBottomCss(seg)); - }; - TimeCol.prototype.computeSegTopBottomCss = function (seg) { - return { - top: seg.top, - bottom: -seg.bottom, - }; - }; - return TimeCol; - }(BaseComponent)); - - var TimeColsContent = /** @class */ (function (_super) { - __extends(TimeColsContent, _super); - function TimeColsContent() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.splitFgEventSegs = memoize(splitSegsByCol); - _this.splitBgEventSegs = memoize(splitSegsByCol); - _this.splitBusinessHourSegs = memoize(splitSegsByCol); - _this.splitNowIndicatorSegs = memoize(splitSegsByCol); - _this.splitDateSelectionSegs = memoize(splitSegsByCol); - _this.splitEventDrag = memoize(splitInteractionByCol); - _this.splitEventResize = memoize(splitInteractionByCol); - _this.rootElRef = createRef(); - _this.cellElRefs = new RefMap(); - return _this; - } - TimeColsContent.prototype.render = function () { - var _this = this; - var _a = this, props = _a.props, context = _a.context; - var nowIndicatorTop = context.options.nowIndicator && - props.slatCoords && - props.slatCoords.safeComputeTop(props.nowDate); // might return void - var colCnt = props.cells.length; - var fgEventSegsByRow = this.splitFgEventSegs(props.fgEventSegs, colCnt); - var bgEventSegsByRow = this.splitBgEventSegs(props.bgEventSegs, colCnt); - var businessHourSegsByRow = this.splitBusinessHourSegs(props.businessHourSegs, colCnt); - var nowIndicatorSegsByRow = this.splitNowIndicatorSegs(props.nowIndicatorSegs, colCnt); - var dateSelectionSegsByRow = this.splitDateSelectionSegs(props.dateSelectionSegs, colCnt); - var eventDragByRow = this.splitEventDrag(props.eventDrag, colCnt); - var eventResizeByRow = this.splitEventResize(props.eventResize, colCnt); - return (createElement("div", { className: "fc-timegrid-cols", ref: this.rootElRef }, - createElement("table", { style: { - minWidth: props.tableMinWidth, - width: props.clientWidth, - } }, - props.tableColGroupNode, - createElement("tbody", null, - createElement("tr", null, - props.axis && (createElement("td", { className: "fc-timegrid-col fc-timegrid-axis" }, - createElement("div", { className: "fc-timegrid-col-frame" }, - createElement("div", { className: "fc-timegrid-now-indicator-container" }, typeof nowIndicatorTop === 'number' && (createElement(NowIndicatorRoot, { isAxis: true, date: props.nowDate }, function (rootElRef, classNames, innerElRef, innerContent) { return (createElement("div", { ref: rootElRef, className: ['fc-timegrid-now-indicator-arrow'].concat(classNames).join(' '), style: { top: nowIndicatorTop } }, innerContent)); })))))), - props.cells.map(function (cell, i) { return (createElement(TimeCol, { key: cell.key, elRef: _this.cellElRefs.createRef(cell.key), dateProfile: props.dateProfile, date: cell.date, nowDate: props.nowDate, todayRange: props.todayRange, extraHookProps: cell.extraHookProps, extraDataAttrs: cell.extraDataAttrs, extraClassNames: cell.extraClassNames, fgEventSegs: fgEventSegsByRow[i], bgEventSegs: bgEventSegsByRow[i], businessHourSegs: businessHourSegsByRow[i], nowIndicatorSegs: nowIndicatorSegsByRow[i], dateSelectionSegs: dateSelectionSegsByRow[i], eventDrag: eventDragByRow[i], eventResize: eventResizeByRow[i], slatCoords: props.slatCoords, eventSelection: props.eventSelection, forPrint: props.forPrint })); })))))); - }; - TimeColsContent.prototype.componentDidMount = function () { - this.updateCoords(); - }; - TimeColsContent.prototype.componentDidUpdate = function () { - this.updateCoords(); - }; - TimeColsContent.prototype.updateCoords = function () { - var props = this.props; - if (props.onColCoords && - props.clientWidth !== null // means sizing has stabilized - ) { - props.onColCoords(new PositionCache(this.rootElRef.current, collectCellEls(this.cellElRefs.currentMap, props.cells), true, // horizontal - false)); - } - }; - return TimeColsContent; - }(BaseComponent)); - function collectCellEls(elMap, cells) { - return cells.map(function (cell) { return elMap[cell.key]; }); - } - - /* A component that renders one or more columns of vertical time slots - ----------------------------------------------------------------------------------------------------------------------*/ - var TimeCols = /** @class */ (function (_super) { - __extends(TimeCols, _super); - function TimeCols() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.processSlotOptions = memoize(processSlotOptions); - _this.state = { - slatCoords: null, - }; - _this.handleScrollRequest = function (request) { - var onScrollTopRequest = _this.props.onScrollTopRequest; - var slatCoords = _this.state.slatCoords; - if (onScrollTopRequest && slatCoords) { - if (request.time) { - var top_1 = slatCoords.computeTimeTop(request.time); - top_1 = Math.ceil(top_1); // zoom can give weird floating-point values. rather scroll a little bit further - if (top_1) { - top_1 += 1; // to overcome top border that slots beyond the first have. looks better - } - onScrollTopRequest(top_1); - } - return true; - } - return false; - }; - _this.handleColCoords = function (colCoords) { - _this.colCoords = colCoords; - }; - _this.handleSlatCoords = function (slatCoords) { - _this.setState({ slatCoords: slatCoords }); - if (_this.props.onSlatCoords) { - _this.props.onSlatCoords(slatCoords); - } - }; - return _this; - } - TimeCols.prototype.render = function () { - var _a = this, props = _a.props, state = _a.state; - return (createElement("div", { className: "fc-timegrid-body", ref: props.rootElRef, style: { - // these props are important to give this wrapper correct dimensions for interactions - // TODO: if we set it here, can we avoid giving to inner tables? - width: props.clientWidth, - minWidth: props.tableMinWidth, - } }, - createElement(TimeColsSlats, { axis: props.axis, dateProfile: props.dateProfile, slatMetas: props.slatMetas, clientWidth: props.clientWidth, minHeight: props.expandRows ? props.clientHeight : '', tableMinWidth: props.tableMinWidth, tableColGroupNode: props.axis ? props.tableColGroupNode : null /* axis depends on the colgroup's shrinking */, onCoords: this.handleSlatCoords }), - createElement(TimeColsContent, { cells: props.cells, axis: props.axis, dateProfile: props.dateProfile, businessHourSegs: props.businessHourSegs, bgEventSegs: props.bgEventSegs, fgEventSegs: props.fgEventSegs, dateSelectionSegs: props.dateSelectionSegs, eventSelection: props.eventSelection, eventDrag: props.eventDrag, eventResize: props.eventResize, todayRange: props.todayRange, nowDate: props.nowDate, nowIndicatorSegs: props.nowIndicatorSegs, clientWidth: props.clientWidth, tableMinWidth: props.tableMinWidth, tableColGroupNode: props.tableColGroupNode, slatCoords: state.slatCoords, onColCoords: this.handleColCoords, forPrint: props.forPrint }))); - }; - TimeCols.prototype.componentDidMount = function () { - this.scrollResponder = this.context.createScrollResponder(this.handleScrollRequest); - }; - TimeCols.prototype.componentDidUpdate = function (prevProps) { - this.scrollResponder.update(prevProps.dateProfile !== this.props.dateProfile); - }; - TimeCols.prototype.componentWillUnmount = function () { - this.scrollResponder.detach(); - }; - TimeCols.prototype.positionToHit = function (positionLeft, positionTop) { - var _a = this.context, dateEnv = _a.dateEnv, options = _a.options; - var colCoords = this.colCoords; - var dateProfile = this.props.dateProfile; - var slatCoords = this.state.slatCoords; - var _b = this.processSlotOptions(this.props.slotDuration, options.snapDuration), snapDuration = _b.snapDuration, snapsPerSlot = _b.snapsPerSlot; - var colIndex = colCoords.leftToIndex(positionLeft); - var slatIndex = slatCoords.positions.topToIndex(positionTop); - if (colIndex != null && slatIndex != null) { - var slatTop = slatCoords.positions.tops[slatIndex]; - var slatHeight = slatCoords.positions.getHeight(slatIndex); - var partial = (positionTop - slatTop) / slatHeight; // floating point number between 0 and 1 - var localSnapIndex = Math.floor(partial * snapsPerSlot); // the snap # relative to start of slat - var snapIndex = slatIndex * snapsPerSlot + localSnapIndex; - var dayDate = this.props.cells[colIndex].date; - var time = addDurations(dateProfile.slotMinTime, multiplyDuration(snapDuration, snapIndex)); - var start = dateEnv.add(dayDate, time); - var end = dateEnv.add(start, snapDuration); - return { - col: colIndex, - dateSpan: { - range: { start: start, end: end }, - allDay: false, - }, - dayEl: colCoords.els[colIndex], - relativeRect: { - left: colCoords.lefts[colIndex], - right: colCoords.rights[colIndex], - top: slatTop, - bottom: slatTop + slatHeight, - }, - }; - } - return null; - }; - return TimeCols; - }(BaseComponent)); - function processSlotOptions(slotDuration, snapDurationOverride) { - var snapDuration = snapDurationOverride || slotDuration; - var snapsPerSlot = wholeDivideDurations(slotDuration, snapDuration); - if (snapsPerSlot === null) { - snapDuration = slotDuration; - snapsPerSlot = 1; - // TODO: say warning? - } - return { snapDuration: snapDuration, snapsPerSlot: snapsPerSlot }; - } - - var DayTimeColsSlicer = /** @class */ (function (_super) { - __extends(DayTimeColsSlicer, _super); - function DayTimeColsSlicer() { - return _super !== null && _super.apply(this, arguments) || this; - } - DayTimeColsSlicer.prototype.sliceRange = function (range, dayRanges) { - var segs = []; - for (var col = 0; col < dayRanges.length; col += 1) { - var segRange = intersectRanges(range, dayRanges[col]); - if (segRange) { - segs.push({ - start: segRange.start, - end: segRange.end, - isStart: segRange.start.valueOf() === range.start.valueOf(), - isEnd: segRange.end.valueOf() === range.end.valueOf(), - col: col, - }); - } - } - return segs; - }; - return DayTimeColsSlicer; - }(Slicer)); - - var DayTimeCols = /** @class */ (function (_super) { - __extends(DayTimeCols, _super); - function DayTimeCols() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.buildDayRanges = memoize(buildDayRanges); - _this.slicer = new DayTimeColsSlicer(); - _this.timeColsRef = createRef(); - _this.handleRootEl = function (rootEl) { - if (rootEl) { - _this.context.registerInteractiveComponent(_this, { el: rootEl }); - } - else { - _this.context.unregisterInteractiveComponent(_this); - } - }; - return _this; - } - DayTimeCols.prototype.render = function () { - var _this = this; - var _a = this, props = _a.props, context = _a.context; - var dateProfile = props.dateProfile, dayTableModel = props.dayTableModel; - var isNowIndicator = context.options.nowIndicator; - var dayRanges = this.buildDayRanges(dayTableModel, dateProfile, context.dateEnv); - // give it the first row of cells - // TODO: would move this further down hierarchy, but sliceNowDate needs it - return (createElement(NowTimer, { unit: isNowIndicator ? 'minute' : 'day' }, function (nowDate, todayRange) { return (createElement(TimeCols, __assign({ ref: _this.timeColsRef, rootElRef: _this.handleRootEl }, _this.slicer.sliceProps(props, dateProfile, null, context, dayRanges), { forPrint: props.forPrint, axis: props.axis, dateProfile: dateProfile, slatMetas: props.slatMetas, slotDuration: props.slotDuration, cells: dayTableModel.cells[0], tableColGroupNode: props.tableColGroupNode, tableMinWidth: props.tableMinWidth, clientWidth: props.clientWidth, clientHeight: props.clientHeight, expandRows: props.expandRows, nowDate: nowDate, nowIndicatorSegs: isNowIndicator && _this.slicer.sliceNowDate(nowDate, context, dayRanges), todayRange: todayRange, onScrollTopRequest: props.onScrollTopRequest, onSlatCoords: props.onSlatCoords }))); })); - }; - DayTimeCols.prototype.queryHit = function (positionLeft, positionTop) { - var rawHit = this.timeColsRef.current.positionToHit(positionLeft, positionTop); - if (rawHit) { - return { - component: this, - dateSpan: rawHit.dateSpan, - dayEl: rawHit.dayEl, - rect: { - left: rawHit.relativeRect.left, - right: rawHit.relativeRect.right, - top: rawHit.relativeRect.top, - bottom: rawHit.relativeRect.bottom, - }, - layer: 0, - }; - } - return null; - }; - return DayTimeCols; - }(DateComponent)); - function buildDayRanges(dayTableModel, dateProfile, dateEnv) { - var ranges = []; - for (var _i = 0, _a = dayTableModel.headerDates; _i < _a.length; _i++) { - var date = _a[_i]; - ranges.push({ - start: dateEnv.add(date, dateProfile.slotMinTime), - end: dateEnv.add(date, dateProfile.slotMaxTime), - }); - } - return ranges; - } - - // potential nice values for the slot-duration and interval-duration - // from largest to smallest - var STOCK_SUB_DURATIONS = [ - { hours: 1 }, - { minutes: 30 }, - { minutes: 15 }, - { seconds: 30 }, - { seconds: 15 }, - ]; - function buildSlatMetas(slotMinTime, slotMaxTime, explicitLabelInterval, slotDuration, dateEnv) { - var dayStart = new Date(0); - var slatTime = slotMinTime; - var slatIterator = createDuration(0); - var labelInterval = explicitLabelInterval || computeLabelInterval(slotDuration); - var metas = []; - while (asRoughMs(slatTime) < asRoughMs(slotMaxTime)) { - var date = dateEnv.add(dayStart, slatTime); - var isLabeled = wholeDivideDurations(slatIterator, labelInterval) !== null; - metas.push({ - date: date, - time: slatTime, - key: date.toISOString(), - isoTimeStr: formatIsoTimeString(date), - isLabeled: isLabeled, - }); - slatTime = addDurations(slatTime, slotDuration); - slatIterator = addDurations(slatIterator, slotDuration); - } - return metas; - } - // Computes an automatic value for slotLabelInterval - function computeLabelInterval(slotDuration) { - var i; - var labelInterval; - var slotsPerLabel; - // find the smallest stock label interval that results in more than one slots-per-label - for (i = STOCK_SUB_DURATIONS.length - 1; i >= 0; i -= 1) { - labelInterval = createDuration(STOCK_SUB_DURATIONS[i]); - slotsPerLabel = wholeDivideDurations(labelInterval, slotDuration); - if (slotsPerLabel !== null && slotsPerLabel > 1) { - return labelInterval; - } - } - return slotDuration; // fall back - } - - var DayTimeColsView = /** @class */ (function (_super) { - __extends(DayTimeColsView, _super); - function DayTimeColsView() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.buildTimeColsModel = memoize(buildTimeColsModel); - _this.buildSlatMetas = memoize(buildSlatMetas); - return _this; - } - DayTimeColsView.prototype.render = function () { - var _this = this; - var _a = this.context, options = _a.options, dateEnv = _a.dateEnv, dateProfileGenerator = _a.dateProfileGenerator; - var props = this.props; - var dateProfile = props.dateProfile; - var dayTableModel = this.buildTimeColsModel(dateProfile, dateProfileGenerator); - var splitProps = this.allDaySplitter.splitProps(props); - var slatMetas = this.buildSlatMetas(dateProfile.slotMinTime, dateProfile.slotMaxTime, options.slotLabelInterval, options.slotDuration, dateEnv); - var dayMinWidth = options.dayMinWidth; - var hasAttachedAxis = !dayMinWidth; - var hasDetachedAxis = dayMinWidth; - var headerContent = options.dayHeaders && (createElement(DayHeader, { dates: dayTableModel.headerDates, dateProfile: dateProfile, datesRepDistinctDays: true, renderIntro: hasAttachedAxis ? this.renderHeadAxis : null })); - var allDayContent = (options.allDaySlot !== false) && (function (contentArg) { return (createElement(DayTable, __assign({}, splitProps.allDay, { dateProfile: dateProfile, dayTableModel: dayTableModel, nextDayThreshold: options.nextDayThreshold, tableMinWidth: contentArg.tableMinWidth, colGroupNode: contentArg.tableColGroupNode, renderRowIntro: hasAttachedAxis ? _this.renderTableRowAxis : null, showWeekNumbers: false, expandRows: false, headerAlignElRef: _this.headerElRef, clientWidth: contentArg.clientWidth, clientHeight: contentArg.clientHeight, forPrint: props.forPrint }, _this.getAllDayMaxEventProps()))); }); - var timeGridContent = function (contentArg) { return (createElement(DayTimeCols, __assign({}, splitProps.timed, { dayTableModel: dayTableModel, dateProfile: dateProfile, axis: hasAttachedAxis, slotDuration: options.slotDuration, slatMetas: slatMetas, forPrint: props.forPrint, tableColGroupNode: contentArg.tableColGroupNode, tableMinWidth: contentArg.tableMinWidth, clientWidth: contentArg.clientWidth, clientHeight: contentArg.clientHeight, onSlatCoords: _this.handleSlatCoords, expandRows: contentArg.expandRows, onScrollTopRequest: _this.handleScrollTopRequest }))); }; - return hasDetachedAxis - ? this.renderHScrollLayout(headerContent, allDayContent, timeGridContent, dayTableModel.colCnt, dayMinWidth, slatMetas, this.state.slatCoords) - : this.renderSimpleLayout(headerContent, allDayContent, timeGridContent); - }; - return DayTimeColsView; - }(TimeColsView)); - function buildTimeColsModel(dateProfile, dateProfileGenerator) { - var daySeries = new DaySeriesModel(dateProfile.renderRange, dateProfileGenerator); - return new DayTableModel(daySeries, false); - } - - var OPTION_REFINERS$2 = { - allDaySlot: Boolean, - }; - - var timeGridPlugin = createPlugin({ - initialView: 'timeGridWeek', - optionRefiners: OPTION_REFINERS$2, - views: { - timeGrid: { - component: DayTimeColsView, - usesMinMaxTime: true, - allDaySlot: true, - slotDuration: '00:30:00', - slotEventOverlap: true, - }, - timeGridDay: { - type: 'timeGrid', - duration: { days: 1 }, - }, - timeGridWeek: { - type: 'timeGrid', - duration: { weeks: 1 }, - }, - }, - }); - - var ListViewHeaderRow = /** @class */ (function (_super) { - __extends(ListViewHeaderRow, _super); - function ListViewHeaderRow() { - return _super !== null && _super.apply(this, arguments) || this; - } - ListViewHeaderRow.prototype.render = function () { - var _a = this.props, dayDate = _a.dayDate, todayRange = _a.todayRange; - var _b = this.context, theme = _b.theme, dateEnv = _b.dateEnv, options = _b.options, viewApi = _b.viewApi; - var dayMeta = getDateMeta(dayDate, todayRange); - // will ever be falsy? - var text = options.listDayFormat ? dateEnv.format(dayDate, options.listDayFormat) : ''; - // will ever be falsy? also, BAD NAME "alt" - var sideText = options.listDaySideFormat ? dateEnv.format(dayDate, options.listDaySideFormat) : ''; - var navLinkData = options.navLinks - ? buildNavLinkData(dayDate) - : null; - var hookProps = __assign({ date: dateEnv.toDate(dayDate), view: viewApi, text: text, - sideText: sideText, - navLinkData: navLinkData }, dayMeta); - var classNames = ['fc-list-day'].concat(getDayClassNames(dayMeta, theme)); - // TODO: make a reusable HOC for dayHeader (used in daygrid/timegrid too) - return (createElement(RenderHook, { hookProps: hookProps, classNames: options.dayHeaderClassNames, content: options.dayHeaderContent, defaultContent: renderInnerContent$4, didMount: options.dayHeaderDidMount, willUnmount: options.dayHeaderWillUnmount }, function (rootElRef, customClassNames, innerElRef, innerContent) { return (createElement("tr", { ref: rootElRef, className: classNames.concat(customClassNames).join(' '), "data-date": formatDayString(dayDate) }, - createElement("th", { colSpan: 3 }, - createElement("div", { className: 'fc-list-day-cushion ' + theme.getClass('tableCellShaded'), ref: innerElRef }, innerContent)))); })); - }; - return ListViewHeaderRow; - }(BaseComponent)); - function renderInnerContent$4(props) { - var navLinkAttrs = props.navLinkData // is there a type for this? - ? { 'data-navlink': props.navLinkData, tabIndex: 0 } - : {}; - return (createElement(Fragment, null, - props.text && (createElement("a", __assign({ className: "fc-list-day-text" }, navLinkAttrs), props.text)), - props.sideText && (createElement("a", __assign({ className: "fc-list-day-side-text" }, navLinkAttrs), props.sideText)))); - } - - var DEFAULT_TIME_FORMAT$1 = createFormatter({ - hour: 'numeric', - minute: '2-digit', - meridiem: 'short', - }); - var ListViewEventRow = /** @class */ (function (_super) { - __extends(ListViewEventRow, _super); - function ListViewEventRow() { - return _super !== null && _super.apply(this, arguments) || this; - } - ListViewEventRow.prototype.render = function () { - var _a = this, props = _a.props, context = _a.context; - var seg = props.seg; - var timeFormat = context.options.eventTimeFormat || DEFAULT_TIME_FORMAT$1; - return (createElement(EventRoot, { seg: seg, timeText: "" // BAD. because of all-day content - , disableDragging: true, disableResizing: true, defaultContent: renderEventInnerContent, isPast: props.isPast, isFuture: props.isFuture, isToday: props.isToday, isSelected: props.isSelected, isDragging: props.isDragging, isResizing: props.isResizing, isDateSelecting: props.isDateSelecting }, function (rootElRef, classNames, innerElRef, innerContent, hookProps) { return (createElement("tr", { className: ['fc-list-event', hookProps.event.url ? 'fc-event-forced-url' : ''].concat(classNames).join(' '), ref: rootElRef }, - buildTimeContent(seg, timeFormat, context), - createElement("td", { className: "fc-list-event-graphic" }, - createElement("span", { className: "fc-list-event-dot", style: { borderColor: hookProps.borderColor || hookProps.backgroundColor } })), - createElement("td", { className: "fc-list-event-title", ref: innerElRef }, innerContent))); })); - }; - return ListViewEventRow; - }(BaseComponent)); - function renderEventInnerContent(props) { - var event = props.event; - var url = event.url; - var anchorAttrs = url ? { href: url } : {}; - return (createElement("a", __assign({}, anchorAttrs), event.title)); - } - function buildTimeContent(seg, timeFormat, context) { - var options = context.options; - if (options.displayEventTime !== false) { - var eventDef = seg.eventRange.def; - var eventInstance = seg.eventRange.instance; - var doAllDay = false; - var timeText = void 0; - if (eventDef.allDay) { - doAllDay = true; - } - else if (isMultiDayRange(seg.eventRange.range)) { // TODO: use (!isStart || !isEnd) instead? - if (seg.isStart) { - timeText = buildSegTimeText(seg, timeFormat, context, null, null, eventInstance.range.start, seg.end); - } - else if (seg.isEnd) { - timeText = buildSegTimeText(seg, timeFormat, context, null, null, seg.start, eventInstance.range.end); - } - else { - doAllDay = true; - } - } - else { - timeText = buildSegTimeText(seg, timeFormat, context); - } - if (doAllDay) { - var hookProps = { - text: context.options.allDayText, - view: context.viewApi, - }; - return (createElement(RenderHook, { hookProps: hookProps, classNames: options.allDayClassNames, content: options.allDayContent, defaultContent: renderAllDayInner$1, didMount: options.allDayDidMount, willUnmount: options.allDayWillUnmount }, function (rootElRef, classNames, innerElRef, innerContent) { return (createElement("td", { className: ['fc-list-event-time'].concat(classNames).join(' '), ref: rootElRef }, innerContent)); })); - } - return (createElement("td", { className: "fc-list-event-time" }, timeText)); - } - return null; - } - function renderAllDayInner$1(hookProps) { - return hookProps.text; - } - - /* - Responsible for the scroller, and forwarding event-related actions into the "grid". - */ - var ListView = /** @class */ (function (_super) { - __extends(ListView, _super); - function ListView() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.computeDateVars = memoize(computeDateVars); - _this.eventStoreToSegs = memoize(_this._eventStoreToSegs); - _this.setRootEl = function (rootEl) { - if (rootEl) { - _this.context.registerInteractiveComponent(_this, { - el: rootEl, - }); - } - else { - _this.context.unregisterInteractiveComponent(_this); - } - }; - return _this; - } - ListView.prototype.render = function () { - var _this = this; - var _a = this, props = _a.props, context = _a.context; - var extraClassNames = [ - 'fc-list', - context.theme.getClass('table'), - context.options.stickyHeaderDates !== false ? 'fc-list-sticky' : '', - ]; - var _b = this.computeDateVars(props.dateProfile), dayDates = _b.dayDates, dayRanges = _b.dayRanges; - var eventSegs = this.eventStoreToSegs(props.eventStore, props.eventUiBases, dayRanges); - return (createElement(ViewRoot, { viewSpec: context.viewSpec, elRef: this.setRootEl }, function (rootElRef, classNames) { return (createElement("div", { ref: rootElRef, className: extraClassNames.concat(classNames).join(' ') }, - createElement(Scroller, { liquid: !props.isHeightAuto, overflowX: props.isHeightAuto ? 'visible' : 'hidden', overflowY: props.isHeightAuto ? 'visible' : 'auto' }, eventSegs.length > 0 ? - _this.renderSegList(eventSegs, dayDates) : - _this.renderEmptyMessage()))); })); - }; - ListView.prototype.renderEmptyMessage = function () { - var _a = this.context, options = _a.options, viewApi = _a.viewApi; - var hookProps = { - text: options.noEventsText, - view: viewApi, - }; - return (createElement(RenderHook, { hookProps: hookProps, classNames: options.noEventsClassNames, content: options.noEventsContent, defaultContent: renderNoEventsInner, didMount: options.noEventsDidMount, willUnmount: options.noEventsWillUnmount }, function (rootElRef, classNames, innerElRef, innerContent) { return (createElement("div", { className: ['fc-list-empty'].concat(classNames).join(' '), ref: rootElRef }, - createElement("div", { className: "fc-list-empty-cushion", ref: innerElRef }, innerContent))); })); - }; - ListView.prototype.renderSegList = function (allSegs, dayDates) { - var _a = this.context, theme = _a.theme, options = _a.options; - var segsByDay = groupSegsByDay(allSegs); // sparse array - return (createElement(NowTimer, { unit: "day" }, function (nowDate, todayRange) { - var innerNodes = []; - for (var dayIndex = 0; dayIndex < segsByDay.length; dayIndex += 1) { - var daySegs = segsByDay[dayIndex]; - if (daySegs) { // sparse array, so might be undefined - var dayStr = dayDates[dayIndex].toISOString(); - // append a day header - innerNodes.push(createElement(ListViewHeaderRow, { key: dayStr, dayDate: dayDates[dayIndex], todayRange: todayRange })); - daySegs = sortEventSegs(daySegs, options.eventOrder); - for (var _i = 0, daySegs_1 = daySegs; _i < daySegs_1.length; _i++) { - var seg = daySegs_1[_i]; - innerNodes.push(createElement(ListViewEventRow, __assign({ key: dayStr + ':' + seg.eventRange.instance.instanceId /* are multiple segs for an instanceId */, seg: seg, isDragging: false, isResizing: false, isDateSelecting: false, isSelected: false }, getSegMeta(seg, todayRange, nowDate)))); - } - } - } - return (createElement("table", { className: 'fc-list-table ' + theme.getClass('table') }, - createElement("tbody", null, innerNodes))); - })); - }; - ListView.prototype._eventStoreToSegs = function (eventStore, eventUiBases, dayRanges) { - return this.eventRangesToSegs(sliceEventStore(eventStore, eventUiBases, this.props.dateProfile.activeRange, this.context.options.nextDayThreshold).fg, dayRanges); - }; - ListView.prototype.eventRangesToSegs = function (eventRanges, dayRanges) { - var segs = []; - for (var _i = 0, eventRanges_1 = eventRanges; _i < eventRanges_1.length; _i++) { - var eventRange = eventRanges_1[_i]; - segs.push.apply(segs, this.eventRangeToSegs(eventRange, dayRanges)); - } - return segs; - }; - ListView.prototype.eventRangeToSegs = function (eventRange, dayRanges) { - var dateEnv = this.context.dateEnv; - var nextDayThreshold = this.context.options.nextDayThreshold; - var range = eventRange.range; - var allDay = eventRange.def.allDay; - var dayIndex; - var segRange; - var seg; - var segs = []; - for (dayIndex = 0; dayIndex < dayRanges.length; dayIndex += 1) { - segRange = intersectRanges(range, dayRanges[dayIndex]); - if (segRange) { - seg = { - component: this, - eventRange: eventRange, - start: segRange.start, - end: segRange.end, - isStart: eventRange.isStart && segRange.start.valueOf() === range.start.valueOf(), - isEnd: eventRange.isEnd && segRange.end.valueOf() === range.end.valueOf(), - dayIndex: dayIndex, - }; - segs.push(seg); - // detect when range won't go fully into the next day, - // and mutate the latest seg to the be the end. - if (!seg.isEnd && !allDay && - dayIndex + 1 < dayRanges.length && - range.end < - dateEnv.add(dayRanges[dayIndex + 1].start, nextDayThreshold)) { - seg.end = range.end; - seg.isEnd = true; - break; - } - } - } - return segs; - }; - return ListView; - }(DateComponent)); - function renderNoEventsInner(hookProps) { - return hookProps.text; - } - function computeDateVars(dateProfile) { - var dayStart = startOfDay(dateProfile.renderRange.start); - var viewEnd = dateProfile.renderRange.end; - var dayDates = []; - var dayRanges = []; - while (dayStart < viewEnd) { - dayDates.push(dayStart); - dayRanges.push({ - start: dayStart, - end: addDays(dayStart, 1), - }); - dayStart = addDays(dayStart, 1); - } - return { dayDates: dayDates, dayRanges: dayRanges }; - } - // Returns a sparse array of arrays, segs grouped by their dayIndex - function groupSegsByDay(segs) { - var segsByDay = []; // sparse array - var i; - var seg; - for (i = 0; i < segs.length; i += 1) { - seg = segs[i]; - (segsByDay[seg.dayIndex] || (segsByDay[seg.dayIndex] = [])) - .push(seg); - } - return segsByDay; - } - - var OPTION_REFINERS$3 = { - listDayFormat: createFalsableFormatter, - listDaySideFormat: createFalsableFormatter, - noEventsClassNames: identity, - noEventsContent: identity, - noEventsDidMount: identity, - noEventsWillUnmount: identity, - }; - function createFalsableFormatter(input) { - return input === false ? null : createFormatter(input); - } - - var listPlugin = createPlugin({ - optionRefiners: OPTION_REFINERS$3, - views: { - list: { - component: ListView, - buttonTextKey: 'list', - listDayFormat: { month: 'long', day: 'numeric', year: 'numeric' }, - }, - listDay: { - type: 'list', - duration: { days: 1 }, - listDayFormat: { weekday: 'long' }, - }, - listWeek: { - type: 'list', - duration: { weeks: 1 }, - listDayFormat: { weekday: 'long' }, - listDaySideFormat: { month: 'long', day: 'numeric', year: 'numeric' }, - }, - listMonth: { - type: 'list', - duration: { month: 1 }, - listDaySideFormat: { weekday: 'long' }, - }, - listYear: { - type: 'list', - duration: { year: 1 }, - listDaySideFormat: { weekday: 'long' }, - }, - }, - }); - - var BootstrapTheme = /** @class */ (function (_super) { - __extends(BootstrapTheme, _super); - function BootstrapTheme() { - return _super !== null && _super.apply(this, arguments) || this; - } - return BootstrapTheme; - }(Theme)); - BootstrapTheme.prototype.classes = { - root: 'fc-theme-bootstrap', - table: 'table-bordered', - tableCellShaded: 'table-active', - buttonGroup: 'btn-group', - button: 'btn btn-primary', - buttonActive: 'active', - popover: 'popover', - popoverHeader: 'popover-header', - popoverContent: 'popover-body', - }; - BootstrapTheme.prototype.baseIconClass = 'fa'; - BootstrapTheme.prototype.iconClasses = { - close: 'fa-times', - prev: 'fa-chevron-left', - next: 'fa-chevron-right', - prevYear: 'fa-angle-double-left', - nextYear: 'fa-angle-double-right', - }; - BootstrapTheme.prototype.rtlIconClasses = { - prev: 'fa-chevron-right', - next: 'fa-chevron-left', - prevYear: 'fa-angle-double-right', - nextYear: 'fa-angle-double-left', - }; - BootstrapTheme.prototype.iconOverrideOption = 'bootstrapFontAwesome'; // TODO: make TS-friendly. move the option-processing into this plugin - BootstrapTheme.prototype.iconOverrideCustomButtonOption = 'bootstrapFontAwesome'; - BootstrapTheme.prototype.iconOverridePrefix = 'fa-'; - var plugin = createPlugin({ - themeClasses: { - bootstrap: BootstrapTheme, - }, - }); - - // rename this file to options.ts like other packages? - var OPTION_REFINERS$4 = { - googleCalendarApiKey: String, - }; - - var EVENT_SOURCE_REFINERS$1 = { - googleCalendarApiKey: String, - googleCalendarId: String, - googleCalendarApiBase: String, - extraParams: identity, - }; - - // TODO: expose somehow - var API_BASE = 'https://www.googleapis.com/calendar/v3/calendars'; - var eventSourceDef$3 = { - parseMeta: function (refined) { - var googleCalendarId = refined.googleCalendarId; - if (!googleCalendarId && refined.url) { - googleCalendarId = parseGoogleCalendarId(refined.url); - } - if (googleCalendarId) { - return { - googleCalendarId: googleCalendarId, - googleCalendarApiKey: refined.googleCalendarApiKey, - googleCalendarApiBase: refined.googleCalendarApiBase, - extraParams: refined.extraParams, - }; - } - return null; - }, - fetch: function (arg, onSuccess, onFailure) { - var _a = arg.context, dateEnv = _a.dateEnv, options = _a.options; - var meta = arg.eventSource.meta; - var apiKey = meta.googleCalendarApiKey || options.googleCalendarApiKey; - if (!apiKey) { - onFailure({ - message: 'Specify a googleCalendarApiKey. See http://fullcalendar.io/docs/google_calendar/', - }); - } - else { - var url = buildUrl(meta); - // TODO: make DRY with json-feed-event-source - var extraParams = meta.extraParams; - var extraParamsObj = typeof extraParams === 'function' ? extraParams() : extraParams; - var requestParams_1 = buildRequestParams$1(arg.range, apiKey, extraParamsObj, dateEnv); - requestJson('GET', url, requestParams_1, function (body, xhr) { - if (body.error) { - onFailure({ - message: 'Google Calendar API: ' + body.error.message, - errors: body.error.errors, - xhr: xhr, - }); - } - else { - onSuccess({ - rawEvents: gcalItemsToRawEventDefs(body.items, requestParams_1.timeZone), - xhr: xhr, - }); - } - }, function (message, xhr) { - onFailure({ message: message, xhr: xhr }); - }); - } - }, - }; - function parseGoogleCalendarId(url) { - var match; - // detect if the ID was specified as a single string. - // will match calendars like "asdf1234@calendar.google.com" in addition to person email calendars. - if (/^[^/]+@([^/.]+\.)*(google|googlemail|gmail)\.com$/.test(url)) { - return url; - } - if ((match = /^https:\/\/www.googleapis.com\/calendar\/v3\/calendars\/([^/]*)/.exec(url)) || - (match = /^https?:\/\/www.google.com\/calendar\/feeds\/([^/]*)/.exec(url))) { - return decodeURIComponent(match[1]); - } - return null; - } - function buildUrl(meta) { - var apiBase = meta.googleCalendarApiBase; - if (!apiBase) { - apiBase = API_BASE; - } - return apiBase + '/' + encodeURIComponent(meta.googleCalendarId) + '/events'; - } - function buildRequestParams$1(range, apiKey, extraParams, dateEnv) { - var params; - var startStr; - var endStr; - if (dateEnv.canComputeOffset) { - // strings will naturally have offsets, which GCal needs - startStr = dateEnv.formatIso(range.start); - endStr = dateEnv.formatIso(range.end); - } - else { - // when timezone isn't known, we don't know what the UTC offset should be, so ask for +/- 1 day - // from the UTC day-start to guarantee we're getting all the events - // (start/end will be UTC-coerced dates, so toISOString is okay) - startStr = addDays(range.start, -1).toISOString(); - endStr = addDays(range.end, 1).toISOString(); - } - params = __assign(__assign({}, (extraParams || {})), { key: apiKey, timeMin: startStr, timeMax: endStr, singleEvents: true, maxResults: 9999 }); - if (dateEnv.timeZone !== 'local') { - params.timeZone = dateEnv.timeZone; - } - return params; - } - function gcalItemsToRawEventDefs(items, gcalTimezone) { - return items.map(function (item) { return gcalItemToRawEventDef(item, gcalTimezone); }); - } - function gcalItemToRawEventDef(item, gcalTimezone) { - var url = item.htmlLink || null; - // make the URLs for each event show times in the correct timezone - if (url && gcalTimezone) { - url = injectQsComponent(url, 'ctz=' + gcalTimezone); - } - return { - id: item.id, - title: item.summary, - start: item.start.dateTime || item.start.date, - end: item.end.dateTime || item.end.date, - url: url, - location: item.location, - description: item.description, - }; - } - // Injects a string like "arg=value" into the querystring of a URL - // TODO: move to a general util file? - function injectQsComponent(url, component) { - // inject it after the querystring but before the fragment - return url.replace(/(\?.*?)?(#|$)/, function (whole, qs, hash) { return (qs ? qs + '&' : '?') + component + hash; }); - } - var googleCalendarPlugin = createPlugin({ - eventSourceDefs: [eventSourceDef$3], - optionRefiners: OPTION_REFINERS$4, - eventSourceRefiners: EVENT_SOURCE_REFINERS$1, - }); - - var RELEASE_DATE = '2021-01-16'; // for Scheduler - var UPGRADE_WINDOW = 365 + 7; // days. 1 week leeway, for tz shift reasons too - var INVALID_LICENSE_URL = 'http://fullcalendar.io/docs/schedulerLicenseKey#invalid'; - var OUTDATED_LICENSE_URL = 'http://fullcalendar.io/docs/schedulerLicenseKey#outdated'; - var PRESET_LICENSE_KEYS = [ - 'GPL-My-Project-Is-Open-Source', - 'CC-Attribution-NonCommercial-NoDerivatives', - ]; - var CSS = { - position: 'absolute', - zIndex: 99999, - bottom: '1px', - left: '1px', - background: '#eee', - borderColor: '#ddd', - borderStyle: 'solid', - borderWidth: '1px 1px 0 0', - padding: '2px 4px', - fontSize: '12px', - borderTopRightRadius: '3px', - }; - function buildLicenseWarning(context) { - var key = context.options.schedulerLicenseKey; - var currentUrl = typeof window !== 'undefined' ? window.location.href : ''; - if (!isImmuneUrl(currentUrl)) { - var status_1 = processLicenseKey(key); - if (status_1 !== 'valid') { - return (createElement("div", { className: "fc-license-message", style: CSS }, (status_1 === 'outdated') ? (createElement(Fragment, null, - 'Your license key is too old to work with this version. ', - createElement("a", { href: OUTDATED_LICENSE_URL }, "More Info"))) : (createElement(Fragment, null, - 'Your license key is invalid. ', - createElement("a", { href: INVALID_LICENSE_URL }, "More Info"))))); - } - } - return null; - } - /* - This decryption is not meant to be bulletproof. Just a way to remind about an upgrade. - */ - function processLicenseKey(key) { - if (PRESET_LICENSE_KEYS.indexOf(key) !== -1) { - return 'valid'; - } - var parts = (key || '').match(/^(\d+)-fcs-(\d+)$/); - if (parts && (parts[1].length === 10)) { - var purchaseDate = new Date(parseInt(parts[2], 10) * 1000); - var releaseDate = new Date(config.mockSchedulerReleaseDate || RELEASE_DATE); - if (isValidDate(releaseDate)) { // token won't be replaced in dev mode - var minPurchaseDate = addDays(releaseDate, -UPGRADE_WINDOW); - if (minPurchaseDate < purchaseDate) { - return 'valid'; - } - return 'outdated'; - } - } - return 'invalid'; - } - function isImmuneUrl(url) { - return /\w+:\/\/fullcalendar\.io\/|\/examples\/[\w-]+\.html$/.test(url); - } - - var OPTION_REFINERS$5 = { - schedulerLicenseKey: String, - }; - - var premiumCommonPlugin = createPlugin({ - optionRefiners: OPTION_REFINERS$5, - viewContainerAppends: [buildLicenseWarning], - }); - - var WHEEL_EVENT_NAMES = 'wheel mousewheel DomMouseScroll MozMousePixelScroll'.split(' '); - /* - ALSO, with the ability to disable touch - */ - var ScrollListener = /** @class */ (function () { - function ScrollListener(el) { - var _this = this; - this.el = el; - this.emitter = new Emitter(); - this.isScrolling = false; - this.isTouching = false; // user currently has finger down? - this.isRecentlyWheeled = false; - this.isRecentlyScrolled = false; - this.wheelWaiter = new DelayedRunner(this._handleWheelWaited.bind(this)); - this.scrollWaiter = new DelayedRunner(this._handleScrollWaited.bind(this)); - // Handlers - // ---------------------------------------------------------------------------------------------- - this.handleScroll = function () { - _this.startScroll(); - _this.emitter.trigger('scroll', _this.isRecentlyWheeled, _this.isTouching); - _this.isRecentlyScrolled = true; - _this.scrollWaiter.request(500); - }; - // will fire *before* the scroll event is fired (might not cause a scroll) - this.handleWheel = function () { - _this.isRecentlyWheeled = true; - _this.wheelWaiter.request(500); - }; - // will fire *before* the scroll event is fired (might not cause a scroll) - this.handleTouchStart = function () { - _this.isTouching = true; - }; - this.handleTouchEnd = function () { - _this.isTouching = false; - // if the user ended their touch, and the scroll area wasn't moving, - // we consider this to be the end of the scroll. - if (!_this.isRecentlyScrolled) { - _this.endScroll(); // won't fire if already ended - } - }; - el.addEventListener('scroll', this.handleScroll); - el.addEventListener('touchstart', this.handleTouchStart, { passive: true }); - el.addEventListener('touchend', this.handleTouchEnd); - for (var _i = 0, WHEEL_EVENT_NAMES_1 = WHEEL_EVENT_NAMES; _i < WHEEL_EVENT_NAMES_1.length; _i++) { - var eventName = WHEEL_EVENT_NAMES_1[_i]; - el.addEventListener(eventName, this.handleWheel); - } - } - ScrollListener.prototype.destroy = function () { - var el = this.el; - el.removeEventListener('scroll', this.handleScroll); - el.removeEventListener('touchstart', this.handleTouchStart, { passive: true }); - el.removeEventListener('touchend', this.handleTouchEnd); - for (var _i = 0, WHEEL_EVENT_NAMES_2 = WHEEL_EVENT_NAMES; _i < WHEEL_EVENT_NAMES_2.length; _i++) { - var eventName = WHEEL_EVENT_NAMES_2[_i]; - el.removeEventListener(eventName, this.handleWheel); - } - }; - // Start / Stop - // ---------------------------------------------------------------------------------------------- - ScrollListener.prototype.startScroll = function () { - if (!this.isScrolling) { - this.isScrolling = true; - this.emitter.trigger('scrollStart', this.isRecentlyWheeled, this.isTouching); - } - }; - ScrollListener.prototype.endScroll = function () { - if (this.isScrolling) { - this.emitter.trigger('scrollEnd'); - this.isScrolling = false; - this.isRecentlyScrolled = true; - this.isRecentlyWheeled = false; - this.scrollWaiter.clear(); - this.wheelWaiter.clear(); - } - }; - ScrollListener.prototype._handleScrollWaited = function () { - this.isRecentlyScrolled = false; - // only end the scroll if not currently touching. - // if touching, the scrolling will end later, on touchend. - if (!this.isTouching) { - this.endScroll(); // won't fire if already ended - } - }; - ScrollListener.prototype._handleWheelWaited = function () { - this.isRecentlyWheeled = false; - }; - return ScrollListener; - }()); - - // TODO: assume the el has no borders? - function getScrollCanvasOrigin(scrollEl) { - var rect = scrollEl.getBoundingClientRect(); - var edges = computeEdges(scrollEl); // TODO: pass in isRtl? - return { - left: rect.left + edges.borderLeft + edges.scrollbarLeft - getScrollFromLeftEdge(scrollEl), - top: rect.top + edges.borderTop - scrollEl.scrollTop, - }; - } - function getScrollFromLeftEdge(el) { - var val = el.scrollLeft; - var computedStyles = window.getComputedStyle(el); // TODO: pass in isRtl? - if (computedStyles.direction === 'rtl') { - switch (getRtlScrollSystem()) { - case 'negative': - val = el.scrollWidth - el.clientWidth + val; // maxScrollDistance + val - break; - case 'reverse': - val = el.scrollWidth - el.clientWidth - val; // maxScrollDistance - val - break; - } - } - return val; - } - /* - `val` is in the "negative" scheme - */ - function setScrollFromStartingEdge(el, val) { - var computedStyles = window.getComputedStyle(el); // TODO: pass in isRtl? - if (computedStyles.direction === 'rtl') { - switch (getRtlScrollSystem()) { - case 'positive': - val = (el.scrollWidth - el.clientWidth) + val; // maxScrollDistance + val - break; - case 'reverse': - val = -val; - break; - } - } - el.scrollLeft = val; - } - // Horizontal Scroll System Detection - // ---------------------------------------------------------------------------------------------- - var _rtlScrollSystem; - function getRtlScrollSystem() { - return _rtlScrollSystem || (_rtlScrollSystem = detectRtlScrollSystem()); - } - function detectRtlScrollSystem() { - var el = document.createElement('div'); - el.style.position = 'absolute'; - el.style.top = '-1000px'; - el.style.width = '1px'; - el.style.height = '1px'; - el.style.overflow = 'scroll'; - el.style.direction = 'rtl'; - el.style.fontSize = '100px'; - el.innerHTML = 'A'; - document.body.appendChild(el); - var system; - if (el.scrollLeft > 0) { - system = 'positive'; // scroll is a positive number from the left edge - } - else { - el.scrollLeft = 1; - if (el.scrollLeft > 0) { - system = 'reverse'; // scroll is a positive number from the right edge - } - else { - system = 'negative'; // scroll is a negative number from the right edge - } - } - removeElement(el); - return system; - } - - var IS_MS_EDGE = typeof navigator !== 'undefined' && /Edge/.test(navigator.userAgent); // TODO: what about Chromeum-based Edge? - var STICKY_SELECTOR = '.fc-sticky'; - /* - useful beyond the native position:sticky for these reasons: - - support in IE11 - - nice centering support - - REQUIREMENT: fc-sticky elements, if the fc-sticky className is taken away, should NOT have relative or absolute positioning. - This is because we attach the coords with JS, and the VDOM might take away the fc-sticky class but doesn't know kill the positioning. - - TODO: don't query text-align:center. isn't compatible with flexbox centering. instead, check natural X coord within parent container - */ - var StickyScrolling = /** @class */ (function () { - function StickyScrolling(scrollEl, isRtl) { - var _this = this; - this.scrollEl = scrollEl; - this.isRtl = isRtl; - this.usingRelative = null; - this.updateSize = function () { - var scrollEl = _this.scrollEl; - var els = findElements(scrollEl, STICKY_SELECTOR); - var elGeoms = _this.queryElGeoms(els); - var viewportWidth = scrollEl.clientWidth; - var viewportHeight = scrollEl.clientHeight; - if (_this.usingRelative) { - var elDestinations = _this.computeElDestinations(elGeoms, viewportWidth); // read before prepPositioning - assignRelativePositions(els, elGeoms, elDestinations, viewportWidth, viewportHeight); - } - else { - assignStickyPositions(els, elGeoms, viewportWidth); - } - }; - this.usingRelative = - !computeStickyPropVal() || // IE11 - // https://stackoverflow.com/questions/56835658/in-microsoft-edge-sticky-positioning-doesnt-work-when-combined-with-dir-rtl - (IS_MS_EDGE && isRtl); - if (this.usingRelative) { - this.listener = new ScrollListener(scrollEl); - this.listener.emitter.on('scrollEnd', this.updateSize); - } - } - StickyScrolling.prototype.destroy = function () { - if (this.listener) { - this.listener.destroy(); - } - }; - StickyScrolling.prototype.queryElGeoms = function (els) { - var _a = this, scrollEl = _a.scrollEl, isRtl = _a.isRtl; - var canvasOrigin = getScrollCanvasOrigin(scrollEl); - var elGeoms = []; - for (var _i = 0, els_1 = els; _i < els_1.length; _i++) { - var el = els_1[_i]; - var parentBound = translateRect(computeInnerRect(el.parentNode, true, true), // weird way to call this!!! - -canvasOrigin.left, -canvasOrigin.top); - var elRect = el.getBoundingClientRect(); - var computedStyles = window.getComputedStyle(el); - var textAlign = window.getComputedStyle(el.parentNode).textAlign; // ask the parent - var naturalBound = null; - if (textAlign === 'start') { - textAlign = isRtl ? 'right' : 'left'; - } - else if (textAlign === 'end') { - textAlign = isRtl ? 'left' : 'right'; - } - if (computedStyles.position !== 'sticky') { - naturalBound = translateRect(elRect, -canvasOrigin.left - (parseFloat(computedStyles.left) || 0), // could be 'auto' - -canvasOrigin.top - (parseFloat(computedStyles.top) || 0)); - } - elGeoms.push({ - parentBound: parentBound, - naturalBound: naturalBound, - elWidth: elRect.width, - elHeight: elRect.height, - textAlign: textAlign, - }); - } - return elGeoms; - }; - // only for IE - StickyScrolling.prototype.computeElDestinations = function (elGeoms, viewportWidth) { - var scrollEl = this.scrollEl; - var viewportTop = scrollEl.scrollTop; - var viewportLeft = getScrollFromLeftEdge(scrollEl); - var viewportRight = viewportLeft + viewportWidth; - return elGeoms.map(function (elGeom) { - var elWidth = elGeom.elWidth, elHeight = elGeom.elHeight, parentBound = elGeom.parentBound, naturalBound = elGeom.naturalBound; - var destLeft; // relative to canvas topleft - var destTop; // " - switch (elGeom.textAlign) { - case 'left': - destLeft = viewportLeft; - break; - case 'right': - destLeft = viewportRight - elWidth; - break; - case 'center': - destLeft = (viewportLeft + viewportRight) / 2 - elWidth / 2; /// noooo, use half-width insteadddddddd - break; - } - destLeft = Math.min(destLeft, parentBound.right - elWidth); - destLeft = Math.max(destLeft, parentBound.left); - destTop = viewportTop; - destTop = Math.min(destTop, parentBound.bottom - elHeight); - destTop = Math.max(destTop, naturalBound.top); // better to use natural top for upper bound - return { left: destLeft, top: destTop }; - }); - }; - return StickyScrolling; - }()); - function assignRelativePositions(els, elGeoms, elDestinations, viewportWidth, viewportHeight) { - els.forEach(function (el, i) { - var _a = elGeoms[i], naturalBound = _a.naturalBound, parentBound = _a.parentBound; - var parentWidth = parentBound.right - parentBound.left; - var parentHeight = parentBound.bottom - parentBound.bottom; - var left; - var top; - if (parentWidth > viewportWidth || - parentHeight > viewportHeight) { - left = elDestinations[i].left - naturalBound.left; - top = elDestinations[i].top - naturalBound.top; - } - else { // if parent container can be completely in view, we don't need stickiness - left = ''; - top = ''; - } - applyStyle(el, { - position: 'relative', - left: left, - right: -left, - top: top, - }); - }); - } - function assignStickyPositions(els, elGeoms, viewportWidth) { - els.forEach(function (el, i) { - var _a = elGeoms[i], textAlign = _a.textAlign, elWidth = _a.elWidth, parentBound = _a.parentBound; - var parentWidth = parentBound.right - parentBound.left; - var left; - if (textAlign === 'center' && - parentWidth > viewportWidth) { - left = (viewportWidth - elWidth) / 2; - } - else { // if parent container can be completely in view, we don't need stickiness - left = ''; - } - applyStyle(el, { - left: left, - right: left, - top: 0, - }); - }); - } - // overkill now that we use the stylesheet to set it! - // just test that the 'position' value of a div with the fc-sticky classname has the word 'sticky' in it - function computeStickyPropVal() { - var el = document.createElement('div'); - el.className = 'fc-sticky'; - document.body.appendChild(el); - var val = window.getComputedStyle(el).position; - removeElement(el); - if (val.indexOf('sticky') !== -1) { - return val; - } - return null; - } - - var ClippedScroller = /** @class */ (function (_super) { - __extends(ClippedScroller, _super); - function ClippedScroller() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.elRef = createRef(); - _this.state = { - xScrollbarWidth: 0, - yScrollbarWidth: 0, - }; - _this.handleScroller = function (scroller) { - _this.scroller = scroller; - setRef(_this.props.scrollerRef, scroller); - }; - _this.handleSizing = function () { - var props = _this.props; - if (props.overflowY === 'scroll-hidden') { - _this.setState({ yScrollbarWidth: _this.scroller.getYScrollbarWidth() }); - } - if (props.overflowX === 'scroll-hidden') { - _this.setState({ xScrollbarWidth: _this.scroller.getXScrollbarWidth() }); - } - }; - return _this; - } - ClippedScroller.prototype.render = function () { - var _a = this, props = _a.props, state = _a.state, context = _a.context; - var isScrollbarOnLeft = context.isRtl && getIsRtlScrollbarOnLeft(); - var overcomeLeft = 0; - var overcomeRight = 0; - var overcomeBottom = 0; - if (props.overflowX === 'scroll-hidden') { - overcomeBottom = state.xScrollbarWidth; - } - if (props.overflowY === 'scroll-hidden') { - if (state.yScrollbarWidth != null) { - if (isScrollbarOnLeft) { - overcomeLeft = state.yScrollbarWidth; - } - else { - overcomeRight = state.yScrollbarWidth; - } - } - } - return (createElement("div", { ref: this.elRef, className: 'fc-scroller-harness' + (props.liquid ? ' fc-scroller-harness-liquid' : '') }, - createElement(Scroller, { ref: this.handleScroller, elRef: this.props.scrollerElRef, overflowX: props.overflowX === 'scroll-hidden' ? 'scroll' : props.overflowX, overflowY: props.overflowY === 'scroll-hidden' ? 'scroll' : props.overflowY, overcomeLeft: overcomeLeft, overcomeRight: overcomeRight, overcomeBottom: overcomeBottom, maxHeight: typeof props.maxHeight === 'number' - ? (props.maxHeight + (props.overflowX === 'scroll-hidden' ? state.xScrollbarWidth : 0)) - : '', liquid: props.liquid, liquidIsAbsolute: true }, props.children))); - }; - ClippedScroller.prototype.componentDidMount = function () { - this.handleSizing(); - this.context.addResizeHandler(this.handleSizing); - }; - ClippedScroller.prototype.componentDidUpdate = function (prevProps) { - if (!isPropsEqual(prevProps, this.props)) { // an external change? - this.handleSizing(); - } - }; - ClippedScroller.prototype.componentWillUnmount = function () { - this.context.removeResizeHandler(this.handleSizing); - }; - ClippedScroller.prototype.needsXScrolling = function () { - return this.scroller.needsXScrolling(); - }; - ClippedScroller.prototype.needsYScrolling = function () { - return this.scroller.needsYScrolling(); - }; - return ClippedScroller; - }(BaseComponent)); - - var ScrollSyncer = /** @class */ (function () { - function ScrollSyncer(isVertical, scrollEls) { - var _this = this; - this.isVertical = isVertical; - this.scrollEls = scrollEls; - this.isPaused = false; - this.scrollListeners = scrollEls.map(function (el) { return _this.bindScroller(el); }); - } - ScrollSyncer.prototype.destroy = function () { - for (var _i = 0, _a = this.scrollListeners; _i < _a.length; _i++) { - var scrollListener = _a[_i]; - scrollListener.destroy(); - } - }; - ScrollSyncer.prototype.bindScroller = function (el) { - var _this = this; - var _a = this, scrollEls = _a.scrollEls, isVertical = _a.isVertical; - var scrollListener = new ScrollListener(el); - var onScroll = function (isWheel, isTouch) { - if (!_this.isPaused) { - if (!_this.masterEl || (_this.masterEl !== el && (isWheel || isTouch))) { - _this.assignMaster(el); - } - if (_this.masterEl === el) { // dealing with current - for (var _i = 0, scrollEls_1 = scrollEls; _i < scrollEls_1.length; _i++) { - var otherEl = scrollEls_1[_i]; - if (otherEl !== el) { - if (isVertical) { - otherEl.scrollTop = el.scrollTop; - } - else { - otherEl.scrollLeft = el.scrollLeft; - } - } - } - } - } - }; - var onScrollEnd = function () { - if (_this.masterEl === el) { - _this.masterEl = null; - } - }; - scrollListener.emitter.on('scroll', onScroll); - scrollListener.emitter.on('scrollEnd', onScrollEnd); - return scrollListener; - }; - ScrollSyncer.prototype.assignMaster = function (el) { - this.masterEl = el; - for (var _i = 0, _a = this.scrollListeners; _i < _a.length; _i++) { - var scrollListener = _a[_i]; - if (scrollListener.el !== el) { - scrollListener.endScroll(); // to prevent residual scrolls from reclaiming master - } - } - }; - /* - will normalize the scrollLeft value - */ - ScrollSyncer.prototype.forceScrollLeft = function (scrollLeft) { - this.isPaused = true; - for (var _i = 0, _a = this.scrollListeners; _i < _a.length; _i++) { - var listener = _a[_i]; - setScrollFromStartingEdge(listener.el, scrollLeft); - } - this.isPaused = false; - }; - ScrollSyncer.prototype.forceScrollTop = function (top) { - this.isPaused = true; - for (var _i = 0, _a = this.scrollListeners; _i < _a.length; _i++) { - var listener = _a[_i]; - listener.el.scrollTop = top; - } - this.isPaused = false; - }; - return ScrollSyncer; - }()); - - var ScrollGrid = /** @class */ (function (_super) { - __extends(ScrollGrid, _super); - function ScrollGrid() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.compileColGroupStats = memoizeArraylike(compileColGroupStat, isColGroupStatsEqual); - _this.renderMicroColGroups = memoizeArraylike(renderMicroColGroup); // yucky to memoize VNodes, but much more efficient for consumers - _this.clippedScrollerRefs = new RefMap(); - // doesn't hold non-scrolling els used just for padding - _this.scrollerElRefs = new RefMap(_this._handleScrollerEl.bind(_this)); - _this.chunkElRefs = new RefMap(_this._handleChunkEl.bind(_this)); - _this.getStickyScrolling = memoizeArraylike(initStickyScrolling, null, destroyStickyScrolling); - _this.getScrollSyncersBySection = memoizeHashlike(initScrollSyncer.bind(_this, true), null, destroyScrollSyncer); - _this.getScrollSyncersByColumn = memoizeHashlike(initScrollSyncer.bind(_this, false), null, destroyScrollSyncer); - _this.stickyScrollings = []; - _this.scrollSyncersBySection = {}; - _this.scrollSyncersByColumn = {}; - // for row-height-syncing - _this.rowUnstableMap = new Map(); // no need to groom. always self-cancels - _this.rowInnerMaxHeightMap = new Map(); - _this.anyRowHeightsChanged = false; - _this.recentSizingCnt = 0; - _this.state = { - shrinkWidths: [], - forceYScrollbars: false, - forceXScrollbars: false, - scrollerClientWidths: {}, - scrollerClientHeights: {}, - sectionRowMaxHeights: [], - }; - _this.handleSizing = function (isForcedResize, sectionRowMaxHeightsChanged) { - if (!_this.allowSizing()) { - return; - } - if (!sectionRowMaxHeightsChanged) { // something else changed, probably external - _this.anyRowHeightsChanged = true; - } - var otherState = {}; - // if reacting to self-change of sectionRowMaxHeightsChanged, or not stable, don't do anything - if (isForcedResize || (!sectionRowMaxHeightsChanged && !_this.rowUnstableMap.size)) { - otherState.sectionRowMaxHeights = _this.computeSectionRowMaxHeights(); - } - _this.setState(__assign(__assign({ shrinkWidths: _this.computeShrinkWidths() }, _this.computeScrollerDims()), otherState), function () { - if (!_this.rowUnstableMap.size) { - _this.updateStickyScrolling(); // needs to happen AFTER final positioning committed to DOM - } - }); - }; - _this.handleRowHeightChange = function (rowEl, isStable) { - var _a = _this, rowUnstableMap = _a.rowUnstableMap, rowInnerMaxHeightMap = _a.rowInnerMaxHeightMap; - if (!isStable) { - rowUnstableMap.set(rowEl, true); - } - else { - rowUnstableMap.delete(rowEl); - var innerMaxHeight = getRowInnerMaxHeight(rowEl); - if (!rowInnerMaxHeightMap.has(rowEl) || rowInnerMaxHeightMap.get(rowEl) !== innerMaxHeight) { - rowInnerMaxHeightMap.set(rowEl, innerMaxHeight); - _this.anyRowHeightsChanged = true; - } - if (!rowUnstableMap.size && _this.anyRowHeightsChanged) { - _this.anyRowHeightsChanged = false; - _this.setState({ - sectionRowMaxHeights: _this.computeSectionRowMaxHeights(), - }); - } - } - }; - return _this; - } - ScrollGrid.prototype.render = function () { - var _a = this, props = _a.props, state = _a.state, context = _a.context; - var shrinkWidths = state.shrinkWidths; - var colGroupStats = this.compileColGroupStats(props.colGroups.map(function (colGroup) { return [colGroup]; })); - var microColGroupNodes = this.renderMicroColGroups(colGroupStats.map(function (stat, i) { return [stat.cols, shrinkWidths[i]]; })); - var classNames = getScrollGridClassNames(props.liquid, context); - var _b = this.getDims(), sectionCnt = _b[0], chunksPerSection = _b[1]; - // TODO: make DRY - var sectionConfigs = props.sections; - var configCnt = sectionConfigs.length; - var configI = 0; - var currentConfig; - var headSectionNodes = []; - var bodySectionNodes = []; - var footSectionNodes = []; - while (configI < configCnt && (currentConfig = sectionConfigs[configI]).type === 'header') { - headSectionNodes.push(this.renderSection(currentConfig, configI, colGroupStats, microColGroupNodes, state.sectionRowMaxHeights)); - configI += 1; - } - while (configI < configCnt && (currentConfig = sectionConfigs[configI]).type === 'body') { - bodySectionNodes.push(this.renderSection(currentConfig, configI, colGroupStats, microColGroupNodes, state.sectionRowMaxHeights)); - configI += 1; - } - while (configI < configCnt && (currentConfig = sectionConfigs[configI]).type === 'footer') { - footSectionNodes.push(this.renderSection(currentConfig, configI, colGroupStats, microColGroupNodes, state.sectionRowMaxHeights)); - configI += 1; - } - var isBuggy = !getCanVGrowWithinCell(); // see NOTE in SimpleScrollGrid - return createElement('table', { - ref: props.elRef, - className: classNames.join(' '), - }, renderMacroColGroup(colGroupStats, shrinkWidths), Boolean(!isBuggy && headSectionNodes.length) && createElement.apply(void 0, __spreadArrays(['thead', {}], headSectionNodes)), Boolean(!isBuggy && bodySectionNodes.length) && createElement.apply(void 0, __spreadArrays(['tbody', {}], bodySectionNodes)), Boolean(!isBuggy && footSectionNodes.length) && createElement.apply(void 0, __spreadArrays(['tfoot', {}], footSectionNodes)), isBuggy && createElement.apply(void 0, __spreadArrays(['tbody', {}], headSectionNodes, bodySectionNodes, footSectionNodes))); - }; - ScrollGrid.prototype.renderSection = function (sectionConfig, sectionIndex, colGroupStats, microColGroupNodes, sectionRowMaxHeights) { - var _this = this; - if ('outerContent' in sectionConfig) { - return (createElement(Fragment, { key: sectionConfig.key }, sectionConfig.outerContent)); - } - return (createElement("tr", { key: sectionConfig.key, className: getSectionClassNames(sectionConfig, this.props.liquid).join(' ') }, sectionConfig.chunks.map(function (chunkConfig, i) { return _this.renderChunk(sectionConfig, sectionIndex, colGroupStats[i], microColGroupNodes[i], chunkConfig, i, (sectionRowMaxHeights[sectionIndex] || [])[i] || []); }))); - }; - ScrollGrid.prototype.renderChunk = function (sectionConfig, sectionIndex, colGroupStat, microColGroupNode, chunkConfig, chunkIndex, rowHeights) { - if ('outerContent' in chunkConfig) { - return (createElement(Fragment, { key: chunkConfig.key }, chunkConfig.outerContent)); - } - var state = this.state; - var scrollerClientWidths = state.scrollerClientWidths, scrollerClientHeights = state.scrollerClientHeights; - var _a = this.getDims(), sectionCnt = _a[0], chunksPerSection = _a[1]; - var index = sectionIndex * chunksPerSection + chunkIndex; - var sideScrollIndex = (!this.context.isRtl || getIsRtlScrollbarOnLeft()) ? chunksPerSection - 1 : 0; - var isVScrollSide = chunkIndex === sideScrollIndex; - var isLastSection = sectionIndex === sectionCnt - 1; - var forceXScrollbars = isLastSection && state.forceXScrollbars; // NOOOO can result in `null` - var forceYScrollbars = isVScrollSide && state.forceYScrollbars; // NOOOO can result in `null` - var allowXScrolling = colGroupStat && colGroupStat.allowXScrolling; // rename? - var allowYScrolling = getAllowYScrolling(this.props, sectionConfig); // rename? do in section func? - var chunkVGrow = getSectionHasLiquidHeight(this.props, sectionConfig); // do in section func? - var expandRows = sectionConfig.expandRows && chunkVGrow; - var tableMinWidth = (colGroupStat && colGroupStat.totalColMinWidth) || ''; - var content = renderChunkContent(sectionConfig, chunkConfig, { - tableColGroupNode: microColGroupNode, - tableMinWidth: tableMinWidth, - clientWidth: scrollerClientWidths[index] !== undefined ? scrollerClientWidths[index] : null, - clientHeight: scrollerClientHeights[index] !== undefined ? scrollerClientHeights[index] : null, - expandRows: expandRows, - syncRowHeights: Boolean(sectionConfig.syncRowHeights), - rowSyncHeights: rowHeights, - reportRowHeightChange: this.handleRowHeightChange, - }); - var overflowX = forceXScrollbars ? (isLastSection ? 'scroll' : 'scroll-hidden') : - !allowXScrolling ? 'hidden' : - (isLastSection ? 'auto' : 'scroll-hidden'); - var overflowY = forceYScrollbars ? (isVScrollSide ? 'scroll' : 'scroll-hidden') : - !allowYScrolling ? 'hidden' : - (isVScrollSide ? 'auto' : 'scroll-hidden'); - // it *could* be possible to reduce DOM wrappers by only doing a ClippedScroller when allowXScrolling or allowYScrolling, - // but if these values were to change, the inner components would be unmounted/remounted because of the parent change. - content = (createElement(ClippedScroller, { ref: this.clippedScrollerRefs.createRef(index), scrollerElRef: this.scrollerElRefs.createRef(index), overflowX: overflowX, overflowY: overflowY, liquid: chunkVGrow, maxHeight: sectionConfig.maxHeight }, content)); - return (createElement("td", { key: chunkConfig.key, ref: this.chunkElRefs.createRef(index) }, content)); - }; - ScrollGrid.prototype.componentDidMount = function () { - this.updateScrollSyncers(); - this.handleSizing(false); - this.context.addResizeHandler(this.handleSizing); - }; - ScrollGrid.prototype.componentDidUpdate = function (prevProps, prevState) { - this.updateScrollSyncers(); - // TODO: need better solution when state contains non-sizing things - this.handleSizing(false, prevState.sectionRowMaxHeights !== this.state.sectionRowMaxHeights); - }; - ScrollGrid.prototype.componentWillUnmount = function () { - this.context.removeResizeHandler(this.handleSizing); - this.destroyStickyScrolling(); - this.destroyScrollSyncers(); - }; - ScrollGrid.prototype.allowSizing = function () { - var now = new Date(); - if (!this.lastSizingDate || - now.valueOf() > this.lastSizingDate.valueOf() + 1000 // beyond a second? - ) { - this.lastSizingDate = now; - this.recentSizingCnt = 0; - return true; - } - return (this.recentSizingCnt += 1) <= 10; - }; - ScrollGrid.prototype.computeShrinkWidths = function () { - var _this = this; - var colGroupStats = this.compileColGroupStats(this.props.colGroups.map(function (colGroup) { return [colGroup]; })); - var _a = this.getDims(), sectionCnt = _a[0], chunksPerSection = _a[1]; - var cnt = sectionCnt * chunksPerSection; - var shrinkWidths = []; - colGroupStats.forEach(function (colGroupStat, i) { - if (colGroupStat.hasShrinkCol) { - var chunkEls = _this.chunkElRefs.collect(i, cnt, chunksPerSection); // in one col - shrinkWidths[i] = computeShrinkWidth(chunkEls); - } - }); - return shrinkWidths; - }; - // has the side effect of grooming rowInnerMaxHeightMap - // TODO: somehow short-circuit if there are no new height changes - ScrollGrid.prototype.computeSectionRowMaxHeights = function () { - var newHeightMap = new Map(); - var _a = this.getDims(), sectionCnt = _a[0], chunksPerSection = _a[1]; - var sectionRowMaxHeights = []; - for (var sectionI = 0; sectionI < sectionCnt; sectionI += 1) { - var sectionConfig = this.props.sections[sectionI]; - var assignableHeights = []; // chunk, row - if (sectionConfig && sectionConfig.syncRowHeights) { - var rowHeightsByChunk = []; - for (var chunkI = 0; chunkI < chunksPerSection; chunkI += 1) { - var index = sectionI * chunksPerSection + chunkI; - var rowHeights = []; - var chunkEl = this.chunkElRefs.currentMap[index]; - if (chunkEl) { - rowHeights = findElements(chunkEl, '.fc-scrollgrid-sync-table tr').map(function (rowEl) { - var max = getRowInnerMaxHeight(rowEl); - newHeightMap.set(rowEl, max); - return max; - }); - } - else { - rowHeights = []; - } - rowHeightsByChunk.push(rowHeights); - } - var rowCnt = rowHeightsByChunk[0].length; - var isEqualRowCnt = true; - for (var chunkI = 1; chunkI < chunksPerSection; chunkI += 1) { - var isOuterContent = sectionConfig.chunks[chunkI] && sectionConfig.chunks[chunkI].outerContent !== undefined; // can be null - if (!isOuterContent && rowHeightsByChunk[chunkI].length !== rowCnt) { // skip outer content - isEqualRowCnt = false; - break; - } - } - if (!isEqualRowCnt) { - var chunkHeightSums = []; - for (var chunkI = 0; chunkI < chunksPerSection; chunkI += 1) { - chunkHeightSums.push(sumNumbers(rowHeightsByChunk[chunkI]) + rowHeightsByChunk[chunkI].length); - } - var maxTotalSum = Math.max.apply(Math, chunkHeightSums); - for (var chunkI = 0; chunkI < chunksPerSection; chunkI += 1) { - var rowInChunkCnt = rowHeightsByChunk[chunkI].length; - var rowInChunkTotalHeight = maxTotalSum - rowInChunkCnt; // subtract border - // height of non-first row. we do this to avoid rounding, because it's unreliable within a table - var rowInChunkHeightOthers = Math.floor(rowInChunkTotalHeight / rowInChunkCnt); - // whatever is leftover goes to the first row - var rowInChunkHeightFirst = rowInChunkTotalHeight - rowInChunkHeightOthers * (rowInChunkCnt - 1); - var rowInChunkHeights = []; - var row = 0; - if (row < rowInChunkCnt) { - rowInChunkHeights.push(rowInChunkHeightFirst); - row += 1; - } - while (row < rowInChunkCnt) { - rowInChunkHeights.push(rowInChunkHeightOthers); - row += 1; - } - assignableHeights.push(rowInChunkHeights); - } - } - else { - for (var chunkI = 0; chunkI < chunksPerSection; chunkI += 1) { - assignableHeights.push([]); - } - for (var row = 0; row < rowCnt; row += 1) { - var rowHeightsAcrossChunks = []; - for (var chunkI = 0; chunkI < chunksPerSection; chunkI += 1) { - var h = rowHeightsByChunk[chunkI][row]; - if (h != null) { // protect against outerContent - rowHeightsAcrossChunks.push(h); - } - } - var maxHeight = Math.max.apply(Math, rowHeightsAcrossChunks); - for (var chunkI = 0; chunkI < chunksPerSection; chunkI += 1) { - assignableHeights[chunkI].push(maxHeight); - } - } - } - } - sectionRowMaxHeights.push(assignableHeights); - } - this.rowInnerMaxHeightMap = newHeightMap; - return sectionRowMaxHeights; - }; - ScrollGrid.prototype.computeScrollerDims = function () { - var scrollbarWidth = getScrollbarWidths(); - var _a = this.getDims(), sectionCnt = _a[0], chunksPerSection = _a[1]; - var sideScrollI = (!this.context.isRtl || getIsRtlScrollbarOnLeft()) ? chunksPerSection - 1 : 0; - var lastSectionI = sectionCnt - 1; - var currentScrollers = this.clippedScrollerRefs.currentMap; - var scrollerEls = this.scrollerElRefs.currentMap; - var forceYScrollbars = false; - var forceXScrollbars = false; - var scrollerClientWidths = {}; - var scrollerClientHeights = {}; - for (var sectionI = 0; sectionI < sectionCnt; sectionI += 1) { // along edge - var index = sectionI * chunksPerSection + sideScrollI; - var scroller = currentScrollers[index]; - if (scroller && scroller.needsYScrolling()) { - forceYScrollbars = true; - break; - } - } - for (var chunkI = 0; chunkI < chunksPerSection; chunkI += 1) { // along last row - var index = lastSectionI * chunksPerSection + chunkI; - var scroller = currentScrollers[index]; - if (scroller && scroller.needsXScrolling()) { - forceXScrollbars = true; - break; - } - } - for (var sectionI = 0; sectionI < sectionCnt; sectionI += 1) { - for (var chunkI = 0; chunkI < chunksPerSection; chunkI += 1) { - var index = sectionI * chunksPerSection + chunkI; - var scrollerEl = scrollerEls[index]; - if (scrollerEl) { - // TODO: weird way to get this. need harness b/c doesn't include table borders - var harnessEl = scrollerEl.parentNode; - scrollerClientWidths[index] = Math.floor(harnessEl.getBoundingClientRect().width - ((chunkI === sideScrollI && forceYScrollbars) - ? scrollbarWidth.y // use global because scroller might not have scrollbars yet but will need them in future - : 0)); - scrollerClientHeights[index] = Math.floor(harnessEl.getBoundingClientRect().height - ((sectionI === lastSectionI && forceXScrollbars) - ? scrollbarWidth.x // use global because scroller might not have scrollbars yet but will need them in future - : 0)); - } - } - } - return { forceYScrollbars: forceYScrollbars, forceXScrollbars: forceXScrollbars, scrollerClientWidths: scrollerClientWidths, scrollerClientHeights: scrollerClientHeights }; - }; - ScrollGrid.prototype.updateStickyScrolling = function () { - var isRtl = this.context.isRtl; - var argsByKey = this.scrollerElRefs.getAll().map(function (scrollEl) { return [scrollEl, isRtl]; }); - var stickyScrollings = this.getStickyScrolling(argsByKey); - stickyScrollings.forEach(function (stickyScrolling) { return stickyScrolling.updateSize(); }); - this.stickyScrollings = stickyScrollings; - }; - ScrollGrid.prototype.destroyStickyScrolling = function () { - this.stickyScrollings.forEach(destroyStickyScrolling); - }; - ScrollGrid.prototype.updateScrollSyncers = function () { - var _a = this.getDims(), sectionCnt = _a[0], chunksPerSection = _a[1]; - var cnt = sectionCnt * chunksPerSection; - var scrollElsBySection = {}; - var scrollElsByColumn = {}; - var scrollElMap = this.scrollerElRefs.currentMap; - for (var sectionI = 0; sectionI < sectionCnt; sectionI += 1) { - var startIndex = sectionI * chunksPerSection; - var endIndex = startIndex + chunksPerSection; - scrollElsBySection[sectionI] = collectFromHash(scrollElMap, startIndex, endIndex, 1); // use the filtered - } - for (var col = 0; col < chunksPerSection; col += 1) { - scrollElsByColumn[col] = this.scrollerElRefs.collect(col, cnt, chunksPerSection); // DON'T use the filtered - } - this.scrollSyncersBySection = this.getScrollSyncersBySection(scrollElsBySection); - this.scrollSyncersByColumn = this.getScrollSyncersByColumn(scrollElsByColumn); - }; - ScrollGrid.prototype.destroyScrollSyncers = function () { - mapHash(this.scrollSyncersBySection, destroyScrollSyncer); - mapHash(this.scrollSyncersByColumn, destroyScrollSyncer); - }; - ScrollGrid.prototype.getChunkConfigByIndex = function (index) { - var chunksPerSection = this.getDims()[1]; - var sectionI = Math.floor(index / chunksPerSection); - var chunkI = index % chunksPerSection; - var sectionConfig = this.props.sections[sectionI]; - return sectionConfig && sectionConfig.chunks[chunkI]; - }; - ScrollGrid.prototype.forceScrollLeft = function (col, scrollLeft) { - var scrollSyncer = this.scrollSyncersByColumn[col]; - if (scrollSyncer) { - scrollSyncer.forceScrollLeft(scrollLeft); - } - }; - ScrollGrid.prototype.forceScrollTop = function (sectionI, scrollTop) { - var scrollSyncer = this.scrollSyncersBySection[sectionI]; - if (scrollSyncer) { - scrollSyncer.forceScrollTop(scrollTop); - } - }; - ScrollGrid.prototype._handleChunkEl = function (chunkEl, key) { - var chunkConfig = this.getChunkConfigByIndex(parseInt(key, 10)); - if (chunkConfig) { // null if section disappeared. bad, b/c won't null-set the elRef - setRef(chunkConfig.elRef, chunkEl); - } - }; - ScrollGrid.prototype._handleScrollerEl = function (scrollerEl, key) { - var chunkConfig = this.getChunkConfigByIndex(parseInt(key, 10)); - if (chunkConfig) { // null if section disappeared. bad, b/c won't null-set the elRef - setRef(chunkConfig.scrollerElRef, scrollerEl); - } - }; - ScrollGrid.prototype.getDims = function () { - var sectionCnt = this.props.sections.length; - var chunksPerSection = sectionCnt ? this.props.sections[0].chunks.length : 0; - return [sectionCnt, chunksPerSection]; - }; - return ScrollGrid; - }(BaseComponent)); - ScrollGrid.addStateEquality({ - shrinkWidths: isArraysEqual, - scrollerClientWidths: isPropsEqual, - scrollerClientHeights: isPropsEqual, - }); - function sumNumbers(numbers) { - var sum = 0; - for (var _i = 0, numbers_1 = numbers; _i < numbers_1.length; _i++) { - var n = numbers_1[_i]; - sum += n; - } - return sum; - } - function getRowInnerMaxHeight(rowEl) { - var innerHeights = findElements(rowEl, '.fc-scrollgrid-sync-inner').map(getElHeight); - if (innerHeights.length) { - return Math.max.apply(Math, innerHeights); - } - return 0; - } - function getElHeight(el) { - return el.offsetHeight; // better to deal with integers, for rounding, for PureComponent - } - function renderMacroColGroup(colGroupStats, shrinkWidths) { - var children = colGroupStats.map(function (colGroupStat, i) { - var width = colGroupStat.width; - if (width === 'shrink') { - width = colGroupStat.totalColWidth + sanitizeShrinkWidth(shrinkWidths[i]) + 1; // +1 for border :( - } - return ( // eslint-disable-next-line react/jsx-key - createElement("col", { style: { width: width } })); - }); - return createElement.apply(void 0, __spreadArrays(['colgroup', {}], children)); - } - function compileColGroupStat(colGroupConfig) { - var totalColWidth = sumColProp(colGroupConfig.cols, 'width'); // excludes "shrink" - var totalColMinWidth = sumColProp(colGroupConfig.cols, 'minWidth'); - var hasShrinkCol = hasShrinkWidth(colGroupConfig.cols); - var allowXScrolling = colGroupConfig.width !== 'shrink' && Boolean(totalColWidth || totalColMinWidth || hasShrinkCol); - return { - hasShrinkCol: hasShrinkCol, - totalColWidth: totalColWidth, - totalColMinWidth: totalColMinWidth, - allowXScrolling: allowXScrolling, - cols: colGroupConfig.cols, - width: colGroupConfig.width, - }; - } - function sumColProp(cols, propName) { - var total = 0; - for (var _i = 0, cols_1 = cols; _i < cols_1.length; _i++) { - var col = cols_1[_i]; - var val = col[propName]; - if (typeof val === 'number') { - total += val * (col.span || 1); - } - } - return total; - } - var COL_GROUP_STAT_EQUALITY = { - cols: isColPropsEqual, - }; - function isColGroupStatsEqual(stat0, stat1) { - return compareObjs(stat0, stat1, COL_GROUP_STAT_EQUALITY); - } - // for memoizers... - function initScrollSyncer(isVertical) { - var scrollEls = []; - for (var _i = 1; _i < arguments.length; _i++) { - scrollEls[_i - 1] = arguments[_i]; - } - return new ScrollSyncer(isVertical, scrollEls); - } - function destroyScrollSyncer(scrollSyncer) { - scrollSyncer.destroy(); - } - function initStickyScrolling(scrollEl, isRtl) { - return new StickyScrolling(scrollEl, isRtl); - } - function destroyStickyScrolling(stickyScrolling) { - stickyScrolling.destroy(); - } - - var scrollGridPlugin = createPlugin({ - deps: [ - premiumCommonPlugin, - ], - scrollGridImpl: ScrollGrid, - }); - - var contexts = []; - var undoFuncs = []; - var adaptivePlugin = createPlugin({ - deps: [ - premiumCommonPlugin, - ], - contextInit: function (context) { - if (!contexts.length) { - attachGlobalHandlers(); - } - contexts.push(context); - context.calendarApi.on('_unmount', function () { - removeExact(contexts, context); - if (!contexts.length) { - removeGlobalHandlers(); - } - }); - }, - }); - function attachGlobalHandlers() { - window.addEventListener('beforeprint', handleBeforePrint); - window.addEventListener('afterprint', handleAfterPrint); - // // for testing - // let forPrint = false - // document.addEventListener('keypress', (ev) => { - // if (ev.key === 'p') { - // forPrint = !forPrint - // if (forPrint) { - // handleBeforePrint() - // } else { - // handleAfterPrint() - // } - // } - // }) - } - function removeGlobalHandlers() { - window.removeEventListener('beforeprint', handleBeforePrint); - window.removeEventListener('afterprint', handleAfterPrint); - } - function handleBeforePrint() { - var scrollEls = queryScrollerEls(); - var scrollCoords = queryScrollerCoords(scrollEls); - for (var _i = 0, contexts_1 = contexts; _i < contexts_1.length; _i++) { - var context = contexts_1[_i]; - context.emitter.trigger('_beforeprint'); - } - flushToDom$1(); // because printing grabs DOM immediately after - killHorizontalScrolling(scrollEls, scrollCoords); - undoFuncs.push(function () { return restoreScrollerCoords(scrollEls, scrollCoords); }); - undoFuncs.push(freezeScrollgridWidths()); - } - function handleAfterPrint() { - for (var _i = 0, contexts_2 = contexts; _i < contexts_2.length; _i++) { - var context = contexts_2[_i]; - context.emitter.trigger('_afterprint'); - } - flushToDom$1(); // guarantee that there are real scrollers - while (undoFuncs.length) { - undoFuncs.shift()(); - } - } - // scrollgrid widths - function freezeScrollgridWidths() { - var els = findElements(document.body, '.fc-scrollgrid'); - els.forEach(freezeScrollGridWidth); - return function () { return els.forEach(unfreezeScrollGridWidth); }; - } - function freezeScrollGridWidth(el) { - el.style.width = el.getBoundingClientRect().width + 'px'; - } - function unfreezeScrollGridWidth(el) { - el.style.width = ''; - } - // scrollers - // TODO: use scroll normalization!? yes - function queryScrollerEls() { - return findElements(document.body, '.fc-scroller-harness > .fc-scroller'); - } - function queryScrollerCoords(els) { - return els.map(function (el) { - var computedStyle = window.getComputedStyle(el); - return { - scrollLeft: el.scrollLeft, - scrollTop: el.scrollTop, - overflowX: computedStyle.overflowX, - overflowY: computedStyle.overflowY, - marginBottom: computedStyle.marginBottom, - }; - }); - } - function killHorizontalScrolling(els, coords) { - els.forEach(function (el, i) { - el.style.overflowX = 'visible'; // need to clear X/Y to get true overflow - el.style.overflowY = 'visible'; // " - el.style.marginBottom = ''; // for clipping away scrollbar. disable - el.style.left = -coords[i].scrollLeft + 'px'; // simulate scrollLeft! will be position:relative - }); - } - function restoreScrollerCoords(els, coords) { - els.forEach(function (el, i) { - var c = coords[i]; - el.style.overflowX = c.overflowX; - el.style.overflowY = c.overflowY; - el.style.marginBottom = c.marginBottom; - el.style.left = ''; - el.scrollLeft = c.scrollLeft; - el.scrollTop = c.scrollTop; - }); - } - - var MIN_AUTO_LABELS = 18; // more than `12` months but less that `24` hours - var MAX_AUTO_SLOTS_PER_LABEL = 6; // allows 6 10-min slots in an hour - var MAX_AUTO_CELLS = 200; // allows 4-days to have a :30 slot duration - config.MAX_TIMELINE_SLOTS = 1000; - // potential nice values for slot-duration and interval-duration - var STOCK_SUB_DURATIONS$1 = [ - { years: 1 }, - { months: 1 }, - { days: 1 }, - { hours: 1 }, - { minutes: 30 }, - { minutes: 15 }, - { minutes: 10 }, - { minutes: 5 }, - { minutes: 1 }, - { seconds: 30 }, - { seconds: 15 }, - { seconds: 10 }, - { seconds: 5 }, - { seconds: 1 }, - { milliseconds: 500 }, - { milliseconds: 100 }, - { milliseconds: 10 }, - { milliseconds: 1 }, - ]; - function buildTimelineDateProfile(dateProfile, dateEnv, allOptions, dateProfileGenerator) { - var tDateProfile = { - labelInterval: allOptions.slotLabelInterval, - slotDuration: allOptions.slotDuration, - }; - validateLabelAndSlot(tDateProfile, dateProfile, dateEnv); // validate after computed grid duration - ensureLabelInterval(tDateProfile, dateProfile, dateEnv); - ensureSlotDuration(tDateProfile, dateProfile, dateEnv); - var input = allOptions.slotLabelFormat; - var rawFormats = Array.isArray(input) ? input : - (input != null) ? [input] : - computeHeaderFormats(tDateProfile, dateProfile, dateEnv, allOptions); - tDateProfile.headerFormats = rawFormats.map(function (rawFormat) { return createFormatter(rawFormat); }); - tDateProfile.isTimeScale = Boolean(tDateProfile.slotDuration.milliseconds); - var largeUnit = null; - if (!tDateProfile.isTimeScale) { - var slotUnit = greatestDurationDenominator(tDateProfile.slotDuration).unit; - if (/year|month|week/.test(slotUnit)) { - largeUnit = slotUnit; - } - } - tDateProfile.largeUnit = largeUnit; - tDateProfile.emphasizeWeeks = - asCleanDays(tDateProfile.slotDuration) === 1 && - currentRangeAs('weeks', dateProfile, dateEnv) >= 2 && - !allOptions.businessHours; - /* - console.log('label interval =', timelineView.labelInterval.humanize()) - console.log('slot duration =', timelineView.slotDuration.humanize()) - console.log('header formats =', timelineView.headerFormats) - console.log('isTimeScale', timelineView.isTimeScale) - console.log('largeUnit', timelineView.largeUnit) - */ - var rawSnapDuration = allOptions.snapDuration; - var snapDuration; - var snapsPerSlot; - if (rawSnapDuration) { - snapDuration = createDuration(rawSnapDuration); - snapsPerSlot = wholeDivideDurations(tDateProfile.slotDuration, snapDuration); - // ^ TODO: warning if not whole? - } - if (snapsPerSlot == null) { - snapDuration = tDateProfile.slotDuration; - snapsPerSlot = 1; - } - tDateProfile.snapDuration = snapDuration; - tDateProfile.snapsPerSlot = snapsPerSlot; - // more... - var timeWindowMs = asRoughMs(dateProfile.slotMaxTime) - asRoughMs(dateProfile.slotMinTime); - // TODO: why not use normalizeRange!? - var normalizedStart = normalizeDate(dateProfile.renderRange.start, tDateProfile, dateEnv); - var normalizedEnd = normalizeDate(dateProfile.renderRange.end, tDateProfile, dateEnv); - // apply slotMinTime/slotMaxTime - // TODO: View should be responsible. - if (tDateProfile.isTimeScale) { - normalizedStart = dateEnv.add(normalizedStart, dateProfile.slotMinTime); - normalizedEnd = dateEnv.add(addDays(normalizedEnd, -1), dateProfile.slotMaxTime); - } - tDateProfile.timeWindowMs = timeWindowMs; - tDateProfile.normalizedRange = { start: normalizedStart, end: normalizedEnd }; - var slotDates = []; - var date = normalizedStart; - while (date < normalizedEnd) { - if (isValidDate$1(date, tDateProfile, dateProfile, dateProfileGenerator)) { - slotDates.push(date); - } - date = dateEnv.add(date, tDateProfile.slotDuration); - } - tDateProfile.slotDates = slotDates; - // more... - var snapIndex = -1; - var snapDiff = 0; // index of the diff :( - var snapDiffToIndex = []; - var snapIndexToDiff = []; - date = normalizedStart; - while (date < normalizedEnd) { - if (isValidDate$1(date, tDateProfile, dateProfile, dateProfileGenerator)) { - snapIndex += 1; - snapDiffToIndex.push(snapIndex); - snapIndexToDiff.push(snapDiff); - } - else { - snapDiffToIndex.push(snapIndex + 0.5); - } - date = dateEnv.add(date, tDateProfile.snapDuration); - snapDiff += 1; - } - tDateProfile.snapDiffToIndex = snapDiffToIndex; - tDateProfile.snapIndexToDiff = snapIndexToDiff; - tDateProfile.snapCnt = snapIndex + 1; // is always one behind - tDateProfile.slotCnt = tDateProfile.snapCnt / tDateProfile.snapsPerSlot; - // more... - tDateProfile.isWeekStarts = buildIsWeekStarts(tDateProfile, dateEnv); - tDateProfile.cellRows = buildCellRows(tDateProfile, dateEnv); - tDateProfile.slotsPerLabel = wholeDivideDurations(tDateProfile.labelInterval, tDateProfile.slotDuration); - return tDateProfile; - } - /* - snaps to appropriate unit - */ - function normalizeDate(date, tDateProfile, dateEnv) { - var normalDate = date; - if (!tDateProfile.isTimeScale) { - normalDate = startOfDay(normalDate); - if (tDateProfile.largeUnit) { - normalDate = dateEnv.startOf(normalDate, tDateProfile.largeUnit); - } - } - return normalDate; - } - /* - snaps to appropriate unit - */ - function normalizeRange(range, tDateProfile, dateEnv) { - if (!tDateProfile.isTimeScale) { - range = computeVisibleDayRange(range); - if (tDateProfile.largeUnit) { - var dayRange = range; // preserve original result - range = { - start: dateEnv.startOf(range.start, tDateProfile.largeUnit), - end: dateEnv.startOf(range.end, tDateProfile.largeUnit), - }; - // if date is partially through the interval, or is in the same interval as the start, - // make the exclusive end be the *next* interval - if (range.end.valueOf() !== dayRange.end.valueOf() || range.end <= range.start) { - range = { - start: range.start, - end: dateEnv.add(range.end, tDateProfile.slotDuration), - }; - } - } - } - return range; - } - function isValidDate$1(date, tDateProfile, dateProfile, dateProfileGenerator) { - if (dateProfileGenerator.isHiddenDay(date)) { - return false; - } - if (tDateProfile.isTimeScale) { - // determine if the time is within slotMinTime/slotMaxTime, which may have wacky values - var day = startOfDay(date); - var timeMs = date.valueOf() - day.valueOf(); - var ms = timeMs - asRoughMs(dateProfile.slotMinTime); // milliseconds since slotMinTime - ms = ((ms % 86400000) + 86400000) % 86400000; // make negative values wrap to 24hr clock - return ms < tDateProfile.timeWindowMs; // before the slotMaxTime? - } - return true; - } - function validateLabelAndSlot(tDateProfile, dateProfile, dateEnv) { - var currentRange = dateProfile.currentRange; - // make sure labelInterval doesn't exceed the max number of cells - if (tDateProfile.labelInterval) { - var labelCnt = dateEnv.countDurationsBetween(currentRange.start, currentRange.end, tDateProfile.labelInterval); - if (labelCnt > config.MAX_TIMELINE_SLOTS) { - console.warn('slotLabelInterval results in too many cells'); - tDateProfile.labelInterval = null; - } - } - // make sure slotDuration doesn't exceed the maximum number of cells - if (tDateProfile.slotDuration) { - var slotCnt = dateEnv.countDurationsBetween(currentRange.start, currentRange.end, tDateProfile.slotDuration); - if (slotCnt > config.MAX_TIMELINE_SLOTS) { - console.warn('slotDuration results in too many cells'); - tDateProfile.slotDuration = null; - } - } - // make sure labelInterval is a multiple of slotDuration - if (tDateProfile.labelInterval && tDateProfile.slotDuration) { - var slotsPerLabel = wholeDivideDurations(tDateProfile.labelInterval, tDateProfile.slotDuration); - if (slotsPerLabel === null || slotsPerLabel < 1) { - console.warn('slotLabelInterval must be a multiple of slotDuration'); - tDateProfile.slotDuration = null; - } - } - } - function ensureLabelInterval(tDateProfile, dateProfile, dateEnv) { - var currentRange = dateProfile.currentRange; - var labelInterval = tDateProfile.labelInterval; - if (!labelInterval) { - // compute based off the slot duration - // find the largest label interval with an acceptable slots-per-label - var input = void 0; - if (tDateProfile.slotDuration) { - for (var _i = 0, STOCK_SUB_DURATIONS_1 = STOCK_SUB_DURATIONS$1; _i < STOCK_SUB_DURATIONS_1.length; _i++) { - input = STOCK_SUB_DURATIONS_1[_i]; - var tryLabelInterval = createDuration(input); - var slotsPerLabel = wholeDivideDurations(tryLabelInterval, tDateProfile.slotDuration); - if (slotsPerLabel !== null && slotsPerLabel <= MAX_AUTO_SLOTS_PER_LABEL) { - labelInterval = tryLabelInterval; - break; - } - } - // use the slot duration as a last resort - if (!labelInterval) { - labelInterval = tDateProfile.slotDuration; - } - // compute based off the view's duration - // find the largest label interval that yields the minimum number of labels - } - else { - for (var _a = 0, STOCK_SUB_DURATIONS_2 = STOCK_SUB_DURATIONS$1; _a < STOCK_SUB_DURATIONS_2.length; _a++) { - input = STOCK_SUB_DURATIONS_2[_a]; - labelInterval = createDuration(input); - var labelCnt = dateEnv.countDurationsBetween(currentRange.start, currentRange.end, labelInterval); - if (labelCnt >= MIN_AUTO_LABELS) { - break; - } - } - } - tDateProfile.labelInterval = labelInterval; - } - return labelInterval; - } - function ensureSlotDuration(tDateProfile, dateProfile, dateEnv) { - var currentRange = dateProfile.currentRange; - var slotDuration = tDateProfile.slotDuration; - if (!slotDuration) { - var labelInterval = ensureLabelInterval(tDateProfile, dateProfile, dateEnv); // will compute if necessary - // compute based off the label interval - // find the largest slot duration that is different from labelInterval, but still acceptable - for (var _i = 0, STOCK_SUB_DURATIONS_3 = STOCK_SUB_DURATIONS$1; _i < STOCK_SUB_DURATIONS_3.length; _i++) { - var input = STOCK_SUB_DURATIONS_3[_i]; - var trySlotDuration = createDuration(input); - var slotsPerLabel = wholeDivideDurations(labelInterval, trySlotDuration); - if (slotsPerLabel !== null && slotsPerLabel > 1 && slotsPerLabel <= MAX_AUTO_SLOTS_PER_LABEL) { - slotDuration = trySlotDuration; - break; - } - } - // only allow the value if it won't exceed the view's # of slots limit - if (slotDuration) { - var slotCnt = dateEnv.countDurationsBetween(currentRange.start, currentRange.end, slotDuration); - if (slotCnt > MAX_AUTO_CELLS) { - slotDuration = null; - } - } - // use the label interval as a last resort - if (!slotDuration) { - slotDuration = labelInterval; - } - tDateProfile.slotDuration = slotDuration; - } - return slotDuration; - } - function computeHeaderFormats(tDateProfile, dateProfile, dateEnv, allOptions) { - var format1; - var format2; - var labelInterval = tDateProfile.labelInterval; - var unit = greatestDurationDenominator(labelInterval).unit; - var weekNumbersVisible = allOptions.weekNumbers; - var format0 = (format1 = (format2 = null)); - // NOTE: weekNumber computation function wont work - if ((unit === 'week') && !weekNumbersVisible) { - unit = 'day'; - } - switch (unit) { - case 'year': - format0 = { year: 'numeric' }; // '2015' - break; - case 'month': - if (currentRangeAs('years', dateProfile, dateEnv) > 1) { - format0 = { year: 'numeric' }; // '2015' - } - format1 = { month: 'short' }; // 'Jan' - break; - case 'week': - if (currentRangeAs('years', dateProfile, dateEnv) > 1) { - format0 = { year: 'numeric' }; // '2015' - } - format1 = { week: 'narrow' }; // 'Wk4' - break; - case 'day': - if (currentRangeAs('years', dateProfile, dateEnv) > 1) { - format0 = { year: 'numeric', month: 'long' }; // 'January 2014' - } - else if (currentRangeAs('months', dateProfile, dateEnv) > 1) { - format0 = { month: 'long' }; // 'January' - } - if (weekNumbersVisible) { - format1 = { week: 'short' }; // 'Wk 4' - } - format2 = { weekday: 'narrow', day: 'numeric' }; // 'Su 9' - break; - case 'hour': - if (weekNumbersVisible) { - format0 = { week: 'short' }; // 'Wk 4' - } - if (currentRangeAs('days', dateProfile, dateEnv) > 1) { - format1 = { weekday: 'short', day: 'numeric', month: 'numeric', omitCommas: true }; // Sat 4/7 - } - format2 = { - hour: 'numeric', - minute: '2-digit', - omitZeroMinute: true, - meridiem: 'short', - }; - break; - case 'minute': - // sufficiently large number of different minute cells? - if ((asRoughMinutes(labelInterval) / 60) >= MAX_AUTO_SLOTS_PER_LABEL) { - format0 = { - hour: 'numeric', - meridiem: 'short', - }; - format1 = function (params) { return (':' + padStart(params.date.minute, 2) // ':30' - ); }; - } - else { - format0 = { - hour: 'numeric', - minute: 'numeric', - meridiem: 'short', - }; - } - break; - case 'second': - // sufficiently large number of different second cells? - if ((asRoughSeconds(labelInterval) / 60) >= MAX_AUTO_SLOTS_PER_LABEL) { - format0 = { hour: 'numeric', minute: '2-digit', meridiem: 'lowercase' }; // '8:30 PM' - format1 = function (params) { return (':' + padStart(params.date.second, 2) // ':30' - ); }; - } - else { - format0 = { hour: 'numeric', minute: '2-digit', second: '2-digit', meridiem: 'lowercase' }; // '8:30:45 PM' - } - break; - case 'millisecond': - format0 = { hour: 'numeric', minute: '2-digit', second: '2-digit', meridiem: 'lowercase' }; // '8:30:45 PM' - format1 = function (params) { return ('.' + padStart(params.millisecond, 3)); }; - break; - } - return [].concat(format0 || [], format1 || [], format2 || []); - } - // Compute the number of the give units in the "current" range. - // Won't go more precise than days. - // Will return `0` if there's not a clean whole interval. - function currentRangeAs(unit, dateProfile, dateEnv) { - var range = dateProfile.currentRange; - var res = null; - if (unit === 'years') { - res = dateEnv.diffWholeYears(range.start, range.end); - } - else if (unit === 'months') { - res = dateEnv.diffWholeMonths(range.start, range.end); - } - else if (unit === 'weeks') { - res = dateEnv.diffWholeMonths(range.start, range.end); - } - else if (unit === 'days') { - res = diffWholeDays(range.start, range.end); - } - return res || 0; - } - function buildIsWeekStarts(tDateProfile, dateEnv) { - var slotDates = tDateProfile.slotDates, emphasizeWeeks = tDateProfile.emphasizeWeeks; - var prevWeekNumber = null; - var isWeekStarts = []; - for (var _i = 0, slotDates_1 = slotDates; _i < slotDates_1.length; _i++) { - var slotDate = slotDates_1[_i]; - var weekNumber = dateEnv.computeWeekNumber(slotDate); - var isWeekStart = emphasizeWeeks && (prevWeekNumber !== null) && (prevWeekNumber !== weekNumber); - prevWeekNumber = weekNumber; - isWeekStarts.push(isWeekStart); - } - return isWeekStarts; - } - function buildCellRows(tDateProfile, dateEnv) { - var slotDates = tDateProfile.slotDates; - var formats = tDateProfile.headerFormats; - var cellRows = formats.map(function () { return []; }); // indexed by row,col - var slotAsDays = asCleanDays(tDateProfile.slotDuration); - var guessedSlotUnit = slotAsDays === 7 ? 'week' : - slotAsDays === 1 ? 'day' : - null; - // specifically for navclicks - var rowUnitsFromFormats = formats.map(function (format) { return (format.getLargestUnit ? format.getLargestUnit() : null); }); - // builds cellRows and slotCells - for (var i = 0; i < slotDates.length; i += 1) { - var date = slotDates[i]; - var isWeekStart = tDateProfile.isWeekStarts[i]; - for (var row = 0; row < formats.length; row += 1) { - var format = formats[row]; - var rowCells = cellRows[row]; - var leadingCell = rowCells[rowCells.length - 1]; - var isLastRow = row === formats.length - 1; - var isSuperRow = formats.length > 1 && !isLastRow; // more than one row and not the last - var newCell = null; - var rowUnit = rowUnitsFromFormats[row] || (isLastRow ? guessedSlotUnit : null); - if (isSuperRow) { - var text = dateEnv.format(date, format); - if (!leadingCell || (leadingCell.text !== text)) { - newCell = buildCellObject(date, text, rowUnit); - } - else { - leadingCell.colspan += 1; - } - } - else if (!leadingCell || - isInt(dateEnv.countDurationsBetween(tDateProfile.normalizedRange.start, date, tDateProfile.labelInterval))) { - var text = dateEnv.format(date, format); - newCell = buildCellObject(date, text, rowUnit); - } - else { - leadingCell.colspan += 1; - } - if (newCell) { - newCell.weekStart = isWeekStart; - rowCells.push(newCell); - } - } - } - return cellRows; - } - function buildCellObject(date, text, rowUnit) { - return { date: date, text: text, rowUnit: rowUnit, colspan: 1, isWeekStart: false }; - } - - var TimelineHeaderThInner = /** @class */ (function (_super) { - __extends(TimelineHeaderThInner, _super); - function TimelineHeaderThInner() { - return _super !== null && _super.apply(this, arguments) || this; - } - TimelineHeaderThInner.prototype.render = function () { - var _a = this, props = _a.props, context = _a.context; - var navLinkAttrs = props.navLinkData - ? { 'data-navlink': props.navLinkData, tabIndex: 0 } - : {}; - return (createElement(ContentHook, { hookProps: props.hookProps, content: context.options.slotLabelContent, defaultContent: renderInnerContent$5 }, function (innerElRef, innerContent) { return (createElement("a", __assign({ ref: innerElRef, className: 'fc-timeline-slot-cushion fc-scrollgrid-sync-inner' + (props.isSticky ? ' fc-sticky' : '') }, navLinkAttrs), innerContent)); })); - }; - return TimelineHeaderThInner; - }(BaseComponent)); - function renderInnerContent$5(props) { - return props.text; - } - function refineHookProps(input) { - return { - level: input.level, - date: input.dateEnv.toDate(input.dateMarker), - view: input.viewApi, - text: input.text, - }; - } - - var TimelineHeaderTh = /** @class */ (function (_super) { - __extends(TimelineHeaderTh, _super); - function TimelineHeaderTh() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.refineHookProps = memoizeObjArg(refineHookProps); - _this.normalizeClassNames = buildClassNameNormalizer(); - return _this; - } - TimelineHeaderTh.prototype.render = function () { - var _a = this, props = _a.props, context = _a.context; - var dateEnv = context.dateEnv, options = context.options; - var cell = props.cell, dateProfile = props.dateProfile, tDateProfile = props.tDateProfile; - // the cell.rowUnit is f'd - // giving 'month' for a 3-day view - // workaround: to infer day, do NOT time - var dateMeta = getDateMeta(cell.date, props.todayRange, props.nowDate, dateProfile); - var classNames = ['fc-timeline-slot', 'fc-timeline-slot-label'].concat(cell.rowUnit === 'time' // TODO: so slot classnames for week/month/bigger. see note above about rowUnit - ? getSlotClassNames(dateMeta, context.theme) - : getDayClassNames(dateMeta, context.theme)); - if (cell.isWeekStart) { - classNames.push('fc-timeline-slot-em'); - } - var navLinkData = (options.navLinks && cell.rowUnit && cell.rowUnit !== 'time') - ? buildNavLinkData(cell.date, cell.rowUnit) - : null; - var hookProps = this.refineHookProps({ - level: props.rowLevel, - dateMarker: cell.date, - text: cell.text, - dateEnv: context.dateEnv, - viewApi: context.viewApi, - }); - var customClassNames = this.normalizeClassNames(options.slotLabelClassNames, hookProps); - return (createElement(MountHook, { hookProps: hookProps, didMount: options.slotLabelDidMount, willUnmount: options.slotLabelWillUnmount }, function (rootElRef) { return (createElement("th", { ref: rootElRef, className: classNames.concat(customClassNames).join(' '), "data-date": dateEnv.formatIso(cell.date, { omitTime: !tDateProfile.isTimeScale, omitTimeZoneOffset: true }), colSpan: cell.colspan }, - createElement("div", { className: "fc-timeline-slot-frame", style: { height: props.rowInnerHeight } }, - createElement(TimelineHeaderThInner, { hookProps: hookProps, isSticky: props.isSticky, navLinkData: navLinkData })))); })); - }; - return TimelineHeaderTh; - }(BaseComponent)); - - var TimelineHeaderRows = /** @class */ (function (_super) { - __extends(TimelineHeaderRows, _super); - function TimelineHeaderRows() { - return _super !== null && _super.apply(this, arguments) || this; - } - TimelineHeaderRows.prototype.render = function () { - var _a = this.props, dateProfile = _a.dateProfile, tDateProfile = _a.tDateProfile, rowInnerHeights = _a.rowInnerHeights, todayRange = _a.todayRange, nowDate = _a.nowDate; - var cellRows = tDateProfile.cellRows; - return (createElement(Fragment, null, cellRows.map(function (rowCells, rowLevel) { - var isLast = rowLevel === cellRows.length - 1; - var isChrono = tDateProfile.isTimeScale && isLast; // the final row, with times? - var classNames = [ - 'fc-timeline-header-row', - isChrono ? 'fc-timeline-header-row-chrono' : '', - ]; - return ( // eslint-disable-next-line react/no-array-index-key - createElement("tr", { key: rowLevel, className: classNames.join(' ') }, rowCells.map(function (cell) { return (createElement(TimelineHeaderTh, { key: cell.date.toISOString(), cell: cell, rowLevel: rowLevel, dateProfile: dateProfile, tDateProfile: tDateProfile, todayRange: todayRange, nowDate: nowDate, rowInnerHeight: rowInnerHeights && rowInnerHeights[rowLevel], isSticky: !isLast })); }))); - }))); - }; - return TimelineHeaderRows; - }(BaseComponent)); - - var TimelineHeader = /** @class */ (function (_super) { - __extends(TimelineHeader, _super); - function TimelineHeader() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.rootElRef = createRef(); - return _this; - } - TimelineHeader.prototype.render = function () { - var _this = this; - var _a = this, props = _a.props, context = _a.context; - // TODO: very repetitive - // TODO: make part of tDateProfile? - var timerUnit = greatestDurationDenominator(props.tDateProfile.slotDuration).unit; - // WORKAROUND: make ignore slatCoords when out of sync with dateProfile - var slatCoords = props.slatCoords && props.slatCoords.dateProfile === props.dateProfile ? props.slatCoords : null; - return (createElement(NowTimer, { unit: timerUnit }, function (nowDate, todayRange) { return (createElement("div", { className: "fc-timeline-header", ref: _this.rootElRef }, - createElement("table", { className: "fc-scrollgrid-sync-table", style: { minWidth: props.tableMinWidth, width: props.clientWidth } }, - props.tableColGroupNode, - createElement("tbody", null, - createElement(TimelineHeaderRows, { dateProfile: props.dateProfile, tDateProfile: props.tDateProfile, nowDate: nowDate, todayRange: todayRange, rowInnerHeights: props.rowInnerHeights }))), - context.options.nowIndicator && ( - // need to have a container regardless of whether the current view has a visible now indicator - // because apparently removal of the element resets the scroll for some reasons (issue #5351). - // this issue doesn't happen for the timeline body however ( - createElement("div", { className: "fc-timeline-now-indicator-container" }, (slatCoords && slatCoords.isDateInRange(nowDate)) && (createElement(NowIndicatorRoot, { isAxis: true, date: nowDate }, function (rootElRef, classNames, innerElRef, innerContent) { return (createElement("div", { ref: rootElRef, className: ['fc-timeline-now-indicator-arrow'].concat(classNames).join(' '), style: { left: slatCoords.dateToCoord(nowDate) } }, innerContent)); })))))); })); - }; - TimelineHeader.prototype.componentDidMount = function () { - this.updateSize(); - }; - TimelineHeader.prototype.componentDidUpdate = function () { - this.updateSize(); - }; - TimelineHeader.prototype.updateSize = function () { - if (this.props.onMaxCushionWidth) { - this.props.onMaxCushionWidth(this.computeMaxCushionWidth()); - } - }; - TimelineHeader.prototype.computeMaxCushionWidth = function () { - return Math.max.apply(Math, findElements(this.rootElRef.current, '.fc-timeline-header-row:last-child .fc-timeline-slot-cushion').map(function (el) { return el.getBoundingClientRect().width; })); - }; - return TimelineHeader; - }(BaseComponent)); - - var TimelineCoords = /** @class */ (function () { - function TimelineCoords(slatRootEl, // okay to expose? - slatEls, dateProfile, tDateProfile, dateEnv, isRtl) { - this.slatRootEl = slatRootEl; - this.dateProfile = dateProfile; - this.tDateProfile = tDateProfile; - this.dateEnv = dateEnv; - this.isRtl = isRtl; - this.outerCoordCache = new PositionCache(slatRootEl, slatEls, true, // isHorizontal - false); - // for the inner divs within the slats - // used for event rendering and scrollTime, to disregard slat border - this.innerCoordCache = new PositionCache(slatRootEl, findDirectChildren(slatEls, 'div'), true, // isHorizontal - false); - } - TimelineCoords.prototype.rangeToCoords = function (range) { - if (this.isRtl) { - return { right: this.dateToCoord(range.start), left: this.dateToCoord(range.end) }; - } - return { left: this.dateToCoord(range.start), right: this.dateToCoord(range.end) }; - }; - TimelineCoords.prototype.isDateInRange = function (date) { - return rangeContainsMarker(this.dateProfile.currentRange, date); - }; - // for LTR, results range from 0 to width of area - // for RTL, results range from negative width of area to 0 - TimelineCoords.prototype.dateToCoord = function (date) { - var tDateProfile = this.tDateProfile; - var snapCoverage = this.computeDateSnapCoverage(date); - var slotCoverage = snapCoverage / tDateProfile.snapsPerSlot; - var slotIndex = Math.floor(slotCoverage); - slotIndex = Math.min(slotIndex, tDateProfile.slotCnt - 1); - var partial = slotCoverage - slotIndex; - var _a = this, innerCoordCache = _a.innerCoordCache, outerCoordCache = _a.outerCoordCache; - if (this.isRtl) { - return (outerCoordCache.rights[slotIndex] - - (innerCoordCache.getWidth(slotIndex) * partial)) - outerCoordCache.originClientRect.width; - } - return (outerCoordCache.lefts[slotIndex] + - (innerCoordCache.getWidth(slotIndex) * partial)); - }; - // returned value is between 0 and the number of snaps - TimelineCoords.prototype.computeDateSnapCoverage = function (date) { - return computeDateSnapCoverage(date, this.tDateProfile, this.dateEnv); - }; - TimelineCoords.prototype.computeDurationLeft = function (duration) { - var _a = this, dateProfile = _a.dateProfile, tDateProfile = _a.tDateProfile, dateEnv = _a.dateEnv, isRtl = _a.isRtl; - var left = 0; - if (dateProfile) { - var date = dateEnv.add(dateProfile.activeRange.start, duration); - if (!tDateProfile.isTimeScale) { - date = startOfDay(date); - } - left = this.dateToCoord(date); - // hack to overcome the left borders of non-first slat - if (!isRtl && left) { - left += 1; - } - } - return left; - }; - return TimelineCoords; - }()); - // returned value is between 0 and the number of snaps - function computeDateSnapCoverage(date, tDateProfile, dateEnv) { - var snapDiff = dateEnv.countDurationsBetween(tDateProfile.normalizedRange.start, date, tDateProfile.snapDuration); - if (snapDiff < 0) { - return 0; - } - if (snapDiff >= tDateProfile.snapDiffToIndex.length) { - return tDateProfile.snapCnt; - } - var snapDiffInt = Math.floor(snapDiff); - var snapCoverage = tDateProfile.snapDiffToIndex[snapDiffInt]; - if (isInt(snapCoverage)) { // not an in-between value - snapCoverage += snapDiff - snapDiffInt; // add the remainder - } - else { - // a fractional value, meaning the date is not visible - // always round up in this case. works for start AND end dates in a range. - snapCoverage = Math.ceil(snapCoverage); - } - return snapCoverage; - } - - var TimelineSlatCell = /** @class */ (function (_super) { - __extends(TimelineSlatCell, _super); - function TimelineSlatCell() { - return _super !== null && _super.apply(this, arguments) || this; - } - TimelineSlatCell.prototype.render = function () { - var _a = this, props = _a.props, context = _a.context; - var dateEnv = context.dateEnv, options = context.options, theme = context.theme; - var date = props.date, tDateProfile = props.tDateProfile, isEm = props.isEm; - var dateMeta = getDateMeta(props.date, props.todayRange, props.nowDate, props.dateProfile); - var classNames = ['fc-timeline-slot', 'fc-timeline-slot-lane']; - var dataAttrs = { 'data-date': dateEnv.formatIso(date, { omitTimeZoneOffset: true, omitTime: !tDateProfile.isTimeScale }) }; - var hookProps = __assign(__assign({ date: dateEnv.toDate(props.date) }, dateMeta), { view: context.viewApi }); - if (isEm) { - classNames.push('fc-timeline-slot-em'); - } - if (tDateProfile.isTimeScale) { - classNames.push(isInt(dateEnv.countDurationsBetween(tDateProfile.normalizedRange.start, props.date, tDateProfile.labelInterval)) ? - 'fc-timeline-slot-major' : - 'fc-timeline-slot-minor'); - } - classNames.push.apply(classNames, (props.isDay - ? getDayClassNames(dateMeta, theme) - : getSlotClassNames(dateMeta, theme))); - return (createElement(RenderHook, { hookProps: hookProps, classNames: options.slotLaneClassNames, content: options.slotLaneContent, didMount: options.slotLaneDidMount, willUnmount: options.slotLaneWillUnmount, elRef: props.elRef }, function (rootElRef, customClassNames, innerElRef, innerContent) { return (createElement("td", __assign({ ref: rootElRef, className: classNames.concat(customClassNames).join(' ') }, dataAttrs), - createElement("div", { ref: innerElRef }, innerContent))); })); - }; - return TimelineSlatCell; - }(BaseComponent)); - - var TimelineSlatsBody = /** @class */ (function (_super) { - __extends(TimelineSlatsBody, _super); - function TimelineSlatsBody() { - return _super !== null && _super.apply(this, arguments) || this; - } - TimelineSlatsBody.prototype.render = function () { - var props = this.props; - var tDateProfile = props.tDateProfile, cellElRefs = props.cellElRefs; - var slotDates = tDateProfile.slotDates, isWeekStarts = tDateProfile.isWeekStarts; - var isDay = !tDateProfile.isTimeScale && !tDateProfile.largeUnit; - return (createElement("tbody", null, - createElement("tr", null, slotDates.map(function (slotDate, i) { - var key = slotDate.toISOString(); - return (createElement(TimelineSlatCell, { key: key, elRef: cellElRefs.createRef(key), date: slotDate, dateProfile: props.dateProfile, tDateProfile: tDateProfile, nowDate: props.nowDate, todayRange: props.todayRange, isEm: isWeekStarts[i], isDay: isDay })); - })))); - }; - return TimelineSlatsBody; - }(BaseComponent)); - - var TimelineSlats = /** @class */ (function (_super) { - __extends(TimelineSlats, _super); - function TimelineSlats() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.rootElRef = createRef(); - _this.cellElRefs = new RefMap(); - _this.handleScrollRequest = function (request) { - var onScrollLeftRequest = _this.props.onScrollLeftRequest; - var coords = _this.coords; - if (onScrollLeftRequest && coords) { - if (request.time) { - var scrollLeft = coords.computeDurationLeft(request.time); - onScrollLeftRequest(scrollLeft); - } - return true; - } - return null; // best? - }; - return _this; - } - TimelineSlats.prototype.render = function () { - var _a = this, props = _a.props, context = _a.context; - return (createElement("div", { className: "fc-timeline-slots", ref: this.rootElRef }, - createElement("table", { className: context.theme.getClass('table'), style: { - minWidth: props.tableMinWidth, - width: props.clientWidth, - } }, - props.tableColGroupNode, - createElement(TimelineSlatsBody, { cellElRefs: this.cellElRefs, dateProfile: props.dateProfile, tDateProfile: props.tDateProfile, nowDate: props.nowDate, todayRange: props.todayRange })))); - }; - TimelineSlats.prototype.componentDidMount = function () { - this.updateSizing(); - this.scrollResponder = this.context.createScrollResponder(this.handleScrollRequest); - }; - TimelineSlats.prototype.componentDidUpdate = function (prevProps) { - this.updateSizing(); - this.scrollResponder.update(prevProps.dateProfile !== this.props.dateProfile); - }; - TimelineSlats.prototype.componentWillUnmount = function () { - this.scrollResponder.detach(); - if (this.props.onCoords) { - this.props.onCoords(null); - } - }; - TimelineSlats.prototype.updateSizing = function () { - var _a = this, props = _a.props, context = _a.context; - if (props.clientWidth !== null && // is sizing stable? - this.scrollResponder - // ^it's possible to have clientWidth immediately after mount (when returning from print view), but w/o scrollResponder - ) { - var rootEl = this.rootElRef.current; - if (rootEl.offsetWidth) { - this.coords = new TimelineCoords(this.rootElRef.current, collectCellEls$1(this.cellElRefs.currentMap, props.tDateProfile.slotDates), props.dateProfile, props.tDateProfile, context.dateEnv, context.isRtl); - if (props.onCoords) { - props.onCoords(this.coords); - } - this.scrollResponder.update(false); // TODO: wouldn't have to do this if coords were in state - } - } - }; - TimelineSlats.prototype.positionToHit = function (leftPosition) { - var outerCoordCache = this.coords.outerCoordCache; - var _a = this.context, dateEnv = _a.dateEnv, isRtl = _a.isRtl; - var tDateProfile = this.props.tDateProfile; - var slatIndex = outerCoordCache.leftToIndex(leftPosition); - if (slatIndex != null) { - // somewhat similar to what TimeGrid does. consolidate? - var slatWidth = outerCoordCache.getWidth(slatIndex); - var partial = isRtl ? - (outerCoordCache.rights[slatIndex] - leftPosition) / slatWidth : - (leftPosition - outerCoordCache.lefts[slatIndex]) / slatWidth; - var localSnapIndex = Math.floor(partial * tDateProfile.snapsPerSlot); - var start = dateEnv.add(tDateProfile.slotDates[slatIndex], multiplyDuration(tDateProfile.snapDuration, localSnapIndex)); - var end = dateEnv.add(start, tDateProfile.snapDuration); - return { - dateSpan: { - range: { start: start, end: end }, - allDay: !this.props.tDateProfile.isTimeScale, - }, - dayEl: this.cellElRefs.currentMap[slatIndex], - left: outerCoordCache.lefts[slatIndex], - right: outerCoordCache.rights[slatIndex], - }; - } - return null; - }; - return TimelineSlats; - }(BaseComponent)); - function collectCellEls$1(elMap, slotDates) { - return slotDates.map(function (slotDate) { - var key = slotDate.toISOString(); - return elMap[key]; - }); - } - - var TimelineLaneBg = /** @class */ (function (_super) { - __extends(TimelineLaneBg, _super); - function TimelineLaneBg() { - return _super !== null && _super.apply(this, arguments) || this; - } - TimelineLaneBg.prototype.render = function () { - var props = this.props; - var highlightSeg = [].concat(props.eventResizeSegs, props.dateSelectionSegs); - return props.timelineCoords && (createElement("div", { className: "fc-timeline-bg" }, - this.renderSegs(props.businessHourSegs || [], props.timelineCoords, 'non-business'), - this.renderSegs(props.bgEventSegs || [], props.timelineCoords, 'bg-event'), - this.renderSegs(highlightSeg, props.timelineCoords, 'highlight'))); - }; - TimelineLaneBg.prototype.renderSegs = function (segs, timelineCoords, fillType) { - var _a = this.props, todayRange = _a.todayRange, nowDate = _a.nowDate; - var children = segs.map(function (seg) { - var coords = timelineCoords.rangeToCoords(seg); // seg has { start, end } - return (createElement("div", { key: buildEventRangeKey(seg.eventRange), className: "fc-timeline-bg-harness", style: { - left: coords.left, - right: -coords.right, - } }, fillType === 'bg-event' ? - createElement(BgEvent, __assign({ seg: seg }, getSegMeta(seg, todayRange, nowDate))) : - renderFill(fillType))); - }); - return createElement(Fragment, null, children); - }; - return TimelineLaneBg; - }(BaseComponent)); - - var TimelineLaneSlicer = /** @class */ (function (_super) { - __extends(TimelineLaneSlicer, _super); - function TimelineLaneSlicer() { - return _super !== null && _super.apply(this, arguments) || this; - } - TimelineLaneSlicer.prototype.sliceRange = function (origRange, dateProfile, dateProfileGenerator, tDateProfile, dateEnv) { - var normalRange = normalizeRange(origRange, tDateProfile, dateEnv); - var segs = []; - // protect against when the span is entirely in an invalid date region - if (computeDateSnapCoverage(normalRange.start, tDateProfile, dateEnv) - < computeDateSnapCoverage(normalRange.end, tDateProfile, dateEnv)) { - // intersect the footprint's range with the grid's range - var slicedRange = intersectRanges(normalRange, tDateProfile.normalizedRange); - if (slicedRange) { - segs.push({ - start: slicedRange.start, - end: slicedRange.end, - isStart: slicedRange.start.valueOf() === normalRange.start.valueOf() - && isValidDate$1(slicedRange.start, tDateProfile, dateProfile, dateProfileGenerator), - isEnd: slicedRange.end.valueOf() === normalRange.end.valueOf() - && isValidDate$1(addMs(slicedRange.end, -1), tDateProfile, dateProfile, dateProfileGenerator), - }); - } - } - return segs; - }; - return TimelineLaneSlicer; - }(Slicer)); - - var DEFAULT_TIME_FORMAT$2 = createFormatter({ - hour: 'numeric', - minute: '2-digit', - omitZeroMinute: true, - meridiem: 'narrow', - }); - var TimelineEvent = /** @class */ (function (_super) { - __extends(TimelineEvent, _super); - function TimelineEvent() { - return _super !== null && _super.apply(this, arguments) || this; - } - TimelineEvent.prototype.render = function () { - var props = this.props; - return (createElement(StandardEvent, __assign({}, props, { extraClassNames: ['fc-timeline-event', 'fc-h-event'], defaultTimeFormat: DEFAULT_TIME_FORMAT$2, defaultDisplayEventTime: !props.isTimeScale }))); - }; - return TimelineEvent; - }(BaseComponent)); - - function computeSegHorizontals$1(segs, timelineCoords) { - var horizontals = {}; - if (timelineCoords) { - for (var _i = 0, segs_1 = segs; _i < segs_1.length; _i++) { - var seg = segs_1[_i]; - var instanceId = seg.eventRange.instance.instanceId; - horizontals[instanceId] = timelineCoords.rangeToCoords(seg); // seg has { start, end } - } - } - return horizontals; - } - function computeSegVerticals$1(segs, eventOrderSpecs, dimHash) { - var placements = []; // sorted by top - var maxBottom = 0; - if (dimHash) { // protection for if dims not computed yet - segs = sortEventSegs(segs, eventOrderSpecs); - for (var _i = 0, segs_2 = segs; _i < segs_2.length; _i++) { - var seg = segs_2[_i]; - var key = seg.eventRange.instance.instanceId; - var dims = dimHash[key]; - if (dims) { // MORE-link protection - var top_1 = 0; - var insertI = 0; // where to start searching for an insert position - for (var i = 0; i < placements.length; i += 1) { // loop through existing placements - var placement = placements[i]; - if (testCollide(dims, top_1, placement.dims, placement.top)) { - top_1 = placement.top + placement.dims.height; - insertI = i; - } - } - // move insertI along to be after the placement whos top is below the current top - while (insertI < placements.length && top_1 >= placements[insertI].top) { - insertI += 1; - } - placements.splice(insertI, 0, { key: key, dims: dims, top: top_1 }); // insert - maxBottom = Math.max(maxBottom, top_1 + dims.height); - } - } - } - var topHash = {}; - for (var _a = 0, placements_1 = placements; _a < placements_1.length; _a++) { - var placement = placements_1[_a]; - topHash[placement.key] = placement.top; - } - return { segTops: topHash, height: maxBottom }; - } - function testCollide(dims0, top0, dims1, top1) { - return dims0.right > dims1.left && - dims0.left < dims1.right && - top0 + dims0.height > top1 && - top0 < top1 + dims1.height; - } - - var TimelineLane = /** @class */ (function (_super) { - __extends(TimelineLane, _super); - function TimelineLane() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.slicer = new TimelineLaneSlicer(); - _this.computeFgSegHorizontals = memoize(computeSegHorizontals$1); // only for fg event segs, not mirror - _this.computeSegVerticals = memoize(computeSegVerticals$1); - _this.harnessElRefs = new RefMap(); - _this.innerElRef = createRef(); - _this.state = { - segDims: null, - }; - return _this; - } - TimelineLane.prototype.render = function () { - var _a = this, props = _a.props, state = _a.state, context = _a.context; - var dateProfile = props.dateProfile, tDateProfile = props.tDateProfile; - var slicedProps = this.slicer.sliceProps(props, dateProfile, tDateProfile.isTimeScale ? null : props.nextDayThreshold, context, // wish we didn't have to pass in the rest of the args... - dateProfile, context.dateProfileGenerator, tDateProfile, context.dateEnv); - var mirrorSegs = (slicedProps.eventDrag ? slicedProps.eventDrag.segs : null) || - (slicedProps.eventResize ? slicedProps.eventResize.segs : null) || - []; - var segHorizontals = this.computeFgSegHorizontals(slicedProps.fgEventSegs, props.timelineCoords); // ONLY for non-mirror. needed? - var _b = this.computeSegVerticals(slicedProps.fgEventSegs, context.options.eventOrder, state.segDims), segTops = _b.segTops, height = _b.height; - var hiddenSegs = // TODO: more convenient - (slicedProps.eventDrag ? slicedProps.eventDrag.affectedInstances : null) || - (slicedProps.eventResize ? slicedProps.eventResize.affectedInstances : null) || - {}; - return (createElement(Fragment, null, - createElement(TimelineLaneBg, { businessHourSegs: slicedProps.businessHourSegs, bgEventSegs: slicedProps.bgEventSegs, timelineCoords: props.timelineCoords, eventResizeSegs: slicedProps.eventResize ? slicedProps.eventResize.segs : [] /* bad new empty array? */, dateSelectionSegs: slicedProps.dateSelectionSegs, nowDate: props.nowDate, todayRange: props.todayRange }), - createElement("div", { className: "fc-timeline-events fc-scrollgrid-sync-inner", ref: this.innerElRef, style: { height: height /* computed by computeSegVerticals */ } }, - this.renderFgSegs(slicedProps.fgEventSegs, segHorizontals, segTops, hiddenSegs, false, false, false), - this.renderFgSegs(mirrorSegs, computeSegHorizontals$1(mirrorSegs, props.timelineCoords), // not memoized - segTops, // reuse same tops for mirror - {}, Boolean(slicedProps.eventDrag), Boolean(slicedProps.eventResize), false)))); - }; - TimelineLane.prototype.componentDidMount = function () { - this.updateSize(); - }; - TimelineLane.prototype.componentDidUpdate = function (prevProps, prevState) { - if (prevProps.eventStore !== this.props.eventStore || - prevProps.timelineCoords !== this.props.timelineCoords - // won't trigger on a segDims change - ) { - this.updateSize(); - } - }; - TimelineLane.prototype.updateSize = function () { - var _this = this; - var props = this.props; - var timelineCoords = props.timelineCoords; - if (props.onHeightChange) { - props.onHeightChange(this.innerElRef.current, false); - } - if (timelineCoords) { - var originRect_1 = timelineCoords.slatRootEl.getBoundingClientRect(); - this.setState({ - segDims: mapHash(this.harnessElRefs.currentMap, function (harnessEl) { - var harnessRect = harnessEl.getBoundingClientRect(); - return { - left: Math.round(harnessRect.left - originRect_1.left), - right: Math.round(harnessRect.right - originRect_1.left), - height: Math.round(harnessRect.height), - }; - }), - }, function () { - if (props.onHeightChange) { - props.onHeightChange(_this.innerElRef.current, true); - } - }); - } - }; - TimelineLane.prototype.renderFgSegs = function (segs, segHorizontals, segTops, hiddenSegs, isDragging, isResizing, isDateSelecting) { - var _this = this; - var _a = this, harnessElRefs = _a.harnessElRefs, props = _a.props; - var isMirror = isDragging || isResizing || isDateSelecting; - return (createElement(Fragment, null, segs.map(function (seg) { - var instanceId = seg.eventRange.instance.instanceId; - var horizontalCoords = segHorizontals[instanceId]; - var top = segTops[instanceId]; - return (createElement("div", { key: instanceId, ref: isMirror ? null : harnessElRefs.createRef(instanceId), className: "fc-timeline-event-harness", style: { - left: horizontalCoords ? horizontalCoords.left : '', - right: horizontalCoords ? -horizontalCoords.right : '', - top: top != null ? top : '', - visibility: hiddenSegs[instanceId] ? 'hidden' : '' /* wtf, file @types/react bug */, - } }, - createElement(TimelineEvent, __assign({ isTimeScale: _this.props.tDateProfile.isTimeScale, seg: seg, isDragging: isDragging, isResizing: isResizing, isDateSelecting: isDateSelecting, isSelected: instanceId === _this.props.eventSelection /* TODO: bad for mirror? */ }, getSegMeta(seg, props.todayRange, props.nowDate))))); - }))); - }; - return TimelineLane; - }(BaseComponent)); - - var TimelineGrid = /** @class */ (function (_super) { - __extends(TimelineGrid, _super); - function TimelineGrid() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.slatsRef = createRef(); - _this.state = { - coords: null, - }; - _this.handeEl = function (el) { - if (el) { - _this.context.registerInteractiveComponent(_this, { el: el }); - } - else { - _this.context.unregisterInteractiveComponent(_this); - } - }; - _this.handleCoords = function (coords) { - _this.setState({ coords: coords }); - if (_this.props.onSlatCoords) { - _this.props.onSlatCoords(coords); - } - }; - return _this; - } - TimelineGrid.prototype.render = function () { - var _this = this; - var _a = this, props = _a.props, state = _a.state, context = _a.context; - var options = context.options; - var dateProfile = props.dateProfile, tDateProfile = props.tDateProfile; - var timerUnit = greatestDurationDenominator(tDateProfile.slotDuration).unit; - return (createElement("div", { className: "fc-timeline-body", ref: this.handeEl, style: { - minWidth: props.tableMinWidth, - height: props.clientHeight, - width: props.clientWidth, - } }, - createElement(NowTimer, { unit: timerUnit }, function (nowDate, todayRange) { return (createElement(Fragment, null, - createElement(TimelineSlats, { ref: _this.slatsRef, dateProfile: dateProfile, tDateProfile: tDateProfile, nowDate: nowDate, todayRange: todayRange, clientWidth: props.clientWidth, tableColGroupNode: props.tableColGroupNode, tableMinWidth: props.tableMinWidth, onCoords: _this.handleCoords, onScrollLeftRequest: props.onScrollLeftRequest }), - createElement(TimelineLane, { dateProfile: dateProfile, tDateProfile: props.tDateProfile, nowDate: nowDate, todayRange: todayRange, nextDayThreshold: options.nextDayThreshold, businessHours: props.businessHours, eventStore: props.eventStore, eventUiBases: props.eventUiBases, dateSelection: props.dateSelection, eventSelection: props.eventSelection, eventDrag: props.eventDrag, eventResize: props.eventResize, timelineCoords: state.coords }), - (options.nowIndicator && state.coords && state.coords.isDateInRange(nowDate)) && (createElement("div", { className: "fc-timeline-now-indicator-container" }, - createElement(NowIndicatorRoot, { isAxis: false, date: nowDate }, function (rootElRef, classNames, innerElRef, innerContent) { return (createElement("div", { ref: rootElRef, className: ['fc-timeline-now-indicator-line'].concat(classNames).join(' '), style: { left: state.coords.dateToCoord(nowDate) } }, innerContent)); }))))); }))); - }; - // Hit System - // ------------------------------------------------------------------------------------------ - TimelineGrid.prototype.queryHit = function (positionLeft, positionTop, elWidth, elHeight) { - var slats = this.slatsRef.current; - var slatHit = slats.positionToHit(positionLeft); - if (slatHit) { - return { - component: this, - dateSpan: slatHit.dateSpan, - rect: { - left: slatHit.left, - right: slatHit.right, - top: 0, - bottom: elHeight, - }, - dayEl: slatHit.dayEl, - layer: 0, - }; - } - return null; - }; - return TimelineGrid; - }(DateComponent)); - - var TimelineView = /** @class */ (function (_super) { - __extends(TimelineView, _super); - function TimelineView() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.buildTimelineDateProfile = memoize(buildTimelineDateProfile); - _this.scrollGridRef = createRef(); - _this.state = { - slatCoords: null, - slotCushionMaxWidth: null, - }; - _this.handleSlatCoords = function (slatCoords) { - _this.setState({ slatCoords: slatCoords }); - }; - _this.handleScrollLeftRequest = function (scrollLeft) { - var scrollGrid = _this.scrollGridRef.current; - scrollGrid.forceScrollLeft(0, scrollLeft); - }; - _this.handleMaxCushionWidth = function (slotCushionMaxWidth) { - _this.setState({ - slotCushionMaxWidth: Math.ceil(slotCushionMaxWidth), - }); - }; - return _this; - } - TimelineView.prototype.render = function () { - var _this = this; - var _a = this, props = _a.props, state = _a.state, context = _a.context; - var options = context.options; - var stickyHeaderDates = !props.forPrint && getStickyHeaderDates(options); - var stickyFooterScrollbar = !props.forPrint && getStickyFooterScrollbar(options); - var tDateProfile = this.buildTimelineDateProfile(props.dateProfile, context.dateEnv, options, context.dateProfileGenerator); - var extraClassNames = [ - 'fc-timeline', - options.eventOverlap === false ? 'fc-timeline-overlap-disabled' : '', - ]; - var slotMinWidth = options.slotMinWidth; - var slatCols = buildSlatCols(tDateProfile, slotMinWidth || this.computeFallbackSlotMinWidth(tDateProfile)); - var sections = [ - { - type: 'header', - key: 'header', - isSticky: stickyHeaderDates, - chunks: [{ - key: 'timeline', - content: function (contentArg) { return (createElement(TimelineHeader, { dateProfile: props.dateProfile, clientWidth: contentArg.clientWidth, clientHeight: contentArg.clientHeight, tableMinWidth: contentArg.tableMinWidth, tableColGroupNode: contentArg.tableColGroupNode, tDateProfile: tDateProfile, slatCoords: state.slatCoords, onMaxCushionWidth: slotMinWidth ? null : _this.handleMaxCushionWidth })); }, - }], - }, - { - type: 'body', - key: 'body', - liquid: true, - chunks: [{ - key: 'timeline', - content: function (contentArg) { return (createElement(TimelineGrid, __assign({}, props, { clientWidth: contentArg.clientWidth, clientHeight: contentArg.clientHeight, tableMinWidth: contentArg.tableMinWidth, tableColGroupNode: contentArg.tableColGroupNode, tDateProfile: tDateProfile, onSlatCoords: _this.handleSlatCoords, onScrollLeftRequest: _this.handleScrollLeftRequest }))); }, - }], - }, - ]; - if (stickyFooterScrollbar) { - sections.push({ - type: 'footer', - key: 'footer', - isSticky: true, - chunks: [{ - key: 'timeline', - content: renderScrollShim, - }], - }); - } - return (createElement(ViewRoot, { viewSpec: context.viewSpec }, function (rootElRef, classNames) { return (createElement("div", { ref: rootElRef, className: extraClassNames.concat(classNames).join(' ') }, - createElement(ScrollGrid, { ref: _this.scrollGridRef, liquid: !props.isHeightAuto && !props.forPrint, colGroups: [ - { cols: slatCols }, - ], sections: sections }))); })); - }; - TimelineView.prototype.computeFallbackSlotMinWidth = function (tDateProfile) { - return Math.max(30, ((this.state.slotCushionMaxWidth || 0) / tDateProfile.slotsPerLabel)); - }; - return TimelineView; - }(DateComponent)); - function buildSlatCols(tDateProfile, slotMinWidth) { - return [{ - span: tDateProfile.slotCnt, - minWidth: slotMinWidth || 1, - }]; - } - - var timelinePlugin = createPlugin({ - deps: [ - premiumCommonPlugin, - ], - initialView: 'timelineDay', - views: { - timeline: { - component: TimelineView, - usesMinMaxTime: true, - eventResizableFromStart: true, - }, - timelineDay: { - type: 'timeline', - duration: { days: 1 }, - }, - timelineWeek: { - type: 'timeline', - duration: { weeks: 1 }, - }, - timelineMonth: { - type: 'timeline', - duration: { months: 1 }, - }, - timelineYear: { - type: 'timeline', - duration: { years: 1 }, - }, - }, - }); - - function massageEventDragMutation(eventMutation, hit0, hit1) { - var resource0 = hit0.dateSpan.resourceId; - var resource1 = hit1.dateSpan.resourceId; - if (resource0 && resource1 && - resource0 !== resource1) { - eventMutation.resourceMutation = { - matchResourceId: resource0, - setResourceId: resource1, - }; - } - } - /* - TODO: all this would be much easier if we were using a hash! - */ - function applyEventDefMutation(eventDef, mutation, context) { - var resourceMutation = mutation.resourceMutation; - if (resourceMutation && computeResourceEditable(eventDef, context)) { - var index = eventDef.resourceIds.indexOf(resourceMutation.matchResourceId); - if (index !== -1) { - var resourceIds = eventDef.resourceIds.slice(); // copy - resourceIds.splice(index, 1); // remove - if (resourceIds.indexOf(resourceMutation.setResourceId) === -1) { // not already in there - resourceIds.push(resourceMutation.setResourceId); // add - } - eventDef.resourceIds = resourceIds; - } - } - } - /* - HACK - TODO: use EventUi system instead of this - */ - function computeResourceEditable(eventDef, context) { - var resourceEditable = eventDef.resourceEditable; - if (resourceEditable == null) { - var source = eventDef.sourceId && context.getCurrentData().eventSources[eventDef.sourceId]; - if (source) { - resourceEditable = source.extendedProps.resourceEditable; // used the Source::extendedProps hack - } - if (resourceEditable == null) { - resourceEditable = context.options.eventResourceEditable; - if (resourceEditable == null) { - resourceEditable = context.options.editable; // TODO: use defaults system instead - } - } - } - return resourceEditable; - } - function transformEventDrop(mutation, context) { - var resourceMutation = mutation.resourceMutation; - if (resourceMutation) { - var calendarApi = context.calendarApi; - return { - oldResource: calendarApi.getResourceById(resourceMutation.matchResourceId), - newResource: calendarApi.getResourceById(resourceMutation.setResourceId), - }; - } - return { - oldResource: null, - newResource: null, - }; - } - - var ResourceDataAdder = /** @class */ (function () { - function ResourceDataAdder() { - this.filterResources = memoize(filterResources); - } - ResourceDataAdder.prototype.transform = function (viewProps, calendarProps) { - if (calendarProps.viewSpec.optionDefaults.needsResourceData) { - return { - resourceStore: this.filterResources(calendarProps.resourceStore, calendarProps.options.filterResourcesWithEvents, calendarProps.eventStore, calendarProps.dateProfile.activeRange), - resourceEntityExpansions: calendarProps.resourceEntityExpansions, - }; - } - return null; - }; - return ResourceDataAdder; - }()); - function filterResources(resourceStore, doFilterResourcesWithEvents, eventStore, activeRange) { - if (doFilterResourcesWithEvents) { - var instancesInRange = filterEventInstancesInRange(eventStore.instances, activeRange); - var hasEvents_1 = computeHasEvents(instancesInRange, eventStore.defs); - __assign(hasEvents_1, computeAncestorHasEvents(hasEvents_1, resourceStore)); - return filterHash(resourceStore, function (resource, resourceId) { return hasEvents_1[resourceId]; }); - } - return resourceStore; - } - function filterEventInstancesInRange(eventInstances, activeRange) { - return filterHash(eventInstances, function (eventInstance) { return rangesIntersect(eventInstance.range, activeRange); }); - } - function computeHasEvents(eventInstances, eventDefs) { - var hasEvents = {}; - for (var instanceId in eventInstances) { - var instance = eventInstances[instanceId]; - for (var _i = 0, _a = eventDefs[instance.defId].resourceIds; _i < _a.length; _i++) { - var resourceId = _a[_i]; - hasEvents[resourceId] = true; - } - } - return hasEvents; - } - /* - mark resources as having events if any of their ancestors have them - NOTE: resourceStore might not have all the resources that hasEvents{} has keyed - */ - function computeAncestorHasEvents(hasEvents, resourceStore) { - var res = {}; - for (var resourceId in hasEvents) { - var resource = void 0; - while ((resource = resourceStore[resourceId])) { - resourceId = resource.parentId; // now functioning as the parentId - if (resourceId) { - res[resourceId] = true; - } - else { - break; - } - } - } - return res; - } - /* - for making sure events that have editable resources are always draggable in resource views - */ - function transformIsDraggable(val, eventDef, eventUi, context) { - if (!val) { - var state = context.getCurrentData(); - var viewSpec = state.viewSpecs[state.currentViewType]; - if (viewSpec.optionDefaults.needsResourceData) { - if (computeResourceEditable(eventDef, context)) { - return true; - } - } - } - return val; - } - - // for when non-resource view should be given EventUi info (for event coloring/constraints based off of resource data) - var ResourceEventConfigAdder = /** @class */ (function () { - function ResourceEventConfigAdder() { - this.buildResourceEventUis = memoize(buildResourceEventUis, isPropsEqual); - this.injectResourceEventUis = memoize(injectResourceEventUis); - } - ResourceEventConfigAdder.prototype.transform = function (viewProps, calendarProps) { - if (!calendarProps.viewSpec.optionDefaults.needsResourceData) { - return { - eventUiBases: this.injectResourceEventUis(viewProps.eventUiBases, viewProps.eventStore.defs, this.buildResourceEventUis(calendarProps.resourceStore)), - }; - } - return null; - }; - return ResourceEventConfigAdder; - }()); - function buildResourceEventUis(resourceStore) { - return mapHash(resourceStore, function (resource) { return resource.ui; }); - } - function injectResourceEventUis(eventUiBases, eventDefs, resourceEventUis) { - return mapHash(eventUiBases, function (eventUi, defId) { - if (defId) { // not the '' key - return injectResourceEventUi(eventUi, eventDefs[defId], resourceEventUis); - } - return eventUi; - }); - } - function injectResourceEventUi(origEventUi, eventDef, resourceEventUis) { - var parts = []; - // first resource takes precedence, which fights with the ordering of combineEventUis, thus the unshifts - for (var _i = 0, _a = eventDef.resourceIds; _i < _a.length; _i++) { - var resourceId = _a[_i]; - if (resourceEventUis[resourceId]) { - parts.unshift(resourceEventUis[resourceId]); - } - } - parts.unshift(origEventUi); - return combineEventUis(parts); - } - - var defs = []; // TODO: use plugin system - function registerResourceSourceDef(def) { - defs.push(def); - } - function getResourceSourceDef(id) { - return defs[id]; - } - function getResourceSourceDefs() { - return defs; - } - - // TODO: make this a plugin-able parser - // TODO: success/failure - var RESOURCE_SOURCE_REFINERS = { - id: String, - // for array. TODO: move to resource-array - resources: identity, - // for json feed. TODO: move to resource-json-feed - url: String, - method: String, - startParam: String, - endParam: String, - timeZoneParam: String, - extraParams: identity, - }; - function parseResourceSource(input) { - var inputObj; - if (typeof input === 'string') { - inputObj = { url: input }; - } - else if (typeof input === 'function' || Array.isArray(input)) { - inputObj = { resources: input }; - } - else if (typeof input === 'object' && input) { // non-null object - inputObj = input; - } - if (inputObj) { - var _a = refineProps(inputObj, RESOURCE_SOURCE_REFINERS), refined = _a.refined, extra = _a.extra; - warnUnknownProps(extra); - var metaRes = buildResourceSourceMeta(refined); - if (metaRes) { - return { - _raw: input, - sourceId: guid(), - sourceDefId: metaRes.sourceDefId, - meta: metaRes.meta, - publicId: refined.id || '', - isFetching: false, - latestFetchId: '', - fetchRange: null, - }; - } - } - return null; - } - function buildResourceSourceMeta(refined) { - var defs = getResourceSourceDefs(); - for (var i = defs.length - 1; i >= 0; i -= 1) { // later-added plugins take precedence - var def = defs[i]; - var meta = def.parseMeta(refined); - if (meta) { - return { meta: meta, sourceDefId: i }; - } - } - return null; - } - function warnUnknownProps(props) { - for (var propName in props) { - console.warn("Unknown resource prop '" + propName + "'"); - } - } - - function reduceResourceSource(source, action, context) { - var options = context.options, dateProfile = context.dateProfile; - if (!source || !action) { - return createSource(options.initialResources || options.resources, dateProfile.activeRange, options.refetchResourcesOnNavigate, context); - } - switch (action.type) { - case 'RESET_RESOURCE_SOURCE': - return createSource(action.resourceSourceInput, dateProfile.activeRange, options.refetchResourcesOnNavigate, context); - case 'PREV': // TODO: how do we track all actions that affect dateProfile :( - case 'NEXT': - case 'CHANGE_DATE': - case 'CHANGE_VIEW_TYPE': - return handleRangeChange(source, dateProfile.activeRange, options.refetchResourcesOnNavigate, context); - case 'RECEIVE_RESOURCES': - case 'RECEIVE_RESOURCE_ERROR': - return receiveResponse$1(source, action.fetchId, action.fetchRange); - case 'REFETCH_RESOURCES': - return fetchSource$1(source, dateProfile.activeRange, context); - default: - return source; - } - } - function createSource(input, activeRange, refetchResourcesOnNavigate, context) { - if (input) { - var source = parseResourceSource(input); - source = fetchSource$1(source, refetchResourcesOnNavigate ? activeRange : null, context); - return source; - } - return null; - } - function handleRangeChange(source, activeRange, refetchResourcesOnNavigate, context) { - if (refetchResourcesOnNavigate && - !doesSourceIgnoreRange(source) && - (!source.fetchRange || !rangesEqual(source.fetchRange, activeRange))) { - return fetchSource$1(source, activeRange, context); - } - return source; - } - function doesSourceIgnoreRange(source) { - return Boolean(getResourceSourceDef(source.sourceDefId).ignoreRange); - } - function fetchSource$1(source, fetchRange, context) { - var sourceDef = getResourceSourceDef(source.sourceDefId); - var fetchId = guid(); - sourceDef.fetch({ - resourceSource: source, - range: fetchRange, - context: context, - }, function (res) { - context.dispatch({ - type: 'RECEIVE_RESOURCES', - fetchId: fetchId, - fetchRange: fetchRange, - rawResources: res.rawResources, - }); - }, function (error) { - context.dispatch({ - type: 'RECEIVE_RESOURCE_ERROR', - fetchId: fetchId, - fetchRange: fetchRange, - error: error, - }); - }); - return __assign(__assign({}, source), { isFetching: true, latestFetchId: fetchId }); - } - function receiveResponse$1(source, fetchId, fetchRange) { - if (fetchId === source.latestFetchId) { - return __assign(__assign({}, source), { isFetching: false, fetchRange: fetchRange }); - } - return source; - } - - var PRIVATE_ID_PREFIX = '_fc:'; - var RESOURCE_REFINERS = { - id: String, - parentId: String, - children: identity, - title: String, - businessHours: identity, - extendedProps: identity, - // event-ui - eventEditable: Boolean, - eventStartEditable: Boolean, - eventDurationEditable: Boolean, - eventConstraint: identity, - eventOverlap: Boolean, - eventAllow: identity, - eventClassNames: parseClassNames, - eventBackgroundColor: String, - eventBorderColor: String, - eventTextColor: String, - eventColor: String, - }; - /* - needs a full store so that it can populate children too - */ - function parseResource(raw, parentId, store, context) { - if (parentId === void 0) { parentId = ''; } - var _a = refineProps(raw, RESOURCE_REFINERS), refined = _a.refined, extra = _a.extra; - var resource = { - id: refined.id || (PRIVATE_ID_PREFIX + guid()), - parentId: refined.parentId || parentId, - title: refined.title || '', - businessHours: refined.businessHours ? parseBusinessHours(refined.businessHours, context) : null, - ui: createEventUi({ - editable: refined.eventEditable, - startEditable: refined.eventStartEditable, - durationEditable: refined.eventDurationEditable, - constraint: refined.eventConstraint, - overlap: refined.eventOverlap, - allow: refined.eventAllow, - classNames: refined.eventClassNames, - backgroundColor: refined.eventBackgroundColor, - borderColor: refined.eventBorderColor, - textColor: refined.eventTextColor, - color: refined.eventColor, - }, context), - extendedProps: __assign(__assign({}, extra), refined.extendedProps), - }; - // help out ResourceApi from having user modify props - Object.freeze(resource.ui.classNames); - Object.freeze(resource.extendedProps); - if (store[resource.id]) ; - else { - store[resource.id] = resource; - if (refined.children) { - for (var _i = 0, _b = refined.children; _i < _b.length; _i++) { - var childInput = _b[_i]; - parseResource(childInput, resource.id, store, context); - } - } - } - return resource; - } - /* - TODO: use this in more places - */ - function getPublicId(id) { - if (id.indexOf(PRIVATE_ID_PREFIX) === 0) { - return ''; - } - return id; - } - - function reduceResourceStore(store, action, source, context) { - if (!store || !action) { - return {}; - } - switch (action.type) { - case 'RECEIVE_RESOURCES': - return receiveRawResources(store, action.rawResources, action.fetchId, source, context); - case 'ADD_RESOURCE': - return addResource(store, action.resourceHash); - case 'REMOVE_RESOURCE': - return removeResource(store, action.resourceId); - case 'SET_RESOURCE_PROP': - return setResourceProp(store, action.resourceId, action.propName, action.propValue); - case 'SET_RESOURCE_EXTENDED_PROP': - return setResourceExtendedProp(store, action.resourceId, action.propName, action.propValue); - default: - return store; - } - } - function receiveRawResources(existingStore, inputs, fetchId, source, context) { - if (source.latestFetchId === fetchId) { - var nextStore = {}; - for (var _i = 0, inputs_1 = inputs; _i < inputs_1.length; _i++) { - var input = inputs_1[_i]; - parseResource(input, '', nextStore, context); - } - return nextStore; - } - return existingStore; - } - function addResource(existingStore, additions) { - // TODO: warn about duplicate IDs - return __assign(__assign({}, existingStore), additions); - } - function removeResource(existingStore, resourceId) { - var newStore = __assign({}, existingStore); - delete newStore[resourceId]; - // promote children - for (var childResourceId in newStore) { // a child, *maybe* but probably not - if (newStore[childResourceId].parentId === resourceId) { - newStore[childResourceId] = __assign(__assign({}, newStore[childResourceId]), { parentId: '' }); - } - } - return newStore; - } - function setResourceProp(existingStore, resourceId, name, value) { - var _a, _b; - var existingResource = existingStore[resourceId]; - // TODO: sanitization - if (existingResource) { - return __assign(__assign({}, existingStore), (_a = {}, _a[resourceId] = __assign(__assign({}, existingResource), (_b = {}, _b[name] = value, _b)), _a)); - } - return existingStore; - } - function setResourceExtendedProp(existingStore, resourceId, name, value) { - var _a, _b; - var existingResource = existingStore[resourceId]; - if (existingResource) { - return __assign(__assign({}, existingStore), (_a = {}, _a[resourceId] = __assign(__assign({}, existingResource), { extendedProps: __assign(__assign({}, existingResource.extendedProps), (_b = {}, _b[name] = value, _b)) }), _a)); - } - return existingStore; - } - - function reduceResourceEntityExpansions(expansions, action) { - var _a; - if (!expansions || !action) { - return {}; - } - switch (action.type) { - case 'SET_RESOURCE_ENTITY_EXPANDED': - return __assign(__assign({}, expansions), (_a = {}, _a[action.id] = action.isExpanded, _a)); - default: - return expansions; - } - } - - function reduceResources(state, action, context) { - var resourceSource = reduceResourceSource(state && state.resourceSource, action, context); - var resourceStore = reduceResourceStore(state && state.resourceStore, action, resourceSource, context); - var resourceEntityExpansions = reduceResourceEntityExpansions(state && state.resourceEntityExpansions, action); - return { - resourceSource: resourceSource, - resourceStore: resourceStore, - resourceEntityExpansions: resourceEntityExpansions, - }; - } - - var EVENT_REFINERS$1 = { - resourceId: String, - resourceIds: identity, - resourceEditable: Boolean, - }; - function generateEventDefResourceMembers(refined) { - return { - resourceIds: ensureStringArray(refined.resourceIds) - .concat(refined.resourceId ? [refined.resourceId] : []), - resourceEditable: refined.resourceEditable, - }; - } - function ensureStringArray(items) { - return (items || []).map(function (item) { return String(item); }); - } - - function transformDateSelectionJoin(hit0, hit1) { - var resourceId0 = hit0.dateSpan.resourceId; - var resourceId1 = hit1.dateSpan.resourceId; - if (resourceId0 && resourceId1) { - if (hit0.component.allowAcrossResources === false && - resourceId0 !== resourceId1) { - return false; - } - return { resourceId: resourceId0 }; - } - return null; - } - - var ResourceApi = /** @class */ (function () { - function ResourceApi(_context, _resource) { - this._context = _context; - this._resource = _resource; - } - ResourceApi.prototype.setProp = function (name, value) { - var oldResource = this._resource; - this._context.dispatch({ - type: 'SET_RESOURCE_PROP', - resourceId: oldResource.id, - propName: name, - propValue: value, - }); - this.sync(oldResource); - }; - ResourceApi.prototype.setExtendedProp = function (name, value) { - var oldResource = this._resource; - this._context.dispatch({ - type: 'SET_RESOURCE_EXTENDED_PROP', - resourceId: oldResource.id, - propName: name, - propValue: value, - }); - this.sync(oldResource); - }; - ResourceApi.prototype.sync = function (oldResource) { - var context = this._context; - var resourceId = oldResource.id; - // TODO: what if dispatch didn't complete synchronously? - this._resource = context.getCurrentData().resourceStore[resourceId]; - context.emitter.trigger('resourceChange', { - oldResource: new ResourceApi(context, oldResource), - resource: this, - revert: function () { - var _a; - context.dispatch({ - type: 'ADD_RESOURCE', - resourceHash: (_a = {}, - _a[resourceId] = oldResource, - _a), - }); - }, - }); - }; - ResourceApi.prototype.remove = function () { - var context = this._context; - var internalResource = this._resource; - var resourceId = internalResource.id; - context.dispatch({ - type: 'REMOVE_RESOURCE', - resourceId: resourceId, - }); - context.emitter.trigger('resourceRemove', { - resource: this, - revert: function () { - var _a; - context.dispatch({ - type: 'ADD_RESOURCE', - resourceHash: (_a = {}, - _a[resourceId] = internalResource, - _a), - }); - }, - }); - }; - ResourceApi.prototype.getParent = function () { - var context = this._context; - var parentId = this._resource.parentId; - if (parentId) { - return new ResourceApi(context, context.getCurrentData().resourceSource[parentId]); - } - return null; - }; - ResourceApi.prototype.getChildren = function () { - var thisResourceId = this._resource.id; - var context = this._context; - var resourceStore = context.getCurrentData().resourceStore; - var childApis = []; - for (var resourceId in resourceStore) { - if (resourceStore[resourceId].parentId === thisResourceId) { - childApis.push(new ResourceApi(context, resourceStore[resourceId])); - } - } - return childApis; - }; - /* - this is really inefficient! - TODO: make EventApi::resourceIds a hash or keep an index in the Calendar's state - */ - ResourceApi.prototype.getEvents = function () { - var thisResourceId = this._resource.id; - var context = this._context; - var _a = context.getCurrentData().eventStore, defs = _a.defs, instances = _a.instances; - var eventApis = []; - for (var instanceId in instances) { - var instance = instances[instanceId]; - var def = defs[instance.defId]; - if (def.resourceIds.indexOf(thisResourceId) !== -1) { // inefficient!!! - eventApis.push(new EventApi(context, def, instance)); - } - } - return eventApis; - }; - Object.defineProperty(ResourceApi.prototype, "id", { - get: function () { return getPublicId(this._resource.id); }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ResourceApi.prototype, "title", { - get: function () { return this._resource.title; }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ResourceApi.prototype, "eventConstraint", { - get: function () { return this._resource.ui.constraints[0] || null; }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ResourceApi.prototype, "eventOverlap", { - get: function () { return this._resource.ui.overlap; }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ResourceApi.prototype, "eventAllow", { - get: function () { return this._resource.ui.allows[0] || null; }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ResourceApi.prototype, "eventBackgroundColor", { - get: function () { return this._resource.ui.backgroundColor; }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ResourceApi.prototype, "eventBorderColor", { - get: function () { return this._resource.ui.borderColor; }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ResourceApi.prototype, "eventTextColor", { - get: function () { return this._resource.ui.textColor; }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ResourceApi.prototype, "eventClassNames", { - // NOTE: user can't modify these because Object.freeze was called in event-def parsing - get: function () { return this._resource.ui.classNames; }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ResourceApi.prototype, "extendedProps", { - get: function () { return this._resource.extendedProps; }, - enumerable: false, - configurable: true - }); - ResourceApi.prototype.toPlainObject = function (settings) { - if (settings === void 0) { settings = {}; } - var internal = this._resource; - var ui = internal.ui; - var publicId = this.id; - var res = {}; - if (publicId) { - res.id = publicId; - } - if (internal.title) { - res.title = internal.title; - } - if (settings.collapseEventColor && ui.backgroundColor && ui.backgroundColor === ui.borderColor) { - res.eventColor = ui.backgroundColor; - } - else { - if (ui.backgroundColor) { - res.eventBackgroundColor = ui.backgroundColor; - } - if (ui.borderColor) { - res.eventBorderColor = ui.borderColor; - } - } - if (ui.textColor) { - res.eventTextColor = ui.textColor; - } - if (ui.classNames.length) { - res.eventClassNames = ui.classNames; - } - if (Object.keys(internal.extendedProps).length) { - if (settings.collapseExtendedProps) { - __assign(res, internal.extendedProps); - } - else { - res.extendedProps = internal.extendedProps; - } - } - return res; - }; - ResourceApi.prototype.toJSON = function () { - return this.toPlainObject(); - }; - return ResourceApi; - }()); - function buildResourceApis(resourceStore, context) { - var resourceApis = []; - for (var resourceId in resourceStore) { - resourceApis.push(new ResourceApi(context, resourceStore[resourceId])); - } - return resourceApis; - } - - CalendarApi.prototype.addResource = function (input, scrollTo) { - var _a; - var _this = this; - if (scrollTo === void 0) { scrollTo = true; } - var currentState = this.getCurrentData(); - var resourceHash; - var resource; - if (input instanceof ResourceApi) { - resource = input._resource; - resourceHash = (_a = {}, _a[resource.id] = resource, _a); - } - else { - resourceHash = {}; - resource = parseResource(input, '', resourceHash, currentState); - } - this.dispatch({ - type: 'ADD_RESOURCE', - resourceHash: resourceHash, - }); - if (scrollTo) { - // TODO: wait til dispatch completes somehow - this.trigger('_scrollRequest', { resourceId: resource.id }); - } - var resourceApi = new ResourceApi(currentState, resource); - currentState.emitter.trigger('resourceAdd', { - resource: resourceApi, - revert: function () { - _this.dispatch({ - type: 'REMOVE_RESOURCE', - resourceId: resource.id, - }); - }, - }); - return resourceApi; - }; - CalendarApi.prototype.getResourceById = function (id) { - id = String(id); - var currentState = this.getCurrentData(); // eslint-disable-line react/no-this-in-sfc - if (currentState.resourceStore) { // guard against calendar with no resource functionality - var rawResource = currentState.resourceStore[id]; - if (rawResource) { - return new ResourceApi(currentState, rawResource); - } - } - return null; - }; - CalendarApi.prototype.getResources = function () { - var currentState = this.getCurrentData(); - var resourceStore = currentState.resourceStore; - var resourceApis = []; - if (resourceStore) { // guard against calendar with no resource functionality - for (var resourceId in resourceStore) { - resourceApis.push(new ResourceApi(currentState, resourceStore[resourceId])); - } - } - return resourceApis; - }; - CalendarApi.prototype.getTopLevelResources = function () { - var currentState = this.getCurrentData(); - var resourceStore = currentState.resourceStore; - var resourceApis = []; - if (resourceStore) { // guard against calendar with no resource functionality - for (var resourceId in resourceStore) { - if (!resourceStore[resourceId].parentId) { - resourceApis.push(new ResourceApi(currentState, resourceStore[resourceId])); - } - } - } - return resourceApis; - }; - CalendarApi.prototype.refetchResources = function () { - this.dispatch({ - type: 'REFETCH_RESOURCES', - }); - }; - function transformDatePoint(dateSpan, context) { - return dateSpan.resourceId ? - { resource: context.calendarApi.getResourceById(dateSpan.resourceId) } : - {}; - } - function transformDateSpan(dateSpan, context) { - return dateSpan.resourceId ? - { resource: context.calendarApi.getResourceById(dateSpan.resourceId) } : - {}; - } - - /* - splits things BASED OFF OF which resources they are associated with. - creates a '' entry which is when something has NO resource. - */ - var ResourceSplitter = /** @class */ (function (_super) { - __extends(ResourceSplitter, _super); - function ResourceSplitter() { - return _super !== null && _super.apply(this, arguments) || this; - } - ResourceSplitter.prototype.getKeyInfo = function (props) { - return __assign({ '': {} }, props.resourceStore); - }; - ResourceSplitter.prototype.getKeysForDateSpan = function (dateSpan) { - return [dateSpan.resourceId || '']; - }; - ResourceSplitter.prototype.getKeysForEventDef = function (eventDef) { - var resourceIds = eventDef.resourceIds; - if (!resourceIds.length) { - return ['']; - } - return resourceIds; - }; - return ResourceSplitter; - }(Splitter)); - - function isPropsValidWithResources(combinedProps, context) { - var splitter = new ResourceSplitter(); - var sets = splitter.splitProps(__assign(__assign({}, combinedProps), { resourceStore: context.getCurrentData().resourceStore })); - for (var resourceId in sets) { - var props = sets[resourceId]; - // merge in event data from the non-resource segment - if (resourceId && sets['']) { // current segment is not the non-resource one, and there IS a non-resource one - props = __assign(__assign({}, props), { eventStore: mergeEventStores(sets[''].eventStore, props.eventStore), eventUiBases: __assign(__assign({}, sets[''].eventUiBases), props.eventUiBases) }); - } - if (!isPropsValid(props, context, { resourceId: resourceId }, filterConfig.bind(null, resourceId))) { - return false; - } - } - return true; - } - function filterConfig(resourceId, config) { - return __assign(__assign({}, config), { constraints: filterConstraints(resourceId, config.constraints) }); - } - function filterConstraints(resourceId, constraints) { - return constraints.map(function (constraint) { - var defs = constraint.defs; - if (defs) { // we are dealing with an EventStore - // if any of the events define constraints to resources that are NOT this resource, - // then this resource is unconditionally prohibited, which is what a `false` value does. - for (var defId in defs) { - var resourceIds = defs[defId].resourceIds; - if (resourceIds.length && resourceIds.indexOf(resourceId) === -1) { // TODO: use a hash?!!! (for other reasons too) - return false; - } - } - } - return constraint; - }); - } - - function transformExternalDef(dateSpan) { - return dateSpan.resourceId ? - { resourceId: dateSpan.resourceId } : - {}; - } - - function transformEventResizeJoin(hit0, hit1) { - var component = hit0.component; - if (component.allowAcrossResources === false && - hit0.dateSpan.resourceId !== hit1.dateSpan.resourceId) { - return false; - } - return null; - } - - EventApi.prototype.getResources = function () { - var calendarApi = this._context.calendarApi; - return this._def.resourceIds.map(function (resourceId) { return calendarApi.getResourceById(resourceId); }); - }; - EventApi.prototype.setResources = function (resources) { - var resourceIds = []; - // massage resources -> resourceIds - for (var _i = 0, resources_1 = resources; _i < resources_1.length; _i++) { - var resource = resources_1[_i]; - var resourceId = null; - if (typeof resource === 'string') { - resourceId = resource; - } - else if (typeof resource === 'number') { - resourceId = String(resource); - } - else if (resource instanceof ResourceApi) { - resourceId = resource.id; // guaranteed to always have an ID. hmmm - } - else { - console.warn('unknown resource type: ' + resource); - } - if (resourceId) { - resourceIds.push(resourceId); - } - } - this.mutate({ - standardProps: { - resourceIds: resourceIds, - }, - }); - }; - - var optionChangeHandlers = { - resources: handleResources, - }; - function handleResources(newSourceInput, context) { - var oldSourceInput = context.getCurrentData().resourceSource._raw; - if (oldSourceInput !== newSourceInput) { - context.dispatch({ - type: 'RESET_RESOURCE_SOURCE', - resourceSourceInput: newSourceInput, - }); - } - } - - var DEFAULT_RESOURCE_ORDER = parseFieldSpecs('id,title'); - function handleResourceStore(resourceStore, calendarData) { - var emitter = calendarData.emitter; - if (emitter.hasHandlers('resourcesSet')) { - emitter.trigger('resourcesSet', buildResourceApis(resourceStore, calendarData)); - } - } - - var OPTION_REFINERS$6 = { - initialResources: identity, - resources: identity, - eventResourceEditable: Boolean, - refetchResourcesOnNavigate: Boolean, - resourceOrder: parseFieldSpecs, - filterResourcesWithEvents: Boolean, - resourceGroupField: String, - resourceAreaWidth: identity, - resourceAreaColumns: identity, - resourcesInitiallyExpanded: Boolean, - datesAboveResources: Boolean, - needsResourceData: Boolean, - resourceAreaHeaderClassNames: identity, - resourceAreaHeaderContent: identity, - resourceAreaHeaderDidMount: identity, - resourceAreaHeaderWillUnmount: identity, - resourceGroupLabelClassNames: identity, - resourceGroupLabelContent: identity, - resourceGroupLabelDidMount: identity, - resourceGroupLabelWillUnmount: identity, - resourceLabelClassNames: identity, - resourceLabelContent: identity, - resourceLabelDidMount: identity, - resourceLabelWillUnmount: identity, - resourceLaneClassNames: identity, - resourceLaneContent: identity, - resourceLaneDidMount: identity, - resourceLaneWillUnmount: identity, - resourceGroupLaneClassNames: identity, - resourceGroupLaneContent: identity, - resourceGroupLaneDidMount: identity, - resourceGroupLaneWillUnmount: identity, - }; - var LISTENER_REFINERS$1 = { - resourcesSet: identity, - resourceAdd: identity, - resourceChange: identity, - resourceRemove: identity, - }; - - registerResourceSourceDef({ - ignoreRange: true, - parseMeta: function (refined) { - if (Array.isArray(refined.resources)) { - return refined.resources; - } - return null; - }, - fetch: function (arg, successCallback) { - successCallback({ - rawResources: arg.resourceSource.meta, - }); - }, - }); - - registerResourceSourceDef({ - parseMeta: function (refined) { - if (typeof refined.resources === 'function') { - return refined.resources; - } - return null; - }, - fetch: function (arg, success, failure) { - var dateEnv = arg.context.dateEnv; - var func = arg.resourceSource.meta; - var publicArg = arg.range ? { - start: dateEnv.toDate(arg.range.start), - end: dateEnv.toDate(arg.range.end), - startStr: dateEnv.formatIso(arg.range.start), - endStr: dateEnv.formatIso(arg.range.end), - timeZone: dateEnv.timeZone, - } : {}; - // TODO: make more dry with EventSourceFunc - // TODO: accept a response? - unpromisify(func.bind(null, publicArg), function (rawResources) { - success({ rawResources: rawResources }); // needs an object response - }, failure); - }, - }); - - registerResourceSourceDef({ - parseMeta: function (refined) { - if (refined.url) { - return { - url: refined.url, - method: (refined.method || 'GET').toUpperCase(), - extraParams: refined.extraParams, - }; - } - return null; - }, - fetch: function (arg, successCallback, failureCallback) { - var meta = arg.resourceSource.meta; - var requestParams = buildRequestParams$2(meta, arg.range, arg.context); - requestJson(meta.method, meta.url, requestParams, function (rawResources, xhr) { - successCallback({ rawResources: rawResources, xhr: xhr }); - }, function (message, xhr) { - failureCallback({ message: message, xhr: xhr }); - }); - }, - }); - // TODO: somehow consolidate with event json feed - function buildRequestParams$2(meta, range, context) { - var dateEnv = context.dateEnv, options = context.options; - var startParam; - var endParam; - var timeZoneParam; - var customRequestParams; - var params = {}; - if (range) { - startParam = meta.startParam; - if (startParam == null) { - startParam = options.startParam; - } - endParam = meta.endParam; - if (endParam == null) { - endParam = options.endParam; - } - timeZoneParam = meta.timeZoneParam; - if (timeZoneParam == null) { - timeZoneParam = options.timeZoneParam; - } - params[startParam] = dateEnv.formatIso(range.start); - params[endParam] = dateEnv.formatIso(range.end); - if (dateEnv.timeZone !== 'local') { - params[timeZoneParam] = dateEnv.timeZone; - } - } - // retrieve any outbound GET/POST data from the options - if (typeof meta.extraParams === 'function') { - // supplied as a function that returns a key/value object - customRequestParams = meta.extraParams(); - } - else { - // probably supplied as a straight key/value object - customRequestParams = meta.extraParams || {}; - } - __assign(params, customRequestParams); - return params; - } - - // TODO: not used for Spreadsheet. START USING. difficult because of col-specific rendering props - function ResourceLabelRoot(props) { - return (createElement(ViewContextType.Consumer, null, function (context) { - var options = context.options; - var hookProps = { - resource: new ResourceApi(context, props.resource), - date: props.date ? context.dateEnv.toDate(props.date) : null, - view: context.viewApi, - }; - var dataAttrs = { - 'data-resource-id': props.resource.id, - 'data-date': props.date ? formatDayString(props.date) : undefined, - }; - return (createElement(RenderHook, { hookProps: hookProps, classNames: options.resourceLabelClassNames, content: options.resourceLabelContent, defaultContent: renderInnerContent$6, didMount: options.resourceLabelDidMount, willUnmount: options.resourceLabelWillUnmount }, function (rootElRef, classNames, innerElRef, innerContent) { return props.children(rootElRef, classNames, // TODO: pass in 'fc-resource' ? - dataAttrs, innerElRef, innerContent); })); - })); - } - function renderInnerContent$6(props) { - return props.resource.title || props.resource.id; - } - - var ResourceCell = /** @class */ (function (_super) { - __extends(ResourceCell, _super); - function ResourceCell() { - return _super !== null && _super.apply(this, arguments) || this; - } - ResourceCell.prototype.render = function () { - var props = this.props; - return (createElement(ResourceLabelRoot, { resource: props.resource, date: props.date }, function (elRef, customClassNames, dataAttrs, innerElRef, innerContent) { return (createElement("th", __assign({ ref: elRef, className: ['fc-col-header-cell', 'fc-resource'].concat(customClassNames).join(' '), colSpan: props.colSpan }, dataAttrs), - createElement("div", { className: "fc-scrollgrid-sync-inner" }, - createElement("span", { className: [ - 'fc-col-header-cell-cushion', - props.isSticky ? 'fc-sticky' : '', - ].join(' '), ref: innerElRef }, innerContent)))); })); - }; - return ResourceCell; - }(BaseComponent)); - - var ResourceDayHeader = /** @class */ (function (_super) { - __extends(ResourceDayHeader, _super); - function ResourceDayHeader() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.buildDateFormat = memoize(buildDateFormat); - return _this; - } - ResourceDayHeader.prototype.render = function () { - var _this = this; - var _a = this, props = _a.props, context = _a.context; - var dateFormat = this.buildDateFormat(context.options.dayHeaderFormat, props.datesRepDistinctDays, props.dates.length); - return (createElement(NowTimer, { unit: "day" }, function (nowDate, todayRange) { - if (props.dates.length === 1) { - return _this.renderResourceRow(props.resources, props.dates[0]); - } - if (context.options.datesAboveResources) { - return _this.renderDayAndResourceRows(props.dates, dateFormat, todayRange, props.resources); - } - return _this.renderResourceAndDayRows(props.resources, props.dates, dateFormat, todayRange); - })); - }; - ResourceDayHeader.prototype.renderResourceRow = function (resources, date) { - var resourceCells = resources.map(function (resource) { return (createElement(ResourceCell, { key: resource.id, resource: resource, colSpan: 1, date: date })); }); - return this.buildTr(resourceCells, 'resources'); - }; - ResourceDayHeader.prototype.renderDayAndResourceRows = function (dates, dateFormat, todayRange, resources) { - var dateCells = []; - var resourceCells = []; - for (var _i = 0, dates_1 = dates; _i < dates_1.length; _i++) { - var date = dates_1[_i]; - dateCells.push(this.renderDateCell(date, dateFormat, todayRange, resources.length, null, true)); - for (var _a = 0, resources_1 = resources; _a < resources_1.length; _a++) { - var resource = resources_1[_a]; - resourceCells.push(createElement(ResourceCell, { key: resource.id + ':' + date.toISOString(), resource: resource, colSpan: 1, date: date })); - } - } - return (createElement(Fragment, null, - this.buildTr(dateCells, 'day'), - this.buildTr(resourceCells, 'resources'))); - }; - ResourceDayHeader.prototype.renderResourceAndDayRows = function (resources, dates, dateFormat, todayRange) { - var resourceCells = []; - var dateCells = []; - for (var _i = 0, resources_2 = resources; _i < resources_2.length; _i++) { - var resource = resources_2[_i]; - resourceCells.push(createElement(ResourceCell, { key: resource.id, resource: resource, colSpan: dates.length, isSticky: true })); - for (var _a = 0, dates_2 = dates; _a < dates_2.length; _a++) { - var date = dates_2[_a]; - dateCells.push(this.renderDateCell(date, dateFormat, todayRange, 1, resource)); - } - } - return (createElement(Fragment, null, - this.buildTr(resourceCells, 'resources'), - this.buildTr(dateCells, 'day'))); - }; - // a cell with date text. might have a resource associated with it - ResourceDayHeader.prototype.renderDateCell = function (date, dateFormat, todayRange, colSpan, resource, isSticky) { - var props = this.props; - var keyPostfix = resource ? ":" + resource.id : ''; - var extraHookProps = resource ? { resource: new ResourceApi(this.context, resource) } : {}; - var extraDataAttrs = resource ? { 'data-resource-id': resource.id } : {}; - return props.datesRepDistinctDays ? (createElement(TableDateCell, { key: date.toISOString() + keyPostfix, date: date, dateProfile: props.dateProfile, todayRange: todayRange, colCnt: props.dates.length * props.resources.length, dayHeaderFormat: dateFormat, colSpan: colSpan, isSticky: isSticky, extraHookProps: extraHookProps, extraDataAttrs: extraDataAttrs })) : (createElement(TableDowCell // we can't leverage the pure-componentness becausae the extra* props are new every time :( - , { key: date.getUTCDay() + keyPostfix, dow: date.getUTCDay(), dayHeaderFormat: dateFormat, colSpan: colSpan, isSticky: isSticky, extraHookProps: extraHookProps, extraDataAttrs: extraDataAttrs })); - }; - ResourceDayHeader.prototype.buildTr = function (cells, key) { - var renderIntro = this.props.renderIntro; - if (!cells.length) { - cells = [createElement("td", { key: 0 }, "\u00A0")]; - } - return (createElement("tr", { key: key }, - renderIntro && renderIntro(key), - cells)); - }; - return ResourceDayHeader; - }(BaseComponent)); - function buildDateFormat(dayHeaderFormat, datesRepDistinctDays, dayCnt) { - return dayHeaderFormat || computeFallbackHeaderFormat(datesRepDistinctDays, dayCnt); - } - - var ResourceIndex = /** @class */ (function () { - function ResourceIndex(resources) { - var indicesById = {}; - var ids = []; - for (var i = 0; i < resources.length; i += 1) { - var id = resources[i].id; - ids.push(id); - indicesById[id] = i; - } - this.ids = ids; - this.indicesById = indicesById; - this.length = resources.length; - } - return ResourceIndex; - }()); - - var AbstractResourceDayTableModel = /** @class */ (function () { - function AbstractResourceDayTableModel(dayTableModel, resources, context) { - this.dayTableModel = dayTableModel; - this.resources = resources; - this.context = context; - this.resourceIndex = new ResourceIndex(resources); - this.rowCnt = dayTableModel.rowCnt; - this.colCnt = dayTableModel.colCnt * resources.length; - this.cells = this.buildCells(); - } - AbstractResourceDayTableModel.prototype.buildCells = function () { - var _a = this, rowCnt = _a.rowCnt, dayTableModel = _a.dayTableModel, resources = _a.resources; - var rows = []; - for (var row = 0; row < rowCnt; row += 1) { - var rowCells = []; - for (var dateCol = 0; dateCol < dayTableModel.colCnt; dateCol += 1) { - for (var resourceCol = 0; resourceCol < resources.length; resourceCol += 1) { - var resource = resources[resourceCol]; - var extraHookProps = { resource: new ResourceApi(this.context, resource) }; - var extraDataAttrs = { 'data-resource-id': resource.id }; - var extraClassNames = ['fc-resource']; - var date = dayTableModel.cells[row][dateCol].date; - rowCells[this.computeCol(dateCol, resourceCol)] = { - key: resource.id + ':' + date.toISOString(), - date: date, - resource: resource, - extraHookProps: extraHookProps, - extraDataAttrs: extraDataAttrs, - extraClassNames: extraClassNames, - }; - } - } - rows.push(rowCells); - } - return rows; - }; - return AbstractResourceDayTableModel; - }()); - - /* - resources over dates - */ - var ResourceDayTableModel = /** @class */ (function (_super) { - __extends(ResourceDayTableModel, _super); - function ResourceDayTableModel() { - return _super !== null && _super.apply(this, arguments) || this; - } - ResourceDayTableModel.prototype.computeCol = function (dateI, resourceI) { - return resourceI * this.dayTableModel.colCnt + dateI; - }; - /* - all date ranges are intact - */ - ResourceDayTableModel.prototype.computeColRanges = function (dateStartI, dateEndI, resourceI) { - return [ - { - firstCol: this.computeCol(dateStartI, resourceI), - lastCol: this.computeCol(dateEndI, resourceI), - isStart: true, - isEnd: true, - }, - ]; - }; - return ResourceDayTableModel; - }(AbstractResourceDayTableModel)); - - /* - dates over resources - */ - var DayResourceTableModel = /** @class */ (function (_super) { - __extends(DayResourceTableModel, _super); - function DayResourceTableModel() { - return _super !== null && _super.apply(this, arguments) || this; - } - DayResourceTableModel.prototype.computeCol = function (dateI, resourceI) { - return dateI * this.resources.length + resourceI; - }; - /* - every single day is broken up - */ - DayResourceTableModel.prototype.computeColRanges = function (dateStartI, dateEndI, resourceI) { - var segs = []; - for (var i = dateStartI; i <= dateEndI; i += 1) { - var col = this.computeCol(i, resourceI); - segs.push({ - firstCol: col, - lastCol: col, - isStart: i === dateStartI, - isEnd: i === dateEndI, - }); - } - return segs; - }; - return DayResourceTableModel; - }(AbstractResourceDayTableModel)); - - var NO_SEGS = []; // for memoizing - var VResourceJoiner = /** @class */ (function () { - function VResourceJoiner() { - this.joinDateSelection = memoize(this.joinSegs); - this.joinBusinessHours = memoize(this.joinSegs); - this.joinFgEvents = memoize(this.joinSegs); - this.joinBgEvents = memoize(this.joinSegs); - this.joinEventDrags = memoize(this.joinInteractions); - this.joinEventResizes = memoize(this.joinInteractions); - } - /* - propSets also has a '' key for things with no resource - */ - VResourceJoiner.prototype.joinProps = function (propSets, resourceDayTable) { - var dateSelectionSets = []; - var businessHoursSets = []; - var fgEventSets = []; - var bgEventSets = []; - var eventDrags = []; - var eventResizes = []; - var eventSelection = ''; - var keys = resourceDayTable.resourceIndex.ids.concat(['']); // add in the all-resource key - for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) { - var key = keys_1[_i]; - var props = propSets[key]; - dateSelectionSets.push(props.dateSelectionSegs); - businessHoursSets.push(key ? props.businessHourSegs : NO_SEGS); // don't include redundant all-resource businesshours - fgEventSets.push(key ? props.fgEventSegs : NO_SEGS); // don't include fg all-resource segs - bgEventSets.push(props.bgEventSegs); - eventDrags.push(props.eventDrag); - eventResizes.push(props.eventResize); - eventSelection = eventSelection || props.eventSelection; - } - return { - dateSelectionSegs: this.joinDateSelection.apply(this, __spreadArrays([resourceDayTable], dateSelectionSets)), - businessHourSegs: this.joinBusinessHours.apply(this, __spreadArrays([resourceDayTable], businessHoursSets)), - fgEventSegs: this.joinFgEvents.apply(this, __spreadArrays([resourceDayTable], fgEventSets)), - bgEventSegs: this.joinBgEvents.apply(this, __spreadArrays([resourceDayTable], bgEventSets)), - eventDrag: this.joinEventDrags.apply(this, __spreadArrays([resourceDayTable], eventDrags)), - eventResize: this.joinEventResizes.apply(this, __spreadArrays([resourceDayTable], eventResizes)), - eventSelection: eventSelection, - }; - }; - VResourceJoiner.prototype.joinSegs = function (resourceDayTable) { - var segGroups = []; - for (var _i = 1; _i < arguments.length; _i++) { - segGroups[_i - 1] = arguments[_i]; - } - var resourceCnt = resourceDayTable.resources.length; - var transformedSegs = []; - for (var i = 0; i < resourceCnt; i += 1) { - for (var _a = 0, _b = segGroups[i]; _a < _b.length; _a++) { - var seg = _b[_a]; - transformedSegs.push.apply(transformedSegs, this.transformSeg(seg, resourceDayTable, i)); - } - for (var _c = 0, _d = segGroups[resourceCnt]; _c < _d.length; _c++) { // one beyond. the all-resource - var seg = _d[_c]; - transformedSegs.push.apply(// one beyond. the all-resource - transformedSegs, this.transformSeg(seg, resourceDayTable, i)); - } - } - return transformedSegs; - }; - /* - for expanding non-resource segs to all resources. - only for public use. - no memoizing. - */ - VResourceJoiner.prototype.expandSegs = function (resourceDayTable, segs) { - var resourceCnt = resourceDayTable.resources.length; - var transformedSegs = []; - for (var i = 0; i < resourceCnt; i += 1) { - for (var _i = 0, segs_1 = segs; _i < segs_1.length; _i++) { - var seg = segs_1[_i]; - transformedSegs.push.apply(transformedSegs, this.transformSeg(seg, resourceDayTable, i)); - } - } - return transformedSegs; - }; - VResourceJoiner.prototype.joinInteractions = function (resourceDayTable) { - var interactions = []; - for (var _i = 1; _i < arguments.length; _i++) { - interactions[_i - 1] = arguments[_i]; - } - var resourceCnt = resourceDayTable.resources.length; - var affectedInstances = {}; - var transformedSegs = []; - var anyInteractions = false; - var isEvent = false; - for (var i = 0; i < resourceCnt; i += 1) { - var interaction = interactions[i]; - if (interaction) { - anyInteractions = true; - for (var _a = 0, _b = interaction.segs; _a < _b.length; _a++) { - var seg = _b[_a]; - transformedSegs.push.apply(transformedSegs, this.transformSeg(seg, resourceDayTable, i)); - } - __assign(affectedInstances, interaction.affectedInstances); - isEvent = isEvent || interaction.isEvent; - } - if (interactions[resourceCnt]) { // one beyond. the all-resource - for (var _c = 0, _d = interactions[resourceCnt].segs; _c < _d.length; _c++) { - var seg = _d[_c]; - transformedSegs.push.apply(transformedSegs, this.transformSeg(seg, resourceDayTable, i)); - } - } - } - if (anyInteractions) { - return { - affectedInstances: affectedInstances, - segs: transformedSegs, - isEvent: isEvent, - }; - } - return null; - }; - return VResourceJoiner; - }()); - - /* - TODO: just use ResourceHash somehow? could then use the generic ResourceSplitter - */ - var VResourceSplitter = /** @class */ (function (_super) { - __extends(VResourceSplitter, _super); - function VResourceSplitter() { - return _super !== null && _super.apply(this, arguments) || this; - } - VResourceSplitter.prototype.getKeyInfo = function (props) { - var resourceDayTableModel = props.resourceDayTableModel; - var hash = mapHash(resourceDayTableModel.resourceIndex.indicesById, function (i) { return resourceDayTableModel.resources[i]; }); // :( - hash[''] = {}; - return hash; - }; - VResourceSplitter.prototype.getKeysForDateSpan = function (dateSpan) { - return [dateSpan.resourceId || '']; - }; - VResourceSplitter.prototype.getKeysForEventDef = function (eventDef) { - var resourceIds = eventDef.resourceIds; - if (!resourceIds.length) { - return ['']; - } - return resourceIds; - }; - return VResourceSplitter; - }(Splitter)); - - /* - doesn't accept grouping - */ - function flattenResources(resourceStore, orderSpecs) { - return buildRowNodes(resourceStore, [], orderSpecs, false, {}, true) - .map(function (node) { return node.resource; }); - } - function buildRowNodes(resourceStore, groupSpecs, orderSpecs, isVGrouping, expansions, expansionDefault) { - var complexNodes = buildHierarchy(resourceStore, isVGrouping ? -1 : 1, groupSpecs, orderSpecs); - var flatNodes = []; - flattenNodes(complexNodes, flatNodes, isVGrouping, [], 0, expansions, expansionDefault); - return flatNodes; - } - function flattenNodes(complexNodes, res, isVGrouping, rowSpans, depth, expansions, expansionDefault) { - for (var i = 0; i < complexNodes.length; i += 1) { - var complexNode = complexNodes[i]; - var group = complexNode.group; - if (group) { - if (isVGrouping) { - var firstRowIndex = res.length; - var rowSpanIndex = rowSpans.length; - flattenNodes(complexNode.children, res, isVGrouping, rowSpans.concat(0), depth, expansions, expansionDefault); - if (firstRowIndex < res.length) { - var firstRow = res[firstRowIndex]; - var firstRowSpans = firstRow.rowSpans = firstRow.rowSpans.slice(); - firstRowSpans[rowSpanIndex] = res.length - firstRowIndex; - } - } - else { - var id = group.spec.field + ':' + group.value; - var isExpanded = expansions[id] != null ? expansions[id] : expansionDefault; - res.push({ id: id, group: group, isExpanded: isExpanded }); - if (isExpanded) { - flattenNodes(complexNode.children, res, isVGrouping, rowSpans, depth + 1, expansions, expansionDefault); - } - } - } - else if (complexNode.resource) { - var id = complexNode.resource.id; - var isExpanded = expansions[id] != null ? expansions[id] : expansionDefault; - res.push({ - id: id, - rowSpans: rowSpans, - depth: depth, - isExpanded: isExpanded, - hasChildren: Boolean(complexNode.children.length), - resource: complexNode.resource, - resourceFields: complexNode.resourceFields, - }); - if (isExpanded) { - flattenNodes(complexNode.children, res, isVGrouping, rowSpans, depth + 1, expansions, expansionDefault); - } - } - } - } - function buildHierarchy(resourceStore, maxDepth, groupSpecs, orderSpecs) { - var resourceNodes = buildResourceNodes(resourceStore, orderSpecs); - var builtNodes = []; - for (var resourceId in resourceNodes) { - var resourceNode = resourceNodes[resourceId]; - if (!resourceNode.resource.parentId) { - insertResourceNode(resourceNode, builtNodes, groupSpecs, 0, maxDepth, orderSpecs); - } - } - return builtNodes; - } - function buildResourceNodes(resourceStore, orderSpecs) { - var nodeHash = {}; - for (var resourceId in resourceStore) { - var resource = resourceStore[resourceId]; - nodeHash[resourceId] = { - resource: resource, - resourceFields: buildResourceFields(resource), - children: [], - }; - } - for (var resourceId in resourceStore) { - var resource = resourceStore[resourceId]; - if (resource.parentId) { - var parentNode = nodeHash[resource.parentId]; - if (parentNode) { - insertResourceNodeInSiblings(nodeHash[resourceId], parentNode.children, orderSpecs); - } - } - } - return nodeHash; - } - function insertResourceNode(resourceNode, nodes, groupSpecs, depth, maxDepth, orderSpecs) { - if (groupSpecs.length && (maxDepth === -1 || depth <= maxDepth)) { - var groupNode = ensureGroupNodes(resourceNode, nodes, groupSpecs[0]); - insertResourceNode(resourceNode, groupNode.children, groupSpecs.slice(1), depth + 1, maxDepth, orderSpecs); - } - else { - insertResourceNodeInSiblings(resourceNode, nodes, orderSpecs); - } - } - function ensureGroupNodes(resourceNode, nodes, groupSpec) { - var groupValue = resourceNode.resourceFields[groupSpec.field]; - var groupNode; - var newGroupIndex; - // find an existing group that matches, or determine the position for a new group - if (groupSpec.order) { - for (newGroupIndex = 0; newGroupIndex < nodes.length; newGroupIndex += 1) { - var node = nodes[newGroupIndex]; - if (node.group) { - var cmp = flexibleCompare(groupValue, node.group.value) * groupSpec.order; - if (cmp === 0) { - groupNode = node; - break; - } - else if (cmp < 0) { - break; - } - } - } - } - else { // the groups are unordered - for (newGroupIndex = 0; newGroupIndex < nodes.length; newGroupIndex += 1) { - var node = nodes[newGroupIndex]; - if (node.group && groupValue === node.group.value) { - groupNode = node; - break; - } - } - } - if (!groupNode) { - groupNode = { - group: { - value: groupValue, - spec: groupSpec, - }, - children: [], - }; - nodes.splice(newGroupIndex, 0, groupNode); - } - return groupNode; - } - function insertResourceNodeInSiblings(resourceNode, siblings, orderSpecs) { - var i; - for (i = 0; i < siblings.length; i += 1) { - var cmp = compareByFieldSpecs(siblings[i].resourceFields, resourceNode.resourceFields, orderSpecs); // TODO: pass in ResourceApi? - if (cmp > 0) { // went 1 past. insert at i - break; - } - } - siblings.splice(i, 0, resourceNode); - } - function buildResourceFields(resource) { - var obj = __assign(__assign(__assign({}, resource.extendedProps), resource.ui), resource); - delete obj.ui; - delete obj.extendedProps; - return obj; - } - function isGroupsEqual(group0, group1) { - return group0.spec === group1.spec && group0.value === group1.value; - } - - var resourceCommonPlugin = createPlugin({ - deps: [ - premiumCommonPlugin, - ], - reducers: [ - reduceResources, - ], - isLoadingFuncs: [ - function (state) { return state.resourceSource && state.resourceSource.isFetching; }, - ], - eventRefiners: EVENT_REFINERS$1, - eventDefMemberAdders: [generateEventDefResourceMembers], - isDraggableTransformers: [transformIsDraggable], - eventDragMutationMassagers: [massageEventDragMutation], - eventDefMutationAppliers: [applyEventDefMutation], - dateSelectionTransformers: [transformDateSelectionJoin], - datePointTransforms: [transformDatePoint], - dateSpanTransforms: [transformDateSpan], - viewPropsTransformers: [ResourceDataAdder, ResourceEventConfigAdder], - isPropsValid: isPropsValidWithResources, - externalDefTransforms: [transformExternalDef], - eventResizeJoinTransforms: [transformEventResizeJoin], - eventDropTransformers: [transformEventDrop], - optionChangeHandlers: optionChangeHandlers, - optionRefiners: OPTION_REFINERS$6, - listenerRefiners: LISTENER_REFINERS$1, - propSetHandlers: { resourceStore: handleResourceStore }, - }); - - var ResourceDayTableJoiner = /** @class */ (function (_super) { - __extends(ResourceDayTableJoiner, _super); - function ResourceDayTableJoiner() { - return _super !== null && _super.apply(this, arguments) || this; - } - ResourceDayTableJoiner.prototype.transformSeg = function (seg, resourceDayTableModel, resourceI) { - var colRanges = resourceDayTableModel.computeColRanges(seg.firstCol, seg.lastCol, resourceI); - return colRanges.map(function (colRange) { return (__assign(__assign(__assign({}, seg), colRange), { isStart: seg.isStart && colRange.isStart, isEnd: seg.isEnd && colRange.isEnd })); }); - }; - return ResourceDayTableJoiner; - }(VResourceJoiner)); - - var ResourceDayTable = /** @class */ (function (_super) { - __extends(ResourceDayTable, _super); - function ResourceDayTable() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.allowAcrossResources = false; - _this.splitter = new VResourceSplitter(); - _this.slicers = {}; - _this.joiner = new ResourceDayTableJoiner(); - _this.tableRef = createRef(); - _this.handleRootEl = function (rootEl) { - if (rootEl) { - _this.context.registerInteractiveComponent(_this, { el: rootEl }); - } - else { - _this.context.unregisterInteractiveComponent(_this); - } - }; - return _this; - } - ResourceDayTable.prototype.render = function () { - var _this = this; - var _a = this, props = _a.props, context = _a.context; - var resourceDayTableModel = props.resourceDayTableModel, nextDayThreshold = props.nextDayThreshold, dateProfile = props.dateProfile; - var splitProps = this.splitter.splitProps(props); - this.slicers = mapHash(splitProps, function (split, resourceId) { return _this.slicers[resourceId] || new DayTableSlicer(); }); - var slicedProps = mapHash(this.slicers, function (slicer, resourceId) { return slicer.sliceProps(splitProps[resourceId], dateProfile, nextDayThreshold, context, resourceDayTableModel.dayTableModel); }); - this.allowAcrossResources = resourceDayTableModel.dayTableModel.colCnt === 1; // hack for EventResizing - return (createElement(Table, __assign({ forPrint: props.forPrint, ref: this.tableRef, elRef: this.handleRootEl }, this.joiner.joinProps(slicedProps, resourceDayTableModel), { cells: resourceDayTableModel.cells, dateProfile: dateProfile, colGroupNode: props.colGroupNode, tableMinWidth: props.tableMinWidth, renderRowIntro: props.renderRowIntro, dayMaxEvents: props.dayMaxEvents, dayMaxEventRows: props.dayMaxEventRows, showWeekNumbers: props.showWeekNumbers, expandRows: props.expandRows, headerAlignElRef: props.headerAlignElRef, clientWidth: props.clientWidth, clientHeight: props.clientHeight }))); - }; - ResourceDayTable.prototype.prepareHits = function () { - this.tableRef.current.prepareHits(); - }; - ResourceDayTable.prototype.queryHit = function (positionLeft, positionTop) { - var rawHit = this.tableRef.current.positionToHit(positionLeft, positionTop); - if (rawHit) { - return { - component: this, - dateSpan: { - range: rawHit.dateSpan.range, - allDay: rawHit.dateSpan.allDay, - resourceId: this.props.resourceDayTableModel.cells[rawHit.row][rawHit.col].resource.id, - }, - dayEl: rawHit.dayEl, - rect: { - left: rawHit.relativeRect.left, - right: rawHit.relativeRect.right, - top: rawHit.relativeRect.top, - bottom: rawHit.relativeRect.bottom, - }, - layer: 0, - }; - } - return null; - }; - return ResourceDayTable; - }(DateComponent)); - - var ResourceDayTableView = /** @class */ (function (_super) { - __extends(ResourceDayTableView, _super); - function ResourceDayTableView() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.flattenResources = memoize(flattenResources); - _this.buildResourceDayTableModel = memoize(buildResourceDayTableModel); - _this.headerRef = createRef(); - _this.tableRef = createRef(); - return _this; - } - ResourceDayTableView.prototype.render = function () { - var _this = this; - var _a = this, props = _a.props, context = _a.context; - var options = context.options; - var resourceOrderSpecs = options.resourceOrder || DEFAULT_RESOURCE_ORDER; - var resources = this.flattenResources(props.resourceStore, resourceOrderSpecs); - var resourceDayTableModel = this.buildResourceDayTableModel(props.dateProfile, context.dateProfileGenerator, resources, options.datesAboveResources, context); - var headerContent = options.dayHeaders && (createElement(ResourceDayHeader, { ref: this.headerRef, resources: resources, dateProfile: props.dateProfile, dates: resourceDayTableModel.dayTableModel.headerDates, datesRepDistinctDays: true })); - var bodyContent = function (contentArg) { return (createElement(ResourceDayTable, { ref: _this.tableRef, dateProfile: props.dateProfile, resourceDayTableModel: resourceDayTableModel, businessHours: props.businessHours, eventStore: props.eventStore, eventUiBases: props.eventUiBases, dateSelection: props.dateSelection, eventSelection: props.eventSelection, eventDrag: props.eventDrag, eventResize: props.eventResize, nextDayThreshold: options.nextDayThreshold, tableMinWidth: contentArg.tableMinWidth, colGroupNode: contentArg.tableColGroupNode, dayMaxEvents: options.dayMaxEvents, dayMaxEventRows: options.dayMaxEventRows, showWeekNumbers: options.weekNumbers, expandRows: !props.isHeightAuto, headerAlignElRef: _this.headerElRef, clientWidth: contentArg.clientWidth, clientHeight: contentArg.clientHeight, forPrint: props.forPrint })); }; - return options.dayMinWidth - ? this.renderHScrollLayout(headerContent, bodyContent, resourceDayTableModel.colCnt, options.dayMinWidth) - : this.renderSimpleLayout(headerContent, bodyContent); - }; - return ResourceDayTableView; - }(TableView)); - function buildResourceDayTableModel(dateProfile, dateProfileGenerator, resources, datesAboveResources, context) { - var dayTable = buildDayTableModel(dateProfile, dateProfileGenerator); - return datesAboveResources ? - new DayResourceTableModel(dayTable, resources, context) : - new ResourceDayTableModel(dayTable, resources, context); - } - - var resourceDayGridPlugin = createPlugin({ - deps: [ - premiumCommonPlugin, - resourceCommonPlugin, - dayGridPlugin, - ], - initialView: 'resourceDayGridDay', - views: { - resourceDayGrid: { - type: 'dayGrid', - component: ResourceDayTableView, - needsResourceData: true, - }, - resourceDayGridDay: { - type: 'resourceDayGrid', - duration: { days: 1 }, - }, - resourceDayGridWeek: { - type: 'resourceDayGrid', - duration: { weeks: 1 }, - }, - resourceDayGridMonth: { - type: 'resourceDayGrid', - duration: { months: 1 }, - // TODO: wish we didn't have to C&P from dayGrid's file - monthMode: true, - fixedWeekCount: true, - }, - }, - }); - - var ResourceDayTimeColsJoiner = /** @class */ (function (_super) { - __extends(ResourceDayTimeColsJoiner, _super); - function ResourceDayTimeColsJoiner() { - return _super !== null && _super.apply(this, arguments) || this; - } - ResourceDayTimeColsJoiner.prototype.transformSeg = function (seg, resourceDayTable, resourceI) { - return [ - __assign(__assign({}, seg), { col: resourceDayTable.computeCol(seg.col, resourceI) }), - ]; - }; - return ResourceDayTimeColsJoiner; - }(VResourceJoiner)); - - var ResourceDayTimeCols = /** @class */ (function (_super) { - __extends(ResourceDayTimeCols, _super); - function ResourceDayTimeCols() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.allowAcrossResources = false; - _this.buildDayRanges = memoize(buildDayRanges); - _this.splitter = new VResourceSplitter(); - _this.slicers = {}; - _this.joiner = new ResourceDayTimeColsJoiner(); - _this.timeColsRef = createRef(); - _this.handleRootEl = function (rootEl) { - if (rootEl) { - _this.context.registerInteractiveComponent(_this, { el: rootEl }); - } - else { - _this.context.unregisterInteractiveComponent(_this); - } - }; - return _this; - } - ResourceDayTimeCols.prototype.render = function () { - var _this = this; - var _a = this, props = _a.props, context = _a.context; - var dateEnv = context.dateEnv, options = context.options; - var dateProfile = props.dateProfile, resourceDayTableModel = props.resourceDayTableModel; - var dayRanges = this.dayRanges = this.buildDayRanges(resourceDayTableModel.dayTableModel, dateProfile, dateEnv); - var splitProps = this.splitter.splitProps(props); - this.slicers = mapHash(splitProps, function (split, resourceId) { return _this.slicers[resourceId] || new DayTimeColsSlicer(); }); - var slicedProps = mapHash(this.slicers, function (slicer, resourceId) { return slicer.sliceProps(splitProps[resourceId], dateProfile, null, context, dayRanges); }); - this.allowAcrossResources = dayRanges.length === 1; - return ( // TODO: would move this further down hierarchy, but sliceNowDate needs it - createElement(NowTimer, { unit: options.nowIndicator ? 'minute' : 'day' }, function (nowDate, todayRange) { return (createElement(TimeCols, __assign({ ref: _this.timeColsRef, rootElRef: _this.handleRootEl }, _this.joiner.joinProps(slicedProps, resourceDayTableModel), { dateProfile: dateProfile, axis: props.axis, slotDuration: props.slotDuration, slatMetas: props.slatMetas, cells: resourceDayTableModel.cells[0], tableColGroupNode: props.tableColGroupNode, tableMinWidth: props.tableMinWidth, clientWidth: props.clientWidth, clientHeight: props.clientHeight, expandRows: props.expandRows, nowDate: nowDate, nowIndicatorSegs: options.nowIndicator && _this.buildNowIndicatorSegs(nowDate), todayRange: todayRange, onScrollTopRequest: props.onScrollTopRequest, forPrint: props.forPrint, onSlatCoords: props.onSlatCoords }))); })); - }; - ResourceDayTimeCols.prototype.buildNowIndicatorSegs = function (date) { - var nonResourceSegs = this.slicers[''].sliceNowDate(date, this.context, this.dayRanges); - return this.joiner.expandSegs(this.props.resourceDayTableModel, nonResourceSegs); - }; - ResourceDayTimeCols.prototype.queryHit = function (positionLeft, positionTop) { - var rawHit = this.timeColsRef.current.positionToHit(positionLeft, positionTop); - if (rawHit) { - return { - component: this, - dateSpan: { - range: rawHit.dateSpan.range, - allDay: rawHit.dateSpan.allDay, - resourceId: this.props.resourceDayTableModel.cells[0][rawHit.col].resource.id, - }, - dayEl: rawHit.dayEl, - rect: { - left: rawHit.relativeRect.left, - right: rawHit.relativeRect.right, - top: rawHit.relativeRect.top, - bottom: rawHit.relativeRect.bottom, - }, - layer: 0, - }; - } - return null; - }; - return ResourceDayTimeCols; - }(DateComponent)); - - var ResourceDayTimeColsView = /** @class */ (function (_super) { - __extends(ResourceDayTimeColsView, _super); - function ResourceDayTimeColsView() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.flattenResources = memoize(flattenResources); - _this.buildResourceTimeColsModel = memoize(buildResourceTimeColsModel); - _this.buildSlatMetas = memoize(buildSlatMetas); - return _this; - } - ResourceDayTimeColsView.prototype.render = function () { - var _this = this; - var _a = this, props = _a.props, context = _a.context; - var options = context.options, dateEnv = context.dateEnv; - var dateProfile = props.dateProfile; - var splitProps = this.allDaySplitter.splitProps(props); - var resourceOrderSpecs = options.resourceOrder || DEFAULT_RESOURCE_ORDER; - var resources = this.flattenResources(props.resourceStore, resourceOrderSpecs); - var resourceDayTableModel = this.buildResourceTimeColsModel(dateProfile, context.dateProfileGenerator, resources, options.datesAboveResources, context); - var slatMetas = this.buildSlatMetas(dateProfile.slotMinTime, dateProfile.slotMaxTime, options.slotLabelInterval, options.slotDuration, dateEnv); - var dayMinWidth = options.dayMinWidth; - var hasAttachedAxis = !dayMinWidth; - var hasDetachedAxis = dayMinWidth; - var headerContent = options.dayHeaders && (createElement(ResourceDayHeader, { resources: resources, dates: resourceDayTableModel.dayTableModel.headerDates, dateProfile: dateProfile, datesRepDistinctDays: true, renderIntro: hasAttachedAxis ? this.renderHeadAxis : null })); - var allDayContent = (options.allDaySlot !== false) && (function (contentArg) { return (createElement(ResourceDayTable, __assign({}, splitProps.allDay, { dateProfile: dateProfile, resourceDayTableModel: resourceDayTableModel, nextDayThreshold: options.nextDayThreshold, tableMinWidth: contentArg.tableMinWidth, colGroupNode: contentArg.tableColGroupNode, renderRowIntro: hasAttachedAxis ? _this.renderTableRowAxis : null, showWeekNumbers: false, expandRows: false, headerAlignElRef: _this.headerElRef, clientWidth: contentArg.clientWidth, clientHeight: contentArg.clientHeight, forPrint: props.forPrint }, _this.getAllDayMaxEventProps()))); }); - var timeGridContent = function (contentArg) { return (createElement(ResourceDayTimeCols, __assign({}, splitProps.timed, { dateProfile: dateProfile, axis: hasAttachedAxis, slotDuration: options.slotDuration, slatMetas: slatMetas, resourceDayTableModel: resourceDayTableModel, tableColGroupNode: contentArg.tableColGroupNode, tableMinWidth: contentArg.tableMinWidth, clientWidth: contentArg.clientWidth, clientHeight: contentArg.clientHeight, onSlatCoords: _this.handleSlatCoords, expandRows: contentArg.expandRows, forPrint: props.forPrint, onScrollTopRequest: _this.handleScrollTopRequest }))); }; - return hasDetachedAxis - ? this.renderHScrollLayout(headerContent, allDayContent, timeGridContent, resourceDayTableModel.colCnt, dayMinWidth, slatMetas, this.state.slatCoords) - : this.renderSimpleLayout(headerContent, allDayContent, timeGridContent); - }; - return ResourceDayTimeColsView; - }(TimeColsView)); - function buildResourceTimeColsModel(dateProfile, dateProfileGenerator, resources, datesAboveResources, context) { - var dayTable = buildTimeColsModel(dateProfile, dateProfileGenerator); - return datesAboveResources ? - new DayResourceTableModel(dayTable, resources, context) : - new ResourceDayTableModel(dayTable, resources, context); - } - - var resourceTimeGridPlugin = createPlugin({ - deps: [ - premiumCommonPlugin, - resourceCommonPlugin, - timeGridPlugin, - ], - initialView: 'resourceTimeGridDay', - views: { - resourceTimeGrid: { - type: 'timeGrid', - component: ResourceDayTimeColsView, - needsResourceData: true, - }, - resourceTimeGridDay: { - type: 'resourceTimeGrid', - duration: { days: 1 }, - }, - resourceTimeGridWeek: { - type: 'resourceTimeGrid', - duration: { weeks: 1 }, - }, - }, - }); - - /* - Renders the DOM responsible for the subrow expander area, - as well as the space before it (used to align expanders of similar depths) - */ - function ExpanderIcon(_a) { - var depth = _a.depth, hasChildren = _a.hasChildren, isExpanded = _a.isExpanded, onExpanderClick = _a.onExpanderClick; - var nodes = []; - for (var i = 0; i < depth; i += 1) { - nodes.push(createElement("span", { className: "fc-icon" })); - } - var iconClassNames = ['fc-icon']; - if (hasChildren) { - if (isExpanded) { - iconClassNames.push('fc-icon-minus-square'); - } - else { - iconClassNames.push('fc-icon-plus-square'); - } - } - nodes.push(createElement("span", { className: 'fc-datagrid-expander' + (hasChildren ? '' : ' fc-datagrid-expander-placeholder'), onClick: onExpanderClick }, - createElement("span", { className: iconClassNames.join(' ') }))); - return createElement.apply(void 0, __spreadArrays([Fragment, {}], nodes)); - } - - function refineHookProps$1(raw) { - return { - resource: new ResourceApi(raw.context, raw.resource), - fieldValue: raw.fieldValue, - view: raw.context.viewApi, - }; - } - - var SpreadsheetIndividualCellInner = /** @class */ (function (_super) { - __extends(SpreadsheetIndividualCellInner, _super); - function SpreadsheetIndividualCellInner() { - return _super !== null && _super.apply(this, arguments) || this; - } - SpreadsheetIndividualCellInner.prototype.render = function () { - var props = this.props; - return (createElement(ContentHook, { hookProps: props.hookProps, content: props.colSpec.cellContent, defaultContent: renderResourceInner }, function (innerElRef, innerContent) { return (createElement("span", { className: "fc-datagrid-cell-main", ref: innerElRef }, innerContent)); })); - }; - return SpreadsheetIndividualCellInner; - }(BaseComponent)); - function renderResourceInner(hookProps) { - return hookProps.fieldValue || createElement(Fragment, null, "\u00A0"); - } - - // worth making a PureComponent? (because of innerHeight) - var SpreadsheetIndividualCell = /** @class */ (function (_super) { - __extends(SpreadsheetIndividualCell, _super); - function SpreadsheetIndividualCell() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.refineHookProps = memoizeObjArg(refineHookProps$1); - _this.normalizeClassNames = buildClassNameNormalizer(); - _this.onExpanderClick = function (ev) { - var props = _this.props; - if (props.hasChildren) { - _this.context.dispatch({ - type: 'SET_RESOURCE_ENTITY_EXPANDED', - id: props.resource.id, - isExpanded: !props.isExpanded, - }); - } - }; - return _this; - } - SpreadsheetIndividualCell.prototype.render = function () { - var _this = this; - var _a = this, props = _a.props, context = _a.context; - var colSpec = props.colSpec; - var hookProps = this.refineHookProps({ - resource: props.resource, - fieldValue: props.fieldValue, - context: context, - }); - var customClassNames = this.normalizeClassNames(colSpec.cellClassNames, hookProps); - return (createElement(MountHook, { hookProps: hookProps, didMount: colSpec.cellDidMount, willUnmount: colSpec.cellWillUnmount }, function (rootElRef) { return (createElement("td", { ref: rootElRef, "data-resource-id": props.resource.id, className: [ - 'fc-datagrid-cell', - 'fc-resource', - ].concat(customClassNames).join(' ') }, - createElement("div", { className: "fc-datagrid-cell-frame", style: { height: props.innerHeight } }, - createElement("div", { className: "fc-datagrid-cell-cushion fc-scrollgrid-sync-inner" }, - colSpec.isMain && (createElement(ExpanderIcon, { depth: props.depth, hasChildren: props.hasChildren, isExpanded: props.isExpanded, onExpanderClick: _this.onExpanderClick })), - createElement(SpreadsheetIndividualCellInner, { hookProps: hookProps, colSpec: colSpec }))))); })); - }; - return SpreadsheetIndividualCell; - }(BaseComponent)); - - // for VERTICAL cell grouping, in spreadsheet area - var SpreadsheetGroupCell = /** @class */ (function (_super) { - __extends(SpreadsheetGroupCell, _super); - function SpreadsheetGroupCell() { - return _super !== null && _super.apply(this, arguments) || this; - } - SpreadsheetGroupCell.prototype.render = function () { - var _a = this, props = _a.props, context = _a.context; - var colSpec = props.colSpec; - var hookProps = { - groupValue: props.fieldValue, - view: context.viewApi, - }; - // a grouped cell. no data that is specific to this specific resource - // `colSpec` is for the group. a GroupSpec :( - return (createElement(RenderHook, { hookProps: hookProps, classNames: colSpec.cellClassNames, content: colSpec.cellContent, defaultContent: renderGroupInner, didMount: colSpec.cellDidMount, willUnmount: colSpec.cellWillUnmount }, function (rootElRef, classNames, innerElRef, innerContent) { return ( - // TODO: make data-attr with group value? - createElement("td", { className: ['fc-datagrid-cell', 'fc-resource-group'].concat(classNames).join(' '), rowSpan: props.rowSpan, ref: rootElRef }, - createElement("div", { className: "fc-datagrid-cell-frame fc-datagrid-cell-frame-liquid" }, - createElement("div", { className: "fc-datagrid-cell-cushion fc-sticky", ref: innerElRef }, innerContent)))); })); - }; - return SpreadsheetGroupCell; - }(BaseComponent)); - function renderGroupInner(hookProps) { - return hookProps.groupValue || createElement(Fragment, null, "\u00A0"); - } - - var SpreadsheetRow = /** @class */ (function (_super) { - __extends(SpreadsheetRow, _super); - function SpreadsheetRow() { - return _super !== null && _super.apply(this, arguments) || this; - } - SpreadsheetRow.prototype.render = function () { - var props = this.props; - var resource = props.resource, rowSpans = props.rowSpans, depth = props.depth; - var resourceFields = buildResourceFields(resource); // slightly inefficient. already done up the call stack - return (createElement("tr", null, props.colSpecs.map(function (colSpec, i) { - var rowSpan = rowSpans[i]; - if (rowSpan === 0) { // not responsible for group-based rows. VRowGroup is - return null; - } - if (rowSpan == null) { - rowSpan = 1; - } - var fieldValue = colSpec.field ? resourceFields[colSpec.field] : - (resource.title || getPublicId(resource.id)); - if (rowSpan > 1) { - return (createElement(SpreadsheetGroupCell, { key: i, colSpec: colSpec, fieldValue: fieldValue, rowSpan: rowSpan })); - } - return (createElement(SpreadsheetIndividualCell, { key: i, colSpec: colSpec, resource: resource, fieldValue: fieldValue, depth: depth, hasChildren: props.hasChildren, isExpanded: props.isExpanded, innerHeight: props.innerHeight })); - }))); - }; - return SpreadsheetRow; - }(BaseComponent)); - SpreadsheetRow.addPropsEquality({ - rowSpans: isArraysEqual, - }); - - // for HORIZONTAL cell grouping, in spreadsheet area - var SpreadsheetGroupRow = /** @class */ (function (_super) { - __extends(SpreadsheetGroupRow, _super); - function SpreadsheetGroupRow() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.innerInnerRef = createRef(); - _this.onExpanderClick = function () { - var props = _this.props; - _this.context.dispatch({ - type: 'SET_RESOURCE_ENTITY_EXPANDED', - id: props.id, - isExpanded: !props.isExpanded, - }); - }; - return _this; - } - SpreadsheetGroupRow.prototype.render = function () { - var _this = this; - var _a = this, props = _a.props, context = _a.context; - var hookProps = { groupValue: props.group.value, view: context.viewApi }; - var spec = props.group.spec; - return (createElement("tr", null, - createElement(RenderHook, { hookProps: hookProps, classNames: spec.labelClassNames, content: spec.labelContent, defaultContent: renderCellInner, didMount: spec.labelDidMount, willUnmount: spec.labelWillUnmount }, function (rootElRef, classNames, innerElRef, innerContent) { return (createElement("td", { ref: rootElRef, colSpan: props.spreadsheetColCnt, className: [ - 'fc-datagrid-cell', - 'fc-resource-group', - context.theme.getClass('tableCellShaded'), - ].concat(classNames).join(' ') }, - createElement("div", { className: "fc-datagrid-cell-frame", style: { height: props.innerHeight } }, - createElement("div", { className: "fc-datagrid-cell-cushion fc-scrollgrid-sync-inner", ref: _this.innerInnerRef }, - createElement(ExpanderIcon, { depth: 0, hasChildren: true, isExpanded: props.isExpanded, onExpanderClick: _this.onExpanderClick }), - createElement("span", { className: "fc-datagrid-cell-main", ref: innerElRef }, innerContent))))); }))); - }; - return SpreadsheetGroupRow; - }(BaseComponent)); - SpreadsheetGroupRow.addPropsEquality({ - group: isGroupsEqual, - }); - function renderCellInner(hookProps) { - return hookProps.groupValue || createElement(Fragment, null, "\u00A0"); - } - - var SPREADSHEET_COL_MIN_WIDTH = 20; - var SpreadsheetHeader = /** @class */ (function (_super) { - __extends(SpreadsheetHeader, _super); - function SpreadsheetHeader() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.resizerElRefs = new RefMap(_this._handleColResizerEl.bind(_this)); - _this.colDraggings = {}; - return _this; - } - SpreadsheetHeader.prototype.render = function () { - var _this = this; - var _a = this.props, colSpecs = _a.colSpecs, superHeaderRendering = _a.superHeaderRendering, rowInnerHeights = _a.rowInnerHeights; - var hookProps = { view: this.context.viewApi }; - var rowNodes = []; - rowInnerHeights = rowInnerHeights.slice(); // copy, because we're gonna pop - if (superHeaderRendering) { - var rowInnerHeight_1 = rowInnerHeights.shift(); - rowNodes.push(createElement("tr", { key: "row-super" }, - createElement(RenderHook, { hookProps: hookProps, classNames: superHeaderRendering.headerClassNames, content: superHeaderRendering.headerContent, didMount: superHeaderRendering.headerDidMount, willUnmount: superHeaderRendering.headerWillUnmount }, function (rootElRef, classNames, innerElRef, innerContent) { return (createElement("th", { colSpan: colSpecs.length, ref: rootElRef, className: [ - 'fc-datagrid-cell', - 'fc-datagrid-cell-super', - ].concat(classNames).join(' ') }, - createElement("div", { className: "fc-datagrid-cell-frame", style: { height: rowInnerHeight_1 } }, - createElement("div", { className: "fc-datagrid-cell-cushion fc-scrollgrid-sync-inner", ref: innerElRef }, innerContent)))); }))); - } - var rowInnerHeight = rowInnerHeights.shift(); - rowNodes.push(createElement("tr", { key: "row" }, colSpecs.map(function (colSpec, i) { - var isLastCol = i === (colSpecs.length - 1); - // need empty inner div for abs positioning for resizer - return (createElement(RenderHook, { key: i, hookProps: hookProps, classNames: colSpec.headerClassNames, content: colSpec.headerContent, didMount: colSpec.headerDidMount, willUnmount: colSpec.headerWillUnmount }, function (rootElRef, classNames, innerElRef, innerContent) { return (createElement("th", { ref: rootElRef, className: ['fc-datagrid-cell'].concat(classNames).join(' ') }, - createElement("div", { className: "fc-datagrid-cell-frame", style: { height: rowInnerHeight } }, - createElement("div", { className: "fc-datagrid-cell-cushion fc-scrollgrid-sync-inner" }, - colSpec.isMain && (createElement("span", { className: "fc-datagrid-expander fc-datagrid-expander-placeholder" }, - createElement("span", { className: "fc-icon" }))), - createElement("span", { className: "fc-datagrid-cell-main", ref: innerElRef }, innerContent)), - !isLastCol && - createElement("div", { className: "fc-datagrid-cell-resizer", ref: _this.resizerElRefs.createRef(i) })))); })); - }))); - return (createElement(Fragment, null, rowNodes)); - }; - SpreadsheetHeader.prototype._handleColResizerEl = function (resizerEl, index) { - var colDraggings = this.colDraggings; - if (!resizerEl) { - var dragging = colDraggings[index]; - if (dragging) { - dragging.destroy(); - delete colDraggings[index]; - } - } - else { - var dragging = this.initColResizing(resizerEl, parseInt(index, 10)); - if (dragging) { - colDraggings[index] = dragging; - } - } - }; - SpreadsheetHeader.prototype.initColResizing = function (resizerEl, index) { - var _a = this.context, pluginHooks = _a.pluginHooks, isRtl = _a.isRtl; - var onColWidthChange = this.props.onColWidthChange; - var ElementDraggingImpl = pluginHooks.elementDraggingImpl; - if (ElementDraggingImpl) { - var dragging = new ElementDraggingImpl(resizerEl); - var startWidth_1; // of just the single column - var currentWidths_1; // of all columns - dragging.emitter.on('dragstart', function () { - var allCells = findElements(elementClosest(resizerEl, 'tr'), 'th'); - currentWidths_1 = allCells.map(function (cellEl) { return (cellEl.getBoundingClientRect().width); }); - startWidth_1 = currentWidths_1[index]; - }); - dragging.emitter.on('dragmove', function (pev) { - currentWidths_1[index] = Math.max(startWidth_1 + pev.deltaX * (isRtl ? -1 : 1), SPREADSHEET_COL_MIN_WIDTH); - if (onColWidthChange) { - onColWidthChange(currentWidths_1.slice()); // send a copy since currentWidths continues to be mutated - } - }); - dragging.setAutoScrollEnabled(false); // because gets weird with auto-scrolling time area - return dragging; - } - return null; - }; - return SpreadsheetHeader; - }(BaseComponent)); - - var ResourceTimelineLaneMisc = /** @class */ (function (_super) { - __extends(ResourceTimelineLaneMisc, _super); - function ResourceTimelineLaneMisc() { - return _super !== null && _super.apply(this, arguments) || this; - } - ResourceTimelineLaneMisc.prototype.render = function () { - var _a = this, props = _a.props, context = _a.context; - var hookProps = { resource: new ResourceApi(context, props.resource) }; // just easier to make directly - return (createElement(ContentHook, { hookProps: hookProps, content: context.options.resourceLaneContent }, function (innerElRef, innerContent) { return (innerContent && // TODO: test how this would interfere with height - createElement("div", { className: "fc-timeline-lane-misc", ref: innerElRef }, innerContent)); })); - }; - return ResourceTimelineLaneMisc; - }(BaseComponent)); - - var ResourceTimelineLane = /** @class */ (function (_super) { - __extends(ResourceTimelineLane, _super); - function ResourceTimelineLane() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.refineHookProps = memoizeObjArg(refineHookProps$2); - _this.normalizeClassNames = buildClassNameNormalizer(); - _this.handleHeightChange = function (innerEl, isStable) { - if (_this.props.onHeightChange) { - _this.props.onHeightChange( - // would want to use own <tr> ref, but not guaranteed to be ready when this fires - elementClosest(innerEl, 'tr'), isStable); - } - }; - return _this; - } - ResourceTimelineLane.prototype.render = function () { - var _this = this; - var _a = this, props = _a.props, context = _a.context; - var options = context.options; - var hookProps = this.refineHookProps({ resource: props.resource, context: context }); - var customClassNames = this.normalizeClassNames(options.resourceLaneClassNames, hookProps); - return (createElement("tr", { ref: props.elRef }, - createElement(MountHook, { hookProps: hookProps, didMount: options.resourceLaneDidMount, willUnmount: options.resourceLaneWillUnmount }, function (rootElRef) { return (createElement("td", { ref: rootElRef, className: ['fc-timeline-lane', 'fc-resource'].concat(customClassNames).join(' '), "data-resource-id": props.resource.id }, - createElement("div", { className: "fc-timeline-lane-frame", style: { height: props.innerHeight } }, - createElement(ResourceTimelineLaneMisc, { resource: props.resource }), - createElement(TimelineLane, { dateProfile: props.dateProfile, tDateProfile: props.tDateProfile, nowDate: props.nowDate, todayRange: props.todayRange, nextDayThreshold: props.nextDayThreshold, businessHours: props.businessHours, eventStore: props.eventStore, eventUiBases: props.eventUiBases, dateSelection: props.dateSelection, eventSelection: props.eventSelection, eventDrag: props.eventDrag, eventResize: props.eventResize, timelineCoords: props.timelineCoords, onHeightChange: _this.handleHeightChange })))); }))); // important NOT to do liquid-height. dont want to shrink height smaller than content - }; - return ResourceTimelineLane; - }(BaseComponent)); - function refineHookProps$2(raw) { - return { - resource: new ResourceApi(raw.context, raw.resource), - }; - } - - /* - parallels the SpreadsheetGroupRow - */ - var DividerRow = /** @class */ (function (_super) { - __extends(DividerRow, _super); - function DividerRow() { - return _super !== null && _super.apply(this, arguments) || this; - } - DividerRow.prototype.render = function () { - var _this = this; - var props = this.props; - var renderingHooks = this.props.renderingHooks; - var hookProps = { groupValue: props.groupValue, view: this.context.viewApi }; - return (createElement("tr", { ref: props.elRef }, - createElement(RenderHook, { hookProps: hookProps, classNames: renderingHooks.laneClassNames, content: renderingHooks.laneContent, didMount: renderingHooks.laneDidMount, willUnmount: renderingHooks.laneWillUnmount }, function (rootElRef, classNames, innerElRef, innerContent) { return (createElement("td", { ref: rootElRef, className: [ - 'fc-timeline-lane', - 'fc-resource-group', - _this.context.theme.getClass('tableCellShaded'), - ].concat(classNames).join(' ') }, - createElement("div", { style: { height: props.innerHeight }, ref: innerElRef }, innerContent))); }))); - }; - return DividerRow; - }(BaseComponent)); - - var ResourceTimelineLanesBody = /** @class */ (function (_super) { - __extends(ResourceTimelineLanesBody, _super); - function ResourceTimelineLanesBody() { - return _super !== null && _super.apply(this, arguments) || this; - } - ResourceTimelineLanesBody.prototype.render = function () { - var _a = this, props = _a.props, context = _a.context; - var rowElRefs = props.rowElRefs, innerHeights = props.innerHeights; - return (createElement("tbody", null, props.rowNodes.map(function (node, index) { - if (node.group) { - return (createElement(DividerRow, { key: node.id, elRef: rowElRefs.createRef(node.id), groupValue: node.group.value, renderingHooks: node.group.spec, innerHeight: innerHeights[index] || '' })); - } - if (node.resource) { - var resource = node.resource; - return (createElement(ResourceTimelineLane, __assign({ key: node.id, elRef: rowElRefs.createRef(node.id) }, props.splitProps[resource.id], { resource: resource, dateProfile: props.dateProfile, tDateProfile: props.tDateProfile, nowDate: props.nowDate, todayRange: props.todayRange, nextDayThreshold: context.options.nextDayThreshold, businessHours: resource.businessHours || props.fallbackBusinessHours, innerHeight: innerHeights[index] || '', timelineCoords: props.slatCoords, onHeightChange: props.onRowHeightChange }))); - } - return null; - }))); - }; - return ResourceTimelineLanesBody; - }(BaseComponent)); - - var ResourceTimelineLanes = /** @class */ (function (_super) { - __extends(ResourceTimelineLanes, _super); - function ResourceTimelineLanes() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.rootElRef = createRef(); - _this.rowElRefs = new RefMap(); - return _this; - } - ResourceTimelineLanes.prototype.render = function () { - var _a = this, props = _a.props, context = _a.context; - return (createElement("table", { ref: this.rootElRef, className: 'fc-scrollgrid-sync-table ' + context.theme.getClass('table'), style: { - minWidth: props.tableMinWidth, - width: props.clientWidth, - height: props.minHeight, - } }, - createElement(ResourceTimelineLanesBody, { rowElRefs: this.rowElRefs, rowNodes: props.rowNodes, dateProfile: props.dateProfile, tDateProfile: props.tDateProfile, nowDate: props.nowDate, todayRange: props.todayRange, splitProps: props.splitProps, fallbackBusinessHours: props.fallbackBusinessHours, slatCoords: props.slatCoords, innerHeights: props.innerHeights, onRowHeightChange: props.onRowHeightChange }))); - }; - ResourceTimelineLanes.prototype.componentDidMount = function () { - this.updateCoords(); - }; - ResourceTimelineLanes.prototype.componentDidUpdate = function () { - this.updateCoords(); - }; - ResourceTimelineLanes.prototype.componentWillUnmount = function () { - if (this.props.onRowCoords) { - this.props.onRowCoords(null); - } - }; - ResourceTimelineLanes.prototype.updateCoords = function () { - var props = this.props; - if (props.onRowCoords && props.clientWidth !== null) { // a populated clientWidth means sizing has stabilized - this.props.onRowCoords(new PositionCache(this.rootElRef.current, collectRowEls(this.rowElRefs.currentMap, props.rowNodes), false, true)); - } - }; - return ResourceTimelineLanes; - }(BaseComponent)); - function collectRowEls(elMap, rowNodes) { - return rowNodes.map(function (rowNode) { return elMap[rowNode.id]; }); - } - - var ResourceTimelineGrid = /** @class */ (function (_super) { - __extends(ResourceTimelineGrid, _super); - function ResourceTimelineGrid() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.computeHasResourceBusinessHours = memoize(computeHasResourceBusinessHours); - _this.resourceSplitter = new ResourceSplitter(); // doesn't let it do businessHours tho - _this.bgSlicer = new TimelineLaneSlicer(); - _this.slatsRef = createRef(); // needed for Hit creation :( - _this.state = { - slatCoords: null, - }; - _this.handleEl = function (el) { - if (el) { - _this.context.registerInteractiveComponent(_this, { el: el }); - } - else { - _this.context.unregisterInteractiveComponent(_this); - } - }; - _this.handleSlatCoords = function (slatCoords) { - _this.setState({ slatCoords: slatCoords }); - if (_this.props.onSlatCoords) { - _this.props.onSlatCoords(slatCoords); - } - }; - _this.handleRowCoords = function (rowCoords) { - _this.rowCoords = rowCoords; - if (_this.props.onRowCoords) { - _this.props.onRowCoords(rowCoords); - } - }; - return _this; - } - ResourceTimelineGrid.prototype.render = function () { - var _this = this; - var _a = this, props = _a.props, state = _a.state, context = _a.context; - var dateProfile = props.dateProfile, tDateProfile = props.tDateProfile; - var timerUnit = greatestDurationDenominator(tDateProfile.slotDuration).unit; - var hasResourceBusinessHours = this.computeHasResourceBusinessHours(props.rowNodes); - var splitProps = this.resourceSplitter.splitProps(props); - var bgLaneProps = splitProps['']; - var bgSlicedProps = this.bgSlicer.sliceProps(bgLaneProps, dateProfile, tDateProfile.isTimeScale ? null : props.nextDayThreshold, context, // wish we didn't need to pass in the rest of these args... - dateProfile, context.dateProfileGenerator, tDateProfile, context.dateEnv); - // WORKAROUND: make ignore slatCoords when out of sync with dateProfile - var slatCoords = state.slatCoords && state.slatCoords.dateProfile === props.dateProfile ? state.slatCoords : null; - return (createElement("div", { ref: this.handleEl, className: "fc-timeline-body", style: { minWidth: props.tableMinWidth } }, - createElement(NowTimer, { unit: timerUnit }, function (nowDate, todayRange) { return (createElement(Fragment, null, - createElement(TimelineSlats, { ref: _this.slatsRef, dateProfile: dateProfile, tDateProfile: tDateProfile, nowDate: nowDate, todayRange: todayRange, clientWidth: props.clientWidth, tableColGroupNode: props.tableColGroupNode, tableMinWidth: props.tableMinWidth, onCoords: _this.handleSlatCoords, onScrollLeftRequest: props.onScrollLeftRequest }), - createElement(TimelineLaneBg, { businessHourSegs: hasResourceBusinessHours ? null : bgSlicedProps.businessHourSegs, bgEventSegs: bgSlicedProps.bgEventSegs, timelineCoords: slatCoords, - // empty array will result in unnecessary rerenders? - eventResizeSegs: (bgSlicedProps.eventResize ? bgSlicedProps.eventResize.segs : []), dateSelectionSegs: bgSlicedProps.dateSelectionSegs, nowDate: nowDate, todayRange: todayRange }), - createElement(ResourceTimelineLanes, { rowNodes: props.rowNodes, dateProfile: dateProfile, tDateProfile: props.tDateProfile, nowDate: nowDate, todayRange: todayRange, splitProps: splitProps, fallbackBusinessHours: hasResourceBusinessHours ? props.businessHours : null, clientWidth: props.clientWidth, minHeight: props.expandRows ? props.clientHeight : '', tableMinWidth: props.tableMinWidth, innerHeights: props.rowInnerHeights, slatCoords: slatCoords, onRowCoords: _this.handleRowCoords, onRowHeightChange: props.onRowHeightChange }), - (context.options.nowIndicator && slatCoords && slatCoords.isDateInRange(nowDate)) && (createElement("div", { className: "fc-timeline-now-indicator-container" }, - createElement(NowIndicatorRoot, { isAxis: false, date: nowDate }, function (rootElRef, classNames, innerElRef, innerContent) { return (createElement("div", { ref: rootElRef, className: ['fc-timeline-now-indicator-line'].concat(classNames).join(' '), style: { left: slatCoords.dateToCoord(nowDate) } }, innerContent)); }))))); }))); - }; - // Hit System - // ------------------------------------------------------------------------------------------ - ResourceTimelineGrid.prototype.queryHit = function (positionLeft, positionTop) { - var rowCoords = this.rowCoords; - var rowIndex = rowCoords.topToIndex(positionTop); - if (rowIndex != null) { - var resource = this.props.rowNodes[rowIndex].resource; - if (resource) { // not a group - var slatHit = this.slatsRef.current.positionToHit(positionLeft); - if (slatHit) { - return { - component: this, - dateSpan: { - range: slatHit.dateSpan.range, - allDay: slatHit.dateSpan.allDay, - resourceId: resource.id, - }, - rect: { - left: slatHit.left, - right: slatHit.right, - top: rowCoords.tops[rowIndex], - bottom: rowCoords.bottoms[rowIndex], - }, - dayEl: slatHit.dayEl, - layer: 0, - }; - } - } - } - return null; - }; - return ResourceTimelineGrid; - }(DateComponent)); - function computeHasResourceBusinessHours(rowNodes) { - for (var _i = 0, rowNodes_1 = rowNodes; _i < rowNodes_1.length; _i++) { - var node = rowNodes_1[_i]; - var resource = node.resource; - if (resource && resource.businessHours) { - return true; - } - } - return false; - } - - var MIN_RESOURCE_AREA_WIDTH = 30; // definitely bigger than scrollbars - // RENAME? - var ResourceTimelineViewLayout = /** @class */ (function (_super) { - __extends(ResourceTimelineViewLayout, _super); - function ResourceTimelineViewLayout() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.scrollGridRef = createRef(); - _this.timeBodyScrollerElRef = createRef(); - _this.spreadsheetHeaderChunkElRef = createRef(); - _this.rootElRef = createRef(); - _this.state = { - resourceAreaWidthOverride: null, - }; - return _this; - } - ResourceTimelineViewLayout.prototype.render = function () { - var _a = this, props = _a.props, state = _a.state, context = _a.context; - var options = context.options; - var stickyHeaderDates = !props.forPrint && getStickyHeaderDates(options); - var stickyFooterScrollbar = !props.forPrint && getStickyFooterScrollbar(options); - var sections = [ - { - type: 'header', - key: 'header', - syncRowHeights: true, - isSticky: stickyHeaderDates, - chunks: [ - { - key: 'datagrid', - elRef: this.spreadsheetHeaderChunkElRef, - // TODO: allow the content to specify this. have general-purpose 'content' with obj with keys - tableClassName: 'fc-datagrid-header', - rowContent: props.spreadsheetHeaderRows, - }, - { - key: 'divider', - outerContent: (createElement("td", { className: 'fc-resource-timeline-divider ' + context.theme.getClass('tableCellShaded') })), - }, - { - key: 'timeline', - content: props.timeHeaderContent, - }, - ], - }, - { - type: 'body', - key: 'body', - syncRowHeights: true, - liquid: true, - expandRows: Boolean(options.expandRows), - chunks: [ - { - key: 'datagrid', - tableClassName: 'fc-datagrid-body', - rowContent: props.spreadsheetBodyRows, - }, - { - key: 'divider', - outerContent: (createElement("td", { className: 'fc-resource-timeline-divider ' + context.theme.getClass('tableCellShaded') })), - }, - { - key: 'timeline', - scrollerElRef: this.timeBodyScrollerElRef, - content: props.timeBodyContent, - }, - ], - }, - ]; - if (stickyFooterScrollbar) { - sections.push({ - type: 'footer', - key: 'footer', - isSticky: true, - chunks: [ - { - key: 'datagrid', - content: renderScrollShim, - }, - { - key: 'divider', - outerContent: (createElement("td", { className: 'fc-resource-timeline-divider ' + context.theme.getClass('tableCellShaded') })), - }, - { - key: 'timeline', - content: renderScrollShim, - }, - ], - }); - } - var resourceAreaWidth = state.resourceAreaWidthOverride != null - ? state.resourceAreaWidthOverride - : options.resourceAreaWidth; - return (createElement(ScrollGrid, { ref: this.scrollGridRef, elRef: this.rootElRef, liquid: !props.isHeightAuto && !props.forPrint, colGroups: [ - { cols: props.spreadsheetCols, width: resourceAreaWidth }, - { cols: [] }, - { cols: props.timeCols }, - ], sections: sections })); - }; - ResourceTimelineViewLayout.prototype.forceTimeScroll = function (left) { - var scrollGrid = this.scrollGridRef.current; - scrollGrid.forceScrollLeft(2, left); // 2 = the time area - }; - ResourceTimelineViewLayout.prototype.forceResourceScroll = function (top) { - var scrollGrid = this.scrollGridRef.current; - scrollGrid.forceScrollTop(1, top); // 1 = the body - }; - ResourceTimelineViewLayout.prototype.getResourceScroll = function () { - var timeBodyScrollerEl = this.timeBodyScrollerElRef.current; - return timeBodyScrollerEl.scrollTop; - }; - // Resource Area Resizing - // ------------------------------------------------------------------------------------------ - // NOTE: a callback Ref for the resizer was firing multiple times with same elements (Preact) - // that's why we use spreadsheetResizerElRef instead - ResourceTimelineViewLayout.prototype.componentDidMount = function () { - this.initSpreadsheetResizing(); - }; - ResourceTimelineViewLayout.prototype.componentWillUnmount = function () { - this.destroySpreadsheetResizing(); - }; - ResourceTimelineViewLayout.prototype.initSpreadsheetResizing = function () { - var _this = this; - var _a = this.context, isRtl = _a.isRtl, pluginHooks = _a.pluginHooks; - var ElementDraggingImpl = pluginHooks.elementDraggingImpl; - var spreadsheetHeadEl = this.spreadsheetHeaderChunkElRef.current; - if (ElementDraggingImpl) { - var rootEl_1 = this.rootElRef.current; - var dragging = this.spreadsheetResizerDragging = new ElementDraggingImpl(rootEl_1, '.fc-resource-timeline-divider'); - var dragStartWidth_1; - var viewWidth_1; - dragging.emitter.on('dragstart', function () { - dragStartWidth_1 = spreadsheetHeadEl.getBoundingClientRect().width; - viewWidth_1 = rootEl_1.getBoundingClientRect().width; - }); - dragging.emitter.on('dragmove', function (pev) { - var newWidth = dragStartWidth_1 + pev.deltaX * (isRtl ? -1 : 1); - newWidth = Math.max(newWidth, MIN_RESOURCE_AREA_WIDTH); - newWidth = Math.min(newWidth, viewWidth_1 - MIN_RESOURCE_AREA_WIDTH); - _this.setState({ - resourceAreaWidthOverride: newWidth, - }); - }); - dragging.setAutoScrollEnabled(false); // because gets weird with auto-scrolling time area - } - }; - ResourceTimelineViewLayout.prototype.destroySpreadsheetResizing = function () { - if (this.spreadsheetResizerDragging) { - this.spreadsheetResizerDragging.destroy(); - } - }; - return ResourceTimelineViewLayout; - }(BaseComponent)); - - var ResourceTimelineView = /** @class */ (function (_super) { - __extends(ResourceTimelineView, _super); - function ResourceTimelineView(props, context) { - var _this = _super.call(this, props, context) || this; - _this.processColOptions = memoize(processColOptions); - _this.buildTimelineDateProfile = memoize(buildTimelineDateProfile); - _this.hasNesting = memoize(hasNesting); - _this.buildRowNodes = memoize(buildRowNodes); - _this.layoutRef = createRef(); - _this.rowNodes = []; - _this.renderedRowNodes = []; - _this.buildRowIndex = memoize(buildRowIndex); - _this.handleSlatCoords = function (slatCoords) { - _this.setState({ slatCoords: slatCoords }); - }; - _this.handleRowCoords = function (rowCoords) { - _this.rowCoords = rowCoords; - _this.scrollResponder.update(false); // TODO: could eliminate this if rowCoords lived in state - }; - _this.handleMaxCushionWidth = function (slotCushionMaxWidth) { - _this.setState({ - slotCushionMaxWidth: Math.ceil(slotCushionMaxWidth), - }); - }; - // Scrolling - // ------------------------------------------------------------------------------------------------------------------ - // this is useful for scrolling prev/next dates while resource is scrolled down - _this.handleScrollLeftRequest = function (scrollLeft) { - var layout = _this.layoutRef.current; - layout.forceTimeScroll(scrollLeft); - }; - _this.handleScrollRequest = function (request) { - var rowCoords = _this.rowCoords; - var layout = _this.layoutRef.current; - var rowId = request.rowId || request.resourceId; - if (rowCoords) { - if (rowId) { - var rowIdToIndex = _this.buildRowIndex(_this.renderedRowNodes); - var index = rowIdToIndex[rowId]; - if (index != null) { - var scrollTop = (request.fromBottom != null ? - rowCoords.bottoms[index] - request.fromBottom : // pixels from bottom edge - rowCoords.tops[index] // just use top edge - ); - layout.forceResourceScroll(scrollTop); - } - } - return true; - } - return null; - }; - // Resource INDIVIDUAL-Column Area Resizing - // ------------------------------------------------------------------------------------------ - _this.handleColWidthChange = function (colWidths) { - _this.setState({ - spreadsheetColWidths: colWidths, - }); - }; - _this.state = { - resourceAreaWidth: context.options.resourceAreaWidth, - spreadsheetColWidths: [], - }; - return _this; - } - ResourceTimelineView.prototype.render = function () { - var _this = this; - var _a = this, props = _a.props, state = _a.state, context = _a.context; - var options = context.options, viewSpec = context.viewSpec; - var _b = this.processColOptions(context.options), superHeaderRendering = _b.superHeaderRendering, groupSpecs = _b.groupSpecs, orderSpecs = _b.orderSpecs, isVGrouping = _b.isVGrouping, colSpecs = _b.colSpecs; - var tDateProfile = this.buildTimelineDateProfile(props.dateProfile, context.dateEnv, options, context.dateProfileGenerator); - var rowNodes = this.rowNodes = this.buildRowNodes(props.resourceStore, groupSpecs, orderSpecs, isVGrouping, props.resourceEntityExpansions, options.resourcesInitiallyExpanded); - var extraClassNames = [ - 'fc-resource-timeline', - this.hasNesting(rowNodes) ? '' : 'fc-resource-timeline-flat', - 'fc-timeline', - options.eventOverlap === false ? 'fc-timeline-overlap-disabled' : 'fc-timeline-overlap-enabled', - ]; - var slotMinWidth = options.slotMinWidth; - var slatCols = buildSlatCols(tDateProfile, slotMinWidth || this.computeFallbackSlotMinWidth(tDateProfile)); - return (createElement(ViewRoot, { viewSpec: viewSpec }, function (rootElRef, classNames) { return (createElement("div", { ref: rootElRef, className: extraClassNames.concat(classNames).join(' ') }, - createElement(ResourceTimelineViewLayout, { ref: _this.layoutRef, forPrint: props.forPrint, isHeightAuto: props.isHeightAuto, spreadsheetCols: buildSpreadsheetCols(colSpecs, state.spreadsheetColWidths, ''), spreadsheetHeaderRows: function (contentArg) { return (createElement(SpreadsheetHeader // TODO: rename to SpreadsheetHeaderRows - , { superHeaderRendering: superHeaderRendering, colSpecs: colSpecs, onColWidthChange: _this.handleColWidthChange, rowInnerHeights: contentArg.rowSyncHeights })); }, spreadsheetBodyRows: function (contentArg) { return (createElement(Fragment, null, _this.renderSpreadsheetRows(rowNodes, colSpecs, contentArg.rowSyncHeights))); }, timeCols: slatCols, timeHeaderContent: function (contentArg) { return (createElement(TimelineHeader, { clientWidth: contentArg.clientWidth, clientHeight: contentArg.clientHeight, tableMinWidth: contentArg.tableMinWidth, tableColGroupNode: contentArg.tableColGroupNode, dateProfile: props.dateProfile, tDateProfile: tDateProfile, slatCoords: state.slatCoords, rowInnerHeights: contentArg.rowSyncHeights, onMaxCushionWidth: slotMinWidth ? null : _this.handleMaxCushionWidth })); }, timeBodyContent: function (contentArg) { return (createElement(ResourceTimelineGrid, { dateProfile: props.dateProfile, clientWidth: contentArg.clientWidth, clientHeight: contentArg.clientHeight, tableMinWidth: contentArg.tableMinWidth, tableColGroupNode: contentArg.tableColGroupNode, expandRows: contentArg.expandRows, tDateProfile: tDateProfile, rowNodes: rowNodes, businessHours: props.businessHours, dateSelection: props.dateSelection, eventStore: props.eventStore, eventUiBases: props.eventUiBases, eventSelection: props.eventSelection, eventDrag: props.eventDrag, eventResize: props.eventResize, resourceStore: props.resourceStore, nextDayThreshold: context.options.nextDayThreshold, rowInnerHeights: contentArg.rowSyncHeights, onSlatCoords: _this.handleSlatCoords, onRowCoords: _this.handleRowCoords, onScrollLeftRequest: _this.handleScrollLeftRequest, onRowHeightChange: contentArg.reportRowHeightChange })); } }))); })); - }; - ResourceTimelineView.prototype.renderSpreadsheetRows = function (nodes, colSpecs, rowSyncHeights) { - return nodes.map(function (node, index) { - if (node.group) { - return (createElement(SpreadsheetGroupRow, { key: node.id, id: node.id, spreadsheetColCnt: colSpecs.length, isExpanded: node.isExpanded, group: node.group, innerHeight: rowSyncHeights[index] || '' })); - } - if (node.resource) { - return (createElement(SpreadsheetRow, { key: node.id, colSpecs: colSpecs, rowSpans: node.rowSpans, depth: node.depth, isExpanded: node.isExpanded, hasChildren: node.hasChildren, resource: node.resource, innerHeight: rowSyncHeights[index] || '' })); - } - return null; - }); - }; - ResourceTimelineView.prototype.componentDidMount = function () { - this.renderedRowNodes = this.rowNodes; - this.scrollResponder = this.context.createScrollResponder(this.handleScrollRequest); - }; - ResourceTimelineView.prototype.getSnapshotBeforeUpdate = function () { - if (!this.props.forPrint) { // because print-view is always zero? - return { resourceScroll: this.queryResourceScroll() }; - } - return {}; - }; - ResourceTimelineView.prototype.componentDidUpdate = function (prevProps, prevState, snapshot) { - this.renderedRowNodes = this.rowNodes; - this.scrollResponder.update(prevProps.dateProfile !== this.props.dateProfile); - if (snapshot.resourceScroll) { - this.handleScrollRequest(snapshot.resourceScroll); // TODO: this gets triggered too often - } - }; - ResourceTimelineView.prototype.componentWillUnmount = function () { - this.scrollResponder.detach(); - }; - ResourceTimelineView.prototype.computeFallbackSlotMinWidth = function (tDateProfile) { - return Math.max(30, ((this.state.slotCushionMaxWidth || 0) / tDateProfile.slotsPerLabel)); - }; - ResourceTimelineView.prototype.queryResourceScroll = function () { - var _a = this, rowCoords = _a.rowCoords, renderedRowNodes = _a.renderedRowNodes; - if (rowCoords) { - var layout = this.layoutRef.current; - var trBottoms = rowCoords.bottoms; - var scrollTop = layout.getResourceScroll(); - var scroll_1 = {}; - for (var i = 0; i < trBottoms.length; i += 1) { - var rowNode = renderedRowNodes[i]; - var elBottom = trBottoms[i] - scrollTop; // from the top of the scroller - if (elBottom > 0) { - scroll_1.rowId = rowNode.id; - scroll_1.fromBottom = elBottom; - break; - } - } - return scroll_1; - } - return null; - }; - return ResourceTimelineView; - }(BaseComponent)); - ResourceTimelineView.addStateEquality({ - spreadsheetColWidths: isArraysEqual, - }); - function buildRowIndex(rowNodes) { - var rowIdToIndex = {}; - for (var i = 0; i < rowNodes.length; i += 1) { - rowIdToIndex[rowNodes[i].id] = i; - } - return rowIdToIndex; - } - function buildSpreadsheetCols(colSpecs, forcedWidths, fallbackWidth) { - if (fallbackWidth === void 0) { fallbackWidth = ''; } - return colSpecs.map(function (colSpec, i) { return ({ - className: colSpec.isMain ? 'fc-main-col' : '', - width: forcedWidths[i] || colSpec.width || fallbackWidth, - }); }); - } - function hasNesting(nodes) { - for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) { - var node = nodes_1[_i]; - if (node.group) { - return true; - } - if (node.resource) { - if (node.hasChildren) { - return true; - } - } - } - return false; - } - function processColOptions(options) { - var allColSpecs = options.resourceAreaColumns || []; - var superHeaderRendering = null; - if (!allColSpecs.length) { - allColSpecs.push({ - headerClassNames: options.resourceAreaHeaderClassNames, - headerContent: options.resourceAreaHeaderContent || 'Resources', - headerDidMount: options.resourceAreaHeaderDidMount, - headerWillUnmount: options.resourceAreaHeaderWillUnmount, - }); - } - else if (options.resourceAreaHeaderContent) { // weird way to determine if content - superHeaderRendering = { - headerClassNames: options.resourceAreaHeaderClassNames, - headerContent: options.resourceAreaHeaderContent, - headerDidMount: options.resourceAreaHeaderDidMount, - headerWillUnmount: options.resourceAreaHeaderWillUnmount, - }; - } - var plainColSpecs = []; - var groupColSpecs = []; // part of the colSpecs, but filtered out in order to put first - var groupSpecs = []; - var isVGrouping = false; - for (var _i = 0, allColSpecs_1 = allColSpecs; _i < allColSpecs_1.length; _i++) { - var colSpec = allColSpecs_1[_i]; - if (colSpec.group) { - groupColSpecs.push(__assign(__assign({}, colSpec), { cellClassNames: colSpec.cellClassNames || options.resourceGroupLabelClassNames, cellContent: colSpec.cellContent || options.resourceGroupLabelContent, cellDidMount: colSpec.cellDidMount || options.resourceGroupLabelDidMount, cellWillUnmount: colSpec.cellWillUnmount || options.resourceGroupLaneWillUnmount })); - } - else { - plainColSpecs.push(colSpec); - } - } - // BAD: mutates a user-supplied option - var mainColSpec = plainColSpecs[0]; - mainColSpec.isMain = true; - mainColSpec.cellClassNames = mainColSpec.cellClassNames || options.resourceLabelClassNames; - mainColSpec.cellContent = mainColSpec.cellContent || options.resourceLabelContent; - mainColSpec.cellDidMount = mainColSpec.cellDidMount || options.resourceLabelDidMount; - mainColSpec.cellWillUnmount = mainColSpec.cellWillUnmount || options.resourceLabelWillUnmount; - if (groupColSpecs.length) { - groupSpecs = groupColSpecs; - isVGrouping = true; - } - else { - var hGroupField = options.resourceGroupField; - if (hGroupField) { - groupSpecs.push({ - field: hGroupField, - labelClassNames: options.resourceGroupLabelClassNames, - labelContent: options.resourceGroupLabelContent, - labelDidMount: options.resourceGroupLabelDidMount, - labelWillUnmount: options.resourceGroupLabelWillUnmount, - laneClassNames: options.resourceGroupLaneClassNames, - laneContent: options.resourceGroupLaneContent, - laneDidMount: options.resourceGroupLaneDidMount, - laneWillUnmount: options.resourceGroupLaneWillUnmount, - }); - } - } - var allOrderSpecs = options.resourceOrder || DEFAULT_RESOURCE_ORDER; - var plainOrderSpecs = []; - for (var _a = 0, allOrderSpecs_1 = allOrderSpecs; _a < allOrderSpecs_1.length; _a++) { - var orderSpec = allOrderSpecs_1[_a]; - var isGroup = false; - for (var _b = 0, groupSpecs_1 = groupSpecs; _b < groupSpecs_1.length; _b++) { - var groupSpec = groupSpecs_1[_b]; - if (groupSpec.field === orderSpec.field) { - groupSpec.order = orderSpec.order; // -1, 0, 1 - isGroup = true; - break; - } - } - if (!isGroup) { - plainOrderSpecs.push(orderSpec); - } - } - return { - superHeaderRendering: superHeaderRendering, - isVGrouping: isVGrouping, - groupSpecs: groupSpecs, - colSpecs: groupColSpecs.concat(plainColSpecs), - orderSpecs: plainOrderSpecs, - }; - } - - var resourceTimelinePlugin = createPlugin({ - deps: [ - premiumCommonPlugin, - resourceCommonPlugin, - timelinePlugin, - ], - initialView: 'resourceTimelineDay', - views: { - resourceTimeline: { - type: 'timeline', - component: ResourceTimelineView, - needsResourceData: true, - resourceAreaWidth: '30%', - resourcesInitiallyExpanded: true, - eventResizableFromStart: true, - }, - resourceTimelineDay: { - type: 'resourceTimeline', - duration: { days: 1 }, - }, - resourceTimelineWeek: { - type: 'resourceTimeline', - duration: { weeks: 1 }, - }, - resourceTimelineMonth: { - type: 'resourceTimeline', - duration: { months: 1 }, - }, - resourceTimelineYear: { - type: 'resourceTimeline', - duration: { years: 1 }, - }, - }, - }); - - globalPlugins.push(interactionPlugin, dayGridPlugin, timeGridPlugin, listPlugin, plugin, googleCalendarPlugin, scrollGridPlugin, adaptivePlugin, timelinePlugin, resourceCommonPlugin, resourceDayGridPlugin, resourceTimeGridPlugin, resourceTimelinePlugin); - - exports.AbstractResourceDayTableModel = AbstractResourceDayTableModel; - exports.BASE_OPTION_DEFAULTS = BASE_OPTION_DEFAULTS; - exports.BASE_OPTION_REFINERS = BASE_OPTION_REFINERS; - exports.BaseComponent = BaseComponent; - exports.BgEvent = BgEvent; - exports.BootstrapTheme = BootstrapTheme; - exports.Calendar = Calendar; - exports.CalendarApi = CalendarApi; - exports.CalendarContent = CalendarContent; - exports.CalendarDataManager = CalendarDataManager; - exports.CalendarDataProvider = CalendarDataProvider; - exports.CalendarRoot = CalendarRoot; - exports.Component = Component; - exports.ContentHook = ContentHook; - exports.CustomContentRenderContext = CustomContentRenderContext; - exports.DEFAULT_RESOURCE_ORDER = DEFAULT_RESOURCE_ORDER; - exports.DateComponent = DateComponent; - exports.DateEnv = DateEnv; - exports.DateProfileGenerator = DateProfileGenerator; - exports.DayCellContent = DayCellContent; - exports.DayCellRoot = DayCellRoot; - exports.DayGridView = DayTableView; - exports.DayHeader = DayHeader; - exports.DayResourceTableModel = DayResourceTableModel; - exports.DaySeriesModel = DaySeriesModel; - exports.DayTable = DayTable; - exports.DayTableModel = DayTableModel; - exports.DayTableSlicer = DayTableSlicer; - exports.DayTimeCols = DayTimeCols; - exports.DayTimeColsSlicer = DayTimeColsSlicer; - exports.DayTimeColsView = DayTimeColsView; - exports.DelayedRunner = DelayedRunner; - exports.Draggable = ExternalDraggable; - exports.ElementDragging = ElementDragging; - exports.ElementScrollController = ElementScrollController; - exports.Emitter = Emitter; - exports.EventApi = EventApi; - exports.EventRoot = EventRoot; - exports.EventSourceApi = EventSourceApi; - exports.FeaturefulElementDragging = FeaturefulElementDragging; - exports.Fragment = Fragment; - exports.Interaction = Interaction; - exports.ListView = ListView; - exports.MountHook = MountHook; - exports.NamedTimeZoneImpl = NamedTimeZoneImpl; - exports.NowIndicatorRoot = NowIndicatorRoot; - exports.NowTimer = NowTimer; - exports.PointerDragging = PointerDragging; - exports.PositionCache = PositionCache; - exports.RefMap = RefMap; - exports.RenderHook = RenderHook; - exports.ResourceApi = ResourceApi; - exports.ResourceDayHeader = ResourceDayHeader; - exports.ResourceDayTable = ResourceDayTable; - exports.ResourceDayTableModel = ResourceDayTableModel; - exports.ResourceDayTableView = ResourceDayTableView; - exports.ResourceDayTimeCols = ResourceDayTimeCols; - exports.ResourceDayTimeColsView = ResourceDayTimeColsView; - exports.ResourceLabelRoot = ResourceLabelRoot; - exports.ResourceSplitter = ResourceSplitter; - exports.ResourceTimelineLane = ResourceTimelineLane; - exports.ResourceTimelineView = ResourceTimelineView; - exports.ScrollController = ScrollController; - exports.ScrollGrid = ScrollGrid; - exports.ScrollResponder = ScrollResponder; - exports.Scroller = Scroller; - exports.SimpleScrollGrid = SimpleScrollGrid; - exports.Slicer = Slicer; - exports.Splitter = Splitter; - exports.SpreadsheetRow = SpreadsheetRow; - exports.StandardEvent = StandardEvent; - exports.Table = Table; - exports.TableDateCell = TableDateCell; - exports.TableDowCell = TableDowCell; - exports.TableView = TableView; - exports.Theme = Theme; - exports.ThirdPartyDraggable = ThirdPartyDraggable; - exports.TimeCols = TimeCols; - exports.TimeColsSlatsCoords = TimeColsSlatsCoords; - exports.TimeColsView = TimeColsView; - exports.TimelineCoords = TimelineCoords; - exports.TimelineHeader = TimelineHeader; - exports.TimelineHeaderRows = TimelineHeaderRows; - exports.TimelineLane = TimelineLane; - exports.TimelineLaneBg = TimelineLaneBg; - exports.TimelineLaneSlicer = TimelineLaneSlicer; - exports.TimelineSlats = TimelineSlats; - exports.TimelineView = TimelineView; - exports.VResourceJoiner = VResourceJoiner; - exports.VResourceSplitter = VResourceSplitter; - exports.ViewApi = ViewApi; - exports.ViewContextType = ViewContextType; - exports.ViewRoot = ViewRoot; - exports.WeekNumberRoot = WeekNumberRoot; - exports.WindowScrollController = WindowScrollController; - exports.addDays = addDays; - exports.addDurations = addDurations; - exports.addMs = addMs; - exports.addWeeks = addWeeks; - exports.allowContextMenu = allowContextMenu; - exports.allowSelection = allowSelection; - exports.applyMutationToEventStore = applyMutationToEventStore; - exports.applyStyle = applyStyle; - exports.applyStyleProp = applyStyleProp; - exports.asCleanDays = asCleanDays; - exports.asRoughMinutes = asRoughMinutes; - exports.asRoughMs = asRoughMs; - exports.asRoughSeconds = asRoughSeconds; - exports.buildClassNameNormalizer = buildClassNameNormalizer; - exports.buildDayRanges = buildDayRanges; - exports.buildDayTableModel = buildDayTableModel; - exports.buildEventApis = buildEventApis; - exports.buildEventRangeKey = buildEventRangeKey; - exports.buildHashFromArray = buildHashFromArray; - exports.buildNavLinkData = buildNavLinkData; - exports.buildResourceFields = buildResourceFields; - exports.buildRowNodes = buildRowNodes; - exports.buildSegCompareObj = buildSegCompareObj; - exports.buildSegTimeText = buildSegTimeText; - exports.buildSlatCols = buildSlatCols; - exports.buildSlatMetas = buildSlatMetas; - exports.buildTimeColsModel = buildTimeColsModel; - exports.buildTimelineDateProfile = buildTimelineDateProfile; - exports.collectFromHash = collectFromHash; - exports.combineEventUis = combineEventUis; - exports.compareByFieldSpec = compareByFieldSpec; - exports.compareByFieldSpecs = compareByFieldSpecs; - exports.compareNumbers = compareNumbers; - exports.compareObjs = compareObjs; - exports.computeEdges = computeEdges; - exports.computeFallbackHeaderFormat = computeFallbackHeaderFormat; - exports.computeHeightAndMargins = computeHeightAndMargins; - exports.computeInnerRect = computeInnerRect; - exports.computeRect = computeRect; - exports.computeSegDraggable = computeSegDraggable; - exports.computeSegEndResizable = computeSegEndResizable; - exports.computeSegStartResizable = computeSegStartResizable; - exports.computeShrinkWidth = computeShrinkWidth; - exports.computeSmallestCellWidth = computeSmallestCellWidth; - exports.computeVisibleDayRange = computeVisibleDayRange; - exports.config = config; - exports.constrainPoint = constrainPoint; - exports.createContext = createContext$1; - exports.createDuration = createDuration; - exports.createElement = createElement; - exports.createEmptyEventStore = createEmptyEventStore; - exports.createEventInstance = createEventInstance; - exports.createEventUi = createEventUi; - exports.createFormatter = createFormatter; - exports.createPlugin = createPlugin; - exports.createRef = createRef; - exports.diffDates = diffDates; - exports.diffDayAndTime = diffDayAndTime; - exports.diffDays = diffDays; - exports.diffPoints = diffPoints; - exports.diffWeeks = diffWeeks; - exports.diffWholeDays = diffWholeDays; - exports.diffWholeWeeks = diffWholeWeeks; - exports.disableCursor = disableCursor; - exports.elementClosest = elementClosest; - exports.elementMatches = elementMatches; - exports.enableCursor = enableCursor; - exports.eventTupleToStore = eventTupleToStore; - exports.filterEventStoreDefs = filterEventStoreDefs; - exports.filterHash = filterHash; - exports.findDirectChildren = findDirectChildren; - exports.findElements = findElements; - exports.flattenResources = flattenResources; - exports.flexibleCompare = flexibleCompare; - exports.flushToDom = flushToDom$1; - exports.formatDate = formatDate; - exports.formatDayString = formatDayString; - exports.formatIsoTimeString = formatIsoTimeString; - exports.formatRange = formatRange; - exports.getAllowYScrolling = getAllowYScrolling; - exports.getCanVGrowWithinCell = getCanVGrowWithinCell; - exports.getClippingParents = getClippingParents; - exports.getDateMeta = getDateMeta; - exports.getDayClassNames = getDayClassNames; - exports.getDefaultEventEnd = getDefaultEventEnd; - exports.getElSeg = getElSeg; - exports.getEventClassNames = getEventClassNames; - exports.getIsRtlScrollbarOnLeft = getIsRtlScrollbarOnLeft; - exports.getPublicId = getPublicId; - exports.getRectCenter = getRectCenter; - exports.getRelevantEvents = getRelevantEvents; - exports.getScrollGridClassNames = getScrollGridClassNames; - exports.getScrollbarWidths = getScrollbarWidths; - exports.getSectionClassNames = getSectionClassNames; - exports.getSectionHasLiquidHeight = getSectionHasLiquidHeight; - exports.getSegMeta = getSegMeta; - exports.getSlotClassNames = getSlotClassNames; - exports.getStickyFooterScrollbar = getStickyFooterScrollbar; - exports.getStickyHeaderDates = getStickyHeaderDates; - exports.getUnequalProps = getUnequalProps; - exports.globalLocales = globalLocales; - exports.globalPlugins = globalPlugins; - exports.greatestDurationDenominator = greatestDurationDenominator; - exports.guid = guid; - exports.hasBgRendering = hasBgRendering; - exports.hasShrinkWidth = hasShrinkWidth; - exports.identity = identity; - exports.interactionSettingsStore = interactionSettingsStore; - exports.interactionSettingsToStore = interactionSettingsToStore; - exports.intersectRanges = intersectRanges; - exports.intersectRects = intersectRects; - exports.isArraysEqual = isArraysEqual; - exports.isColPropsEqual = isColPropsEqual; - exports.isDateSpansEqual = isDateSpansEqual; - exports.isGroupsEqual = isGroupsEqual; - exports.isInt = isInt; - exports.isInteractionValid = isInteractionValid; - exports.isMultiDayRange = isMultiDayRange; - exports.isPropsEqual = isPropsEqual; - exports.isPropsValid = isPropsValid; - exports.isValidDate = isValidDate; - exports.listenBySelector = listenBySelector; - exports.mapHash = mapHash; - exports.memoize = memoize; - exports.memoizeArraylike = memoizeArraylike; - exports.memoizeHashlike = memoizeHashlike; - exports.memoizeObjArg = memoizeObjArg; - exports.mergeEventStores = mergeEventStores; - exports.multiplyDuration = multiplyDuration; - exports.padStart = padStart; - exports.parseBusinessHours = parseBusinessHours; - exports.parseClassNames = parseClassNames; - exports.parseDragMeta = parseDragMeta; - exports.parseEventDef = parseEventDef; - exports.parseFieldSpecs = parseFieldSpecs; - exports.parseMarker = parse; - exports.pointInsideRect = pointInsideRect; - exports.preventContextMenu = preventContextMenu; - exports.preventDefault = preventDefault; - exports.preventSelection = preventSelection; - exports.rangeContainsMarker = rangeContainsMarker; - exports.rangeContainsRange = rangeContainsRange; - exports.rangesEqual = rangesEqual; - exports.rangesIntersect = rangesIntersect; - exports.refineEventDef = refineEventDef; - exports.refineProps = refineProps; - exports.removeElement = removeElement; - exports.removeExact = removeExact; - exports.render = render; - exports.renderChunkContent = renderChunkContent; - exports.renderFill = renderFill; - exports.renderMicroColGroup = renderMicroColGroup; - exports.renderScrollShim = renderScrollShim; - exports.requestJson = requestJson; - exports.sanitizeShrinkWidth = sanitizeShrinkWidth; - exports.setElSeg = setElSeg; - exports.setRef = setRef; - exports.setScrollFromStartingEdge = setScrollFromStartingEdge; - exports.sliceEventStore = sliceEventStore; - exports.sliceEvents = sliceEvents; - exports.sortEventSegs = sortEventSegs; - exports.startOfDay = startOfDay; - exports.translateRect = translateRect; - exports.triggerDateSelect = triggerDateSelect; - exports.unmountComponentAtNode = unmountComponentAtNode$1; - exports.unpromisify = unpromisify; - exports.version = version; - exports.whenTransitionDone = whenTransitionDone; - exports.wholeDivideDurations = wholeDivideDurations; - - Object.defineProperty(exports, '__esModule', { value: true }); - - return exports; - -}({})); diff --git a/static_common/common/vendor/fullcalendar-scheduler/main.min.css b/static_common/common/vendor/fullcalendar-scheduler/main.min.css deleted file mode 100644 index aaec7e82..00000000 --- a/static_common/common/vendor/fullcalendar-scheduler/main.min.css +++ /dev/null @@ -1 +0,0 @@ -.fc-icon,.fc-unselectable{-webkit-user-select:none;-ms-user-select:none}.fc .fc-button,.fc-icon{text-transform:none;text-align:center}.fc-not-allowed,.fc-not-allowed .fc-event{cursor:not-allowed}.fc .fc-button:not(:disabled),.fc a[data-navlink],.fc-event.fc-event-draggable,.fc-event[href]{cursor:pointer}.fc-unselectable{-moz-user-select:none;user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent}.fc{display:flex;flex-direction:column;font-size:1em}.fc .fc-button,.fc-icon{display:inline-block;font-weight:400;-moz-user-select:none}.fc,.fc *,.fc :after,.fc :before{box-sizing:border-box}.fc table{border-collapse:collapse;border-spacing:0;font-size:1em}.fc th{text-align:center}.fc td,.fc th{vertical-align:top;padding:0}.fc .fc-button,.fc .fc-button .fc-icon,.fc .fc-button-group,.fc .fc-timegrid-slot-label{vertical-align:middle}.fc a[data-navlink]:hover{text-decoration:underline}.fc-direction-ltr{direction:ltr;text-align:left}.fc-direction-rtl{direction:rtl;text-align:right}.fc-theme-standard td,.fc-theme-standard th{border:1px solid #ddd;border:1px solid var(--fc-border-color,#ddd)}.fc-liquid-hack td,.fc-liquid-hack th{position:relative}@font-face{font-family:fcicons;src:url("data:application/x-font-ttf;charset=utf-8;base64,AAEAAAALAIAAAwAwT1MvMg8SBfAAAAC8AAAAYGNtYXAXVtKNAAABHAAAAFRnYXNwAAAAEAAAAXAAAAAIZ2x5ZgYydxIAAAF4AAAFNGhlYWQUJ7cIAAAGrAAAADZoaGVhB20DzAAABuQAAAAkaG10eCIABhQAAAcIAAAALGxvY2ED4AU6AAAHNAAAABhtYXhwAA8AjAAAB0wAAAAgbmFtZXsr690AAAdsAAABhnBvc3QAAwAAAAAI9AAAACAAAwPAAZAABQAAApkCzAAAAI8CmQLMAAAB6wAzAQkAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAAADpBgPA/8AAQAPAAEAAAAABAAAAAAAAAAAAAAAgAAAAAAADAAAAAwAAABwAAQADAAAAHAADAAEAAAAcAAQAOAAAAAoACAACAAIAAQAg6Qb//f//AAAAAAAg6QD//f//AAH/4xcEAAMAAQAAAAAAAAAAAAAAAQAB//8ADwABAAAAAAAAAAAAAgAANzkBAAAAAAEAAAAAAAAAAAACAAA3OQEAAAAAAQAAAAAAAAAAAAIAADc5AQAAAAABAWIAjQKeAskAEwAAJSc3NjQnJiIHAQYUFwEWMjc2NCcCnuLiDQ0MJAz/AA0NAQAMJAwNDcni4gwjDQwM/wANIwz/AA0NDCMNAAAAAQFiAI0CngLJABMAACUBNjQnASYiBwYUHwEHBhQXFjI3AZ4BAA0N/wAMJAwNDeLiDQ0MJAyNAQAMIw0BAAwMDSMM4uINIwwNDQAAAAIA4gC3Ax4CngATACcAACUnNzY0JyYiDwEGFB8BFjI3NjQnISc3NjQnJiIPAQYUHwEWMjc2NCcB87e3DQ0MIw3VDQ3VDSMMDQ0BK7e3DQ0MJAzVDQ3VDCQMDQ3zuLcMJAwNDdUNIwzWDAwNIwy4twwkDA0N1Q0jDNYMDA0jDAAAAgDiALcDHgKeABMAJwAAJTc2NC8BJiIHBhQfAQcGFBcWMjchNzY0LwEmIgcGFB8BBwYUFxYyNwJJ1Q0N1Q0jDA0Nt7cNDQwjDf7V1Q0N1QwkDA0Nt7cNDQwkDLfWDCMN1Q0NDCQMt7gMIw0MDNYMIw3VDQ0MJAy3uAwjDQwMAAADAFUAAAOrA1UAMwBoAHcAABMiBgcOAQcOAQcOARURFBYXHgEXHgEXHgEzITI2Nz4BNz4BNz4BNRE0JicuAScuAScuASMFITIWFx4BFx4BFx4BFREUBgcOAQcOAQcOASMhIiYnLgEnLgEnLgE1ETQ2Nz4BNz4BNz4BMxMhMjY1NCYjISIGFRQWM9UNGAwLFQkJDgUFBQUFBQ4JCRULDBgNAlYNGAwLFQkJDgUFBQUFBQ4JCRULDBgN/aoCVgQIBAQHAwMFAQIBAQIBBQMDBwQECAT9qgQIBAQHAwMFAQIBAQIBBQMDBwQECASAAVYRGRkR/qoRGRkRA1UFBAUOCQkVDAsZDf2rDRkLDBUJCA4FBQUFBQUOCQgVDAsZDQJVDRkLDBUJCQ4FBAVVAgECBQMCBwQECAX9qwQJAwQHAwMFAQICAgIBBQMDBwQDCQQCVQUIBAQHAgMFAgEC/oAZEhEZGRESGQAAAAADAFUAAAOrA1UAMwBoAIkAABMiBgcOAQcOAQcOARURFBYXHgEXHgEXHgEzITI2Nz4BNz4BNz4BNRE0JicuAScuAScuASMFITIWFx4BFx4BFx4BFREUBgcOAQcOAQcOASMhIiYnLgEnLgEnLgE1ETQ2Nz4BNz4BNz4BMxMzFRQWMzI2PQEzMjY1NCYrATU0JiMiBh0BIyIGFRQWM9UNGAwLFQkJDgUFBQUFBQ4JCRULDBgNAlYNGAwLFQkJDgUFBQUFBQ4JCRULDBgN/aoCVgQIBAQHAwMFAQIBAQIBBQMDBwQECAT9qgQIBAQHAwMFAQIBAQIBBQMDBwQECASAgBkSEhmAERkZEYAZEhIZgBEZGREDVQUEBQ4JCRUMCxkN/asNGQsMFQkIDgUFBQUFBQ4JCBUMCxkNAlUNGQsMFQkJDgUEBVUCAQIFAwIHBAQIBf2rBAkDBAcDAwUBAgICAgEFAwMHBAMJBAJVBQgEBAcCAwUCAQL+gIASGRkSgBkSERmAEhkZEoAZERIZAAABAOIAjQMeAskAIAAAExcHBhQXFjI/ARcWMjc2NC8BNzY0JyYiDwEnJiIHBhQX4uLiDQ0MJAzi4gwkDA0N4uINDQwkDOLiDCQMDQ0CjeLiDSMMDQ3h4Q0NDCMN4uIMIw0MDOLiDAwNIwwAAAABAAAAAQAAa5n0y18PPPUACwQAAAAAANivOVsAAAAA2K85WwAAAAADqwNVAAAACAACAAAAAAAAAAEAAAPA/8AAAAQAAAAAAAOrAAEAAAAAAAAAAAAAAAAAAAALBAAAAAAAAAAAAAAAAgAAAAQAAWIEAAFiBAAA4gQAAOIEAABVBAAAVQQAAOIAAAAAAAoAFAAeAEQAagCqAOoBngJkApoAAQAAAAsAigADAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAA4ArgABAAAAAAABAAcAAAABAAAAAAACAAcAYAABAAAAAAADAAcANgABAAAAAAAEAAcAdQABAAAAAAAFAAsAFQABAAAAAAAGAAcASwABAAAAAAAKABoAigADAAEECQABAA4ABwADAAEECQACAA4AZwADAAEECQADAA4APQADAAEECQAEAA4AfAADAAEECQAFABYAIAADAAEECQAGAA4AUgADAAEECQAKADQApGZjaWNvbnMAZgBjAGkAYwBvAG4Ac1ZlcnNpb24gMS4wAFYAZQByAHMAaQBvAG4AIAAxAC4AMGZjaWNvbnMAZgBjAGkAYwBvAG4Ac2ZjaWNvbnMAZgBjAGkAYwBvAG4Ac1JlZ3VsYXIAUgBlAGcAdQBsAGEAcmZjaWNvbnMAZgBjAGkAYwBvAG4Ac0ZvbnQgZ2VuZXJhdGVkIGJ5IEljb01vb24uAEYAbwBuAHQAIABnAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAEkAYwBvAE0AbwBvAG4ALgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=") format('truetype');font-weight:400;font-style:normal}.fc-icon{width:1em;height:1em;user-select:none;font-family:fcicons!important;speak:none;font-style:normal;font-variant:normal;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fc .fc-scroller-harness-liquid,.fc .fc-scroller-liquid,.fc .fc-scrollgrid-liquid{height:100%}.fc-icon-chevron-left:before{content:"\e900"}.fc-icon-chevron-right:before{content:"\e901"}.fc-icon-chevrons-left:before{content:"\e902"}.fc-icon-chevrons-right:before{content:"\e903"}.fc-icon-minus-square:before{content:"\e904"}.fc-icon-plus-square:before{content:"\e905"}.fc-icon-x:before{content:"\e906"}.fc .fc-button{overflow:visible;text-transform:none;margin:0;font-family:inherit}.fc .fc-button::-moz-focus-inner{padding:0;border-style:none}.fc .fc-button{-webkit-appearance:button;-webkit-user-select:none;-ms-user-select:none;user-select:none;background-color:transparent;border:1px solid transparent;padding:.4em .65em;font-size:1em;line-height:1.5;border-radius:.25em}.fc .fc-button:hover{text-decoration:none}.fc .fc-button:focus{outline:0;box-shadow:0 0 0 .2rem rgba(44,62,80,.25)}.fc .fc-button-primary:focus,.fc .fc-button-primary:not(:disabled).fc-button-active:focus,.fc .fc-button-primary:not(:disabled):active:focus{box-shadow:0 0 0 .2rem rgba(76,91,106,.5)}.fc .fc-button:disabled{opacity:.65}.fc .fc-button-primary{color:#fff;color:var(--fc-button-text-color,#fff);background-color:#2C3E50;background-color:var(--fc-button-bg-color,#2C3E50);border-color:#2C3E50;border-color:var(--fc-button-border-color,#2C3E50)}.fc .fc-button-primary:hover{color:#fff;color:var(--fc-button-text-color,#fff);background-color:#1e2b37;background-color:var(--fc-button-hover-bg-color,#1e2b37);border-color:#1a252f;border-color:var(--fc-button-hover-border-color,#1a252f)}.fc .fc-button-primary:disabled{color:#fff;color:var(--fc-button-text-color,#fff);background-color:#2C3E50;background-color:var(--fc-button-bg-color,#2C3E50);border-color:#2C3E50;border-color:var(--fc-button-border-color,#2C3E50)}.fc .fc-button-primary:not(:disabled).fc-button-active,.fc .fc-button-primary:not(:disabled):active{color:#fff;color:var(--fc-button-text-color,#fff);background-color:#1a252f;background-color:var(--fc-button-active-bg-color,#1a252f);border-color:#151e27;border-color:var(--fc-button-active-border-color,#151e27)}.fc .fc-button .fc-icon{font-size:1.5em}.fc .fc-button-group{position:relative;display:inline-flex}.fc .fc-button-group>.fc-button{position:relative;flex:1 1 auto}.fc .fc-button-group>.fc-button.fc-button-active,.fc .fc-button-group>.fc-button:active,.fc .fc-button-group>.fc-button:focus,.fc .fc-button-group>.fc-button:hover{z-index:1}.fc-direction-ltr .fc-button-group>.fc-button:not(:first-child){margin-left:-1px;border-top-left-radius:0;border-bottom-left-radius:0}.fc-direction-ltr .fc-button-group>.fc-button:not(:last-child){border-top-right-radius:0;border-bottom-right-radius:0}.fc-direction-rtl .fc-button-group>.fc-button:not(:first-child){margin-right:-1px;border-top-right-radius:0;border-bottom-right-radius:0}.fc-direction-rtl .fc-button-group>.fc-button:not(:last-child){border-top-left-radius:0;border-bottom-left-radius:0}.fc .fc-toolbar{display:flex;justify-content:space-between;align-items:center}.fc .fc-toolbar.fc-header-toolbar{margin-bottom:1.5em}.fc .fc-toolbar.fc-footer-toolbar{margin-top:1.5em}.fc .fc-toolbar-title{font-size:1.75em;margin:0}.fc-direction-ltr .fc-toolbar>*>:not(:first-child){margin-left:.75em}.fc-direction-rtl .fc-toolbar>*>:not(:first-child){margin-right:.75em}.fc-direction-rtl .fc-toolbar-ltr{flex-direction:row-reverse}.fc .fc-scroller{-webkit-overflow-scrolling:touch;position:relative}.fc .fc-scroller-liquid-absolute{position:absolute;top:0;right:0;left:0;bottom:0}.fc .fc-scroller-harness{position:relative;overflow:hidden;direction:ltr}.fc-direction-rtl .fc-scroller-harness>.fc-scroller{direction:rtl}.fc-theme-standard .fc-scrollgrid{border:1px solid #ddd;border:1px solid var(--fc-border-color,#ddd)}.fc .fc-scrollgrid,.fc .fc-scrollgrid-section-footer>*,.fc .fc-scrollgrid-section-header>*{border-bottom-width:0}.fc .fc-scrollgrid,.fc .fc-scrollgrid table{width:100%;table-layout:fixed}.fc .fc-scrollgrid table{border-top-style:hidden;border-left-style:hidden;border-right-style:hidden}.fc .fc-scrollgrid{border-collapse:separate;border-right-width:0}.fc .fc-scrollgrid-section,.fc .fc-scrollgrid-section table,.fc .fc-scrollgrid-section>td{height:1px}.fc .fc-scrollgrid-section-liquid{height:auto}.fc .fc-scrollgrid-section-liquid>td{height:100%}.fc .fc-scrollgrid-section>*{border-top-width:0;border-left-width:0}.fc .fc-scrollgrid-section-body table,.fc .fc-scrollgrid-section-footer table{border-bottom-style:hidden}.fc .fc-scrollgrid-section-sticky>*{background:var(--fc-page-bg-color,#fff);position:-webkit-sticky;position:sticky;z-index:2}.fc .fc-scrollgrid-section-header.fc-scrollgrid-section-sticky>*{top:0}.fc .fc-scrollgrid-section-footer.fc-scrollgrid-section-sticky>*{bottom:0}.fc .fc-scrollgrid-sticky-shim{height:1px;margin-bottom:-1px}.fc-sticky{position:-webkit-sticky;position:sticky}.fc .fc-view-harness{flex-grow:1;position:relative}.fc .fc-bg-event,.fc .fc-highlight,.fc .fc-non-business,.fc .fc-view-harness-active>.fc-view{position:absolute;top:0;left:0;right:0;bottom:0}.fc .fc-col-header-cell-cushion{display:inline-block;padding:2px 4px}.fc .fc-non-business{background:rgba(215,215,215,.3);background:var(--fc-non-business-color,rgba(215,215,215,.3))}.fc .fc-bg-event{background:var(--fc-bg-event-color,#8fdf82);opacity:.3;opacity:var(--fc-bg-event-opacity,.3)}.fc .fc-bg-event .fc-event-title{margin:.5em;font-size:.85em;font-size:var(--fc-small-font-size,.85em);font-style:italic}.fc .fc-highlight{background:rgba(188,232,241,.3);background:var(--fc-highlight-color,rgba(188,232,241,.3))}.fc .fc-cell-shaded,.fc .fc-day-disabled{background:rgba(208,208,208,.3);background:var(--fc-neutral-bg-color,rgba(208,208,208,.3))}a.fc-event,a.fc-event:hover{text-decoration:none}.fc-event .fc-event-main{position:relative;z-index:2}.fc-event-dragging:not(.fc-event-selected){opacity:.75}.fc-event-dragging.fc-event-selected{box-shadow:0 2px 7px rgba(0,0,0,.3)}.fc-event .fc-event-resizer{display:none;position:absolute;z-index:4}.fc-event-selected .fc-event-resizer,.fc-event:hover .fc-event-resizer,.fc-h-event{display:block}.fc-event-selected .fc-event-resizer{border-radius:4px;border-radius:calc(var(--fc-event-resizer-dot-total-width,8px)/ 2);border-width:1px;border-width:var(--fc-event-resizer-dot-border-width,1px);width:8px;width:var(--fc-event-resizer-dot-total-width,8px);height:8px;height:var(--fc-event-resizer-dot-total-width,8px);border-style:solid;border-color:inherit;background:var(--fc-page-bg-color,#fff)}.fc-event-selected .fc-event-resizer:before{content:'';position:absolute;top:-20px;left:-20px;right:-20px;bottom:-20px}.fc-event-selected{box-shadow:0 2px 5px rgba(0,0,0,.2)}.fc-event-selected:before{content:"";position:absolute;z-index:3;top:0;left:0;right:0;bottom:0}.fc-event-selected:after{content:"";background:rgba(0,0,0,.25);background:var(--fc-event-selected-overlay-color,rgba(0,0,0,.25));position:absolute;z-index:1;top:-1px;left:-1px;right:-1px;bottom:-1px}.fc-h-event{border:1px solid #3788d8;border:1px solid var(--fc-event-border-color,#3788d8);background-color:#3788d8;background-color:var(--fc-event-bg-color,#3788d8)}.fc-h-event .fc-event-main{color:#fff;color:var(--fc-event-text-color,#fff)}.fc-h-event .fc-event-main-frame{display:flex}.fc-h-event .fc-event-time{max-width:100%;overflow:hidden}.fc-h-event .fc-event-title-container{flex-grow:1;flex-shrink:1;min-width:0}.fc-h-event .fc-event-title{display:inline-block;vertical-align:top;left:0;right:0;max-width:100%;overflow:hidden}.fc-h-event.fc-event-selected:before{top:-10px;bottom:-10px}.fc-direction-ltr .fc-daygrid-block-event:not(.fc-event-start),.fc-direction-rtl .fc-daygrid-block-event:not(.fc-event-end){border-top-left-radius:0;border-bottom-left-radius:0;border-left-width:0}.fc-direction-ltr .fc-daygrid-block-event:not(.fc-event-end),.fc-direction-rtl .fc-daygrid-block-event:not(.fc-event-start){border-top-right-radius:0;border-bottom-right-radius:0;border-right-width:0}.fc-h-event:not(.fc-event-selected) .fc-event-resizer{top:0;bottom:0;width:8px;width:var(--fc-event-resizer-thickness,8px)}.fc-direction-ltr .fc-h-event:not(.fc-event-selected) .fc-event-resizer-start,.fc-direction-rtl .fc-h-event:not(.fc-event-selected) .fc-event-resizer-end{cursor:w-resize;left:-4px;left:calc(var(--fc-event-resizer-thickness,8px)/ -2)}.fc-direction-ltr .fc-h-event:not(.fc-event-selected) .fc-event-resizer-end,.fc-direction-rtl .fc-h-event:not(.fc-event-selected) .fc-event-resizer-start{cursor:e-resize;right:-4px;right:calc(var(--fc-event-resizer-thickness,8px)/ -2)}.fc-h-event.fc-event-selected .fc-event-resizer{top:50%;margin-top:-4px;margin-top:calc(var(--fc-event-resizer-dot-total-width,8px)/ -2)}.fc-direction-ltr .fc-h-event.fc-event-selected .fc-event-resizer-start,.fc-direction-rtl .fc-h-event.fc-event-selected .fc-event-resizer-end{left:-4px;left:calc(var(--fc-event-resizer-dot-total-width,8px)/ -2)}.fc-direction-ltr .fc-h-event.fc-event-selected .fc-event-resizer-end,.fc-direction-rtl .fc-h-event.fc-event-selected .fc-event-resizer-start{right:-4px;right:calc(var(--fc-event-resizer-dot-total-width,8px)/ -2)}:root{--fc-daygrid-event-dot-width:8px;--fc-list-event-dot-width:10px;--fc-list-event-hover-bg-color:#f5f5f5}.fc .fc-popover{position:fixed;top:0;box-shadow:0 2px 6px rgba(0,0,0,.15)}.fc .fc-popover-header{display:flex;flex-direction:row;justify-content:space-between;align-items:center;padding:3px 4px}.fc .fc-popover-title{margin:0 2px}.fc .fc-popover-close{cursor:pointer;opacity:.65;font-size:1.1em}.fc-theme-standard .fc-popover{border:1px solid #ddd;border:1px solid var(--fc-border-color,#ddd);background:var(--fc-page-bg-color,#fff)}.fc-theme-standard .fc-popover-header{background:rgba(208,208,208,.3);background:var(--fc-neutral-bg-color,rgba(208,208,208,.3))}.fc-daygrid-day-events:after,.fc-daygrid-day-events:before,.fc-daygrid-day-frame:after,.fc-daygrid-day-frame:before,.fc-daygrid-event-harness:after,.fc-daygrid-event-harness:before{content:"";clear:both;display:table}.fc .fc-daygrid-body{position:relative;z-index:1}.fc .fc-daygrid-day.fc-day-today{background-color:rgba(255,220,40,.15);background-color:var(--fc-today-bg-color,rgba(255,220,40,.15))}.fc .fc-daygrid-day-frame{position:relative;min-height:100%}.fc .fc-daygrid-day-top{display:flex;flex-direction:row-reverse}.fc .fc-day-other .fc-daygrid-day-top{opacity:.3}.fc .fc-daygrid-day-number{position:relative;z-index:4;padding:4px}.fc .fc-daygrid-day-events{margin-top:1px}.fc .fc-daygrid-body-balanced .fc-daygrid-day-events{position:absolute;left:0;right:0}.fc .fc-daygrid-body-unbalanced .fc-daygrid-day-events{position:relative;min-height:2em}.fc .fc-daygrid-body-natural .fc-daygrid-day-events{margin-bottom:1em}.fc .fc-daygrid-event-harness{position:relative}.fc .fc-daygrid-event-harness-abs{position:absolute;top:0;left:0;right:0}.fc .fc-daygrid-bg-harness{position:absolute;top:0;bottom:0}.fc .fc-daygrid-day-bg .fc-non-business{z-index:1}.fc .fc-daygrid-day-bg .fc-bg-event{z-index:2}.fc .fc-daygrid-day-bg .fc-highlight{z-index:3}.fc .fc-daygrid-event{z-index:6;margin-top:1px}.fc .fc-daygrid-event.fc-event-mirror{z-index:7}.fc .fc-daygrid-day-bottom{font-size:.85em;margin:2px 3px 0}.fc .fc-daygrid-more-link{position:relative;z-index:4;cursor:pointer}.fc .fc-daygrid-week-number{position:absolute;z-index:5;top:0;padding:2px;min-width:1.5em;text-align:center;background-color:rgba(208,208,208,.3);background-color:var(--fc-neutral-bg-color,rgba(208,208,208,.3));color:grey;color:var(--fc-neutral-text-color,grey)}.fc .fc-more-popover{z-index:8}.fc .fc-more-popover .fc-popover-body{min-width:220px;padding:10px}.fc-direction-ltr .fc-daygrid-event.fc-event-start,.fc-direction-rtl .fc-daygrid-event.fc-event-end{margin-left:2px}.fc-direction-ltr .fc-daygrid-event.fc-event-end,.fc-direction-rtl .fc-daygrid-event.fc-event-start{margin-right:2px}.fc-direction-ltr .fc-daygrid-week-number{left:0;border-radius:0 0 3px}.fc-direction-rtl .fc-daygrid-week-number{right:0;border-radius:0 0 0 3px}.fc-liquid-hack .fc-daygrid-day-frame{position:static}.fc-daygrid-event{position:relative;white-space:nowrap;border-radius:3px;font-size:.85em;font-size:var(--fc-small-font-size,.85em)}.fc-daygrid-block-event .fc-event-time{font-weight:700}.fc-daygrid-block-event .fc-event-time,.fc-daygrid-block-event .fc-event-title{padding:1px}.fc-daygrid-dot-event{display:flex;align-items:center;padding:2px 0}.fc-daygrid-dot-event .fc-event-title{flex-grow:1;flex-shrink:1;min-width:0;overflow:hidden;font-weight:700}.fc-daygrid-dot-event.fc-event-mirror,.fc-daygrid-dot-event:hover{background:rgba(0,0,0,.1)}.fc-daygrid-dot-event.fc-event-selected:before{top:-10px;bottom:-10px}.fc-daygrid-event-dot{margin:0 4px;box-sizing:content-box;width:0;height:0;border:4px solid #3788d8;border:calc(var(--fc-daygrid-event-dot-width,8px)/ 2) solid var(--fc-event-border-color,#3788d8);border-radius:4px;border-radius:calc(var(--fc-daygrid-event-dot-width,8px)/ 2)}.fc-direction-ltr .fc-daygrid-event .fc-event-time{margin-right:3px}.fc-direction-rtl .fc-daygrid-event .fc-event-time{margin-left:3px}.fc-v-event{display:block;border:1px solid #3788d8;border:1px solid var(--fc-event-border-color,#3788d8);background-color:#3788d8;background-color:var(--fc-event-bg-color,#3788d8)}.fc-v-event .fc-event-main{color:#fff;color:var(--fc-event-text-color,#fff);height:100%}.fc-v-event .fc-event-main-frame{height:100%;display:flex;flex-direction:column}.fc-v-event .fc-event-time{flex-grow:0;flex-shrink:0;max-height:100%;overflow:hidden}.fc-v-event .fc-event-title-container{flex-grow:1;flex-shrink:1;min-height:0}.fc-v-event .fc-event-title{top:0;bottom:0;max-height:100%;overflow:hidden}.fc-v-event:not(.fc-event-start){border-top-width:0;border-top-left-radius:0;border-top-right-radius:0}.fc-v-event:not(.fc-event-end){border-bottom-width:0;border-bottom-left-radius:0;border-bottom-right-radius:0}.fc-v-event.fc-event-selected:before{left:-10px;right:-10px}.fc-v-event .fc-event-resizer-start{cursor:n-resize}.fc-v-event .fc-event-resizer-end{cursor:s-resize}.fc-v-event:not(.fc-event-selected) .fc-event-resizer{height:8px;height:var(--fc-event-resizer-thickness,8px);left:0;right:0}.fc-v-event:not(.fc-event-selected) .fc-event-resizer-start{top:-4px;top:calc(var(--fc-event-resizer-thickness,8px)/ -2)}.fc-v-event:not(.fc-event-selected) .fc-event-resizer-end{bottom:-4px;bottom:calc(var(--fc-event-resizer-thickness,8px)/ -2)}.fc-v-event.fc-event-selected .fc-event-resizer{left:50%;margin-left:-4px;margin-left:calc(var(--fc-event-resizer-dot-total-width,8px)/ -2)}.fc-v-event.fc-event-selected .fc-event-resizer-start{top:-4px;top:calc(var(--fc-event-resizer-dot-total-width,8px)/ -2)}.fc-v-event.fc-event-selected .fc-event-resizer-end{bottom:-4px;bottom:calc(var(--fc-event-resizer-dot-total-width,8px)/ -2)}.fc .fc-timegrid .fc-daygrid-body{z-index:2}.fc .fc-timegrid-axis-chunk>table,.fc .fc-timegrid-body,.fc .fc-timegrid-slots{position:relative;z-index:1}.fc .fc-timegrid-divider{padding:0 0 2px}.fc .fc-timegrid-body{min-height:100%}.fc .fc-timegrid-axis-chunk{position:relative}.fc .fc-timegrid-slot{height:1.5em;border-bottom:0}.fc .fc-timegrid-slot:empty:before{content:'\00a0'}.fc .fc-timegrid-slot-minor{border-top-style:dotted}.fc .fc-timegrid-slot-label-cushion{display:inline-block;white-space:nowrap}.fc .fc-timegrid-axis-cushion,.fc .fc-timegrid-slot-label-cushion{padding:0 4px}.fc .fc-timegrid-axis-frame-liquid{height:100%}.fc .fc-timegrid-axis-frame{overflow:hidden;display:flex;align-items:center;justify-content:flex-end}.fc .fc-timegrid-axis-cushion{max-width:60px;flex-shrink:0}.fc-direction-ltr .fc-timegrid-slot-label-frame{text-align:right}.fc-direction-rtl .fc-timegrid-slot-label-frame{text-align:left}.fc-liquid-hack .fc-timegrid-axis-frame-liquid{height:auto;position:absolute;top:0;right:0;bottom:0;left:0}.fc .fc-timegrid-col.fc-day-today{background-color:rgba(255,220,40,.15);background-color:var(--fc-today-bg-color,rgba(255,220,40,.15))}.fc .fc-timegrid-col-frame{min-height:100%;position:relative}.fc-liquid-hack .fc-timegrid-col-frame{height:auto;position:absolute;top:0;right:0;bottom:0;left:0}.fc-media-screen .fc-timegrid-cols{position:absolute;top:0;left:0;right:0;bottom:0}.fc-media-screen .fc-timegrid-cols>table{height:100%}.fc-media-screen .fc-timegrid-col-bg,.fc-media-screen .fc-timegrid-col-events,.fc-media-screen .fc-timegrid-now-indicator-container{position:absolute;top:0;left:0;right:0}.fc-media-screen .fc-timegrid-event-harness{position:absolute}.fc .fc-timegrid-col-bg{z-index:2}.fc .fc-timegrid-col-bg .fc-non-business{z-index:1}.fc .fc-timegrid-col-bg .fc-bg-event{z-index:2}.fc .fc-timegrid-col-bg .fc-highlight,.fc .fc-timegrid-col-events{z-index:3}.fc .fc-timegrid-bg-harness{position:absolute;left:0;right:0}.fc .fc-timegrid-now-indicator-container{bottom:0;overflow:hidden}.fc-direction-ltr .fc-timegrid-col-events{margin:0 2.5% 0 2px}.fc-direction-rtl .fc-timegrid-col-events{margin:0 2px 0 2.5%}.fc-timegrid-event-harness-inset .fc-timegrid-event,.fc-timegrid-event.fc-event-mirror{box-shadow:0 0 0 1px #fff;box-shadow:0 0 0 1px var(--fc-page-bg-color,#fff)}.fc-timegrid-event{font-size:.85em;font-size:var(--fc-small-font-size,.85em);border-radius:3px}.fc-timegrid-event .fc-event-main{padding:1px 1px 0}.fc-timegrid-event .fc-event-time{white-space:nowrap;font-size:.85em;font-size:var(--fc-small-font-size,.85em);margin-bottom:1px}.fc-timegrid-event-condensed .fc-event-main-frame{flex-direction:row;overflow:hidden}.fc-timegrid-event-condensed .fc-event-time:after{content:'\00a0-\00a0'}.fc-timegrid-event-condensed .fc-event-title{font-size:.85em;font-size:var(--fc-small-font-size,.85em)}.fc-media-screen .fc-timegrid-event{position:absolute;top:0;bottom:1px;left:0;right:0}.fc .fc-timegrid-now-indicator-line{position:absolute;z-index:4;left:0;right:0;border-style:solid;border-color:red;border-color:var(--fc-now-indicator-color,red);border-width:1px 0 0}.fc .fc-timegrid-now-indicator-arrow{position:absolute;z-index:4;margin-top:-5px;border-style:solid;border-color:red;border-color:var(--fc-now-indicator-color,red)}.fc-direction-ltr .fc-timegrid-now-indicator-arrow{left:0;border-width:5px 0 5px 6px;border-top-color:transparent;border-bottom-color:transparent}.fc-direction-rtl .fc-timegrid-now-indicator-arrow{right:0;border-width:5px 6px 5px 0;border-top-color:transparent;border-bottom-color:transparent}.fc-theme-standard .fc-list{border:1px solid #ddd;border:1px solid var(--fc-border-color,#ddd)}.fc .fc-list-empty{background-color:rgba(208,208,208,.3);background-color:var(--fc-neutral-bg-color,rgba(208,208,208,.3));height:100%;display:flex;justify-content:center;align-items:center}.fc .fc-list-empty-cushion{margin:5em 0}.fc .fc-list-table{width:100%;border-style:hidden}.fc .fc-list-table tr>*{border-left:0;border-right:0}.fc .fc-list-sticky .fc-list-day>*{position:-webkit-sticky;position:sticky;top:0;background:var(--fc-page-bg-color,#fff)}.fc .fc-list-table th{padding:0}.fc .fc-list-day-cushion,.fc .fc-list-table td{padding:8px 14px}.fc .fc-list-day-cushion:after{content:"";clear:both;display:table}.fc-theme-standard .fc-list-day-cushion{background-color:rgba(208,208,208,.3);background-color:var(--fc-neutral-bg-color,rgba(208,208,208,.3))}.fc-direction-ltr .fc-list-day-text,.fc-direction-rtl .fc-list-day-side-text{float:left}.fc-direction-ltr .fc-list-day-side-text,.fc-direction-rtl .fc-list-day-text{float:right}.fc-direction-ltr .fc-list-table .fc-list-event-graphic{padding-right:0}.fc-direction-rtl .fc-list-table .fc-list-event-graphic{padding-left:0}.fc .fc-list-event.fc-event-forced-url{cursor:pointer}.fc .fc-list-event:hover td{background-color:#f5f5f5;background-color:var(--fc-list-event-hover-bg-color,#f5f5f5)}.fc .fc-list-event-graphic,.fc .fc-list-event-time{white-space:nowrap;width:1px}.fc .fc-list-event-dot{display:inline-block;box-sizing:content-box;width:0;height:0;border:5px solid #3788d8;border:calc(var(--fc-list-event-dot-width,10px)/ 2) solid var(--fc-event-border-color,#3788d8);border-radius:5px;border-radius:calc(var(--fc-list-event-dot-width,10px)/ 2)}.fc .fc-list-event-title a{color:inherit;text-decoration:none}.fc .fc-list-event.fc-event-forced-url:hover a{text-decoration:underline}.fc-theme-bootstrap a:not([href]){color:inherit}.fc .fc-event,.fc .fc-scrollgrid table tr{-moz-column-break-inside:avoid;break-inside:avoid}.fc-media-print{display:block;max-width:100%}.fc-media-print .fc-bg-event,.fc-media-print .fc-non-business,.fc-media-print .fc-timegrid-axis-chunk,.fc-media-print .fc-timegrid-slots,.fc-media-print .fc-timeline-slots{display:none}.fc-media-print .fc-h-event,.fc-media-print .fc-toolbar button,.fc-media-print .fc-v-event{color:#000!important;background:#fff!important}.fc-media-print .fc-event,.fc-media-print .fc-event-main{color:#000!important}.fc-media-print .fc-timegrid-event{margin:.5em 0}.fc .fc-timeline-body{min-height:100%;position:relative;z-index:1}.fc .fc-timeline-slots{position:absolute;z-index:1;top:0;bottom:0}.fc .fc-timeline-slots>table{height:100%}.fc .fc-timeline-slot-minor{border-style:dotted}.fc .fc-timeline-slot-frame{display:flex;align-items:center;justify-content:center}.fc .fc-timeline-header-row-chrono .fc-timeline-slot-frame{justify-content:flex-start}.fc .fc-timeline-slot-cushion{padding:4px 5px;white-space:nowrap}.fc-direction-ltr .fc-timeline-slot{border-right:0!important}.fc-direction-rtl .fc-timeline-slot{border-left:0!important}.fc .fc-timeline-now-indicator-container{position:absolute;z-index:4;top:0;bottom:0;left:0;right:0;width:0}.fc .fc-timeline-now-indicator-arrow,.fc .fc-timeline-now-indicator-line{position:absolute;top:0;border-style:solid;border-color:red;border-color:var(--fc-now-indicator-color,red)}.fc .fc-timeline-now-indicator-arrow{margin:0 -6px;border-width:6px 5px 0;border-left-color:transparent;border-right-color:transparent}.fc .fc-timeline-now-indicator-line{margin:0 -1px;bottom:0;border-width:0 0 0 1px}.fc .fc-timeline-events{position:relative;z-index:3;width:0}.fc .fc-timeline-event-harness{position:absolute;top:0}.fc-timeline-event{z-index:1;position:relative;display:flex;align-items:center;border-radius:0;padding:2px 1px;margin-bottom:1px;font-size:.85em;font-size:var(--fc-small-font-size,.85em)}.fc .fc-timeline-bg,.fc .fc-timeline-bg-harness{position:absolute;top:0;bottom:0}.fc-timeline-event.fc-event-mirror{z-index:2}.fc-timeline-event .fc-event-main{flex-grow:1;flex-shrink:1;min-width:0}.fc-timeline-event .fc-event-time{font-weight:700}.fc-timeline-event .fc-event-time,.fc-timeline-event .fc-event-title{white-space:nowrap;padding:0 2px}.fc-direction-ltr .fc-timeline-event.fc-event-end{margin-right:1px}.fc-direction-rtl .fc-timeline-event.fc-event-end{margin-left:1px}.fc-timeline-overlap-disabled .fc-timeline-event{padding-top:5px;padding-bottom:5px;margin-bottom:0}.fc-timeline-event:not(.fc-event-end):after,.fc-timeline-event:not(.fc-event-start):before{content:"";flex-grow:0;flex-shrink:0;opacity:.5;width:0;height:0;margin:0 1px;border:5px solid #000;border-top-color:transparent;border-bottom-color:transparent}.fc-direction-ltr .fc-timeline-event:not(.fc-event-start):before,.fc-direction-rtl .fc-timeline-event:not(.fc-event-end):after{border-left:0}.fc-direction-ltr .fc-timeline-event:not(.fc-event-end):after,.fc-direction-rtl .fc-timeline-event:not(.fc-event-start):before{border-right:0}.fc .fc-timeline-bg{z-index:2;width:0;left:0;right:0}.fc .fc-timeline-bg .fc-non-business{z-index:1}.fc .fc-timeline-bg .fc-bg-event{z-index:2}.fc .fc-timeline-bg .fc-highlight{z-index:3}.fc .fc-resource-timeline-divider{width:3px;cursor:col-resize}.fc .fc-resource-timeline .fc-resource-group:not([rowspan]){background:rgba(208,208,208,.3);background:var(--fc-neutral-bg-color,rgba(208,208,208,.3))}.fc .fc-timeline-lane-frame{position:relative}.fc .fc-timeline-overlap-enabled .fc-timeline-lane-frame .fc-timeline-events{box-sizing:content-box;padding-bottom:10px}.fc-datagrid-cell-frame-liquid{height:100%}.fc-liquid-hack .fc-datagrid-cell-frame-liquid{height:auto;position:absolute;top:0;right:0;bottom:0;left:0}.fc .fc-datagrid-header .fc-datagrid-cell-frame{position:relative;display:flex;justify-content:flex-start;align-items:center}.fc .fc-datagrid-cell-resizer{position:absolute;z-index:1;top:0;bottom:0;width:5px;cursor:col-resize}.fc .fc-datagrid-cell-cushion{padding:8px;white-space:nowrap;overflow:hidden}.fc .fc-datagrid-expander{cursor:pointer;opacity:.65}.fc .fc-datagrid-expander .fc-icon{display:inline-block;width:1em}.fc .fc-datagrid-expander-placeholder{cursor:auto}.fc .fc-resource-timeline-flat .fc-datagrid-expander-placeholder{display:none}.fc-direction-ltr .fc-datagrid-cell-resizer{right:-3px}.fc-direction-rtl .fc-datagrid-cell-resizer{left:-3px}.fc-direction-ltr .fc-datagrid-expander{margin-right:3px}.fc-direction-rtl .fc-datagrid-expander{margin-left:3px} \ No newline at end of file diff --git a/static_common/common/vendor/jquery/jquery-3.3.1.min.js b/static_common/common/vendor/jquery/jquery-3.3.1.min.js deleted file mode 100644 index 4d9b3a25..00000000 --- a/static_common/common/vendor/jquery/jquery-3.3.1.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! jQuery v3.3.1 | (c) JS Foundation and other contributors | jquery.org/license */ -!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){"use strict";var n=[],r=e.document,i=Object.getPrototypeOf,o=n.slice,a=n.concat,s=n.push,u=n.indexOf,l={},c=l.toString,f=l.hasOwnProperty,p=f.toString,d=p.call(Object),h={},g=function e(t){return"function"==typeof t&&"number"!=typeof t.nodeType},y=function e(t){return null!=t&&t===t.window},v={type:!0,src:!0,noModule:!0};function m(e,t,n){var i,o=(t=t||r).createElement("script");if(o.text=e,n)for(i in v)n[i]&&(o[i]=n[i]);t.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[c.call(e)]||"object":typeof e}var b="3.3.1",w=function(e,t){return new w.fn.init(e,t)},T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;w.fn=w.prototype={jquery:"3.3.1",constructor:w,length:0,toArray:function(){return o.call(this)},get:function(e){return null==e?o.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=w.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return w.each(this,e)},map:function(e){return this.pushStack(w.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(o.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:s,sort:n.sort,splice:n.splice},w.extend=w.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||g(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)n=a[t],a!==(r=e[t])&&(l&&r&&(w.isPlainObject(r)||(i=Array.isArray(r)))?(i?(i=!1,o=n&&Array.isArray(n)?n:[]):o=n&&w.isPlainObject(n)?n:{},a[t]=w.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},w.extend({expando:"jQuery"+("3.3.1"+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==c.call(e))&&(!(t=i(e))||"function"==typeof(n=f.call(t,"constructor")&&t.constructor)&&p.call(n)===d)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e){m(e)},each:function(e,t){var n,r=0;if(C(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},trim:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(C(Object(e))?w.merge(n,"string"==typeof e?[e]:e):s.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:u.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r,i=[],o=0,a=e.length,s=!n;o<a;o++)(r=!t(e[o],o))!==s&&i.push(e[o]);return i},map:function(e,t,n){var r,i,o=0,s=[];if(C(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&s.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&s.push(i);return a.apply([],s)},guid:1,support:h}),"function"==typeof Symbol&&(w.fn[Symbol.iterator]=n[Symbol.iterator]),w.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function C(e){var t=!!e&&"length"in e&&e.length,n=x(e);return!g(e)&&!y(e)&&("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e)}var E=function(e){var t,n,r,i,o,a,s,u,l,c,f,p,d,h,g,y,v,m,x,b="sizzle"+1*new Date,w=e.document,T=0,C=0,E=ae(),k=ae(),S=ae(),D=function(e,t){return e===t&&(f=!0),0},N={}.hasOwnProperty,A=[],j=A.pop,q=A.push,L=A.push,H=A.slice,O=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},P="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",I="\\["+M+"*("+R+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+R+"))|)"+M+"*\\]",W=":("+R+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+I+")*)|.*)\\)|)",$=new RegExp(M+"+","g"),B=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),F=new RegExp("^"+M+"*,"+M+"*"),_=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),z=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),X=new RegExp(W),U=new RegExp("^"+R+"$"),V={ID:new RegExp("^#("+R+")"),CLASS:new RegExp("^\\.("+R+")"),TAG:new RegExp("^("+R+"|[*])"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+W),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+P+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},G=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Q=/^[^{]+\{\s*\[native \w/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,K=/[+~]/,Z=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),ee=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},te=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ne=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},re=function(){p()},ie=me(function(e){return!0===e.disabled&&("form"in e||"label"in e)},{dir:"parentNode",next:"legend"});try{L.apply(A=H.call(w.childNodes),w.childNodes),A[w.childNodes.length].nodeType}catch(e){L={apply:A.length?function(e,t){q.apply(e,H.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function oe(e,t,r,i){var o,s,l,c,f,h,v,m=t&&t.ownerDocument,T=t?t.nodeType:9;if(r=r||[],"string"!=typeof e||!e||1!==T&&9!==T&&11!==T)return r;if(!i&&((t?t.ownerDocument||t:w)!==d&&p(t),t=t||d,g)){if(11!==T&&(f=J.exec(e)))if(o=f[1]){if(9===T){if(!(l=t.getElementById(o)))return r;if(l.id===o)return r.push(l),r}else if(m&&(l=m.getElementById(o))&&x(t,l)&&l.id===o)return r.push(l),r}else{if(f[2])return L.apply(r,t.getElementsByTagName(e)),r;if((o=f[3])&&n.getElementsByClassName&&t.getElementsByClassName)return L.apply(r,t.getElementsByClassName(o)),r}if(n.qsa&&!S[e+" "]&&(!y||!y.test(e))){if(1!==T)m=t,v=e;else if("object"!==t.nodeName.toLowerCase()){(c=t.getAttribute("id"))?c=c.replace(te,ne):t.setAttribute("id",c=b),s=(h=a(e)).length;while(s--)h[s]="#"+c+" "+ve(h[s]);v=h.join(","),m=K.test(e)&&ge(t.parentNode)||t}if(v)try{return L.apply(r,m.querySelectorAll(v)),r}catch(e){}finally{c===b&&t.removeAttribute("id")}}}return u(e.replace(B,"$1"),t,r,i)}function ae(){var e=[];function t(n,i){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=i}return t}function se(e){return e[b]=!0,e}function ue(e){var t=d.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function le(e,t){var n=e.split("|"),i=n.length;while(i--)r.attrHandle[n[i]]=t}function ce(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function fe(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function pe(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function de(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&ie(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function he(e){return se(function(t){return t=+t,se(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}function ge(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}n=oe.support={},o=oe.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},p=oe.setDocument=function(e){var t,i,a=e?e.ownerDocument||e:w;return a!==d&&9===a.nodeType&&a.documentElement?(d=a,h=d.documentElement,g=!o(d),w!==d&&(i=d.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",re,!1):i.attachEvent&&i.attachEvent("onunload",re)),n.attributes=ue(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=ue(function(e){return e.appendChild(d.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=Q.test(d.getElementsByClassName),n.getById=ue(function(e){return h.appendChild(e).id=b,!d.getElementsByName||!d.getElementsByName(b).length}),n.getById?(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){return e.getAttribute("id")===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n=t.getElementById(e);return n?[n]:[]}}):(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),r.find.TAG=n.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):n.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},r.find.CLASS=n.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&g)return t.getElementsByClassName(e)},v=[],y=[],(n.qsa=Q.test(d.querySelectorAll))&&(ue(function(e){h.appendChild(e).innerHTML="<a id='"+b+"'></a><select id='"+b+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&y.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||y.push("\\["+M+"*(?:value|"+P+")"),e.querySelectorAll("[id~="+b+"-]").length||y.push("~="),e.querySelectorAll(":checked").length||y.push(":checked"),e.querySelectorAll("a#"+b+"+*").length||y.push(".#.+[+~]")}),ue(function(e){e.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var t=d.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&y.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&y.push(":enabled",":disabled"),h.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&y.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),y.push(",.*:")})),(n.matchesSelector=Q.test(m=h.matches||h.webkitMatchesSelector||h.mozMatchesSelector||h.oMatchesSelector||h.msMatchesSelector))&&ue(function(e){n.disconnectedMatch=m.call(e,"*"),m.call(e,"[s!='']:x"),v.push("!=",W)}),y=y.length&&new RegExp(y.join("|")),v=v.length&&new RegExp(v.join("|")),t=Q.test(h.compareDocumentPosition),x=t||Q.test(h.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return f=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!n.sortDetached&&t.compareDocumentPosition(e)===r?e===d||e.ownerDocument===w&&x(w,e)?-1:t===d||t.ownerDocument===w&&x(w,t)?1:c?O(c,e)-O(c,t):0:4&r?-1:1)}:function(e,t){if(e===t)return f=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e===d?-1:t===d?1:i?-1:o?1:c?O(c,e)-O(c,t):0;if(i===o)return ce(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?ce(a[r],s[r]):a[r]===w?-1:s[r]===w?1:0},d):d},oe.matches=function(e,t){return oe(e,null,null,t)},oe.matchesSelector=function(e,t){if((e.ownerDocument||e)!==d&&p(e),t=t.replace(z,"='$1']"),n.matchesSelector&&g&&!S[t+" "]&&(!v||!v.test(t))&&(!y||!y.test(t)))try{var r=m.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){}return oe(t,d,null,[e]).length>0},oe.contains=function(e,t){return(e.ownerDocument||e)!==d&&p(e),x(e,t)},oe.attr=function(e,t){(e.ownerDocument||e)!==d&&p(e);var i=r.attrHandle[t.toLowerCase()],o=i&&N.call(r.attrHandle,t.toLowerCase())?i(e,t,!g):void 0;return void 0!==o?o:n.attributes||!g?e.getAttribute(t):(o=e.getAttributeNode(t))&&o.specified?o.value:null},oe.escape=function(e){return(e+"").replace(te,ne)},oe.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},oe.uniqueSort=function(e){var t,r=[],i=0,o=0;if(f=!n.detectDuplicates,c=!n.sortStable&&e.slice(0),e.sort(D),f){while(t=e[o++])t===e[o]&&(i=r.push(o));while(i--)e.splice(r[i],1)}return c=null,e},i=oe.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e)}else if(3===o||4===o)return e.nodeValue}else while(t=e[r++])n+=i(t);return n},(r=oe.selectors={cacheLength:50,createPseudo:se,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(Z,ee),e[3]=(e[3]||e[4]||e[5]||"").replace(Z,ee),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||oe.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&oe.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return V.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=a(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(Z,ee).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=E[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&E(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=oe.attr(r,e);return null==i?"!="===t:!t||(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i.replace($," ")+" ").indexOf(n)>-1:"|="===t&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,p,d,h,g=o!==a?"nextSibling":"previousSibling",y=t.parentNode,v=s&&t.nodeName.toLowerCase(),m=!u&&!s,x=!1;if(y){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===v:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?y.firstChild:y.lastChild],a&&m){x=(d=(l=(c=(f=(p=y)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1])&&l[2],p=d&&y.childNodes[d];while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if(1===p.nodeType&&++x&&p===t){c[e]=[T,d,x];break}}else if(m&&(x=d=(l=(c=(f=(p=t)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1]),!1===x)while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===v:1===p.nodeType)&&++x&&(m&&((c=(f=p[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]=[T,x]),p===t))break;return(x-=i)===r||x%r==0&&x/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||oe.error("unsupported pseudo: "+e);return i[b]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?se(function(e,n){var r,o=i(e,t),a=o.length;while(a--)e[r=O(e,o[a])]=!(n[r]=o[a])}):function(e){return i(e,0,n)}):i}},pseudos:{not:se(function(e){var t=[],n=[],r=s(e.replace(B,"$1"));return r[b]?se(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),t[0]=null,!n.pop()}}),has:se(function(e){return function(t){return oe(e,t).length>0}}),contains:se(function(e){return e=e.replace(Z,ee),function(t){return(t.textContent||t.innerText||i(t)).indexOf(e)>-1}}),lang:se(function(e){return U.test(e||"")||oe.error("unsupported lang: "+e),e=e.replace(Z,ee).toLowerCase(),function(t){var n;do{if(n=g?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===h},focus:function(e){return e===d.activeElement&&(!d.hasFocus||d.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:de(!1),disabled:de(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!r.pseudos.empty(e)},header:function(e){return Y.test(e.nodeName)},input:function(e){return G.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:he(function(){return[0]}),last:he(function(e,t){return[t-1]}),eq:he(function(e,t,n){return[n<0?n+t:n]}),even:he(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:he(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:he(function(e,t,n){for(var r=n<0?n+t:n;--r>=0;)e.push(r);return e}),gt:he(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}}).pseudos.nth=r.pseudos.eq;for(t in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})r.pseudos[t]=fe(t);for(t in{submit:!0,reset:!0})r.pseudos[t]=pe(t);function ye(){}ye.prototype=r.filters=r.pseudos,r.setFilters=new ye,a=oe.tokenize=function(e,t){var n,i,o,a,s,u,l,c=k[e+" "];if(c)return t?0:c.slice(0);s=e,u=[],l=r.preFilter;while(s){n&&!(i=F.exec(s))||(i&&(s=s.slice(i[0].length)||s),u.push(o=[])),n=!1,(i=_.exec(s))&&(n=i.shift(),o.push({value:n,type:i[0].replace(B," ")}),s=s.slice(n.length));for(a in r.filter)!(i=V[a].exec(s))||l[a]&&!(i=l[a](i))||(n=i.shift(),o.push({value:n,type:a,matches:i}),s=s.slice(n.length));if(!n)break}return t?s.length:s?oe.error(e):k(e,u).slice(0)};function ve(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function me(e,t,n){var r=t.dir,i=t.next,o=i||r,a=n&&"parentNode"===o,s=C++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||a)return e(t,n,i);return!1}:function(t,n,u){var l,c,f,p=[T,s];if(u){while(t=t[r])if((1===t.nodeType||a)&&e(t,n,u))return!0}else while(t=t[r])if(1===t.nodeType||a)if(f=t[b]||(t[b]={}),c=f[t.uniqueID]||(f[t.uniqueID]={}),i&&i===t.nodeName.toLowerCase())t=t[r]||t;else{if((l=c[o])&&l[0]===T&&l[1]===s)return p[2]=l[2];if(c[o]=p,p[2]=e(t,n,u))return!0}return!1}}function xe(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function be(e,t,n){for(var r=0,i=t.length;r<i;r++)oe(e,t[r],n);return n}function we(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,l=null!=t;s<u;s++)(o=e[s])&&(n&&!n(o,r,i)||(a.push(o),l&&t.push(s)));return a}function Te(e,t,n,r,i,o){return r&&!r[b]&&(r=Te(r)),i&&!i[b]&&(i=Te(i,o)),se(function(o,a,s,u){var l,c,f,p=[],d=[],h=a.length,g=o||be(t||"*",s.nodeType?[s]:s,[]),y=!e||!o&&t?g:we(g,p,e,s,u),v=n?i||(o?e:h||r)?[]:a:y;if(n&&n(y,v,s,u),r){l=we(v,d),r(l,[],s,u),c=l.length;while(c--)(f=l[c])&&(v[d[c]]=!(y[d[c]]=f))}if(o){if(i||e){if(i){l=[],c=v.length;while(c--)(f=v[c])&&l.push(y[c]=f);i(null,v=[],l,u)}c=v.length;while(c--)(f=v[c])&&(l=i?O(o,f):p[c])>-1&&(o[l]=!(a[l]=f))}}else v=we(v===a?v.splice(h,v.length):v),i?i(null,a,v,u):L.apply(a,v)})}function Ce(e){for(var t,n,i,o=e.length,a=r.relative[e[0].type],s=a||r.relative[" "],u=a?1:0,c=me(function(e){return e===t},s,!0),f=me(function(e){return O(t,e)>-1},s,!0),p=[function(e,n,r){var i=!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):f(e,n,r));return t=null,i}];u<o;u++)if(n=r.relative[e[u].type])p=[me(xe(p),n)];else{if((n=r.filter[e[u].type].apply(null,e[u].matches))[b]){for(i=++u;i<o;i++)if(r.relative[e[i].type])break;return Te(u>1&&xe(p),u>1&&ve(e.slice(0,u-1).concat({value:" "===e[u-2].type?"*":""})).replace(B,"$1"),n,u<i&&Ce(e.slice(u,i)),i<o&&Ce(e=e.slice(i)),i<o&&ve(e))}p.push(n)}return xe(p)}function Ee(e,t){var n=t.length>0,i=e.length>0,o=function(o,a,s,u,c){var f,h,y,v=0,m="0",x=o&&[],b=[],w=l,C=o||i&&r.find.TAG("*",c),E=T+=null==w?1:Math.random()||.1,k=C.length;for(c&&(l=a===d||a||c);m!==k&&null!=(f=C[m]);m++){if(i&&f){h=0,a||f.ownerDocument===d||(p(f),s=!g);while(y=e[h++])if(y(f,a||d,s)){u.push(f);break}c&&(T=E)}n&&((f=!y&&f)&&v--,o&&x.push(f))}if(v+=m,n&&m!==v){h=0;while(y=t[h++])y(x,b,a,s);if(o){if(v>0)while(m--)x[m]||b[m]||(b[m]=j.call(u));b=we(b)}L.apply(u,b),c&&!o&&b.length>0&&v+t.length>1&&oe.uniqueSort(u)}return c&&(T=E,l=w),x};return n?se(o):o}return s=oe.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=a(e)),n=t.length;while(n--)(o=Ce(t[n]))[b]?r.push(o):i.push(o);(o=S(e,Ee(i,r))).selector=e}return o},u=oe.select=function(e,t,n,i){var o,u,l,c,f,p="function"==typeof e&&e,d=!i&&a(e=p.selector||e);if(n=n||[],1===d.length){if((u=d[0]=d[0].slice(0)).length>2&&"ID"===(l=u[0]).type&&9===t.nodeType&&g&&r.relative[u[1].type]){if(!(t=(r.find.ID(l.matches[0].replace(Z,ee),t)||[])[0]))return n;p&&(t=t.parentNode),e=e.slice(u.shift().value.length)}o=V.needsContext.test(e)?0:u.length;while(o--){if(l=u[o],r.relative[c=l.type])break;if((f=r.find[c])&&(i=f(l.matches[0].replace(Z,ee),K.test(u[0].type)&&ge(t.parentNode)||t))){if(u.splice(o,1),!(e=i.length&&ve(u)))return L.apply(n,i),n;break}}}return(p||s(e,d))(i,t,!g,n,!t||K.test(e)&&ge(t.parentNode)||t),n},n.sortStable=b.split("").sort(D).join("")===b,n.detectDuplicates=!!f,p(),n.sortDetached=ue(function(e){return 1&e.compareDocumentPosition(d.createElement("fieldset"))}),ue(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||le("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),n.attributes&&ue(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||le("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),ue(function(e){return null==e.getAttribute("disabled")})||le(P,function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),oe}(e);w.find=E,w.expr=E.selectors,w.expr[":"]=w.expr.pseudos,w.uniqueSort=w.unique=E.uniqueSort,w.text=E.getText,w.isXMLDoc=E.isXML,w.contains=E.contains,w.escapeSelector=E.escape;var k=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&w(e).is(n))break;r.push(e)}return r},S=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},D=w.expr.match.needsContext;function N(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var A=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,t,n){return g(t)?w.grep(e,function(e,r){return!!t.call(e,r,e)!==n}):t.nodeType?w.grep(e,function(e){return e===t!==n}):"string"!=typeof t?w.grep(e,function(e){return u.call(t,e)>-1!==n}):w.filter(t,e,n)}w.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?w.find.matchesSelector(r,e)?[r]:[]:w.find.matches(e,w.grep(t,function(e){return 1===e.nodeType}))},w.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(w(e).filter(function(){for(t=0;t<r;t++)if(w.contains(i[t],this))return!0}));for(n=this.pushStack([]),t=0;t<r;t++)w.find(e,i[t],n);return r>1?w.uniqueSort(n):n},filter:function(e){return this.pushStack(j(this,e||[],!1))},not:function(e){return this.pushStack(j(this,e||[],!0))},is:function(e){return!!j(this,"string"==typeof e&&D.test(e)?w(e):e||[],!1).length}});var q,L=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(w.fn.init=function(e,t,n){var i,o;if(!e)return this;if(n=n||q,"string"==typeof e){if(!(i="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:L.exec(e))||!i[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(i[1]){if(t=t instanceof w?t[0]:t,w.merge(this,w.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:r,!0)),A.test(i[1])&&w.isPlainObject(t))for(i in t)g(this[i])?this[i](t[i]):this.attr(i,t[i]);return this}return(o=r.getElementById(i[2]))&&(this[0]=o,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):g(e)?void 0!==n.ready?n.ready(e):e(w):w.makeArray(e,this)}).prototype=w.fn,q=w(r);var H=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};w.fn.extend({has:function(e){var t=w(e,this),n=t.length;return this.filter(function(){for(var e=0;e<n;e++)if(w.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,i=this.length,o=[],a="string"!=typeof e&&w(e);if(!D.test(e))for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?a.index(n)>-1:1===n.nodeType&&w.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?w.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?u.call(w(e),this[0]):u.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(w.uniqueSort(w.merge(this.get(),w(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function P(e,t){while((e=e[t])&&1!==e.nodeType);return e}w.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return k(e,"parentNode")},parentsUntil:function(e,t,n){return k(e,"parentNode",n)},next:function(e){return P(e,"nextSibling")},prev:function(e){return P(e,"previousSibling")},nextAll:function(e){return k(e,"nextSibling")},prevAll:function(e){return k(e,"previousSibling")},nextUntil:function(e,t,n){return k(e,"nextSibling",n)},prevUntil:function(e,t,n){return k(e,"previousSibling",n)},siblings:function(e){return S((e.parentNode||{}).firstChild,e)},children:function(e){return S(e.firstChild)},contents:function(e){return N(e,"iframe")?e.contentDocument:(N(e,"template")&&(e=e.content||e),w.merge([],e.childNodes))}},function(e,t){w.fn[e]=function(n,r){var i=w.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=w.filter(r,i)),this.length>1&&(O[e]||w.uniqueSort(i),H.test(e)&&i.reverse()),this.pushStack(i)}});var M=/[^\x20\t\r\n\f]+/g;function R(e){var t={};return w.each(e.match(M)||[],function(e,n){t[n]=!0}),t}w.Callbacks=function(e){e="string"==typeof e?R(e):w.extend({},e);var t,n,r,i,o=[],a=[],s=-1,u=function(){for(i=i||e.once,r=t=!0;a.length;s=-1){n=a.shift();while(++s<o.length)!1===o[s].apply(n[0],n[1])&&e.stopOnFalse&&(s=o.length,n=!1)}e.memory||(n=!1),t=!1,i&&(o=n?[]:"")},l={add:function(){return o&&(n&&!t&&(s=o.length-1,a.push(n)),function t(n){w.each(n,function(n,r){g(r)?e.unique&&l.has(r)||o.push(r):r&&r.length&&"string"!==x(r)&&t(r)})}(arguments),n&&!t&&u()),this},remove:function(){return w.each(arguments,function(e,t){var n;while((n=w.inArray(t,o,n))>-1)o.splice(n,1),n<=s&&s--}),this},has:function(e){return e?w.inArray(e,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return i=a=[],o=n="",this},disabled:function(){return!o},lock:function(){return i=a=[],n||t||(o=n=""),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=[e,(n=n||[]).slice?n.slice():n],a.push(n),t||u()),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!r}};return l};function I(e){return e}function W(e){throw e}function $(e,t,n,r){var i;try{e&&g(i=e.promise)?i.call(e).done(t).fail(n):e&&g(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}w.extend({Deferred:function(t){var n=[["notify","progress",w.Callbacks("memory"),w.Callbacks("memory"),2],["resolve","done",w.Callbacks("once memory"),w.Callbacks("once memory"),0,"resolved"],["reject","fail",w.Callbacks("once memory"),w.Callbacks("once memory"),1,"rejected"]],r="pending",i={state:function(){return r},always:function(){return o.done(arguments).fail(arguments),this},"catch":function(e){return i.then(null,e)},pipe:function(){var e=arguments;return w.Deferred(function(t){w.each(n,function(n,r){var i=g(e[r[4]])&&e[r[4]];o[r[1]](function(){var e=i&&i.apply(this,arguments);e&&g(e.promise)?e.promise().progress(t.notify).done(t.resolve).fail(t.reject):t[r[0]+"With"](this,i?[e]:arguments)})}),e=null}).promise()},then:function(t,r,i){var o=0;function a(t,n,r,i){return function(){var s=this,u=arguments,l=function(){var e,l;if(!(t<o)){if((e=r.apply(s,u))===n.promise())throw new TypeError("Thenable self-resolution");l=e&&("object"==typeof e||"function"==typeof e)&&e.then,g(l)?i?l.call(e,a(o,n,I,i),a(o,n,W,i)):(o++,l.call(e,a(o,n,I,i),a(o,n,W,i),a(o,n,I,n.notifyWith))):(r!==I&&(s=void 0,u=[e]),(i||n.resolveWith)(s,u))}},c=i?l:function(){try{l()}catch(e){w.Deferred.exceptionHook&&w.Deferred.exceptionHook(e,c.stackTrace),t+1>=o&&(r!==W&&(s=void 0,u=[e]),n.rejectWith(s,u))}};t?c():(w.Deferred.getStackHook&&(c.stackTrace=w.Deferred.getStackHook()),e.setTimeout(c))}}return w.Deferred(function(e){n[0][3].add(a(0,e,g(i)?i:I,e.notifyWith)),n[1][3].add(a(0,e,g(t)?t:I)),n[2][3].add(a(0,e,g(r)?r:W))}).promise()},promise:function(e){return null!=e?w.extend(e,i):i}},o={};return w.each(n,function(e,t){var a=t[2],s=t[5];i[t[1]]=a.add,s&&a.add(function(){r=s},n[3-e][2].disable,n[3-e][3].disable,n[0][2].lock,n[0][3].lock),a.add(t[3].fire),o[t[0]]=function(){return o[t[0]+"With"](this===o?void 0:this,arguments),this},o[t[0]+"With"]=a.fireWith}),i.promise(o),t&&t.call(o,o),o},when:function(e){var t=arguments.length,n=t,r=Array(n),i=o.call(arguments),a=w.Deferred(),s=function(e){return function(n){r[e]=this,i[e]=arguments.length>1?o.call(arguments):n,--t||a.resolveWith(r,i)}};if(t<=1&&($(e,a.done(s(n)).resolve,a.reject,!t),"pending"===a.state()||g(i[n]&&i[n].then)))return a.then();while(n--)$(i[n],s(n),a.reject);return a.promise()}});var B=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;w.Deferred.exceptionHook=function(t,n){e.console&&e.console.warn&&t&&B.test(t.name)&&e.console.warn("jQuery.Deferred exception: "+t.message,t.stack,n)},w.readyException=function(t){e.setTimeout(function(){throw t})};var F=w.Deferred();w.fn.ready=function(e){return F.then(e)["catch"](function(e){w.readyException(e)}),this},w.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--w.readyWait:w.isReady)||(w.isReady=!0,!0!==e&&--w.readyWait>0||F.resolveWith(r,[w]))}}),w.ready.then=F.then;function _(){r.removeEventListener("DOMContentLoaded",_),e.removeEventListener("load",_),w.ready()}"complete"===r.readyState||"loading"!==r.readyState&&!r.documentElement.doScroll?e.setTimeout(w.ready):(r.addEventListener("DOMContentLoaded",_),e.addEventListener("load",_));var z=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if("object"===x(n)){i=!0;for(s in n)z(e,t,s,n[s],!0,o,a)}else if(void 0!==r&&(i=!0,g(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(w(e),n)})),t))for(;s<u;s++)t(e[s],n,a?r:r.call(e[s],s,t(e[s],n)));return i?e:l?t.call(e):u?t(e[0],n):o},X=/^-ms-/,U=/-([a-z])/g;function V(e,t){return t.toUpperCase()}function G(e){return e.replace(X,"ms-").replace(U,V)}var Y=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};function Q(){this.expando=w.expando+Q.uid++}Q.uid=1,Q.prototype={cache:function(e){var t=e[this.expando];return t||(t={},Y(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,i=this.cache(e);if("string"==typeof t)i[G(t)]=n;else for(r in t)i[G(r)]=t[r];return i},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][G(t)]},access:function(e,t,n){return void 0===t||t&&"string"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){n=(t=Array.isArray(t)?t.map(G):(t=G(t))in r?[t]:t.match(M)||[]).length;while(n--)delete r[t[n]]}(void 0===t||w.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!w.isEmptyObject(t)}};var J=new Q,K=new Q,Z=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,ee=/[A-Z]/g;function te(e){return"true"===e||"false"!==e&&("null"===e?null:e===+e+""?+e:Z.test(e)?JSON.parse(e):e)}function ne(e,t,n){var r;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(ee,"-$&").toLowerCase(),"string"==typeof(n=e.getAttribute(r))){try{n=te(n)}catch(e){}K.set(e,t,n)}else n=void 0;return n}w.extend({hasData:function(e){return K.hasData(e)||J.hasData(e)},data:function(e,t,n){return K.access(e,t,n)},removeData:function(e,t){K.remove(e,t)},_data:function(e,t,n){return J.access(e,t,n)},_removeData:function(e,t){J.remove(e,t)}}),w.fn.extend({data:function(e,t){var n,r,i,o=this[0],a=o&&o.attributes;if(void 0===e){if(this.length&&(i=K.get(o),1===o.nodeType&&!J.get(o,"hasDataAttrs"))){n=a.length;while(n--)a[n]&&0===(r=a[n].name).indexOf("data-")&&(r=G(r.slice(5)),ne(o,r,i[r]));J.set(o,"hasDataAttrs",!0)}return i}return"object"==typeof e?this.each(function(){K.set(this,e)}):z(this,function(t){var n;if(o&&void 0===t){if(void 0!==(n=K.get(o,e)))return n;if(void 0!==(n=ne(o,e)))return n}else this.each(function(){K.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){K.remove(this,e)})}}),w.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=J.get(e,t),n&&(!r||Array.isArray(n)?r=J.access(e,t,w.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=w.queue(e,t),r=n.length,i=n.shift(),o=w._queueHooks(e,t),a=function(){w.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return J.get(e,n)||J.access(e,n,{empty:w.Callbacks("once memory").add(function(){J.remove(e,[t+"queue",n])})})}}),w.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length<n?w.queue(this[0],e):void 0===t?this:this.each(function(){var n=w.queue(this,e,t);w._queueHooks(this,e),"fx"===e&&"inprogress"!==n[0]&&w.dequeue(this,e)})},dequeue:function(e){return this.each(function(){w.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=w.Deferred(),o=this,a=this.length,s=function(){--r||i.resolveWith(o,[o])};"string"!=typeof e&&(t=e,e=void 0),e=e||"fx";while(a--)(n=J.get(o[a],e+"queueHooks"))&&n.empty&&(r++,n.empty.add(s));return s(),i.promise(t)}});var re=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,ie=new RegExp("^(?:([+-])=|)("+re+")([a-z%]*)$","i"),oe=["Top","Right","Bottom","Left"],ae=function(e,t){return"none"===(e=t||e).style.display||""===e.style.display&&w.contains(e.ownerDocument,e)&&"none"===w.css(e,"display")},se=function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i};function ue(e,t,n,r){var i,o,a=20,s=r?function(){return r.cur()}:function(){return w.css(e,t,"")},u=s(),l=n&&n[3]||(w.cssNumber[t]?"":"px"),c=(w.cssNumber[t]||"px"!==l&&+u)&&ie.exec(w.css(e,t));if(c&&c[3]!==l){u/=2,l=l||c[3],c=+u||1;while(a--)w.style(e,t,c+l),(1-o)*(1-(o=s()/u||.5))<=0&&(a=0),c/=o;c*=2,w.style(e,t,c+l),n=n||[]}return n&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}var le={};function ce(e){var t,n=e.ownerDocument,r=e.nodeName,i=le[r];return i||(t=n.body.appendChild(n.createElement(r)),i=w.css(t,"display"),t.parentNode.removeChild(t),"none"===i&&(i="block"),le[r]=i,i)}function fe(e,t){for(var n,r,i=[],o=0,a=e.length;o<a;o++)(r=e[o]).style&&(n=r.style.display,t?("none"===n&&(i[o]=J.get(r,"display")||null,i[o]||(r.style.display="")),""===r.style.display&&ae(r)&&(i[o]=ce(r))):"none"!==n&&(i[o]="none",J.set(r,"display",n)));for(o=0;o<a;o++)null!=i[o]&&(e[o].style.display=i[o]);return e}w.fn.extend({show:function(){return fe(this,!0)},hide:function(){return fe(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){ae(this)?w(this).show():w(this).hide()})}});var pe=/^(?:checkbox|radio)$/i,de=/<([a-z][^\/\0>\x20\t\r\n\f]+)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ge={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ge.optgroup=ge.option,ge.tbody=ge.tfoot=ge.colgroup=ge.caption=ge.thead,ge.th=ge.td;function ye(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&N(e,t)?w.merge([e],n):n}function ve(e,t){for(var n=0,r=e.length;n<r;n++)J.set(e[n],"globalEval",!t||J.get(t[n],"globalEval"))}var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d<h;d++)if((o=e[d])||0===o)if("object"===x(o))w.merge(p,o.nodeType?[o]:o);else if(me.test(o)){a=a||f.appendChild(t.createElement("div")),s=(de.exec(o)||["",""])[1].toLowerCase(),u=ge[s]||ge._default,a.innerHTML=u[1]+w.htmlPrefilter(o)+u[2],c=u[0];while(c--)a=a.lastChild;w.merge(p,a.childNodes),(a=f.firstChild).textContent=""}else p.push(t.createTextNode(o));f.textContent="",d=0;while(o=p[d++])if(r&&w.inArray(o,r)>-1)i&&i.push(o);else if(l=w.contains(o.ownerDocument,o),a=ye(f.appendChild(o),"script"),l&&ve(a),n){c=0;while(o=a[c++])he.test(o.type||"")&&n.push(o)}return f}!function(){var e=r.createDocumentFragment().appendChild(r.createElement("div")),t=r.createElement("input");t.setAttribute("type","radio"),t.setAttribute("checked","checked"),t.setAttribute("name","t"),e.appendChild(t),h.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,e.innerHTML="<textarea>x</textarea>",h.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue}();var be=r.documentElement,we=/^key/,Te=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ce=/^([^.]*)(?:\.(.+)|)/;function Ee(){return!0}function ke(){return!1}function Se(){try{return r.activeElement}catch(e){}}function De(e,t,n,r,i,o){var a,s;if("object"==typeof t){"string"!=typeof n&&(r=r||n,n=void 0);for(s in t)De(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=ke;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return w().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=w.guid++)),e.each(function(){w.event.add(this,t,i,r,n)})}w.event={global:{},add:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.get(e);if(y){n.handler&&(n=(o=n).handler,i=o.selector),i&&w.find.matchesSelector(be,i),n.guid||(n.guid=w.guid++),(u=y.events)||(u=y.events={}),(a=y.handle)||(a=y.handle=function(t){return"undefined"!=typeof w&&w.event.triggered!==t.type?w.event.dispatch.apply(e,arguments):void 0}),l=(t=(t||"").match(M)||[""]).length;while(l--)d=g=(s=Ce.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=w.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=w.event.special[d]||{},c=w.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&w.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(e,r,h,a)||e.addEventListener&&e.addEventListener(d,a)),f.add&&(f.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),w.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.hasData(e)&&J.get(e);if(y&&(u=y.events)){l=(t=(t||"").match(M)||[""]).length;while(l--)if(s=Ce.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){f=w.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,y.handle)||w.removeEvent(e,d,y.handle),delete u[d])}else for(d in u)w.event.remove(e,d+t[l],n,r,!0);w.isEmptyObject(u)&&J.remove(e,"handle events")}},dispatch:function(e){var t=w.event.fix(e),n,r,i,o,a,s,u=new Array(arguments.length),l=(J.get(this,"events")||{})[t.type]||[],c=w.event.special[t.type]||{};for(u[0]=t,n=1;n<arguments.length;n++)u[n]=arguments[n];if(t.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,t)){s=w.event.handlers.call(this,t,l),n=0;while((o=s[n++])&&!t.isPropagationStopped()){t.currentTarget=o.elem,r=0;while((a=o.handlers[r++])&&!t.isImmediatePropagationStopped())t.rnamespace&&!t.rnamespace.test(a.namespace)||(t.handleObj=a,t.data=a.data,void 0!==(i=((w.event.special[a.origType]||{}).handle||a.handler).apply(o.elem,u))&&!1===(t.result=i)&&(t.preventDefault(),t.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,t),t.result}},handlers:function(e,t){var n,r,i,o,a,s=[],u=t.delegateCount,l=e.target;if(u&&l.nodeType&&!("click"===e.type&&e.button>=1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n<u;n++)void 0===a[i=(r=t[n]).selector+" "]&&(a[i]=r.needsContext?w(i,this).index(l)>-1:w.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u<t.length&&s.push({elem:l,handlers:t.slice(u)}),s},addProp:function(e,t){Object.defineProperty(w.Event.prototype,e,{enumerable:!0,configurable:!0,get:g(t)?function(){if(this.originalEvent)return t(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[e]},set:function(t){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:t})}})},fix:function(e){return e[w.expando]?e:new w.Event(e)},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==Se()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===Se()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&N(this,"input"))return this.click(),!1},_default:function(e){return N(e.target,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},w.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},w.Event=function(e,t){if(!(this instanceof w.Event))return new w.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?Ee:ke,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&w.extend(this,t),this.timeStamp=e&&e.timeStamp||Date.now(),this[w.expando]=!0},w.Event.prototype={constructor:w.Event,isDefaultPrevented:ke,isPropagationStopped:ke,isImmediatePropagationStopped:ke,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=Ee,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=Ee,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=Ee,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},w.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(e){var t=e.button;return null==e.which&&we.test(e.type)?null!=e.charCode?e.charCode:e.keyCode:!e.which&&void 0!==t&&Te.test(e.type)?1&t?1:2&t?3:4&t?2:0:e.which}},w.event.addProp),w.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,t){w.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return i&&(i===r||w.contains(r,i))||(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),w.fn.extend({on:function(e,t,n,r){return De(this,e,t,n,r)},one:function(e,t,n,r){return De(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,w(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return!1!==t&&"function"!=typeof t||(n=t,t=void 0),!1===n&&(n=ke),this.each(function(){w.event.remove(this,e,n,t)})}});var Ne=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,Ae=/<script|<style|<link/i,je=/checked\s*(?:[^=]|=\s*.checked.)/i,qe=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function Le(e,t){return N(e,"table")&&N(11!==t.nodeType?t:t.firstChild,"tr")?w(e).children("tbody")[0]||e:e}function He(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Oe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Pe(e,t){var n,r,i,o,a,s,u,l;if(1===t.nodeType){if(J.hasData(e)&&(o=J.access(e),a=J.set(t,o),l=o.events)){delete a.handle,a.events={};for(i in l)for(n=0,r=l[i].length;n<r;n++)w.event.add(t,i,l[i][n])}K.hasData(e)&&(s=K.access(e),u=w.extend({},s),K.set(t,u))}}function Me(e,t){var n=t.nodeName.toLowerCase();"input"===n&&pe.test(e.type)?t.checked=e.checked:"input"!==n&&"textarea"!==n||(t.defaultValue=e.defaultValue)}function Re(e,t,n,r){t=a.apply([],t);var i,o,s,u,l,c,f=0,p=e.length,d=p-1,y=t[0],v=g(y);if(v||p>1&&"string"==typeof y&&!h.checkClone&&je.test(y))return e.each(function(i){var o=e.eq(i);v&&(t[0]=y.call(this,i,o.html())),Re(o,t,n,r)});if(p&&(i=xe(t,e[0].ownerDocument,!1,e,r),o=i.firstChild,1===i.childNodes.length&&(i=o),o||r)){for(u=(s=w.map(ye(i,"script"),He)).length;f<p;f++)l=i,f!==d&&(l=w.clone(l,!0,!0),u&&w.merge(s,ye(l,"script"))),n.call(e[f],l,f);if(u)for(c=s[s.length-1].ownerDocument,w.map(s,Oe),f=0;f<u;f++)l=s[f],he.test(l.type||"")&&!J.access(l,"globalEval")&&w.contains(c,l)&&(l.src&&"module"!==(l.type||"").toLowerCase()?w._evalUrl&&w._evalUrl(l.src):m(l.textContent.replace(qe,""),c,l))}return e}function Ie(e,t,n){for(var r,i=t?w.filter(t,e):e,o=0;null!=(r=i[o]);o++)n||1!==r.nodeType||w.cleanData(ye(r)),r.parentNode&&(n&&w.contains(r.ownerDocument,r)&&ve(ye(r,"script")),r.parentNode.removeChild(r));return e}w.extend({htmlPrefilter:function(e){return e.replace(Ne,"<$1></$2>")},clone:function(e,t,n){var r,i,o,a,s=e.cloneNode(!0),u=w.contains(e.ownerDocument,e);if(!(h.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||w.isXMLDoc(e)))for(a=ye(s),r=0,i=(o=ye(e)).length;r<i;r++)Me(o[r],a[r]);if(t)if(n)for(o=o||ye(e),a=a||ye(s),r=0,i=o.length;r<i;r++)Pe(o[r],a[r]);else Pe(e,s);return(a=ye(s,"script")).length>0&&ve(a,!u&&ye(e,"script")),s},cleanData:function(e){for(var t,n,r,i=w.event.special,o=0;void 0!==(n=e[o]);o++)if(Y(n)){if(t=n[J.expando]){if(t.events)for(r in t.events)i[r]?w.event.remove(n,r):w.removeEvent(n,r,t.handle);n[J.expando]=void 0}n[K.expando]&&(n[K.expando]=void 0)}}}),w.fn.extend({detach:function(e){return Ie(this,e,!0)},remove:function(e){return Ie(this,e)},text:function(e){return z(this,function(e){return void 0===e?w.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return Re(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Le(this,e).appendChild(e)})},prepend:function(){return Re(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Le(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(w.cleanData(ye(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return w.clone(this,e,t)})},html:function(e){return z(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Ae.test(e)&&!ge[(de.exec(e)||["",""])[1].toLowerCase()]){e=w.htmlPrefilter(e);try{for(;n<r;n++)1===(t=this[n]||{}).nodeType&&(w.cleanData(ye(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=[];return Re(this,arguments,function(t){var n=this.parentNode;w.inArray(this,e)<0&&(w.cleanData(ye(this)),n&&n.replaceChild(t,this))},e)}}),w.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){w.fn[e]=function(e){for(var n,r=[],i=w(e),o=i.length-1,a=0;a<=o;a++)n=a===o?this:this.clone(!0),w(i[a])[t](n),s.apply(r,n.get());return this.pushStack(r)}});var We=new RegExp("^("+re+")(?!px)[a-z%]+$","i"),$e=function(t){var n=t.ownerDocument.defaultView;return n&&n.opener||(n=e),n.getComputedStyle(t)},Be=new RegExp(oe.join("|"),"i");!function(){function t(){if(c){l.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",c.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",be.appendChild(l).appendChild(c);var t=e.getComputedStyle(c);i="1%"!==t.top,u=12===n(t.marginLeft),c.style.right="60%",s=36===n(t.right),o=36===n(t.width),c.style.position="absolute",a=36===c.offsetWidth||"absolute",be.removeChild(l),c=null}}function n(e){return Math.round(parseFloat(e))}var i,o,a,s,u,l=r.createElement("div"),c=r.createElement("div");c.style&&(c.style.backgroundClip="content-box",c.cloneNode(!0).style.backgroundClip="",h.clearCloneStyle="content-box"===c.style.backgroundClip,w.extend(h,{boxSizingReliable:function(){return t(),o},pixelBoxStyles:function(){return t(),s},pixelPosition:function(){return t(),i},reliableMarginLeft:function(){return t(),u},scrollboxSize:function(){return t(),a}}))}();function Fe(e,t,n){var r,i,o,a,s=e.style;return(n=n||$e(e))&&(""!==(a=n.getPropertyValue(t)||n[t])||w.contains(e.ownerDocument,e)||(a=w.style(e,t)),!h.pixelBoxStyles()&&We.test(a)&&Be.test(t)&&(r=s.width,i=s.minWidth,o=s.maxWidth,s.minWidth=s.maxWidth=s.width=a,a=n.width,s.width=r,s.minWidth=i,s.maxWidth=o)),void 0!==a?a+"":a}function _e(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}var ze=/^(none|table(?!-c[ea]).+)/,Xe=/^--/,Ue={position:"absolute",visibility:"hidden",display:"block"},Ve={letterSpacing:"0",fontWeight:"400"},Ge=["Webkit","Moz","ms"],Ye=r.createElement("div").style;function Qe(e){if(e in Ye)return e;var t=e[0].toUpperCase()+e.slice(1),n=Ge.length;while(n--)if((e=Ge[n]+t)in Ye)return e}function Je(e){var t=w.cssProps[e];return t||(t=w.cssProps[e]=Qe(e)||e),t}function Ke(e,t,n){var r=ie.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function Ze(e,t,n,r,i,o){var a="width"===t?1:0,s=0,u=0;if(n===(r?"border":"content"))return 0;for(;a<4;a+=2)"margin"===n&&(u+=w.css(e,n+oe[a],!0,i)),r?("content"===n&&(u-=w.css(e,"padding"+oe[a],!0,i)),"margin"!==n&&(u-=w.css(e,"border"+oe[a]+"Width",!0,i))):(u+=w.css(e,"padding"+oe[a],!0,i),"padding"!==n?u+=w.css(e,"border"+oe[a]+"Width",!0,i):s+=w.css(e,"border"+oe[a]+"Width",!0,i));return!r&&o>=0&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))),u}function et(e,t,n){var r=$e(e),i=Fe(e,t,r),o="border-box"===w.css(e,"boxSizing",!1,r),a=o;if(We.test(i)){if(!n)return i;i="auto"}return a=a&&(h.boxSizingReliable()||i===e.style[t]),("auto"===i||!parseFloat(i)&&"inline"===w.css(e,"display",!1,r))&&(i=e["offset"+t[0].toUpperCase()+t.slice(1)],a=!0),(i=parseFloat(i)||0)+Ze(e,t,n||(o?"border":"content"),a,r,i)+"px"}w.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Fe(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=G(t),u=Xe.test(t),l=e.style;if(u||(t=Je(s)),a=w.cssHooks[t]||w.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];"string"==(o=typeof n)&&(i=ie.exec(n))&&i[1]&&(n=ue(e,t,i),o="number"),null!=n&&n===n&&("number"===o&&(n+=i&&i[3]||(w.cssNumber[s]?"":"px")),h.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,s=G(t);return Xe.test(t)||(t=Je(s)),(a=w.cssHooks[t]||w.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=Fe(e,t,r)),"normal"===i&&t in Ve&&(i=Ve[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),w.each(["height","width"],function(e,t){w.cssHooks[t]={get:function(e,n,r){if(n)return!ze.test(w.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?et(e,t,r):se(e,Ue,function(){return et(e,t,r)})},set:function(e,n,r){var i,o=$e(e),a="border-box"===w.css(e,"boxSizing",!1,o),s=r&&Ze(e,t,r,a,o);return a&&h.scrollboxSize()===o.position&&(s-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(o[t])-Ze(e,t,"border",!1,o)-.5)),s&&(i=ie.exec(n))&&"px"!==(i[3]||"px")&&(e.style[t]=n,n=w.css(e,t)),Ke(e,n,s)}}}),w.cssHooks.marginLeft=_e(h.reliableMarginLeft,function(e,t){if(t)return(parseFloat(Fe(e,"marginLeft"))||e.getBoundingClientRect().left-se(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),w.each({margin:"",padding:"",border:"Width"},function(e,t){w.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[e+oe[r]+t]=o[r]||o[r-2]||o[0];return i}},"margin"!==e&&(w.cssHooks[e+t].set=Ke)}),w.fn.extend({css:function(e,t){return z(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=$e(e),i=t.length;a<i;a++)o[t[a]]=w.css(e,t[a],!1,r);return o}return void 0!==n?w.style(e,t,n):w.css(e,t)},e,t,arguments.length>1)}});function tt(e,t,n,r,i){return new tt.prototype.init(e,t,n,r,i)}w.Tween=tt,tt.prototype={constructor:tt,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||w.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(w.cssNumber[n]?"":"px")},cur:function(){var e=tt.propHooks[this.prop];return e&&e.get?e.get(this):tt.propHooks._default.get(this)},run:function(e){var t,n=tt.propHooks[this.prop];return this.options.duration?this.pos=t=w.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):tt.propHooks._default.set(this),this}},tt.prototype.init.prototype=tt.prototype,tt.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=w.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){w.fx.step[e.prop]?w.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[w.cssProps[e.prop]]&&!w.cssHooks[e.prop]?e.elem[e.prop]=e.now:w.style(e.elem,e.prop,e.now+e.unit)}}},tt.propHooks.scrollTop=tt.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},w.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},w.fx=tt.prototype.init,w.fx.step={};var nt,rt,it=/^(?:toggle|show|hide)$/,ot=/queueHooks$/;function at(){rt&&(!1===r.hidden&&e.requestAnimationFrame?e.requestAnimationFrame(at):e.setTimeout(at,w.fx.interval),w.fx.tick())}function st(){return e.setTimeout(function(){nt=void 0}),nt=Date.now()}function ut(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=oe[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function lt(e,t,n){for(var r,i=(pt.tweeners[t]||[]).concat(pt.tweeners["*"]),o=0,a=i.length;o<a;o++)if(r=i[o].call(n,t,e))return r}function ct(e,t,n){var r,i,o,a,s,u,l,c,f="width"in t||"height"in t,p=this,d={},h=e.style,g=e.nodeType&&ae(e),y=J.get(e,"fxshow");n.queue||(null==(a=w._queueHooks(e,"fx")).unqueued&&(a.unqueued=0,s=a.empty.fire,a.empty.fire=function(){a.unqueued||s()}),a.unqueued++,p.always(function(){p.always(function(){a.unqueued--,w.queue(e,"fx").length||a.empty.fire()})}));for(r in t)if(i=t[r],it.test(i)){if(delete t[r],o=o||"toggle"===i,i===(g?"hide":"show")){if("show"!==i||!y||void 0===y[r])continue;g=!0}d[r]=y&&y[r]||w.style(e,r)}if((u=!w.isEmptyObject(t))||!w.isEmptyObject(d)){f&&1===e.nodeType&&(n.overflow=[h.overflow,h.overflowX,h.overflowY],null==(l=y&&y.display)&&(l=J.get(e,"display")),"none"===(c=w.css(e,"display"))&&(l?c=l:(fe([e],!0),l=e.style.display||l,c=w.css(e,"display"),fe([e]))),("inline"===c||"inline-block"===c&&null!=l)&&"none"===w.css(e,"float")&&(u||(p.done(function(){h.display=l}),null==l&&(c=h.display,l="none"===c?"":c)),h.display="inline-block")),n.overflow&&(h.overflow="hidden",p.always(function(){h.overflow=n.overflow[0],h.overflowX=n.overflow[1],h.overflowY=n.overflow[2]})),u=!1;for(r in d)u||(y?"hidden"in y&&(g=y.hidden):y=J.access(e,"fxshow",{display:l}),o&&(y.hidden=!g),g&&fe([e],!0),p.done(function(){g||fe([e]),J.remove(e,"fxshow");for(r in d)w.style(e,r,d[r])})),u=lt(g?y[r]:0,r,p),r in y||(y[r]=u.start,g&&(u.end=u.start,u.start=0))}}function ft(e,t){var n,r,i,o,a;for(n in e)if(r=G(n),i=t[r],o=e[n],Array.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(a=w.cssHooks[r])&&"expand"in a){o=a.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}function pt(e,t,n){var r,i,o=0,a=pt.prefilters.length,s=w.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;for(var t=nt||st(),n=Math.max(0,l.startTime+l.duration-t),r=1-(n/l.duration||0),o=0,a=l.tweens.length;o<a;o++)l.tweens[o].run(r);return s.notifyWith(e,[l,r,n]),r<1&&a?n:(a||s.notifyWith(e,[l,1,0]),s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:w.extend({},t),opts:w.extend(!0,{specialEasing:{},easing:w.easing._default},n),originalProperties:t,originalOptions:n,startTime:nt||st(),duration:n.duration,tweens:[],createTween:function(t,n){var r=w.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;n<r;n++)l.tweens[n].run(1);return t?(s.notifyWith(e,[l,1,0]),s.resolveWith(e,[l,t])):s.rejectWith(e,[l,t]),this}}),c=l.props;for(ft(c,l.opts.specialEasing);o<a;o++)if(r=pt.prefilters[o].call(l,e,c,l.opts))return g(r.stop)&&(w._queueHooks(l.elem,l.opts.queue).stop=r.stop.bind(r)),r;return w.map(c,lt,l),g(l.opts.start)&&l.opts.start.call(e,l),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always),w.fx.timer(w.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l}w.Animation=w.extend(pt,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return ue(n.elem,e,ie.exec(t),n),n}]},tweener:function(e,t){g(e)?(t=e,e=["*"]):e=e.match(M);for(var n,r=0,i=e.length;r<i;r++)n=e[r],pt.tweeners[n]=pt.tweeners[n]||[],pt.tweeners[n].unshift(t)},prefilters:[ct],prefilter:function(e,t){t?pt.prefilters.unshift(e):pt.prefilters.push(e)}}),w.speed=function(e,t,n){var r=e&&"object"==typeof e?w.extend({},e):{complete:n||!n&&t||g(e)&&e,duration:e,easing:n&&t||t&&!g(t)&&t};return w.fx.off?r.duration=0:"number"!=typeof r.duration&&(r.duration in w.fx.speeds?r.duration=w.fx.speeds[r.duration]:r.duration=w.fx.speeds._default),null!=r.queue&&!0!==r.queue||(r.queue="fx"),r.old=r.complete,r.complete=function(){g(r.old)&&r.old.call(this),r.queue&&w.dequeue(this,r.queue)},r},w.fn.extend({fadeTo:function(e,t,n,r){return this.filter(ae).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=w.isEmptyObject(e),o=w.speed(t,n,r),a=function(){var t=pt(this,w.extend({},e),o);(i||J.get(this,"finish"))&&t.stop(!0)};return a.finish=a,i||!1===o.queue?this.each(a):this.queue(o.queue,a)},stop:function(e,t,n){var r=function(e){var t=e.stop;delete e.stop,t(n)};return"string"!=typeof e&&(n=t,t=e,e=void 0),t&&!1!==e&&this.queue(e||"fx",[]),this.each(function(){var t=!0,i=null!=e&&e+"queueHooks",o=w.timers,a=J.get(this);if(i)a[i]&&a[i].stop&&r(a[i]);else for(i in a)a[i]&&a[i].stop&&ot.test(i)&&r(a[i]);for(i=o.length;i--;)o[i].elem!==this||null!=e&&o[i].queue!==e||(o[i].anim.stop(n),t=!1,o.splice(i,1));!t&&n||w.dequeue(this,e)})},finish:function(e){return!1!==e&&(e=e||"fx"),this.each(function(){var t,n=J.get(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=w.timers,a=r?r.length:0;for(n.finish=!0,w.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;t<a;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}}),w.each(["toggle","show","hide"],function(e,t){var n=w.fn[t];w.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ut(t,!0),e,r,i)}}),w.each({slideDown:ut("show"),slideUp:ut("hide"),slideToggle:ut("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){w.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),w.timers=[],w.fx.tick=function(){var e,t=0,n=w.timers;for(nt=Date.now();t<n.length;t++)(e=n[t])()||n[t]!==e||n.splice(t--,1);n.length||w.fx.stop(),nt=void 0},w.fx.timer=function(e){w.timers.push(e),w.fx.start()},w.fx.interval=13,w.fx.start=function(){rt||(rt=!0,at())},w.fx.stop=function(){rt=null},w.fx.speeds={slow:600,fast:200,_default:400},w.fn.delay=function(t,n){return t=w.fx?w.fx.speeds[t]||t:t,n=n||"fx",this.queue(n,function(n,r){var i=e.setTimeout(n,t);r.stop=function(){e.clearTimeout(i)}})},function(){var e=r.createElement("input"),t=r.createElement("select").appendChild(r.createElement("option"));e.type="checkbox",h.checkOn=""!==e.value,h.optSelected=t.selected,(e=r.createElement("input")).value="t",e.type="radio",h.radioValue="t"===e.value}();var dt,ht=w.expr.attrHandle;w.fn.extend({attr:function(e,t){return z(this,w.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){w.removeAttr(this,e)})}}),w.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?w.prop(e,t,n):(1===o&&w.isXMLDoc(e)||(i=w.attrHooks[t.toLowerCase()]||(w.expr.match.bool.test(t)?dt:void 0)),void 0!==n?null===n?void w.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=w.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!h.radioValue&&"radio"===t&&N(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(M);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),dt={set:function(e,t,n){return!1===t?w.removeAttr(e,n):e.setAttribute(n,n),n}},w.each(w.expr.match.bool.source.match(/\w+/g),function(e,t){var n=ht[t]||w.find.attr;ht[t]=function(e,t,r){var i,o,a=t.toLowerCase();return r||(o=ht[a],ht[a]=i,i=null!=n(e,t,r)?a:null,ht[a]=o),i}});var gt=/^(?:input|select|textarea|button)$/i,yt=/^(?:a|area)$/i;w.fn.extend({prop:function(e,t){return z(this,w.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[w.propFix[e]||e]})}}),w.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&w.isXMLDoc(e)||(t=w.propFix[t]||t,i=w.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=w.find.attr(e,"tabindex");return t?parseInt(t,10):gt.test(e.nodeName)||yt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),h.optSelected||(w.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),w.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){w.propFix[this.toLowerCase()]=this});function vt(e){return(e.match(M)||[]).join(" ")}function mt(e){return e.getAttribute&&e.getAttribute("class")||""}function xt(e){return Array.isArray(e)?e:"string"==typeof e?e.match(M)||[]:[]}w.fn.extend({addClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).addClass(e.call(this,t,mt(this)))});if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])r.indexOf(" "+o+" ")<0&&(r+=o+" ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},removeClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).removeClass(e.call(this,t,mt(this)))});if(!arguments.length)return this.attr("class","");if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])while(r.indexOf(" "+o+" ")>-1)r=r.replace(" "+o+" "," ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},toggleClass:function(e,t){var n=typeof e,r="string"===n||Array.isArray(e);return"boolean"==typeof t&&r?t?this.addClass(e):this.removeClass(e):g(e)?this.each(function(n){w(this).toggleClass(e.call(this,n,mt(this),t),t)}):this.each(function(){var t,i,o,a;if(r){i=0,o=w(this),a=xt(e);while(t=a[i++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else void 0!==e&&"boolean"!==n||((t=mt(this))&&J.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":J.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(1===n.nodeType&&(" "+vt(mt(n))+" ").indexOf(t)>-1)return!0;return!1}});var bt=/\r/g;w.fn.extend({val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=g(e),this.each(function(n){var i;1===this.nodeType&&(null==(i=r?e.call(this,n,w(this).val()):e)?i="":"number"==typeof i?i+="":Array.isArray(i)&&(i=w.map(i,function(e){return null==e?"":e+""})),(t=w.valHooks[this.type]||w.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))});if(i)return(t=w.valHooks[i.type]||w.valHooks[i.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:"string"==typeof(n=i.value)?n.replace(bt,""):null==n?"":n}}}),w.extend({valHooks:{option:{get:function(e){var t=w.find.attr(e,"value");return null!=t?t:vt(w.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r<u;r++)if(((n=i[r]).selected||r===o)&&!n.disabled&&(!n.parentNode.disabled||!N(n.parentNode,"optgroup"))){if(t=w(n).val(),a)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=w.makeArray(t),a=i.length;while(a--)((r=i[a]).selected=w.inArray(w.valHooks.option.get(r),o)>-1)&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),w.each(["radio","checkbox"],function(){w.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=w.inArray(w(e).val(),t)>-1}},h.checkOn||(w.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),h.focusin="onfocusin"in e;var wt=/^(?:focusinfocus|focusoutblur)$/,Tt=function(e){e.stopPropagation()};w.extend(w.event,{trigger:function(t,n,i,o){var a,s,u,l,c,p,d,h,v=[i||r],m=f.call(t,"type")?t.type:t,x=f.call(t,"namespace")?t.namespace.split("."):[];if(s=h=u=i=i||r,3!==i.nodeType&&8!==i.nodeType&&!wt.test(m+w.event.triggered)&&(m.indexOf(".")>-1&&(m=(x=m.split(".")).shift(),x.sort()),c=m.indexOf(":")<0&&"on"+m,t=t[w.expando]?t:new w.Event(m,"object"==typeof t&&t),t.isTrigger=o?2:3,t.namespace=x.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+x.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=i),n=null==n?[t]:w.makeArray(n,[t]),d=w.event.special[m]||{},o||!d.trigger||!1!==d.trigger.apply(i,n))){if(!o&&!d.noBubble&&!y(i)){for(l=d.delegateType||m,wt.test(l+m)||(s=s.parentNode);s;s=s.parentNode)v.push(s),u=s;u===(i.ownerDocument||r)&&v.push(u.defaultView||u.parentWindow||e)}a=0;while((s=v[a++])&&!t.isPropagationStopped())h=s,t.type=a>1?l:d.bindType||m,(p=(J.get(s,"events")||{})[t.type]&&J.get(s,"handle"))&&p.apply(s,n),(p=c&&s[c])&&p.apply&&Y(s)&&(t.result=p.apply(s,n),!1===t.result&&t.preventDefault());return t.type=m,o||t.isDefaultPrevented()||d._default&&!1!==d._default.apply(v.pop(),n)||!Y(i)||c&&g(i[m])&&!y(i)&&((u=i[c])&&(i[c]=null),w.event.triggered=m,t.isPropagationStopped()&&h.addEventListener(m,Tt),i[m](),t.isPropagationStopped()&&h.removeEventListener(m,Tt),w.event.triggered=void 0,u&&(i[c]=u)),t.result}},simulate:function(e,t,n){var r=w.extend(new w.Event,n,{type:e,isSimulated:!0});w.event.trigger(r,null,t)}}),w.fn.extend({trigger:function(e,t){return this.each(function(){w.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return w.event.trigger(e,t,n,!0)}}),h.focusin||w.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){w.event.simulate(t,e.target,w.event.fix(e))};w.event.special[t]={setup:function(){var r=this.ownerDocument||this,i=J.access(r,t);i||r.addEventListener(e,n,!0),J.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=J.access(r,t)-1;i?J.access(r,t,i):(r.removeEventListener(e,n,!0),J.remove(r,t))}}});var Ct=e.location,Et=Date.now(),kt=/\?/;w.parseXML=function(t){var n;if(!t||"string"!=typeof t)return null;try{n=(new e.DOMParser).parseFromString(t,"text/xml")}catch(e){n=void 0}return n&&!n.getElementsByTagName("parsererror").length||w.error("Invalid XML: "+t),n};var St=/\[\]$/,Dt=/\r?\n/g,Nt=/^(?:submit|button|image|reset|file)$/i,At=/^(?:input|select|textarea|keygen)/i;function jt(e,t,n,r){var i;if(Array.isArray(t))w.each(t,function(t,i){n||St.test(e)?r(e,i):jt(e+"["+("object"==typeof i&&null!=i?t:"")+"]",i,n,r)});else if(n||"object"!==x(t))r(e,t);else for(i in t)jt(e+"["+i+"]",t[i],n,r)}w.param=function(e,t){var n,r=[],i=function(e,t){var n=g(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(Array.isArray(e)||e.jquery&&!w.isPlainObject(e))w.each(e,function(){i(this.name,this.value)});else for(n in e)jt(n,e[n],t,i);return r.join("&")},w.fn.extend({serialize:function(){return w.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=w.prop(this,"elements");return e?w.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!w(this).is(":disabled")&&At.test(this.nodeName)&&!Nt.test(e)&&(this.checked||!pe.test(e))}).map(function(e,t){var n=w(this).val();return null==n?null:Array.isArray(n)?w.map(n,function(e){return{name:t.name,value:e.replace(Dt,"\r\n")}}):{name:t.name,value:n.replace(Dt,"\r\n")}}).get()}});var qt=/%20/g,Lt=/#.*$/,Ht=/([?&])_=[^&]*/,Ot=/^(.*?):[ \t]*([^\r\n]*)$/gm,Pt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Mt=/^(?:GET|HEAD)$/,Rt=/^\/\//,It={},Wt={},$t="*/".concat("*"),Bt=r.createElement("a");Bt.href=Ct.href;function Ft(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(M)||[];if(g(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function _t(e,t,n,r){var i={},o=e===Wt;function a(s){var u;return i[s]=!0,w.each(e[s]||[],function(e,s){var l=s(t,n,r);return"string"!=typeof l||o||i[l]?o?!(u=l):void 0:(t.dataTypes.unshift(l),a(l),!1)}),u}return a(t.dataTypes[0])||!i["*"]&&a("*")}function zt(e,t){var n,r,i=w.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&w.extend(!0,e,r),e}function Xt(e,t,n){var r,i,o,a,s=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]}function Ut(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(a=l[u+" "+o]||l["* "+o]))for(i in l)if((s=i.split(" "))[1]===o&&(a=l[u+" "+s[0]]||l["* "+s[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}w.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ct.href,type:"GET",isLocal:Pt.test(Ct.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":$t,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":w.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?zt(zt(e,w.ajaxSettings),t):zt(w.ajaxSettings,e)},ajaxPrefilter:Ft(It),ajaxTransport:Ft(Wt),ajax:function(t,n){"object"==typeof t&&(n=t,t=void 0),n=n||{};var i,o,a,s,u,l,c,f,p,d,h=w.ajaxSetup({},n),g=h.context||h,y=h.context&&(g.nodeType||g.jquery)?w(g):w.event,v=w.Deferred(),m=w.Callbacks("once memory"),x=h.statusCode||{},b={},T={},C="canceled",E={readyState:0,getResponseHeader:function(e){var t;if(c){if(!s){s={};while(t=Ot.exec(a))s[t[1].toLowerCase()]=t[2]}t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return c?a:null},setRequestHeader:function(e,t){return null==c&&(e=T[e.toLowerCase()]=T[e.toLowerCase()]||e,b[e]=t),this},overrideMimeType:function(e){return null==c&&(h.mimeType=e),this},statusCode:function(e){var t;if(e)if(c)E.always(e[E.status]);else for(t in e)x[t]=[x[t],e[t]];return this},abort:function(e){var t=e||C;return i&&i.abort(t),k(0,t),this}};if(v.promise(E),h.url=((t||h.url||Ct.href)+"").replace(Rt,Ct.protocol+"//"),h.type=n.method||n.type||h.method||h.type,h.dataTypes=(h.dataType||"*").toLowerCase().match(M)||[""],null==h.crossDomain){l=r.createElement("a");try{l.href=h.url,l.href=l.href,h.crossDomain=Bt.protocol+"//"+Bt.host!=l.protocol+"//"+l.host}catch(e){h.crossDomain=!0}}if(h.data&&h.processData&&"string"!=typeof h.data&&(h.data=w.param(h.data,h.traditional)),_t(It,h,n,E),c)return E;(f=w.event&&h.global)&&0==w.active++&&w.event.trigger("ajaxStart"),h.type=h.type.toUpperCase(),h.hasContent=!Mt.test(h.type),o=h.url.replace(Lt,""),h.hasContent?h.data&&h.processData&&0===(h.contentType||"").indexOf("application/x-www-form-urlencoded")&&(h.data=h.data.replace(qt,"+")):(d=h.url.slice(o.length),h.data&&(h.processData||"string"==typeof h.data)&&(o+=(kt.test(o)?"&":"?")+h.data,delete h.data),!1===h.cache&&(o=o.replace(Ht,"$1"),d=(kt.test(o)?"&":"?")+"_="+Et+++d),h.url=o+d),h.ifModified&&(w.lastModified[o]&&E.setRequestHeader("If-Modified-Since",w.lastModified[o]),w.etag[o]&&E.setRequestHeader("If-None-Match",w.etag[o])),(h.data&&h.hasContent&&!1!==h.contentType||n.contentType)&&E.setRequestHeader("Content-Type",h.contentType),E.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+$t+"; q=0.01":""):h.accepts["*"]);for(p in h.headers)E.setRequestHeader(p,h.headers[p]);if(h.beforeSend&&(!1===h.beforeSend.call(g,E,h)||c))return E.abort();if(C="abort",m.add(h.complete),E.done(h.success),E.fail(h.error),i=_t(Wt,h,n,E)){if(E.readyState=1,f&&y.trigger("ajaxSend",[E,h]),c)return E;h.async&&h.timeout>0&&(u=e.setTimeout(function(){E.abort("timeout")},h.timeout));try{c=!1,i.send(b,k)}catch(e){if(c)throw e;k(-1,e)}}else k(-1,"No Transport");function k(t,n,r,s){var l,p,d,b,T,C=n;c||(c=!0,u&&e.clearTimeout(u),i=void 0,a=s||"",E.readyState=t>0?4:0,l=t>=200&&t<300||304===t,r&&(b=Xt(h,E,r)),b=Ut(h,b,E,l),l?(h.ifModified&&((T=E.getResponseHeader("Last-Modified"))&&(w.lastModified[o]=T),(T=E.getResponseHeader("etag"))&&(w.etag[o]=T)),204===t||"HEAD"===h.type?C="nocontent":304===t?C="notmodified":(C=b.state,p=b.data,l=!(d=b.error))):(d=C,!t&&C||(C="error",t<0&&(t=0))),E.status=t,E.statusText=(n||C)+"",l?v.resolveWith(g,[p,C,E]):v.rejectWith(g,[E,C,d]),E.statusCode(x),x=void 0,f&&y.trigger(l?"ajaxSuccess":"ajaxError",[E,h,l?p:d]),m.fireWith(g,[E,C]),f&&(y.trigger("ajaxComplete",[E,h]),--w.active||w.event.trigger("ajaxStop")))}return E},getJSON:function(e,t,n){return w.get(e,t,n,"json")},getScript:function(e,t){return w.get(e,void 0,t,"script")}}),w.each(["get","post"],function(e,t){w[t]=function(e,n,r,i){return g(n)&&(i=i||r,r=n,n=void 0),w.ajax(w.extend({url:e,type:t,dataType:i,data:n,success:r},w.isPlainObject(e)&&e))}}),w._evalUrl=function(e){return w.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},w.fn.extend({wrapAll:function(e){var t;return this[0]&&(g(e)&&(e=e.call(this[0])),t=w(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(e){return g(e)?this.each(function(t){w(this).wrapInner(e.call(this,t))}):this.each(function(){var t=w(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=g(e);return this.each(function(n){w(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){w(this).replaceWith(this.childNodes)}),this}}),w.expr.pseudos.hidden=function(e){return!w.expr.pseudos.visible(e)},w.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},w.ajaxSettings.xhr=function(){try{return new e.XMLHttpRequest}catch(e){}};var Vt={0:200,1223:204},Gt=w.ajaxSettings.xhr();h.cors=!!Gt&&"withCredentials"in Gt,h.ajax=Gt=!!Gt,w.ajaxTransport(function(t){var n,r;if(h.cors||Gt&&!t.crossDomain)return{send:function(i,o){var a,s=t.xhr();if(s.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(a in t.xhrFields)s[a]=t.xhrFields[a];t.mimeType&&s.overrideMimeType&&s.overrideMimeType(t.mimeType),t.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");for(a in i)s.setRequestHeader(a,i[a]);n=function(e){return function(){n&&(n=r=s.onload=s.onerror=s.onabort=s.ontimeout=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?o(0,"error"):o(s.status,s.statusText):o(Vt[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=n(),r=s.onerror=s.ontimeout=n("error"),void 0!==s.onabort?s.onabort=r:s.onreadystatechange=function(){4===s.readyState&&e.setTimeout(function(){n&&r()})},n=n("abort");try{s.send(t.hasContent&&t.data||null)}catch(e){if(n)throw e}},abort:function(){n&&n()}}}),w.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),w.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return w.globalEval(e),e}}}),w.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),w.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(i,o){t=w("<script>").prop({charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&o("error"===e.type?404:200,e.type)}),r.head.appendChild(t[0])},abort:function(){n&&n()}}}});var Yt=[],Qt=/(=)\?(?=&|$)|\?\?/;w.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Yt.pop()||w.expando+"_"+Et++;return this[e]=!0,e}}),w.ajaxPrefilter("json jsonp",function(t,n,r){var i,o,a,s=!1!==t.jsonp&&(Qt.test(t.url)?"url":"string"==typeof t.data&&0===(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&Qt.test(t.data)&&"data");if(s||"jsonp"===t.dataTypes[0])return i=t.jsonpCallback=g(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,s?t[s]=t[s].replace(Qt,"$1"+i):!1!==t.jsonp&&(t.url+=(kt.test(t.url)?"&":"?")+t.jsonp+"="+i),t.converters["script json"]=function(){return a||w.error(i+" was not called"),a[0]},t.dataTypes[0]="json",o=e[i],e[i]=function(){a=arguments},r.always(function(){void 0===o?w(e).removeProp(i):e[i]=o,t[i]&&(t.jsonpCallback=n.jsonpCallback,Yt.push(i)),a&&g(o)&&o(a[0]),a=o=void 0}),"script"}),h.createHTMLDocument=function(){var e=r.implementation.createHTMLDocument("").body;return e.innerHTML="<form></form><form></form>",2===e.childNodes.length}(),w.parseHTML=function(e,t,n){if("string"!=typeof e)return[];"boolean"==typeof t&&(n=t,t=!1);var i,o,a;return t||(h.createHTMLDocument?((i=(t=r.implementation.createHTMLDocument("")).createElement("base")).href=r.location.href,t.head.appendChild(i)):t=r),o=A.exec(e),a=!n&&[],o?[t.createElement(o[1])]:(o=xe([e],t,a),a&&a.length&&w(a).remove(),w.merge([],o.childNodes))},w.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return s>-1&&(r=vt(e.slice(s)),e=e.slice(0,s)),g(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),a.length>0&&w.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done(function(e){o=arguments,a.html(r?w("<div>").append(w.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},w.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){w.fn[t]=function(e){return this.on(t,e)}}),w.expr.pseudos.animated=function(e){return w.grep(w.timers,function(t){return e===t.elem}).length},w.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l,c=w.css(e,"position"),f=w(e),p={};"static"===c&&(e.style.position="relative"),s=f.offset(),o=w.css(e,"top"),u=w.css(e,"left"),(l=("absolute"===c||"fixed"===c)&&(o+u).indexOf("auto")>-1)?(a=(r=f.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),g(t)&&(t=t.call(e,n,w.extend({},s))),null!=t.top&&(p.top=t.top-s.top+a),null!=t.left&&(p.left=t.left-s.left+i),"using"in t?t.using.call(e,p):f.css(p)}},w.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each(function(t){w.offset.setOffset(this,e,t)});var t,n,r=this[0];if(r)return r.getClientRects().length?(t=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:t.top+n.pageYOffset,left:t.left+n.pageXOffset}):{top:0,left:0}},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===w.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===w.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=w(e).offset()).top+=w.css(e,"borderTopWidth",!0),i.left+=w.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-w.css(r,"marginTop",!0),left:t.left-i.left-w.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===w.css(e,"position"))e=e.offsetParent;return e||be})}}),w.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var n="pageYOffset"===t;w.fn[e]=function(r){return z(this,function(e,r,i){var o;if(y(e)?o=e:9===e.nodeType&&(o=e.defaultView),void 0===i)return o?o[t]:e[r];o?o.scrollTo(n?o.pageXOffset:i,n?i:o.pageYOffset):e[r]=i},e,r,arguments.length)}}),w.each(["top","left"],function(e,t){w.cssHooks[t]=_e(h.pixelPosition,function(e,n){if(n)return n=Fe(e,t),We.test(n)?w(e).position()[t]+"px":n})}),w.each({Height:"height",Width:"width"},function(e,t){w.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){w.fn[r]=function(i,o){var a=arguments.length&&(n||"boolean"!=typeof i),s=n||(!0===i||!0===o?"margin":"border");return z(this,function(t,n,i){var o;return y(t)?0===r.indexOf("outer")?t["inner"+e]:t.document.documentElement["client"+e]:9===t.nodeType?(o=t.documentElement,Math.max(t.body["scroll"+e],o["scroll"+e],t.body["offset"+e],o["offset"+e],o["client"+e])):void 0===i?w.css(t,n,s):w.style(t,n,i,s)},t,a?i:void 0,a)}})}),w.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,t){w.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),w.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),w.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}}),w.proxy=function(e,t){var n,r,i;if("string"==typeof t&&(n=e[t],t=e,e=n),g(e))return r=o.call(arguments,2),i=function(){return e.apply(t||this,r.concat(o.call(arguments)))},i.guid=e.guid=e.guid||w.guid++,i},w.holdReady=function(e){e?w.readyWait++:w.ready(!0)},w.isArray=Array.isArray,w.parseJSON=JSON.parse,w.nodeName=N,w.isFunction=g,w.isWindow=y,w.camelCase=G,w.type=x,w.now=Date.now,w.isNumeric=function(e){var t=w.type(e);return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))},"function"==typeof define&&define.amd&&define("jquery",[],function(){return w});var Jt=e.jQuery,Kt=e.$;return w.noConflict=function(t){return e.$===w&&(e.$=Kt),t&&e.jQuery===w&&(e.jQuery=Jt),w},t||(e.jQuery=e.$=w),w}); diff --git a/static_common/common/vendor/jquery/jquery-3.3.1.slim.min.js b/static_common/common/vendor/jquery/jquery-3.3.1.slim.min.js deleted file mode 100644 index f4ca9b24..00000000 --- a/static_common/common/vendor/jquery/jquery-3.3.1.slim.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! jQuery v3.3.1 -ajax,-ajax/jsonp,-ajax/load,-ajax/parseXML,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-event/ajax,-effects,-effects/Tween,-effects/animatedSelector | (c) JS Foundation and other contributors | jquery.org/license */ -!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){"use strict";var n=[],r=e.document,i=Object.getPrototypeOf,o=n.slice,a=n.concat,u=n.push,s=n.indexOf,l={},c=l.toString,f=l.hasOwnProperty,d=f.toString,p=d.call(Object),h={},g=function e(t){return"function"==typeof t&&"number"!=typeof t.nodeType},v=function e(t){return null!=t&&t===t.window},y={type:!0,src:!0,noModule:!0};function m(e,t,n){var i,o=(t=t||r).createElement("script");if(o.text=e,n)for(i in y)n[i]&&(o[i]=n[i]);t.head.appendChild(o).parentNode.removeChild(o)}function b(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[c.call(e)]||"object":typeof e}var x="3.3.1 -ajax,-ajax/jsonp,-ajax/load,-ajax/parseXML,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-event/ajax,-effects,-effects/Tween,-effects/animatedSelector",w=function(e,t){return new w.fn.init(e,t)},C=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;w.fn=w.prototype={jquery:x,constructor:w,length:0,toArray:function(){return o.call(this)},get:function(e){return null==e?o.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=w.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return w.each(this,e)},map:function(e){return this.pushStack(w.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(o.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:u,sort:n.sort,splice:n.splice},w.extend=w.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},u=1,s=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[u]||{},u++),"object"==typeof a||g(a)||(a={}),u===s&&(a=this,u--);u<s;u++)if(null!=(e=arguments[u]))for(t in e)n=a[t],a!==(r=e[t])&&(l&&r&&(w.isPlainObject(r)||(i=Array.isArray(r)))?(i?(i=!1,o=n&&Array.isArray(n)?n:[]):o=n&&w.isPlainObject(n)?n:{},a[t]=w.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},w.extend({expando:"jQuery"+(x+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==c.call(e))&&(!(t=i(e))||"function"==typeof(n=f.call(t,"constructor")&&t.constructor)&&d.call(n)===p)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e){m(e)},each:function(e,t){var n,r=0;if(T(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},trim:function(e){return null==e?"":(e+"").replace(C,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(T(Object(e))?w.merge(n,"string"==typeof e?[e]:e):u.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:s.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r,i=[],o=0,a=e.length,u=!n;o<a;o++)(r=!t(e[o],o))!==u&&i.push(e[o]);return i},map:function(e,t,n){var r,i,o=0,u=[];if(T(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&u.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&u.push(i);return a.apply([],u)},guid:1,support:h}),"function"==typeof Symbol&&(w.fn[Symbol.iterator]=n[Symbol.iterator]),w.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function T(e){var t=!!e&&"length"in e&&e.length,n=b(e);return!g(e)&&!v(e)&&("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e)}var E=function(e){var t,n,r,i,o,a,u,s,l,c,f,d,p,h,g,v,y,m,b,x="sizzle"+1*new Date,w=e.document,C=0,T=0,E=ae(),N=ae(),k=ae(),A=function(e,t){return e===t&&(f=!0),0},D={}.hasOwnProperty,S=[],L=S.pop,j=S.push,q=S.push,O=S.slice,P=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},H="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",I="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",B="\\["+I+"*("+R+")(?:"+I+"*([*^$|!~]?=)"+I+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+R+"))|)"+I+"*\\]",M=":("+R+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+B+")*)|.*)\\)|)",W=new RegExp(I+"+","g"),$=new RegExp("^"+I+"+|((?:^|[^\\\\])(?:\\\\.)*)"+I+"+$","g"),F=new RegExp("^"+I+"*,"+I+"*"),z=new RegExp("^"+I+"*([>+~]|"+I+")"+I+"*"),_=new RegExp("="+I+"*([^\\]'\"]*?)"+I+"*\\]","g"),U=new RegExp(M),V=new RegExp("^"+R+"$"),X={ID:new RegExp("^#("+R+")"),CLASS:new RegExp("^\\.("+R+")"),TAG:new RegExp("^("+R+"|[*])"),ATTR:new RegExp("^"+B),PSEUDO:new RegExp("^"+M),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+I+"*(even|odd|(([+-]|)(\\d*)n|)"+I+"*(?:([+-]|)"+I+"*(\\d+)|))"+I+"*\\)|)","i"),bool:new RegExp("^(?:"+H+")$","i"),needsContext:new RegExp("^"+I+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+I+"*((?:-\\d)?\\d*)"+I+"*\\)|)(?=[^-]|$)","i")},Q=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,G=/^[^{]+\{\s*\[native \w/,K=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,J=/[+~]/,Z=new RegExp("\\\\([\\da-f]{1,6}"+I+"?|("+I+")|.)","ig"),ee=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},te=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ne=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},re=function(){d()},ie=me(function(e){return!0===e.disabled&&("form"in e||"label"in e)},{dir:"parentNode",next:"legend"});try{q.apply(S=O.call(w.childNodes),w.childNodes),S[w.childNodes.length].nodeType}catch(e){q={apply:S.length?function(e,t){j.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function oe(e,t,r,i){var o,u,l,c,f,h,y,m=t&&t.ownerDocument,C=t?t.nodeType:9;if(r=r||[],"string"!=typeof e||!e||1!==C&&9!==C&&11!==C)return r;if(!i&&((t?t.ownerDocument||t:w)!==p&&d(t),t=t||p,g)){if(11!==C&&(f=K.exec(e)))if(o=f[1]){if(9===C){if(!(l=t.getElementById(o)))return r;if(l.id===o)return r.push(l),r}else if(m&&(l=m.getElementById(o))&&b(t,l)&&l.id===o)return r.push(l),r}else{if(f[2])return q.apply(r,t.getElementsByTagName(e)),r;if((o=f[3])&&n.getElementsByClassName&&t.getElementsByClassName)return q.apply(r,t.getElementsByClassName(o)),r}if(n.qsa&&!k[e+" "]&&(!v||!v.test(e))){if(1!==C)m=t,y=e;else if("object"!==t.nodeName.toLowerCase()){(c=t.getAttribute("id"))?c=c.replace(te,ne):t.setAttribute("id",c=x),u=(h=a(e)).length;while(u--)h[u]="#"+c+" "+ye(h[u]);y=h.join(","),m=J.test(e)&&ge(t.parentNode)||t}if(y)try{return q.apply(r,m.querySelectorAll(y)),r}catch(e){}finally{c===x&&t.removeAttribute("id")}}}return s(e.replace($,"$1"),t,r,i)}function ae(){var e=[];function t(n,i){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=i}return t}function ue(e){return e[x]=!0,e}function se(e){var t=p.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function le(e,t){var n=e.split("|"),i=n.length;while(i--)r.attrHandle[n[i]]=t}function ce(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function fe(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function de(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function pe(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&ie(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function he(e){return ue(function(t){return t=+t,ue(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}function ge(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}n=oe.support={},o=oe.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},d=oe.setDocument=function(e){var t,i,a=e?e.ownerDocument||e:w;return a!==p&&9===a.nodeType&&a.documentElement?(p=a,h=p.documentElement,g=!o(p),w!==p&&(i=p.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",re,!1):i.attachEvent&&i.attachEvent("onunload",re)),n.attributes=se(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=se(function(e){return e.appendChild(p.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=G.test(p.getElementsByClassName),n.getById=se(function(e){return h.appendChild(e).id=x,!p.getElementsByName||!p.getElementsByName(x).length}),n.getById?(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){return e.getAttribute("id")===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n=t.getElementById(e);return n?[n]:[]}}):(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),r.find.TAG=n.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):n.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},r.find.CLASS=n.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&g)return t.getElementsByClassName(e)},y=[],v=[],(n.qsa=G.test(p.querySelectorAll))&&(se(function(e){h.appendChild(e).innerHTML="<a id='"+x+"'></a><select id='"+x+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+I+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+I+"*(?:value|"+H+")"),e.querySelectorAll("[id~="+x+"-]").length||v.push("~="),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+x+"+*").length||v.push(".#.+[+~]")}),se(function(e){e.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var t=p.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+I+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),h.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(n.matchesSelector=G.test(m=h.matches||h.webkitMatchesSelector||h.mozMatchesSelector||h.oMatchesSelector||h.msMatchesSelector))&&se(function(e){n.disconnectedMatch=m.call(e,"*"),m.call(e,"[s!='']:x"),y.push("!=",M)}),v=v.length&&new RegExp(v.join("|")),y=y.length&&new RegExp(y.join("|")),t=G.test(h.compareDocumentPosition),b=t||G.test(h.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},A=t?function(e,t){if(e===t)return f=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!n.sortDetached&&t.compareDocumentPosition(e)===r?e===p||e.ownerDocument===w&&b(w,e)?-1:t===p||t.ownerDocument===w&&b(w,t)?1:c?P(c,e)-P(c,t):0:4&r?-1:1)}:function(e,t){if(e===t)return f=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],u=[t];if(!i||!o)return e===p?-1:t===p?1:i?-1:o?1:c?P(c,e)-P(c,t):0;if(i===o)return ce(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)u.unshift(n);while(a[r]===u[r])r++;return r?ce(a[r],u[r]):a[r]===w?-1:u[r]===w?1:0},p):p},oe.matches=function(e,t){return oe(e,null,null,t)},oe.matchesSelector=function(e,t){if((e.ownerDocument||e)!==p&&d(e),t=t.replace(_,"='$1']"),n.matchesSelector&&g&&!k[t+" "]&&(!y||!y.test(t))&&(!v||!v.test(t)))try{var r=m.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){}return oe(t,p,null,[e]).length>0},oe.contains=function(e,t){return(e.ownerDocument||e)!==p&&d(e),b(e,t)},oe.attr=function(e,t){(e.ownerDocument||e)!==p&&d(e);var i=r.attrHandle[t.toLowerCase()],o=i&&D.call(r.attrHandle,t.toLowerCase())?i(e,t,!g):void 0;return void 0!==o?o:n.attributes||!g?e.getAttribute(t):(o=e.getAttributeNode(t))&&o.specified?o.value:null},oe.escape=function(e){return(e+"").replace(te,ne)},oe.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},oe.uniqueSort=function(e){var t,r=[],i=0,o=0;if(f=!n.detectDuplicates,c=!n.sortStable&&e.slice(0),e.sort(A),f){while(t=e[o++])t===e[o]&&(i=r.push(o));while(i--)e.splice(r[i],1)}return c=null,e},i=oe.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e)}else if(3===o||4===o)return e.nodeValue}else while(t=e[r++])n+=i(t);return n},(r=oe.selectors={cacheLength:50,createPseudo:ue,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(Z,ee),e[3]=(e[3]||e[4]||e[5]||"").replace(Z,ee),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||oe.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&oe.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return X.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&U.test(n)&&(t=a(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(Z,ee).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=E[e+" "];return t||(t=new RegExp("(^|"+I+")"+e+"("+I+"|$)"))&&E(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=oe.attr(r,e);return null==i?"!="===t:!t||(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i.replace(W," ")+" ").indexOf(n)>-1:"|="===t&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),u="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,s){var l,c,f,d,p,h,g=o!==a?"nextSibling":"previousSibling",v=t.parentNode,y=u&&t.nodeName.toLowerCase(),m=!s&&!u,b=!1;if(v){if(o){while(g){d=t;while(d=d[g])if(u?d.nodeName.toLowerCase()===y:1===d.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?v.firstChild:v.lastChild],a&&m){b=(p=(l=(c=(f=(d=v)[x]||(d[x]={}))[d.uniqueID]||(f[d.uniqueID]={}))[e]||[])[0]===C&&l[1])&&l[2],d=p&&v.childNodes[p];while(d=++p&&d&&d[g]||(b=p=0)||h.pop())if(1===d.nodeType&&++b&&d===t){c[e]=[C,p,b];break}}else if(m&&(b=p=(l=(c=(f=(d=t)[x]||(d[x]={}))[d.uniqueID]||(f[d.uniqueID]={}))[e]||[])[0]===C&&l[1]),!1===b)while(d=++p&&d&&d[g]||(b=p=0)||h.pop())if((u?d.nodeName.toLowerCase()===y:1===d.nodeType)&&++b&&(m&&((c=(f=d[x]||(d[x]={}))[d.uniqueID]||(f[d.uniqueID]={}))[e]=[C,b]),d===t))break;return(b-=i)===r||b%r==0&&b/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||oe.error("unsupported pseudo: "+e);return i[x]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?ue(function(e,n){var r,o=i(e,t),a=o.length;while(a--)e[r=P(e,o[a])]=!(n[r]=o[a])}):function(e){return i(e,0,n)}):i}},pseudos:{not:ue(function(e){var t=[],n=[],r=u(e.replace($,"$1"));return r[x]?ue(function(e,t,n,i){var o,a=r(e,null,i,[]),u=e.length;while(u--)(o=a[u])&&(e[u]=!(t[u]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),t[0]=null,!n.pop()}}),has:ue(function(e){return function(t){return oe(e,t).length>0}}),contains:ue(function(e){return e=e.replace(Z,ee),function(t){return(t.textContent||t.innerText||i(t)).indexOf(e)>-1}}),lang:ue(function(e){return V.test(e||"")||oe.error("unsupported lang: "+e),e=e.replace(Z,ee).toLowerCase(),function(t){var n;do{if(n=g?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===h},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:pe(!1),disabled:pe(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!r.pseudos.empty(e)},header:function(e){return Y.test(e.nodeName)},input:function(e){return Q.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:he(function(){return[0]}),last:he(function(e,t){return[t-1]}),eq:he(function(e,t,n){return[n<0?n+t:n]}),even:he(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:he(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:he(function(e,t,n){for(var r=n<0?n+t:n;--r>=0;)e.push(r);return e}),gt:he(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}}).pseudos.nth=r.pseudos.eq;for(t in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})r.pseudos[t]=fe(t);for(t in{submit:!0,reset:!0})r.pseudos[t]=de(t);function ve(){}ve.prototype=r.filters=r.pseudos,r.setFilters=new ve,a=oe.tokenize=function(e,t){var n,i,o,a,u,s,l,c=N[e+" "];if(c)return t?0:c.slice(0);u=e,s=[],l=r.preFilter;while(u){n&&!(i=F.exec(u))||(i&&(u=u.slice(i[0].length)||u),s.push(o=[])),n=!1,(i=z.exec(u))&&(n=i.shift(),o.push({value:n,type:i[0].replace($," ")}),u=u.slice(n.length));for(a in r.filter)!(i=X[a].exec(u))||l[a]&&!(i=l[a](i))||(n=i.shift(),o.push({value:n,type:a,matches:i}),u=u.slice(n.length));if(!n)break}return t?u.length:u?oe.error(e):N(e,s).slice(0)};function ye(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function me(e,t,n){var r=t.dir,i=t.next,o=i||r,a=n&&"parentNode"===o,u=T++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||a)return e(t,n,i);return!1}:function(t,n,s){var l,c,f,d=[C,u];if(s){while(t=t[r])if((1===t.nodeType||a)&&e(t,n,s))return!0}else while(t=t[r])if(1===t.nodeType||a)if(f=t[x]||(t[x]={}),c=f[t.uniqueID]||(f[t.uniqueID]={}),i&&i===t.nodeName.toLowerCase())t=t[r]||t;else{if((l=c[o])&&l[0]===C&&l[1]===u)return d[2]=l[2];if(c[o]=d,d[2]=e(t,n,s))return!0}return!1}}function be(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function xe(e,t,n){for(var r=0,i=t.length;r<i;r++)oe(e,t[r],n);return n}function we(e,t,n,r,i){for(var o,a=[],u=0,s=e.length,l=null!=t;u<s;u++)(o=e[u])&&(n&&!n(o,r,i)||(a.push(o),l&&t.push(u)));return a}function Ce(e,t,n,r,i,o){return r&&!r[x]&&(r=Ce(r)),i&&!i[x]&&(i=Ce(i,o)),ue(function(o,a,u,s){var l,c,f,d=[],p=[],h=a.length,g=o||xe(t||"*",u.nodeType?[u]:u,[]),v=!e||!o&&t?g:we(g,d,e,u,s),y=n?i||(o?e:h||r)?[]:a:v;if(n&&n(v,y,u,s),r){l=we(y,p),r(l,[],u,s),c=l.length;while(c--)(f=l[c])&&(y[p[c]]=!(v[p[c]]=f))}if(o){if(i||e){if(i){l=[],c=y.length;while(c--)(f=y[c])&&l.push(v[c]=f);i(null,y=[],l,s)}c=y.length;while(c--)(f=y[c])&&(l=i?P(o,f):d[c])>-1&&(o[l]=!(a[l]=f))}}else y=we(y===a?y.splice(h,y.length):y),i?i(null,a,y,s):q.apply(a,y)})}function Te(e){for(var t,n,i,o=e.length,a=r.relative[e[0].type],u=a||r.relative[" "],s=a?1:0,c=me(function(e){return e===t},u,!0),f=me(function(e){return P(t,e)>-1},u,!0),d=[function(e,n,r){var i=!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):f(e,n,r));return t=null,i}];s<o;s++)if(n=r.relative[e[s].type])d=[me(be(d),n)];else{if((n=r.filter[e[s].type].apply(null,e[s].matches))[x]){for(i=++s;i<o;i++)if(r.relative[e[i].type])break;return Ce(s>1&&be(d),s>1&&ye(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace($,"$1"),n,s<i&&Te(e.slice(s,i)),i<o&&Te(e=e.slice(i)),i<o&&ye(e))}d.push(n)}return be(d)}function Ee(e,t){var n=t.length>0,i=e.length>0,o=function(o,a,u,s,c){var f,h,v,y=0,m="0",b=o&&[],x=[],w=l,T=o||i&&r.find.TAG("*",c),E=C+=null==w?1:Math.random()||.1,N=T.length;for(c&&(l=a===p||a||c);m!==N&&null!=(f=T[m]);m++){if(i&&f){h=0,a||f.ownerDocument===p||(d(f),u=!g);while(v=e[h++])if(v(f,a||p,u)){s.push(f);break}c&&(C=E)}n&&((f=!v&&f)&&y--,o&&b.push(f))}if(y+=m,n&&m!==y){h=0;while(v=t[h++])v(b,x,a,u);if(o){if(y>0)while(m--)b[m]||x[m]||(x[m]=L.call(s));x=we(x)}q.apply(s,x),c&&!o&&x.length>0&&y+t.length>1&&oe.uniqueSort(s)}return c&&(C=E,l=w),b};return n?ue(o):o}return u=oe.compile=function(e,t){var n,r=[],i=[],o=k[e+" "];if(!o){t||(t=a(e)),n=t.length;while(n--)(o=Te(t[n]))[x]?r.push(o):i.push(o);(o=k(e,Ee(i,r))).selector=e}return o},s=oe.select=function(e,t,n,i){var o,s,l,c,f,d="function"==typeof e&&e,p=!i&&a(e=d.selector||e);if(n=n||[],1===p.length){if((s=p[0]=p[0].slice(0)).length>2&&"ID"===(l=s[0]).type&&9===t.nodeType&&g&&r.relative[s[1].type]){if(!(t=(r.find.ID(l.matches[0].replace(Z,ee),t)||[])[0]))return n;d&&(t=t.parentNode),e=e.slice(s.shift().value.length)}o=X.needsContext.test(e)?0:s.length;while(o--){if(l=s[o],r.relative[c=l.type])break;if((f=r.find[c])&&(i=f(l.matches[0].replace(Z,ee),J.test(s[0].type)&&ge(t.parentNode)||t))){if(s.splice(o,1),!(e=i.length&&ye(s)))return q.apply(n,i),n;break}}}return(d||u(e,p))(i,t,!g,n,!t||J.test(e)&&ge(t.parentNode)||t),n},n.sortStable=x.split("").sort(A).join("")===x,n.detectDuplicates=!!f,d(),n.sortDetached=se(function(e){return 1&e.compareDocumentPosition(p.createElement("fieldset"))}),se(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||le("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),n.attributes&&se(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||le("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),se(function(e){return null==e.getAttribute("disabled")})||le(H,function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),oe}(e);w.find=E,w.expr=E.selectors,w.expr[":"]=w.expr.pseudos,w.uniqueSort=w.unique=E.uniqueSort,w.text=E.getText,w.isXMLDoc=E.isXML,w.contains=E.contains,w.escapeSelector=E.escape;var N=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&w(e).is(n))break;r.push(e)}return r},k=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},A=w.expr.match.needsContext;function D(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var S=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function L(e,t,n){return g(t)?w.grep(e,function(e,r){return!!t.call(e,r,e)!==n}):t.nodeType?w.grep(e,function(e){return e===t!==n}):"string"!=typeof t?w.grep(e,function(e){return s.call(t,e)>-1!==n}):w.filter(t,e,n)}w.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?w.find.matchesSelector(r,e)?[r]:[]:w.find.matches(e,w.grep(t,function(e){return 1===e.nodeType}))},w.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(w(e).filter(function(){for(t=0;t<r;t++)if(w.contains(i[t],this))return!0}));for(n=this.pushStack([]),t=0;t<r;t++)w.find(e,i[t],n);return r>1?w.uniqueSort(n):n},filter:function(e){return this.pushStack(L(this,e||[],!1))},not:function(e){return this.pushStack(L(this,e||[],!0))},is:function(e){return!!L(this,"string"==typeof e&&A.test(e)?w(e):e||[],!1).length}});var j,q=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(w.fn.init=function(e,t,n){var i,o;if(!e)return this;if(n=n||j,"string"==typeof e){if(!(i="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:q.exec(e))||!i[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(i[1]){if(t=t instanceof w?t[0]:t,w.merge(this,w.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:r,!0)),S.test(i[1])&&w.isPlainObject(t))for(i in t)g(this[i])?this[i](t[i]):this.attr(i,t[i]);return this}return(o=r.getElementById(i[2]))&&(this[0]=o,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):g(e)?void 0!==n.ready?n.ready(e):e(w):w.makeArray(e,this)}).prototype=w.fn,j=w(r);var O=/^(?:parents|prev(?:Until|All))/,P={children:!0,contents:!0,next:!0,prev:!0};w.fn.extend({has:function(e){var t=w(e,this),n=t.length;return this.filter(function(){for(var e=0;e<n;e++)if(w.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,i=this.length,o=[],a="string"!=typeof e&&w(e);if(!A.test(e))for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?a.index(n)>-1:1===n.nodeType&&w.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?w.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?s.call(w(e),this[0]):s.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(w.uniqueSort(w.merge(this.get(),w(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function H(e,t){while((e=e[t])&&1!==e.nodeType);return e}w.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return N(e,"parentNode")},parentsUntil:function(e,t,n){return N(e,"parentNode",n)},next:function(e){return H(e,"nextSibling")},prev:function(e){return H(e,"previousSibling")},nextAll:function(e){return N(e,"nextSibling")},prevAll:function(e){return N(e,"previousSibling")},nextUntil:function(e,t,n){return N(e,"nextSibling",n)},prevUntil:function(e,t,n){return N(e,"previousSibling",n)},siblings:function(e){return k((e.parentNode||{}).firstChild,e)},children:function(e){return k(e.firstChild)},contents:function(e){return D(e,"iframe")?e.contentDocument:(D(e,"template")&&(e=e.content||e),w.merge([],e.childNodes))}},function(e,t){w.fn[e]=function(n,r){var i=w.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=w.filter(r,i)),this.length>1&&(P[e]||w.uniqueSort(i),O.test(e)&&i.reverse()),this.pushStack(i)}});var I=/[^\x20\t\r\n\f]+/g;function R(e){var t={};return w.each(e.match(I)||[],function(e,n){t[n]=!0}),t}w.Callbacks=function(e){e="string"==typeof e?R(e):w.extend({},e);var t,n,r,i,o=[],a=[],u=-1,s=function(){for(i=i||e.once,r=t=!0;a.length;u=-1){n=a.shift();while(++u<o.length)!1===o[u].apply(n[0],n[1])&&e.stopOnFalse&&(u=o.length,n=!1)}e.memory||(n=!1),t=!1,i&&(o=n?[]:"")},l={add:function(){return o&&(n&&!t&&(u=o.length-1,a.push(n)),function t(n){w.each(n,function(n,r){g(r)?e.unique&&l.has(r)||o.push(r):r&&r.length&&"string"!==b(r)&&t(r)})}(arguments),n&&!t&&s()),this},remove:function(){return w.each(arguments,function(e,t){var n;while((n=w.inArray(t,o,n))>-1)o.splice(n,1),n<=u&&u--}),this},has:function(e){return e?w.inArray(e,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return i=a=[],o=n="",this},disabled:function(){return!o},lock:function(){return i=a=[],n||t||(o=n=""),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=[e,(n=n||[]).slice?n.slice():n],a.push(n),t||s()),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!r}};return l};function B(e){return e}function M(e){throw e}function W(e,t,n,r){var i;try{e&&g(i=e.promise)?i.call(e).done(t).fail(n):e&&g(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}w.extend({Deferred:function(t){var n=[["notify","progress",w.Callbacks("memory"),w.Callbacks("memory"),2],["resolve","done",w.Callbacks("once memory"),w.Callbacks("once memory"),0,"resolved"],["reject","fail",w.Callbacks("once memory"),w.Callbacks("once memory"),1,"rejected"]],r="pending",i={state:function(){return r},always:function(){return o.done(arguments).fail(arguments),this},"catch":function(e){return i.then(null,e)},pipe:function(){var e=arguments;return w.Deferred(function(t){w.each(n,function(n,r){var i=g(e[r[4]])&&e[r[4]];o[r[1]](function(){var e=i&&i.apply(this,arguments);e&&g(e.promise)?e.promise().progress(t.notify).done(t.resolve).fail(t.reject):t[r[0]+"With"](this,i?[e]:arguments)})}),e=null}).promise()},then:function(t,r,i){var o=0;function a(t,n,r,i){return function(){var u=this,s=arguments,l=function(){var e,l;if(!(t<o)){if((e=r.apply(u,s))===n.promise())throw new TypeError("Thenable self-resolution");l=e&&("object"==typeof e||"function"==typeof e)&&e.then,g(l)?i?l.call(e,a(o,n,B,i),a(o,n,M,i)):(o++,l.call(e,a(o,n,B,i),a(o,n,M,i),a(o,n,B,n.notifyWith))):(r!==B&&(u=void 0,s=[e]),(i||n.resolveWith)(u,s))}},c=i?l:function(){try{l()}catch(e){w.Deferred.exceptionHook&&w.Deferred.exceptionHook(e,c.stackTrace),t+1>=o&&(r!==M&&(u=void 0,s=[e]),n.rejectWith(u,s))}};t?c():(w.Deferred.getStackHook&&(c.stackTrace=w.Deferred.getStackHook()),e.setTimeout(c))}}return w.Deferred(function(e){n[0][3].add(a(0,e,g(i)?i:B,e.notifyWith)),n[1][3].add(a(0,e,g(t)?t:B)),n[2][3].add(a(0,e,g(r)?r:M))}).promise()},promise:function(e){return null!=e?w.extend(e,i):i}},o={};return w.each(n,function(e,t){var a=t[2],u=t[5];i[t[1]]=a.add,u&&a.add(function(){r=u},n[3-e][2].disable,n[3-e][3].disable,n[0][2].lock,n[0][3].lock),a.add(t[3].fire),o[t[0]]=function(){return o[t[0]+"With"](this===o?void 0:this,arguments),this},o[t[0]+"With"]=a.fireWith}),i.promise(o),t&&t.call(o,o),o},when:function(e){var t=arguments.length,n=t,r=Array(n),i=o.call(arguments),a=w.Deferred(),u=function(e){return function(n){r[e]=this,i[e]=arguments.length>1?o.call(arguments):n,--t||a.resolveWith(r,i)}};if(t<=1&&(W(e,a.done(u(n)).resolve,a.reject,!t),"pending"===a.state()||g(i[n]&&i[n].then)))return a.then();while(n--)W(i[n],u(n),a.reject);return a.promise()}});var $=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;w.Deferred.exceptionHook=function(t,n){e.console&&e.console.warn&&t&&$.test(t.name)&&e.console.warn("jQuery.Deferred exception: "+t.message,t.stack,n)},w.readyException=function(t){e.setTimeout(function(){throw t})};var F=w.Deferred();w.fn.ready=function(e){return F.then(e)["catch"](function(e){w.readyException(e)}),this},w.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--w.readyWait:w.isReady)||(w.isReady=!0,!0!==e&&--w.readyWait>0||F.resolveWith(r,[w]))}}),w.ready.then=F.then;function z(){r.removeEventListener("DOMContentLoaded",z),e.removeEventListener("load",z),w.ready()}"complete"===r.readyState||"loading"!==r.readyState&&!r.documentElement.doScroll?e.setTimeout(w.ready):(r.addEventListener("DOMContentLoaded",z),e.addEventListener("load",z));var _=function(e,t,n,r,i,o,a){var u=0,s=e.length,l=null==n;if("object"===b(n)){i=!0;for(u in n)_(e,t,u,n[u],!0,o,a)}else if(void 0!==r&&(i=!0,g(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(w(e),n)})),t))for(;u<s;u++)t(e[u],n,a?r:r.call(e[u],u,t(e[u],n)));return i?e:l?t.call(e):s?t(e[0],n):o},U=/^-ms-/,V=/-([a-z])/g;function X(e,t){return t.toUpperCase()}function Q(e){return e.replace(U,"ms-").replace(V,X)}var Y=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};function G(){this.expando=w.expando+G.uid++}G.uid=1,G.prototype={cache:function(e){var t=e[this.expando];return t||(t={},Y(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,i=this.cache(e);if("string"==typeof t)i[Q(t)]=n;else for(r in t)i[Q(r)]=t[r];return i},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][Q(t)]},access:function(e,t,n){return void 0===t||t&&"string"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){n=(t=Array.isArray(t)?t.map(Q):(t=Q(t))in r?[t]:t.match(I)||[]).length;while(n--)delete r[t[n]]}(void 0===t||w.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!w.isEmptyObject(t)}};var K=new G,J=new G,Z=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,ee=/[A-Z]/g;function te(e){return"true"===e||"false"!==e&&("null"===e?null:e===+e+""?+e:Z.test(e)?JSON.parse(e):e)}function ne(e,t,n){var r;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(ee,"-$&").toLowerCase(),"string"==typeof(n=e.getAttribute(r))){try{n=te(n)}catch(e){}J.set(e,t,n)}else n=void 0;return n}w.extend({hasData:function(e){return J.hasData(e)||K.hasData(e)},data:function(e,t,n){return J.access(e,t,n)},removeData:function(e,t){J.remove(e,t)},_data:function(e,t,n){return K.access(e,t,n)},_removeData:function(e,t){K.remove(e,t)}}),w.fn.extend({data:function(e,t){var n,r,i,o=this[0],a=o&&o.attributes;if(void 0===e){if(this.length&&(i=J.get(o),1===o.nodeType&&!K.get(o,"hasDataAttrs"))){n=a.length;while(n--)a[n]&&0===(r=a[n].name).indexOf("data-")&&(r=Q(r.slice(5)),ne(o,r,i[r]));K.set(o,"hasDataAttrs",!0)}return i}return"object"==typeof e?this.each(function(){J.set(this,e)}):_(this,function(t){var n;if(o&&void 0===t){if(void 0!==(n=J.get(o,e)))return n;if(void 0!==(n=ne(o,e)))return n}else this.each(function(){J.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){J.remove(this,e)})}}),w.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=K.get(e,t),n&&(!r||Array.isArray(n)?r=K.access(e,t,w.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=w.queue(e,t),r=n.length,i=n.shift(),o=w._queueHooks(e,t),a=function(){w.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return K.get(e,n)||K.access(e,n,{empty:w.Callbacks("once memory").add(function(){K.remove(e,[t+"queue",n])})})}}),w.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length<n?w.queue(this[0],e):void 0===t?this:this.each(function(){var n=w.queue(this,e,t);w._queueHooks(this,e),"fx"===e&&"inprogress"!==n[0]&&w.dequeue(this,e)})},dequeue:function(e){return this.each(function(){w.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=w.Deferred(),o=this,a=this.length,u=function(){--r||i.resolveWith(o,[o])};"string"!=typeof e&&(t=e,e=void 0),e=e||"fx";while(a--)(n=K.get(o[a],e+"queueHooks"))&&n.empty&&(r++,n.empty.add(u));return u(),i.promise(t)}});var re=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,ie=new RegExp("^(?:([+-])=|)("+re+")([a-z%]*)$","i"),oe=["Top","Right","Bottom","Left"],ae=function(e,t){return"none"===(e=t||e).style.display||""===e.style.display&&w.contains(e.ownerDocument,e)&&"none"===w.css(e,"display")},ue=function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i};function se(e,t,n,r){var i,o,a=20,u=r?function(){return r.cur()}:function(){return w.css(e,t,"")},s=u(),l=n&&n[3]||(w.cssNumber[t]?"":"px"),c=(w.cssNumber[t]||"px"!==l&&+s)&&ie.exec(w.css(e,t));if(c&&c[3]!==l){s/=2,l=l||c[3],c=+s||1;while(a--)w.style(e,t,c+l),(1-o)*(1-(o=u()/s||.5))<=0&&(a=0),c/=o;c*=2,w.style(e,t,c+l),n=n||[]}return n&&(c=+c||+s||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}var le={};function ce(e){var t,n=e.ownerDocument,r=e.nodeName,i=le[r];return i||(t=n.body.appendChild(n.createElement(r)),i=w.css(t,"display"),t.parentNode.removeChild(t),"none"===i&&(i="block"),le[r]=i,i)}function fe(e,t){for(var n,r,i=[],o=0,a=e.length;o<a;o++)(r=e[o]).style&&(n=r.style.display,t?("none"===n&&(i[o]=K.get(r,"display")||null,i[o]||(r.style.display="")),""===r.style.display&&ae(r)&&(i[o]=ce(r))):"none"!==n&&(i[o]="none",K.set(r,"display",n)));for(o=0;o<a;o++)null!=i[o]&&(e[o].style.display=i[o]);return e}w.fn.extend({show:function(){return fe(this,!0)},hide:function(){return fe(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){ae(this)?w(this).show():w(this).hide()})}});var de=/^(?:checkbox|radio)$/i,pe=/<([a-z][^\/\0>\x20\t\r\n\f]+)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ge={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ge.optgroup=ge.option,ge.tbody=ge.tfoot=ge.colgroup=ge.caption=ge.thead,ge.th=ge.td;function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&D(e,t)?w.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;n<r;n++)K.set(e[n],"globalEval",!t||K.get(t[n],"globalEval"))}var me=/<|&#?\w+;/;function be(e,t,n,r,i){for(var o,a,u,s,l,c,f=t.createDocumentFragment(),d=[],p=0,h=e.length;p<h;p++)if((o=e[p])||0===o)if("object"===b(o))w.merge(d,o.nodeType?[o]:o);else if(me.test(o)){a=a||f.appendChild(t.createElement("div")),u=(pe.exec(o)||["",""])[1].toLowerCase(),s=ge[u]||ge._default,a.innerHTML=s[1]+w.htmlPrefilter(o)+s[2],c=s[0];while(c--)a=a.lastChild;w.merge(d,a.childNodes),(a=f.firstChild).textContent=""}else d.push(t.createTextNode(o));f.textContent="",p=0;while(o=d[p++])if(r&&w.inArray(o,r)>-1)i&&i.push(o);else if(l=w.contains(o.ownerDocument,o),a=ve(f.appendChild(o),"script"),l&&ye(a),n){c=0;while(o=a[c++])he.test(o.type||"")&&n.push(o)}return f}!function(){var e=r.createDocumentFragment().appendChild(r.createElement("div")),t=r.createElement("input");t.setAttribute("type","radio"),t.setAttribute("checked","checked"),t.setAttribute("name","t"),e.appendChild(t),h.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,e.innerHTML="<textarea>x</textarea>",h.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue}();var xe=r.documentElement,we=/^key/,Ce=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Te=/^([^.]*)(?:\.(.+)|)/;function Ee(){return!0}function Ne(){return!1}function ke(){try{return r.activeElement}catch(e){}}function Ae(e,t,n,r,i,o){var a,u;if("object"==typeof t){"string"!=typeof n&&(r=r||n,n=void 0);for(u in t)Ae(e,u,n,r,t[u],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=Ne;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return w().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=w.guid++)),e.each(function(){w.event.add(this,t,i,r,n)})}w.event={global:{},add:function(e,t,n,r,i){var o,a,u,s,l,c,f,d,p,h,g,v=K.get(e);if(v){n.handler&&(n=(o=n).handler,i=o.selector),i&&w.find.matchesSelector(xe,i),n.guid||(n.guid=w.guid++),(s=v.events)||(s=v.events={}),(a=v.handle)||(a=v.handle=function(t){return"undefined"!=typeof w&&w.event.triggered!==t.type?w.event.dispatch.apply(e,arguments):void 0}),l=(t=(t||"").match(I)||[""]).length;while(l--)p=g=(u=Te.exec(t[l])||[])[1],h=(u[2]||"").split(".").sort(),p&&(f=w.event.special[p]||{},p=(i?f.delegateType:f.bindType)||p,f=w.event.special[p]||{},c=w.extend({type:p,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&w.expr.match.needsContext.test(i),namespace:h.join(".")},o),(d=s[p])||((d=s[p]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(e,r,h,a)||e.addEventListener&&e.addEventListener(p,a)),f.add&&(f.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),i?d.splice(d.delegateCount++,0,c):d.push(c),w.event.global[p]=!0)}},remove:function(e,t,n,r,i){var o,a,u,s,l,c,f,d,p,h,g,v=K.hasData(e)&&K.get(e);if(v&&(s=v.events)){l=(t=(t||"").match(I)||[""]).length;while(l--)if(u=Te.exec(t[l])||[],p=g=u[1],h=(u[2]||"").split(".").sort(),p){f=w.event.special[p]||{},d=s[p=(r?f.delegateType:f.bindType)||p]||[],u=u[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=d.length;while(o--)c=d[o],!i&&g!==c.origType||n&&n.guid!==c.guid||u&&!u.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(d.splice(o,1),c.selector&&d.delegateCount--,f.remove&&f.remove.call(e,c));a&&!d.length&&(f.teardown&&!1!==f.teardown.call(e,h,v.handle)||w.removeEvent(e,p,v.handle),delete s[p])}else for(p in s)w.event.remove(e,p+t[l],n,r,!0);w.isEmptyObject(s)&&K.remove(e,"handle events")}},dispatch:function(e){var t=w.event.fix(e),n,r,i,o,a,u,s=new Array(arguments.length),l=(K.get(this,"events")||{})[t.type]||[],c=w.event.special[t.type]||{};for(s[0]=t,n=1;n<arguments.length;n++)s[n]=arguments[n];if(t.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,t)){u=w.event.handlers.call(this,t,l),n=0;while((o=u[n++])&&!t.isPropagationStopped()){t.currentTarget=o.elem,r=0;while((a=o.handlers[r++])&&!t.isImmediatePropagationStopped())t.rnamespace&&!t.rnamespace.test(a.namespace)||(t.handleObj=a,t.data=a.data,void 0!==(i=((w.event.special[a.origType]||{}).handle||a.handler).apply(o.elem,s))&&!1===(t.result=i)&&(t.preventDefault(),t.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,t),t.result}},handlers:function(e,t){var n,r,i,o,a,u=[],s=t.delegateCount,l=e.target;if(s&&l.nodeType&&!("click"===e.type&&e.button>=1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n<s;n++)void 0===a[i=(r=t[n]).selector+" "]&&(a[i]=r.needsContext?w(i,this).index(l)>-1:w.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&u.push({elem:l,handlers:o})}return l=this,s<t.length&&u.push({elem:l,handlers:t.slice(s)}),u},addProp:function(e,t){Object.defineProperty(w.Event.prototype,e,{enumerable:!0,configurable:!0,get:g(t)?function(){if(this.originalEvent)return t(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[e]},set:function(t){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:t})}})},fix:function(e){return e[w.expando]?e:new w.Event(e)},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==ke()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===ke()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&D(this,"input"))return this.click(),!1},_default:function(e){return D(e.target,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},w.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},w.Event=function(e,t){if(!(this instanceof w.Event))return new w.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?Ee:Ne,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&w.extend(this,t),this.timeStamp=e&&e.timeStamp||Date.now(),this[w.expando]=!0},w.Event.prototype={constructor:w.Event,isDefaultPrevented:Ne,isPropagationStopped:Ne,isImmediatePropagationStopped:Ne,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=Ee,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=Ee,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=Ee,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},w.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(e){var t=e.button;return null==e.which&&we.test(e.type)?null!=e.charCode?e.charCode:e.keyCode:!e.which&&void 0!==t&&Ce.test(e.type)?1&t?1:2&t?3:4&t?2:0:e.which}},w.event.addProp),w.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,t){w.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return i&&(i===r||w.contains(r,i))||(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),w.fn.extend({on:function(e,t,n,r){return Ae(this,e,t,n,r)},one:function(e,t,n,r){return Ae(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,w(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return!1!==t&&"function"!=typeof t||(n=t,t=void 0),!1===n&&(n=Ne),this.each(function(){w.event.remove(this,e,n,t)})}});var De=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,Se=/<script|<style|<link/i,Le=/checked\s*(?:[^=]|=\s*.checked.)/i,je=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function qe(e,t){return D(e,"table")&&D(11!==t.nodeType?t:t.firstChild,"tr")?w(e).children("tbody")[0]||e:e}function Oe(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Pe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function He(e,t){var n,r,i,o,a,u,s,l;if(1===t.nodeType){if(K.hasData(e)&&(o=K.access(e),a=K.set(t,o),l=o.events)){delete a.handle,a.events={};for(i in l)for(n=0,r=l[i].length;n<r;n++)w.event.add(t,i,l[i][n])}J.hasData(e)&&(u=J.access(e),s=w.extend({},u),J.set(t,s))}}function Ie(e,t){var n=t.nodeName.toLowerCase();"input"===n&&de.test(e.type)?t.checked=e.checked:"input"!==n&&"textarea"!==n||(t.defaultValue=e.defaultValue)}function Re(e,t,n,r){t=a.apply([],t);var i,o,u,s,l,c,f=0,d=e.length,p=d-1,v=t[0],y=g(v);if(y||d>1&&"string"==typeof v&&!h.checkClone&&Le.test(v))return e.each(function(i){var o=e.eq(i);y&&(t[0]=v.call(this,i,o.html())),Re(o,t,n,r)});if(d&&(i=be(t,e[0].ownerDocument,!1,e,r),o=i.firstChild,1===i.childNodes.length&&(i=o),o||r)){for(s=(u=w.map(ve(i,"script"),Oe)).length;f<d;f++)l=i,f!==p&&(l=w.clone(l,!0,!0),s&&w.merge(u,ve(l,"script"))),n.call(e[f],l,f);if(s)for(c=u[u.length-1].ownerDocument,w.map(u,Pe),f=0;f<s;f++)l=u[f],he.test(l.type||"")&&!K.access(l,"globalEval")&&w.contains(c,l)&&(l.src&&"module"!==(l.type||"").toLowerCase()?w._evalUrl&&w._evalUrl(l.src):m(l.textContent.replace(je,""),c,l))}return e}function Be(e,t,n){for(var r,i=t?w.filter(t,e):e,o=0;null!=(r=i[o]);o++)n||1!==r.nodeType||w.cleanData(ve(r)),r.parentNode&&(n&&w.contains(r.ownerDocument,r)&&ye(ve(r,"script")),r.parentNode.removeChild(r));return e}w.extend({htmlPrefilter:function(e){return e.replace(De,"<$1></$2>")},clone:function(e,t,n){var r,i,o,a,u=e.cloneNode(!0),s=w.contains(e.ownerDocument,e);if(!(h.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||w.isXMLDoc(e)))for(a=ve(u),r=0,i=(o=ve(e)).length;r<i;r++)Ie(o[r],a[r]);if(t)if(n)for(o=o||ve(e),a=a||ve(u),r=0,i=o.length;r<i;r++)He(o[r],a[r]);else He(e,u);return(a=ve(u,"script")).length>0&&ye(a,!s&&ve(e,"script")),u},cleanData:function(e){for(var t,n,r,i=w.event.special,o=0;void 0!==(n=e[o]);o++)if(Y(n)){if(t=n[K.expando]){if(t.events)for(r in t.events)i[r]?w.event.remove(n,r):w.removeEvent(n,r,t.handle);n[K.expando]=void 0}n[J.expando]&&(n[J.expando]=void 0)}}}),w.fn.extend({detach:function(e){return Be(this,e,!0)},remove:function(e){return Be(this,e)},text:function(e){return _(this,function(e){return void 0===e?w.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return Re(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||qe(this,e).appendChild(e)})},prepend:function(){return Re(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=qe(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(w.cleanData(ve(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return w.clone(this,e,t)})},html:function(e){return _(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Se.test(e)&&!ge[(pe.exec(e)||["",""])[1].toLowerCase()]){e=w.htmlPrefilter(e);try{for(;n<r;n++)1===(t=this[n]||{}).nodeType&&(w.cleanData(ve(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=[];return Re(this,arguments,function(t){var n=this.parentNode;w.inArray(this,e)<0&&(w.cleanData(ve(this)),n&&n.replaceChild(t,this))},e)}}),w.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){w.fn[e]=function(e){for(var n,r=[],i=w(e),o=i.length-1,a=0;a<=o;a++)n=a===o?this:this.clone(!0),w(i[a])[t](n),u.apply(r,n.get());return this.pushStack(r)}});var Me=new RegExp("^("+re+")(?!px)[a-z%]+$","i"),We=function(t){var n=t.ownerDocument.defaultView;return n&&n.opener||(n=e),n.getComputedStyle(t)},$e=new RegExp(oe.join("|"),"i");!function(){function t(){if(c){l.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",c.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",xe.appendChild(l).appendChild(c);var t=e.getComputedStyle(c);i="1%"!==t.top,s=12===n(t.marginLeft),c.style.right="60%",u=36===n(t.right),o=36===n(t.width),c.style.position="absolute",a=36===c.offsetWidth||"absolute",xe.removeChild(l),c=null}}function n(e){return Math.round(parseFloat(e))}var i,o,a,u,s,l=r.createElement("div"),c=r.createElement("div");c.style&&(c.style.backgroundClip="content-box",c.cloneNode(!0).style.backgroundClip="",h.clearCloneStyle="content-box"===c.style.backgroundClip,w.extend(h,{boxSizingReliable:function(){return t(),o},pixelBoxStyles:function(){return t(),u},pixelPosition:function(){return t(),i},reliableMarginLeft:function(){return t(),s},scrollboxSize:function(){return t(),a}}))}();function Fe(e,t,n){var r,i,o,a,u=e.style;return(n=n||We(e))&&(""!==(a=n.getPropertyValue(t)||n[t])||w.contains(e.ownerDocument,e)||(a=w.style(e,t)),!h.pixelBoxStyles()&&Me.test(a)&&$e.test(t)&&(r=u.width,i=u.minWidth,o=u.maxWidth,u.minWidth=u.maxWidth=u.width=a,a=n.width,u.width=r,u.minWidth=i,u.maxWidth=o)),void 0!==a?a+"":a}function ze(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}var _e=/^(none|table(?!-c[ea]).+)/,Ue=/^--/,Ve={position:"absolute",visibility:"hidden",display:"block"},Xe={letterSpacing:"0",fontWeight:"400"},Qe=["Webkit","Moz","ms"],Ye=r.createElement("div").style;function Ge(e){if(e in Ye)return e;var t=e[0].toUpperCase()+e.slice(1),n=Qe.length;while(n--)if((e=Qe[n]+t)in Ye)return e}function Ke(e){var t=w.cssProps[e];return t||(t=w.cssProps[e]=Ge(e)||e),t}function Je(e,t,n){var r=ie.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function Ze(e,t,n,r,i,o){var a="width"===t?1:0,u=0,s=0;if(n===(r?"border":"content"))return 0;for(;a<4;a+=2)"margin"===n&&(s+=w.css(e,n+oe[a],!0,i)),r?("content"===n&&(s-=w.css(e,"padding"+oe[a],!0,i)),"margin"!==n&&(s-=w.css(e,"border"+oe[a]+"Width",!0,i))):(s+=w.css(e,"padding"+oe[a],!0,i),"padding"!==n?s+=w.css(e,"border"+oe[a]+"Width",!0,i):u+=w.css(e,"border"+oe[a]+"Width",!0,i));return!r&&o>=0&&(s+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-s-u-.5))),s}function et(e,t,n){var r=We(e),i=Fe(e,t,r),o="border-box"===w.css(e,"boxSizing",!1,r),a=o;if(Me.test(i)){if(!n)return i;i="auto"}return a=a&&(h.boxSizingReliable()||i===e.style[t]),("auto"===i||!parseFloat(i)&&"inline"===w.css(e,"display",!1,r))&&(i=e["offset"+t[0].toUpperCase()+t.slice(1)],a=!0),(i=parseFloat(i)||0)+Ze(e,t,n||(o?"border":"content"),a,r,i)+"px"}w.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Fe(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,u=Q(t),s=Ue.test(t),l=e.style;if(s||(t=Ke(u)),a=w.cssHooks[t]||w.cssHooks[u],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];"string"==(o=typeof n)&&(i=ie.exec(n))&&i[1]&&(n=se(e,t,i),o="number"),null!=n&&n===n&&("number"===o&&(n+=i&&i[3]||(w.cssNumber[u]?"":"px")),h.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(s?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,u=Q(t);return Ue.test(t)||(t=Ke(u)),(a=w.cssHooks[t]||w.cssHooks[u])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=Fe(e,t,r)),"normal"===i&&t in Xe&&(i=Xe[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),w.each(["height","width"],function(e,t){w.cssHooks[t]={get:function(e,n,r){if(n)return!_e.test(w.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?et(e,t,r):ue(e,Ve,function(){return et(e,t,r)})},set:function(e,n,r){var i,o=We(e),a="border-box"===w.css(e,"boxSizing",!1,o),u=r&&Ze(e,t,r,a,o);return a&&h.scrollboxSize()===o.position&&(u-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(o[t])-Ze(e,t,"border",!1,o)-.5)),u&&(i=ie.exec(n))&&"px"!==(i[3]||"px")&&(e.style[t]=n,n=w.css(e,t)),Je(e,n,u)}}}),w.cssHooks.marginLeft=ze(h.reliableMarginLeft,function(e,t){if(t)return(parseFloat(Fe(e,"marginLeft"))||e.getBoundingClientRect().left-ue(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),w.each({margin:"",padding:"",border:"Width"},function(e,t){w.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[e+oe[r]+t]=o[r]||o[r-2]||o[0];return i}},"margin"!==e&&(w.cssHooks[e+t].set=Je)}),w.fn.extend({css:function(e,t){return _(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=We(e),i=t.length;a<i;a++)o[t[a]]=w.css(e,t[a],!1,r);return o}return void 0!==n?w.style(e,t,n):w.css(e,t)},e,t,arguments.length>1)}}),w.fn.delay=function(t,n){return t=w.fx?w.fx.speeds[t]||t:t,n=n||"fx",this.queue(n,function(n,r){var i=e.setTimeout(n,t);r.stop=function(){e.clearTimeout(i)}})},function(){var e=r.createElement("input"),t=r.createElement("select").appendChild(r.createElement("option"));e.type="checkbox",h.checkOn=""!==e.value,h.optSelected=t.selected,(e=r.createElement("input")).value="t",e.type="radio",h.radioValue="t"===e.value}();var tt,nt=w.expr.attrHandle;w.fn.extend({attr:function(e,t){return _(this,w.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){w.removeAttr(this,e)})}}),w.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?w.prop(e,t,n):(1===o&&w.isXMLDoc(e)||(i=w.attrHooks[t.toLowerCase()]||(w.expr.match.bool.test(t)?tt:void 0)),void 0!==n?null===n?void w.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=w.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!h.radioValue&&"radio"===t&&D(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(I);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),tt={set:function(e,t,n){return!1===t?w.removeAttr(e,n):e.setAttribute(n,n),n}},w.each(w.expr.match.bool.source.match(/\w+/g),function(e,t){var n=nt[t]||w.find.attr;nt[t]=function(e,t,r){var i,o,a=t.toLowerCase();return r||(o=nt[a],nt[a]=i,i=null!=n(e,t,r)?a:null,nt[a]=o),i}});var rt=/^(?:input|select|textarea|button)$/i,it=/^(?:a|area)$/i;w.fn.extend({prop:function(e,t){return _(this,w.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[w.propFix[e]||e]})}}),w.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&w.isXMLDoc(e)||(t=w.propFix[t]||t,i=w.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=w.find.attr(e,"tabindex");return t?parseInt(t,10):rt.test(e.nodeName)||it.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),h.optSelected||(w.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),w.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){w.propFix[this.toLowerCase()]=this});function ot(e){return(e.match(I)||[]).join(" ")}function at(e){return e.getAttribute&&e.getAttribute("class")||""}function ut(e){return Array.isArray(e)?e:"string"==typeof e?e.match(I)||[]:[]}w.fn.extend({addClass:function(e){var t,n,r,i,o,a,u,s=0;if(g(e))return this.each(function(t){w(this).addClass(e.call(this,t,at(this)))});if((t=ut(e)).length)while(n=this[s++])if(i=at(n),r=1===n.nodeType&&" "+ot(i)+" "){a=0;while(o=t[a++])r.indexOf(" "+o+" ")<0&&(r+=o+" ");i!==(u=ot(r))&&n.setAttribute("class",u)}return this},removeClass:function(e){var t,n,r,i,o,a,u,s=0;if(g(e))return this.each(function(t){w(this).removeClass(e.call(this,t,at(this)))});if(!arguments.length)return this.attr("class","");if((t=ut(e)).length)while(n=this[s++])if(i=at(n),r=1===n.nodeType&&" "+ot(i)+" "){a=0;while(o=t[a++])while(r.indexOf(" "+o+" ")>-1)r=r.replace(" "+o+" "," ");i!==(u=ot(r))&&n.setAttribute("class",u)}return this},toggleClass:function(e,t){var n=typeof e,r="string"===n||Array.isArray(e);return"boolean"==typeof t&&r?t?this.addClass(e):this.removeClass(e):g(e)?this.each(function(n){w(this).toggleClass(e.call(this,n,at(this),t),t)}):this.each(function(){var t,i,o,a;if(r){i=0,o=w(this),a=ut(e);while(t=a[i++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else void 0!==e&&"boolean"!==n||((t=at(this))&&K.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":K.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(1===n.nodeType&&(" "+ot(at(n))+" ").indexOf(t)>-1)return!0;return!1}});var st=/\r/g;w.fn.extend({val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=g(e),this.each(function(n){var i;1===this.nodeType&&(null==(i=r?e.call(this,n,w(this).val()):e)?i="":"number"==typeof i?i+="":Array.isArray(i)&&(i=w.map(i,function(e){return null==e?"":e+""})),(t=w.valHooks[this.type]||w.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))});if(i)return(t=w.valHooks[i.type]||w.valHooks[i.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:"string"==typeof(n=i.value)?n.replace(st,""):null==n?"":n}}}),w.extend({valHooks:{option:{get:function(e){var t=w.find.attr(e,"value");return null!=t?t:ot(w.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,u=a?null:[],s=a?o+1:i.length;for(r=o<0?s:a?o:0;r<s;r++)if(((n=i[r]).selected||r===o)&&!n.disabled&&(!n.parentNode.disabled||!D(n.parentNode,"optgroup"))){if(t=w(n).val(),a)return t;u.push(t)}return u},set:function(e,t){var n,r,i=e.options,o=w.makeArray(t),a=i.length;while(a--)((r=i[a]).selected=w.inArray(w.valHooks.option.get(r),o)>-1)&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),w.each(["radio","checkbox"],function(){w.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=w.inArray(w(e).val(),t)>-1}},h.checkOn||(w.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),h.focusin="onfocusin"in e;var lt=/^(?:focusinfocus|focusoutblur)$/,ct=function(e){e.stopPropagation()};w.extend(w.event,{trigger:function(t,n,i,o){var a,u,s,l,c,d,p,h,y=[i||r],m=f.call(t,"type")?t.type:t,b=f.call(t,"namespace")?t.namespace.split("."):[];if(u=h=s=i=i||r,3!==i.nodeType&&8!==i.nodeType&&!lt.test(m+w.event.triggered)&&(m.indexOf(".")>-1&&(m=(b=m.split(".")).shift(),b.sort()),c=m.indexOf(":")<0&&"on"+m,t=t[w.expando]?t:new w.Event(m,"object"==typeof t&&t),t.isTrigger=o?2:3,t.namespace=b.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+b.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=i),n=null==n?[t]:w.makeArray(n,[t]),p=w.event.special[m]||{},o||!p.trigger||!1!==p.trigger.apply(i,n))){if(!o&&!p.noBubble&&!v(i)){for(l=p.delegateType||m,lt.test(l+m)||(u=u.parentNode);u;u=u.parentNode)y.push(u),s=u;s===(i.ownerDocument||r)&&y.push(s.defaultView||s.parentWindow||e)}a=0;while((u=y[a++])&&!t.isPropagationStopped())h=u,t.type=a>1?l:p.bindType||m,(d=(K.get(u,"events")||{})[t.type]&&K.get(u,"handle"))&&d.apply(u,n),(d=c&&u[c])&&d.apply&&Y(u)&&(t.result=d.apply(u,n),!1===t.result&&t.preventDefault());return t.type=m,o||t.isDefaultPrevented()||p._default&&!1!==p._default.apply(y.pop(),n)||!Y(i)||c&&g(i[m])&&!v(i)&&((s=i[c])&&(i[c]=null),w.event.triggered=m,t.isPropagationStopped()&&h.addEventListener(m,ct),i[m](),t.isPropagationStopped()&&h.removeEventListener(m,ct),w.event.triggered=void 0,s&&(i[c]=s)),t.result}},simulate:function(e,t,n){var r=w.extend(new w.Event,n,{type:e,isSimulated:!0});w.event.trigger(r,null,t)}}),w.fn.extend({trigger:function(e,t){return this.each(function(){w.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return w.event.trigger(e,t,n,!0)}}),h.focusin||w.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){w.event.simulate(t,e.target,w.event.fix(e))};w.event.special[t]={setup:function(){var r=this.ownerDocument||this,i=K.access(r,t);i||r.addEventListener(e,n,!0),K.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=K.access(r,t)-1;i?K.access(r,t,i):(r.removeEventListener(e,n,!0),K.remove(r,t))}}});var ft=/\[\]$/,dt=/\r?\n/g,pt=/^(?:submit|button|image|reset|file)$/i,ht=/^(?:input|select|textarea|keygen)/i;function gt(e,t,n,r){var i;if(Array.isArray(t))w.each(t,function(t,i){n||ft.test(e)?r(e,i):gt(e+"["+("object"==typeof i&&null!=i?t:"")+"]",i,n,r)});else if(n||"object"!==b(t))r(e,t);else for(i in t)gt(e+"["+i+"]",t[i],n,r)}w.param=function(e,t){var n,r=[],i=function(e,t){var n=g(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(Array.isArray(e)||e.jquery&&!w.isPlainObject(e))w.each(e,function(){i(this.name,this.value)});else for(n in e)gt(n,e[n],t,i);return r.join("&")},w.fn.extend({serialize:function(){return w.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=w.prop(this,"elements");return e?w.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!w(this).is(":disabled")&&ht.test(this.nodeName)&&!pt.test(e)&&(this.checked||!de.test(e))}).map(function(e,t){var n=w(this).val();return null==n?null:Array.isArray(n)?w.map(n,function(e){return{name:t.name,value:e.replace(dt,"\r\n")}}):{name:t.name,value:n.replace(dt,"\r\n")}}).get()}}),w.fn.extend({wrapAll:function(e){var t;return this[0]&&(g(e)&&(e=e.call(this[0])),t=w(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(e){return g(e)?this.each(function(t){w(this).wrapInner(e.call(this,t))}):this.each(function(){var t=w(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=g(e);return this.each(function(n){w(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){w(this).replaceWith(this.childNodes)}),this}}),w.expr.pseudos.hidden=function(e){return!w.expr.pseudos.visible(e)},w.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},h.createHTMLDocument=function(){var e=r.implementation.createHTMLDocument("").body;return e.innerHTML="<form></form><form></form>",2===e.childNodes.length}(),w.parseHTML=function(e,t,n){if("string"!=typeof e)return[];"boolean"==typeof t&&(n=t,t=!1);var i,o,a;return t||(h.createHTMLDocument?((i=(t=r.implementation.createHTMLDocument("")).createElement("base")).href=r.location.href,t.head.appendChild(i)):t=r),o=S.exec(e),a=!n&&[],o?[t.createElement(o[1])]:(o=be([e],t,a),a&&a.length&&w(a).remove(),w.merge([],o.childNodes))},w.offset={setOffset:function(e,t,n){var r,i,o,a,u,s,l,c=w.css(e,"position"),f=w(e),d={};"static"===c&&(e.style.position="relative"),u=f.offset(),o=w.css(e,"top"),s=w.css(e,"left"),(l=("absolute"===c||"fixed"===c)&&(o+s).indexOf("auto")>-1)?(a=(r=f.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(s)||0),g(t)&&(t=t.call(e,n,w.extend({},u))),null!=t.top&&(d.top=t.top-u.top+a),null!=t.left&&(d.left=t.left-u.left+i),"using"in t?t.using.call(e,d):f.css(d)}},w.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each(function(t){w.offset.setOffset(this,e,t)});var t,n,r=this[0];if(r)return r.getClientRects().length?(t=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:t.top+n.pageYOffset,left:t.left+n.pageXOffset}):{top:0,left:0}},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===w.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===w.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=w(e).offset()).top+=w.css(e,"borderTopWidth",!0),i.left+=w.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-w.css(r,"marginTop",!0),left:t.left-i.left-w.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===w.css(e,"position"))e=e.offsetParent;return e||xe})}}),w.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var n="pageYOffset"===t;w.fn[e]=function(r){return _(this,function(e,r,i){var o;if(v(e)?o=e:9===e.nodeType&&(o=e.defaultView),void 0===i)return o?o[t]:e[r];o?o.scrollTo(n?o.pageXOffset:i,n?i:o.pageYOffset):e[r]=i},e,r,arguments.length)}}),w.each(["top","left"],function(e,t){w.cssHooks[t]=ze(h.pixelPosition,function(e,n){if(n)return n=Fe(e,t),Me.test(n)?w(e).position()[t]+"px":n})}),w.each({Height:"height",Width:"width"},function(e,t){w.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){w.fn[r]=function(i,o){var a=arguments.length&&(n||"boolean"!=typeof i),u=n||(!0===i||!0===o?"margin":"border");return _(this,function(t,n,i){var o;return v(t)?0===r.indexOf("outer")?t["inner"+e]:t.document.documentElement["client"+e]:9===t.nodeType?(o=t.documentElement,Math.max(t.body["scroll"+e],o["scroll"+e],t.body["offset"+e],o["offset"+e],o["client"+e])):void 0===i?w.css(t,n,u):w.style(t,n,i,u)},t,a?i:void 0,a)}})}),w.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,t){w.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),w.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),w.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}}),w.proxy=function(e,t){var n,r,i;if("string"==typeof t&&(n=e[t],t=e,e=n),g(e))return r=o.call(arguments,2),i=function(){return e.apply(t||this,r.concat(o.call(arguments)))},i.guid=e.guid=e.guid||w.guid++,i},w.holdReady=function(e){e?w.readyWait++:w.ready(!0)},w.isArray=Array.isArray,w.parseJSON=JSON.parse,w.nodeName=D,w.isFunction=g,w.isWindow=v,w.camelCase=Q,w.type=b,w.now=Date.now,w.isNumeric=function(e){var t=w.type(e);return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))},"function"==typeof define&&define.amd&&define("jquery",[],function(){return w});var vt=e.jQuery,yt=e.$;return w.noConflict=function(t){return e.$===w&&(e.$=yt),t&&e.jQuery===w&&(e.jQuery=vt),w},t||(e.jQuery=e.$=w),w}); diff --git a/static_common/common/vendor/jquery/jquery-3.6.3.js b/static_common/common/vendor/jquery/jquery-3.6.3.js new file mode 100644 index 00000000..b86de89a --- /dev/null +++ b/static_common/common/vendor/jquery/jquery-3.6.3.js @@ -0,0 +1,10993 @@ +/*! + * jQuery JavaScript Library v3.6.3 + * https://jquery.com/ + * + * Includes Sizzle.js + * https://sizzlejs.com/ + * + * Copyright OpenJS Foundation and other contributors + * Released under the MIT license + * https://jquery.org/license + * + * Date: 2022-12-20T21:28Z + */ +( function( global, factory ) { + + "use strict"; + + if ( typeof module === "object" && typeof module.exports === "object" ) { + + // For CommonJS and CommonJS-like environments where a proper `window` + // is present, execute the factory and get jQuery. + // For environments that do not have a `window` with a `document` + // (such as Node.js), expose a factory as module.exports. + // This accentuates the need for the creation of a real `window`. + // e.g. var jQuery = require("jquery")(window); + // See ticket trac-14549 for more info. + module.exports = global.document ? + factory( global, true ) : + function( w ) { + if ( !w.document ) { + throw new Error( "jQuery requires a window with a document" ); + } + return factory( w ); + }; + } else { + factory( global ); + } + +// Pass this if window is not defined yet +} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { + +// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 +// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode +// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common +// enough that all such attempts are guarded in a try block. +"use strict"; + +var arr = []; + +var getProto = Object.getPrototypeOf; + +var slice = arr.slice; + +var flat = arr.flat ? function( array ) { + return arr.flat.call( array ); +} : function( array ) { + return arr.concat.apply( [], array ); +}; + + +var push = arr.push; + +var indexOf = arr.indexOf; + +var class2type = {}; + +var toString = class2type.toString; + +var hasOwn = class2type.hasOwnProperty; + +var fnToString = hasOwn.toString; + +var ObjectFunctionString = fnToString.call( Object ); + +var support = {}; + +var isFunction = function isFunction( obj ) { + + // Support: Chrome <=57, Firefox <=52 + // In some browsers, typeof returns "function" for HTML <object> elements + // (i.e., `typeof document.createElement( "object" ) === "function"`). + // We don't want to classify *any* DOM node as a function. + // Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5 + // Plus for old WebKit, typeof returns "function" for HTML collections + // (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756) + return typeof obj === "function" && typeof obj.nodeType !== "number" && + typeof obj.item !== "function"; + }; + + +var isWindow = function isWindow( obj ) { + return obj != null && obj === obj.window; + }; + + +var document = window.document; + + + + var preservedScriptAttributes = { + type: true, + src: true, + nonce: true, + noModule: true + }; + + function DOMEval( code, node, doc ) { + doc = doc || document; + + var i, val, + script = doc.createElement( "script" ); + + script.text = code; + if ( node ) { + for ( i in preservedScriptAttributes ) { + + // Support: Firefox 64+, Edge 18+ + // Some browsers don't support the "nonce" property on scripts. + // On the other hand, just using `getAttribute` is not enough as + // the `nonce` attribute is reset to an empty string whenever it + // becomes browsing-context connected. + // See https://github.com/whatwg/html/issues/2369 + // See https://html.spec.whatwg.org/#nonce-attributes + // The `node.getAttribute` check was added for the sake of + // `jQuery.globalEval` so that it can fake a nonce-containing node + // via an object. + val = node[ i ] || node.getAttribute && node.getAttribute( i ); + if ( val ) { + script.setAttribute( i, val ); + } + } + } + doc.head.appendChild( script ).parentNode.removeChild( script ); + } + + +function toType( obj ) { + if ( obj == null ) { + return obj + ""; + } + + // Support: Android <=2.3 only (functionish RegExp) + return typeof obj === "object" || typeof obj === "function" ? + class2type[ toString.call( obj ) ] || "object" : + typeof obj; +} +/* global Symbol */ +// Defining this global in .eslintrc.json would create a danger of using the global +// unguarded in another place, it seems safer to define global only for this module + + + +var + version = "3.6.3", + + // Define a local copy of jQuery + jQuery = function( selector, context ) { + + // The jQuery object is actually just the init constructor 'enhanced' + // Need init if jQuery is called (just allow error to be thrown if not included) + return new jQuery.fn.init( selector, context ); + }; + +jQuery.fn = jQuery.prototype = { + + // The current version of jQuery being used + jquery: version, + + constructor: jQuery, + + // The default length of a jQuery object is 0 + length: 0, + + toArray: function() { + return slice.call( this ); + }, + + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + + // Return all the elements in a clean array + if ( num == null ) { + return slice.call( this ); + } + + // Return just the one element from the set + return num < 0 ? this[ num + this.length ] : this[ num ]; + }, + + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems ) { + + // Build a new jQuery matched element set + var ret = jQuery.merge( this.constructor(), elems ); + + // Add the old object onto the stack (as a reference) + ret.prevObject = this; + + // Return the newly-formed element set + return ret; + }, + + // Execute a callback for every element in the matched set. + each: function( callback ) { + return jQuery.each( this, callback ); + }, + + map: function( callback ) { + return this.pushStack( jQuery.map( this, function( elem, i ) { + return callback.call( elem, i, elem ); + } ) ); + }, + + slice: function() { + return this.pushStack( slice.apply( this, arguments ) ); + }, + + first: function() { + return this.eq( 0 ); + }, + + last: function() { + return this.eq( -1 ); + }, + + even: function() { + return this.pushStack( jQuery.grep( this, function( _elem, i ) { + return ( i + 1 ) % 2; + } ) ); + }, + + odd: function() { + return this.pushStack( jQuery.grep( this, function( _elem, i ) { + return i % 2; + } ) ); + }, + + eq: function( i ) { + var len = this.length, + j = +i + ( i < 0 ? len : 0 ); + return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); + }, + + end: function() { + return this.prevObject || this.constructor(); + }, + + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: push, + sort: arr.sort, + splice: arr.splice +}; + +jQuery.extend = jQuery.fn.extend = function() { + var options, name, src, copy, copyIsArray, clone, + target = arguments[ 0 ] || {}, + i = 1, + length = arguments.length, + deep = false; + + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + + // Skip the boolean and the target + target = arguments[ i ] || {}; + i++; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !isFunction( target ) ) { + target = {}; + } + + // Extend jQuery itself if only one argument is passed + if ( i === length ) { + target = this; + i--; + } + + for ( ; i < length; i++ ) { + + // Only deal with non-null/undefined values + if ( ( options = arguments[ i ] ) != null ) { + + // Extend the base object + for ( name in options ) { + copy = options[ name ]; + + // Prevent Object.prototype pollution + // Prevent never-ending loop + if ( name === "__proto__" || target === copy ) { + continue; + } + + // Recurse if we're merging plain objects or arrays + if ( deep && copy && ( jQuery.isPlainObject( copy ) || + ( copyIsArray = Array.isArray( copy ) ) ) ) { + src = target[ name ]; + + // Ensure proper type for the source value + if ( copyIsArray && !Array.isArray( src ) ) { + clone = []; + } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) { + clone = {}; + } else { + clone = src; + } + copyIsArray = false; + + // Never move original objects, clone them + target[ name ] = jQuery.extend( deep, clone, copy ); + + // Don't bring in undefined values + } else if ( copy !== undefined ) { + target[ name ] = copy; + } + } + } + } + + // Return the modified object + return target; +}; + +jQuery.extend( { + + // Unique for each copy of jQuery on the page + expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), + + // Assume jQuery is ready without the ready module + isReady: true, + + error: function( msg ) { + throw new Error( msg ); + }, + + noop: function() {}, + + isPlainObject: function( obj ) { + var proto, Ctor; + + // Detect obvious negatives + // Use toString instead of jQuery.type to catch host objects + if ( !obj || toString.call( obj ) !== "[object Object]" ) { + return false; + } + + proto = getProto( obj ); + + // Objects with no prototype (e.g., `Object.create( null )`) are plain + if ( !proto ) { + return true; + } + + // Objects with prototype are plain iff they were constructed by a global Object function + Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; + return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; + }, + + isEmptyObject: function( obj ) { + var name; + + for ( name in obj ) { + return false; + } + return true; + }, + + // Evaluates a script in a provided context; falls back to the global one + // if not specified. + globalEval: function( code, options, doc ) { + DOMEval( code, { nonce: options && options.nonce }, doc ); + }, + + each: function( obj, callback ) { + var length, i = 0; + + if ( isArrayLike( obj ) ) { + length = obj.length; + for ( ; i < length; i++ ) { + if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { + break; + } + } + } else { + for ( i in obj ) { + if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { + break; + } + } + } + + return obj; + }, + + // results is for internal usage only + makeArray: function( arr, results ) { + var ret = results || []; + + if ( arr != null ) { + if ( isArrayLike( Object( arr ) ) ) { + jQuery.merge( ret, + typeof arr === "string" ? + [ arr ] : arr + ); + } else { + push.call( ret, arr ); + } + } + + return ret; + }, + + inArray: function( elem, arr, i ) { + return arr == null ? -1 : indexOf.call( arr, elem, i ); + }, + + // Support: Android <=4.0 only, PhantomJS 1 only + // push.apply(_, arraylike) throws on ancient WebKit + merge: function( first, second ) { + var len = +second.length, + j = 0, + i = first.length; + + for ( ; j < len; j++ ) { + first[ i++ ] = second[ j ]; + } + + first.length = i; + + return first; + }, + + grep: function( elems, callback, invert ) { + var callbackInverse, + matches = [], + i = 0, + length = elems.length, + callbackExpect = !invert; + + // Go through the array, only saving the items + // that pass the validator function + for ( ; i < length; i++ ) { + callbackInverse = !callback( elems[ i ], i ); + if ( callbackInverse !== callbackExpect ) { + matches.push( elems[ i ] ); + } + } + + return matches; + }, + + // arg is for internal usage only + map: function( elems, callback, arg ) { + var length, value, + i = 0, + ret = []; + + // Go through the array, translating each of the items to their new values + if ( isArrayLike( elems ) ) { + length = elems.length; + for ( ; i < length; i++ ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret.push( value ); + } + } + + // Go through every key on the object, + } else { + for ( i in elems ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret.push( value ); + } + } + } + + // Flatten any nested arrays + return flat( ret ); + }, + + // A global GUID counter for objects + guid: 1, + + // jQuery.support is not used in Core but other projects attach their + // properties to it so it needs to exist. + support: support +} ); + +if ( typeof Symbol === "function" ) { + jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; +} + +// Populate the class2type map +jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), + function( _i, name ) { + class2type[ "[object " + name + "]" ] = name.toLowerCase(); + } ); + +function isArrayLike( obj ) { + + // Support: real iOS 8.2 only (not reproducible in simulator) + // `in` check used to prevent JIT error (gh-2145) + // hasOwn isn't used here due to false negatives + // regarding Nodelist length in IE + var length = !!obj && "length" in obj && obj.length, + type = toType( obj ); + + if ( isFunction( obj ) || isWindow( obj ) ) { + return false; + } + + return type === "array" || length === 0 || + typeof length === "number" && length > 0 && ( length - 1 ) in obj; +} +var Sizzle = +/*! + * Sizzle CSS Selector Engine v2.3.9 + * https://sizzlejs.com/ + * + * Copyright JS Foundation and other contributors + * Released under the MIT license + * https://js.foundation/ + * + * Date: 2022-12-19 + */ +( function( window ) { +var i, + support, + Expr, + getText, + isXML, + tokenize, + compile, + select, + outermostContext, + sortInput, + hasDuplicate, + + // Local document vars + setDocument, + document, + docElem, + documentIsHTML, + rbuggyQSA, + rbuggyMatches, + matches, + contains, + + // Instance-specific data + expando = "sizzle" + 1 * new Date(), + preferredDoc = window.document, + dirruns = 0, + done = 0, + classCache = createCache(), + tokenCache = createCache(), + compilerCache = createCache(), + nonnativeSelectorCache = createCache(), + sortOrder = function( a, b ) { + if ( a === b ) { + hasDuplicate = true; + } + return 0; + }, + + // Instance methods + hasOwn = ( {} ).hasOwnProperty, + arr = [], + pop = arr.pop, + pushNative = arr.push, + push = arr.push, + slice = arr.slice, + + // Use a stripped-down indexOf as it's faster than native + // https://jsperf.com/thor-indexof-vs-for/5 + indexOf = function( list, elem ) { + var i = 0, + len = list.length; + for ( ; i < len; i++ ) { + if ( list[ i ] === elem ) { + return i; + } + } + return -1; + }, + + booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|" + + "ismap|loop|multiple|open|readonly|required|scoped", + + // Regular expressions + + // http://www.w3.org/TR/css3-selectors/#whitespace + whitespace = "[\\x20\\t\\r\\n\\f]", + + // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram + identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + + "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", + + // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors + attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + + + // Operator (capture 2) + "*([*^$|!~]?=)" + whitespace + + + // "Attribute values must be CSS identifiers [capture 5] + // or strings [capture 3 or capture 4]" + "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + + whitespace + "*\\]", + + pseudos = ":(" + identifier + ")(?:\\((" + + + // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: + // 1. quoted (capture 3; capture 4 or capture 5) + "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + + + // 2. simple (capture 6) + "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + + + // 3. anything else (capture 2) + ".*" + + ")\\)|)", + + // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter + rwhitespace = new RegExp( whitespace + "+", "g" ), + rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + + whitespace + "+$", "g" ), + + rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), + rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + + "*" ), + rdescend = new RegExp( whitespace + "|>" ), + + rpseudo = new RegExp( pseudos ), + ridentifier = new RegExp( "^" + identifier + "$" ), + + matchExpr = { + "ID": new RegExp( "^#(" + identifier + ")" ), + "CLASS": new RegExp( "^\\.(" + identifier + ")" ), + "TAG": new RegExp( "^(" + identifier + "|[*])" ), + "ATTR": new RegExp( "^" + attributes ), + "PSEUDO": new RegExp( "^" + pseudos ), + "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), + "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), + + // For use in libraries implementing .is() + // We use this for POS matching in `select` + "needsContext": new RegExp( "^" + whitespace + + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) + }, + + rhtml = /HTML$/i, + rinputs = /^(?:input|select|textarea|button)$/i, + rheader = /^h\d$/i, + + rnative = /^[^{]+\{\s*\[native \w/, + + // Easily-parseable/retrievable ID or TAG or CLASS selectors + rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, + + rsibling = /[+~]/, + + // CSS escapes + // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters + runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g" ), + funescape = function( escape, nonHex ) { + var high = "0x" + escape.slice( 1 ) - 0x10000; + + return nonHex ? + + // Strip the backslash prefix from a non-hex escape sequence + nonHex : + + // Replace a hexadecimal escape sequence with the encoded Unicode code point + // Support: IE <=11+ + // For values outside the Basic Multilingual Plane (BMP), manually construct a + // surrogate pair + high < 0 ? + String.fromCharCode( high + 0x10000 ) : + String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); + }, + + // CSS string/identifier serialization + // https://drafts.csswg.org/cssom/#common-serializing-idioms + rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, + fcssescape = function( ch, asCodePoint ) { + if ( asCodePoint ) { + + // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER + if ( ch === "\0" ) { + return "\uFFFD"; + } + + // Control characters and (dependent upon position) numbers get escaped as code points + return ch.slice( 0, -1 ) + "\\" + + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; + } + + // Other potentially-special ASCII characters get backslash-escaped + return "\\" + ch; + }, + + // Used for iframes + // See setDocument() + // Removing the function wrapper causes a "Permission Denied" + // error in IE + unloadHandler = function() { + setDocument(); + }, + + inDisabledFieldset = addCombinator( + function( elem ) { + return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset"; + }, + { dir: "parentNode", next: "legend" } + ); + +// Optimize for push.apply( _, NodeList ) +try { + push.apply( + ( arr = slice.call( preferredDoc.childNodes ) ), + preferredDoc.childNodes + ); + + // Support: Android<4.0 + // Detect silently failing push.apply + // eslint-disable-next-line no-unused-expressions + arr[ preferredDoc.childNodes.length ].nodeType; +} catch ( e ) { + push = { apply: arr.length ? + + // Leverage slice if possible + function( target, els ) { + pushNative.apply( target, slice.call( els ) ); + } : + + // Support: IE<9 + // Otherwise append directly + function( target, els ) { + var j = target.length, + i = 0; + + // Can't trust NodeList.length + while ( ( target[ j++ ] = els[ i++ ] ) ) {} + target.length = j - 1; + } + }; +} + +function Sizzle( selector, context, results, seed ) { + var m, i, elem, nid, match, groups, newSelector, + newContext = context && context.ownerDocument, + + // nodeType defaults to 9, since context defaults to document + nodeType = context ? context.nodeType : 9; + + results = results || []; + + // Return early from calls with invalid selector or context + if ( typeof selector !== "string" || !selector || + nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { + + return results; + } + + // Try to shortcut find operations (as opposed to filters) in HTML documents + if ( !seed ) { + setDocument( context ); + context = context || document; + + if ( documentIsHTML ) { + + // If the selector is sufficiently simple, try using a "get*By*" DOM method + // (excepting DocumentFragment context, where the methods don't exist) + if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) { + + // ID selector + if ( ( m = match[ 1 ] ) ) { + + // Document context + if ( nodeType === 9 ) { + if ( ( elem = context.getElementById( m ) ) ) { + + // Support: IE, Opera, Webkit + // TODO: identify versions + // getElementById can match elements by name instead of ID + if ( elem.id === m ) { + results.push( elem ); + return results; + } + } else { + return results; + } + + // Element context + } else { + + // Support: IE, Opera, Webkit + // TODO: identify versions + // getElementById can match elements by name instead of ID + if ( newContext && ( elem = newContext.getElementById( m ) ) && + contains( context, elem ) && + elem.id === m ) { + + results.push( elem ); + return results; + } + } + + // Type selector + } else if ( match[ 2 ] ) { + push.apply( results, context.getElementsByTagName( selector ) ); + return results; + + // Class selector + } else if ( ( m = match[ 3 ] ) && support.getElementsByClassName && + context.getElementsByClassName ) { + + push.apply( results, context.getElementsByClassName( m ) ); + return results; + } + } + + // Take advantage of querySelectorAll + if ( support.qsa && + !nonnativeSelectorCache[ selector + " " ] && + ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) && + + // Support: IE 8 only + // Exclude object elements + ( nodeType !== 1 || context.nodeName.toLowerCase() !== "object" ) ) { + + newSelector = selector; + newContext = context; + + // qSA considers elements outside a scoping root when evaluating child or + // descendant combinators, which is not what we want. + // In such cases, we work around the behavior by prefixing every selector in the + // list with an ID selector referencing the scope context. + // The technique has to be used as well when a leading combinator is used + // as such selectors are not recognized by querySelectorAll. + // Thanks to Andrew Dupont for this technique. + if ( nodeType === 1 && + ( rdescend.test( selector ) || rcombinators.test( selector ) ) ) { + + // Expand context for sibling selectors + newContext = rsibling.test( selector ) && testContext( context.parentNode ) || + context; + + // We can use :scope instead of the ID hack if the browser + // supports it & if we're not changing the context. + if ( newContext !== context || !support.scope ) { + + // Capture the context ID, setting it first if necessary + if ( ( nid = context.getAttribute( "id" ) ) ) { + nid = nid.replace( rcssescape, fcssescape ); + } else { + context.setAttribute( "id", ( nid = expando ) ); + } + } + + // Prefix every selector in the list + groups = tokenize( selector ); + i = groups.length; + while ( i-- ) { + groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " + + toSelector( groups[ i ] ); + } + newSelector = groups.join( "," ); + } + + try { + + // `qSA` may not throw for unrecognized parts using forgiving parsing: + // https://drafts.csswg.org/selectors/#forgiving-selector + // like the `:has()` pseudo-class: + // https://drafts.csswg.org/selectors/#relational + // `CSS.supports` is still expected to return `false` then: + // https://drafts.csswg.org/css-conditional-4/#typedef-supports-selector-fn + // https://drafts.csswg.org/css-conditional-4/#dfn-support-selector + if ( support.cssSupportsSelector && + + // eslint-disable-next-line no-undef + !CSS.supports( "selector(:is(" + newSelector + "))" ) ) { + + // Support: IE 11+ + // Throw to get to the same code path as an error directly in qSA. + // Note: once we only support browser supporting + // `CSS.supports('selector(...)')`, we can most likely drop + // the `try-catch`. IE doesn't implement the API. + throw new Error(); + } + + push.apply( results, + newContext.querySelectorAll( newSelector ) + ); + return results; + } catch ( qsaError ) { + nonnativeSelectorCache( selector, true ); + } finally { + if ( nid === expando ) { + context.removeAttribute( "id" ); + } + } + } + } + } + + // All others + return select( selector.replace( rtrim, "$1" ), context, results, seed ); +} + +/** + * Create key-value caches of limited size + * @returns {function(string, object)} Returns the Object data after storing it on itself with + * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) + * deleting the oldest entry + */ +function createCache() { + var keys = []; + + function cache( key, value ) { + + // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) + if ( keys.push( key + " " ) > Expr.cacheLength ) { + + // Only keep the most recent entries + delete cache[ keys.shift() ]; + } + return ( cache[ key + " " ] = value ); + } + return cache; +} + +/** + * Mark a function for special use by Sizzle + * @param {Function} fn The function to mark + */ +function markFunction( fn ) { + fn[ expando ] = true; + return fn; +} + +/** + * Support testing using an element + * @param {Function} fn Passed the created element and returns a boolean result + */ +function assert( fn ) { + var el = document.createElement( "fieldset" ); + + try { + return !!fn( el ); + } catch ( e ) { + return false; + } finally { + + // Remove from its parent by default + if ( el.parentNode ) { + el.parentNode.removeChild( el ); + } + + // release memory in IE + el = null; + } +} + +/** + * Adds the same handler for all of the specified attrs + * @param {String} attrs Pipe-separated list of attributes + * @param {Function} handler The method that will be applied + */ +function addHandle( attrs, handler ) { + var arr = attrs.split( "|" ), + i = arr.length; + + while ( i-- ) { + Expr.attrHandle[ arr[ i ] ] = handler; + } +} + +/** + * Checks document order of two siblings + * @param {Element} a + * @param {Element} b + * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b + */ +function siblingCheck( a, b ) { + var cur = b && a, + diff = cur && a.nodeType === 1 && b.nodeType === 1 && + a.sourceIndex - b.sourceIndex; + + // Use IE sourceIndex if available on both nodes + if ( diff ) { + return diff; + } + + // Check if b follows a + if ( cur ) { + while ( ( cur = cur.nextSibling ) ) { + if ( cur === b ) { + return -1; + } + } + } + + return a ? 1 : -1; +} + +/** + * Returns a function to use in pseudos for input types + * @param {String} type + */ +function createInputPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for buttons + * @param {String} type + */ +function createButtonPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return ( name === "input" || name === "button" ) && elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for :enabled/:disabled + * @param {Boolean} disabled true for :disabled; false for :enabled + */ +function createDisabledPseudo( disabled ) { + + // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable + return function( elem ) { + + // Only certain elements can match :enabled or :disabled + // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled + // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled + if ( "form" in elem ) { + + // Check for inherited disabledness on relevant non-disabled elements: + // * listed form-associated elements in a disabled fieldset + // https://html.spec.whatwg.org/multipage/forms.html#category-listed + // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled + // * option elements in a disabled optgroup + // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled + // All such elements have a "form" property. + if ( elem.parentNode && elem.disabled === false ) { + + // Option elements defer to a parent optgroup if present + if ( "label" in elem ) { + if ( "label" in elem.parentNode ) { + return elem.parentNode.disabled === disabled; + } else { + return elem.disabled === disabled; + } + } + + // Support: IE 6 - 11 + // Use the isDisabled shortcut property to check for disabled fieldset ancestors + return elem.isDisabled === disabled || + + // Where there is no isDisabled, check manually + /* jshint -W018 */ + elem.isDisabled !== !disabled && + inDisabledFieldset( elem ) === disabled; + } + + return elem.disabled === disabled; + + // Try to winnow out elements that can't be disabled before trusting the disabled property. + // Some victims get caught in our net (label, legend, menu, track), but it shouldn't + // even exist on them, let alone have a boolean value. + } else if ( "label" in elem ) { + return elem.disabled === disabled; + } + + // Remaining elements are neither :enabled nor :disabled + return false; + }; +} + +/** + * Returns a function to use in pseudos for positionals + * @param {Function} fn + */ +function createPositionalPseudo( fn ) { + return markFunction( function( argument ) { + argument = +argument; + return markFunction( function( seed, matches ) { + var j, + matchIndexes = fn( [], seed.length, argument ), + i = matchIndexes.length; + + // Match elements found at the specified indexes + while ( i-- ) { + if ( seed[ ( j = matchIndexes[ i ] ) ] ) { + seed[ j ] = !( matches[ j ] = seed[ j ] ); + } + } + } ); + } ); +} + +/** + * Checks a node for validity as a Sizzle context + * @param {Element|Object=} context + * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value + */ +function testContext( context ) { + return context && typeof context.getElementsByTagName !== "undefined" && context; +} + +// Expose support vars for convenience +support = Sizzle.support = {}; + +/** + * Detects XML nodes + * @param {Element|Object} elem An element or a document + * @returns {Boolean} True iff elem is a non-HTML XML node + */ +isXML = Sizzle.isXML = function( elem ) { + var namespace = elem && elem.namespaceURI, + docElem = elem && ( elem.ownerDocument || elem ).documentElement; + + // Support: IE <=8 + // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes + // https://bugs.jquery.com/ticket/4833 + return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" ); +}; + +/** + * Sets document-related variables once based on the current document + * @param {Element|Object} [doc] An element or document object to use to set the document + * @returns {Object} Returns the current document + */ +setDocument = Sizzle.setDocument = function( node ) { + var hasCompare, subWindow, + doc = node ? node.ownerDocument || node : preferredDoc; + + // Return early if doc is invalid or already selected + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // two documents; shallow comparisons work. + // eslint-disable-next-line eqeqeq + if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) { + return document; + } + + // Update global variables + document = doc; + docElem = document.documentElement; + documentIsHTML = !isXML( document ); + + // Support: IE 9 - 11+, Edge 12 - 18+ + // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // two documents; shallow comparisons work. + // eslint-disable-next-line eqeqeq + if ( preferredDoc != document && + ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { + + // Support: IE 11, Edge + if ( subWindow.addEventListener ) { + subWindow.addEventListener( "unload", unloadHandler, false ); + + // Support: IE 9 - 10 only + } else if ( subWindow.attachEvent ) { + subWindow.attachEvent( "onunload", unloadHandler ); + } + } + + // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only, + // Safari 4 - 5 only, Opera <=11.6 - 12.x only + // IE/Edge & older browsers don't support the :scope pseudo-class. + // Support: Safari 6.0 only + // Safari 6.0 supports :scope but it's an alias of :root there. + support.scope = assert( function( el ) { + docElem.appendChild( el ).appendChild( document.createElement( "div" ) ); + return typeof el.querySelectorAll !== "undefined" && + !el.querySelectorAll( ":scope fieldset div" ).length; + } ); + + // Support: Chrome 105+, Firefox 104+, Safari 15.4+ + // Make sure forgiving mode is not used in `CSS.supports( "selector(...)" )`. + // + // `:is()` uses a forgiving selector list as an argument and is widely + // implemented, so it's a good one to test against. + support.cssSupportsSelector = assert( function() { + /* eslint-disable no-undef */ + + return CSS.supports( "selector(*)" ) && + + // Support: Firefox 78-81 only + // In old Firefox, `:is()` didn't use forgiving parsing. In that case, + // fail this test as there's no selector to test against that. + // `CSS.supports` uses unforgiving parsing + document.querySelectorAll( ":is(:jqfake)" ) && + + // `*` is needed as Safari & newer Chrome implemented something in between + // for `:has()` - it throws in `qSA` if it only contains an unsupported + // argument but multiple ones, one of which is supported, are fine. + // We want to play safe in case `:is()` gets the same treatment. + !CSS.supports( "selector(:is(*,:jqfake))" ); + + /* eslint-enable */ + } ); + + /* Attributes + ---------------------------------------------------------------------- */ + + // Support: IE<8 + // Verify that getAttribute really returns attributes and not properties + // (excepting IE8 booleans) + support.attributes = assert( function( el ) { + el.className = "i"; + return !el.getAttribute( "className" ); + } ); + + /* getElement(s)By* + ---------------------------------------------------------------------- */ + + // Check if getElementsByTagName("*") returns only elements + support.getElementsByTagName = assert( function( el ) { + el.appendChild( document.createComment( "" ) ); + return !el.getElementsByTagName( "*" ).length; + } ); + + // Support: IE<9 + support.getElementsByClassName = rnative.test( document.getElementsByClassName ); + + // Support: IE<10 + // Check if getElementById returns elements by name + // The broken getElementById methods don't pick up programmatically-set names, + // so use a roundabout getElementsByName test + support.getById = assert( function( el ) { + docElem.appendChild( el ).id = expando; + return !document.getElementsByName || !document.getElementsByName( expando ).length; + } ); + + // ID filter and find + if ( support.getById ) { + Expr.filter[ "ID" ] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + return elem.getAttribute( "id" ) === attrId; + }; + }; + Expr.find[ "ID" ] = function( id, context ) { + if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { + var elem = context.getElementById( id ); + return elem ? [ elem ] : []; + } + }; + } else { + Expr.filter[ "ID" ] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + var node = typeof elem.getAttributeNode !== "undefined" && + elem.getAttributeNode( "id" ); + return node && node.value === attrId; + }; + }; + + // Support: IE 6 - 7 only + // getElementById is not reliable as a find shortcut + Expr.find[ "ID" ] = function( id, context ) { + if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { + var node, i, elems, + elem = context.getElementById( id ); + + if ( elem ) { + + // Verify the id attribute + node = elem.getAttributeNode( "id" ); + if ( node && node.value === id ) { + return [ elem ]; + } + + // Fall back on getElementsByName + elems = context.getElementsByName( id ); + i = 0; + while ( ( elem = elems[ i++ ] ) ) { + node = elem.getAttributeNode( "id" ); + if ( node && node.value === id ) { + return [ elem ]; + } + } + } + + return []; + } + }; + } + + // Tag + Expr.find[ "TAG" ] = support.getElementsByTagName ? + function( tag, context ) { + if ( typeof context.getElementsByTagName !== "undefined" ) { + return context.getElementsByTagName( tag ); + + // DocumentFragment nodes don't have gEBTN + } else if ( support.qsa ) { + return context.querySelectorAll( tag ); + } + } : + + function( tag, context ) { + var elem, + tmp = [], + i = 0, + + // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too + results = context.getElementsByTagName( tag ); + + // Filter out possible comments + if ( tag === "*" ) { + while ( ( elem = results[ i++ ] ) ) { + if ( elem.nodeType === 1 ) { + tmp.push( elem ); + } + } + + return tmp; + } + return results; + }; + + // Class + Expr.find[ "CLASS" ] = support.getElementsByClassName && function( className, context ) { + if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { + return context.getElementsByClassName( className ); + } + }; + + /* QSA/matchesSelector + ---------------------------------------------------------------------- */ + + // QSA and matchesSelector support + + // matchesSelector(:active) reports false when true (IE9/Opera 11.5) + rbuggyMatches = []; + + // qSa(:focus) reports false when true (Chrome 21) + // We allow this because of a bug in IE8/9 that throws an error + // whenever `document.activeElement` is accessed on an iframe + // So, we allow :focus to pass through QSA all the time to avoid the IE error + // See https://bugs.jquery.com/ticket/13378 + rbuggyQSA = []; + + if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) { + + // Build QSA regex + // Regex strategy adopted from Diego Perini + assert( function( el ) { + + var input; + + // Select is set to empty string on purpose + // This is to test IE's treatment of not explicitly + // setting a boolean content attribute, + // since its presence should be enough + // https://bugs.jquery.com/ticket/12359 + docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" + + "<select id='" + expando + "-\r\\' msallowcapture=''>" + + "<option selected=''></option></select>"; + + // Support: IE8, Opera 11-12.16 + // Nothing should be selected when empty strings follow ^= or $= or *= + // The test attribute must be unknown in Opera but "safe" for WinRT + // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section + if ( el.querySelectorAll( "[msallowcapture^='']" ).length ) { + rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); + } + + // Support: IE8 + // Boolean attributes and "value" are not treated correctly + if ( !el.querySelectorAll( "[selected]" ).length ) { + rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); + } + + // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ + if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { + rbuggyQSA.push( "~=" ); + } + + // Support: IE 11+, Edge 15 - 18+ + // IE 11/Edge don't find elements on a `[name='']` query in some cases. + // Adding a temporary attribute to the document before the selection works + // around the issue. + // Interestingly, IE 10 & older don't seem to have the issue. + input = document.createElement( "input" ); + input.setAttribute( "name", "" ); + el.appendChild( input ); + if ( !el.querySelectorAll( "[name='']" ).length ) { + rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" + + whitespace + "*(?:''|\"\")" ); + } + + // Webkit/Opera - :checked should return selected option elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + // IE8 throws error here and will not see later tests + if ( !el.querySelectorAll( ":checked" ).length ) { + rbuggyQSA.push( ":checked" ); + } + + // Support: Safari 8+, iOS 8+ + // https://bugs.webkit.org/show_bug.cgi?id=136851 + // In-page `selector#id sibling-combinator selector` fails + if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { + rbuggyQSA.push( ".#.+[+~]" ); + } + + // Support: Firefox <=3.6 - 5 only + // Old Firefox doesn't throw on a badly-escaped identifier. + el.querySelectorAll( "\\\f" ); + rbuggyQSA.push( "[\\r\\n\\f]" ); + } ); + + assert( function( el ) { + el.innerHTML = "<a href='' disabled='disabled'></a>" + + "<select disabled='disabled'><option/></select>"; + + // Support: Windows 8 Native Apps + // The type and name attributes are restricted during .innerHTML assignment + var input = document.createElement( "input" ); + input.setAttribute( "type", "hidden" ); + el.appendChild( input ).setAttribute( "name", "D" ); + + // Support: IE8 + // Enforce case-sensitivity of name attribute + if ( el.querySelectorAll( "[name=d]" ).length ) { + rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); + } + + // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) + // IE8 throws error here and will not see later tests + if ( el.querySelectorAll( ":enabled" ).length !== 2 ) { + rbuggyQSA.push( ":enabled", ":disabled" ); + } + + // Support: IE9-11+ + // IE's :disabled selector does not pick up the children of disabled fieldsets + docElem.appendChild( el ).disabled = true; + if ( el.querySelectorAll( ":disabled" ).length !== 2 ) { + rbuggyQSA.push( ":enabled", ":disabled" ); + } + + // Support: Opera 10 - 11 only + // Opera 10-11 does not throw on post-comma invalid pseudos + el.querySelectorAll( "*,:x" ); + rbuggyQSA.push( ",.*:" ); + } ); + } + + if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches || + docElem.webkitMatchesSelector || + docElem.mozMatchesSelector || + docElem.oMatchesSelector || + docElem.msMatchesSelector ) ) ) ) { + + assert( function( el ) { + + // Check to see if it's possible to do matchesSelector + // on a disconnected node (IE 9) + support.disconnectedMatch = matches.call( el, "*" ); + + // This should fail with an exception + // Gecko does not error, returns false instead + matches.call( el, "[s!='']:x" ); + rbuggyMatches.push( "!=", pseudos ); + } ); + } + + if ( !support.cssSupportsSelector ) { + + // Support: Chrome 105+, Safari 15.4+ + // `:has()` uses a forgiving selector list as an argument so our regular + // `try-catch` mechanism fails to catch `:has()` with arguments not supported + // natively like `:has(:contains("Foo"))`. Where supported & spec-compliant, + // we now use `CSS.supports("selector(:is(SELECTOR_TO_BE_TESTED))")`, but + // outside that we mark `:has` as buggy. + rbuggyQSA.push( ":has" ); + } + + rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); + rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join( "|" ) ); + + /* Contains + ---------------------------------------------------------------------- */ + hasCompare = rnative.test( docElem.compareDocumentPosition ); + + // Element contains another + // Purposefully self-exclusive + // As in, an element does not contain itself + contains = hasCompare || rnative.test( docElem.contains ) ? + function( a, b ) { + + // Support: IE <9 only + // IE doesn't have `contains` on `document` so we need to check for + // `documentElement` presence. + // We need to fall back to `a` when `documentElement` is missing + // as `ownerDocument` of elements within `<template/>` may have + // a null one - a default behavior of all modern browsers. + var adown = a.nodeType === 9 && a.documentElement || a, + bup = b && b.parentNode; + return a === bup || !!( bup && bup.nodeType === 1 && ( + adown.contains ? + adown.contains( bup ) : + a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 + ) ); + } : + function( a, b ) { + if ( b ) { + while ( ( b = b.parentNode ) ) { + if ( b === a ) { + return true; + } + } + } + return false; + }; + + /* Sorting + ---------------------------------------------------------------------- */ + + // Document order sorting + sortOrder = hasCompare ? + function( a, b ) { + + // Flag for duplicate removal + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + // Sort on method existence if only one input has compareDocumentPosition + var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; + if ( compare ) { + return compare; + } + + // Calculate position if both inputs belong to the same document + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // two documents; shallow comparisons work. + // eslint-disable-next-line eqeqeq + compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ? + a.compareDocumentPosition( b ) : + + // Otherwise we know they are disconnected + 1; + + // Disconnected nodes + if ( compare & 1 || + ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) { + + // Choose the first element that is related to our preferred document + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // two documents; shallow comparisons work. + // eslint-disable-next-line eqeqeq + if ( a == document || a.ownerDocument == preferredDoc && + contains( preferredDoc, a ) ) { + return -1; + } + + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // two documents; shallow comparisons work. + // eslint-disable-next-line eqeqeq + if ( b == document || b.ownerDocument == preferredDoc && + contains( preferredDoc, b ) ) { + return 1; + } + + // Maintain original order + return sortInput ? + ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : + 0; + } + + return compare & 4 ? -1 : 1; + } : + function( a, b ) { + + // Exit early if the nodes are identical + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + var cur, + i = 0, + aup = a.parentNode, + bup = b.parentNode, + ap = [ a ], + bp = [ b ]; + + // Parentless nodes are either documents or disconnected + if ( !aup || !bup ) { + + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // two documents; shallow comparisons work. + /* eslint-disable eqeqeq */ + return a == document ? -1 : + b == document ? 1 : + /* eslint-enable eqeqeq */ + aup ? -1 : + bup ? 1 : + sortInput ? + ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : + 0; + + // If the nodes are siblings, we can do a quick check + } else if ( aup === bup ) { + return siblingCheck( a, b ); + } + + // Otherwise we need full lists of their ancestors for comparison + cur = a; + while ( ( cur = cur.parentNode ) ) { + ap.unshift( cur ); + } + cur = b; + while ( ( cur = cur.parentNode ) ) { + bp.unshift( cur ); + } + + // Walk down the tree looking for a discrepancy + while ( ap[ i ] === bp[ i ] ) { + i++; + } + + return i ? + + // Do a sibling check if the nodes have a common ancestor + siblingCheck( ap[ i ], bp[ i ] ) : + + // Otherwise nodes in our document sort first + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // two documents; shallow comparisons work. + /* eslint-disable eqeqeq */ + ap[ i ] == preferredDoc ? -1 : + bp[ i ] == preferredDoc ? 1 : + /* eslint-enable eqeqeq */ + 0; + }; + + return document; +}; + +Sizzle.matches = function( expr, elements ) { + return Sizzle( expr, null, null, elements ); +}; + +Sizzle.matchesSelector = function( elem, expr ) { + setDocument( elem ); + + if ( support.matchesSelector && documentIsHTML && + !nonnativeSelectorCache[ expr + " " ] && + ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && + ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { + + try { + var ret = matches.call( elem, expr ); + + // IE 9's matchesSelector returns false on disconnected nodes + if ( ret || support.disconnectedMatch || + + // As well, disconnected nodes are said to be in a document + // fragment in IE 9 + elem.document && elem.document.nodeType !== 11 ) { + return ret; + } + } catch ( e ) { + nonnativeSelectorCache( expr, true ); + } + } + + return Sizzle( expr, document, null, [ elem ] ).length > 0; +}; + +Sizzle.contains = function( context, elem ) { + + // Set document vars if needed + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // two documents; shallow comparisons work. + // eslint-disable-next-line eqeqeq + if ( ( context.ownerDocument || context ) != document ) { + setDocument( context ); + } + return contains( context, elem ); +}; + +Sizzle.attr = function( elem, name ) { + + // Set document vars if needed + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // two documents; shallow comparisons work. + // eslint-disable-next-line eqeqeq + if ( ( elem.ownerDocument || elem ) != document ) { + setDocument( elem ); + } + + var fn = Expr.attrHandle[ name.toLowerCase() ], + + // Don't get fooled by Object.prototype properties (jQuery #13807) + val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? + fn( elem, name, !documentIsHTML ) : + undefined; + + return val !== undefined ? + val : + support.attributes || !documentIsHTML ? + elem.getAttribute( name ) : + ( val = elem.getAttributeNode( name ) ) && val.specified ? + val.value : + null; +}; + +Sizzle.escape = function( sel ) { + return ( sel + "" ).replace( rcssescape, fcssescape ); +}; + +Sizzle.error = function( msg ) { + throw new Error( "Syntax error, unrecognized expression: " + msg ); +}; + +/** + * Document sorting and removing duplicates + * @param {ArrayLike} results + */ +Sizzle.uniqueSort = function( results ) { + var elem, + duplicates = [], + j = 0, + i = 0; + + // Unless we *know* we can detect duplicates, assume their presence + hasDuplicate = !support.detectDuplicates; + sortInput = !support.sortStable && results.slice( 0 ); + results.sort( sortOrder ); + + if ( hasDuplicate ) { + while ( ( elem = results[ i++ ] ) ) { + if ( elem === results[ i ] ) { + j = duplicates.push( i ); + } + } + while ( j-- ) { + results.splice( duplicates[ j ], 1 ); + } + } + + // Clear input after sorting to release objects + // See https://github.com/jquery/sizzle/pull/225 + sortInput = null; + + return results; +}; + +/** + * Utility function for retrieving the text value of an array of DOM nodes + * @param {Array|Element} elem + */ +getText = Sizzle.getText = function( elem ) { + var node, + ret = "", + i = 0, + nodeType = elem.nodeType; + + if ( !nodeType ) { + + // If no nodeType, this is expected to be an array + while ( ( node = elem[ i++ ] ) ) { + + // Do not traverse comment nodes + ret += getText( node ); + } + } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { + + // Use textContent for elements + // innerText usage removed for consistency of new lines (jQuery #11153) + if ( typeof elem.textContent === "string" ) { + return elem.textContent; + } else { + + // Traverse its children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + ret += getText( elem ); + } + } + } else if ( nodeType === 3 || nodeType === 4 ) { + return elem.nodeValue; + } + + // Do not include comment or processing instruction nodes + + return ret; +}; + +Expr = Sizzle.selectors = { + + // Can be adjusted by the user + cacheLength: 50, + + createPseudo: markFunction, + + match: matchExpr, + + attrHandle: {}, + + find: {}, + + relative: { + ">": { dir: "parentNode", first: true }, + " ": { dir: "parentNode" }, + "+": { dir: "previousSibling", first: true }, + "~": { dir: "previousSibling" } + }, + + preFilter: { + "ATTR": function( match ) { + match[ 1 ] = match[ 1 ].replace( runescape, funescape ); + + // Move the given value to match[3] whether quoted or unquoted + match[ 3 ] = ( match[ 3 ] || match[ 4 ] || + match[ 5 ] || "" ).replace( runescape, funescape ); + + if ( match[ 2 ] === "~=" ) { + match[ 3 ] = " " + match[ 3 ] + " "; + } + + return match.slice( 0, 4 ); + }, + + "CHILD": function( match ) { + + /* matches from matchExpr["CHILD"] + 1 type (only|nth|...) + 2 what (child|of-type) + 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) + 4 xn-component of xn+y argument ([+-]?\d*n|) + 5 sign of xn-component + 6 x of xn-component + 7 sign of y-component + 8 y of y-component + */ + match[ 1 ] = match[ 1 ].toLowerCase(); + + if ( match[ 1 ].slice( 0, 3 ) === "nth" ) { + + // nth-* requires argument + if ( !match[ 3 ] ) { + Sizzle.error( match[ 0 ] ); + } + + // numeric x and y parameters for Expr.filter.CHILD + // remember that false/true cast respectively to 0/1 + match[ 4 ] = +( match[ 4 ] ? + match[ 5 ] + ( match[ 6 ] || 1 ) : + 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) ); + match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" ); + + // other types prohibit arguments + } else if ( match[ 3 ] ) { + Sizzle.error( match[ 0 ] ); + } + + return match; + }, + + "PSEUDO": function( match ) { + var excess, + unquoted = !match[ 6 ] && match[ 2 ]; + + if ( matchExpr[ "CHILD" ].test( match[ 0 ] ) ) { + return null; + } + + // Accept quoted arguments as-is + if ( match[ 3 ] ) { + match[ 2 ] = match[ 4 ] || match[ 5 ] || ""; + + // Strip excess characters from unquoted arguments + } else if ( unquoted && rpseudo.test( unquoted ) && + + // Get excess from tokenize (recursively) + ( excess = tokenize( unquoted, true ) ) && + + // advance to the next closing parenthesis + ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) { + + // excess is a negative index + match[ 0 ] = match[ 0 ].slice( 0, excess ); + match[ 2 ] = unquoted.slice( 0, excess ); + } + + // Return only captures needed by the pseudo filter method (type and argument) + return match.slice( 0, 3 ); + } + }, + + filter: { + + "TAG": function( nodeNameSelector ) { + var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); + return nodeNameSelector === "*" ? + function() { + return true; + } : + function( elem ) { + return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; + }; + }, + + "CLASS": function( className ) { + var pattern = classCache[ className + " " ]; + + return pattern || + ( pattern = new RegExp( "(^|" + whitespace + + ")" + className + "(" + whitespace + "|$)" ) ) && classCache( + className, function( elem ) { + return pattern.test( + typeof elem.className === "string" && elem.className || + typeof elem.getAttribute !== "undefined" && + elem.getAttribute( "class" ) || + "" + ); + } ); + }, + + "ATTR": function( name, operator, check ) { + return function( elem ) { + var result = Sizzle.attr( elem, name ); + + if ( result == null ) { + return operator === "!="; + } + if ( !operator ) { + return true; + } + + result += ""; + + /* eslint-disable max-len */ + + return operator === "=" ? result === check : + operator === "!=" ? result !== check : + operator === "^=" ? check && result.indexOf( check ) === 0 : + operator === "*=" ? check && result.indexOf( check ) > -1 : + operator === "$=" ? check && result.slice( -check.length ) === check : + operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : + operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : + false; + /* eslint-enable max-len */ + + }; + }, + + "CHILD": function( type, what, _argument, first, last ) { + var simple = type.slice( 0, 3 ) !== "nth", + forward = type.slice( -4 ) !== "last", + ofType = what === "of-type"; + + return first === 1 && last === 0 ? + + // Shortcut for :nth-*(n) + function( elem ) { + return !!elem.parentNode; + } : + + function( elem, _context, xml ) { + var cache, uniqueCache, outerCache, node, nodeIndex, start, + dir = simple !== forward ? "nextSibling" : "previousSibling", + parent = elem.parentNode, + name = ofType && elem.nodeName.toLowerCase(), + useCache = !xml && !ofType, + diff = false; + + if ( parent ) { + + // :(first|last|only)-(child|of-type) + if ( simple ) { + while ( dir ) { + node = elem; + while ( ( node = node[ dir ] ) ) { + if ( ofType ? + node.nodeName.toLowerCase() === name : + node.nodeType === 1 ) { + + return false; + } + } + + // Reverse direction for :only-* (if we haven't yet done so) + start = dir = type === "only" && !start && "nextSibling"; + } + return true; + } + + start = [ forward ? parent.firstChild : parent.lastChild ]; + + // non-xml :nth-child(...) stores cache data on `parent` + if ( forward && useCache ) { + + // Seek `elem` from a previously-cached index + + // ...in a gzip-friendly way + node = parent; + outerCache = node[ expando ] || ( node[ expando ] = {} ); + + // Support: IE <9 only + // Defend against cloned attroperties (jQuery gh-1709) + uniqueCache = outerCache[ node.uniqueID ] || + ( outerCache[ node.uniqueID ] = {} ); + + cache = uniqueCache[ type ] || []; + nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; + diff = nodeIndex && cache[ 2 ]; + node = nodeIndex && parent.childNodes[ nodeIndex ]; + + while ( ( node = ++nodeIndex && node && node[ dir ] || + + // Fallback to seeking `elem` from the start + ( diff = nodeIndex = 0 ) || start.pop() ) ) { + + // When found, cache indexes on `parent` and break + if ( node.nodeType === 1 && ++diff && node === elem ) { + uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; + break; + } + } + + } else { + + // Use previously-cached element index if available + if ( useCache ) { + + // ...in a gzip-friendly way + node = elem; + outerCache = node[ expando ] || ( node[ expando ] = {} ); + + // Support: IE <9 only + // Defend against cloned attroperties (jQuery gh-1709) + uniqueCache = outerCache[ node.uniqueID ] || + ( outerCache[ node.uniqueID ] = {} ); + + cache = uniqueCache[ type ] || []; + nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; + diff = nodeIndex; + } + + // xml :nth-child(...) + // or :nth-last-child(...) or :nth(-last)?-of-type(...) + if ( diff === false ) { + + // Use the same loop as above to seek `elem` from the start + while ( ( node = ++nodeIndex && node && node[ dir ] || + ( diff = nodeIndex = 0 ) || start.pop() ) ) { + + if ( ( ofType ? + node.nodeName.toLowerCase() === name : + node.nodeType === 1 ) && + ++diff ) { + + // Cache the index of each encountered element + if ( useCache ) { + outerCache = node[ expando ] || + ( node[ expando ] = {} ); + + // Support: IE <9 only + // Defend against cloned attroperties (jQuery gh-1709) + uniqueCache = outerCache[ node.uniqueID ] || + ( outerCache[ node.uniqueID ] = {} ); + + uniqueCache[ type ] = [ dirruns, diff ]; + } + + if ( node === elem ) { + break; + } + } + } + } + } + + // Incorporate the offset, then check against cycle size + diff -= last; + return diff === first || ( diff % first === 0 && diff / first >= 0 ); + } + }; + }, + + "PSEUDO": function( pseudo, argument ) { + + // pseudo-class names are case-insensitive + // http://www.w3.org/TR/selectors/#pseudo-classes + // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters + // Remember that setFilters inherits from pseudos + var args, + fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || + Sizzle.error( "unsupported pseudo: " + pseudo ); + + // The user may use createPseudo to indicate that + // arguments are needed to create the filter function + // just as Sizzle does + if ( fn[ expando ] ) { + return fn( argument ); + } + + // But maintain support for old signatures + if ( fn.length > 1 ) { + args = [ pseudo, pseudo, "", argument ]; + return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? + markFunction( function( seed, matches ) { + var idx, + matched = fn( seed, argument ), + i = matched.length; + while ( i-- ) { + idx = indexOf( seed, matched[ i ] ); + seed[ idx ] = !( matches[ idx ] = matched[ i ] ); + } + } ) : + function( elem ) { + return fn( elem, 0, args ); + }; + } + + return fn; + } + }, + + pseudos: { + + // Potentially complex pseudos + "not": markFunction( function( selector ) { + + // Trim the selector passed to compile + // to avoid treating leading and trailing + // spaces as combinators + var input = [], + results = [], + matcher = compile( selector.replace( rtrim, "$1" ) ); + + return matcher[ expando ] ? + markFunction( function( seed, matches, _context, xml ) { + var elem, + unmatched = matcher( seed, null, xml, [] ), + i = seed.length; + + // Match elements unmatched by `matcher` + while ( i-- ) { + if ( ( elem = unmatched[ i ] ) ) { + seed[ i ] = !( matches[ i ] = elem ); + } + } + } ) : + function( elem, _context, xml ) { + input[ 0 ] = elem; + matcher( input, null, xml, results ); + + // Don't keep the element (issue #299) + input[ 0 ] = null; + return !results.pop(); + }; + } ), + + "has": markFunction( function( selector ) { + return function( elem ) { + return Sizzle( selector, elem ).length > 0; + }; + } ), + + "contains": markFunction( function( text ) { + text = text.replace( runescape, funescape ); + return function( elem ) { + return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1; + }; + } ), + + // "Whether an element is represented by a :lang() selector + // is based solely on the element's language value + // being equal to the identifier C, + // or beginning with the identifier C immediately followed by "-". + // The matching of C against the element's language value is performed case-insensitively. + // The identifier C does not have to be a valid language name." + // http://www.w3.org/TR/selectors/#lang-pseudo + "lang": markFunction( function( lang ) { + + // lang value must be a valid identifier + if ( !ridentifier.test( lang || "" ) ) { + Sizzle.error( "unsupported lang: " + lang ); + } + lang = lang.replace( runescape, funescape ).toLowerCase(); + return function( elem ) { + var elemLang; + do { + if ( ( elemLang = documentIsHTML ? + elem.lang : + elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) { + + elemLang = elemLang.toLowerCase(); + return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; + } + } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 ); + return false; + }; + } ), + + // Miscellaneous + "target": function( elem ) { + var hash = window.location && window.location.hash; + return hash && hash.slice( 1 ) === elem.id; + }, + + "root": function( elem ) { + return elem === docElem; + }, + + "focus": function( elem ) { + return elem === document.activeElement && + ( !document.hasFocus || document.hasFocus() ) && + !!( elem.type || elem.href || ~elem.tabIndex ); + }, + + // Boolean properties + "enabled": createDisabledPseudo( false ), + "disabled": createDisabledPseudo( true ), + + "checked": function( elem ) { + + // In CSS3, :checked should return both checked and selected elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + var nodeName = elem.nodeName.toLowerCase(); + return ( nodeName === "input" && !!elem.checked ) || + ( nodeName === "option" && !!elem.selected ); + }, + + "selected": function( elem ) { + + // Accessing this property makes selected-by-default + // options in Safari work properly + if ( elem.parentNode ) { + // eslint-disable-next-line no-unused-expressions + elem.parentNode.selectedIndex; + } + + return elem.selected === true; + }, + + // Contents + "empty": function( elem ) { + + // http://www.w3.org/TR/selectors/#empty-pseudo + // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), + // but not by others (comment: 8; processing instruction: 7; etc.) + // nodeType < 6 works because attributes (2) do not appear as children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + if ( elem.nodeType < 6 ) { + return false; + } + } + return true; + }, + + "parent": function( elem ) { + return !Expr.pseudos[ "empty" ]( elem ); + }, + + // Element/input types + "header": function( elem ) { + return rheader.test( elem.nodeName ); + }, + + "input": function( elem ) { + return rinputs.test( elem.nodeName ); + }, + + "button": function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === "button" || name === "button"; + }, + + "text": function( elem ) { + var attr; + return elem.nodeName.toLowerCase() === "input" && + elem.type === "text" && + + // Support: IE <10 only + // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" + ( ( attr = elem.getAttribute( "type" ) ) == null || + attr.toLowerCase() === "text" ); + }, + + // Position-in-collection + "first": createPositionalPseudo( function() { + return [ 0 ]; + } ), + + "last": createPositionalPseudo( function( _matchIndexes, length ) { + return [ length - 1 ]; + } ), + + "eq": createPositionalPseudo( function( _matchIndexes, length, argument ) { + return [ argument < 0 ? argument + length : argument ]; + } ), + + "even": createPositionalPseudo( function( matchIndexes, length ) { + var i = 0; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + } ), + + "odd": createPositionalPseudo( function( matchIndexes, length ) { + var i = 1; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + } ), + + "lt": createPositionalPseudo( function( matchIndexes, length, argument ) { + var i = argument < 0 ? + argument + length : + argument > length ? + length : + argument; + for ( ; --i >= 0; ) { + matchIndexes.push( i ); + } + return matchIndexes; + } ), + + "gt": createPositionalPseudo( function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; ++i < length; ) { + matchIndexes.push( i ); + } + return matchIndexes; + } ) + } +}; + +Expr.pseudos[ "nth" ] = Expr.pseudos[ "eq" ]; + +// Add button/input type pseudos +for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { + Expr.pseudos[ i ] = createInputPseudo( i ); +} +for ( i in { submit: true, reset: true } ) { + Expr.pseudos[ i ] = createButtonPseudo( i ); +} + +// Easy API for creating new setFilters +function setFilters() {} +setFilters.prototype = Expr.filters = Expr.pseudos; +Expr.setFilters = new setFilters(); + +tokenize = Sizzle.tokenize = function( selector, parseOnly ) { + var matched, match, tokens, type, + soFar, groups, preFilters, + cached = tokenCache[ selector + " " ]; + + if ( cached ) { + return parseOnly ? 0 : cached.slice( 0 ); + } + + soFar = selector; + groups = []; + preFilters = Expr.preFilter; + + while ( soFar ) { + + // Comma and first run + if ( !matched || ( match = rcomma.exec( soFar ) ) ) { + if ( match ) { + + // Don't consume trailing commas as valid + soFar = soFar.slice( match[ 0 ].length ) || soFar; + } + groups.push( ( tokens = [] ) ); + } + + matched = false; + + // Combinators + if ( ( match = rcombinators.exec( soFar ) ) ) { + matched = match.shift(); + tokens.push( { + value: matched, + + // Cast descendant combinators to space + type: match[ 0 ].replace( rtrim, " " ) + } ); + soFar = soFar.slice( matched.length ); + } + + // Filters + for ( type in Expr.filter ) { + if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] || + ( match = preFilters[ type ]( match ) ) ) ) { + matched = match.shift(); + tokens.push( { + value: matched, + type: type, + matches: match + } ); + soFar = soFar.slice( matched.length ); + } + } + + if ( !matched ) { + break; + } + } + + // Return the length of the invalid excess + // if we're just parsing + // Otherwise, throw an error or return tokens + return parseOnly ? + soFar.length : + soFar ? + Sizzle.error( selector ) : + + // Cache the tokens + tokenCache( selector, groups ).slice( 0 ); +}; + +function toSelector( tokens ) { + var i = 0, + len = tokens.length, + selector = ""; + for ( ; i < len; i++ ) { + selector += tokens[ i ].value; + } + return selector; +} + +function addCombinator( matcher, combinator, base ) { + var dir = combinator.dir, + skip = combinator.next, + key = skip || dir, + checkNonElements = base && key === "parentNode", + doneName = done++; + + return combinator.first ? + + // Check against closest ancestor/preceding element + function( elem, context, xml ) { + while ( ( elem = elem[ dir ] ) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + return matcher( elem, context, xml ); + } + } + return false; + } : + + // Check against all ancestor/preceding elements + function( elem, context, xml ) { + var oldCache, uniqueCache, outerCache, + newCache = [ dirruns, doneName ]; + + // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching + if ( xml ) { + while ( ( elem = elem[ dir ] ) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + if ( matcher( elem, context, xml ) ) { + return true; + } + } + } + } else { + while ( ( elem = elem[ dir ] ) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + outerCache = elem[ expando ] || ( elem[ expando ] = {} ); + + // Support: IE <9 only + // Defend against cloned attroperties (jQuery gh-1709) + uniqueCache = outerCache[ elem.uniqueID ] || + ( outerCache[ elem.uniqueID ] = {} ); + + if ( skip && skip === elem.nodeName.toLowerCase() ) { + elem = elem[ dir ] || elem; + } else if ( ( oldCache = uniqueCache[ key ] ) && + oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { + + // Assign to newCache so results back-propagate to previous elements + return ( newCache[ 2 ] = oldCache[ 2 ] ); + } else { + + // Reuse newcache so results back-propagate to previous elements + uniqueCache[ key ] = newCache; + + // A match means we're done; a fail means we have to keep checking + if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) { + return true; + } + } + } + } + } + return false; + }; +} + +function elementMatcher( matchers ) { + return matchers.length > 1 ? + function( elem, context, xml ) { + var i = matchers.length; + while ( i-- ) { + if ( !matchers[ i ]( elem, context, xml ) ) { + return false; + } + } + return true; + } : + matchers[ 0 ]; +} + +function multipleContexts( selector, contexts, results ) { + var i = 0, + len = contexts.length; + for ( ; i < len; i++ ) { + Sizzle( selector, contexts[ i ], results ); + } + return results; +} + +function condense( unmatched, map, filter, context, xml ) { + var elem, + newUnmatched = [], + i = 0, + len = unmatched.length, + mapped = map != null; + + for ( ; i < len; i++ ) { + if ( ( elem = unmatched[ i ] ) ) { + if ( !filter || filter( elem, context, xml ) ) { + newUnmatched.push( elem ); + if ( mapped ) { + map.push( i ); + } + } + } + } + + return newUnmatched; +} + +function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { + if ( postFilter && !postFilter[ expando ] ) { + postFilter = setMatcher( postFilter ); + } + if ( postFinder && !postFinder[ expando ] ) { + postFinder = setMatcher( postFinder, postSelector ); + } + return markFunction( function( seed, results, context, xml ) { + var temp, i, elem, + preMap = [], + postMap = [], + preexisting = results.length, + + // Get initial elements from seed or context + elems = seed || multipleContexts( + selector || "*", + context.nodeType ? [ context ] : context, + [] + ), + + // Prefilter to get matcher input, preserving a map for seed-results synchronization + matcherIn = preFilter && ( seed || !selector ) ? + condense( elems, preMap, preFilter, context, xml ) : + elems, + + matcherOut = matcher ? + + // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, + postFinder || ( seed ? preFilter : preexisting || postFilter ) ? + + // ...intermediate processing is necessary + [] : + + // ...otherwise use results directly + results : + matcherIn; + + // Find primary matches + if ( matcher ) { + matcher( matcherIn, matcherOut, context, xml ); + } + + // Apply postFilter + if ( postFilter ) { + temp = condense( matcherOut, postMap ); + postFilter( temp, [], context, xml ); + + // Un-match failing elements by moving them back to matcherIn + i = temp.length; + while ( i-- ) { + if ( ( elem = temp[ i ] ) ) { + matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem ); + } + } + } + + if ( seed ) { + if ( postFinder || preFilter ) { + if ( postFinder ) { + + // Get the final matcherOut by condensing this intermediate into postFinder contexts + temp = []; + i = matcherOut.length; + while ( i-- ) { + if ( ( elem = matcherOut[ i ] ) ) { + + // Restore matcherIn since elem is not yet a final match + temp.push( ( matcherIn[ i ] = elem ) ); + } + } + postFinder( null, ( matcherOut = [] ), temp, xml ); + } + + // Move matched elements from seed to results to keep them synchronized + i = matcherOut.length; + while ( i-- ) { + if ( ( elem = matcherOut[ i ] ) && + ( temp = postFinder ? indexOf( seed, elem ) : preMap[ i ] ) > -1 ) { + + seed[ temp ] = !( results[ temp ] = elem ); + } + } + } + + // Add elements to results, through postFinder if defined + } else { + matcherOut = condense( + matcherOut === results ? + matcherOut.splice( preexisting, matcherOut.length ) : + matcherOut + ); + if ( postFinder ) { + postFinder( null, results, matcherOut, xml ); + } else { + push.apply( results, matcherOut ); + } + } + } ); +} + +function matcherFromTokens( tokens ) { + var checkContext, matcher, j, + len = tokens.length, + leadingRelative = Expr.relative[ tokens[ 0 ].type ], + implicitRelative = leadingRelative || Expr.relative[ " " ], + i = leadingRelative ? 1 : 0, + + // The foundational matcher ensures that elements are reachable from top-level context(s) + matchContext = addCombinator( function( elem ) { + return elem === checkContext; + }, implicitRelative, true ), + matchAnyContext = addCombinator( function( elem ) { + return indexOf( checkContext, elem ) > -1; + }, implicitRelative, true ), + matchers = [ function( elem, context, xml ) { + var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( + ( checkContext = context ).nodeType ? + matchContext( elem, context, xml ) : + matchAnyContext( elem, context, xml ) ); + + // Avoid hanging onto element (issue #299) + checkContext = null; + return ret; + } ]; + + for ( ; i < len; i++ ) { + if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) { + matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; + } else { + matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches ); + + // Return special upon seeing a positional matcher + if ( matcher[ expando ] ) { + + // Find the next relative operator (if any) for proper handling + j = ++i; + for ( ; j < len; j++ ) { + if ( Expr.relative[ tokens[ j ].type ] ) { + break; + } + } + return setMatcher( + i > 1 && elementMatcher( matchers ), + i > 1 && toSelector( + + // If the preceding token was a descendant combinator, insert an implicit any-element `*` + tokens + .slice( 0, i - 1 ) + .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } ) + ).replace( rtrim, "$1" ), + matcher, + i < j && matcherFromTokens( tokens.slice( i, j ) ), + j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ), + j < len && toSelector( tokens ) + ); + } + matchers.push( matcher ); + } + } + + return elementMatcher( matchers ); +} + +function matcherFromGroupMatchers( elementMatchers, setMatchers ) { + var bySet = setMatchers.length > 0, + byElement = elementMatchers.length > 0, + superMatcher = function( seed, context, xml, results, outermost ) { + var elem, j, matcher, + matchedCount = 0, + i = "0", + unmatched = seed && [], + setMatched = [], + contextBackup = outermostContext, + + // We must always have either seed elements or outermost context + elems = seed || byElement && Expr.find[ "TAG" ]( "*", outermost ), + + // Use integer dirruns iff this is the outermost matcher + dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ), + len = elems.length; + + if ( outermost ) { + + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // two documents; shallow comparisons work. + // eslint-disable-next-line eqeqeq + outermostContext = context == document || context || outermost; + } + + // Add elements passing elementMatchers directly to results + // Support: IE<9, Safari + // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id + for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) { + if ( byElement && elem ) { + j = 0; + + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // two documents; shallow comparisons work. + // eslint-disable-next-line eqeqeq + if ( !context && elem.ownerDocument != document ) { + setDocument( elem ); + xml = !documentIsHTML; + } + while ( ( matcher = elementMatchers[ j++ ] ) ) { + if ( matcher( elem, context || document, xml ) ) { + results.push( elem ); + break; + } + } + if ( outermost ) { + dirruns = dirrunsUnique; + } + } + + // Track unmatched elements for set filters + if ( bySet ) { + + // They will have gone through all possible matchers + if ( ( elem = !matcher && elem ) ) { + matchedCount--; + } + + // Lengthen the array for every element, matched or not + if ( seed ) { + unmatched.push( elem ); + } + } + } + + // `i` is now the count of elements visited above, and adding it to `matchedCount` + // makes the latter nonnegative. + matchedCount += i; + + // Apply set filters to unmatched elements + // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` + // equals `i`), unless we didn't visit _any_ elements in the above loop because we have + // no element matchers and no seed. + // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that + // case, which will result in a "00" `matchedCount` that differs from `i` but is also + // numerically zero. + if ( bySet && i !== matchedCount ) { + j = 0; + while ( ( matcher = setMatchers[ j++ ] ) ) { + matcher( unmatched, setMatched, context, xml ); + } + + if ( seed ) { + + // Reintegrate element matches to eliminate the need for sorting + if ( matchedCount > 0 ) { + while ( i-- ) { + if ( !( unmatched[ i ] || setMatched[ i ] ) ) { + setMatched[ i ] = pop.call( results ); + } + } + } + + // Discard index placeholder values to get only actual matches + setMatched = condense( setMatched ); + } + + // Add matches to results + push.apply( results, setMatched ); + + // Seedless set matches succeeding multiple successful matchers stipulate sorting + if ( outermost && !seed && setMatched.length > 0 && + ( matchedCount + setMatchers.length ) > 1 ) { + + Sizzle.uniqueSort( results ); + } + } + + // Override manipulation of globals by nested matchers + if ( outermost ) { + dirruns = dirrunsUnique; + outermostContext = contextBackup; + } + + return unmatched; + }; + + return bySet ? + markFunction( superMatcher ) : + superMatcher; +} + +compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { + var i, + setMatchers = [], + elementMatchers = [], + cached = compilerCache[ selector + " " ]; + + if ( !cached ) { + + // Generate a function of recursive functions that can be used to check each element + if ( !match ) { + match = tokenize( selector ); + } + i = match.length; + while ( i-- ) { + cached = matcherFromTokens( match[ i ] ); + if ( cached[ expando ] ) { + setMatchers.push( cached ); + } else { + elementMatchers.push( cached ); + } + } + + // Cache the compiled function + cached = compilerCache( + selector, + matcherFromGroupMatchers( elementMatchers, setMatchers ) + ); + + // Save selector and tokenization + cached.selector = selector; + } + return cached; +}; + +/** + * A low-level selection function that works with Sizzle's compiled + * selector functions + * @param {String|Function} selector A selector or a pre-compiled + * selector function built with Sizzle.compile + * @param {Element} context + * @param {Array} [results] + * @param {Array} [seed] A set of elements to match against + */ +select = Sizzle.select = function( selector, context, results, seed ) { + var i, tokens, token, type, find, + compiled = typeof selector === "function" && selector, + match = !seed && tokenize( ( selector = compiled.selector || selector ) ); + + results = results || []; + + // Try to minimize operations if there is only one selector in the list and no seed + // (the latter of which guarantees us context) + if ( match.length === 1 ) { + + // Reduce context if the leading compound selector is an ID + tokens = match[ 0 ] = match[ 0 ].slice( 0 ); + if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" && + context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) { + + context = ( Expr.find[ "ID" ]( token.matches[ 0 ] + .replace( runescape, funescape ), context ) || [] )[ 0 ]; + if ( !context ) { + return results; + + // Precompiled matchers will still verify ancestry, so step up a level + } else if ( compiled ) { + context = context.parentNode; + } + + selector = selector.slice( tokens.shift().value.length ); + } + + // Fetch a seed set for right-to-left matching + i = matchExpr[ "needsContext" ].test( selector ) ? 0 : tokens.length; + while ( i-- ) { + token = tokens[ i ]; + + // Abort if we hit a combinator + if ( Expr.relative[ ( type = token.type ) ] ) { + break; + } + if ( ( find = Expr.find[ type ] ) ) { + + // Search, expanding context for leading sibling combinators + if ( ( seed = find( + token.matches[ 0 ].replace( runescape, funescape ), + rsibling.test( tokens[ 0 ].type ) && testContext( context.parentNode ) || + context + ) ) ) { + + // If seed is empty or no tokens remain, we can return early + tokens.splice( i, 1 ); + selector = seed.length && toSelector( tokens ); + if ( !selector ) { + push.apply( results, seed ); + return results; + } + + break; + } + } + } + } + + // Compile and execute a filtering function if one is not provided + // Provide `match` to avoid retokenization if we modified the selector above + ( compiled || compile( selector, match ) )( + seed, + context, + !documentIsHTML, + results, + !context || rsibling.test( selector ) && testContext( context.parentNode ) || context + ); + return results; +}; + +// One-time assignments + +// Sort stability +support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando; + +// Support: Chrome 14-35+ +// Always assume duplicates if they aren't passed to the comparison function +support.detectDuplicates = !!hasDuplicate; + +// Initialize against the default document +setDocument(); + +// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) +// Detached nodes confoundingly follow *each other* +support.sortDetached = assert( function( el ) { + + // Should return 1, but returns 4 (following) + return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1; +} ); + +// Support: IE<8 +// Prevent attribute/property "interpolation" +// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx +if ( !assert( function( el ) { + el.innerHTML = "<a href='#'></a>"; + return el.firstChild.getAttribute( "href" ) === "#"; +} ) ) { + addHandle( "type|href|height|width", function( elem, name, isXML ) { + if ( !isXML ) { + return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); + } + } ); +} + +// Support: IE<9 +// Use defaultValue in place of getAttribute("value") +if ( !support.attributes || !assert( function( el ) { + el.innerHTML = "<input/>"; + el.firstChild.setAttribute( "value", "" ); + return el.firstChild.getAttribute( "value" ) === ""; +} ) ) { + addHandle( "value", function( elem, _name, isXML ) { + if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { + return elem.defaultValue; + } + } ); +} + +// Support: IE<9 +// Use getAttributeNode to fetch booleans when getAttribute lies +if ( !assert( function( el ) { + return el.getAttribute( "disabled" ) == null; +} ) ) { + addHandle( booleans, function( elem, name, isXML ) { + var val; + if ( !isXML ) { + return elem[ name ] === true ? name.toLowerCase() : + ( val = elem.getAttributeNode( name ) ) && val.specified ? + val.value : + null; + } + } ); +} + +return Sizzle; + +} )( window ); + + + +jQuery.find = Sizzle; +jQuery.expr = Sizzle.selectors; + +// Deprecated +jQuery.expr[ ":" ] = jQuery.expr.pseudos; +jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; +jQuery.text = Sizzle.getText; +jQuery.isXMLDoc = Sizzle.isXML; +jQuery.contains = Sizzle.contains; +jQuery.escapeSelector = Sizzle.escape; + + + + +var dir = function( elem, dir, until ) { + var matched = [], + truncate = until !== undefined; + + while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { + if ( elem.nodeType === 1 ) { + if ( truncate && jQuery( elem ).is( until ) ) { + break; + } + matched.push( elem ); + } + } + return matched; +}; + + +var siblings = function( n, elem ) { + var matched = []; + + for ( ; n; n = n.nextSibling ) { + if ( n.nodeType === 1 && n !== elem ) { + matched.push( n ); + } + } + + return matched; +}; + + +var rneedsContext = jQuery.expr.match.needsContext; + + + +function nodeName( elem, name ) { + + return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); + +} +var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); + + + +// Implement the identical functionality for filter and not +function winnow( elements, qualifier, not ) { + if ( isFunction( qualifier ) ) { + return jQuery.grep( elements, function( elem, i ) { + return !!qualifier.call( elem, i, elem ) !== not; + } ); + } + + // Single element + if ( qualifier.nodeType ) { + return jQuery.grep( elements, function( elem ) { + return ( elem === qualifier ) !== not; + } ); + } + + // Arraylike of elements (jQuery, arguments, Array) + if ( typeof qualifier !== "string" ) { + return jQuery.grep( elements, function( elem ) { + return ( indexOf.call( qualifier, elem ) > -1 ) !== not; + } ); + } + + // Filtered directly for both simple and complex selectors + return jQuery.filter( qualifier, elements, not ); +} + +jQuery.filter = function( expr, elems, not ) { + var elem = elems[ 0 ]; + + if ( not ) { + expr = ":not(" + expr + ")"; + } + + if ( elems.length === 1 && elem.nodeType === 1 ) { + return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; + } + + return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { + return elem.nodeType === 1; + } ) ); +}; + +jQuery.fn.extend( { + find: function( selector ) { + var i, ret, + len = this.length, + self = this; + + if ( typeof selector !== "string" ) { + return this.pushStack( jQuery( selector ).filter( function() { + for ( i = 0; i < len; i++ ) { + if ( jQuery.contains( self[ i ], this ) ) { + return true; + } + } + } ) ); + } + + ret = this.pushStack( [] ); + + for ( i = 0; i < len; i++ ) { + jQuery.find( selector, self[ i ], ret ); + } + + return len > 1 ? jQuery.uniqueSort( ret ) : ret; + }, + filter: function( selector ) { + return this.pushStack( winnow( this, selector || [], false ) ); + }, + not: function( selector ) { + return this.pushStack( winnow( this, selector || [], true ) ); + }, + is: function( selector ) { + return !!winnow( + this, + + // If this is a positional/relative selector, check membership in the returned set + // so $("p:first").is("p:last") won't return true for a doc with two "p". + typeof selector === "string" && rneedsContext.test( selector ) ? + jQuery( selector ) : + selector || [], + false + ).length; + } +} ); + + +// Initialize a jQuery object + + +// A central reference to the root jQuery(document) +var rootjQuery, + + // A simple way to check for HTML strings + // Prioritize #id over <tag> to avoid XSS via location.hash (trac-9521) + // Strict HTML recognition (trac-11290: must start with <) + // Shortcut simple #id case for speed + rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, + + init = jQuery.fn.init = function( selector, context, root ) { + var match, elem; + + // HANDLE: $(""), $(null), $(undefined), $(false) + if ( !selector ) { + return this; + } + + // Method init() accepts an alternate rootjQuery + // so migrate can support jQuery.sub (gh-2101) + root = root || rootjQuery; + + // Handle HTML strings + if ( typeof selector === "string" ) { + if ( selector[ 0 ] === "<" && + selector[ selector.length - 1 ] === ">" && + selector.length >= 3 ) { + + // Assume that strings that start and end with <> are HTML and skip the regex check + match = [ null, selector, null ]; + + } else { + match = rquickExpr.exec( selector ); + } + + // Match html or make sure no context is specified for #id + if ( match && ( match[ 1 ] || !context ) ) { + + // HANDLE: $(html) -> $(array) + if ( match[ 1 ] ) { + context = context instanceof jQuery ? context[ 0 ] : context; + + // Option to run scripts is true for back-compat + // Intentionally let the error be thrown if parseHTML is not present + jQuery.merge( this, jQuery.parseHTML( + match[ 1 ], + context && context.nodeType ? context.ownerDocument || context : document, + true + ) ); + + // HANDLE: $(html, props) + if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { + for ( match in context ) { + + // Properties of context are called as methods if possible + if ( isFunction( this[ match ] ) ) { + this[ match ]( context[ match ] ); + + // ...and otherwise set as attributes + } else { + this.attr( match, context[ match ] ); + } + } + } + + return this; + + // HANDLE: $(#id) + } else { + elem = document.getElementById( match[ 2 ] ); + + if ( elem ) { + + // Inject the element directly into the jQuery object + this[ 0 ] = elem; + this.length = 1; + } + return this; + } + + // HANDLE: $(expr, $(...)) + } else if ( !context || context.jquery ) { + return ( context || root ).find( selector ); + + // HANDLE: $(expr, context) + // (which is just equivalent to: $(context).find(expr) + } else { + return this.constructor( context ).find( selector ); + } + + // HANDLE: $(DOMElement) + } else if ( selector.nodeType ) { + this[ 0 ] = selector; + this.length = 1; + return this; + + // HANDLE: $(function) + // Shortcut for document ready + } else if ( isFunction( selector ) ) { + return root.ready !== undefined ? + root.ready( selector ) : + + // Execute immediately if ready is not present + selector( jQuery ); + } + + return jQuery.makeArray( selector, this ); + }; + +// Give the init function the jQuery prototype for later instantiation +init.prototype = jQuery.fn; + +// Initialize central reference +rootjQuery = jQuery( document ); + + +var rparentsprev = /^(?:parents|prev(?:Until|All))/, + + // Methods guaranteed to produce a unique set when starting from a unique set + guaranteedUnique = { + children: true, + contents: true, + next: true, + prev: true + }; + +jQuery.fn.extend( { + has: function( target ) { + var targets = jQuery( target, this ), + l = targets.length; + + return this.filter( function() { + var i = 0; + for ( ; i < l; i++ ) { + if ( jQuery.contains( this, targets[ i ] ) ) { + return true; + } + } + } ); + }, + + closest: function( selectors, context ) { + var cur, + i = 0, + l = this.length, + matched = [], + targets = typeof selectors !== "string" && jQuery( selectors ); + + // Positional selectors never match, since there's no _selection_ context + if ( !rneedsContext.test( selectors ) ) { + for ( ; i < l; i++ ) { + for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { + + // Always skip document fragments + if ( cur.nodeType < 11 && ( targets ? + targets.index( cur ) > -1 : + + // Don't pass non-elements to Sizzle + cur.nodeType === 1 && + jQuery.find.matchesSelector( cur, selectors ) ) ) { + + matched.push( cur ); + break; + } + } + } + } + + return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); + }, + + // Determine the position of an element within the set + index: function( elem ) { + + // No argument, return index in parent + if ( !elem ) { + return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; + } + + // Index in selector + if ( typeof elem === "string" ) { + return indexOf.call( jQuery( elem ), this[ 0 ] ); + } + + // Locate the position of the desired element + return indexOf.call( this, + + // If it receives a jQuery object, the first element is used + elem.jquery ? elem[ 0 ] : elem + ); + }, + + add: function( selector, context ) { + return this.pushStack( + jQuery.uniqueSort( + jQuery.merge( this.get(), jQuery( selector, context ) ) + ) + ); + }, + + addBack: function( selector ) { + return this.add( selector == null ? + this.prevObject : this.prevObject.filter( selector ) + ); + } +} ); + +function sibling( cur, dir ) { + while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} + return cur; +} + +jQuery.each( { + parent: function( elem ) { + var parent = elem.parentNode; + return parent && parent.nodeType !== 11 ? parent : null; + }, + parents: function( elem ) { + return dir( elem, "parentNode" ); + }, + parentsUntil: function( elem, _i, until ) { + return dir( elem, "parentNode", until ); + }, + next: function( elem ) { + return sibling( elem, "nextSibling" ); + }, + prev: function( elem ) { + return sibling( elem, "previousSibling" ); + }, + nextAll: function( elem ) { + return dir( elem, "nextSibling" ); + }, + prevAll: function( elem ) { + return dir( elem, "previousSibling" ); + }, + nextUntil: function( elem, _i, until ) { + return dir( elem, "nextSibling", until ); + }, + prevUntil: function( elem, _i, until ) { + return dir( elem, "previousSibling", until ); + }, + siblings: function( elem ) { + return siblings( ( elem.parentNode || {} ).firstChild, elem ); + }, + children: function( elem ) { + return siblings( elem.firstChild ); + }, + contents: function( elem ) { + if ( elem.contentDocument != null && + + // Support: IE 11+ + // <object> elements with no `data` attribute has an object + // `contentDocument` with a `null` prototype. + getProto( elem.contentDocument ) ) { + + return elem.contentDocument; + } + + // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only + // Treat the template element as a regular one in browsers that + // don't support it. + if ( nodeName( elem, "template" ) ) { + elem = elem.content || elem; + } + + return jQuery.merge( [], elem.childNodes ); + } +}, function( name, fn ) { + jQuery.fn[ name ] = function( until, selector ) { + var matched = jQuery.map( this, fn, until ); + + if ( name.slice( -5 ) !== "Until" ) { + selector = until; + } + + if ( selector && typeof selector === "string" ) { + matched = jQuery.filter( selector, matched ); + } + + if ( this.length > 1 ) { + + // Remove duplicates + if ( !guaranteedUnique[ name ] ) { + jQuery.uniqueSort( matched ); + } + + // Reverse order for parents* and prev-derivatives + if ( rparentsprev.test( name ) ) { + matched.reverse(); + } + } + + return this.pushStack( matched ); + }; +} ); +var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); + + + +// Convert String-formatted options into Object-formatted ones +function createOptions( options ) { + var object = {}; + jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { + object[ flag ] = true; + } ); + return object; +} + +/* + * Create a callback list using the following parameters: + * + * options: an optional list of space-separated options that will change how + * the callback list behaves or a more traditional option object + * + * By default a callback list will act like an event callback list and can be + * "fired" multiple times. + * + * Possible options: + * + * once: will ensure the callback list can only be fired once (like a Deferred) + * + * memory: will keep track of previous values and will call any callback added + * after the list has been fired right away with the latest "memorized" + * values (like a Deferred) + * + * unique: will ensure a callback can only be added once (no duplicate in the list) + * + * stopOnFalse: interrupt callings when a callback returns false + * + */ +jQuery.Callbacks = function( options ) { + + // Convert options from String-formatted to Object-formatted if needed + // (we check in cache first) + options = typeof options === "string" ? + createOptions( options ) : + jQuery.extend( {}, options ); + + var // Flag to know if list is currently firing + firing, + + // Last fire value for non-forgettable lists + memory, + + // Flag to know if list was already fired + fired, + + // Flag to prevent firing + locked, + + // Actual callback list + list = [], + + // Queue of execution data for repeatable lists + queue = [], + + // Index of currently firing callback (modified by add/remove as needed) + firingIndex = -1, + + // Fire callbacks + fire = function() { + + // Enforce single-firing + locked = locked || options.once; + + // Execute callbacks for all pending executions, + // respecting firingIndex overrides and runtime changes + fired = firing = true; + for ( ; queue.length; firingIndex = -1 ) { + memory = queue.shift(); + while ( ++firingIndex < list.length ) { + + // Run callback and check for early termination + if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && + options.stopOnFalse ) { + + // Jump to end and forget the data so .add doesn't re-fire + firingIndex = list.length; + memory = false; + } + } + } + + // Forget the data if we're done with it + if ( !options.memory ) { + memory = false; + } + + firing = false; + + // Clean up if we're done firing for good + if ( locked ) { + + // Keep an empty list if we have data for future add calls + if ( memory ) { + list = []; + + // Otherwise, this object is spent + } else { + list = ""; + } + } + }, + + // Actual Callbacks object + self = { + + // Add a callback or a collection of callbacks to the list + add: function() { + if ( list ) { + + // If we have memory from a past run, we should fire after adding + if ( memory && !firing ) { + firingIndex = list.length - 1; + queue.push( memory ); + } + + ( function add( args ) { + jQuery.each( args, function( _, arg ) { + if ( isFunction( arg ) ) { + if ( !options.unique || !self.has( arg ) ) { + list.push( arg ); + } + } else if ( arg && arg.length && toType( arg ) !== "string" ) { + + // Inspect recursively + add( arg ); + } + } ); + } )( arguments ); + + if ( memory && !firing ) { + fire(); + } + } + return this; + }, + + // Remove a callback from the list + remove: function() { + jQuery.each( arguments, function( _, arg ) { + var index; + while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { + list.splice( index, 1 ); + + // Handle firing indexes + if ( index <= firingIndex ) { + firingIndex--; + } + } + } ); + return this; + }, + + // Check if a given callback is in the list. + // If no argument is given, return whether or not list has callbacks attached. + has: function( fn ) { + return fn ? + jQuery.inArray( fn, list ) > -1 : + list.length > 0; + }, + + // Remove all callbacks from the list + empty: function() { + if ( list ) { + list = []; + } + return this; + }, + + // Disable .fire and .add + // Abort any current/pending executions + // Clear all callbacks and values + disable: function() { + locked = queue = []; + list = memory = ""; + return this; + }, + disabled: function() { + return !list; + }, + + // Disable .fire + // Also disable .add unless we have memory (since it would have no effect) + // Abort any pending executions + lock: function() { + locked = queue = []; + if ( !memory && !firing ) { + list = memory = ""; + } + return this; + }, + locked: function() { + return !!locked; + }, + + // Call all callbacks with the given context and arguments + fireWith: function( context, args ) { + if ( !locked ) { + args = args || []; + args = [ context, args.slice ? args.slice() : args ]; + queue.push( args ); + if ( !firing ) { + fire(); + } + } + return this; + }, + + // Call all the callbacks with the given arguments + fire: function() { + self.fireWith( this, arguments ); + return this; + }, + + // To know if the callbacks have already been called at least once + fired: function() { + return !!fired; + } + }; + + return self; +}; + + +function Identity( v ) { + return v; +} +function Thrower( ex ) { + throw ex; +} + +function adoptValue( value, resolve, reject, noValue ) { + var method; + + try { + + // Check for promise aspect first to privilege synchronous behavior + if ( value && isFunction( ( method = value.promise ) ) ) { + method.call( value ).done( resolve ).fail( reject ); + + // Other thenables + } else if ( value && isFunction( ( method = value.then ) ) ) { + method.call( value, resolve, reject ); + + // Other non-thenables + } else { + + // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: + // * false: [ value ].slice( 0 ) => resolve( value ) + // * true: [ value ].slice( 1 ) => resolve() + resolve.apply( undefined, [ value ].slice( noValue ) ); + } + + // For Promises/A+, convert exceptions into rejections + // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in + // Deferred#then to conditionally suppress rejection. + } catch ( value ) { + + // Support: Android 4.0 only + // Strict mode functions invoked without .call/.apply get global-object context + reject.apply( undefined, [ value ] ); + } +} + +jQuery.extend( { + + Deferred: function( func ) { + var tuples = [ + + // action, add listener, callbacks, + // ... .then handlers, argument index, [final state] + [ "notify", "progress", jQuery.Callbacks( "memory" ), + jQuery.Callbacks( "memory" ), 2 ], + [ "resolve", "done", jQuery.Callbacks( "once memory" ), + jQuery.Callbacks( "once memory" ), 0, "resolved" ], + [ "reject", "fail", jQuery.Callbacks( "once memory" ), + jQuery.Callbacks( "once memory" ), 1, "rejected" ] + ], + state = "pending", + promise = { + state: function() { + return state; + }, + always: function() { + deferred.done( arguments ).fail( arguments ); + return this; + }, + "catch": function( fn ) { + return promise.then( null, fn ); + }, + + // Keep pipe for back-compat + pipe: function( /* fnDone, fnFail, fnProgress */ ) { + var fns = arguments; + + return jQuery.Deferred( function( newDefer ) { + jQuery.each( tuples, function( _i, tuple ) { + + // Map tuples (progress, done, fail) to arguments (done, fail, progress) + var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; + + // deferred.progress(function() { bind to newDefer or newDefer.notify }) + // deferred.done(function() { bind to newDefer or newDefer.resolve }) + // deferred.fail(function() { bind to newDefer or newDefer.reject }) + deferred[ tuple[ 1 ] ]( function() { + var returned = fn && fn.apply( this, arguments ); + if ( returned && isFunction( returned.promise ) ) { + returned.promise() + .progress( newDefer.notify ) + .done( newDefer.resolve ) + .fail( newDefer.reject ); + } else { + newDefer[ tuple[ 0 ] + "With" ]( + this, + fn ? [ returned ] : arguments + ); + } + } ); + } ); + fns = null; + } ).promise(); + }, + then: function( onFulfilled, onRejected, onProgress ) { + var maxDepth = 0; + function resolve( depth, deferred, handler, special ) { + return function() { + var that = this, + args = arguments, + mightThrow = function() { + var returned, then; + + // Support: Promises/A+ section 2.3.3.3.3 + // https://promisesaplus.com/#point-59 + // Ignore double-resolution attempts + if ( depth < maxDepth ) { + return; + } + + returned = handler.apply( that, args ); + + // Support: Promises/A+ section 2.3.1 + // https://promisesaplus.com/#point-48 + if ( returned === deferred.promise() ) { + throw new TypeError( "Thenable self-resolution" ); + } + + // Support: Promises/A+ sections 2.3.3.1, 3.5 + // https://promisesaplus.com/#point-54 + // https://promisesaplus.com/#point-75 + // Retrieve `then` only once + then = returned && + + // Support: Promises/A+ section 2.3.4 + // https://promisesaplus.com/#point-64 + // Only check objects and functions for thenability + ( typeof returned === "object" || + typeof returned === "function" ) && + returned.then; + + // Handle a returned thenable + if ( isFunction( then ) ) { + + // Special processors (notify) just wait for resolution + if ( special ) { + then.call( + returned, + resolve( maxDepth, deferred, Identity, special ), + resolve( maxDepth, deferred, Thrower, special ) + ); + + // Normal processors (resolve) also hook into progress + } else { + + // ...and disregard older resolution values + maxDepth++; + + then.call( + returned, + resolve( maxDepth, deferred, Identity, special ), + resolve( maxDepth, deferred, Thrower, special ), + resolve( maxDepth, deferred, Identity, + deferred.notifyWith ) + ); + } + + // Handle all other returned values + } else { + + // Only substitute handlers pass on context + // and multiple values (non-spec behavior) + if ( handler !== Identity ) { + that = undefined; + args = [ returned ]; + } + + // Process the value(s) + // Default process is resolve + ( special || deferred.resolveWith )( that, args ); + } + }, + + // Only normal processors (resolve) catch and reject exceptions + process = special ? + mightThrow : + function() { + try { + mightThrow(); + } catch ( e ) { + + if ( jQuery.Deferred.exceptionHook ) { + jQuery.Deferred.exceptionHook( e, + process.stackTrace ); + } + + // Support: Promises/A+ section 2.3.3.3.4.1 + // https://promisesaplus.com/#point-61 + // Ignore post-resolution exceptions + if ( depth + 1 >= maxDepth ) { + + // Only substitute handlers pass on context + // and multiple values (non-spec behavior) + if ( handler !== Thrower ) { + that = undefined; + args = [ e ]; + } + + deferred.rejectWith( that, args ); + } + } + }; + + // Support: Promises/A+ section 2.3.3.3.1 + // https://promisesaplus.com/#point-57 + // Re-resolve promises immediately to dodge false rejection from + // subsequent errors + if ( depth ) { + process(); + } else { + + // Call an optional hook to record the stack, in case of exception + // since it's otherwise lost when execution goes async + if ( jQuery.Deferred.getStackHook ) { + process.stackTrace = jQuery.Deferred.getStackHook(); + } + window.setTimeout( process ); + } + }; + } + + return jQuery.Deferred( function( newDefer ) { + + // progress_handlers.add( ... ) + tuples[ 0 ][ 3 ].add( + resolve( + 0, + newDefer, + isFunction( onProgress ) ? + onProgress : + Identity, + newDefer.notifyWith + ) + ); + + // fulfilled_handlers.add( ... ) + tuples[ 1 ][ 3 ].add( + resolve( + 0, + newDefer, + isFunction( onFulfilled ) ? + onFulfilled : + Identity + ) + ); + + // rejected_handlers.add( ... ) + tuples[ 2 ][ 3 ].add( + resolve( + 0, + newDefer, + isFunction( onRejected ) ? + onRejected : + Thrower + ) + ); + } ).promise(); + }, + + // Get a promise for this deferred + // If obj is provided, the promise aspect is added to the object + promise: function( obj ) { + return obj != null ? jQuery.extend( obj, promise ) : promise; + } + }, + deferred = {}; + + // Add list-specific methods + jQuery.each( tuples, function( i, tuple ) { + var list = tuple[ 2 ], + stateString = tuple[ 5 ]; + + // promise.progress = list.add + // promise.done = list.add + // promise.fail = list.add + promise[ tuple[ 1 ] ] = list.add; + + // Handle state + if ( stateString ) { + list.add( + function() { + + // state = "resolved" (i.e., fulfilled) + // state = "rejected" + state = stateString; + }, + + // rejected_callbacks.disable + // fulfilled_callbacks.disable + tuples[ 3 - i ][ 2 ].disable, + + // rejected_handlers.disable + // fulfilled_handlers.disable + tuples[ 3 - i ][ 3 ].disable, + + // progress_callbacks.lock + tuples[ 0 ][ 2 ].lock, + + // progress_handlers.lock + tuples[ 0 ][ 3 ].lock + ); + } + + // progress_handlers.fire + // fulfilled_handlers.fire + // rejected_handlers.fire + list.add( tuple[ 3 ].fire ); + + // deferred.notify = function() { deferred.notifyWith(...) } + // deferred.resolve = function() { deferred.resolveWith(...) } + // deferred.reject = function() { deferred.rejectWith(...) } + deferred[ tuple[ 0 ] ] = function() { + deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); + return this; + }; + + // deferred.notifyWith = list.fireWith + // deferred.resolveWith = list.fireWith + // deferred.rejectWith = list.fireWith + deferred[ tuple[ 0 ] + "With" ] = list.fireWith; + } ); + + // Make the deferred a promise + promise.promise( deferred ); + + // Call given func if any + if ( func ) { + func.call( deferred, deferred ); + } + + // All done! + return deferred; + }, + + // Deferred helper + when: function( singleValue ) { + var + + // count of uncompleted subordinates + remaining = arguments.length, + + // count of unprocessed arguments + i = remaining, + + // subordinate fulfillment data + resolveContexts = Array( i ), + resolveValues = slice.call( arguments ), + + // the primary Deferred + primary = jQuery.Deferred(), + + // subordinate callback factory + updateFunc = function( i ) { + return function( value ) { + resolveContexts[ i ] = this; + resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; + if ( !( --remaining ) ) { + primary.resolveWith( resolveContexts, resolveValues ); + } + }; + }; + + // Single- and empty arguments are adopted like Promise.resolve + if ( remaining <= 1 ) { + adoptValue( singleValue, primary.done( updateFunc( i ) ).resolve, primary.reject, + !remaining ); + + // Use .then() to unwrap secondary thenables (cf. gh-3000) + if ( primary.state() === "pending" || + isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { + + return primary.then(); + } + } + + // Multiple arguments are aggregated like Promise.all array elements + while ( i-- ) { + adoptValue( resolveValues[ i ], updateFunc( i ), primary.reject ); + } + + return primary.promise(); + } +} ); + + +// These usually indicate a programmer mistake during development, +// warn about them ASAP rather than swallowing them by default. +var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; + +jQuery.Deferred.exceptionHook = function( error, stack ) { + + // Support: IE 8 - 9 only + // Console exists when dev tools are open, which can happen at any time + if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { + window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); + } +}; + + + + +jQuery.readyException = function( error ) { + window.setTimeout( function() { + throw error; + } ); +}; + + + + +// The deferred used on DOM ready +var readyList = jQuery.Deferred(); + +jQuery.fn.ready = function( fn ) { + + readyList + .then( fn ) + + // Wrap jQuery.readyException in a function so that the lookup + // happens at the time of error handling instead of callback + // registration. + .catch( function( error ) { + jQuery.readyException( error ); + } ); + + return this; +}; + +jQuery.extend( { + + // Is the DOM ready to be used? Set to true once it occurs. + isReady: false, + + // A counter to track how many items to wait for before + // the ready event fires. See trac-6781 + readyWait: 1, + + // Handle when the DOM is ready + ready: function( wait ) { + + // Abort if there are pending holds or we're already ready + if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { + return; + } + + // Remember that the DOM is ready + jQuery.isReady = true; + + // If a normal DOM Ready event fired, decrement, and wait if need be + if ( wait !== true && --jQuery.readyWait > 0 ) { + return; + } + + // If there are functions bound, to execute + readyList.resolveWith( document, [ jQuery ] ); + } +} ); + +jQuery.ready.then = readyList.then; + +// The ready event handler and self cleanup method +function completed() { + document.removeEventListener( "DOMContentLoaded", completed ); + window.removeEventListener( "load", completed ); + jQuery.ready(); +} + +// Catch cases where $(document).ready() is called +// after the browser event has already occurred. +// Support: IE <=9 - 10 only +// Older IE sometimes signals "interactive" too soon +if ( document.readyState === "complete" || + ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { + + // Handle it asynchronously to allow scripts the opportunity to delay ready + window.setTimeout( jQuery.ready ); + +} else { + + // Use the handy event callback + document.addEventListener( "DOMContentLoaded", completed ); + + // A fallback to window.onload, that will always work + window.addEventListener( "load", completed ); +} + + + + +// Multifunctional method to get and set values of a collection +// The value/s can optionally be executed if it's a function +var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { + var i = 0, + len = elems.length, + bulk = key == null; + + // Sets many values + if ( toType( key ) === "object" ) { + chainable = true; + for ( i in key ) { + access( elems, fn, i, key[ i ], true, emptyGet, raw ); + } + + // Sets one value + } else if ( value !== undefined ) { + chainable = true; + + if ( !isFunction( value ) ) { + raw = true; + } + + if ( bulk ) { + + // Bulk operations run against the entire set + if ( raw ) { + fn.call( elems, value ); + fn = null; + + // ...except when executing function values + } else { + bulk = fn; + fn = function( elem, _key, value ) { + return bulk.call( jQuery( elem ), value ); + }; + } + } + + if ( fn ) { + for ( ; i < len; i++ ) { + fn( + elems[ i ], key, raw ? + value : + value.call( elems[ i ], i, fn( elems[ i ], key ) ) + ); + } + } + } + + if ( chainable ) { + return elems; + } + + // Gets + if ( bulk ) { + return fn.call( elems ); + } + + return len ? fn( elems[ 0 ], key ) : emptyGet; +}; + + +// Matches dashed string for camelizing +var rmsPrefix = /^-ms-/, + rdashAlpha = /-([a-z])/g; + +// Used by camelCase as callback to replace() +function fcamelCase( _all, letter ) { + return letter.toUpperCase(); +} + +// Convert dashed to camelCase; used by the css and data modules +// Support: IE <=9 - 11, Edge 12 - 15 +// Microsoft forgot to hump their vendor prefix (trac-9572) +function camelCase( string ) { + return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); +} +var acceptData = function( owner ) { + + // Accepts only: + // - Node + // - Node.ELEMENT_NODE + // - Node.DOCUMENT_NODE + // - Object + // - Any + return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); +}; + + + + +function Data() { + this.expando = jQuery.expando + Data.uid++; +} + +Data.uid = 1; + +Data.prototype = { + + cache: function( owner ) { + + // Check if the owner object already has a cache + var value = owner[ this.expando ]; + + // If not, create one + if ( !value ) { + value = {}; + + // We can accept data for non-element nodes in modern browsers, + // but we should not, see trac-8335. + // Always return an empty object. + if ( acceptData( owner ) ) { + + // If it is a node unlikely to be stringify-ed or looped over + // use plain assignment + if ( owner.nodeType ) { + owner[ this.expando ] = value; + + // Otherwise secure it in a non-enumerable property + // configurable must be true to allow the property to be + // deleted when data is removed + } else { + Object.defineProperty( owner, this.expando, { + value: value, + configurable: true + } ); + } + } + } + + return value; + }, + set: function( owner, data, value ) { + var prop, + cache = this.cache( owner ); + + // Handle: [ owner, key, value ] args + // Always use camelCase key (gh-2257) + if ( typeof data === "string" ) { + cache[ camelCase( data ) ] = value; + + // Handle: [ owner, { properties } ] args + } else { + + // Copy the properties one-by-one to the cache object + for ( prop in data ) { + cache[ camelCase( prop ) ] = data[ prop ]; + } + } + return cache; + }, + get: function( owner, key ) { + return key === undefined ? + this.cache( owner ) : + + // Always use camelCase key (gh-2257) + owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ]; + }, + access: function( owner, key, value ) { + + // In cases where either: + // + // 1. No key was specified + // 2. A string key was specified, but no value provided + // + // Take the "read" path and allow the get method to determine + // which value to return, respectively either: + // + // 1. The entire cache object + // 2. The data stored at the key + // + if ( key === undefined || + ( ( key && typeof key === "string" ) && value === undefined ) ) { + + return this.get( owner, key ); + } + + // When the key is not a string, or both a key and value + // are specified, set or extend (existing objects) with either: + // + // 1. An object of properties + // 2. A key and value + // + this.set( owner, key, value ); + + // Since the "set" path can have two possible entry points + // return the expected data based on which path was taken[*] + return value !== undefined ? value : key; + }, + remove: function( owner, key ) { + var i, + cache = owner[ this.expando ]; + + if ( cache === undefined ) { + return; + } + + if ( key !== undefined ) { + + // Support array or space separated string of keys + if ( Array.isArray( key ) ) { + + // If key is an array of keys... + // We always set camelCase keys, so remove that. + key = key.map( camelCase ); + } else { + key = camelCase( key ); + + // If a key with the spaces exists, use it. + // Otherwise, create an array by matching non-whitespace + key = key in cache ? + [ key ] : + ( key.match( rnothtmlwhite ) || [] ); + } + + i = key.length; + + while ( i-- ) { + delete cache[ key[ i ] ]; + } + } + + // Remove the expando if there's no more data + if ( key === undefined || jQuery.isEmptyObject( cache ) ) { + + // Support: Chrome <=35 - 45 + // Webkit & Blink performance suffers when deleting properties + // from DOM nodes, so set to undefined instead + // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) + if ( owner.nodeType ) { + owner[ this.expando ] = undefined; + } else { + delete owner[ this.expando ]; + } + } + }, + hasData: function( owner ) { + var cache = owner[ this.expando ]; + return cache !== undefined && !jQuery.isEmptyObject( cache ); + } +}; +var dataPriv = new Data(); + +var dataUser = new Data(); + + + +// Implementation Summary +// +// 1. Enforce API surface and semantic compatibility with 1.9.x branch +// 2. Improve the module's maintainability by reducing the storage +// paths to a single mechanism. +// 3. Use the same single mechanism to support "private" and "user" data. +// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) +// 5. Avoid exposing implementation details on user objects (eg. expando properties) +// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 + +var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, + rmultiDash = /[A-Z]/g; + +function getData( data ) { + if ( data === "true" ) { + return true; + } + + if ( data === "false" ) { + return false; + } + + if ( data === "null" ) { + return null; + } + + // Only convert to a number if it doesn't change the string + if ( data === +data + "" ) { + return +data; + } + + if ( rbrace.test( data ) ) { + return JSON.parse( data ); + } + + return data; +} + +function dataAttr( elem, key, data ) { + var name; + + // If nothing was found internally, try to fetch any + // data from the HTML5 data-* attribute + if ( data === undefined && elem.nodeType === 1 ) { + name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); + data = elem.getAttribute( name ); + + if ( typeof data === "string" ) { + try { + data = getData( data ); + } catch ( e ) {} + + // Make sure we set the data so it isn't changed later + dataUser.set( elem, key, data ); + } else { + data = undefined; + } + } + return data; +} + +jQuery.extend( { + hasData: function( elem ) { + return dataUser.hasData( elem ) || dataPriv.hasData( elem ); + }, + + data: function( elem, name, data ) { + return dataUser.access( elem, name, data ); + }, + + removeData: function( elem, name ) { + dataUser.remove( elem, name ); + }, + + // TODO: Now that all calls to _data and _removeData have been replaced + // with direct calls to dataPriv methods, these can be deprecated. + _data: function( elem, name, data ) { + return dataPriv.access( elem, name, data ); + }, + + _removeData: function( elem, name ) { + dataPriv.remove( elem, name ); + } +} ); + +jQuery.fn.extend( { + data: function( key, value ) { + var i, name, data, + elem = this[ 0 ], + attrs = elem && elem.attributes; + + // Gets all values + if ( key === undefined ) { + if ( this.length ) { + data = dataUser.get( elem ); + + if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { + i = attrs.length; + while ( i-- ) { + + // Support: IE 11 only + // The attrs elements can be null (trac-14894) + if ( attrs[ i ] ) { + name = attrs[ i ].name; + if ( name.indexOf( "data-" ) === 0 ) { + name = camelCase( name.slice( 5 ) ); + dataAttr( elem, name, data[ name ] ); + } + } + } + dataPriv.set( elem, "hasDataAttrs", true ); + } + } + + return data; + } + + // Sets multiple values + if ( typeof key === "object" ) { + return this.each( function() { + dataUser.set( this, key ); + } ); + } + + return access( this, function( value ) { + var data; + + // The calling jQuery object (element matches) is not empty + // (and therefore has an element appears at this[ 0 ]) and the + // `value` parameter was not undefined. An empty jQuery object + // will result in `undefined` for elem = this[ 0 ] which will + // throw an exception if an attempt to read a data cache is made. + if ( elem && value === undefined ) { + + // Attempt to get data from the cache + // The key will always be camelCased in Data + data = dataUser.get( elem, key ); + if ( data !== undefined ) { + return data; + } + + // Attempt to "discover" the data in + // HTML5 custom data-* attrs + data = dataAttr( elem, key ); + if ( data !== undefined ) { + return data; + } + + // We tried really hard, but the data doesn't exist. + return; + } + + // Set the data... + this.each( function() { + + // We always store the camelCased key + dataUser.set( this, key, value ); + } ); + }, null, value, arguments.length > 1, null, true ); + }, + + removeData: function( key ) { + return this.each( function() { + dataUser.remove( this, key ); + } ); + } +} ); + + +jQuery.extend( { + queue: function( elem, type, data ) { + var queue; + + if ( elem ) { + type = ( type || "fx" ) + "queue"; + queue = dataPriv.get( elem, type ); + + // Speed up dequeue by getting out quickly if this is just a lookup + if ( data ) { + if ( !queue || Array.isArray( data ) ) { + queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); + } else { + queue.push( data ); + } + } + return queue || []; + } + }, + + dequeue: function( elem, type ) { + type = type || "fx"; + + var queue = jQuery.queue( elem, type ), + startLength = queue.length, + fn = queue.shift(), + hooks = jQuery._queueHooks( elem, type ), + next = function() { + jQuery.dequeue( elem, type ); + }; + + // If the fx queue is dequeued, always remove the progress sentinel + if ( fn === "inprogress" ) { + fn = queue.shift(); + startLength--; + } + + if ( fn ) { + + // Add a progress sentinel to prevent the fx queue from being + // automatically dequeued + if ( type === "fx" ) { + queue.unshift( "inprogress" ); + } + + // Clear up the last queue stop function + delete hooks.stop; + fn.call( elem, next, hooks ); + } + + if ( !startLength && hooks ) { + hooks.empty.fire(); + } + }, + + // Not public - generate a queueHooks object, or return the current one + _queueHooks: function( elem, type ) { + var key = type + "queueHooks"; + return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { + empty: jQuery.Callbacks( "once memory" ).add( function() { + dataPriv.remove( elem, [ type + "queue", key ] ); + } ) + } ); + } +} ); + +jQuery.fn.extend( { + queue: function( type, data ) { + var setter = 2; + + if ( typeof type !== "string" ) { + data = type; + type = "fx"; + setter--; + } + + if ( arguments.length < setter ) { + return jQuery.queue( this[ 0 ], type ); + } + + return data === undefined ? + this : + this.each( function() { + var queue = jQuery.queue( this, type, data ); + + // Ensure a hooks for this queue + jQuery._queueHooks( this, type ); + + if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { + jQuery.dequeue( this, type ); + } + } ); + }, + dequeue: function( type ) { + return this.each( function() { + jQuery.dequeue( this, type ); + } ); + }, + clearQueue: function( type ) { + return this.queue( type || "fx", [] ); + }, + + // Get a promise resolved when queues of a certain type + // are emptied (fx is the type by default) + promise: function( type, obj ) { + var tmp, + count = 1, + defer = jQuery.Deferred(), + elements = this, + i = this.length, + resolve = function() { + if ( !( --count ) ) { + defer.resolveWith( elements, [ elements ] ); + } + }; + + if ( typeof type !== "string" ) { + obj = type; + type = undefined; + } + type = type || "fx"; + + while ( i-- ) { + tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); + if ( tmp && tmp.empty ) { + count++; + tmp.empty.add( resolve ); + } + } + resolve(); + return defer.promise( obj ); + } +} ); +var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; + +var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); + + +var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; + +var documentElement = document.documentElement; + + + + var isAttached = function( elem ) { + return jQuery.contains( elem.ownerDocument, elem ); + }, + composed = { composed: true }; + + // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only + // Check attachment across shadow DOM boundaries when possible (gh-3504) + // Support: iOS 10.0-10.2 only + // Early iOS 10 versions support `attachShadow` but not `getRootNode`, + // leading to errors. We need to check for `getRootNode`. + if ( documentElement.getRootNode ) { + isAttached = function( elem ) { + return jQuery.contains( elem.ownerDocument, elem ) || + elem.getRootNode( composed ) === elem.ownerDocument; + }; + } +var isHiddenWithinTree = function( elem, el ) { + + // isHiddenWithinTree might be called from jQuery#filter function; + // in that case, element will be second argument + elem = el || elem; + + // Inline style trumps all + return elem.style.display === "none" || + elem.style.display === "" && + + // Otherwise, check computed style + // Support: Firefox <=43 - 45 + // Disconnected elements can have computed display: none, so first confirm that elem is + // in the document. + isAttached( elem ) && + + jQuery.css( elem, "display" ) === "none"; + }; + + + +function adjustCSS( elem, prop, valueParts, tween ) { + var adjusted, scale, + maxIterations = 20, + currentValue = tween ? + function() { + return tween.cur(); + } : + function() { + return jQuery.css( elem, prop, "" ); + }, + initial = currentValue(), + unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), + + // Starting value computation is required for potential unit mismatches + initialInUnit = elem.nodeType && + ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && + rcssNum.exec( jQuery.css( elem, prop ) ); + + if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { + + // Support: Firefox <=54 + // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) + initial = initial / 2; + + // Trust units reported by jQuery.css + unit = unit || initialInUnit[ 3 ]; + + // Iteratively approximate from a nonzero starting point + initialInUnit = +initial || 1; + + while ( maxIterations-- ) { + + // Evaluate and update our best guess (doubling guesses that zero out). + // Finish if the scale equals or crosses 1 (making the old*new product non-positive). + jQuery.style( elem, prop, initialInUnit + unit ); + if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) { + maxIterations = 0; + } + initialInUnit = initialInUnit / scale; + + } + + initialInUnit = initialInUnit * 2; + jQuery.style( elem, prop, initialInUnit + unit ); + + // Make sure we update the tween properties later on + valueParts = valueParts || []; + } + + if ( valueParts ) { + initialInUnit = +initialInUnit || +initial || 0; + + // Apply relative offset (+=/-=) if specified + adjusted = valueParts[ 1 ] ? + initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : + +valueParts[ 2 ]; + if ( tween ) { + tween.unit = unit; + tween.start = initialInUnit; + tween.end = adjusted; + } + } + return adjusted; +} + + +var defaultDisplayMap = {}; + +function getDefaultDisplay( elem ) { + var temp, + doc = elem.ownerDocument, + nodeName = elem.nodeName, + display = defaultDisplayMap[ nodeName ]; + + if ( display ) { + return display; + } + + temp = doc.body.appendChild( doc.createElement( nodeName ) ); + display = jQuery.css( temp, "display" ); + + temp.parentNode.removeChild( temp ); + + if ( display === "none" ) { + display = "block"; + } + defaultDisplayMap[ nodeName ] = display; + + return display; +} + +function showHide( elements, show ) { + var display, elem, + values = [], + index = 0, + length = elements.length; + + // Determine new display value for elements that need to change + for ( ; index < length; index++ ) { + elem = elements[ index ]; + if ( !elem.style ) { + continue; + } + + display = elem.style.display; + if ( show ) { + + // Since we force visibility upon cascade-hidden elements, an immediate (and slow) + // check is required in this first loop unless we have a nonempty display value (either + // inline or about-to-be-restored) + if ( display === "none" ) { + values[ index ] = dataPriv.get( elem, "display" ) || null; + if ( !values[ index ] ) { + elem.style.display = ""; + } + } + if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { + values[ index ] = getDefaultDisplay( elem ); + } + } else { + if ( display !== "none" ) { + values[ index ] = "none"; + + // Remember what we're overwriting + dataPriv.set( elem, "display", display ); + } + } + } + + // Set the display of the elements in a second loop to avoid constant reflow + for ( index = 0; index < length; index++ ) { + if ( values[ index ] != null ) { + elements[ index ].style.display = values[ index ]; + } + } + + return elements; +} + +jQuery.fn.extend( { + show: function() { + return showHide( this, true ); + }, + hide: function() { + return showHide( this ); + }, + toggle: function( state ) { + if ( typeof state === "boolean" ) { + return state ? this.show() : this.hide(); + } + + return this.each( function() { + if ( isHiddenWithinTree( this ) ) { + jQuery( this ).show(); + } else { + jQuery( this ).hide(); + } + } ); + } +} ); +var rcheckableType = ( /^(?:checkbox|radio)$/i ); + +var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i ); + +var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); + + + +( function() { + var fragment = document.createDocumentFragment(), + div = fragment.appendChild( document.createElement( "div" ) ), + input = document.createElement( "input" ); + + // Support: Android 4.0 - 4.3 only + // Check state lost if the name is set (trac-11217) + // Support: Windows Web Apps (WWA) + // `name` and `type` must use .setAttribute for WWA (trac-14901) + input.setAttribute( "type", "radio" ); + input.setAttribute( "checked", "checked" ); + input.setAttribute( "name", "t" ); + + div.appendChild( input ); + + // Support: Android <=4.1 only + // Older WebKit doesn't clone checked state correctly in fragments + support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; + + // Support: IE <=11 only + // Make sure textarea (and checkbox) defaultValue is properly cloned + div.innerHTML = "<textarea>x</textarea>"; + support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; + + // Support: IE <=9 only + // IE <=9 replaces <option> tags with their contents when inserted outside of + // the select element. + div.innerHTML = "<option></option>"; + support.option = !!div.lastChild; +} )(); + + +// We have to close these tags to support XHTML (trac-13200) +var wrapMap = { + + // XHTML parsers do not magically insert elements in the + // same way that tag soup parsers do. So we cannot shorten + // this by omitting <tbody> or other required elements. + thead: [ 1, "<table>", "</table>" ], + col: [ 2, "<table><colgroup>", "</colgroup></table>" ], + tr: [ 2, "<table><tbody>", "</tbody></table>" ], + td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], + + _default: [ 0, "", "" ] +}; + +wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; +wrapMap.th = wrapMap.td; + +// Support: IE <=9 only +if ( !support.option ) { + wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ]; +} + + +function getAll( context, tag ) { + + // Support: IE <=9 - 11 only + // Use typeof to avoid zero-argument method invocation on host objects (trac-15151) + var ret; + + if ( typeof context.getElementsByTagName !== "undefined" ) { + ret = context.getElementsByTagName( tag || "*" ); + + } else if ( typeof context.querySelectorAll !== "undefined" ) { + ret = context.querySelectorAll( tag || "*" ); + + } else { + ret = []; + } + + if ( tag === undefined || tag && nodeName( context, tag ) ) { + return jQuery.merge( [ context ], ret ); + } + + return ret; +} + + +// Mark scripts as having already been evaluated +function setGlobalEval( elems, refElements ) { + var i = 0, + l = elems.length; + + for ( ; i < l; i++ ) { + dataPriv.set( + elems[ i ], + "globalEval", + !refElements || dataPriv.get( refElements[ i ], "globalEval" ) + ); + } +} + + +var rhtml = /<|&#?\w+;/; + +function buildFragment( elems, context, scripts, selection, ignored ) { + var elem, tmp, tag, wrap, attached, j, + fragment = context.createDocumentFragment(), + nodes = [], + i = 0, + l = elems.length; + + for ( ; i < l; i++ ) { + elem = elems[ i ]; + + if ( elem || elem === 0 ) { + + // Add nodes directly + if ( toType( elem ) === "object" ) { + + // Support: Android <=4.0 only, PhantomJS 1 only + // push.apply(_, arraylike) throws on ancient WebKit + jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); + + // Convert non-html into a text node + } else if ( !rhtml.test( elem ) ) { + nodes.push( context.createTextNode( elem ) ); + + // Convert html into DOM nodes + } else { + tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); + + // Deserialize a standard representation + tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); + wrap = wrapMap[ tag ] || wrapMap._default; + tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; + + // Descend through wrappers to the right content + j = wrap[ 0 ]; + while ( j-- ) { + tmp = tmp.lastChild; + } + + // Support: Android <=4.0 only, PhantomJS 1 only + // push.apply(_, arraylike) throws on ancient WebKit + jQuery.merge( nodes, tmp.childNodes ); + + // Remember the top-level container + tmp = fragment.firstChild; + + // Ensure the created nodes are orphaned (trac-12392) + tmp.textContent = ""; + } + } + } + + // Remove wrapper from fragment + fragment.textContent = ""; + + i = 0; + while ( ( elem = nodes[ i++ ] ) ) { + + // Skip elements already in the context collection (trac-4087) + if ( selection && jQuery.inArray( elem, selection ) > -1 ) { + if ( ignored ) { + ignored.push( elem ); + } + continue; + } + + attached = isAttached( elem ); + + // Append to fragment + tmp = getAll( fragment.appendChild( elem ), "script" ); + + // Preserve script evaluation history + if ( attached ) { + setGlobalEval( tmp ); + } + + // Capture executables + if ( scripts ) { + j = 0; + while ( ( elem = tmp[ j++ ] ) ) { + if ( rscriptType.test( elem.type || "" ) ) { + scripts.push( elem ); + } + } + } + } + + return fragment; +} + + +var rtypenamespace = /^([^.]*)(?:\.(.+)|)/; + +function returnTrue() { + return true; +} + +function returnFalse() { + return false; +} + +// Support: IE <=9 - 11+ +// focus() and blur() are asynchronous, except when they are no-op. +// So expect focus to be synchronous when the element is already active, +// and blur to be synchronous when the element is not already active. +// (focus and blur are always synchronous in other supported browsers, +// this just defines when we can count on it). +function expectSync( elem, type ) { + return ( elem === safeActiveElement() ) === ( type === "focus" ); +} + +// Support: IE <=9 only +// Accessing document.activeElement can throw unexpectedly +// https://bugs.jquery.com/ticket/13393 +function safeActiveElement() { + try { + return document.activeElement; + } catch ( err ) { } +} + +function on( elem, types, selector, data, fn, one ) { + var origFn, type; + + // Types can be a map of types/handlers + if ( typeof types === "object" ) { + + // ( types-Object, selector, data ) + if ( typeof selector !== "string" ) { + + // ( types-Object, data ) + data = data || selector; + selector = undefined; + } + for ( type in types ) { + on( elem, type, selector, data, types[ type ], one ); + } + return elem; + } + + if ( data == null && fn == null ) { + + // ( types, fn ) + fn = selector; + data = selector = undefined; + } else if ( fn == null ) { + if ( typeof selector === "string" ) { + + // ( types, selector, fn ) + fn = data; + data = undefined; + } else { + + // ( types, data, fn ) + fn = data; + data = selector; + selector = undefined; + } + } + if ( fn === false ) { + fn = returnFalse; + } else if ( !fn ) { + return elem; + } + + if ( one === 1 ) { + origFn = fn; + fn = function( event ) { + + // Can use an empty set, since event contains the info + jQuery().off( event ); + return origFn.apply( this, arguments ); + }; + + // Use same guid so caller can remove using origFn + fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); + } + return elem.each( function() { + jQuery.event.add( this, types, fn, data, selector ); + } ); +} + +/* + * Helper functions for managing events -- not part of the public interface. + * Props to Dean Edwards' addEvent library for many of the ideas. + */ +jQuery.event = { + + global: {}, + + add: function( elem, types, handler, data, selector ) { + + var handleObjIn, eventHandle, tmp, + events, t, handleObj, + special, handlers, type, namespaces, origType, + elemData = dataPriv.get( elem ); + + // Only attach events to objects that accept data + if ( !acceptData( elem ) ) { + return; + } + + // Caller can pass in an object of custom data in lieu of the handler + if ( handler.handler ) { + handleObjIn = handler; + handler = handleObjIn.handler; + selector = handleObjIn.selector; + } + + // Ensure that invalid selectors throw exceptions at attach time + // Evaluate against documentElement in case elem is a non-element node (e.g., document) + if ( selector ) { + jQuery.find.matchesSelector( documentElement, selector ); + } + + // Make sure that the handler has a unique ID, used to find/remove it later + if ( !handler.guid ) { + handler.guid = jQuery.guid++; + } + + // Init the element's event structure and main handler, if this is the first + if ( !( events = elemData.events ) ) { + events = elemData.events = Object.create( null ); + } + if ( !( eventHandle = elemData.handle ) ) { + eventHandle = elemData.handle = function( e ) { + + // Discard the second event of a jQuery.event.trigger() and + // when an event is called after a page has unloaded + return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? + jQuery.event.dispatch.apply( elem, arguments ) : undefined; + }; + } + + // Handle multiple events separated by a space + types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[ t ] ) || []; + type = origType = tmp[ 1 ]; + namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); + + // There *must* be a type, no attaching namespace-only handlers + if ( !type ) { + continue; + } + + // If event changes its type, use the special event handlers for the changed type + special = jQuery.event.special[ type ] || {}; + + // If selector defined, determine special event api type, otherwise given type + type = ( selector ? special.delegateType : special.bindType ) || type; + + // Update special based on newly reset type + special = jQuery.event.special[ type ] || {}; + + // handleObj is passed to all event handlers + handleObj = jQuery.extend( { + type: type, + origType: origType, + data: data, + handler: handler, + guid: handler.guid, + selector: selector, + needsContext: selector && jQuery.expr.match.needsContext.test( selector ), + namespace: namespaces.join( "." ) + }, handleObjIn ); + + // Init the event handler queue if we're the first + if ( !( handlers = events[ type ] ) ) { + handlers = events[ type ] = []; + handlers.delegateCount = 0; + + // Only use addEventListener if the special events handler returns false + if ( !special.setup || + special.setup.call( elem, data, namespaces, eventHandle ) === false ) { + + if ( elem.addEventListener ) { + elem.addEventListener( type, eventHandle ); + } + } + } + + if ( special.add ) { + special.add.call( elem, handleObj ); + + if ( !handleObj.handler.guid ) { + handleObj.handler.guid = handler.guid; + } + } + + // Add to the element's handler list, delegates in front + if ( selector ) { + handlers.splice( handlers.delegateCount++, 0, handleObj ); + } else { + handlers.push( handleObj ); + } + + // Keep track of which events have ever been used, for event optimization + jQuery.event.global[ type ] = true; + } + + }, + + // Detach an event or set of events from an element + remove: function( elem, types, handler, selector, mappedTypes ) { + + var j, origCount, tmp, + events, t, handleObj, + special, handlers, type, namespaces, origType, + elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); + + if ( !elemData || !( events = elemData.events ) ) { + return; + } + + // Once for each type.namespace in types; type may be omitted + types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[ t ] ) || []; + type = origType = tmp[ 1 ]; + namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); + + // Unbind all events (on this namespace, if provided) for the element + if ( !type ) { + for ( type in events ) { + jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); + } + continue; + } + + special = jQuery.event.special[ type ] || {}; + type = ( selector ? special.delegateType : special.bindType ) || type; + handlers = events[ type ] || []; + tmp = tmp[ 2 ] && + new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); + + // Remove matching events + origCount = j = handlers.length; + while ( j-- ) { + handleObj = handlers[ j ]; + + if ( ( mappedTypes || origType === handleObj.origType ) && + ( !handler || handler.guid === handleObj.guid ) && + ( !tmp || tmp.test( handleObj.namespace ) ) && + ( !selector || selector === handleObj.selector || + selector === "**" && handleObj.selector ) ) { + handlers.splice( j, 1 ); + + if ( handleObj.selector ) { + handlers.delegateCount--; + } + if ( special.remove ) { + special.remove.call( elem, handleObj ); + } + } + } + + // Remove generic event handler if we removed something and no more handlers exist + // (avoids potential for endless recursion during removal of special event handlers) + if ( origCount && !handlers.length ) { + if ( !special.teardown || + special.teardown.call( elem, namespaces, elemData.handle ) === false ) { + + jQuery.removeEvent( elem, type, elemData.handle ); + } + + delete events[ type ]; + } + } + + // Remove data and the expando if it's no longer used + if ( jQuery.isEmptyObject( events ) ) { + dataPriv.remove( elem, "handle events" ); + } + }, + + dispatch: function( nativeEvent ) { + + var i, j, ret, matched, handleObj, handlerQueue, + args = new Array( arguments.length ), + + // Make a writable jQuery.Event from the native event object + event = jQuery.event.fix( nativeEvent ), + + handlers = ( + dataPriv.get( this, "events" ) || Object.create( null ) + )[ event.type ] || [], + special = jQuery.event.special[ event.type ] || {}; + + // Use the fix-ed jQuery.Event rather than the (read-only) native event + args[ 0 ] = event; + + for ( i = 1; i < arguments.length; i++ ) { + args[ i ] = arguments[ i ]; + } + + event.delegateTarget = this; + + // Call the preDispatch hook for the mapped type, and let it bail if desired + if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { + return; + } + + // Determine handlers + handlerQueue = jQuery.event.handlers.call( this, event, handlers ); + + // Run delegates first; they may want to stop propagation beneath us + i = 0; + while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { + event.currentTarget = matched.elem; + + j = 0; + while ( ( handleObj = matched.handlers[ j++ ] ) && + !event.isImmediatePropagationStopped() ) { + + // If the event is namespaced, then each handler is only invoked if it is + // specially universal or its namespaces are a superset of the event's. + if ( !event.rnamespace || handleObj.namespace === false || + event.rnamespace.test( handleObj.namespace ) ) { + + event.handleObj = handleObj; + event.data = handleObj.data; + + ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || + handleObj.handler ).apply( matched.elem, args ); + + if ( ret !== undefined ) { + if ( ( event.result = ret ) === false ) { + event.preventDefault(); + event.stopPropagation(); + } + } + } + } + } + + // Call the postDispatch hook for the mapped type + if ( special.postDispatch ) { + special.postDispatch.call( this, event ); + } + + return event.result; + }, + + handlers: function( event, handlers ) { + var i, handleObj, sel, matchedHandlers, matchedSelectors, + handlerQueue = [], + delegateCount = handlers.delegateCount, + cur = event.target; + + // Find delegate handlers + if ( delegateCount && + + // Support: IE <=9 + // Black-hole SVG <use> instance trees (trac-13180) + cur.nodeType && + + // Support: Firefox <=42 + // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) + // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click + // Support: IE 11 only + // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) + !( event.type === "click" && event.button >= 1 ) ) { + + for ( ; cur !== this; cur = cur.parentNode || this ) { + + // Don't check non-elements (trac-13208) + // Don't process clicks on disabled elements (trac-6911, trac-8165, trac-11382, trac-11764) + if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { + matchedHandlers = []; + matchedSelectors = {}; + for ( i = 0; i < delegateCount; i++ ) { + handleObj = handlers[ i ]; + + // Don't conflict with Object.prototype properties (trac-13203) + sel = handleObj.selector + " "; + + if ( matchedSelectors[ sel ] === undefined ) { + matchedSelectors[ sel ] = handleObj.needsContext ? + jQuery( sel, this ).index( cur ) > -1 : + jQuery.find( sel, this, null, [ cur ] ).length; + } + if ( matchedSelectors[ sel ] ) { + matchedHandlers.push( handleObj ); + } + } + if ( matchedHandlers.length ) { + handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); + } + } + } + } + + // Add the remaining (directly-bound) handlers + cur = this; + if ( delegateCount < handlers.length ) { + handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); + } + + return handlerQueue; + }, + + addProp: function( name, hook ) { + Object.defineProperty( jQuery.Event.prototype, name, { + enumerable: true, + configurable: true, + + get: isFunction( hook ) ? + function() { + if ( this.originalEvent ) { + return hook( this.originalEvent ); + } + } : + function() { + if ( this.originalEvent ) { + return this.originalEvent[ name ]; + } + }, + + set: function( value ) { + Object.defineProperty( this, name, { + enumerable: true, + configurable: true, + writable: true, + value: value + } ); + } + } ); + }, + + fix: function( originalEvent ) { + return originalEvent[ jQuery.expando ] ? + originalEvent : + new jQuery.Event( originalEvent ); + }, + + special: { + load: { + + // Prevent triggered image.load events from bubbling to window.load + noBubble: true + }, + click: { + + // Utilize native event to ensure correct state for checkable inputs + setup: function( data ) { + + // For mutual compressibility with _default, replace `this` access with a local var. + // `|| data` is dead code meant only to preserve the variable through minification. + var el = this || data; + + // Claim the first handler + if ( rcheckableType.test( el.type ) && + el.click && nodeName( el, "input" ) ) { + + // dataPriv.set( el, "click", ... ) + leverageNative( el, "click", returnTrue ); + } + + // Return false to allow normal processing in the caller + return false; + }, + trigger: function( data ) { + + // For mutual compressibility with _default, replace `this` access with a local var. + // `|| data` is dead code meant only to preserve the variable through minification. + var el = this || data; + + // Force setup before triggering a click + if ( rcheckableType.test( el.type ) && + el.click && nodeName( el, "input" ) ) { + + leverageNative( el, "click" ); + } + + // Return non-false to allow normal event-path propagation + return true; + }, + + // For cross-browser consistency, suppress native .click() on links + // Also prevent it if we're currently inside a leveraged native-event stack + _default: function( event ) { + var target = event.target; + return rcheckableType.test( target.type ) && + target.click && nodeName( target, "input" ) && + dataPriv.get( target, "click" ) || + nodeName( target, "a" ); + } + }, + + beforeunload: { + postDispatch: function( event ) { + + // Support: Firefox 20+ + // Firefox doesn't alert if the returnValue field is not set. + if ( event.result !== undefined && event.originalEvent ) { + event.originalEvent.returnValue = event.result; + } + } + } + } +}; + +// Ensure the presence of an event listener that handles manually-triggered +// synthetic events by interrupting progress until reinvoked in response to +// *native* events that it fires directly, ensuring that state changes have +// already occurred before other listeners are invoked. +function leverageNative( el, type, expectSync ) { + + // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add + if ( !expectSync ) { + if ( dataPriv.get( el, type ) === undefined ) { + jQuery.event.add( el, type, returnTrue ); + } + return; + } + + // Register the controller as a special universal handler for all event namespaces + dataPriv.set( el, type, false ); + jQuery.event.add( el, type, { + namespace: false, + handler: function( event ) { + var notAsync, result, + saved = dataPriv.get( this, type ); + + if ( ( event.isTrigger & 1 ) && this[ type ] ) { + + // Interrupt processing of the outer synthetic .trigger()ed event + // Saved data should be false in such cases, but might be a leftover capture object + // from an async native handler (gh-4350) + if ( !saved.length ) { + + // Store arguments for use when handling the inner native event + // There will always be at least one argument (an event object), so this array + // will not be confused with a leftover capture object. + saved = slice.call( arguments ); + dataPriv.set( this, type, saved ); + + // Trigger the native event and capture its result + // Support: IE <=9 - 11+ + // focus() and blur() are asynchronous + notAsync = expectSync( this, type ); + this[ type ](); + result = dataPriv.get( this, type ); + if ( saved !== result || notAsync ) { + dataPriv.set( this, type, false ); + } else { + result = {}; + } + if ( saved !== result ) { + + // Cancel the outer synthetic event + event.stopImmediatePropagation(); + event.preventDefault(); + + // Support: Chrome 86+ + // In Chrome, if an element having a focusout handler is blurred by + // clicking outside of it, it invokes the handler synchronously. If + // that handler calls `.remove()` on the element, the data is cleared, + // leaving `result` undefined. We need to guard against this. + return result && result.value; + } + + // If this is an inner synthetic event for an event with a bubbling surrogate + // (focus or blur), assume that the surrogate already propagated from triggering the + // native event and prevent that from happening again here. + // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the + // bubbling surrogate propagates *after* the non-bubbling base), but that seems + // less bad than duplication. + } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) { + event.stopPropagation(); + } + + // If this is a native event triggered above, everything is now in order + // Fire an inner synthetic event with the original arguments + } else if ( saved.length ) { + + // ...and capture the result + dataPriv.set( this, type, { + value: jQuery.event.trigger( + + // Support: IE <=9 - 11+ + // Extend with the prototype to reset the above stopImmediatePropagation() + jQuery.extend( saved[ 0 ], jQuery.Event.prototype ), + saved.slice( 1 ), + this + ) + } ); + + // Abort handling of the native event + event.stopImmediatePropagation(); + } + } + } ); +} + +jQuery.removeEvent = function( elem, type, handle ) { + + // This "if" is needed for plain objects + if ( elem.removeEventListener ) { + elem.removeEventListener( type, handle ); + } +}; + +jQuery.Event = function( src, props ) { + + // Allow instantiation without the 'new' keyword + if ( !( this instanceof jQuery.Event ) ) { + return new jQuery.Event( src, props ); + } + + // Event object + if ( src && src.type ) { + this.originalEvent = src; + this.type = src.type; + + // Events bubbling up the document may have been marked as prevented + // by a handler lower down the tree; reflect the correct value. + this.isDefaultPrevented = src.defaultPrevented || + src.defaultPrevented === undefined && + + // Support: Android <=2.3 only + src.returnValue === false ? + returnTrue : + returnFalse; + + // Create target properties + // Support: Safari <=6 - 7 only + // Target should not be a text node (trac-504, trac-13143) + this.target = ( src.target && src.target.nodeType === 3 ) ? + src.target.parentNode : + src.target; + + this.currentTarget = src.currentTarget; + this.relatedTarget = src.relatedTarget; + + // Event type + } else { + this.type = src; + } + + // Put explicitly provided properties onto the event object + if ( props ) { + jQuery.extend( this, props ); + } + + // Create a timestamp if incoming event doesn't have one + this.timeStamp = src && src.timeStamp || Date.now(); + + // Mark it as fixed + this[ jQuery.expando ] = true; +}; + +// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding +// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html +jQuery.Event.prototype = { + constructor: jQuery.Event, + isDefaultPrevented: returnFalse, + isPropagationStopped: returnFalse, + isImmediatePropagationStopped: returnFalse, + isSimulated: false, + + preventDefault: function() { + var e = this.originalEvent; + + this.isDefaultPrevented = returnTrue; + + if ( e && !this.isSimulated ) { + e.preventDefault(); + } + }, + stopPropagation: function() { + var e = this.originalEvent; + + this.isPropagationStopped = returnTrue; + + if ( e && !this.isSimulated ) { + e.stopPropagation(); + } + }, + stopImmediatePropagation: function() { + var e = this.originalEvent; + + this.isImmediatePropagationStopped = returnTrue; + + if ( e && !this.isSimulated ) { + e.stopImmediatePropagation(); + } + + this.stopPropagation(); + } +}; + +// Includes all common event props including KeyEvent and MouseEvent specific props +jQuery.each( { + altKey: true, + bubbles: true, + cancelable: true, + changedTouches: true, + ctrlKey: true, + detail: true, + eventPhase: true, + metaKey: true, + pageX: true, + pageY: true, + shiftKey: true, + view: true, + "char": true, + code: true, + charCode: true, + key: true, + keyCode: true, + button: true, + buttons: true, + clientX: true, + clientY: true, + offsetX: true, + offsetY: true, + pointerId: true, + pointerType: true, + screenX: true, + screenY: true, + targetTouches: true, + toElement: true, + touches: true, + which: true +}, jQuery.event.addProp ); + +jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { + jQuery.event.special[ type ] = { + + // Utilize native event if possible so blur/focus sequence is correct + setup: function() { + + // Claim the first handler + // dataPriv.set( this, "focus", ... ) + // dataPriv.set( this, "blur", ... ) + leverageNative( this, type, expectSync ); + + // Return false to allow normal processing in the caller + return false; + }, + trigger: function() { + + // Force setup before trigger + leverageNative( this, type ); + + // Return non-false to allow normal event-path propagation + return true; + }, + + // Suppress native focus or blur if we're currently inside + // a leveraged native-event stack + _default: function( event ) { + return dataPriv.get( event.target, type ); + }, + + delegateType: delegateType + }; +} ); + +// Create mouseenter/leave events using mouseover/out and event-time checks +// so that event delegation works in jQuery. +// Do the same for pointerenter/pointerleave and pointerover/pointerout +// +// Support: Safari 7 only +// Safari sends mouseenter too often; see: +// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 +// for the description of the bug (it existed in older Chrome versions as well). +jQuery.each( { + mouseenter: "mouseover", + mouseleave: "mouseout", + pointerenter: "pointerover", + pointerleave: "pointerout" +}, function( orig, fix ) { + jQuery.event.special[ orig ] = { + delegateType: fix, + bindType: fix, + + handle: function( event ) { + var ret, + target = this, + related = event.relatedTarget, + handleObj = event.handleObj; + + // For mouseenter/leave call the handler if related is outside the target. + // NB: No relatedTarget if the mouse left/entered the browser window + if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { + event.type = handleObj.origType; + ret = handleObj.handler.apply( this, arguments ); + event.type = fix; + } + return ret; + } + }; +} ); + +jQuery.fn.extend( { + + on: function( types, selector, data, fn ) { + return on( this, types, selector, data, fn ); + }, + one: function( types, selector, data, fn ) { + return on( this, types, selector, data, fn, 1 ); + }, + off: function( types, selector, fn ) { + var handleObj, type; + if ( types && types.preventDefault && types.handleObj ) { + + // ( event ) dispatched jQuery.Event + handleObj = types.handleObj; + jQuery( types.delegateTarget ).off( + handleObj.namespace ? + handleObj.origType + "." + handleObj.namespace : + handleObj.origType, + handleObj.selector, + handleObj.handler + ); + return this; + } + if ( typeof types === "object" ) { + + // ( types-object [, selector] ) + for ( type in types ) { + this.off( type, selector, types[ type ] ); + } + return this; + } + if ( selector === false || typeof selector === "function" ) { + + // ( types [, fn] ) + fn = selector; + selector = undefined; + } + if ( fn === false ) { + fn = returnFalse; + } + return this.each( function() { + jQuery.event.remove( this, types, fn, selector ); + } ); + } +} ); + + +var + + // Support: IE <=10 - 11, Edge 12 - 13 only + // In IE/Edge using regex groups here causes severe slowdowns. + // See https://connect.microsoft.com/IE/feedback/details/1736512/ + rnoInnerhtml = /<script|<style|<link/i, + + // checked="checked" or checked + rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, + + rcleanScript = /^\s*<!\[CDATA\[|\]\]>\s*$/g; + +// Prefer a tbody over its parent table for containing new rows +function manipulationTarget( elem, content ) { + if ( nodeName( elem, "table" ) && + nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { + + return jQuery( elem ).children( "tbody" )[ 0 ] || elem; + } + + return elem; +} + +// Replace/restore the type attribute of script elements for safe DOM manipulation +function disableScript( elem ) { + elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; + return elem; +} +function restoreScript( elem ) { + if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { + elem.type = elem.type.slice( 5 ); + } else { + elem.removeAttribute( "type" ); + } + + return elem; +} + +function cloneCopyEvent( src, dest ) { + var i, l, type, pdataOld, udataOld, udataCur, events; + + if ( dest.nodeType !== 1 ) { + return; + } + + // 1. Copy private data: events, handlers, etc. + if ( dataPriv.hasData( src ) ) { + pdataOld = dataPriv.get( src ); + events = pdataOld.events; + + if ( events ) { + dataPriv.remove( dest, "handle events" ); + + for ( type in events ) { + for ( i = 0, l = events[ type ].length; i < l; i++ ) { + jQuery.event.add( dest, type, events[ type ][ i ] ); + } + } + } + } + + // 2. Copy user data + if ( dataUser.hasData( src ) ) { + udataOld = dataUser.access( src ); + udataCur = jQuery.extend( {}, udataOld ); + + dataUser.set( dest, udataCur ); + } +} + +// Fix IE bugs, see support tests +function fixInput( src, dest ) { + var nodeName = dest.nodeName.toLowerCase(); + + // Fails to persist the checked state of a cloned checkbox or radio button. + if ( nodeName === "input" && rcheckableType.test( src.type ) ) { + dest.checked = src.checked; + + // Fails to return the selected option to the default selected state when cloning options + } else if ( nodeName === "input" || nodeName === "textarea" ) { + dest.defaultValue = src.defaultValue; + } +} + +function domManip( collection, args, callback, ignored ) { + + // Flatten any nested arrays + args = flat( args ); + + var fragment, first, scripts, hasScripts, node, doc, + i = 0, + l = collection.length, + iNoClone = l - 1, + value = args[ 0 ], + valueIsFunction = isFunction( value ); + + // We can't cloneNode fragments that contain checked, in WebKit + if ( valueIsFunction || + ( l > 1 && typeof value === "string" && + !support.checkClone && rchecked.test( value ) ) ) { + return collection.each( function( index ) { + var self = collection.eq( index ); + if ( valueIsFunction ) { + args[ 0 ] = value.call( this, index, self.html() ); + } + domManip( self, args, callback, ignored ); + } ); + } + + if ( l ) { + fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); + first = fragment.firstChild; + + if ( fragment.childNodes.length === 1 ) { + fragment = first; + } + + // Require either new content or an interest in ignored elements to invoke the callback + if ( first || ignored ) { + scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); + hasScripts = scripts.length; + + // Use the original fragment for the last item + // instead of the first because it can end up + // being emptied incorrectly in certain situations (trac-8070). + for ( ; i < l; i++ ) { + node = fragment; + + if ( i !== iNoClone ) { + node = jQuery.clone( node, true, true ); + + // Keep references to cloned scripts for later restoration + if ( hasScripts ) { + + // Support: Android <=4.0 only, PhantomJS 1 only + // push.apply(_, arraylike) throws on ancient WebKit + jQuery.merge( scripts, getAll( node, "script" ) ); + } + } + + callback.call( collection[ i ], node, i ); + } + + if ( hasScripts ) { + doc = scripts[ scripts.length - 1 ].ownerDocument; + + // Reenable scripts + jQuery.map( scripts, restoreScript ); + + // Evaluate executable scripts on first document insertion + for ( i = 0; i < hasScripts; i++ ) { + node = scripts[ i ]; + if ( rscriptType.test( node.type || "" ) && + !dataPriv.access( node, "globalEval" ) && + jQuery.contains( doc, node ) ) { + + if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { + + // Optional AJAX dependency, but won't run scripts if not present + if ( jQuery._evalUrl && !node.noModule ) { + jQuery._evalUrl( node.src, { + nonce: node.nonce || node.getAttribute( "nonce" ) + }, doc ); + } + } else { + + // Unwrap a CDATA section containing script contents. This shouldn't be + // needed as in XML documents they're already not visible when + // inspecting element contents and in HTML documents they have no + // meaning but we're preserving that logic for backwards compatibility. + // This will be removed completely in 4.0. See gh-4904. + DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc ); + } + } + } + } + } + } + + return collection; +} + +function remove( elem, selector, keepData ) { + var node, + nodes = selector ? jQuery.filter( selector, elem ) : elem, + i = 0; + + for ( ; ( node = nodes[ i ] ) != null; i++ ) { + if ( !keepData && node.nodeType === 1 ) { + jQuery.cleanData( getAll( node ) ); + } + + if ( node.parentNode ) { + if ( keepData && isAttached( node ) ) { + setGlobalEval( getAll( node, "script" ) ); + } + node.parentNode.removeChild( node ); + } + } + + return elem; +} + +jQuery.extend( { + htmlPrefilter: function( html ) { + return html; + }, + + clone: function( elem, dataAndEvents, deepDataAndEvents ) { + var i, l, srcElements, destElements, + clone = elem.cloneNode( true ), + inPage = isAttached( elem ); + + // Fix IE cloning issues + if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && + !jQuery.isXMLDoc( elem ) ) { + + // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 + destElements = getAll( clone ); + srcElements = getAll( elem ); + + for ( i = 0, l = srcElements.length; i < l; i++ ) { + fixInput( srcElements[ i ], destElements[ i ] ); + } + } + + // Copy the events from the original to the clone + if ( dataAndEvents ) { + if ( deepDataAndEvents ) { + srcElements = srcElements || getAll( elem ); + destElements = destElements || getAll( clone ); + + for ( i = 0, l = srcElements.length; i < l; i++ ) { + cloneCopyEvent( srcElements[ i ], destElements[ i ] ); + } + } else { + cloneCopyEvent( elem, clone ); + } + } + + // Preserve script evaluation history + destElements = getAll( clone, "script" ); + if ( destElements.length > 0 ) { + setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); + } + + // Return the cloned set + return clone; + }, + + cleanData: function( elems ) { + var data, elem, type, + special = jQuery.event.special, + i = 0; + + for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { + if ( acceptData( elem ) ) { + if ( ( data = elem[ dataPriv.expando ] ) ) { + if ( data.events ) { + for ( type in data.events ) { + if ( special[ type ] ) { + jQuery.event.remove( elem, type ); + + // This is a shortcut to avoid jQuery.event.remove's overhead + } else { + jQuery.removeEvent( elem, type, data.handle ); + } + } + } + + // Support: Chrome <=35 - 45+ + // Assign undefined instead of using delete, see Data#remove + elem[ dataPriv.expando ] = undefined; + } + if ( elem[ dataUser.expando ] ) { + + // Support: Chrome <=35 - 45+ + // Assign undefined instead of using delete, see Data#remove + elem[ dataUser.expando ] = undefined; + } + } + } + } +} ); + +jQuery.fn.extend( { + detach: function( selector ) { + return remove( this, selector, true ); + }, + + remove: function( selector ) { + return remove( this, selector ); + }, + + text: function( value ) { + return access( this, function( value ) { + return value === undefined ? + jQuery.text( this ) : + this.empty().each( function() { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + this.textContent = value; + } + } ); + }, null, value, arguments.length ); + }, + + append: function() { + return domManip( this, arguments, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + var target = manipulationTarget( this, elem ); + target.appendChild( elem ); + } + } ); + }, + + prepend: function() { + return domManip( this, arguments, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + var target = manipulationTarget( this, elem ); + target.insertBefore( elem, target.firstChild ); + } + } ); + }, + + before: function() { + return domManip( this, arguments, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this ); + } + } ); + }, + + after: function() { + return domManip( this, arguments, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this.nextSibling ); + } + } ); + }, + + empty: function() { + var elem, + i = 0; + + for ( ; ( elem = this[ i ] ) != null; i++ ) { + if ( elem.nodeType === 1 ) { + + // Prevent memory leaks + jQuery.cleanData( getAll( elem, false ) ); + + // Remove any remaining nodes + elem.textContent = ""; + } + } + + return this; + }, + + clone: function( dataAndEvents, deepDataAndEvents ) { + dataAndEvents = dataAndEvents == null ? false : dataAndEvents; + deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; + + return this.map( function() { + return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); + } ); + }, + + html: function( value ) { + return access( this, function( value ) { + var elem = this[ 0 ] || {}, + i = 0, + l = this.length; + + if ( value === undefined && elem.nodeType === 1 ) { + return elem.innerHTML; + } + + // See if we can take a shortcut and just use innerHTML + if ( typeof value === "string" && !rnoInnerhtml.test( value ) && + !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { + + value = jQuery.htmlPrefilter( value ); + + try { + for ( ; i < l; i++ ) { + elem = this[ i ] || {}; + + // Remove element nodes and prevent memory leaks + if ( elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem, false ) ); + elem.innerHTML = value; + } + } + + elem = 0; + + // If using innerHTML throws an exception, use the fallback method + } catch ( e ) {} + } + + if ( elem ) { + this.empty().append( value ); + } + }, null, value, arguments.length ); + }, + + replaceWith: function() { + var ignored = []; + + // Make the changes, replacing each non-ignored context element with the new content + return domManip( this, arguments, function( elem ) { + var parent = this.parentNode; + + if ( jQuery.inArray( this, ignored ) < 0 ) { + jQuery.cleanData( getAll( this ) ); + if ( parent ) { + parent.replaceChild( elem, this ); + } + } + + // Force callback invocation + }, ignored ); + } +} ); + +jQuery.each( { + appendTo: "append", + prependTo: "prepend", + insertBefore: "before", + insertAfter: "after", + replaceAll: "replaceWith" +}, function( name, original ) { + jQuery.fn[ name ] = function( selector ) { + var elems, + ret = [], + insert = jQuery( selector ), + last = insert.length - 1, + i = 0; + + for ( ; i <= last; i++ ) { + elems = i === last ? this : this.clone( true ); + jQuery( insert[ i ] )[ original ]( elems ); + + // Support: Android <=4.0 only, PhantomJS 1 only + // .get() because push.apply(_, arraylike) throws on ancient WebKit + push.apply( ret, elems.get() ); + } + + return this.pushStack( ret ); + }; +} ); +var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); + +var rcustomProp = /^--/; + + +var getStyles = function( elem ) { + + // Support: IE <=11 only, Firefox <=30 (trac-15098, trac-14150) + // IE throws on elements created in popups + // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" + var view = elem.ownerDocument.defaultView; + + if ( !view || !view.opener ) { + view = window; + } + + return view.getComputedStyle( elem ); + }; + +var swap = function( elem, options, callback ) { + var ret, name, + old = {}; + + // Remember the old values, and insert the new ones + for ( name in options ) { + old[ name ] = elem.style[ name ]; + elem.style[ name ] = options[ name ]; + } + + ret = callback.call( elem ); + + // Revert the old values + for ( name in options ) { + elem.style[ name ] = old[ name ]; + } + + return ret; +}; + + +var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); + +var whitespace = "[\\x20\\t\\r\\n\\f]"; + + +var rtrimCSS = new RegExp( + "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", + "g" +); + + + + +( function() { + + // Executing both pixelPosition & boxSizingReliable tests require only one layout + // so they're executed at the same time to save the second computation. + function computeStyleTests() { + + // This is a singleton, we need to execute it only once + if ( !div ) { + return; + } + + container.style.cssText = "position:absolute;left:-11111px;width:60px;" + + "margin-top:1px;padding:0;border:0"; + div.style.cssText = + "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + + "margin:auto;border:1px;padding:1px;" + + "width:60%;top:1%"; + documentElement.appendChild( container ).appendChild( div ); + + var divStyle = window.getComputedStyle( div ); + pixelPositionVal = divStyle.top !== "1%"; + + // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 + reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12; + + // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 + // Some styles come back with percentage values, even though they shouldn't + div.style.right = "60%"; + pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36; + + // Support: IE 9 - 11 only + // Detect misreporting of content dimensions for box-sizing:border-box elements + boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36; + + // Support: IE 9 only + // Detect overflow:scroll screwiness (gh-3699) + // Support: Chrome <=64 + // Don't get tricked when zoom affects offsetWidth (gh-4029) + div.style.position = "absolute"; + scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12; + + documentElement.removeChild( container ); + + // Nullify the div so it wouldn't be stored in the memory and + // it will also be a sign that checks already performed + div = null; + } + + function roundPixelMeasures( measure ) { + return Math.round( parseFloat( measure ) ); + } + + var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, + reliableTrDimensionsVal, reliableMarginLeftVal, + container = document.createElement( "div" ), + div = document.createElement( "div" ); + + // Finish early in limited (non-browser) environments + if ( !div.style ) { + return; + } + + // Support: IE <=9 - 11 only + // Style of cloned element affects source element cloned (trac-8908) + div.style.backgroundClip = "content-box"; + div.cloneNode( true ).style.backgroundClip = ""; + support.clearCloneStyle = div.style.backgroundClip === "content-box"; + + jQuery.extend( support, { + boxSizingReliable: function() { + computeStyleTests(); + return boxSizingReliableVal; + }, + pixelBoxStyles: function() { + computeStyleTests(); + return pixelBoxStylesVal; + }, + pixelPosition: function() { + computeStyleTests(); + return pixelPositionVal; + }, + reliableMarginLeft: function() { + computeStyleTests(); + return reliableMarginLeftVal; + }, + scrollboxSize: function() { + computeStyleTests(); + return scrollboxSizeVal; + }, + + // Support: IE 9 - 11+, Edge 15 - 18+ + // IE/Edge misreport `getComputedStyle` of table rows with width/height + // set in CSS while `offset*` properties report correct values. + // Behavior in IE 9 is more subtle than in newer versions & it passes + // some versions of this test; make sure not to make it pass there! + // + // Support: Firefox 70+ + // Only Firefox includes border widths + // in computed dimensions. (gh-4529) + reliableTrDimensions: function() { + var table, tr, trChild, trStyle; + if ( reliableTrDimensionsVal == null ) { + table = document.createElement( "table" ); + tr = document.createElement( "tr" ); + trChild = document.createElement( "div" ); + + table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate"; + tr.style.cssText = "border:1px solid"; + + // Support: Chrome 86+ + // Height set through cssText does not get applied. + // Computed height then comes back as 0. + tr.style.height = "1px"; + trChild.style.height = "9px"; + + // Support: Android 8 Chrome 86+ + // In our bodyBackground.html iframe, + // display for all div elements is set to "inline", + // which causes a problem only in Android 8 Chrome 86. + // Ensuring the div is display: block + // gets around this issue. + trChild.style.display = "block"; + + documentElement + .appendChild( table ) + .appendChild( tr ) + .appendChild( trChild ); + + trStyle = window.getComputedStyle( tr ); + reliableTrDimensionsVal = ( parseInt( trStyle.height, 10 ) + + parseInt( trStyle.borderTopWidth, 10 ) + + parseInt( trStyle.borderBottomWidth, 10 ) ) === tr.offsetHeight; + + documentElement.removeChild( table ); + } + return reliableTrDimensionsVal; + } + } ); +} )(); + + +function curCSS( elem, name, computed ) { + var width, minWidth, maxWidth, ret, + isCustomProp = rcustomProp.test( name ), + + // Support: Firefox 51+ + // Retrieving style before computed somehow + // fixes an issue with getting wrong values + // on detached elements + style = elem.style; + + computed = computed || getStyles( elem ); + + // getPropertyValue is needed for: + // .css('filter') (IE 9 only, trac-12537) + // .css('--customProperty) (gh-3144) + if ( computed ) { + + // Support: IE <=9 - 11+ + // IE only supports `"float"` in `getPropertyValue`; in computed styles + // it's only available as `"cssFloat"`. We no longer modify properties + // sent to `.css()` apart from camelCasing, so we need to check both. + // Normally, this would create difference in behavior: if + // `getPropertyValue` returns an empty string, the value returned + // by `.css()` would be `undefined`. This is usually the case for + // disconnected elements. However, in IE even disconnected elements + // with no styles return `"none"` for `getPropertyValue( "float" )` + ret = computed.getPropertyValue( name ) || computed[ name ]; + + if ( isCustomProp && ret ) { + + // Support: Firefox 105+, Chrome <=105+ + // Spec requires trimming whitespace for custom properties (gh-4926). + // Firefox only trims leading whitespace. Chrome just collapses + // both leading & trailing whitespace to a single space. + // + // Fall back to `undefined` if empty string returned. + // This collapses a missing definition with property defined + // and set to an empty string but there's no standard API + // allowing us to differentiate them without a performance penalty + // and returning `undefined` aligns with older jQuery. + // + // rtrimCSS treats U+000D CARRIAGE RETURN and U+000C FORM FEED + // as whitespace while CSS does not, but this is not a problem + // because CSS preprocessing replaces them with U+000A LINE FEED + // (which *is* CSS whitespace) + // https://www.w3.org/TR/css-syntax-3/#input-preprocessing + ret = ret.replace( rtrimCSS, "$1" ) || undefined; + } + + if ( ret === "" && !isAttached( elem ) ) { + ret = jQuery.style( elem, name ); + } + + // A tribute to the "awesome hack by Dean Edwards" + // Android Browser returns percentage for some values, + // but width seems to be reliably pixels. + // This is against the CSSOM draft spec: + // https://drafts.csswg.org/cssom/#resolved-values + if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) { + + // Remember the original values + width = style.width; + minWidth = style.minWidth; + maxWidth = style.maxWidth; + + // Put in the new values to get a computed value out + style.minWidth = style.maxWidth = style.width = ret; + ret = computed.width; + + // Revert the changed values + style.width = width; + style.minWidth = minWidth; + style.maxWidth = maxWidth; + } + } + + return ret !== undefined ? + + // Support: IE <=9 - 11 only + // IE returns zIndex value as an integer. + ret + "" : + ret; +} + + +function addGetHookIf( conditionFn, hookFn ) { + + // Define the hook, we'll check on the first run if it's really needed. + return { + get: function() { + if ( conditionFn() ) { + + // Hook not needed (or it's not possible to use it due + // to missing dependency), remove it. + delete this.get; + return; + } + + // Hook needed; redefine it so that the support test is not executed again. + return ( this.get = hookFn ).apply( this, arguments ); + } + }; +} + + +var cssPrefixes = [ "Webkit", "Moz", "ms" ], + emptyStyle = document.createElement( "div" ).style, + vendorProps = {}; + +// Return a vendor-prefixed property or undefined +function vendorPropName( name ) { + + // Check for vendor prefixed names + var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), + i = cssPrefixes.length; + + while ( i-- ) { + name = cssPrefixes[ i ] + capName; + if ( name in emptyStyle ) { + return name; + } + } +} + +// Return a potentially-mapped jQuery.cssProps or vendor prefixed property +function finalPropName( name ) { + var final = jQuery.cssProps[ name ] || vendorProps[ name ]; + + if ( final ) { + return final; + } + if ( name in emptyStyle ) { + return name; + } + return vendorProps[ name ] = vendorPropName( name ) || name; +} + + +var + + // Swappable if display is none or starts with table + // except "table", "table-cell", or "table-caption" + // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display + rdisplayswap = /^(none|table(?!-c[ea]).+)/, + cssShow = { position: "absolute", visibility: "hidden", display: "block" }, + cssNormalTransform = { + letterSpacing: "0", + fontWeight: "400" + }; + +function setPositiveNumber( _elem, value, subtract ) { + + // Any relative (+/-) values have already been + // normalized at this point + var matches = rcssNum.exec( value ); + return matches ? + + // Guard against undefined "subtract", e.g., when used as in cssHooks + Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : + value; +} + +function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { + var i = dimension === "width" ? 1 : 0, + extra = 0, + delta = 0; + + // Adjustment may not be necessary + if ( box === ( isBorderBox ? "border" : "content" ) ) { + return 0; + } + + for ( ; i < 4; i += 2 ) { + + // Both box models exclude margin + if ( box === "margin" ) { + delta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); + } + + // If we get here with a content-box, we're seeking "padding" or "border" or "margin" + if ( !isBorderBox ) { + + // Add padding + delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); + + // For "border" or "margin", add border + if ( box !== "padding" ) { + delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); + + // But still keep track of it otherwise + } else { + extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); + } + + // If we get here with a border-box (content + padding + border), we're seeking "content" or + // "padding" or "margin" + } else { + + // For "content", subtract padding + if ( box === "content" ) { + delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); + } + + // For "content" or "padding", subtract border + if ( box !== "margin" ) { + delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); + } + } + } + + // Account for positive content-box scroll gutter when requested by providing computedVal + if ( !isBorderBox && computedVal >= 0 ) { + + // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border + // Assuming integer scroll gutter, subtract the rest and round down + delta += Math.max( 0, Math.ceil( + elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - + computedVal - + delta - + extra - + 0.5 + + // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter + // Use an explicit zero to avoid NaN (gh-3964) + ) ) || 0; + } + + return delta; +} + +function getWidthOrHeight( elem, dimension, extra ) { + + // Start with computed style + var styles = getStyles( elem ), + + // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322). + // Fake content-box until we know it's needed to know the true value. + boxSizingNeeded = !support.boxSizingReliable() || extra, + isBorderBox = boxSizingNeeded && + jQuery.css( elem, "boxSizing", false, styles ) === "border-box", + valueIsBorderBox = isBorderBox, + + val = curCSS( elem, dimension, styles ), + offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ); + + // Support: Firefox <=54 + // Return a confounding non-pixel value or feign ignorance, as appropriate. + if ( rnumnonpx.test( val ) ) { + if ( !extra ) { + return val; + } + val = "auto"; + } + + + // Support: IE 9 - 11 only + // Use offsetWidth/offsetHeight for when box sizing is unreliable. + // In those cases, the computed value can be trusted to be border-box. + if ( ( !support.boxSizingReliable() && isBorderBox || + + // Support: IE 10 - 11+, Edge 15 - 18+ + // IE/Edge misreport `getComputedStyle` of table rows with width/height + // set in CSS while `offset*` properties report correct values. + // Interestingly, in some cases IE 9 doesn't suffer from this issue. + !support.reliableTrDimensions() && nodeName( elem, "tr" ) || + + // Fall back to offsetWidth/offsetHeight when value is "auto" + // This happens for inline elements with no explicit setting (gh-3571) + val === "auto" || + + // Support: Android <=4.1 - 4.3 only + // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) + !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) && + + // Make sure the element is visible & connected + elem.getClientRects().length ) { + + isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; + + // Where available, offsetWidth/offsetHeight approximate border box dimensions. + // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the + // retrieved value as a content box dimension. + valueIsBorderBox = offsetProp in elem; + if ( valueIsBorderBox ) { + val = elem[ offsetProp ]; + } + } + + // Normalize "" and auto + val = parseFloat( val ) || 0; + + // Adjust for the element's box model + return ( val + + boxModelAdjustment( + elem, + dimension, + extra || ( isBorderBox ? "border" : "content" ), + valueIsBorderBox, + styles, + + // Provide the current computed size to request scroll gutter calculation (gh-3589) + val + ) + ) + "px"; +} + +jQuery.extend( { + + // Add in style property hooks for overriding the default + // behavior of getting and setting a style property + cssHooks: { + opacity: { + get: function( elem, computed ) { + if ( computed ) { + + // We should always get a number back from opacity + var ret = curCSS( elem, "opacity" ); + return ret === "" ? "1" : ret; + } + } + } + }, + + // Don't automatically add "px" to these possibly-unitless properties + cssNumber: { + "animationIterationCount": true, + "columnCount": true, + "fillOpacity": true, + "flexGrow": true, + "flexShrink": true, + "fontWeight": true, + "gridArea": true, + "gridColumn": true, + "gridColumnEnd": true, + "gridColumnStart": true, + "gridRow": true, + "gridRowEnd": true, + "gridRowStart": true, + "lineHeight": true, + "opacity": true, + "order": true, + "orphans": true, + "widows": true, + "zIndex": true, + "zoom": true + }, + + // Add in properties whose names you wish to fix before + // setting or getting the value + cssProps: {}, + + // Get and set the style property on a DOM Node + style: function( elem, name, value, extra ) { + + // Don't set styles on text and comment nodes + if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { + return; + } + + // Make sure that we're working with the right name + var ret, type, hooks, + origName = camelCase( name ), + isCustomProp = rcustomProp.test( name ), + style = elem.style; + + // Make sure that we're working with the right name. We don't + // want to query the value if it is a CSS custom property + // since they are user-defined. + if ( !isCustomProp ) { + name = finalPropName( origName ); + } + + // Gets hook for the prefixed version, then unprefixed version + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + + // Check if we're setting a value + if ( value !== undefined ) { + type = typeof value; + + // Convert "+=" or "-=" to relative numbers (trac-7345) + if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { + value = adjustCSS( elem, name, ret ); + + // Fixes bug trac-9237 + type = "number"; + } + + // Make sure that null and NaN values aren't set (trac-7116) + if ( value == null || value !== value ) { + return; + } + + // If a number was passed in, add the unit (except for certain CSS properties) + // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append + // "px" to a few hardcoded values. + if ( type === "number" && !isCustomProp ) { + value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); + } + + // background-* props affect original clone's values + if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { + style[ name ] = "inherit"; + } + + // If a hook was provided, use that value, otherwise just set the specified value + if ( !hooks || !( "set" in hooks ) || + ( value = hooks.set( elem, value, extra ) ) !== undefined ) { + + if ( isCustomProp ) { + style.setProperty( name, value ); + } else { + style[ name ] = value; + } + } + + } else { + + // If a hook was provided get the non-computed value from there + if ( hooks && "get" in hooks && + ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { + + return ret; + } + + // Otherwise just get the value from the style object + return style[ name ]; + } + }, + + css: function( elem, name, extra, styles ) { + var val, num, hooks, + origName = camelCase( name ), + isCustomProp = rcustomProp.test( name ); + + // Make sure that we're working with the right name. We don't + // want to modify the value if it is a CSS custom property + // since they are user-defined. + if ( !isCustomProp ) { + name = finalPropName( origName ); + } + + // Try prefixed name followed by the unprefixed name + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + + // If a hook was provided get the computed value from there + if ( hooks && "get" in hooks ) { + val = hooks.get( elem, true, extra ); + } + + // Otherwise, if a way to get the computed value exists, use that + if ( val === undefined ) { + val = curCSS( elem, name, styles ); + } + + // Convert "normal" to computed value + if ( val === "normal" && name in cssNormalTransform ) { + val = cssNormalTransform[ name ]; + } + + // Make numeric if forced or a qualifier was provided and val looks numeric + if ( extra === "" || extra ) { + num = parseFloat( val ); + return extra === true || isFinite( num ) ? num || 0 : val; + } + + return val; + } +} ); + +jQuery.each( [ "height", "width" ], function( _i, dimension ) { + jQuery.cssHooks[ dimension ] = { + get: function( elem, computed, extra ) { + if ( computed ) { + + // Certain elements can have dimension info if we invisibly show them + // but it must have a current display style that would benefit + return rdisplayswap.test( jQuery.css( elem, "display" ) ) && + + // Support: Safari 8+ + // Table columns in Safari have non-zero offsetWidth & zero + // getBoundingClientRect().width unless display is changed. + // Support: IE <=11 only + // Running getBoundingClientRect on a disconnected node + // in IE throws an error. + ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? + swap( elem, cssShow, function() { + return getWidthOrHeight( elem, dimension, extra ); + } ) : + getWidthOrHeight( elem, dimension, extra ); + } + }, + + set: function( elem, value, extra ) { + var matches, + styles = getStyles( elem ), + + // Only read styles.position if the test has a chance to fail + // to avoid forcing a reflow. + scrollboxSizeBuggy = !support.scrollboxSize() && + styles.position === "absolute", + + // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991) + boxSizingNeeded = scrollboxSizeBuggy || extra, + isBorderBox = boxSizingNeeded && + jQuery.css( elem, "boxSizing", false, styles ) === "border-box", + subtract = extra ? + boxModelAdjustment( + elem, + dimension, + extra, + isBorderBox, + styles + ) : + 0; + + // Account for unreliable border-box dimensions by comparing offset* to computed and + // faking a content-box to get border and padding (gh-3699) + if ( isBorderBox && scrollboxSizeBuggy ) { + subtract -= Math.ceil( + elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - + parseFloat( styles[ dimension ] ) - + boxModelAdjustment( elem, dimension, "border", false, styles ) - + 0.5 + ); + } + + // Convert to pixels if value adjustment is needed + if ( subtract && ( matches = rcssNum.exec( value ) ) && + ( matches[ 3 ] || "px" ) !== "px" ) { + + elem.style[ dimension ] = value; + value = jQuery.css( elem, dimension ); + } + + return setPositiveNumber( elem, value, subtract ); + } + }; +} ); + +jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, + function( elem, computed ) { + if ( computed ) { + return ( parseFloat( curCSS( elem, "marginLeft" ) ) || + elem.getBoundingClientRect().left - + swap( elem, { marginLeft: 0 }, function() { + return elem.getBoundingClientRect().left; + } ) + ) + "px"; + } + } +); + +// These hooks are used by animate to expand properties +jQuery.each( { + margin: "", + padding: "", + border: "Width" +}, function( prefix, suffix ) { + jQuery.cssHooks[ prefix + suffix ] = { + expand: function( value ) { + var i = 0, + expanded = {}, + + // Assumes a single number if not a string + parts = typeof value === "string" ? value.split( " " ) : [ value ]; + + for ( ; i < 4; i++ ) { + expanded[ prefix + cssExpand[ i ] + suffix ] = + parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; + } + + return expanded; + } + }; + + if ( prefix !== "margin" ) { + jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; + } +} ); + +jQuery.fn.extend( { + css: function( name, value ) { + return access( this, function( elem, name, value ) { + var styles, len, + map = {}, + i = 0; + + if ( Array.isArray( name ) ) { + styles = getStyles( elem ); + len = name.length; + + for ( ; i < len; i++ ) { + map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); + } + + return map; + } + + return value !== undefined ? + jQuery.style( elem, name, value ) : + jQuery.css( elem, name ); + }, name, value, arguments.length > 1 ); + } +} ); + + +function Tween( elem, options, prop, end, easing ) { + return new Tween.prototype.init( elem, options, prop, end, easing ); +} +jQuery.Tween = Tween; + +Tween.prototype = { + constructor: Tween, + init: function( elem, options, prop, end, easing, unit ) { + this.elem = elem; + this.prop = prop; + this.easing = easing || jQuery.easing._default; + this.options = options; + this.start = this.now = this.cur(); + this.end = end; + this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); + }, + cur: function() { + var hooks = Tween.propHooks[ this.prop ]; + + return hooks && hooks.get ? + hooks.get( this ) : + Tween.propHooks._default.get( this ); + }, + run: function( percent ) { + var eased, + hooks = Tween.propHooks[ this.prop ]; + + if ( this.options.duration ) { + this.pos = eased = jQuery.easing[ this.easing ]( + percent, this.options.duration * percent, 0, 1, this.options.duration + ); + } else { + this.pos = eased = percent; + } + this.now = ( this.end - this.start ) * eased + this.start; + + if ( this.options.step ) { + this.options.step.call( this.elem, this.now, this ); + } + + if ( hooks && hooks.set ) { + hooks.set( this ); + } else { + Tween.propHooks._default.set( this ); + } + return this; + } +}; + +Tween.prototype.init.prototype = Tween.prototype; + +Tween.propHooks = { + _default: { + get: function( tween ) { + var result; + + // Use a property on the element directly when it is not a DOM element, + // or when there is no matching style property that exists. + if ( tween.elem.nodeType !== 1 || + tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { + return tween.elem[ tween.prop ]; + } + + // Passing an empty string as a 3rd parameter to .css will automatically + // attempt a parseFloat and fallback to a string if the parse fails. + // Simple values such as "10px" are parsed to Float; + // complex values such as "rotate(1rad)" are returned as-is. + result = jQuery.css( tween.elem, tween.prop, "" ); + + // Empty strings, null, undefined and "auto" are converted to 0. + return !result || result === "auto" ? 0 : result; + }, + set: function( tween ) { + + // Use step hook for back compat. + // Use cssHook if its there. + // Use .style if available and use plain properties where available. + if ( jQuery.fx.step[ tween.prop ] ) { + jQuery.fx.step[ tween.prop ]( tween ); + } else if ( tween.elem.nodeType === 1 && ( + jQuery.cssHooks[ tween.prop ] || + tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) { + jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); + } else { + tween.elem[ tween.prop ] = tween.now; + } + } + } +}; + +// Support: IE <=9 only +// Panic based approach to setting things on disconnected nodes +Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { + set: function( tween ) { + if ( tween.elem.nodeType && tween.elem.parentNode ) { + tween.elem[ tween.prop ] = tween.now; + } + } +}; + +jQuery.easing = { + linear: function( p ) { + return p; + }, + swing: function( p ) { + return 0.5 - Math.cos( p * Math.PI ) / 2; + }, + _default: "swing" +}; + +jQuery.fx = Tween.prototype.init; + +// Back compat <1.8 extension point +jQuery.fx.step = {}; + + + + +var + fxNow, inProgress, + rfxtypes = /^(?:toggle|show|hide)$/, + rrun = /queueHooks$/; + +function schedule() { + if ( inProgress ) { + if ( document.hidden === false && window.requestAnimationFrame ) { + window.requestAnimationFrame( schedule ); + } else { + window.setTimeout( schedule, jQuery.fx.interval ); + } + + jQuery.fx.tick(); + } +} + +// Animations created synchronously will run synchronously +function createFxNow() { + window.setTimeout( function() { + fxNow = undefined; + } ); + return ( fxNow = Date.now() ); +} + +// Generate parameters to create a standard animation +function genFx( type, includeWidth ) { + var which, + i = 0, + attrs = { height: type }; + + // If we include width, step value is 1 to do all cssExpand values, + // otherwise step value is 2 to skip over Left and Right + includeWidth = includeWidth ? 1 : 0; + for ( ; i < 4; i += 2 - includeWidth ) { + which = cssExpand[ i ]; + attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; + } + + if ( includeWidth ) { + attrs.opacity = attrs.width = type; + } + + return attrs; +} + +function createTween( value, prop, animation ) { + var tween, + collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), + index = 0, + length = collection.length; + for ( ; index < length; index++ ) { + if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { + + // We're done with this property + return tween; + } + } +} + +function defaultPrefilter( elem, props, opts ) { + var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, + isBox = "width" in props || "height" in props, + anim = this, + orig = {}, + style = elem.style, + hidden = elem.nodeType && isHiddenWithinTree( elem ), + dataShow = dataPriv.get( elem, "fxshow" ); + + // Queue-skipping animations hijack the fx hooks + if ( !opts.queue ) { + hooks = jQuery._queueHooks( elem, "fx" ); + if ( hooks.unqueued == null ) { + hooks.unqueued = 0; + oldfire = hooks.empty.fire; + hooks.empty.fire = function() { + if ( !hooks.unqueued ) { + oldfire(); + } + }; + } + hooks.unqueued++; + + anim.always( function() { + + // Ensure the complete handler is called before this completes + anim.always( function() { + hooks.unqueued--; + if ( !jQuery.queue( elem, "fx" ).length ) { + hooks.empty.fire(); + } + } ); + } ); + } + + // Detect show/hide animations + for ( prop in props ) { + value = props[ prop ]; + if ( rfxtypes.test( value ) ) { + delete props[ prop ]; + toggle = toggle || value === "toggle"; + if ( value === ( hidden ? "hide" : "show" ) ) { + + // Pretend to be hidden if this is a "show" and + // there is still data from a stopped show/hide + if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { + hidden = true; + + // Ignore all other no-op show/hide data + } else { + continue; + } + } + orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); + } + } + + // Bail out if this is a no-op like .hide().hide() + propTween = !jQuery.isEmptyObject( props ); + if ( !propTween && jQuery.isEmptyObject( orig ) ) { + return; + } + + // Restrict "overflow" and "display" styles during box animations + if ( isBox && elem.nodeType === 1 ) { + + // Support: IE <=9 - 11, Edge 12 - 15 + // Record all 3 overflow attributes because IE does not infer the shorthand + // from identically-valued overflowX and overflowY and Edge just mirrors + // the overflowX value there. + opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; + + // Identify a display type, preferring old show/hide data over the CSS cascade + restoreDisplay = dataShow && dataShow.display; + if ( restoreDisplay == null ) { + restoreDisplay = dataPriv.get( elem, "display" ); + } + display = jQuery.css( elem, "display" ); + if ( display === "none" ) { + if ( restoreDisplay ) { + display = restoreDisplay; + } else { + + // Get nonempty value(s) by temporarily forcing visibility + showHide( [ elem ], true ); + restoreDisplay = elem.style.display || restoreDisplay; + display = jQuery.css( elem, "display" ); + showHide( [ elem ] ); + } + } + + // Animate inline elements as inline-block + if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { + if ( jQuery.css( elem, "float" ) === "none" ) { + + // Restore the original display value at the end of pure show/hide animations + if ( !propTween ) { + anim.done( function() { + style.display = restoreDisplay; + } ); + if ( restoreDisplay == null ) { + display = style.display; + restoreDisplay = display === "none" ? "" : display; + } + } + style.display = "inline-block"; + } + } + } + + if ( opts.overflow ) { + style.overflow = "hidden"; + anim.always( function() { + style.overflow = opts.overflow[ 0 ]; + style.overflowX = opts.overflow[ 1 ]; + style.overflowY = opts.overflow[ 2 ]; + } ); + } + + // Implement show/hide animations + propTween = false; + for ( prop in orig ) { + + // General show/hide setup for this element animation + if ( !propTween ) { + if ( dataShow ) { + if ( "hidden" in dataShow ) { + hidden = dataShow.hidden; + } + } else { + dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); + } + + // Store hidden/visible for toggle so `.stop().toggle()` "reverses" + if ( toggle ) { + dataShow.hidden = !hidden; + } + + // Show elements before animating them + if ( hidden ) { + showHide( [ elem ], true ); + } + + /* eslint-disable no-loop-func */ + + anim.done( function() { + + /* eslint-enable no-loop-func */ + + // The final step of a "hide" animation is actually hiding the element + if ( !hidden ) { + showHide( [ elem ] ); + } + dataPriv.remove( elem, "fxshow" ); + for ( prop in orig ) { + jQuery.style( elem, prop, orig[ prop ] ); + } + } ); + } + + // Per-property setup + propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); + if ( !( prop in dataShow ) ) { + dataShow[ prop ] = propTween.start; + if ( hidden ) { + propTween.end = propTween.start; + propTween.start = 0; + } + } + } +} + +function propFilter( props, specialEasing ) { + var index, name, easing, value, hooks; + + // camelCase, specialEasing and expand cssHook pass + for ( index in props ) { + name = camelCase( index ); + easing = specialEasing[ name ]; + value = props[ index ]; + if ( Array.isArray( value ) ) { + easing = value[ 1 ]; + value = props[ index ] = value[ 0 ]; + } + + if ( index !== name ) { + props[ name ] = value; + delete props[ index ]; + } + + hooks = jQuery.cssHooks[ name ]; + if ( hooks && "expand" in hooks ) { + value = hooks.expand( value ); + delete props[ name ]; + + // Not quite $.extend, this won't overwrite existing keys. + // Reusing 'index' because we have the correct "name" + for ( index in value ) { + if ( !( index in props ) ) { + props[ index ] = value[ index ]; + specialEasing[ index ] = easing; + } + } + } else { + specialEasing[ name ] = easing; + } + } +} + +function Animation( elem, properties, options ) { + var result, + stopped, + index = 0, + length = Animation.prefilters.length, + deferred = jQuery.Deferred().always( function() { + + // Don't match elem in the :animated selector + delete tick.elem; + } ), + tick = function() { + if ( stopped ) { + return false; + } + var currentTime = fxNow || createFxNow(), + remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), + + // Support: Android 2.3 only + // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (trac-12497) + temp = remaining / animation.duration || 0, + percent = 1 - temp, + index = 0, + length = animation.tweens.length; + + for ( ; index < length; index++ ) { + animation.tweens[ index ].run( percent ); + } + + deferred.notifyWith( elem, [ animation, percent, remaining ] ); + + // If there's more to do, yield + if ( percent < 1 && length ) { + return remaining; + } + + // If this was an empty animation, synthesize a final progress notification + if ( !length ) { + deferred.notifyWith( elem, [ animation, 1, 0 ] ); + } + + // Resolve the animation and report its conclusion + deferred.resolveWith( elem, [ animation ] ); + return false; + }, + animation = deferred.promise( { + elem: elem, + props: jQuery.extend( {}, properties ), + opts: jQuery.extend( true, { + specialEasing: {}, + easing: jQuery.easing._default + }, options ), + originalProperties: properties, + originalOptions: options, + startTime: fxNow || createFxNow(), + duration: options.duration, + tweens: [], + createTween: function( prop, end ) { + var tween = jQuery.Tween( elem, animation.opts, prop, end, + animation.opts.specialEasing[ prop ] || animation.opts.easing ); + animation.tweens.push( tween ); + return tween; + }, + stop: function( gotoEnd ) { + var index = 0, + + // If we are going to the end, we want to run all the tweens + // otherwise we skip this part + length = gotoEnd ? animation.tweens.length : 0; + if ( stopped ) { + return this; + } + stopped = true; + for ( ; index < length; index++ ) { + animation.tweens[ index ].run( 1 ); + } + + // Resolve when we played the last frame; otherwise, reject + if ( gotoEnd ) { + deferred.notifyWith( elem, [ animation, 1, 0 ] ); + deferred.resolveWith( elem, [ animation, gotoEnd ] ); + } else { + deferred.rejectWith( elem, [ animation, gotoEnd ] ); + } + return this; + } + } ), + props = animation.props; + + propFilter( props, animation.opts.specialEasing ); + + for ( ; index < length; index++ ) { + result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); + if ( result ) { + if ( isFunction( result.stop ) ) { + jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = + result.stop.bind( result ); + } + return result; + } + } + + jQuery.map( props, createTween, animation ); + + if ( isFunction( animation.opts.start ) ) { + animation.opts.start.call( elem, animation ); + } + + // Attach callbacks from options + animation + .progress( animation.opts.progress ) + .done( animation.opts.done, animation.opts.complete ) + .fail( animation.opts.fail ) + .always( animation.opts.always ); + + jQuery.fx.timer( + jQuery.extend( tick, { + elem: elem, + anim: animation, + queue: animation.opts.queue + } ) + ); + + return animation; +} + +jQuery.Animation = jQuery.extend( Animation, { + + tweeners: { + "*": [ function( prop, value ) { + var tween = this.createTween( prop, value ); + adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); + return tween; + } ] + }, + + tweener: function( props, callback ) { + if ( isFunction( props ) ) { + callback = props; + props = [ "*" ]; + } else { + props = props.match( rnothtmlwhite ); + } + + var prop, + index = 0, + length = props.length; + + for ( ; index < length; index++ ) { + prop = props[ index ]; + Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; + Animation.tweeners[ prop ].unshift( callback ); + } + }, + + prefilters: [ defaultPrefilter ], + + prefilter: function( callback, prepend ) { + if ( prepend ) { + Animation.prefilters.unshift( callback ); + } else { + Animation.prefilters.push( callback ); + } + } +} ); + +jQuery.speed = function( speed, easing, fn ) { + var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { + complete: fn || !fn && easing || + isFunction( speed ) && speed, + duration: speed, + easing: fn && easing || easing && !isFunction( easing ) && easing + }; + + // Go to the end state if fx are off + if ( jQuery.fx.off ) { + opt.duration = 0; + + } else { + if ( typeof opt.duration !== "number" ) { + if ( opt.duration in jQuery.fx.speeds ) { + opt.duration = jQuery.fx.speeds[ opt.duration ]; + + } else { + opt.duration = jQuery.fx.speeds._default; + } + } + } + + // Normalize opt.queue - true/undefined/null -> "fx" + if ( opt.queue == null || opt.queue === true ) { + opt.queue = "fx"; + } + + // Queueing + opt.old = opt.complete; + + opt.complete = function() { + if ( isFunction( opt.old ) ) { + opt.old.call( this ); + } + + if ( opt.queue ) { + jQuery.dequeue( this, opt.queue ); + } + }; + + return opt; +}; + +jQuery.fn.extend( { + fadeTo: function( speed, to, easing, callback ) { + + // Show any hidden elements after setting opacity to 0 + return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() + + // Animate to the value specified + .end().animate( { opacity: to }, speed, easing, callback ); + }, + animate: function( prop, speed, easing, callback ) { + var empty = jQuery.isEmptyObject( prop ), + optall = jQuery.speed( speed, easing, callback ), + doAnimation = function() { + + // Operate on a copy of prop so per-property easing won't be lost + var anim = Animation( this, jQuery.extend( {}, prop ), optall ); + + // Empty animations, or finishing resolves immediately + if ( empty || dataPriv.get( this, "finish" ) ) { + anim.stop( true ); + } + }; + + doAnimation.finish = doAnimation; + + return empty || optall.queue === false ? + this.each( doAnimation ) : + this.queue( optall.queue, doAnimation ); + }, + stop: function( type, clearQueue, gotoEnd ) { + var stopQueue = function( hooks ) { + var stop = hooks.stop; + delete hooks.stop; + stop( gotoEnd ); + }; + + if ( typeof type !== "string" ) { + gotoEnd = clearQueue; + clearQueue = type; + type = undefined; + } + if ( clearQueue ) { + this.queue( type || "fx", [] ); + } + + return this.each( function() { + var dequeue = true, + index = type != null && type + "queueHooks", + timers = jQuery.timers, + data = dataPriv.get( this ); + + if ( index ) { + if ( data[ index ] && data[ index ].stop ) { + stopQueue( data[ index ] ); + } + } else { + for ( index in data ) { + if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { + stopQueue( data[ index ] ); + } + } + } + + for ( index = timers.length; index--; ) { + if ( timers[ index ].elem === this && + ( type == null || timers[ index ].queue === type ) ) { + + timers[ index ].anim.stop( gotoEnd ); + dequeue = false; + timers.splice( index, 1 ); + } + } + + // Start the next in the queue if the last step wasn't forced. + // Timers currently will call their complete callbacks, which + // will dequeue but only if they were gotoEnd. + if ( dequeue || !gotoEnd ) { + jQuery.dequeue( this, type ); + } + } ); + }, + finish: function( type ) { + if ( type !== false ) { + type = type || "fx"; + } + return this.each( function() { + var index, + data = dataPriv.get( this ), + queue = data[ type + "queue" ], + hooks = data[ type + "queueHooks" ], + timers = jQuery.timers, + length = queue ? queue.length : 0; + + // Enable finishing flag on private data + data.finish = true; + + // Empty the queue first + jQuery.queue( this, type, [] ); + + if ( hooks && hooks.stop ) { + hooks.stop.call( this, true ); + } + + // Look for any active animations, and finish them + for ( index = timers.length; index--; ) { + if ( timers[ index ].elem === this && timers[ index ].queue === type ) { + timers[ index ].anim.stop( true ); + timers.splice( index, 1 ); + } + } + + // Look for any animations in the old queue and finish them + for ( index = 0; index < length; index++ ) { + if ( queue[ index ] && queue[ index ].finish ) { + queue[ index ].finish.call( this ); + } + } + + // Turn off finishing flag + delete data.finish; + } ); + } +} ); + +jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) { + var cssFn = jQuery.fn[ name ]; + jQuery.fn[ name ] = function( speed, easing, callback ) { + return speed == null || typeof speed === "boolean" ? + cssFn.apply( this, arguments ) : + this.animate( genFx( name, true ), speed, easing, callback ); + }; +} ); + +// Generate shortcuts for custom animations +jQuery.each( { + slideDown: genFx( "show" ), + slideUp: genFx( "hide" ), + slideToggle: genFx( "toggle" ), + fadeIn: { opacity: "show" }, + fadeOut: { opacity: "hide" }, + fadeToggle: { opacity: "toggle" } +}, function( name, props ) { + jQuery.fn[ name ] = function( speed, easing, callback ) { + return this.animate( props, speed, easing, callback ); + }; +} ); + +jQuery.timers = []; +jQuery.fx.tick = function() { + var timer, + i = 0, + timers = jQuery.timers; + + fxNow = Date.now(); + + for ( ; i < timers.length; i++ ) { + timer = timers[ i ]; + + // Run the timer and safely remove it when done (allowing for external removal) + if ( !timer() && timers[ i ] === timer ) { + timers.splice( i--, 1 ); + } + } + + if ( !timers.length ) { + jQuery.fx.stop(); + } + fxNow = undefined; +}; + +jQuery.fx.timer = function( timer ) { + jQuery.timers.push( timer ); + jQuery.fx.start(); +}; + +jQuery.fx.interval = 13; +jQuery.fx.start = function() { + if ( inProgress ) { + return; + } + + inProgress = true; + schedule(); +}; + +jQuery.fx.stop = function() { + inProgress = null; +}; + +jQuery.fx.speeds = { + slow: 600, + fast: 200, + + // Default speed + _default: 400 +}; + + +// Based off of the plugin by Clint Helfers, with permission. +jQuery.fn.delay = function( time, type ) { + time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; + type = type || "fx"; + + return this.queue( type, function( next, hooks ) { + var timeout = window.setTimeout( next, time ); + hooks.stop = function() { + window.clearTimeout( timeout ); + }; + } ); +}; + + +( function() { + var input = document.createElement( "input" ), + select = document.createElement( "select" ), + opt = select.appendChild( document.createElement( "option" ) ); + + input.type = "checkbox"; + + // Support: Android <=4.3 only + // Default value for a checkbox should be "on" + support.checkOn = input.value !== ""; + + // Support: IE <=11 only + // Must access selectedIndex to make default options select + support.optSelected = opt.selected; + + // Support: IE <=11 only + // An input loses its value after becoming a radio + input = document.createElement( "input" ); + input.value = "t"; + input.type = "radio"; + support.radioValue = input.value === "t"; +} )(); + + +var boolHook, + attrHandle = jQuery.expr.attrHandle; + +jQuery.fn.extend( { + attr: function( name, value ) { + return access( this, jQuery.attr, name, value, arguments.length > 1 ); + }, + + removeAttr: function( name ) { + return this.each( function() { + jQuery.removeAttr( this, name ); + } ); + } +} ); + +jQuery.extend( { + attr: function( elem, name, value ) { + var ret, hooks, + nType = elem.nodeType; + + // Don't get/set attributes on text, comment and attribute nodes + if ( nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + // Fallback to prop when attributes are not supported + if ( typeof elem.getAttribute === "undefined" ) { + return jQuery.prop( elem, name, value ); + } + + // Attribute hooks are determined by the lowercase version + // Grab necessary hook if one is defined + if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { + hooks = jQuery.attrHooks[ name.toLowerCase() ] || + ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); + } + + if ( value !== undefined ) { + if ( value === null ) { + jQuery.removeAttr( elem, name ); + return; + } + + if ( hooks && "set" in hooks && + ( ret = hooks.set( elem, value, name ) ) !== undefined ) { + return ret; + } + + elem.setAttribute( name, value + "" ); + return value; + } + + if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { + return ret; + } + + ret = jQuery.find.attr( elem, name ); + + // Non-existent attributes return null, we normalize to undefined + return ret == null ? undefined : ret; + }, + + attrHooks: { + type: { + set: function( elem, value ) { + if ( !support.radioValue && value === "radio" && + nodeName( elem, "input" ) ) { + var val = elem.value; + elem.setAttribute( "type", value ); + if ( val ) { + elem.value = val; + } + return value; + } + } + } + }, + + removeAttr: function( elem, value ) { + var name, + i = 0, + + // Attribute names can contain non-HTML whitespace characters + // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 + attrNames = value && value.match( rnothtmlwhite ); + + if ( attrNames && elem.nodeType === 1 ) { + while ( ( name = attrNames[ i++ ] ) ) { + elem.removeAttribute( name ); + } + } + } +} ); + +// Hooks for boolean attributes +boolHook = { + set: function( elem, value, name ) { + if ( value === false ) { + + // Remove boolean attributes when set to false + jQuery.removeAttr( elem, name ); + } else { + elem.setAttribute( name, name ); + } + return name; + } +}; + +jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) { + var getter = attrHandle[ name ] || jQuery.find.attr; + + attrHandle[ name ] = function( elem, name, isXML ) { + var ret, handle, + lowercaseName = name.toLowerCase(); + + if ( !isXML ) { + + // Avoid an infinite loop by temporarily removing this function from the getter + handle = attrHandle[ lowercaseName ]; + attrHandle[ lowercaseName ] = ret; + ret = getter( elem, name, isXML ) != null ? + lowercaseName : + null; + attrHandle[ lowercaseName ] = handle; + } + return ret; + }; +} ); + + + + +var rfocusable = /^(?:input|select|textarea|button)$/i, + rclickable = /^(?:a|area)$/i; + +jQuery.fn.extend( { + prop: function( name, value ) { + return access( this, jQuery.prop, name, value, arguments.length > 1 ); + }, + + removeProp: function( name ) { + return this.each( function() { + delete this[ jQuery.propFix[ name ] || name ]; + } ); + } +} ); + +jQuery.extend( { + prop: function( elem, name, value ) { + var ret, hooks, + nType = elem.nodeType; + + // Don't get/set properties on text, comment and attribute nodes + if ( nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { + + // Fix name and attach hooks + name = jQuery.propFix[ name ] || name; + hooks = jQuery.propHooks[ name ]; + } + + if ( value !== undefined ) { + if ( hooks && "set" in hooks && + ( ret = hooks.set( elem, value, name ) ) !== undefined ) { + return ret; + } + + return ( elem[ name ] = value ); + } + + if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { + return ret; + } + + return elem[ name ]; + }, + + propHooks: { + tabIndex: { + get: function( elem ) { + + // Support: IE <=9 - 11 only + // elem.tabIndex doesn't always return the + // correct value when it hasn't been explicitly set + // Use proper attribute retrieval (trac-12072) + var tabindex = jQuery.find.attr( elem, "tabindex" ); + + if ( tabindex ) { + return parseInt( tabindex, 10 ); + } + + if ( + rfocusable.test( elem.nodeName ) || + rclickable.test( elem.nodeName ) && + elem.href + ) { + return 0; + } + + return -1; + } + } + }, + + propFix: { + "for": "htmlFor", + "class": "className" + } +} ); + +// Support: IE <=11 only +// Accessing the selectedIndex property +// forces the browser to respect setting selected +// on the option +// The getter ensures a default option is selected +// when in an optgroup +// eslint rule "no-unused-expressions" is disabled for this code +// since it considers such accessions noop +if ( !support.optSelected ) { + jQuery.propHooks.selected = { + get: function( elem ) { + + /* eslint no-unused-expressions: "off" */ + + var parent = elem.parentNode; + if ( parent && parent.parentNode ) { + parent.parentNode.selectedIndex; + } + return null; + }, + set: function( elem ) { + + /* eslint no-unused-expressions: "off" */ + + var parent = elem.parentNode; + if ( parent ) { + parent.selectedIndex; + + if ( parent.parentNode ) { + parent.parentNode.selectedIndex; + } + } + } + }; +} + +jQuery.each( [ + "tabIndex", + "readOnly", + "maxLength", + "cellSpacing", + "cellPadding", + "rowSpan", + "colSpan", + "useMap", + "frameBorder", + "contentEditable" +], function() { + jQuery.propFix[ this.toLowerCase() ] = this; +} ); + + + + + // Strip and collapse whitespace according to HTML spec + // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace + function stripAndCollapse( value ) { + var tokens = value.match( rnothtmlwhite ) || []; + return tokens.join( " " ); + } + + +function getClass( elem ) { + return elem.getAttribute && elem.getAttribute( "class" ) || ""; +} + +function classesToArray( value ) { + if ( Array.isArray( value ) ) { + return value; + } + if ( typeof value === "string" ) { + return value.match( rnothtmlwhite ) || []; + } + return []; +} + +jQuery.fn.extend( { + addClass: function( value ) { + var classNames, cur, curValue, className, i, finalValue; + + if ( isFunction( value ) ) { + return this.each( function( j ) { + jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); + } ); + } + + classNames = classesToArray( value ); + + if ( classNames.length ) { + return this.each( function() { + curValue = getClass( this ); + cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); + + if ( cur ) { + for ( i = 0; i < classNames.length; i++ ) { + className = classNames[ i ]; + if ( cur.indexOf( " " + className + " " ) < 0 ) { + cur += className + " "; + } + } + + // Only assign if different to avoid unneeded rendering. + finalValue = stripAndCollapse( cur ); + if ( curValue !== finalValue ) { + this.setAttribute( "class", finalValue ); + } + } + } ); + } + + return this; + }, + + removeClass: function( value ) { + var classNames, cur, curValue, className, i, finalValue; + + if ( isFunction( value ) ) { + return this.each( function( j ) { + jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); + } ); + } + + if ( !arguments.length ) { + return this.attr( "class", "" ); + } + + classNames = classesToArray( value ); + + if ( classNames.length ) { + return this.each( function() { + curValue = getClass( this ); + + // This expression is here for better compressibility (see addClass) + cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); + + if ( cur ) { + for ( i = 0; i < classNames.length; i++ ) { + className = classNames[ i ]; + + // Remove *all* instances + while ( cur.indexOf( " " + className + " " ) > -1 ) { + cur = cur.replace( " " + className + " ", " " ); + } + } + + // Only assign if different to avoid unneeded rendering. + finalValue = stripAndCollapse( cur ); + if ( curValue !== finalValue ) { + this.setAttribute( "class", finalValue ); + } + } + } ); + } + + return this; + }, + + toggleClass: function( value, stateVal ) { + var classNames, className, i, self, + type = typeof value, + isValidValue = type === "string" || Array.isArray( value ); + + if ( isFunction( value ) ) { + return this.each( function( i ) { + jQuery( this ).toggleClass( + value.call( this, i, getClass( this ), stateVal ), + stateVal + ); + } ); + } + + if ( typeof stateVal === "boolean" && isValidValue ) { + return stateVal ? this.addClass( value ) : this.removeClass( value ); + } + + classNames = classesToArray( value ); + + return this.each( function() { + if ( isValidValue ) { + + // Toggle individual class names + self = jQuery( this ); + + for ( i = 0; i < classNames.length; i++ ) { + className = classNames[ i ]; + + // Check each className given, space separated list + if ( self.hasClass( className ) ) { + self.removeClass( className ); + } else { + self.addClass( className ); + } + } + + // Toggle whole class name + } else if ( value === undefined || type === "boolean" ) { + className = getClass( this ); + if ( className ) { + + // Store className if set + dataPriv.set( this, "__className__", className ); + } + + // If the element has a class name or if we're passed `false`, + // then remove the whole classname (if there was one, the above saved it). + // Otherwise bring back whatever was previously saved (if anything), + // falling back to the empty string if nothing was stored. + if ( this.setAttribute ) { + this.setAttribute( "class", + className || value === false ? + "" : + dataPriv.get( this, "__className__" ) || "" + ); + } + } + } ); + }, + + hasClass: function( selector ) { + var className, elem, + i = 0; + + className = " " + selector + " "; + while ( ( elem = this[ i++ ] ) ) { + if ( elem.nodeType === 1 && + ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { + return true; + } + } + + return false; + } +} ); + + + + +var rreturn = /\r/g; + +jQuery.fn.extend( { + val: function( value ) { + var hooks, ret, valueIsFunction, + elem = this[ 0 ]; + + if ( !arguments.length ) { + if ( elem ) { + hooks = jQuery.valHooks[ elem.type ] || + jQuery.valHooks[ elem.nodeName.toLowerCase() ]; + + if ( hooks && + "get" in hooks && + ( ret = hooks.get( elem, "value" ) ) !== undefined + ) { + return ret; + } + + ret = elem.value; + + // Handle most common string cases + if ( typeof ret === "string" ) { + return ret.replace( rreturn, "" ); + } + + // Handle cases where value is null/undef or number + return ret == null ? "" : ret; + } + + return; + } + + valueIsFunction = isFunction( value ); + + return this.each( function( i ) { + var val; + + if ( this.nodeType !== 1 ) { + return; + } + + if ( valueIsFunction ) { + val = value.call( this, i, jQuery( this ).val() ); + } else { + val = value; + } + + // Treat null/undefined as ""; convert numbers to string + if ( val == null ) { + val = ""; + + } else if ( typeof val === "number" ) { + val += ""; + + } else if ( Array.isArray( val ) ) { + val = jQuery.map( val, function( value ) { + return value == null ? "" : value + ""; + } ); + } + + hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; + + // If set returns undefined, fall back to normal setting + if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { + this.value = val; + } + } ); + } +} ); + +jQuery.extend( { + valHooks: { + option: { + get: function( elem ) { + + var val = jQuery.find.attr( elem, "value" ); + return val != null ? + val : + + // Support: IE <=10 - 11 only + // option.text throws exceptions (trac-14686, trac-14858) + // Strip and collapse whitespace + // https://html.spec.whatwg.org/#strip-and-collapse-whitespace + stripAndCollapse( jQuery.text( elem ) ); + } + }, + select: { + get: function( elem ) { + var value, option, i, + options = elem.options, + index = elem.selectedIndex, + one = elem.type === "select-one", + values = one ? null : [], + max = one ? index + 1 : options.length; + + if ( index < 0 ) { + i = max; + + } else { + i = one ? index : 0; + } + + // Loop through all the selected options + for ( ; i < max; i++ ) { + option = options[ i ]; + + // Support: IE <=9 only + // IE8-9 doesn't update selected after form reset (trac-2551) + if ( ( option.selected || i === index ) && + + // Don't return options that are disabled or in a disabled optgroup + !option.disabled && + ( !option.parentNode.disabled || + !nodeName( option.parentNode, "optgroup" ) ) ) { + + // Get the specific value for the option + value = jQuery( option ).val(); + + // We don't need an array for one selects + if ( one ) { + return value; + } + + // Multi-Selects return an array + values.push( value ); + } + } + + return values; + }, + + set: function( elem, value ) { + var optionSet, option, + options = elem.options, + values = jQuery.makeArray( value ), + i = options.length; + + while ( i-- ) { + option = options[ i ]; + + /* eslint-disable no-cond-assign */ + + if ( option.selected = + jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 + ) { + optionSet = true; + } + + /* eslint-enable no-cond-assign */ + } + + // Force browsers to behave consistently when non-matching value is set + if ( !optionSet ) { + elem.selectedIndex = -1; + } + return values; + } + } + } +} ); + +// Radios and checkboxes getter/setter +jQuery.each( [ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = { + set: function( elem, value ) { + if ( Array.isArray( value ) ) { + return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); + } + } + }; + if ( !support.checkOn ) { + jQuery.valHooks[ this ].get = function( elem ) { + return elem.getAttribute( "value" ) === null ? "on" : elem.value; + }; + } +} ); + + + + +// Return jQuery for attributes-only inclusion + + +support.focusin = "onfocusin" in window; + + +var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, + stopPropagationCallback = function( e ) { + e.stopPropagation(); + }; + +jQuery.extend( jQuery.event, { + + trigger: function( event, data, elem, onlyHandlers ) { + + var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, + eventPath = [ elem || document ], + type = hasOwn.call( event, "type" ) ? event.type : event, + namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; + + cur = lastElement = tmp = elem = elem || document; + + // Don't do events on text and comment nodes + if ( elem.nodeType === 3 || elem.nodeType === 8 ) { + return; + } + + // focus/blur morphs to focusin/out; ensure we're not firing them right now + if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { + return; + } + + if ( type.indexOf( "." ) > -1 ) { + + // Namespaced trigger; create a regexp to match event type in handle() + namespaces = type.split( "." ); + type = namespaces.shift(); + namespaces.sort(); + } + ontype = type.indexOf( ":" ) < 0 && "on" + type; + + // Caller can pass in a jQuery.Event object, Object, or just an event type string + event = event[ jQuery.expando ] ? + event : + new jQuery.Event( type, typeof event === "object" && event ); + + // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) + event.isTrigger = onlyHandlers ? 2 : 3; + event.namespace = namespaces.join( "." ); + event.rnamespace = event.namespace ? + new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : + null; + + // Clean up the event in case it is being reused + event.result = undefined; + if ( !event.target ) { + event.target = elem; + } + + // Clone any incoming data and prepend the event, creating the handler arg list + data = data == null ? + [ event ] : + jQuery.makeArray( data, [ event ] ); + + // Allow special events to draw outside the lines + special = jQuery.event.special[ type ] || {}; + if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { + return; + } + + // Determine event propagation path in advance, per W3C events spec (trac-9951) + // Bubble up to document, then to window; watch for a global ownerDocument var (trac-9724) + if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { + + bubbleType = special.delegateType || type; + if ( !rfocusMorph.test( bubbleType + type ) ) { + cur = cur.parentNode; + } + for ( ; cur; cur = cur.parentNode ) { + eventPath.push( cur ); + tmp = cur; + } + + // Only add window if we got to document (e.g., not plain obj or detached DOM) + if ( tmp === ( elem.ownerDocument || document ) ) { + eventPath.push( tmp.defaultView || tmp.parentWindow || window ); + } + } + + // Fire handlers on the event path + i = 0; + while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { + lastElement = cur; + event.type = i > 1 ? + bubbleType : + special.bindType || type; + + // jQuery handler + handle = ( dataPriv.get( cur, "events" ) || Object.create( null ) )[ event.type ] && + dataPriv.get( cur, "handle" ); + if ( handle ) { + handle.apply( cur, data ); + } + + // Native handler + handle = ontype && cur[ ontype ]; + if ( handle && handle.apply && acceptData( cur ) ) { + event.result = handle.apply( cur, data ); + if ( event.result === false ) { + event.preventDefault(); + } + } + } + event.type = type; + + // If nobody prevented the default action, do it now + if ( !onlyHandlers && !event.isDefaultPrevented() ) { + + if ( ( !special._default || + special._default.apply( eventPath.pop(), data ) === false ) && + acceptData( elem ) ) { + + // Call a native DOM method on the target with the same name as the event. + // Don't do default actions on window, that's where global variables be (trac-6170) + if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { + + // Don't re-trigger an onFOO event when we call its FOO() method + tmp = elem[ ontype ]; + + if ( tmp ) { + elem[ ontype ] = null; + } + + // Prevent re-triggering of the same event, since we already bubbled it above + jQuery.event.triggered = type; + + if ( event.isPropagationStopped() ) { + lastElement.addEventListener( type, stopPropagationCallback ); + } + + elem[ type ](); + + if ( event.isPropagationStopped() ) { + lastElement.removeEventListener( type, stopPropagationCallback ); + } + + jQuery.event.triggered = undefined; + + if ( tmp ) { + elem[ ontype ] = tmp; + } + } + } + } + + return event.result; + }, + + // Piggyback on a donor event to simulate a different one + // Used only for `focus(in | out)` events + simulate: function( type, elem, event ) { + var e = jQuery.extend( + new jQuery.Event(), + event, + { + type: type, + isSimulated: true + } + ); + + jQuery.event.trigger( e, null, elem ); + } + +} ); + +jQuery.fn.extend( { + + trigger: function( type, data ) { + return this.each( function() { + jQuery.event.trigger( type, data, this ); + } ); + }, + triggerHandler: function( type, data ) { + var elem = this[ 0 ]; + if ( elem ) { + return jQuery.event.trigger( type, data, elem, true ); + } + } +} ); + + +// Support: Firefox <=44 +// Firefox doesn't have focus(in | out) events +// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 +// +// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 +// focus(in | out) events fire after focus & blur events, +// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order +// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 +if ( !support.focusin ) { + jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { + + // Attach a single capturing handler on the document while someone wants focusin/focusout + var handler = function( event ) { + jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); + }; + + jQuery.event.special[ fix ] = { + setup: function() { + + // Handle: regular nodes (via `this.ownerDocument`), window + // (via `this.document`) & document (via `this`). + var doc = this.ownerDocument || this.document || this, + attaches = dataPriv.access( doc, fix ); + + if ( !attaches ) { + doc.addEventListener( orig, handler, true ); + } + dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); + }, + teardown: function() { + var doc = this.ownerDocument || this.document || this, + attaches = dataPriv.access( doc, fix ) - 1; + + if ( !attaches ) { + doc.removeEventListener( orig, handler, true ); + dataPriv.remove( doc, fix ); + + } else { + dataPriv.access( doc, fix, attaches ); + } + } + }; + } ); +} +var location = window.location; + +var nonce = { guid: Date.now() }; + +var rquery = ( /\?/ ); + + + +// Cross-browser xml parsing +jQuery.parseXML = function( data ) { + var xml, parserErrorElem; + if ( !data || typeof data !== "string" ) { + return null; + } + + // Support: IE 9 - 11 only + // IE throws on parseFromString with invalid input. + try { + xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); + } catch ( e ) {} + + parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ]; + if ( !xml || parserErrorElem ) { + jQuery.error( "Invalid XML: " + ( + parserErrorElem ? + jQuery.map( parserErrorElem.childNodes, function( el ) { + return el.textContent; + } ).join( "\n" ) : + data + ) ); + } + return xml; +}; + + +var + rbracket = /\[\]$/, + rCRLF = /\r?\n/g, + rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, + rsubmittable = /^(?:input|select|textarea|keygen)/i; + +function buildParams( prefix, obj, traditional, add ) { + var name; + + if ( Array.isArray( obj ) ) { + + // Serialize array item. + jQuery.each( obj, function( i, v ) { + if ( traditional || rbracket.test( prefix ) ) { + + // Treat each array item as a scalar. + add( prefix, v ); + + } else { + + // Item is non-scalar (array or object), encode its numeric index. + buildParams( + prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", + v, + traditional, + add + ); + } + } ); + + } else if ( !traditional && toType( obj ) === "object" ) { + + // Serialize object item. + for ( name in obj ) { + buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); + } + + } else { + + // Serialize scalar item. + add( prefix, obj ); + } +} + +// Serialize an array of form elements or a set of +// key/values into a query string +jQuery.param = function( a, traditional ) { + var prefix, + s = [], + add = function( key, valueOrFunction ) { + + // If value is a function, invoke it and use its return value + var value = isFunction( valueOrFunction ) ? + valueOrFunction() : + valueOrFunction; + + s[ s.length ] = encodeURIComponent( key ) + "=" + + encodeURIComponent( value == null ? "" : value ); + }; + + if ( a == null ) { + return ""; + } + + // If an array was passed in, assume that it is an array of form elements. + if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { + + // Serialize the form elements + jQuery.each( a, function() { + add( this.name, this.value ); + } ); + + } else { + + // If traditional, encode the "old" way (the way 1.3.2 or older + // did it), otherwise encode params recursively. + for ( prefix in a ) { + buildParams( prefix, a[ prefix ], traditional, add ); + } + } + + // Return the resulting serialization + return s.join( "&" ); +}; + +jQuery.fn.extend( { + serialize: function() { + return jQuery.param( this.serializeArray() ); + }, + serializeArray: function() { + return this.map( function() { + + // Can add propHook for "elements" to filter or add form elements + var elements = jQuery.prop( this, "elements" ); + return elements ? jQuery.makeArray( elements ) : this; + } ).filter( function() { + var type = this.type; + + // Use .is( ":disabled" ) so that fieldset[disabled] works + return this.name && !jQuery( this ).is( ":disabled" ) && + rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && + ( this.checked || !rcheckableType.test( type ) ); + } ).map( function( _i, elem ) { + var val = jQuery( this ).val(); + + if ( val == null ) { + return null; + } + + if ( Array.isArray( val ) ) { + return jQuery.map( val, function( val ) { + return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; + } ); + } + + return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; + } ).get(); + } +} ); + + +var + r20 = /%20/g, + rhash = /#.*$/, + rantiCache = /([?&])_=[^&]*/, + rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, + + // trac-7653, trac-8125, trac-8152: local protocol detection + rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, + rnoContent = /^(?:GET|HEAD)$/, + rprotocol = /^\/\//, + + /* Prefilters + * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) + * 2) These are called: + * - BEFORE asking for a transport + * - AFTER param serialization (s.data is a string if s.processData is true) + * 3) key is the dataType + * 4) the catchall symbol "*" can be used + * 5) execution will start with transport dataType and THEN continue down to "*" if needed + */ + prefilters = {}, + + /* Transports bindings + * 1) key is the dataType + * 2) the catchall symbol "*" can be used + * 3) selection will start with transport dataType and THEN go to "*" if needed + */ + transports = {}, + + // Avoid comment-prolog char sequence (trac-10098); must appease lint and evade compression + allTypes = "*/".concat( "*" ), + + // Anchor tag for parsing the document origin + originAnchor = document.createElement( "a" ); + +originAnchor.href = location.href; + +// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport +function addToPrefiltersOrTransports( structure ) { + + // dataTypeExpression is optional and defaults to "*" + return function( dataTypeExpression, func ) { + + if ( typeof dataTypeExpression !== "string" ) { + func = dataTypeExpression; + dataTypeExpression = "*"; + } + + var dataType, + i = 0, + dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; + + if ( isFunction( func ) ) { + + // For each dataType in the dataTypeExpression + while ( ( dataType = dataTypes[ i++ ] ) ) { + + // Prepend if requested + if ( dataType[ 0 ] === "+" ) { + dataType = dataType.slice( 1 ) || "*"; + ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); + + // Otherwise append + } else { + ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); + } + } + } + }; +} + +// Base inspection function for prefilters and transports +function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { + + var inspected = {}, + seekingTransport = ( structure === transports ); + + function inspect( dataType ) { + var selected; + inspected[ dataType ] = true; + jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { + var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); + if ( typeof dataTypeOrTransport === "string" && + !seekingTransport && !inspected[ dataTypeOrTransport ] ) { + + options.dataTypes.unshift( dataTypeOrTransport ); + inspect( dataTypeOrTransport ); + return false; + } else if ( seekingTransport ) { + return !( selected = dataTypeOrTransport ); + } + } ); + return selected; + } + + return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); +} + +// A special extend for ajax options +// that takes "flat" options (not to be deep extended) +// Fixes trac-9887 +function ajaxExtend( target, src ) { + var key, deep, + flatOptions = jQuery.ajaxSettings.flatOptions || {}; + + for ( key in src ) { + if ( src[ key ] !== undefined ) { + ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; + } + } + if ( deep ) { + jQuery.extend( true, target, deep ); + } + + return target; +} + +/* Handles responses to an ajax request: + * - finds the right dataType (mediates between content-type and expected dataType) + * - returns the corresponding response + */ +function ajaxHandleResponses( s, jqXHR, responses ) { + + var ct, type, finalDataType, firstDataType, + contents = s.contents, + dataTypes = s.dataTypes; + + // Remove auto dataType and get content-type in the process + while ( dataTypes[ 0 ] === "*" ) { + dataTypes.shift(); + if ( ct === undefined ) { + ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); + } + } + + // Check if we're dealing with a known content-type + if ( ct ) { + for ( type in contents ) { + if ( contents[ type ] && contents[ type ].test( ct ) ) { + dataTypes.unshift( type ); + break; + } + } + } + + // Check to see if we have a response for the expected dataType + if ( dataTypes[ 0 ] in responses ) { + finalDataType = dataTypes[ 0 ]; + } else { + + // Try convertible dataTypes + for ( type in responses ) { + if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { + finalDataType = type; + break; + } + if ( !firstDataType ) { + firstDataType = type; + } + } + + // Or just use first one + finalDataType = finalDataType || firstDataType; + } + + // If we found a dataType + // We add the dataType to the list if needed + // and return the corresponding response + if ( finalDataType ) { + if ( finalDataType !== dataTypes[ 0 ] ) { + dataTypes.unshift( finalDataType ); + } + return responses[ finalDataType ]; + } +} + +/* Chain conversions given the request and the original response + * Also sets the responseXXX fields on the jqXHR instance + */ +function ajaxConvert( s, response, jqXHR, isSuccess ) { + var conv2, current, conv, tmp, prev, + converters = {}, + + // Work with a copy of dataTypes in case we need to modify it for conversion + dataTypes = s.dataTypes.slice(); + + // Create converters map with lowercased keys + if ( dataTypes[ 1 ] ) { + for ( conv in s.converters ) { + converters[ conv.toLowerCase() ] = s.converters[ conv ]; + } + } + + current = dataTypes.shift(); + + // Convert to each sequential dataType + while ( current ) { + + if ( s.responseFields[ current ] ) { + jqXHR[ s.responseFields[ current ] ] = response; + } + + // Apply the dataFilter if provided + if ( !prev && isSuccess && s.dataFilter ) { + response = s.dataFilter( response, s.dataType ); + } + + prev = current; + current = dataTypes.shift(); + + if ( current ) { + + // There's only work to do if current dataType is non-auto + if ( current === "*" ) { + + current = prev; + + // Convert response if prev dataType is non-auto and differs from current + } else if ( prev !== "*" && prev !== current ) { + + // Seek a direct converter + conv = converters[ prev + " " + current ] || converters[ "* " + current ]; + + // If none found, seek a pair + if ( !conv ) { + for ( conv2 in converters ) { + + // If conv2 outputs current + tmp = conv2.split( " " ); + if ( tmp[ 1 ] === current ) { + + // If prev can be converted to accepted input + conv = converters[ prev + " " + tmp[ 0 ] ] || + converters[ "* " + tmp[ 0 ] ]; + if ( conv ) { + + // Condense equivalence converters + if ( conv === true ) { + conv = converters[ conv2 ]; + + // Otherwise, insert the intermediate dataType + } else if ( converters[ conv2 ] !== true ) { + current = tmp[ 0 ]; + dataTypes.unshift( tmp[ 1 ] ); + } + break; + } + } + } + } + + // Apply converter (if not an equivalence) + if ( conv !== true ) { + + // Unless errors are allowed to bubble, catch and return them + if ( conv && s.throws ) { + response = conv( response ); + } else { + try { + response = conv( response ); + } catch ( e ) { + return { + state: "parsererror", + error: conv ? e : "No conversion from " + prev + " to " + current + }; + } + } + } + } + } + } + + return { state: "success", data: response }; +} + +jQuery.extend( { + + // Counter for holding the number of active queries + active: 0, + + // Last-Modified header cache for next request + lastModified: {}, + etag: {}, + + ajaxSettings: { + url: location.href, + type: "GET", + isLocal: rlocalProtocol.test( location.protocol ), + global: true, + processData: true, + async: true, + contentType: "application/x-www-form-urlencoded; charset=UTF-8", + + /* + timeout: 0, + data: null, + dataType: null, + username: null, + password: null, + cache: null, + throws: false, + traditional: false, + headers: {}, + */ + + accepts: { + "*": allTypes, + text: "text/plain", + html: "text/html", + xml: "application/xml, text/xml", + json: "application/json, text/javascript" + }, + + contents: { + xml: /\bxml\b/, + html: /\bhtml/, + json: /\bjson\b/ + }, + + responseFields: { + xml: "responseXML", + text: "responseText", + json: "responseJSON" + }, + + // Data converters + // Keys separate source (or catchall "*") and destination types with a single space + converters: { + + // Convert anything to text + "* text": String, + + // Text to html (true = no transformation) + "text html": true, + + // Evaluate text as a json expression + "text json": JSON.parse, + + // Parse text as xml + "text xml": jQuery.parseXML + }, + + // For options that shouldn't be deep extended: + // you can add your own custom options here if + // and when you create one that shouldn't be + // deep extended (see ajaxExtend) + flatOptions: { + url: true, + context: true + } + }, + + // Creates a full fledged settings object into target + // with both ajaxSettings and settings fields. + // If target is omitted, writes into ajaxSettings. + ajaxSetup: function( target, settings ) { + return settings ? + + // Building a settings object + ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : + + // Extending ajaxSettings + ajaxExtend( jQuery.ajaxSettings, target ); + }, + + ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), + ajaxTransport: addToPrefiltersOrTransports( transports ), + + // Main method + ajax: function( url, options ) { + + // If url is an object, simulate pre-1.5 signature + if ( typeof url === "object" ) { + options = url; + url = undefined; + } + + // Force options to be an object + options = options || {}; + + var transport, + + // URL without anti-cache param + cacheURL, + + // Response headers + responseHeadersString, + responseHeaders, + + // timeout handle + timeoutTimer, + + // Url cleanup var + urlAnchor, + + // Request state (becomes false upon send and true upon completion) + completed, + + // To know if global events are to be dispatched + fireGlobals, + + // Loop variable + i, + + // uncached part of the url + uncached, + + // Create the final options object + s = jQuery.ajaxSetup( {}, options ), + + // Callbacks context + callbackContext = s.context || s, + + // Context for global events is callbackContext if it is a DOM node or jQuery collection + globalEventContext = s.context && + ( callbackContext.nodeType || callbackContext.jquery ) ? + jQuery( callbackContext ) : + jQuery.event, + + // Deferreds + deferred = jQuery.Deferred(), + completeDeferred = jQuery.Callbacks( "once memory" ), + + // Status-dependent callbacks + statusCode = s.statusCode || {}, + + // Headers (they are sent all at once) + requestHeaders = {}, + requestHeadersNames = {}, + + // Default abort message + strAbort = "canceled", + + // Fake xhr + jqXHR = { + readyState: 0, + + // Builds headers hashtable if needed + getResponseHeader: function( key ) { + var match; + if ( completed ) { + if ( !responseHeaders ) { + responseHeaders = {}; + while ( ( match = rheaders.exec( responseHeadersString ) ) ) { + responseHeaders[ match[ 1 ].toLowerCase() + " " ] = + ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] ) + .concat( match[ 2 ] ); + } + } + match = responseHeaders[ key.toLowerCase() + " " ]; + } + return match == null ? null : match.join( ", " ); + }, + + // Raw string + getAllResponseHeaders: function() { + return completed ? responseHeadersString : null; + }, + + // Caches the header + setRequestHeader: function( name, value ) { + if ( completed == null ) { + name = requestHeadersNames[ name.toLowerCase() ] = + requestHeadersNames[ name.toLowerCase() ] || name; + requestHeaders[ name ] = value; + } + return this; + }, + + // Overrides response content-type header + overrideMimeType: function( type ) { + if ( completed == null ) { + s.mimeType = type; + } + return this; + }, + + // Status-dependent callbacks + statusCode: function( map ) { + var code; + if ( map ) { + if ( completed ) { + + // Execute the appropriate callbacks + jqXHR.always( map[ jqXHR.status ] ); + } else { + + // Lazy-add the new callbacks in a way that preserves old ones + for ( code in map ) { + statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; + } + } + } + return this; + }, + + // Cancel the request + abort: function( statusText ) { + var finalText = statusText || strAbort; + if ( transport ) { + transport.abort( finalText ); + } + done( 0, finalText ); + return this; + } + }; + + // Attach deferreds + deferred.promise( jqXHR ); + + // Add protocol if not provided (prefilters might expect it) + // Handle falsy url in the settings object (trac-10093: consistency with old signature) + // We also use the url parameter if available + s.url = ( ( url || s.url || location.href ) + "" ) + .replace( rprotocol, location.protocol + "//" ); + + // Alias method option to type as per ticket trac-12004 + s.type = options.method || options.type || s.method || s.type; + + // Extract dataTypes list + s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; + + // A cross-domain request is in order when the origin doesn't match the current origin. + if ( s.crossDomain == null ) { + urlAnchor = document.createElement( "a" ); + + // Support: IE <=8 - 11, Edge 12 - 15 + // IE throws exception on accessing the href property if url is malformed, + // e.g. http://example.com:80x/ + try { + urlAnchor.href = s.url; + + // Support: IE <=8 - 11 only + // Anchor's host property isn't correctly set when s.url is relative + urlAnchor.href = urlAnchor.href; + s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== + urlAnchor.protocol + "//" + urlAnchor.host; + } catch ( e ) { + + // If there is an error parsing the URL, assume it is crossDomain, + // it can be rejected by the transport if it is invalid + s.crossDomain = true; + } + } + + // Convert data if not already a string + if ( s.data && s.processData && typeof s.data !== "string" ) { + s.data = jQuery.param( s.data, s.traditional ); + } + + // Apply prefilters + inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); + + // If request was aborted inside a prefilter, stop there + if ( completed ) { + return jqXHR; + } + + // We can fire global events as of now if asked to + // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (trac-15118) + fireGlobals = jQuery.event && s.global; + + // Watch for a new set of requests + if ( fireGlobals && jQuery.active++ === 0 ) { + jQuery.event.trigger( "ajaxStart" ); + } + + // Uppercase the type + s.type = s.type.toUpperCase(); + + // Determine if request has content + s.hasContent = !rnoContent.test( s.type ); + + // Save the URL in case we're toying with the If-Modified-Since + // and/or If-None-Match header later on + // Remove hash to simplify url manipulation + cacheURL = s.url.replace( rhash, "" ); + + // More options handling for requests with no content + if ( !s.hasContent ) { + + // Remember the hash so we can put it back + uncached = s.url.slice( cacheURL.length ); + + // If data is available and should be processed, append data to url + if ( s.data && ( s.processData || typeof s.data === "string" ) ) { + cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; + + // trac-9682: remove data so that it's not used in an eventual retry + delete s.data; + } + + // Add or update anti-cache param if needed + if ( s.cache === false ) { + cacheURL = cacheURL.replace( rantiCache, "$1" ); + uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) + + uncached; + } + + // Put hash and anti-cache on the URL that will be requested (gh-1732) + s.url = cacheURL + uncached; + + // Change '%20' to '+' if this is encoded form body content (gh-2658) + } else if ( s.data && s.processData && + ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { + s.data = s.data.replace( r20, "+" ); + } + + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. + if ( s.ifModified ) { + if ( jQuery.lastModified[ cacheURL ] ) { + jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); + } + if ( jQuery.etag[ cacheURL ] ) { + jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); + } + } + + // Set the correct header, if data is being sent + if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { + jqXHR.setRequestHeader( "Content-Type", s.contentType ); + } + + // Set the Accepts header for the server, depending on the dataType + jqXHR.setRequestHeader( + "Accept", + s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? + s.accepts[ s.dataTypes[ 0 ] ] + + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : + s.accepts[ "*" ] + ); + + // Check for headers option + for ( i in s.headers ) { + jqXHR.setRequestHeader( i, s.headers[ i ] ); + } + + // Allow custom headers/mimetypes and early abort + if ( s.beforeSend && + ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { + + // Abort if not done already and return + return jqXHR.abort(); + } + + // Aborting is no longer a cancellation + strAbort = "abort"; + + // Install callbacks on deferreds + completeDeferred.add( s.complete ); + jqXHR.done( s.success ); + jqXHR.fail( s.error ); + + // Get transport + transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); + + // If no transport, we auto-abort + if ( !transport ) { + done( -1, "No Transport" ); + } else { + jqXHR.readyState = 1; + + // Send global event + if ( fireGlobals ) { + globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); + } + + // If request was aborted inside ajaxSend, stop there + if ( completed ) { + return jqXHR; + } + + // Timeout + if ( s.async && s.timeout > 0 ) { + timeoutTimer = window.setTimeout( function() { + jqXHR.abort( "timeout" ); + }, s.timeout ); + } + + try { + completed = false; + transport.send( requestHeaders, done ); + } catch ( e ) { + + // Rethrow post-completion exceptions + if ( completed ) { + throw e; + } + + // Propagate others as results + done( -1, e ); + } + } + + // Callback for when everything is done + function done( status, nativeStatusText, responses, headers ) { + var isSuccess, success, error, response, modified, + statusText = nativeStatusText; + + // Ignore repeat invocations + if ( completed ) { + return; + } + + completed = true; + + // Clear timeout if it exists + if ( timeoutTimer ) { + window.clearTimeout( timeoutTimer ); + } + + // Dereference transport for early garbage collection + // (no matter how long the jqXHR object will be used) + transport = undefined; + + // Cache response headers + responseHeadersString = headers || ""; + + // Set readyState + jqXHR.readyState = status > 0 ? 4 : 0; + + // Determine if successful + isSuccess = status >= 200 && status < 300 || status === 304; + + // Get response data + if ( responses ) { + response = ajaxHandleResponses( s, jqXHR, responses ); + } + + // Use a noop converter for missing script but not if jsonp + if ( !isSuccess && + jQuery.inArray( "script", s.dataTypes ) > -1 && + jQuery.inArray( "json", s.dataTypes ) < 0 ) { + s.converters[ "text script" ] = function() {}; + } + + // Convert no matter what (that way responseXXX fields are always set) + response = ajaxConvert( s, response, jqXHR, isSuccess ); + + // If successful, handle type chaining + if ( isSuccess ) { + + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. + if ( s.ifModified ) { + modified = jqXHR.getResponseHeader( "Last-Modified" ); + if ( modified ) { + jQuery.lastModified[ cacheURL ] = modified; + } + modified = jqXHR.getResponseHeader( "etag" ); + if ( modified ) { + jQuery.etag[ cacheURL ] = modified; + } + } + + // if no content + if ( status === 204 || s.type === "HEAD" ) { + statusText = "nocontent"; + + // if not modified + } else if ( status === 304 ) { + statusText = "notmodified"; + + // If we have data, let's convert it + } else { + statusText = response.state; + success = response.data; + error = response.error; + isSuccess = !error; + } + } else { + + // Extract error from statusText and normalize for non-aborts + error = statusText; + if ( status || !statusText ) { + statusText = "error"; + if ( status < 0 ) { + status = 0; + } + } + } + + // Set data for the fake xhr object + jqXHR.status = status; + jqXHR.statusText = ( nativeStatusText || statusText ) + ""; + + // Success/Error + if ( isSuccess ) { + deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); + } else { + deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); + } + + // Status-dependent callbacks + jqXHR.statusCode( statusCode ); + statusCode = undefined; + + if ( fireGlobals ) { + globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", + [ jqXHR, s, isSuccess ? success : error ] ); + } + + // Complete + completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); + + if ( fireGlobals ) { + globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); + + // Handle the global AJAX counter + if ( !( --jQuery.active ) ) { + jQuery.event.trigger( "ajaxStop" ); + } + } + } + + return jqXHR; + }, + + getJSON: function( url, data, callback ) { + return jQuery.get( url, data, callback, "json" ); + }, + + getScript: function( url, callback ) { + return jQuery.get( url, undefined, callback, "script" ); + } +} ); + +jQuery.each( [ "get", "post" ], function( _i, method ) { + jQuery[ method ] = function( url, data, callback, type ) { + + // Shift arguments if data argument was omitted + if ( isFunction( data ) ) { + type = type || callback; + callback = data; + data = undefined; + } + + // The url can be an options object (which then must have .url) + return jQuery.ajax( jQuery.extend( { + url: url, + type: method, + dataType: type, + data: data, + success: callback + }, jQuery.isPlainObject( url ) && url ) ); + }; +} ); + +jQuery.ajaxPrefilter( function( s ) { + var i; + for ( i in s.headers ) { + if ( i.toLowerCase() === "content-type" ) { + s.contentType = s.headers[ i ] || ""; + } + } +} ); + + +jQuery._evalUrl = function( url, options, doc ) { + return jQuery.ajax( { + url: url, + + // Make this explicit, since user can override this through ajaxSetup (trac-11264) + type: "GET", + dataType: "script", + cache: true, + async: false, + global: false, + + // Only evaluate the response if it is successful (gh-4126) + // dataFilter is not invoked for failure responses, so using it instead + // of the default converter is kludgy but it works. + converters: { + "text script": function() {} + }, + dataFilter: function( response ) { + jQuery.globalEval( response, options, doc ); + } + } ); +}; + + +jQuery.fn.extend( { + wrapAll: function( html ) { + var wrap; + + if ( this[ 0 ] ) { + if ( isFunction( html ) ) { + html = html.call( this[ 0 ] ); + } + + // The elements to wrap the target around + wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); + + if ( this[ 0 ].parentNode ) { + wrap.insertBefore( this[ 0 ] ); + } + + wrap.map( function() { + var elem = this; + + while ( elem.firstElementChild ) { + elem = elem.firstElementChild; + } + + return elem; + } ).append( this ); + } + + return this; + }, + + wrapInner: function( html ) { + if ( isFunction( html ) ) { + return this.each( function( i ) { + jQuery( this ).wrapInner( html.call( this, i ) ); + } ); + } + + return this.each( function() { + var self = jQuery( this ), + contents = self.contents(); + + if ( contents.length ) { + contents.wrapAll( html ); + + } else { + self.append( html ); + } + } ); + }, + + wrap: function( html ) { + var htmlIsFunction = isFunction( html ); + + return this.each( function( i ) { + jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html ); + } ); + }, + + unwrap: function( selector ) { + this.parent( selector ).not( "body" ).each( function() { + jQuery( this ).replaceWith( this.childNodes ); + } ); + return this; + } +} ); + + +jQuery.expr.pseudos.hidden = function( elem ) { + return !jQuery.expr.pseudos.visible( elem ); +}; +jQuery.expr.pseudos.visible = function( elem ) { + return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); +}; + + + + +jQuery.ajaxSettings.xhr = function() { + try { + return new window.XMLHttpRequest(); + } catch ( e ) {} +}; + +var xhrSuccessStatus = { + + // File protocol always yields status code 0, assume 200 + 0: 200, + + // Support: IE <=9 only + // trac-1450: sometimes IE returns 1223 when it should be 204 + 1223: 204 + }, + xhrSupported = jQuery.ajaxSettings.xhr(); + +support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); +support.ajax = xhrSupported = !!xhrSupported; + +jQuery.ajaxTransport( function( options ) { + var callback, errorCallback; + + // Cross domain only allowed if supported through XMLHttpRequest + if ( support.cors || xhrSupported && !options.crossDomain ) { + return { + send: function( headers, complete ) { + var i, + xhr = options.xhr(); + + xhr.open( + options.type, + options.url, + options.async, + options.username, + options.password + ); + + // Apply custom fields if provided + if ( options.xhrFields ) { + for ( i in options.xhrFields ) { + xhr[ i ] = options.xhrFields[ i ]; + } + } + + // Override mime type if needed + if ( options.mimeType && xhr.overrideMimeType ) { + xhr.overrideMimeType( options.mimeType ); + } + + // X-Requested-With header + // For cross-domain requests, seeing as conditions for a preflight are + // akin to a jigsaw puzzle, we simply never set it to be sure. + // (it can always be set on a per-request basis or even using ajaxSetup) + // For same-domain requests, won't change header if already provided. + if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { + headers[ "X-Requested-With" ] = "XMLHttpRequest"; + } + + // Set headers + for ( i in headers ) { + xhr.setRequestHeader( i, headers[ i ] ); + } + + // Callback + callback = function( type ) { + return function() { + if ( callback ) { + callback = errorCallback = xhr.onload = + xhr.onerror = xhr.onabort = xhr.ontimeout = + xhr.onreadystatechange = null; + + if ( type === "abort" ) { + xhr.abort(); + } else if ( type === "error" ) { + + // Support: IE <=9 only + // On a manual native abort, IE9 throws + // errors on any property access that is not readyState + if ( typeof xhr.status !== "number" ) { + complete( 0, "error" ); + } else { + complete( + + // File: protocol always yields status 0; see trac-8605, trac-14207 + xhr.status, + xhr.statusText + ); + } + } else { + complete( + xhrSuccessStatus[ xhr.status ] || xhr.status, + xhr.statusText, + + // Support: IE <=9 only + // IE9 has no XHR2 but throws on binary (trac-11426) + // For XHR2 non-text, let the caller handle it (gh-2498) + ( xhr.responseType || "text" ) !== "text" || + typeof xhr.responseText !== "string" ? + { binary: xhr.response } : + { text: xhr.responseText }, + xhr.getAllResponseHeaders() + ); + } + } + }; + }; + + // Listen to events + xhr.onload = callback(); + errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); + + // Support: IE 9 only + // Use onreadystatechange to replace onabort + // to handle uncaught aborts + if ( xhr.onabort !== undefined ) { + xhr.onabort = errorCallback; + } else { + xhr.onreadystatechange = function() { + + // Check readyState before timeout as it changes + if ( xhr.readyState === 4 ) { + + // Allow onerror to be called first, + // but that will not handle a native abort + // Also, save errorCallback to a variable + // as xhr.onerror cannot be accessed + window.setTimeout( function() { + if ( callback ) { + errorCallback(); + } + } ); + } + }; + } + + // Create the abort callback + callback = callback( "abort" ); + + try { + + // Do send the request (this may raise an exception) + xhr.send( options.hasContent && options.data || null ); + } catch ( e ) { + + // trac-14683: Only rethrow if this hasn't been notified as an error yet + if ( callback ) { + throw e; + } + } + }, + + abort: function() { + if ( callback ) { + callback(); + } + } + }; + } +} ); + + + + +// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) +jQuery.ajaxPrefilter( function( s ) { + if ( s.crossDomain ) { + s.contents.script = false; + } +} ); + +// Install script dataType +jQuery.ajaxSetup( { + accepts: { + script: "text/javascript, application/javascript, " + + "application/ecmascript, application/x-ecmascript" + }, + contents: { + script: /\b(?:java|ecma)script\b/ + }, + converters: { + "text script": function( text ) { + jQuery.globalEval( text ); + return text; + } + } +} ); + +// Handle cache's special case and crossDomain +jQuery.ajaxPrefilter( "script", function( s ) { + if ( s.cache === undefined ) { + s.cache = false; + } + if ( s.crossDomain ) { + s.type = "GET"; + } +} ); + +// Bind script tag hack transport +jQuery.ajaxTransport( "script", function( s ) { + + // This transport only deals with cross domain or forced-by-attrs requests + if ( s.crossDomain || s.scriptAttrs ) { + var script, callback; + return { + send: function( _, complete ) { + script = jQuery( "<script>" ) + .attr( s.scriptAttrs || {} ) + .prop( { charset: s.scriptCharset, src: s.url } ) + .on( "load error", callback = function( evt ) { + script.remove(); + callback = null; + if ( evt ) { + complete( evt.type === "error" ? 404 : 200, evt.type ); + } + } ); + + // Use native DOM manipulation to avoid our domManip AJAX trickery + document.head.appendChild( script[ 0 ] ); + }, + abort: function() { + if ( callback ) { + callback(); + } + } + }; + } +} ); + + + + +var oldCallbacks = [], + rjsonp = /(=)\?(?=&|$)|\?\?/; + +// Default jsonp settings +jQuery.ajaxSetup( { + jsonp: "callback", + jsonpCallback: function() { + var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce.guid++ ) ); + this[ callback ] = true; + return callback; + } +} ); + +// Detect, normalize options and install callbacks for jsonp requests +jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { + + var callbackName, overwritten, responseContainer, + jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? + "url" : + typeof s.data === "string" && + ( s.contentType || "" ) + .indexOf( "application/x-www-form-urlencoded" ) === 0 && + rjsonp.test( s.data ) && "data" + ); + + // Handle iff the expected data type is "jsonp" or we have a parameter to set + if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { + + // Get callback name, remembering preexisting value associated with it + callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ? + s.jsonpCallback() : + s.jsonpCallback; + + // Insert callback into url or form data + if ( jsonProp ) { + s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); + } else if ( s.jsonp !== false ) { + s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; + } + + // Use data converter to retrieve json after script execution + s.converters[ "script json" ] = function() { + if ( !responseContainer ) { + jQuery.error( callbackName + " was not called" ); + } + return responseContainer[ 0 ]; + }; + + // Force json dataType + s.dataTypes[ 0 ] = "json"; + + // Install callback + overwritten = window[ callbackName ]; + window[ callbackName ] = function() { + responseContainer = arguments; + }; + + // Clean-up function (fires after converters) + jqXHR.always( function() { + + // If previous value didn't exist - remove it + if ( overwritten === undefined ) { + jQuery( window ).removeProp( callbackName ); + + // Otherwise restore preexisting value + } else { + window[ callbackName ] = overwritten; + } + + // Save back as free + if ( s[ callbackName ] ) { + + // Make sure that re-using the options doesn't screw things around + s.jsonpCallback = originalSettings.jsonpCallback; + + // Save the callback name for future use + oldCallbacks.push( callbackName ); + } + + // Call if it was a function and we have a response + if ( responseContainer && isFunction( overwritten ) ) { + overwritten( responseContainer[ 0 ] ); + } + + responseContainer = overwritten = undefined; + } ); + + // Delegate to script + return "script"; + } +} ); + + + + +// Support: Safari 8 only +// In Safari 8 documents created via document.implementation.createHTMLDocument +// collapse sibling forms: the second one becomes a child of the first one. +// Because of that, this security measure has to be disabled in Safari 8. +// https://bugs.webkit.org/show_bug.cgi?id=137337 +support.createHTMLDocument = ( function() { + var body = document.implementation.createHTMLDocument( "" ).body; + body.innerHTML = "<form></form><form></form>"; + return body.childNodes.length === 2; +} )(); + + +// Argument "data" should be string of html +// context (optional): If specified, the fragment will be created in this context, +// defaults to document +// keepScripts (optional): If true, will include scripts passed in the html string +jQuery.parseHTML = function( data, context, keepScripts ) { + if ( typeof data !== "string" ) { + return []; + } + if ( typeof context === "boolean" ) { + keepScripts = context; + context = false; + } + + var base, parsed, scripts; + + if ( !context ) { + + // Stop scripts or inline event handlers from being executed immediately + // by using document.implementation + if ( support.createHTMLDocument ) { + context = document.implementation.createHTMLDocument( "" ); + + // Set the base href for the created document + // so any parsed elements with URLs + // are based on the document's URL (gh-2965) + base = context.createElement( "base" ); + base.href = document.location.href; + context.head.appendChild( base ); + } else { + context = document; + } + } + + parsed = rsingleTag.exec( data ); + scripts = !keepScripts && []; + + // Single tag + if ( parsed ) { + return [ context.createElement( parsed[ 1 ] ) ]; + } + + parsed = buildFragment( [ data ], context, scripts ); + + if ( scripts && scripts.length ) { + jQuery( scripts ).remove(); + } + + return jQuery.merge( [], parsed.childNodes ); +}; + + +/** + * Load a url into a page + */ +jQuery.fn.load = function( url, params, callback ) { + var selector, type, response, + self = this, + off = url.indexOf( " " ); + + if ( off > -1 ) { + selector = stripAndCollapse( url.slice( off ) ); + url = url.slice( 0, off ); + } + + // If it's a function + if ( isFunction( params ) ) { + + // We assume that it's the callback + callback = params; + params = undefined; + + // Otherwise, build a param string + } else if ( params && typeof params === "object" ) { + type = "POST"; + } + + // If we have elements to modify, make the request + if ( self.length > 0 ) { + jQuery.ajax( { + url: url, + + // If "type" variable is undefined, then "GET" method will be used. + // Make value of this field explicit since + // user can override it through ajaxSetup method + type: type || "GET", + dataType: "html", + data: params + } ).done( function( responseText ) { + + // Save response for use in complete callback + response = arguments; + + self.html( selector ? + + // If a selector was specified, locate the right elements in a dummy div + // Exclude scripts to avoid IE 'Permission Denied' errors + jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) : + + // Otherwise use the full result + responseText ); + + // If the request succeeds, this function gets "data", "status", "jqXHR" + // but they are ignored because response was set above. + // If it fails, this function gets "jqXHR", "status", "error" + } ).always( callback && function( jqXHR, status ) { + self.each( function() { + callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] ); + } ); + } ); + } + + return this; +}; + + + + +jQuery.expr.pseudos.animated = function( elem ) { + return jQuery.grep( jQuery.timers, function( fn ) { + return elem === fn.elem; + } ).length; +}; + + + + +jQuery.offset = { + setOffset: function( elem, options, i ) { + var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, + position = jQuery.css( elem, "position" ), + curElem = jQuery( elem ), + props = {}; + + // Set position first, in-case top/left are set even on static elem + if ( position === "static" ) { + elem.style.position = "relative"; + } + + curOffset = curElem.offset(); + curCSSTop = jQuery.css( elem, "top" ); + curCSSLeft = jQuery.css( elem, "left" ); + calculatePosition = ( position === "absolute" || position === "fixed" ) && + ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1; + + // Need to be able to calculate position if either + // top or left is auto and position is either absolute or fixed + if ( calculatePosition ) { + curPosition = curElem.position(); + curTop = curPosition.top; + curLeft = curPosition.left; + + } else { + curTop = parseFloat( curCSSTop ) || 0; + curLeft = parseFloat( curCSSLeft ) || 0; + } + + if ( isFunction( options ) ) { + + // Use jQuery.extend here to allow modification of coordinates argument (gh-1848) + options = options.call( elem, i, jQuery.extend( {}, curOffset ) ); + } + + if ( options.top != null ) { + props.top = ( options.top - curOffset.top ) + curTop; + } + if ( options.left != null ) { + props.left = ( options.left - curOffset.left ) + curLeft; + } + + if ( "using" in options ) { + options.using.call( elem, props ); + + } else { + curElem.css( props ); + } + } +}; + +jQuery.fn.extend( { + + // offset() relates an element's border box to the document origin + offset: function( options ) { + + // Preserve chaining for setter + if ( arguments.length ) { + return options === undefined ? + this : + this.each( function( i ) { + jQuery.offset.setOffset( this, options, i ); + } ); + } + + var rect, win, + elem = this[ 0 ]; + + if ( !elem ) { + return; + } + + // Return zeros for disconnected and hidden (display: none) elements (gh-2310) + // Support: IE <=11 only + // Running getBoundingClientRect on a + // disconnected node in IE throws an error + if ( !elem.getClientRects().length ) { + return { top: 0, left: 0 }; + } + + // Get document-relative position by adding viewport scroll to viewport-relative gBCR + rect = elem.getBoundingClientRect(); + win = elem.ownerDocument.defaultView; + return { + top: rect.top + win.pageYOffset, + left: rect.left + win.pageXOffset + }; + }, + + // position() relates an element's margin box to its offset parent's padding box + // This corresponds to the behavior of CSS absolute positioning + position: function() { + if ( !this[ 0 ] ) { + return; + } + + var offsetParent, offset, doc, + elem = this[ 0 ], + parentOffset = { top: 0, left: 0 }; + + // position:fixed elements are offset from the viewport, which itself always has zero offset + if ( jQuery.css( elem, "position" ) === "fixed" ) { + + // Assume position:fixed implies availability of getBoundingClientRect + offset = elem.getBoundingClientRect(); + + } else { + offset = this.offset(); + + // Account for the *real* offset parent, which can be the document or its root element + // when a statically positioned element is identified + doc = elem.ownerDocument; + offsetParent = elem.offsetParent || doc.documentElement; + while ( offsetParent && + ( offsetParent === doc.body || offsetParent === doc.documentElement ) && + jQuery.css( offsetParent, "position" ) === "static" ) { + + offsetParent = offsetParent.parentNode; + } + if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) { + + // Incorporate borders into its offset, since they are outside its content origin + parentOffset = jQuery( offsetParent ).offset(); + parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true ); + parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true ); + } + } + + // Subtract parent offsets and element margins + return { + top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), + left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) + }; + }, + + // This method will return documentElement in the following cases: + // 1) For the element inside the iframe without offsetParent, this method will return + // documentElement of the parent window + // 2) For the hidden or detached element + // 3) For body or html element, i.e. in case of the html node - it will return itself + // + // but those exceptions were never presented as a real life use-cases + // and might be considered as more preferable results. + // + // This logic, however, is not guaranteed and can change at any point in the future + offsetParent: function() { + return this.map( function() { + var offsetParent = this.offsetParent; + + while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) { + offsetParent = offsetParent.offsetParent; + } + + return offsetParent || documentElement; + } ); + } +} ); + +// Create scrollLeft and scrollTop methods +jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { + var top = "pageYOffset" === prop; + + jQuery.fn[ method ] = function( val ) { + return access( this, function( elem, method, val ) { + + // Coalesce documents and windows + var win; + if ( isWindow( elem ) ) { + win = elem; + } else if ( elem.nodeType === 9 ) { + win = elem.defaultView; + } + + if ( val === undefined ) { + return win ? win[ prop ] : elem[ method ]; + } + + if ( win ) { + win.scrollTo( + !top ? val : win.pageXOffset, + top ? val : win.pageYOffset + ); + + } else { + elem[ method ] = val; + } + }, method, val, arguments.length ); + }; +} ); + +// Support: Safari <=7 - 9.1, Chrome <=37 - 49 +// Add the top/left cssHooks using jQuery.fn.position +// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 +// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347 +// getComputedStyle returns percent when specified for top/left/bottom/right; +// rather than make the css module depend on the offset module, just check for it here +jQuery.each( [ "top", "left" ], function( _i, prop ) { + jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, + function( elem, computed ) { + if ( computed ) { + computed = curCSS( elem, prop ); + + // If curCSS returns percentage, fallback to offset + return rnumnonpx.test( computed ) ? + jQuery( elem ).position()[ prop ] + "px" : + computed; + } + } + ); +} ); + + +// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods +jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { + jQuery.each( { + padding: "inner" + name, + content: type, + "": "outer" + name + }, function( defaultExtra, funcName ) { + + // Margin is only for outerHeight, outerWidth + jQuery.fn[ funcName ] = function( margin, value ) { + var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), + extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); + + return access( this, function( elem, type, value ) { + var doc; + + if ( isWindow( elem ) ) { + + // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729) + return funcName.indexOf( "outer" ) === 0 ? + elem[ "inner" + name ] : + elem.document.documentElement[ "client" + name ]; + } + + // Get document width or height + if ( elem.nodeType === 9 ) { + doc = elem.documentElement; + + // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], + // whichever is greatest + return Math.max( + elem.body[ "scroll" + name ], doc[ "scroll" + name ], + elem.body[ "offset" + name ], doc[ "offset" + name ], + doc[ "client" + name ] + ); + } + + return value === undefined ? + + // Get width or height on the element, requesting but not forcing parseFloat + jQuery.css( elem, type, extra ) : + + // Set width or height on the element + jQuery.style( elem, type, value, extra ); + }, type, chainable ? margin : undefined, chainable ); + }; + } ); +} ); + + +jQuery.each( [ + "ajaxStart", + "ajaxStop", + "ajaxComplete", + "ajaxError", + "ajaxSuccess", + "ajaxSend" +], function( _i, type ) { + jQuery.fn[ type ] = function( fn ) { + return this.on( type, fn ); + }; +} ); + + + + +jQuery.fn.extend( { + + bind: function( types, data, fn ) { + return this.on( types, null, data, fn ); + }, + unbind: function( types, fn ) { + return this.off( types, null, fn ); + }, + + delegate: function( selector, types, data, fn ) { + return this.on( types, selector, data, fn ); + }, + undelegate: function( selector, types, fn ) { + + // ( namespace ) or ( selector, types [, fn] ) + return arguments.length === 1 ? + this.off( selector, "**" ) : + this.off( types, selector || "**", fn ); + }, + + hover: function( fnOver, fnOut ) { + return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); + } +} ); + +jQuery.each( + ( "blur focus focusin focusout resize scroll click dblclick " + + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + + "change select submit keydown keypress keyup contextmenu" ).split( " " ), + function( _i, name ) { + + // Handle event binding + jQuery.fn[ name ] = function( data, fn ) { + return arguments.length > 0 ? + this.on( name, null, data, fn ) : + this.trigger( name ); + }; + } +); + + + + +// Support: Android <=4.0 only +// Make sure we trim BOM and NBSP +// Require that the "whitespace run" starts from a non-whitespace +// to avoid O(N^2) behavior when the engine would try matching "\s+$" at each space position. +var rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g; + +// Bind a function to a context, optionally partially applying any +// arguments. +// jQuery.proxy is deprecated to promote standards (specifically Function#bind) +// However, it is not slated for removal any time soon +jQuery.proxy = function( fn, context ) { + var tmp, args, proxy; + + if ( typeof context === "string" ) { + tmp = fn[ context ]; + context = fn; + fn = tmp; + } + + // Quick check to determine if target is callable, in the spec + // this throws a TypeError, but we will just return undefined. + if ( !isFunction( fn ) ) { + return undefined; + } + + // Simulated bind + args = slice.call( arguments, 2 ); + proxy = function() { + return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); + }; + + // Set the guid of unique handler to the same of original handler, so it can be removed + proxy.guid = fn.guid = fn.guid || jQuery.guid++; + + return proxy; +}; + +jQuery.holdReady = function( hold ) { + if ( hold ) { + jQuery.readyWait++; + } else { + jQuery.ready( true ); + } +}; +jQuery.isArray = Array.isArray; +jQuery.parseJSON = JSON.parse; +jQuery.nodeName = nodeName; +jQuery.isFunction = isFunction; +jQuery.isWindow = isWindow; +jQuery.camelCase = camelCase; +jQuery.type = toType; + +jQuery.now = Date.now; + +jQuery.isNumeric = function( obj ) { + + // As of jQuery 3.0, isNumeric is limited to + // strings and numbers (primitives or objects) + // that can be coerced to finite numbers (gh-2662) + var type = jQuery.type( obj ); + return ( type === "number" || type === "string" ) && + + // parseFloat NaNs numeric-cast false positives ("") + // ...but misinterprets leading-number strings, particularly hex literals ("0x...") + // subtraction forces infinities to NaN + !isNaN( obj - parseFloat( obj ) ); +}; + +jQuery.trim = function( text ) { + return text == null ? + "" : + ( text + "" ).replace( rtrim, "$1" ); +}; + + + +// Register as a named AMD module, since jQuery can be concatenated with other +// files that may use define, but not via a proper concatenation script that +// understands anonymous AMD modules. A named AMD is safest and most robust +// way to register. Lowercase jquery is used because AMD module names are +// derived from file names, and jQuery is normally delivered in a lowercase +// file name. Do this after creating the global so that if an AMD module wants +// to call noConflict to hide this version of jQuery, it will work. + +// Note that for maximum portability, libraries that are not jQuery should +// declare themselves as anonymous modules, and avoid setting a global if an +// AMD loader is present. jQuery is a special case. For more information, see +// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon + +if ( typeof define === "function" && define.amd ) { + define( "jquery", [], function() { + return jQuery; + } ); +} + + + + +var + + // Map over jQuery in case of overwrite + _jQuery = window.jQuery, + + // Map over the $ in case of overwrite + _$ = window.$; + +jQuery.noConflict = function( deep ) { + if ( window.$ === jQuery ) { + window.$ = _$; + } + + if ( deep && window.jQuery === jQuery ) { + window.jQuery = _jQuery; + } + + return jQuery; +}; + +// Expose jQuery and $ identifiers, even in AMD +// (trac-7102#comment:10, https://github.com/jquery/jquery/pull/557) +// and CommonJS for browser emulators (trac-13566) +if ( typeof noGlobal === "undefined" ) { + window.jQuery = window.$ = jQuery; +} + + + + +return jQuery; +} ); diff --git a/static_common/common/vendor/jquery/jquery-3.6.3.min.js b/static_common/common/vendor/jquery/jquery-3.6.3.min.js new file mode 100644 index 00000000..b5329e9a --- /dev/null +++ b/static_common/common/vendor/jquery/jquery-3.6.3.min.js @@ -0,0 +1,2 @@ +/*! jQuery v3.6.3 | (c) OpenJS Foundation and other contributors | jquery.org/license */ +!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],r=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,y=n.hasOwnProperty,a=y.toString,l=a.call(Object),v={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},x=function(e){return null!=e&&e===e.window},S=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||S).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.6.3",E=function(e,t){return new E.fn.init(e,t)};function p(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0<t&&t-1 in e)}E.fn=E.prototype={jquery:f,constructor:E,length:0,toArray:function(){return s.call(this)},get:function(e){return null==e?s.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=E.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return E.each(this,e)},map:function(n){return this.pushStack(E.map(this,function(e,t){return n.call(e,t,e)}))},slice:function(){return this.pushStack(s.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(E.grep(this,function(e,t){return(t+1)%2}))},odd:function(){return this.pushStack(E.grep(this,function(e,t){return t%2}))},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(0<=n&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:u,sort:t.sort,splice:t.splice},E.extend=E.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||m(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)r=e[t],"__proto__"!==t&&a!==r&&(l&&r&&(E.isPlainObject(r)||(i=Array.isArray(r)))?(n=a[t],o=i&&!Array.isArray(n)?[]:i||E.isPlainObject(n)?n:{},i=!1,a[t]=E.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},E.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==o.call(e))&&(!(t=r(e))||"function"==typeof(n=y.call(t,"constructor")&&t.constructor)&&a.call(n)===l)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e,t,n){b(e,{nonce:t&&t.nonce},n)},each:function(e,t){var n,r=0;if(p(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},makeArray:function(e,t){var n=t||[];return null!=e&&(p(Object(e))?E.merge(n,"string"==typeof e?[e]:e):u.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:i.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r=[],i=0,o=e.length,a=!n;i<o;i++)!t(e[i],i)!==a&&r.push(e[i]);return r},map:function(e,t,n){var r,i,o=0,a=[];if(p(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&a.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&a.push(i);return g(a)},guid:1,support:v}),"function"==typeof Symbol&&(E.fn[Symbol.iterator]=t[Symbol.iterator]),E.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){n["[object "+t+"]"]=t.toLowerCase()});var d=function(n){var e,d,b,o,i,h,f,g,w,u,l,T,C,a,S,y,s,c,v,E="sizzle"+1*new Date,p=n.document,k=0,r=0,m=ue(),x=ue(),A=ue(),N=ue(),j=function(e,t){return e===t&&(l=!0),0},D={}.hasOwnProperty,t=[],q=t.pop,L=t.push,H=t.push,O=t.slice,P=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},R="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",I="(?:\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",W="\\["+M+"*("+I+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+I+"))|)"+M+"*\\]",F=":("+I+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+W+")*)|.*)\\)|)",$=new RegExp(M+"+","g"),B=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),_=new RegExp("^"+M+"*,"+M+"*"),z=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp(F),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(p.childNodes),p.childNodes),t[p.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(T(e),e=e||C,S)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&v(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!N[t+" "]&&(!y||!y.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&(U.test(t)||z.test(t))){(f=ee.test(t)&&ve(e.parentNode)||e)===e&&d.scope||((s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=E)),o=(l=h(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+xe(l[o]);c=l.join(",")}try{if(d.cssSupportsSelector&&!CSS.supports("selector(:is("+c+"))"))throw new Error;return H.apply(n,f.querySelectorAll(c)),n}catch(e){N(t,!0)}finally{s===E&&e.removeAttribute("id")}}}return g(t.replace(B,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[E]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ye(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ve(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:p;return r!=C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,S=!i(C),p!=C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.scope=ce(function(e){return a.appendChild(e).appendChild(C.createElement("div")),"undefined"!=typeof e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),d.cssSupportsSelector=ce(function(){return CSS.supports("selector(*)")&&C.querySelectorAll(":is(:jqfake)")&&!CSS.supports("selector(:is(*,:jqfake))")}),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=E,!C.getElementsByName||!C.getElementsByName(E).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&S){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&S){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&S)return t.getElementsByClassName(e)},s=[],y=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){var t;a.appendChild(e).innerHTML="<a id='"+E+"'></a><select id='"+E+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&y.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||y.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+E+"-]").length||y.push("~="),(t=C.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||y.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||y.push(":checked"),e.querySelectorAll("a#"+E+"+*").length||y.push(".#.+[+~]"),e.querySelectorAll("\\\f"),y.push("[\\r\\n\\f]")}),ce(function(e){e.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&y.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&y.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&y.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),y.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",F)}),d.cssSupportsSelector||y.push(":has"),y=y.length&&new RegExp(y.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),v=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType&&e.documentElement||e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},j=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e==C||e.ownerDocument==p&&v(p,e)?-1:t==C||t.ownerDocument==p&&v(p,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==C?-1:t==C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]==p?-1:s[r]==p?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(T(e),d.matchesSelector&&S&&!N[t+" "]&&(!s||!s.test(t))&&(!y||!y.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0<se(t,C,null,[e]).length},se.contains=function(e,t){return(e.ownerDocument||e)!=C&&T(e),v(e,t)},se.attr=function(e,t){(e.ownerDocument||e)!=C&&T(e);var n=b.attrHandle[t.toLowerCase()],r=n&&D.call(b.attrHandle,t.toLowerCase())?n(e,t,!S):void 0;return void 0!==r?r:d.attributes||!S?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},se.escape=function(e){return(e+"").replace(re,ie)},se.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},se.uniqueSort=function(e){var t,n=[],r=0,i=0;if(l=!d.detectDuplicates,u=!d.sortStable&&e.slice(0),e.sort(j),l){while(t=e[i++])t===e[i]&&(r=n.push(i));while(r--)e.splice(n[r],1)}return u=null,e},o=se.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else while(t=e[r++])n+=o(t);return n},(b=se.selectors={cacheLength:50,createPseudo:le,match:G,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&m(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1<t.indexOf(i):"$="===r?i&&t.slice(-i.length)===i:"~="===r?-1<(" "+t.replace($," ")+" ").indexOf(i):"|="===r&&(t===i||t.slice(0,i.length+1)===i+"-"))}},CHILD:function(h,e,t,g,y){var v="nth"!==h.slice(0,3),m="last"!==h.slice(-4),x="of-type"===e;return 1===g&&0===y?function(e){return!!e.parentNode}:function(e,t,n){var r,i,o,a,s,u,l=v!==m?"nextSibling":"previousSibling",c=e.parentNode,f=x&&e.nodeName.toLowerCase(),p=!n&&!x,d=!1;if(c){if(v){while(l){a=e;while(a=a[l])if(x?a.nodeName.toLowerCase()===f:1===a.nodeType)return!1;u=l="only"===h&&!u&&"nextSibling"}return!0}if(u=[m?c.firstChild:c.lastChild],m&&p){d=(s=(r=(i=(o=(a=c)[E]||(a[E]={}))[a.uniqueID]||(o[a.uniqueID]={}))[h]||[])[0]===k&&r[1])&&r[2],a=s&&c.childNodes[s];while(a=++s&&a&&a[l]||(d=s=0)||u.pop())if(1===a.nodeType&&++d&&a===e){i[h]=[k,s,d];break}}else if(p&&(d=s=(r=(i=(o=(a=e)[E]||(a[E]={}))[a.uniqueID]||(o[a.uniqueID]={}))[h]||[])[0]===k&&r[1]),!1===d)while(a=++s&&a&&a[l]||(d=s=0)||u.pop())if((x?a.nodeName.toLowerCase()===f:1===a.nodeType)&&++d&&(p&&((i=(o=a[E]||(a[E]={}))[a.uniqueID]||(o[a.uniqueID]={}))[h]=[k,d]),a===e))break;return(d-=y)===g||d%g==0&&0<=d/g}}},PSEUDO:function(e,o){var t,a=b.pseudos[e]||b.setFilters[e.toLowerCase()]||se.error("unsupported pseudo: "+e);return a[E]?a(o):1<a.length?(t=[e,e,"",o],b.setFilters.hasOwnProperty(e.toLowerCase())?le(function(e,t){var n,r=a(e,o),i=r.length;while(i--)e[n=P(e,r[i])]=!(t[n]=r[i])}):function(e){return a(e,0,t)}):a}},pseudos:{not:le(function(e){var r=[],i=[],s=f(e.replace(B,"$1"));return s[E]?le(function(e,t,n,r){var i,o=s(e,null,r,[]),a=e.length;while(a--)(i=o[a])&&(e[a]=!(t[a]=i))}):function(e,t,n){return r[0]=e,s(r,null,n,i),r[0]=null,!i.pop()}}),has:le(function(t){return function(e){return 0<se(t,e).length}}),contains:le(function(t){return t=t.replace(te,ne),function(e){return-1<(e.textContent||o(e)).indexOf(t)}}),lang:le(function(n){return V.test(n||"")||se.error("unsupported lang: "+n),n=n.replace(te,ne).toLowerCase(),function(e){var t;do{if(t=S?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return(t=t.toLowerCase())===n||0===t.indexOf(n+"-")}while((e=e.parentNode)&&1===e.nodeType);return!1}}),target:function(e){var t=n.location&&n.location.hash;return t&&t.slice(1)===e.id},root:function(e){return e===a},focus:function(e){return e===C.activeElement&&(!C.hasFocus||C.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:ge(!1),disabled:ge(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!b.pseudos.empty(e)},header:function(e){return J.test(e.nodeName)},input:function(e){return Q.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:ye(function(){return[0]}),last:ye(function(e,t){return[t-1]}),eq:ye(function(e,t,n){return[n<0?n+t:n]}),even:ye(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:ye(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:ye(function(e,t,n){for(var r=n<0?n+t:t<n?t:n;0<=--r;)e.push(r);return e}),gt:ye(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}}).pseudos.nth=b.pseudos.eq,{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})b.pseudos[e]=de(e);for(e in{submit:!0,reset:!0})b.pseudos[e]=he(e);function me(){}function xe(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function be(s,e,t){var u=e.dir,l=e.next,c=l||u,f=t&&"parentNode"===c,p=r++;return e.first?function(e,t,n){while(e=e[u])if(1===e.nodeType||f)return s(e,t,n);return!1}:function(e,t,n){var r,i,o,a=[k,p];if(n){while(e=e[u])if((1===e.nodeType||f)&&s(e,t,n))return!0}else while(e=e[u])if(1===e.nodeType||f)if(i=(o=e[E]||(e[E]={}))[e.uniqueID]||(o[e.uniqueID]={}),l&&l===e.nodeName.toLowerCase())e=e[u]||e;else{if((r=i[c])&&r[0]===k&&r[1]===p)return a[2]=r[2];if((i[c]=a)[2]=s(e,t,n))return!0}return!1}}function we(i){return 1<i.length?function(e,t,n){var r=i.length;while(r--)if(!i[r](e,t,n))return!1;return!0}:i[0]}function Te(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,l=null!=t;s<u;s++)(o=e[s])&&(n&&!n(o,r,i)||(a.push(o),l&&t.push(s)));return a}function Ce(d,h,g,y,v,e){return y&&!y[E]&&(y=Ce(y)),v&&!v[E]&&(v=Ce(v,e)),le(function(e,t,n,r){var i,o,a,s=[],u=[],l=t.length,c=e||function(e,t,n){for(var r=0,i=t.length;r<i;r++)se(e,t[r],n);return n}(h||"*",n.nodeType?[n]:n,[]),f=!d||!e&&h?c:Te(c,s,d,n,r),p=g?v||(e?d:l||y)?[]:t:f;if(g&&g(f,p,n,r),y){i=Te(p,u),y(i,[],n,r),o=i.length;while(o--)(a=i[o])&&(p[u[o]]=!(f[u[o]]=a))}if(e){if(v||d){if(v){i=[],o=p.length;while(o--)(a=p[o])&&i.push(f[o]=a);v(null,p=[],i,r)}o=p.length;while(o--)(a=p[o])&&-1<(i=v?P(e,a):s[o])&&(e[i]=!(t[i]=a))}}else p=Te(p===t?p.splice(l,p.length):p),v?v(null,t,p,r):H.apply(t,p)})}function Se(e){for(var i,t,n,r=e.length,o=b.relative[e[0].type],a=o||b.relative[" "],s=o?1:0,u=be(function(e){return e===i},a,!0),l=be(function(e){return-1<P(i,e)},a,!0),c=[function(e,t,n){var r=!o&&(n||t!==w)||((i=t).nodeType?u(e,t,n):l(e,t,n));return i=null,r}];s<r;s++)if(t=b.relative[e[s].type])c=[be(we(c),t)];else{if((t=b.filter[e[s].type].apply(null,e[s].matches))[E]){for(n=++s;n<r;n++)if(b.relative[e[n].type])break;return Ce(1<s&&we(c),1<s&&xe(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace(B,"$1"),t,s<n&&Se(e.slice(s,n)),n<r&&Se(e=e.slice(n)),n<r&&xe(e))}c.push(t)}return we(c)}return me.prototype=b.filters=b.pseudos,b.setFilters=new me,h=se.tokenize=function(e,t){var n,r,i,o,a,s,u,l=x[e+" "];if(l)return t?0:l.slice(0);a=e,s=[],u=b.preFilter;while(a){for(o in n&&!(r=_.exec(a))||(r&&(a=a.slice(r[0].length)||a),s.push(i=[])),n=!1,(r=z.exec(a))&&(n=r.shift(),i.push({value:n,type:r[0].replace(B," ")}),a=a.slice(n.length)),b.filter)!(r=G[o].exec(a))||u[o]&&!(r=u[o](r))||(n=r.shift(),i.push({value:n,type:o,matches:r}),a=a.slice(n.length));if(!n)break}return t?a.length:a?se.error(e):x(e,s).slice(0)},f=se.compile=function(e,t){var n,y,v,m,x,r,i=[],o=[],a=A[e+" "];if(!a){t||(t=h(e)),n=t.length;while(n--)(a=Se(t[n]))[E]?i.push(a):o.push(a);(a=A(e,(y=o,m=0<(v=i).length,x=0<y.length,r=function(e,t,n,r,i){var o,a,s,u=0,l="0",c=e&&[],f=[],p=w,d=e||x&&b.find.TAG("*",i),h=k+=null==p?1:Math.random()||.1,g=d.length;for(i&&(w=t==C||t||i);l!==g&&null!=(o=d[l]);l++){if(x&&o){a=0,t||o.ownerDocument==C||(T(o),n=!S);while(s=y[a++])if(s(o,t||C,n)){r.push(o);break}i&&(k=h)}m&&((o=!s&&o)&&u--,e&&c.push(o))}if(u+=l,m&&l!==u){a=0;while(s=v[a++])s(c,f,t,n);if(e){if(0<u)while(l--)c[l]||f[l]||(f[l]=q.call(r));f=Te(f)}H.apply(r,f),i&&!e&&0<f.length&&1<u+v.length&&se.uniqueSort(r)}return i&&(k=h,w=p),c},m?le(r):r))).selector=e}return a},g=se.select=function(e,t,n,r){var i,o,a,s,u,l="function"==typeof e&&e,c=!r&&h(e=l.selector||e);if(n=n||[],1===c.length){if(2<(o=c[0]=c[0].slice(0)).length&&"ID"===(a=o[0]).type&&9===t.nodeType&&S&&b.relative[o[1].type]){if(!(t=(b.find.ID(a.matches[0].replace(te,ne),t)||[])[0]))return n;l&&(t=t.parentNode),e=e.slice(o.shift().value.length)}i=G.needsContext.test(e)?0:o.length;while(i--){if(a=o[i],b.relative[s=a.type])break;if((u=b.find[s])&&(r=u(a.matches[0].replace(te,ne),ee.test(o[0].type)&&ve(t.parentNode)||t))){if(o.splice(i,1),!(e=r.length&&xe(o)))return H.apply(n,r),n;break}}}return(l||f(e,c))(r,t,!S,n,!t||ee.test(e)&&ve(t.parentNode)||t),n},d.sortStable=E.split("").sort(j).join("")===E,d.detectDuplicates=!!l,T(),d.sortDetached=ce(function(e){return 1&e.compareDocumentPosition(C.createElement("fieldset"))}),ce(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||fe("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),d.attributes&&ce(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||fe("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),ce(function(e){return null==e.getAttribute("disabled")})||fe(R,function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),se}(C);E.find=d,E.expr=d.selectors,E.expr[":"]=E.expr.pseudos,E.uniqueSort=E.unique=d.uniqueSort,E.text=d.getText,E.isXMLDoc=d.isXML,E.contains=d.contains,E.escapeSelector=d.escape;var h=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&E(e).is(n))break;r.push(e)}return r},T=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},k=E.expr.match.needsContext;function A(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var N=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,n,r){return m(n)?E.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?E.grep(e,function(e){return e===n!==r}):"string"!=typeof n?E.grep(e,function(e){return-1<i.call(n,e)!==r}):E.filter(n,e,r)}E.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?E.find.matchesSelector(r,e)?[r]:[]:E.find.matches(e,E.grep(t,function(e){return 1===e.nodeType}))},E.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(E(e).filter(function(){for(t=0;t<r;t++)if(E.contains(i[t],this))return!0}));for(n=this.pushStack([]),t=0;t<r;t++)E.find(e,i[t],n);return 1<r?E.uniqueSort(n):n},filter:function(e){return this.pushStack(j(this,e||[],!1))},not:function(e){return this.pushStack(j(this,e||[],!0))},is:function(e){return!!j(this,"string"==typeof e&&k.test(e)?E(e):e||[],!1).length}});var D,q=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(E.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||D,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:q.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof E?t[0]:t,E.merge(this,E.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:S,!0)),N.test(r[1])&&E.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=S.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(E):E.makeArray(e,this)}).prototype=E.fn,D=E(S);var L=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){while((e=e[t])&&1!==e.nodeType);return e}E.fn.extend({has:function(e){var t=E(e,this),n=t.length;return this.filter(function(){for(var e=0;e<n;e++)if(E.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,i=this.length,o=[],a="string"!=typeof e&&E(e);if(!k.test(e))for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?-1<a.index(n):1===n.nodeType&&E.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(1<o.length?E.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?i.call(E(e),this[0]):i.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(E.uniqueSort(E.merge(this.get(),E(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),E.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return h(e,"parentNode")},parentsUntil:function(e,t,n){return h(e,"parentNode",n)},next:function(e){return O(e,"nextSibling")},prev:function(e){return O(e,"previousSibling")},nextAll:function(e){return h(e,"nextSibling")},prevAll:function(e){return h(e,"previousSibling")},nextUntil:function(e,t,n){return h(e,"nextSibling",n)},prevUntil:function(e,t,n){return h(e,"previousSibling",n)},siblings:function(e){return T((e.parentNode||{}).firstChild,e)},children:function(e){return T(e.firstChild)},contents:function(e){return null!=e.contentDocument&&r(e.contentDocument)?e.contentDocument:(A(e,"template")&&(e=e.content||e),E.merge([],e.childNodes))}},function(r,i){E.fn[r]=function(e,t){var n=E.map(this,i,e);return"Until"!==r.slice(-5)&&(t=e),t&&"string"==typeof t&&(n=E.filter(t,n)),1<this.length&&(H[r]||E.uniqueSort(n),L.test(r)&&n.reverse()),this.pushStack(n)}});var P=/[^\x20\t\r\n\f]+/g;function R(e){return e}function M(e){throw e}function I(e,t,n,r){var i;try{e&&m(i=e.promise)?i.call(e).done(t).fail(n):e&&m(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}E.Callbacks=function(r){var e,n;r="string"==typeof r?(e=r,n={},E.each(e.match(P)||[],function(e,t){n[t]=!0}),n):E.extend({},r);var i,t,o,a,s=[],u=[],l=-1,c=function(){for(a=a||r.once,o=i=!0;u.length;l=-1){t=u.shift();while(++l<s.length)!1===s[l].apply(t[0],t[1])&&r.stopOnFalse&&(l=s.length,t=!1)}r.memory||(t=!1),i=!1,a&&(s=t?[]:"")},f={add:function(){return s&&(t&&!i&&(l=s.length-1,u.push(t)),function n(e){E.each(e,function(e,t){m(t)?r.unique&&f.has(t)||s.push(t):t&&t.length&&"string"!==w(t)&&n(t)})}(arguments),t&&!i&&c()),this},remove:function(){return E.each(arguments,function(e,t){var n;while(-1<(n=E.inArray(t,s,n)))s.splice(n,1),n<=l&&l--}),this},has:function(e){return e?-1<E.inArray(e,s):0<s.length},empty:function(){return s&&(s=[]),this},disable:function(){return a=u=[],s=t="",this},disabled:function(){return!s},lock:function(){return a=u=[],t||i||(s=t=""),this},locked:function(){return!!a},fireWith:function(e,t){return a||(t=[e,(t=t||[]).slice?t.slice():t],u.push(t),i||c()),this},fire:function(){return f.fireWith(this,arguments),this},fired:function(){return!!o}};return f},E.extend({Deferred:function(e){var o=[["notify","progress",E.Callbacks("memory"),E.Callbacks("memory"),2],["resolve","done",E.Callbacks("once memory"),E.Callbacks("once memory"),0,"resolved"],["reject","fail",E.Callbacks("once memory"),E.Callbacks("once memory"),1,"rejected"]],i="pending",a={state:function(){return i},always:function(){return s.done(arguments).fail(arguments),this},"catch":function(e){return a.then(null,e)},pipe:function(){var i=arguments;return E.Deferred(function(r){E.each(o,function(e,t){var n=m(i[t[4]])&&i[t[4]];s[t[1]](function(){var e=n&&n.apply(this,arguments);e&&m(e.promise)?e.promise().progress(r.notify).done(r.resolve).fail(r.reject):r[t[0]+"With"](this,n?[e]:arguments)})}),i=null}).promise()},then:function(t,n,r){var u=0;function l(i,o,a,s){return function(){var n=this,r=arguments,e=function(){var e,t;if(!(i<u)){if((e=a.apply(n,r))===o.promise())throw new TypeError("Thenable self-resolution");t=e&&("object"==typeof e||"function"==typeof e)&&e.then,m(t)?s?t.call(e,l(u,o,R,s),l(u,o,M,s)):(u++,t.call(e,l(u,o,R,s),l(u,o,M,s),l(u,o,R,o.notifyWith))):(a!==R&&(n=void 0,r=[e]),(s||o.resolveWith)(n,r))}},t=s?e:function(){try{e()}catch(e){E.Deferred.exceptionHook&&E.Deferred.exceptionHook(e,t.stackTrace),u<=i+1&&(a!==M&&(n=void 0,r=[e]),o.rejectWith(n,r))}};i?t():(E.Deferred.getStackHook&&(t.stackTrace=E.Deferred.getStackHook()),C.setTimeout(t))}}return E.Deferred(function(e){o[0][3].add(l(0,e,m(r)?r:R,e.notifyWith)),o[1][3].add(l(0,e,m(t)?t:R)),o[2][3].add(l(0,e,m(n)?n:M))}).promise()},promise:function(e){return null!=e?E.extend(e,a):a}},s={};return E.each(o,function(e,t){var n=t[2],r=t[5];a[t[1]]=n.add,r&&n.add(function(){i=r},o[3-e][2].disable,o[3-e][3].disable,o[0][2].lock,o[0][3].lock),n.add(t[3].fire),s[t[0]]=function(){return s[t[0]+"With"](this===s?void 0:this,arguments),this},s[t[0]+"With"]=n.fireWith}),a.promise(s),e&&e.call(s,s),s},when:function(e){var n=arguments.length,t=n,r=Array(t),i=s.call(arguments),o=E.Deferred(),a=function(t){return function(e){r[t]=this,i[t]=1<arguments.length?s.call(arguments):e,--n||o.resolveWith(r,i)}};if(n<=1&&(I(e,o.done(a(t)).resolve,o.reject,!n),"pending"===o.state()||m(i[t]&&i[t].then)))return o.then();while(t--)I(i[t],a(t),o.reject);return o.promise()}});var W=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;E.Deferred.exceptionHook=function(e,t){C.console&&C.console.warn&&e&&W.test(e.name)&&C.console.warn("jQuery.Deferred exception: "+e.message,e.stack,t)},E.readyException=function(e){C.setTimeout(function(){throw e})};var F=E.Deferred();function $(){S.removeEventListener("DOMContentLoaded",$),C.removeEventListener("load",$),E.ready()}E.fn.ready=function(e){return F.then(e)["catch"](function(e){E.readyException(e)}),this},E.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--E.readyWait:E.isReady)||(E.isReady=!0)!==e&&0<--E.readyWait||F.resolveWith(S,[E])}}),E.ready.then=F.then,"complete"===S.readyState||"loading"!==S.readyState&&!S.documentElement.doScroll?C.setTimeout(E.ready):(S.addEventListener("DOMContentLoaded",$),C.addEventListener("load",$));var B=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if("object"===w(n))for(s in i=!0,n)B(e,t,s,n[s],!0,o,a);else if(void 0!==r&&(i=!0,m(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(E(e),n)})),t))for(;s<u;s++)t(e[s],n,a?r:r.call(e[s],s,t(e[s],n)));return i?e:l?t.call(e):u?t(e[0],n):o},_=/^-ms-/,z=/-([a-z])/g;function U(e,t){return t.toUpperCase()}function X(e){return e.replace(_,"ms-").replace(z,U)}var V=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};function G(){this.expando=E.expando+G.uid++}G.uid=1,G.prototype={cache:function(e){var t=e[this.expando];return t||(t={},V(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,i=this.cache(e);if("string"==typeof t)i[X(t)]=n;else for(r in t)i[X(r)]=t[r];return i},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][X(t)]},access:function(e,t,n){return void 0===t||t&&"string"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){n=(t=Array.isArray(t)?t.map(X):(t=X(t))in r?[t]:t.match(P)||[]).length;while(n--)delete r[t[n]]}(void 0===t||E.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!E.isEmptyObject(t)}};var Y=new G,Q=new G,J=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,K=/[A-Z]/g;function Z(e,t,n){var r,i;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(K,"-$&").toLowerCase(),"string"==typeof(n=e.getAttribute(r))){try{n="true"===(i=n)||"false"!==i&&("null"===i?null:i===+i+""?+i:J.test(i)?JSON.parse(i):i)}catch(e){}Q.set(e,t,n)}else n=void 0;return n}E.extend({hasData:function(e){return Q.hasData(e)||Y.hasData(e)},data:function(e,t,n){return Q.access(e,t,n)},removeData:function(e,t){Q.remove(e,t)},_data:function(e,t,n){return Y.access(e,t,n)},_removeData:function(e,t){Y.remove(e,t)}}),E.fn.extend({data:function(n,e){var t,r,i,o=this[0],a=o&&o.attributes;if(void 0===n){if(this.length&&(i=Q.get(o),1===o.nodeType&&!Y.get(o,"hasDataAttrs"))){t=a.length;while(t--)a[t]&&0===(r=a[t].name).indexOf("data-")&&(r=X(r.slice(5)),Z(o,r,i[r]));Y.set(o,"hasDataAttrs",!0)}return i}return"object"==typeof n?this.each(function(){Q.set(this,n)}):B(this,function(e){var t;if(o&&void 0===e)return void 0!==(t=Q.get(o,n))?t:void 0!==(t=Z(o,n))?t:void 0;this.each(function(){Q.set(this,n,e)})},null,e,1<arguments.length,null,!0)},removeData:function(e){return this.each(function(){Q.remove(this,e)})}}),E.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=Y.get(e,t),n&&(!r||Array.isArray(n)?r=Y.access(e,t,E.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=E.queue(e,t),r=n.length,i=n.shift(),o=E._queueHooks(e,t);"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,function(){E.dequeue(e,t)},o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return Y.get(e,n)||Y.access(e,n,{empty:E.Callbacks("once memory").add(function(){Y.remove(e,[t+"queue",n])})})}}),E.fn.extend({queue:function(t,n){var e=2;return"string"!=typeof t&&(n=t,t="fx",e--),arguments.length<e?E.queue(this[0],t):void 0===n?this:this.each(function(){var e=E.queue(this,t,n);E._queueHooks(this,t),"fx"===t&&"inprogress"!==e[0]&&E.dequeue(this,t)})},dequeue:function(e){return this.each(function(){E.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=E.Deferred(),o=this,a=this.length,s=function(){--r||i.resolveWith(o,[o])};"string"!=typeof e&&(t=e,e=void 0),e=e||"fx";while(a--)(n=Y.get(o[a],e+"queueHooks"))&&n.empty&&(r++,n.empty.add(s));return s(),i.promise(t)}});var ee=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,te=new RegExp("^(?:([+-])=|)("+ee+")([a-z%]*)$","i"),ne=["Top","Right","Bottom","Left"],re=S.documentElement,ie=function(e){return E.contains(e.ownerDocument,e)},oe={composed:!0};re.getRootNode&&(ie=function(e){return E.contains(e.ownerDocument,e)||e.getRootNode(oe)===e.ownerDocument});var ae=function(e,t){return"none"===(e=t||e).style.display||""===e.style.display&&ie(e)&&"none"===E.css(e,"display")};function se(e,t,n,r){var i,o,a=20,s=r?function(){return r.cur()}:function(){return E.css(e,t,"")},u=s(),l=n&&n[3]||(E.cssNumber[t]?"":"px"),c=e.nodeType&&(E.cssNumber[t]||"px"!==l&&+u)&&te.exec(E.css(e,t));if(c&&c[3]!==l){u/=2,l=l||c[3],c=+u||1;while(a--)E.style(e,t,c+l),(1-o)*(1-(o=s()/u||.5))<=0&&(a=0),c/=o;c*=2,E.style(e,t,c+l),n=n||[]}return n&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}var ue={};function le(e,t){for(var n,r,i,o,a,s,u,l=[],c=0,f=e.length;c<f;c++)(r=e[c]).style&&(n=r.style.display,t?("none"===n&&(l[c]=Y.get(r,"display")||null,l[c]||(r.style.display="")),""===r.style.display&&ae(r)&&(l[c]=(u=a=o=void 0,a=(i=r).ownerDocument,s=i.nodeName,(u=ue[s])||(o=a.body.appendChild(a.createElement(s)),u=E.css(o,"display"),o.parentNode.removeChild(o),"none"===u&&(u="block"),ue[s]=u)))):"none"!==n&&(l[c]="none",Y.set(r,"display",n)));for(c=0;c<f;c++)null!=l[c]&&(e[c].style.display=l[c]);return e}E.fn.extend({show:function(){return le(this,!0)},hide:function(){return le(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){ae(this)?E(this).show():E(this).hide()})}});var ce,fe,pe=/^(?:checkbox|radio)$/i,de=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i;ce=S.createDocumentFragment().appendChild(S.createElement("div")),(fe=S.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),ce.appendChild(fe),v.checkClone=ce.cloneNode(!0).cloneNode(!0).lastChild.checked,ce.innerHTML="<textarea>x</textarea>",v.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML="<option></option>",v.option=!!ce.lastChild;var ge={thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};function ye(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?E.merge([e],n):n}function ve(e,t){for(var n=0,r=e.length;n<r;n++)Y.set(e[n],"globalEval",!t||Y.get(t[n],"globalEval"))}ge.tbody=ge.tfoot=ge.colgroup=ge.caption=ge.thead,ge.th=ge.td,v.option||(ge.optgroup=ge.option=[1,"<select multiple='multiple'>","</select>"]);var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d<h;d++)if((o=e[d])||0===o)if("object"===w(o))E.merge(p,o.nodeType?[o]:o);else if(me.test(o)){a=a||f.appendChild(t.createElement("div")),s=(de.exec(o)||["",""])[1].toLowerCase(),u=ge[s]||ge._default,a.innerHTML=u[1]+E.htmlPrefilter(o)+u[2],c=u[0];while(c--)a=a.lastChild;E.merge(p,a.childNodes),(a=f.firstChild).textContent=""}else p.push(t.createTextNode(o));f.textContent="",d=0;while(o=p[d++])if(r&&-1<E.inArray(o,r))i&&i.push(o);else if(l=ie(o),a=ye(f.appendChild(o),"script"),l&&ve(a),n){c=0;while(o=a[c++])he.test(o.type||"")&&n.push(o)}return f}var be=/^([^.]*)(?:\.(.+)|)/;function we(){return!0}function Te(){return!1}function Ce(e,t){return e===function(){try{return S.activeElement}catch(e){}}()==("focus"===t)}function Se(e,t,n,r,i,o){var a,s;if("object"==typeof t){for(s in"string"!=typeof n&&(r=r||n,n=void 0),t)Se(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=Te;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return E().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=E.guid++)),e.each(function(){E.event.add(this,t,i,r,n)})}function Ee(e,i,o){o?(Y.set(e,i,!1),E.event.add(e,i,{namespace:!1,handler:function(e){var t,n,r=Y.get(this,i);if(1&e.isTrigger&&this[i]){if(r.length)(E.event.special[i]||{}).delegateType&&e.stopPropagation();else if(r=s.call(arguments),Y.set(this,i,r),t=o(this,i),this[i](),r!==(n=Y.get(this,i))||t?Y.set(this,i,!1):n={},r!==n)return e.stopImmediatePropagation(),e.preventDefault(),n&&n.value}else r.length&&(Y.set(this,i,{value:E.event.trigger(E.extend(r[0],E.Event.prototype),r.slice(1),this)}),e.stopImmediatePropagation())}})):void 0===Y.get(e,i)&&E.event.add(e,i,we)}E.event={global:{},add:function(t,e,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=Y.get(t);if(V(t)){n.handler&&(n=(o=n).handler,i=o.selector),i&&E.find.matchesSelector(re,i),n.guid||(n.guid=E.guid++),(u=y.events)||(u=y.events=Object.create(null)),(a=y.handle)||(a=y.handle=function(e){return"undefined"!=typeof E&&E.event.triggered!==e.type?E.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||"").match(P)||[""]).length;while(l--)d=g=(s=be.exec(e[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=E.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=E.event.special[d]||{},c=E.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&E.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,r,h,a)||t.addEventListener&&t.addEventListener(d,a)),f.add&&(f.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),E.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=Y.hasData(e)&&Y.get(e);if(y&&(u=y.events)){l=(t=(t||"").match(P)||[""]).length;while(l--)if(d=g=(s=be.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d){f=E.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,y.handle)||E.removeEvent(e,d,y.handle),delete u[d])}else for(d in u)E.event.remove(e,d+t[l],n,r,!0);E.isEmptyObject(u)&&Y.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,a,s=new Array(arguments.length),u=E.event.fix(e),l=(Y.get(this,"events")||Object.create(null))[u.type]||[],c=E.event.special[u.type]||{};for(s[0]=u,t=1;t<arguments.length;t++)s[t]=arguments[t];if(u.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,u)){a=E.event.handlers.call(this,u,l),t=0;while((i=a[t++])&&!u.isPropagationStopped()){u.currentTarget=i.elem,n=0;while((o=i.handlers[n++])&&!u.isImmediatePropagationStopped())u.rnamespace&&!1!==o.namespace&&!u.rnamespace.test(o.namespace)||(u.handleObj=o,u.data=o.data,void 0!==(r=((E.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,s))&&!1===(u.result=r)&&(u.preventDefault(),u.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,u),u.result}},handlers:function(e,t){var n,r,i,o,a,s=[],u=t.delegateCount,l=e.target;if(u&&l.nodeType&&!("click"===e.type&&1<=e.button))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n<u;n++)void 0===a[i=(r=t[n]).selector+" "]&&(a[i]=r.needsContext?-1<E(i,this).index(l):E.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u<t.length&&s.push({elem:l,handlers:t.slice(u)}),s},addProp:function(t,e){Object.defineProperty(E.Event.prototype,t,{enumerable:!0,configurable:!0,get:m(e)?function(){if(this.originalEvent)return e(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[t]},set:function(e){Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:e})}})},fix:function(e){return e[E.expando]?e:new E.Event(e)},special:{load:{noBubble:!0},click:{setup:function(e){var t=this||e;return pe.test(t.type)&&t.click&&A(t,"input")&&Ee(t,"click",we),!1},trigger:function(e){var t=this||e;return pe.test(t.type)&&t.click&&A(t,"input")&&Ee(t,"click"),!0},_default:function(e){var t=e.target;return pe.test(t.type)&&t.click&&A(t,"input")&&Y.get(t,"click")||A(t,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},E.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},E.Event=function(e,t){if(!(this instanceof E.Event))return new E.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?we:Te,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&E.extend(this,t),this.timeStamp=e&&e.timeStamp||Date.now(),this[E.expando]=!0},E.Event.prototype={constructor:E.Event,isDefaultPrevented:Te,isPropagationStopped:Te,isImmediatePropagationStopped:Te,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=we,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=we,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=we,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},E.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,code:!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:!0},E.event.addProp),E.each({focus:"focusin",blur:"focusout"},function(t,e){E.event.special[t]={setup:function(){return Ee(this,t,Ce),!1},trigger:function(){return Ee(this,t),!0},_default:function(e){return Y.get(e.target,t)},delegateType:e}}),E.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,i){E.event.special[e]={delegateType:i,bindType:i,handle:function(e){var t,n=e.relatedTarget,r=e.handleObj;return n&&(n===this||E.contains(this,n))||(e.type=r.origType,t=r.handler.apply(this,arguments),e.type=i),t}}}),E.fn.extend({on:function(e,t,n,r){return Se(this,e,t,n,r)},one:function(e,t,n,r){return Se(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,E(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return!1!==t&&"function"!=typeof t||(n=t,t=void 0),!1===n&&(n=Te),this.each(function(){E.event.remove(this,e,n,t)})}});var ke=/<script|<style|<link/i,Ae=/checked\s*(?:[^=]|=\s*.checked.)/i,Ne=/^\s*<!\[CDATA\[|\]\]>\s*$/g;function je(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&E(e).children("tbody")[0]||e}function De(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function qe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Le(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,"handle events"),s)for(n=0,r=s[i].length;n<r;n++)E.event.add(t,i,s[i][n]);Q.hasData(e)&&(o=Q.access(e),a=E.extend({},o),Q.set(t,a))}}function He(n,r,i,o){r=g(r);var e,t,a,s,u,l,c=0,f=n.length,p=f-1,d=r[0],h=m(d);if(h||1<f&&"string"==typeof d&&!v.checkClone&&Ae.test(d))return n.each(function(e){var t=n.eq(e);h&&(r[0]=d.call(this,e,t.html())),He(t,r,i,o)});if(f&&(t=(e=xe(r,n[0].ownerDocument,!1,n,o)).firstChild,1===e.childNodes.length&&(e=t),t||o)){for(s=(a=E.map(ye(e,"script"),De)).length;c<f;c++)u=e,c!==p&&(u=E.clone(u,!0,!0),s&&E.merge(a,ye(u,"script"))),i.call(n[c],u,c);if(s)for(l=a[a.length-1].ownerDocument,E.map(a,qe),c=0;c<s;c++)u=a[c],he.test(u.type||"")&&!Y.access(u,"globalEval")&&E.contains(l,u)&&(u.src&&"module"!==(u.type||"").toLowerCase()?E._evalUrl&&!u.noModule&&E._evalUrl(u.src,{nonce:u.nonce||u.getAttribute("nonce")},l):b(u.textContent.replace(Ne,""),u,l))}return n}function Oe(e,t,n){for(var r,i=t?E.filter(t,e):e,o=0;null!=(r=i[o]);o++)n||1!==r.nodeType||E.cleanData(ye(r)),r.parentNode&&(n&&ie(r)&&ve(ye(r,"script")),r.parentNode.removeChild(r));return e}E.extend({htmlPrefilter:function(e){return e},clone:function(e,t,n){var r,i,o,a,s,u,l,c=e.cloneNode(!0),f=ie(e);if(!(v.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||E.isXMLDoc(e)))for(a=ye(c),r=0,i=(o=ye(e)).length;r<i;r++)s=o[r],u=a[r],void 0,"input"===(l=u.nodeName.toLowerCase())&&pe.test(s.type)?u.checked=s.checked:"input"!==l&&"textarea"!==l||(u.defaultValue=s.defaultValue);if(t)if(n)for(o=o||ye(e),a=a||ye(c),r=0,i=o.length;r<i;r++)Le(o[r],a[r]);else Le(e,c);return 0<(a=ye(c,"script")).length&&ve(a,!f&&ye(e,"script")),c},cleanData:function(e){for(var t,n,r,i=E.event.special,o=0;void 0!==(n=e[o]);o++)if(V(n)){if(t=n[Y.expando]){if(t.events)for(r in t.events)i[r]?E.event.remove(n,r):E.removeEvent(n,r,t.handle);n[Y.expando]=void 0}n[Q.expando]&&(n[Q.expando]=void 0)}}}),E.fn.extend({detach:function(e){return Oe(this,e,!0)},remove:function(e){return Oe(this,e)},text:function(e){return B(this,function(e){return void 0===e?E.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return He(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||je(this,e).appendChild(e)})},prepend:function(){return He(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=je(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return He(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return He(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(E.cleanData(ye(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return E.clone(this,e,t)})},html:function(e){return B(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!ke.test(e)&&!ge[(de.exec(e)||["",""])[1].toLowerCase()]){e=E.htmlPrefilter(e);try{for(;n<r;n++)1===(t=this[n]||{}).nodeType&&(E.cleanData(ye(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var n=[];return He(this,arguments,function(e){var t=this.parentNode;E.inArray(this,n)<0&&(E.cleanData(ye(this)),t&&t.replaceChild(e,this))},n)}}),E.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,a){E.fn[e]=function(e){for(var t,n=[],r=E(e),i=r.length-1,o=0;o<=i;o++)t=o===i?this:this.clone(!0),E(r[o])[a](t),u.apply(n,t.get());return this.pushStack(n)}});var Pe=new RegExp("^("+ee+")(?!px)[a-z%]+$","i"),Re=/^--/,Me=function(e){var t=e.ownerDocument.defaultView;return t&&t.opener||(t=C),t.getComputedStyle(e)},Ie=function(e,t,n){var r,i,o={};for(i in t)o[i]=e.style[i],e.style[i]=t[i];for(i in r=n.call(e),t)e.style[i]=o[i];return r},We=new RegExp(ne.join("|"),"i"),Fe="[\\x20\\t\\r\\n\\f]",$e=new RegExp("^"+Fe+"+|((?:^|[^\\\\])(?:\\\\.)*)"+Fe+"+$","g");function Be(e,t,n){var r,i,o,a,s=Re.test(t),u=e.style;return(n=n||Me(e))&&(a=n.getPropertyValue(t)||n[t],s&&a&&(a=a.replace($e,"$1")||void 0),""!==a||ie(e)||(a=E.style(e,t)),!v.pixelBoxStyles()&&Pe.test(a)&&We.test(t)&&(r=u.width,i=u.minWidth,o=u.maxWidth,u.minWidth=u.maxWidth=u.width=a,a=n.width,u.width=r,u.minWidth=i,u.maxWidth=o)),void 0!==a?a+"":a}function _e(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}!function(){function e(){if(l){u.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",l.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",re.appendChild(u).appendChild(l);var e=C.getComputedStyle(l);n="1%"!==e.top,s=12===t(e.marginLeft),l.style.right="60%",o=36===t(e.right),r=36===t(e.width),l.style.position="absolute",i=12===t(l.offsetWidth/3),re.removeChild(u),l=null}}function t(e){return Math.round(parseFloat(e))}var n,r,i,o,a,s,u=S.createElement("div"),l=S.createElement("div");l.style&&(l.style.backgroundClip="content-box",l.cloneNode(!0).style.backgroundClip="",v.clearCloneStyle="content-box"===l.style.backgroundClip,E.extend(v,{boxSizingReliable:function(){return e(),r},pixelBoxStyles:function(){return e(),o},pixelPosition:function(){return e(),n},reliableMarginLeft:function(){return e(),s},scrollboxSize:function(){return e(),i},reliableTrDimensions:function(){var e,t,n,r;return null==a&&(e=S.createElement("table"),t=S.createElement("tr"),n=S.createElement("div"),e.style.cssText="position:absolute;left:-11111px;border-collapse:separate",t.style.cssText="border:1px solid",t.style.height="1px",n.style.height="9px",n.style.display="block",re.appendChild(e).appendChild(t).appendChild(n),r=C.getComputedStyle(t),a=parseInt(r.height,10)+parseInt(r.borderTopWidth,10)+parseInt(r.borderBottomWidth,10)===t.offsetHeight,re.removeChild(e)),a}}))}();var ze=["Webkit","Moz","ms"],Ue=S.createElement("div").style,Xe={};function Ve(e){var t=E.cssProps[e]||Xe[e];return t||(e in Ue?e:Xe[e]=function(e){var t=e[0].toUpperCase()+e.slice(1),n=ze.length;while(n--)if((e=ze[n]+t)in Ue)return e}(e)||e)}var Ge=/^(none|table(?!-c[ea]).+)/,Ye={position:"absolute",visibility:"hidden",display:"block"},Qe={letterSpacing:"0",fontWeight:"400"};function Je(e,t,n){var r=te.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function Ke(e,t,n,r,i,o){var a="width"===t?1:0,s=0,u=0;if(n===(r?"border":"content"))return 0;for(;a<4;a+=2)"margin"===n&&(u+=E.css(e,n+ne[a],!0,i)),r?("content"===n&&(u-=E.css(e,"padding"+ne[a],!0,i)),"margin"!==n&&(u-=E.css(e,"border"+ne[a]+"Width",!0,i))):(u+=E.css(e,"padding"+ne[a],!0,i),"padding"!==n?u+=E.css(e,"border"+ne[a]+"Width",!0,i):s+=E.css(e,"border"+ne[a]+"Width",!0,i));return!r&&0<=o&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))||0),u}function Ze(e,t,n){var r=Me(e),i=(!v.boxSizingReliable()||n)&&"border-box"===E.css(e,"boxSizing",!1,r),o=i,a=Be(e,t,r),s="offset"+t[0].toUpperCase()+t.slice(1);if(Pe.test(a)){if(!n)return a;a="auto"}return(!v.boxSizingReliable()&&i||!v.reliableTrDimensions()&&A(e,"tr")||"auto"===a||!parseFloat(a)&&"inline"===E.css(e,"display",!1,r))&&e.getClientRects().length&&(i="border-box"===E.css(e,"boxSizing",!1,r),(o=s in e)&&(a=e[s])),(a=parseFloat(a)||0)+Ke(e,t,n||(i?"border":"content"),o,r,a)+"px"}function et(e,t,n,r,i){return new et.prototype.init(e,t,n,r,i)}E.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Be(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=X(t),u=Re.test(t),l=e.style;if(u||(t=Ve(s)),a=E.cssHooks[t]||E.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];"string"===(o=typeof n)&&(i=te.exec(n))&&i[1]&&(n=se(e,t,i),o="number"),null!=n&&n==n&&("number"!==o||u||(n+=i&&i[3]||(E.cssNumber[s]?"":"px")),v.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,s=X(t);return Re.test(t)||(t=Ve(s)),(a=E.cssHooks[t]||E.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=Be(e,t,r)),"normal"===i&&t in Qe&&(i=Qe[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),E.each(["height","width"],function(e,u){E.cssHooks[u]={get:function(e,t,n){if(t)return!Ge.test(E.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?Ze(e,u,n):Ie(e,Ye,function(){return Ze(e,u,n)})},set:function(e,t,n){var r,i=Me(e),o=!v.scrollboxSize()&&"absolute"===i.position,a=(o||n)&&"border-box"===E.css(e,"boxSizing",!1,i),s=n?Ke(e,u,n,a,i):0;return a&&o&&(s-=Math.ceil(e["offset"+u[0].toUpperCase()+u.slice(1)]-parseFloat(i[u])-Ke(e,u,"border",!1,i)-.5)),s&&(r=te.exec(t))&&"px"!==(r[3]||"px")&&(e.style[u]=t,t=E.css(e,u)),Je(0,t,s)}}}),E.cssHooks.marginLeft=_e(v.reliableMarginLeft,function(e,t){if(t)return(parseFloat(Be(e,"marginLeft"))||e.getBoundingClientRect().left-Ie(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),E.each({margin:"",padding:"",border:"Width"},function(i,o){E.cssHooks[i+o]={expand:function(e){for(var t=0,n={},r="string"==typeof e?e.split(" "):[e];t<4;t++)n[i+ne[t]+o]=r[t]||r[t-2]||r[0];return n}},"margin"!==i&&(E.cssHooks[i+o].set=Je)}),E.fn.extend({css:function(e,t){return B(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=Me(e),i=t.length;a<i;a++)o[t[a]]=E.css(e,t[a],!1,r);return o}return void 0!==n?E.style(e,t,n):E.css(e,t)},e,t,1<arguments.length)}}),((E.Tween=et).prototype={constructor:et,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||E.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(E.cssNumber[n]?"":"px")},cur:function(){var e=et.propHooks[this.prop];return e&&e.get?e.get(this):et.propHooks._default.get(this)},run:function(e){var t,n=et.propHooks[this.prop];return this.options.duration?this.pos=t=E.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):et.propHooks._default.set(this),this}}).init.prototype=et.prototype,(et.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=E.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){E.fx.step[e.prop]?E.fx.step[e.prop](e):1!==e.elem.nodeType||!E.cssHooks[e.prop]&&null==e.elem.style[Ve(e.prop)]?e.elem[e.prop]=e.now:E.style(e.elem,e.prop,e.now+e.unit)}}}).scrollTop=et.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},E.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},E.fx=et.prototype.init,E.fx.step={};var tt,nt,rt,it,ot=/^(?:toggle|show|hide)$/,at=/queueHooks$/;function st(){nt&&(!1===S.hidden&&C.requestAnimationFrame?C.requestAnimationFrame(st):C.setTimeout(st,E.fx.interval),E.fx.tick())}function ut(){return C.setTimeout(function(){tt=void 0}),tt=Date.now()}function lt(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=ne[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function ct(e,t,n){for(var r,i=(ft.tweeners[t]||[]).concat(ft.tweeners["*"]),o=0,a=i.length;o<a;o++)if(r=i[o].call(n,t,e))return r}function ft(o,e,t){var n,a,r=0,i=ft.prefilters.length,s=E.Deferred().always(function(){delete u.elem}),u=function(){if(a)return!1;for(var e=tt||ut(),t=Math.max(0,l.startTime+l.duration-e),n=1-(t/l.duration||0),r=0,i=l.tweens.length;r<i;r++)l.tweens[r].run(n);return s.notifyWith(o,[l,n,t]),n<1&&i?t:(i||s.notifyWith(o,[l,1,0]),s.resolveWith(o,[l]),!1)},l=s.promise({elem:o,props:E.extend({},e),opts:E.extend(!0,{specialEasing:{},easing:E.easing._default},t),originalProperties:e,originalOptions:t,startTime:tt||ut(),duration:t.duration,tweens:[],createTween:function(e,t){var n=E.Tween(o,l.opts,e,t,l.opts.specialEasing[e]||l.opts.easing);return l.tweens.push(n),n},stop:function(e){var t=0,n=e?l.tweens.length:0;if(a)return this;for(a=!0;t<n;t++)l.tweens[t].run(1);return e?(s.notifyWith(o,[l,1,0]),s.resolveWith(o,[l,e])):s.rejectWith(o,[l,e]),this}}),c=l.props;for(!function(e,t){var n,r,i,o,a;for(n in e)if(i=t[r=X(n)],o=e[n],Array.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(a=E.cssHooks[r])&&"expand"in a)for(n in o=a.expand(o),delete e[r],o)n in e||(e[n]=o[n],t[n]=i);else t[r]=i}(c,l.opts.specialEasing);r<i;r++)if(n=ft.prefilters[r].call(l,o,c,l.opts))return m(n.stop)&&(E._queueHooks(l.elem,l.opts.queue).stop=n.stop.bind(n)),n;return E.map(c,ct,l),m(l.opts.start)&&l.opts.start.call(o,l),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always),E.fx.timer(E.extend(u,{elem:o,anim:l,queue:l.opts.queue})),l}E.Animation=E.extend(ft,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return se(n.elem,e,te.exec(t),n),n}]},tweener:function(e,t){m(e)?(t=e,e=["*"]):e=e.match(P);for(var n,r=0,i=e.length;r<i;r++)n=e[r],ft.tweeners[n]=ft.tweeners[n]||[],ft.tweeners[n].unshift(t)},prefilters:[function(e,t,n){var r,i,o,a,s,u,l,c,f="width"in t||"height"in t,p=this,d={},h=e.style,g=e.nodeType&&ae(e),y=Y.get(e,"fxshow");for(r in n.queue||(null==(a=E._queueHooks(e,"fx")).unqueued&&(a.unqueued=0,s=a.empty.fire,a.empty.fire=function(){a.unqueued||s()}),a.unqueued++,p.always(function(){p.always(function(){a.unqueued--,E.queue(e,"fx").length||a.empty.fire()})})),t)if(i=t[r],ot.test(i)){if(delete t[r],o=o||"toggle"===i,i===(g?"hide":"show")){if("show"!==i||!y||void 0===y[r])continue;g=!0}d[r]=y&&y[r]||E.style(e,r)}if((u=!E.isEmptyObject(t))||!E.isEmptyObject(d))for(r in f&&1===e.nodeType&&(n.overflow=[h.overflow,h.overflowX,h.overflowY],null==(l=y&&y.display)&&(l=Y.get(e,"display")),"none"===(c=E.css(e,"display"))&&(l?c=l:(le([e],!0),l=e.style.display||l,c=E.css(e,"display"),le([e]))),("inline"===c||"inline-block"===c&&null!=l)&&"none"===E.css(e,"float")&&(u||(p.done(function(){h.display=l}),null==l&&(c=h.display,l="none"===c?"":c)),h.display="inline-block")),n.overflow&&(h.overflow="hidden",p.always(function(){h.overflow=n.overflow[0],h.overflowX=n.overflow[1],h.overflowY=n.overflow[2]})),u=!1,d)u||(y?"hidden"in y&&(g=y.hidden):y=Y.access(e,"fxshow",{display:l}),o&&(y.hidden=!g),g&&le([e],!0),p.done(function(){for(r in g||le([e]),Y.remove(e,"fxshow"),d)E.style(e,r,d[r])})),u=ct(g?y[r]:0,r,p),r in y||(y[r]=u.start,g&&(u.end=u.start,u.start=0))}],prefilter:function(e,t){t?ft.prefilters.unshift(e):ft.prefilters.push(e)}}),E.speed=function(e,t,n){var r=e&&"object"==typeof e?E.extend({},e):{complete:n||!n&&t||m(e)&&e,duration:e,easing:n&&t||t&&!m(t)&&t};return E.fx.off?r.duration=0:"number"!=typeof r.duration&&(r.duration in E.fx.speeds?r.duration=E.fx.speeds[r.duration]:r.duration=E.fx.speeds._default),null!=r.queue&&!0!==r.queue||(r.queue="fx"),r.old=r.complete,r.complete=function(){m(r.old)&&r.old.call(this),r.queue&&E.dequeue(this,r.queue)},r},E.fn.extend({fadeTo:function(e,t,n,r){return this.filter(ae).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(t,e,n,r){var i=E.isEmptyObject(t),o=E.speed(e,n,r),a=function(){var e=ft(this,E.extend({},t),o);(i||Y.get(this,"finish"))&&e.stop(!0)};return a.finish=a,i||!1===o.queue?this.each(a):this.queue(o.queue,a)},stop:function(i,e,o){var a=function(e){var t=e.stop;delete e.stop,t(o)};return"string"!=typeof i&&(o=e,e=i,i=void 0),e&&this.queue(i||"fx",[]),this.each(function(){var e=!0,t=null!=i&&i+"queueHooks",n=E.timers,r=Y.get(this);if(t)r[t]&&r[t].stop&&a(r[t]);else for(t in r)r[t]&&r[t].stop&&at.test(t)&&a(r[t]);for(t=n.length;t--;)n[t].elem!==this||null!=i&&n[t].queue!==i||(n[t].anim.stop(o),e=!1,n.splice(t,1));!e&&o||E.dequeue(this,i)})},finish:function(a){return!1!==a&&(a=a||"fx"),this.each(function(){var e,t=Y.get(this),n=t[a+"queue"],r=t[a+"queueHooks"],i=E.timers,o=n?n.length:0;for(t.finish=!0,E.queue(this,a,[]),r&&r.stop&&r.stop.call(this,!0),e=i.length;e--;)i[e].elem===this&&i[e].queue===a&&(i[e].anim.stop(!0),i.splice(e,1));for(e=0;e<o;e++)n[e]&&n[e].finish&&n[e].finish.call(this);delete t.finish})}}),E.each(["toggle","show","hide"],function(e,r){var i=E.fn[r];E.fn[r]=function(e,t,n){return null==e||"boolean"==typeof e?i.apply(this,arguments):this.animate(lt(r,!0),e,t,n)}}),E.each({slideDown:lt("show"),slideUp:lt("hide"),slideToggle:lt("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,r){E.fn[e]=function(e,t,n){return this.animate(r,e,t,n)}}),E.timers=[],E.fx.tick=function(){var e,t=0,n=E.timers;for(tt=Date.now();t<n.length;t++)(e=n[t])()||n[t]!==e||n.splice(t--,1);n.length||E.fx.stop(),tt=void 0},E.fx.timer=function(e){E.timers.push(e),E.fx.start()},E.fx.interval=13,E.fx.start=function(){nt||(nt=!0,st())},E.fx.stop=function(){nt=null},E.fx.speeds={slow:600,fast:200,_default:400},E.fn.delay=function(r,e){return r=E.fx&&E.fx.speeds[r]||r,e=e||"fx",this.queue(e,function(e,t){var n=C.setTimeout(e,r);t.stop=function(){C.clearTimeout(n)}})},rt=S.createElement("input"),it=S.createElement("select").appendChild(S.createElement("option")),rt.type="checkbox",v.checkOn=""!==rt.value,v.optSelected=it.selected,(rt=S.createElement("input")).value="t",rt.type="radio",v.radioValue="t"===rt.value;var pt,dt=E.expr.attrHandle;E.fn.extend({attr:function(e,t){return B(this,E.attr,e,t,1<arguments.length)},removeAttr:function(e){return this.each(function(){E.removeAttr(this,e)})}}),E.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?E.prop(e,t,n):(1===o&&E.isXMLDoc(e)||(i=E.attrHooks[t.toLowerCase()]||(E.expr.match.bool.test(t)?pt:void 0)),void 0!==n?null===n?void E.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=E.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!v.radioValue&&"radio"===t&&A(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(P);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),pt={set:function(e,t,n){return!1===t?E.removeAttr(e,n):e.setAttribute(n,n),n}},E.each(E.expr.match.bool.source.match(/\w+/g),function(e,t){var a=dt[t]||E.find.attr;dt[t]=function(e,t,n){var r,i,o=t.toLowerCase();return n||(i=dt[o],dt[o]=r,r=null!=a(e,t,n)?o:null,dt[o]=i),r}});var ht=/^(?:input|select|textarea|button)$/i,gt=/^(?:a|area)$/i;function yt(e){return(e.match(P)||[]).join(" ")}function vt(e){return e.getAttribute&&e.getAttribute("class")||""}function mt(e){return Array.isArray(e)?e:"string"==typeof e&&e.match(P)||[]}E.fn.extend({prop:function(e,t){return B(this,E.prop,e,t,1<arguments.length)},removeProp:function(e){return this.each(function(){delete this[E.propFix[e]||e]})}}),E.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&E.isXMLDoc(e)||(t=E.propFix[t]||t,i=E.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=E.find.attr(e,"tabindex");return t?parseInt(t,10):ht.test(e.nodeName)||gt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),v.optSelected||(E.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),E.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){E.propFix[this.toLowerCase()]=this}),E.fn.extend({addClass:function(t){var e,n,r,i,o,a;return m(t)?this.each(function(e){E(this).addClass(t.call(this,e,vt(this)))}):(e=mt(t)).length?this.each(function(){if(r=vt(this),n=1===this.nodeType&&" "+yt(r)+" "){for(o=0;o<e.length;o++)i=e[o],n.indexOf(" "+i+" ")<0&&(n+=i+" ");a=yt(n),r!==a&&this.setAttribute("class",a)}}):this},removeClass:function(t){var e,n,r,i,o,a;return m(t)?this.each(function(e){E(this).removeClass(t.call(this,e,vt(this)))}):arguments.length?(e=mt(t)).length?this.each(function(){if(r=vt(this),n=1===this.nodeType&&" "+yt(r)+" "){for(o=0;o<e.length;o++){i=e[o];while(-1<n.indexOf(" "+i+" "))n=n.replace(" "+i+" "," ")}a=yt(n),r!==a&&this.setAttribute("class",a)}}):this:this.attr("class","")},toggleClass:function(t,n){var e,r,i,o,a=typeof t,s="string"===a||Array.isArray(t);return m(t)?this.each(function(e){E(this).toggleClass(t.call(this,e,vt(this),n),n)}):"boolean"==typeof n&&s?n?this.addClass(t):this.removeClass(t):(e=mt(t),this.each(function(){if(s)for(o=E(this),i=0;i<e.length;i++)r=e[i],o.hasClass(r)?o.removeClass(r):o.addClass(r);else void 0!==t&&"boolean"!==a||((r=vt(this))&&Y.set(this,"__className__",r),this.setAttribute&&this.setAttribute("class",r||!1===t?"":Y.get(this,"__className__")||""))}))},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(1===n.nodeType&&-1<(" "+yt(vt(n))+" ").indexOf(t))return!0;return!1}});var xt=/\r/g;E.fn.extend({val:function(n){var r,e,i,t=this[0];return arguments.length?(i=m(n),this.each(function(e){var t;1===this.nodeType&&(null==(t=i?n.call(this,e,E(this).val()):n)?t="":"number"==typeof t?t+="":Array.isArray(t)&&(t=E.map(t,function(e){return null==e?"":e+""})),(r=E.valHooks[this.type]||E.valHooks[this.nodeName.toLowerCase()])&&"set"in r&&void 0!==r.set(this,t,"value")||(this.value=t))})):t?(r=E.valHooks[t.type]||E.valHooks[t.nodeName.toLowerCase()])&&"get"in r&&void 0!==(e=r.get(t,"value"))?e:"string"==typeof(e=t.value)?e.replace(xt,""):null==e?"":e:void 0}}),E.extend({valHooks:{option:{get:function(e){var t=E.find.attr(e,"value");return null!=t?t:yt(E.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r<u;r++)if(((n=i[r]).selected||r===o)&&!n.disabled&&(!n.parentNode.disabled||!A(n.parentNode,"optgroup"))){if(t=E(n).val(),a)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=E.makeArray(t),a=i.length;while(a--)((r=i[a]).selected=-1<E.inArray(E.valHooks.option.get(r),o))&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),E.each(["radio","checkbox"],function(){E.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=-1<E.inArray(E(e).val(),t)}},v.checkOn||(E.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),v.focusin="onfocusin"in C;var bt=/^(?:focusinfocus|focusoutblur)$/,wt=function(e){e.stopPropagation()};E.extend(E.event,{trigger:function(e,t,n,r){var i,o,a,s,u,l,c,f,p=[n||S],d=y.call(e,"type")?e.type:e,h=y.call(e,"namespace")?e.namespace.split("."):[];if(o=f=a=n=n||S,3!==n.nodeType&&8!==n.nodeType&&!bt.test(d+E.event.triggered)&&(-1<d.indexOf(".")&&(d=(h=d.split(".")).shift(),h.sort()),u=d.indexOf(":")<0&&"on"+d,(e=e[E.expando]?e:new E.Event(d,"object"==typeof e&&e)).isTrigger=r?2:3,e.namespace=h.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),t=null==t?[e]:E.makeArray(t,[e]),c=E.event.special[d]||{},r||!c.trigger||!1!==c.trigger.apply(n,t))){if(!r&&!c.noBubble&&!x(n)){for(s=c.delegateType||d,bt.test(s+d)||(o=o.parentNode);o;o=o.parentNode)p.push(o),a=o;a===(n.ownerDocument||S)&&p.push(a.defaultView||a.parentWindow||C)}i=0;while((o=p[i++])&&!e.isPropagationStopped())f=o,e.type=1<i?s:c.bindType||d,(l=(Y.get(o,"events")||Object.create(null))[e.type]&&Y.get(o,"handle"))&&l.apply(o,t),(l=u&&o[u])&&l.apply&&V(o)&&(e.result=l.apply(o,t),!1===e.result&&e.preventDefault());return e.type=d,r||e.isDefaultPrevented()||c._default&&!1!==c._default.apply(p.pop(),t)||!V(n)||u&&m(n[d])&&!x(n)&&((a=n[u])&&(n[u]=null),E.event.triggered=d,e.isPropagationStopped()&&f.addEventListener(d,wt),n[d](),e.isPropagationStopped()&&f.removeEventListener(d,wt),E.event.triggered=void 0,a&&(n[u]=a)),e.result}},simulate:function(e,t,n){var r=E.extend(new E.Event,n,{type:e,isSimulated:!0});E.event.trigger(r,null,t)}}),E.fn.extend({trigger:function(e,t){return this.each(function(){E.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return E.event.trigger(e,t,n,!0)}}),v.focusin||E.each({focus:"focusin",blur:"focusout"},function(n,r){var i=function(e){E.event.simulate(r,e.target,E.event.fix(e))};E.event.special[r]={setup:function(){var e=this.ownerDocument||this.document||this,t=Y.access(e,r);t||e.addEventListener(n,i,!0),Y.access(e,r,(t||0)+1)},teardown:function(){var e=this.ownerDocument||this.document||this,t=Y.access(e,r)-1;t?Y.access(e,r,t):(e.removeEventListener(n,i,!0),Y.remove(e,r))}}});var Tt=C.location,Ct={guid:Date.now()},St=/\?/;E.parseXML=function(e){var t,n;if(!e||"string"!=typeof e)return null;try{t=(new C.DOMParser).parseFromString(e,"text/xml")}catch(e){}return n=t&&t.getElementsByTagName("parsererror")[0],t&&!n||E.error("Invalid XML: "+(n?E.map(n.childNodes,function(e){return e.textContent}).join("\n"):e)),t};var Et=/\[\]$/,kt=/\r?\n/g,At=/^(?:submit|button|image|reset|file)$/i,Nt=/^(?:input|select|textarea|keygen)/i;function jt(n,e,r,i){var t;if(Array.isArray(e))E.each(e,function(e,t){r||Et.test(n)?i(n,t):jt(n+"["+("object"==typeof t&&null!=t?e:"")+"]",t,r,i)});else if(r||"object"!==w(e))i(n,e);else for(t in e)jt(n+"["+t+"]",e[t],r,i)}E.param=function(e,t){var n,r=[],i=function(e,t){var n=m(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(null==e)return"";if(Array.isArray(e)||e.jquery&&!E.isPlainObject(e))E.each(e,function(){i(this.name,this.value)});else for(n in e)jt(n,e[n],t,i);return r.join("&")},E.fn.extend({serialize:function(){return E.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=E.prop(this,"elements");return e?E.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!E(this).is(":disabled")&&Nt.test(this.nodeName)&&!At.test(e)&&(this.checked||!pe.test(e))}).map(function(e,t){var n=E(this).val();return null==n?null:Array.isArray(n)?E.map(n,function(e){return{name:t.name,value:e.replace(kt,"\r\n")}}):{name:t.name,value:n.replace(kt,"\r\n")}}).get()}});var Dt=/%20/g,qt=/#.*$/,Lt=/([?&])_=[^&]*/,Ht=/^(.*?):[ \t]*([^\r\n]*)$/gm,Ot=/^(?:GET|HEAD)$/,Pt=/^\/\//,Rt={},Mt={},It="*/".concat("*"),Wt=S.createElement("a");function Ft(o){return function(e,t){"string"!=typeof e&&(t=e,e="*");var n,r=0,i=e.toLowerCase().match(P)||[];if(m(t))while(n=i[r++])"+"===n[0]?(n=n.slice(1)||"*",(o[n]=o[n]||[]).unshift(t)):(o[n]=o[n]||[]).push(t)}}function $t(t,i,o,a){var s={},u=t===Mt;function l(e){var r;return s[e]=!0,E.each(t[e]||[],function(e,t){var n=t(i,o,a);return"string"!=typeof n||u||s[n]?u?!(r=n):void 0:(i.dataTypes.unshift(n),l(n),!1)}),r}return l(i.dataTypes[0])||!s["*"]&&l("*")}function Bt(e,t){var n,r,i=E.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&E.extend(!0,e,r),e}Wt.href=Tt.href,E.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Tt.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(Tt.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":It,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":E.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Bt(Bt(e,E.ajaxSettings),t):Bt(E.ajaxSettings,e)},ajaxPrefilter:Ft(Rt),ajaxTransport:Ft(Mt),ajax:function(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var c,f,p,n,d,r,h,g,i,o,y=E.ajaxSetup({},t),v=y.context||y,m=y.context&&(v.nodeType||v.jquery)?E(v):E.event,x=E.Deferred(),b=E.Callbacks("once memory"),w=y.statusCode||{},a={},s={},u="canceled",T={readyState:0,getResponseHeader:function(e){var t;if(h){if(!n){n={};while(t=Ht.exec(p))n[t[1].toLowerCase()+" "]=(n[t[1].toLowerCase()+" "]||[]).concat(t[2])}t=n[e.toLowerCase()+" "]}return null==t?null:t.join(", ")},getAllResponseHeaders:function(){return h?p:null},setRequestHeader:function(e,t){return null==h&&(e=s[e.toLowerCase()]=s[e.toLowerCase()]||e,a[e]=t),this},overrideMimeType:function(e){return null==h&&(y.mimeType=e),this},statusCode:function(e){var t;if(e)if(h)T.always(e[T.status]);else for(t in e)w[t]=[w[t],e[t]];return this},abort:function(e){var t=e||u;return c&&c.abort(t),l(0,t),this}};if(x.promise(T),y.url=((e||y.url||Tt.href)+"").replace(Pt,Tt.protocol+"//"),y.type=t.method||t.type||y.method||y.type,y.dataTypes=(y.dataType||"*").toLowerCase().match(P)||[""],null==y.crossDomain){r=S.createElement("a");try{r.href=y.url,r.href=r.href,y.crossDomain=Wt.protocol+"//"+Wt.host!=r.protocol+"//"+r.host}catch(e){y.crossDomain=!0}}if(y.data&&y.processData&&"string"!=typeof y.data&&(y.data=E.param(y.data,y.traditional)),$t(Rt,y,t,T),h)return T;for(i in(g=E.event&&y.global)&&0==E.active++&&E.event.trigger("ajaxStart"),y.type=y.type.toUpperCase(),y.hasContent=!Ot.test(y.type),f=y.url.replace(qt,""),y.hasContent?y.data&&y.processData&&0===(y.contentType||"").indexOf("application/x-www-form-urlencoded")&&(y.data=y.data.replace(Dt,"+")):(o=y.url.slice(f.length),y.data&&(y.processData||"string"==typeof y.data)&&(f+=(St.test(f)?"&":"?")+y.data,delete y.data),!1===y.cache&&(f=f.replace(Lt,"$1"),o=(St.test(f)?"&":"?")+"_="+Ct.guid+++o),y.url=f+o),y.ifModified&&(E.lastModified[f]&&T.setRequestHeader("If-Modified-Since",E.lastModified[f]),E.etag[f]&&T.setRequestHeader("If-None-Match",E.etag[f])),(y.data&&y.hasContent&&!1!==y.contentType||t.contentType)&&T.setRequestHeader("Content-Type",y.contentType),T.setRequestHeader("Accept",y.dataTypes[0]&&y.accepts[y.dataTypes[0]]?y.accepts[y.dataTypes[0]]+("*"!==y.dataTypes[0]?", "+It+"; q=0.01":""):y.accepts["*"]),y.headers)T.setRequestHeader(i,y.headers[i]);if(y.beforeSend&&(!1===y.beforeSend.call(v,T,y)||h))return T.abort();if(u="abort",b.add(y.complete),T.done(y.success),T.fail(y.error),c=$t(Mt,y,t,T)){if(T.readyState=1,g&&m.trigger("ajaxSend",[T,y]),h)return T;y.async&&0<y.timeout&&(d=C.setTimeout(function(){T.abort("timeout")},y.timeout));try{h=!1,c.send(a,l)}catch(e){if(h)throw e;l(-1,e)}}else l(-1,"No Transport");function l(e,t,n,r){var i,o,a,s,u,l=t;h||(h=!0,d&&C.clearTimeout(d),c=void 0,p=r||"",T.readyState=0<e?4:0,i=200<=e&&e<300||304===e,n&&(s=function(e,t,n){var r,i,o,a,s=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]}(y,T,n)),!i&&-1<E.inArray("script",y.dataTypes)&&E.inArray("json",y.dataTypes)<0&&(y.converters["text script"]=function(){}),s=function(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(a=l[u+" "+o]||l["* "+o]))for(i in l)if((s=i.split(" "))[1]===o&&(a=l[u+" "+s[0]]||l["* "+s[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}(y,s,T,i),i?(y.ifModified&&((u=T.getResponseHeader("Last-Modified"))&&(E.lastModified[f]=u),(u=T.getResponseHeader("etag"))&&(E.etag[f]=u)),204===e||"HEAD"===y.type?l="nocontent":304===e?l="notmodified":(l=s.state,o=s.data,i=!(a=s.error))):(a=l,!e&&l||(l="error",e<0&&(e=0))),T.status=e,T.statusText=(t||l)+"",i?x.resolveWith(v,[o,l,T]):x.rejectWith(v,[T,l,a]),T.statusCode(w),w=void 0,g&&m.trigger(i?"ajaxSuccess":"ajaxError",[T,y,i?o:a]),b.fireWith(v,[T,l]),g&&(m.trigger("ajaxComplete",[T,y]),--E.active||E.event.trigger("ajaxStop")))}return T},getJSON:function(e,t,n){return E.get(e,t,n,"json")},getScript:function(e,t){return E.get(e,void 0,t,"script")}}),E.each(["get","post"],function(e,i){E[i]=function(e,t,n,r){return m(t)&&(r=r||n,n=t,t=void 0),E.ajax(E.extend({url:e,type:i,dataType:r,data:t,success:n},E.isPlainObject(e)&&e))}}),E.ajaxPrefilter(function(e){var t;for(t in e.headers)"content-type"===t.toLowerCase()&&(e.contentType=e.headers[t]||"")}),E._evalUrl=function(e,t,n){return E.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(e){E.globalEval(e,t,n)}})},E.fn.extend({wrapAll:function(e){var t;return this[0]&&(m(e)&&(e=e.call(this[0])),t=E(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(n){return m(n)?this.each(function(e){E(this).wrapInner(n.call(this,e))}):this.each(function(){var e=E(this),t=e.contents();t.length?t.wrapAll(n):e.append(n)})},wrap:function(t){var n=m(t);return this.each(function(e){E(this).wrapAll(n?t.call(this,e):t)})},unwrap:function(e){return this.parent(e).not("body").each(function(){E(this).replaceWith(this.childNodes)}),this}}),E.expr.pseudos.hidden=function(e){return!E.expr.pseudos.visible(e)},E.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},E.ajaxSettings.xhr=function(){try{return new C.XMLHttpRequest}catch(e){}};var _t={0:200,1223:204},zt=E.ajaxSettings.xhr();v.cors=!!zt&&"withCredentials"in zt,v.ajax=zt=!!zt,E.ajaxTransport(function(i){var o,a;if(v.cors||zt&&!i.crossDomain)return{send:function(e,t){var n,r=i.xhr();if(r.open(i.type,i.url,i.async,i.username,i.password),i.xhrFields)for(n in i.xhrFields)r[n]=i.xhrFields[n];for(n in i.mimeType&&r.overrideMimeType&&r.overrideMimeType(i.mimeType),i.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest"),e)r.setRequestHeader(n,e[n]);o=function(e){return function(){o&&(o=a=r.onload=r.onerror=r.onabort=r.ontimeout=r.onreadystatechange=null,"abort"===e?r.abort():"error"===e?"number"!=typeof r.status?t(0,"error"):t(r.status,r.statusText):t(_t[r.status]||r.status,r.statusText,"text"!==(r.responseType||"text")||"string"!=typeof r.responseText?{binary:r.response}:{text:r.responseText},r.getAllResponseHeaders()))}},r.onload=o(),a=r.onerror=r.ontimeout=o("error"),void 0!==r.onabort?r.onabort=a:r.onreadystatechange=function(){4===r.readyState&&C.setTimeout(function(){o&&a()})},o=o("abort");try{r.send(i.hasContent&&i.data||null)}catch(e){if(o)throw e}},abort:function(){o&&o()}}}),E.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),E.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return E.globalEval(e),e}}}),E.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),E.ajaxTransport("script",function(n){var r,i;if(n.crossDomain||n.scriptAttrs)return{send:function(e,t){r=E("<script>").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),S.head.appendChild(r[0])},abort:function(){i&&i()}}});var Ut,Xt=[],Vt=/(=)\?(?=&|$)|\?\?/;E.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Xt.pop()||E.expando+"_"+Ct.guid++;return this[e]=!0,e}}),E.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Vt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Vt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Vt,"$1"+r):!1!==e.jsonp&&(e.url+=(St.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||E.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?E(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Xt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),v.createHTMLDocument=((Ut=S.implementation.createHTMLDocument("").body).innerHTML="<form></form><form></form>",2===Ut.childNodes.length),E.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(v.createHTMLDocument?((r=(t=S.implementation.createHTMLDocument("")).createElement("base")).href=S.location.href,t.head.appendChild(r)):t=S),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&E(o).remove(),E.merge([],i.childNodes)));var r,i,o},E.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1<s&&(r=yt(e.slice(s)),e=e.slice(0,s)),m(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),0<a.length&&E.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done(function(e){o=arguments,a.html(r?E("<div>").append(E.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},E.expr.pseudos.animated=function(t){return E.grep(E.timers,function(e){return t===e.elem}).length},E.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=E.css(e,"position"),c=E(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=E.css(e,"top"),u=E.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,E.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},E.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){E.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===E.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===E.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=E(e).offset()).top+=E.css(e,"borderTopWidth",!0),i.left+=E.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-E.css(r,"marginTop",!0),left:t.left-i.left-E.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===E.css(e,"position"))e=e.offsetParent;return e||re})}}),E.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;E.fn[t]=function(e){return B(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),E.each(["top","left"],function(e,n){E.cssHooks[n]=_e(v.pixelPosition,function(e,t){if(t)return t=Be(e,n),Pe.test(t)?E(e).position()[n]+"px":t})}),E.each({Height:"height",Width:"width"},function(a,s){E.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){E.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return B(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?E.css(e,t,i):E.style(e,t,n,i)},s,n?e:void 0,n)}})}),E.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){E.fn[t]=function(e){return this.on(t,e)}}),E.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),E.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){E.fn[n]=function(e,t){return 0<arguments.length?this.on(n,null,e,t):this.trigger(n)}});var Gt=/^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g;E.proxy=function(e,t){var n,r,i;if("string"==typeof t&&(n=e[t],t=e,e=n),m(e))return r=s.call(arguments,2),(i=function(){return e.apply(t||this,r.concat(s.call(arguments)))}).guid=e.guid=e.guid||E.guid++,i},E.holdReady=function(e){e?E.readyWait++:E.ready(!0)},E.isArray=Array.isArray,E.parseJSON=JSON.parse,E.nodeName=A,E.isFunction=m,E.isWindow=x,E.camelCase=X,E.type=w,E.now=Date.now,E.isNumeric=function(e){var t=E.type(e);return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))},E.trim=function(e){return null==e?"":(e+"").replace(Gt,"$1")},"function"==typeof define&&define.amd&&define("jquery",[],function(){return E});var Yt=C.jQuery,Qt=C.$;return E.noConflict=function(e){return C.$===E&&(C.$=Qt),e&&C.jQuery===E&&(C.jQuery=Yt),E},"undefined"==typeof e&&(C.jQuery=C.$=E),E}); diff --git a/static_common/common/vendor/select2/select2.css b/static_common/common/vendor/select2/select2.css new file mode 100644 index 00000000..750b3207 --- /dev/null +++ b/static_common/common/vendor/select2/select2.css @@ -0,0 +1,481 @@ +.select2-container { + box-sizing: border-box; + display: inline-block; + margin: 0; + position: relative; + vertical-align: middle; } + .select2-container .select2-selection--single { + box-sizing: border-box; + cursor: pointer; + display: block; + height: 28px; + user-select: none; + -webkit-user-select: none; } + .select2-container .select2-selection--single .select2-selection__rendered { + display: block; + padding-left: 8px; + padding-right: 20px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; } + .select2-container .select2-selection--single .select2-selection__clear { + position: relative; } + .select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered { + padding-right: 8px; + padding-left: 20px; } + .select2-container .select2-selection--multiple { + box-sizing: border-box; + cursor: pointer; + display: block; + min-height: 32px; + user-select: none; + -webkit-user-select: none; } + .select2-container .select2-selection--multiple .select2-selection__rendered { + display: inline-block; + overflow: hidden; + padding-left: 8px; + text-overflow: ellipsis; + white-space: nowrap; } + .select2-container .select2-search--inline { + float: left; } + .select2-container .select2-search--inline .select2-search__field { + box-sizing: border-box; + border: none; + font-size: 100%; + margin-top: 5px; + padding: 0; } + .select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button { + -webkit-appearance: none; } + +.select2-dropdown { + background-color: white; + border: 1px solid #aaa; + border-radius: 4px; + box-sizing: border-box; + display: block; + position: absolute; + left: -100000px; + width: 100%; + z-index: 1051; } + +.select2-results { + display: block; } + +.select2-results__options { + list-style: none; + margin: 0; + padding: 0; } + +.select2-results__option { + padding: 6px; + user-select: none; + -webkit-user-select: none; } + .select2-results__option[aria-selected] { + cursor: pointer; } + +.select2-container--open .select2-dropdown { + left: 0; } + +.select2-container--open .select2-dropdown--above { + border-bottom: none; + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; } + +.select2-container--open .select2-dropdown--below { + border-top: none; + border-top-left-radius: 0; + border-top-right-radius: 0; } + +.select2-search--dropdown { + display: block; + padding: 4px; } + .select2-search--dropdown .select2-search__field { + padding: 4px; + width: 100%; + box-sizing: border-box; } + .select2-search--dropdown .select2-search__field::-webkit-search-cancel-button { + -webkit-appearance: none; } + .select2-search--dropdown.select2-search--hide { + display: none; } + +.select2-close-mask { + border: 0; + margin: 0; + padding: 0; + display: block; + position: fixed; + left: 0; + top: 0; + min-height: 100%; + min-width: 100%; + height: auto; + width: auto; + opacity: 0; + z-index: 99; + background-color: #fff; + filter: alpha(opacity=0); } + +.select2-hidden-accessible { + border: 0 !important; + clip: rect(0 0 0 0) !important; + -webkit-clip-path: inset(50%) !important; + clip-path: inset(50%) !important; + height: 1px !important; + overflow: hidden !important; + padding: 0 !important; + position: absolute !important; + width: 1px !important; + white-space: nowrap !important; } + +.select2-container--default .select2-selection--single { + background-color: #fff; + border: 1px solid #aaa; + border-radius: 4px; } + .select2-container--default .select2-selection--single .select2-selection__rendered { + color: #444; + line-height: 28px; } + .select2-container--default .select2-selection--single .select2-selection__clear { + cursor: pointer; + float: right; + font-weight: bold; } + .select2-container--default .select2-selection--single .select2-selection__placeholder { + color: #999; } + .select2-container--default .select2-selection--single .select2-selection__arrow { + height: 26px; + position: absolute; + top: 1px; + right: 1px; + width: 20px; } + .select2-container--default .select2-selection--single .select2-selection__arrow b { + border-color: #888 transparent transparent transparent; + border-style: solid; + border-width: 5px 4px 0 4px; + height: 0; + left: 50%; + margin-left: -4px; + margin-top: -2px; + position: absolute; + top: 50%; + width: 0; } + +.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear { + float: left; } + +.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow { + left: 1px; + right: auto; } + +.select2-container--default.select2-container--disabled .select2-selection--single { + background-color: #eee; + cursor: default; } + .select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear { + display: none; } + +.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b { + border-color: transparent transparent #888 transparent; + border-width: 0 4px 5px 4px; } + +.select2-container--default .select2-selection--multiple { + background-color: white; + border: 1px solid #aaa; + border-radius: 4px; + cursor: text; } + .select2-container--default .select2-selection--multiple .select2-selection__rendered { + box-sizing: border-box; + list-style: none; + margin: 0; + padding: 0 5px; + width: 100%; } + .select2-container--default .select2-selection--multiple .select2-selection__rendered li { + list-style: none; } + .select2-container--default .select2-selection--multiple .select2-selection__clear { + cursor: pointer; + float: right; + font-weight: bold; + margin-top: 5px; + margin-right: 10px; + padding: 1px; } + .select2-container--default .select2-selection--multiple .select2-selection__choice { + background-color: #e4e4e4; + border: 1px solid #aaa; + border-radius: 4px; + cursor: default; + float: left; + margin-right: 5px; + margin-top: 5px; + padding: 0 5px; } + .select2-container--default .select2-selection--multiple .select2-selection__choice__remove { + color: #999; + cursor: pointer; + display: inline-block; + font-weight: bold; + margin-right: 2px; } + .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover { + color: #333; } + +.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline { + float: right; } + +.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice { + margin-left: 5px; + margin-right: auto; } + +.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove { + margin-left: 2px; + margin-right: auto; } + +.select2-container--default.select2-container--focus .select2-selection--multiple { + border: solid black 1px; + outline: 0; } + +.select2-container--default.select2-container--disabled .select2-selection--multiple { + background-color: #eee; + cursor: default; } + +.select2-container--default.select2-container--disabled .select2-selection__choice__remove { + display: none; } + +.select2-container--default.select2-container--open.select2-container--above .select2-selection--single, .select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple { + border-top-left-radius: 0; + border-top-right-radius: 0; } + +.select2-container--default.select2-container--open.select2-container--below .select2-selection--single, .select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple { + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; } + +.select2-container--default .select2-search--dropdown .select2-search__field { + border: 1px solid #aaa; } + +.select2-container--default .select2-search--inline .select2-search__field { + background: transparent; + border: none; + outline: 0; + box-shadow: none; + -webkit-appearance: textfield; } + +.select2-container--default .select2-results > .select2-results__options { + max-height: 200px; + overflow-y: auto; } + +.select2-container--default .select2-results__option[role=group] { + padding: 0; } + +.select2-container--default .select2-results__option[aria-disabled=true] { + color: #999; } + +.select2-container--default .select2-results__option[aria-selected=true] { + background-color: #ddd; } + +.select2-container--default .select2-results__option .select2-results__option { + padding-left: 1em; } + .select2-container--default .select2-results__option .select2-results__option .select2-results__group { + padding-left: 0; } + .select2-container--default .select2-results__option .select2-results__option .select2-results__option { + margin-left: -1em; + padding-left: 2em; } + .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option { + margin-left: -2em; + padding-left: 3em; } + .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option { + margin-left: -3em; + padding-left: 4em; } + .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option { + margin-left: -4em; + padding-left: 5em; } + .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option { + margin-left: -5em; + padding-left: 6em; } + +.select2-container--default .select2-results__option--highlighted[aria-selected] { + background-color: #5897fb; + color: white; } + +.select2-container--default .select2-results__group { + cursor: default; + display: block; + padding: 6px; } + +.select2-container--classic .select2-selection--single { + background-color: #f7f7f7; + border: 1px solid #aaa; + border-radius: 4px; + outline: 0; + background-image: -webkit-linear-gradient(top, white 50%, #eeeeee 100%); + background-image: -o-linear-gradient(top, white 50%, #eeeeee 100%); + background-image: linear-gradient(to bottom, white 50%, #eeeeee 100%); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); } + .select2-container--classic .select2-selection--single:focus { + border: 1px solid #5897fb; } + .select2-container--classic .select2-selection--single .select2-selection__rendered { + color: #444; + line-height: 28px; } + .select2-container--classic .select2-selection--single .select2-selection__clear { + cursor: pointer; + float: right; + font-weight: bold; + margin-right: 10px; } + .select2-container--classic .select2-selection--single .select2-selection__placeholder { + color: #999; } + .select2-container--classic .select2-selection--single .select2-selection__arrow { + background-color: #ddd; + border: none; + border-left: 1px solid #aaa; + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; + height: 26px; + position: absolute; + top: 1px; + right: 1px; + width: 20px; + background-image: -webkit-linear-gradient(top, #eeeeee 50%, #cccccc 100%); + background-image: -o-linear-gradient(top, #eeeeee 50%, #cccccc 100%); + background-image: linear-gradient(to bottom, #eeeeee 50%, #cccccc 100%); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0); } + .select2-container--classic .select2-selection--single .select2-selection__arrow b { + border-color: #888 transparent transparent transparent; + border-style: solid; + border-width: 5px 4px 0 4px; + height: 0; + left: 50%; + margin-left: -4px; + margin-top: -2px; + position: absolute; + top: 50%; + width: 0; } + +.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear { + float: left; } + +.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow { + border: none; + border-right: 1px solid #aaa; + border-radius: 0; + border-top-left-radius: 4px; + border-bottom-left-radius: 4px; + left: 1px; + right: auto; } + +.select2-container--classic.select2-container--open .select2-selection--single { + border: 1px solid #5897fb; } + .select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow { + background: transparent; + border: none; } + .select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b { + border-color: transparent transparent #888 transparent; + border-width: 0 4px 5px 4px; } + +.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single { + border-top: none; + border-top-left-radius: 0; + border-top-right-radius: 0; + background-image: -webkit-linear-gradient(top, white 0%, #eeeeee 50%); + background-image: -o-linear-gradient(top, white 0%, #eeeeee 50%); + background-image: linear-gradient(to bottom, white 0%, #eeeeee 50%); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); } + +.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single { + border-bottom: none; + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; + background-image: -webkit-linear-gradient(top, #eeeeee 50%, white 100%); + background-image: -o-linear-gradient(top, #eeeeee 50%, white 100%); + background-image: linear-gradient(to bottom, #eeeeee 50%, white 100%); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0); } + +.select2-container--classic .select2-selection--multiple { + background-color: white; + border: 1px solid #aaa; + border-radius: 4px; + cursor: text; + outline: 0; } + .select2-container--classic .select2-selection--multiple:focus { + border: 1px solid #5897fb; } + .select2-container--classic .select2-selection--multiple .select2-selection__rendered { + list-style: none; + margin: 0; + padding: 0 5px; } + .select2-container--classic .select2-selection--multiple .select2-selection__clear { + display: none; } + .select2-container--classic .select2-selection--multiple .select2-selection__choice { + background-color: #e4e4e4; + border: 1px solid #aaa; + border-radius: 4px; + cursor: default; + float: left; + margin-right: 5px; + margin-top: 5px; + padding: 0 5px; } + .select2-container--classic .select2-selection--multiple .select2-selection__choice__remove { + color: #888; + cursor: pointer; + display: inline-block; + font-weight: bold; + margin-right: 2px; } + .select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover { + color: #555; } + +.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice { + float: right; + margin-left: 5px; + margin-right: auto; } + +.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove { + margin-left: 2px; + margin-right: auto; } + +.select2-container--classic.select2-container--open .select2-selection--multiple { + border: 1px solid #5897fb; } + +.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple { + border-top: none; + border-top-left-radius: 0; + border-top-right-radius: 0; } + +.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple { + border-bottom: none; + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; } + +.select2-container--classic .select2-search--dropdown .select2-search__field { + border: 1px solid #aaa; + outline: 0; } + +.select2-container--classic .select2-search--inline .select2-search__field { + outline: 0; + box-shadow: none; } + +.select2-container--classic .select2-dropdown { + background-color: white; + border: 1px solid transparent; } + +.select2-container--classic .select2-dropdown--above { + border-bottom: none; } + +.select2-container--classic .select2-dropdown--below { + border-top: none; } + +.select2-container--classic .select2-results > .select2-results__options { + max-height: 200px; + overflow-y: auto; } + +.select2-container--classic .select2-results__option[role=group] { + padding: 0; } + +.select2-container--classic .select2-results__option[aria-disabled=true] { + color: grey; } + +.select2-container--classic .select2-results__option--highlighted[aria-selected] { + background-color: #3875d7; + color: white; } + +.select2-container--classic .select2-results__group { + cursor: default; + display: block; + padding: 6px; } + +.select2-container--classic.select2-container--open .select2-dropdown { + border-color: #5897fb; } diff --git a/static_common/common/vendor/select2/select2.js b/static_common/common/vendor/select2/select2.js new file mode 100644 index 00000000..fcfb5ab4 --- /dev/null +++ b/static_common/common/vendor/select2/select2.js @@ -0,0 +1,6108 @@ +/*! + * Select2 4.0.13 + * https://select2.github.io + * + * Released under the MIT license + * https://github.com/select2/select2/blob/master/LICENSE.md + */ +;(function (factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['jquery'], factory); + } else if (typeof module === 'object' && module.exports) { + // Node/CommonJS + module.exports = function (root, jQuery) { + if (jQuery === undefined) { + // require('jQuery') returns a factory that requires window to + // build a jQuery instance, we normalize how we use modules + // that require this pattern but the window provided is a noop + // if it's defined (how jquery works) + if (typeof window !== 'undefined') { + jQuery = require('jquery'); + } + else { + jQuery = require('jquery')(root); + } + } + factory(jQuery); + return jQuery; + }; + } else { + // Browser globals + factory(jQuery); + } +} (function (jQuery) { + // This is needed so we can catch the AMD loader configuration and use it + // The inner file should be wrapped (by `banner.start.js`) in a function that + // returns the AMD loader references. + var S2 =(function () { + // Restore the Select2 AMD loader so it can be used + // Needed mostly in the language files, where the loader is not inserted + if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) { + var S2 = jQuery.fn.select2.amd; + } +var S2;(function () { if (!S2 || !S2.requirejs) { +if (!S2) { S2 = {}; } else { require = S2; } +/** + * @license almond 0.3.3 Copyright jQuery Foundation and other contributors. + * Released under MIT license, http://github.com/requirejs/almond/LICENSE + */ +//Going sloppy to avoid 'use strict' string cost, but strict practices should +//be followed. +/*global setTimeout: false */ + +var requirejs, require, define; +(function (undef) { + var main, req, makeMap, handlers, + defined = {}, + waiting = {}, + config = {}, + defining = {}, + hasOwn = Object.prototype.hasOwnProperty, + aps = [].slice, + jsSuffixRegExp = /\.js$/; + + function hasProp(obj, prop) { + return hasOwn.call(obj, prop); + } + + /** + * Given a relative module name, like ./something, normalize it to + * a real name that can be mapped to a path. + * @param {String} name the relative name + * @param {String} baseName a real name that the name arg is relative + * to. + * @returns {String} normalized name + */ + function normalize(name, baseName) { + var nameParts, nameSegment, mapValue, foundMap, lastIndex, + foundI, foundStarMap, starI, i, j, part, normalizedBaseParts, + baseParts = baseName && baseName.split("/"), + map = config.map, + starMap = (map && map['*']) || {}; + + //Adjust any relative paths. + if (name) { + name = name.split('/'); + lastIndex = name.length - 1; + + // If wanting node ID compatibility, strip .js from end + // of IDs. Have to do this here, and not in nameToUrl + // because node allows either .js or non .js to map + // to same file. + if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) { + name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, ''); + } + + // Starts with a '.' so need the baseName + if (name[0].charAt(0) === '.' && baseParts) { + //Convert baseName to array, and lop off the last part, + //so that . matches that 'directory' and not name of the baseName's + //module. For instance, baseName of 'one/two/three', maps to + //'one/two/three.js', but we want the directory, 'one/two' for + //this normalization. + normalizedBaseParts = baseParts.slice(0, baseParts.length - 1); + name = normalizedBaseParts.concat(name); + } + + //start trimDots + for (i = 0; i < name.length; i++) { + part = name[i]; + if (part === '.') { + name.splice(i, 1); + i -= 1; + } else if (part === '..') { + // If at the start, or previous value is still .., + // keep them so that when converted to a path it may + // still work when converted to a path, even though + // as an ID it is less than ideal. In larger point + // releases, may be better to just kick out an error. + if (i === 0 || (i === 1 && name[2] === '..') || name[i - 1] === '..') { + continue; + } else if (i > 0) { + name.splice(i - 1, 2); + i -= 2; + } + } + } + //end trimDots + + name = name.join('/'); + } + + //Apply map config if available. + if ((baseParts || starMap) && map) { + nameParts = name.split('/'); + + for (i = nameParts.length; i > 0; i -= 1) { + nameSegment = nameParts.slice(0, i).join("/"); + + if (baseParts) { + //Find the longest baseName segment match in the config. + //So, do joins on the biggest to smallest lengths of baseParts. + for (j = baseParts.length; j > 0; j -= 1) { + mapValue = map[baseParts.slice(0, j).join('/')]; + + //baseName segment has config, find if it has one for + //this name. + if (mapValue) { + mapValue = mapValue[nameSegment]; + if (mapValue) { + //Match, update name to the new value. + foundMap = mapValue; + foundI = i; + break; + } + } + } + } + + if (foundMap) { + break; + } + + //Check for a star map match, but just hold on to it, + //if there is a shorter segment match later in a matching + //config, then favor over this star map. + if (!foundStarMap && starMap && starMap[nameSegment]) { + foundStarMap = starMap[nameSegment]; + starI = i; + } + } + + if (!foundMap && foundStarMap) { + foundMap = foundStarMap; + foundI = starI; + } + + if (foundMap) { + nameParts.splice(0, foundI, foundMap); + name = nameParts.join('/'); + } + } + + return name; + } + + function makeRequire(relName, forceSync) { + return function () { + //A version of a require function that passes a moduleName + //value for items that may need to + //look up paths relative to the moduleName + var args = aps.call(arguments, 0); + + //If first arg is not require('string'), and there is only + //one arg, it is the array form without a callback. Insert + //a null so that the following concat is correct. + if (typeof args[0] !== 'string' && args.length === 1) { + args.push(null); + } + return req.apply(undef, args.concat([relName, forceSync])); + }; + } + + function makeNormalize(relName) { + return function (name) { + return normalize(name, relName); + }; + } + + function makeLoad(depName) { + return function (value) { + defined[depName] = value; + }; + } + + function callDep(name) { + if (hasProp(waiting, name)) { + var args = waiting[name]; + delete waiting[name]; + defining[name] = true; + main.apply(undef, args); + } + + if (!hasProp(defined, name) && !hasProp(defining, name)) { + throw new Error('No ' + name); + } + return defined[name]; + } + + //Turns a plugin!resource to [plugin, resource] + //with the plugin being undefined if the name + //did not have a plugin prefix. + function splitPrefix(name) { + var prefix, + index = name ? name.indexOf('!') : -1; + if (index > -1) { + prefix = name.substring(0, index); + name = name.substring(index + 1, name.length); + } + return [prefix, name]; + } + + //Creates a parts array for a relName where first part is plugin ID, + //second part is resource ID. Assumes relName has already been normalized. + function makeRelParts(relName) { + return relName ? splitPrefix(relName) : []; + } + + /** + * Makes a name map, normalizing the name, and using a plugin + * for normalization if necessary. Grabs a ref to plugin + * too, as an optimization. + */ + makeMap = function (name, relParts) { + var plugin, + parts = splitPrefix(name), + prefix = parts[0], + relResourceName = relParts[1]; + + name = parts[1]; + + if (prefix) { + prefix = normalize(prefix, relResourceName); + plugin = callDep(prefix); + } + + //Normalize according + if (prefix) { + if (plugin && plugin.normalize) { + name = plugin.normalize(name, makeNormalize(relResourceName)); + } else { + name = normalize(name, relResourceName); + } + } else { + name = normalize(name, relResourceName); + parts = splitPrefix(name); + prefix = parts[0]; + name = parts[1]; + if (prefix) { + plugin = callDep(prefix); + } + } + + //Using ridiculous property names for space reasons + return { + f: prefix ? prefix + '!' + name : name, //fullName + n: name, + pr: prefix, + p: plugin + }; + }; + + function makeConfig(name) { + return function () { + return (config && config.config && config.config[name]) || {}; + }; + } + + handlers = { + require: function (name) { + return makeRequire(name); + }, + exports: function (name) { + var e = defined[name]; + if (typeof e !== 'undefined') { + return e; + } else { + return (defined[name] = {}); + } + }, + module: function (name) { + return { + id: name, + uri: '', + exports: defined[name], + config: makeConfig(name) + }; + } + }; + + main = function (name, deps, callback, relName) { + var cjsModule, depName, ret, map, i, relParts, + args = [], + callbackType = typeof callback, + usingExports; + + //Use name if no relName + relName = relName || name; + relParts = makeRelParts(relName); + + //Call the callback to define the module, if necessary. + if (callbackType === 'undefined' || callbackType === 'function') { + //Pull out the defined dependencies and pass the ordered + //values to the callback. + //Default to [require, exports, module] if no deps + deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps; + for (i = 0; i < deps.length; i += 1) { + map = makeMap(deps[i], relParts); + depName = map.f; + + //Fast path CommonJS standard dependencies. + if (depName === "require") { + args[i] = handlers.require(name); + } else if (depName === "exports") { + //CommonJS module spec 1.1 + args[i] = handlers.exports(name); + usingExports = true; + } else if (depName === "module") { + //CommonJS module spec 1.1 + cjsModule = args[i] = handlers.module(name); + } else if (hasProp(defined, depName) || + hasProp(waiting, depName) || + hasProp(defining, depName)) { + args[i] = callDep(depName); + } else if (map.p) { + map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {}); + args[i] = defined[depName]; + } else { + throw new Error(name + ' missing ' + depName); + } + } + + ret = callback ? callback.apply(defined[name], args) : undefined; + + if (name) { + //If setting exports via "module" is in play, + //favor that over return value and exports. After that, + //favor a non-undefined return value over exports use. + if (cjsModule && cjsModule.exports !== undef && + cjsModule.exports !== defined[name]) { + defined[name] = cjsModule.exports; + } else if (ret !== undef || !usingExports) { + //Use the return value from the function. + defined[name] = ret; + } + } + } else if (name) { + //May just be an object definition for the module. Only + //worry about defining if have a module name. + defined[name] = callback; + } + }; + + requirejs = require = req = function (deps, callback, relName, forceSync, alt) { + if (typeof deps === "string") { + if (handlers[deps]) { + //callback in this case is really relName + return handlers[deps](callback); + } + //Just return the module wanted. In this scenario, the + //deps arg is the module name, and second arg (if passed) + //is just the relName. + //Normalize module name, if it contains . or .. + return callDep(makeMap(deps, makeRelParts(callback)).f); + } else if (!deps.splice) { + //deps is a config object, not an array. + config = deps; + if (config.deps) { + req(config.deps, config.callback); + } + if (!callback) { + return; + } + + if (callback.splice) { + //callback is an array, which means it is a dependency list. + //Adjust args if there are dependencies + deps = callback; + callback = relName; + relName = null; + } else { + deps = undef; + } + } + + //Support require(['a']) + callback = callback || function () {}; + + //If relName is a function, it is an errback handler, + //so remove it. + if (typeof relName === 'function') { + relName = forceSync; + forceSync = alt; + } + + //Simulate async callback; + if (forceSync) { + main(undef, deps, callback, relName); + } else { + //Using a non-zero value because of concern for what old browsers + //do, and latest browsers "upgrade" to 4 if lower value is used: + //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout: + //If want a value immediately, use require('id') instead -- something + //that works in almond on the global level, but not guaranteed and + //unlikely to work in other AMD implementations. + setTimeout(function () { + main(undef, deps, callback, relName); + }, 4); + } + + return req; + }; + + /** + * Just drops the config on the floor, but returns req in case + * the config return value is used. + */ + req.config = function (cfg) { + return req(cfg); + }; + + /** + * Expose module registry for debugging and tooling + */ + requirejs._defined = defined; + + define = function (name, deps, callback) { + if (typeof name !== 'string') { + throw new Error('See almond README: incorrect module build, no module name'); + } + + //This module may not have dependencies + if (!deps.splice) { + //deps is not an array, so probably means + //an object literal or factory function for + //the value. Adjust args. + callback = deps; + deps = []; + } + + if (!hasProp(defined, name) && !hasProp(waiting, name)) { + waiting[name] = [name, deps, callback]; + } + }; + + define.amd = { + jQuery: true + }; +}()); + +S2.requirejs = requirejs;S2.require = require;S2.define = define; +} +}()); +S2.define("almond", function(){}); + +/* global jQuery:false, $:false */ +S2.define('jquery',[],function () { + var _$ = jQuery || $; + + if (_$ == null && console && console.error) { + console.error( + 'Select2: An instance of jQuery or a jQuery-compatible library was not ' + + 'found. Make sure that you are including jQuery before Select2 on your ' + + 'web page.' + ); + } + + return _$; +}); + +S2.define('select2/utils',[ + 'jquery' +], function ($) { + var Utils = {}; + + Utils.Extend = function (ChildClass, SuperClass) { + var __hasProp = {}.hasOwnProperty; + + function BaseConstructor () { + this.constructor = ChildClass; + } + + for (var key in SuperClass) { + if (__hasProp.call(SuperClass, key)) { + ChildClass[key] = SuperClass[key]; + } + } + + BaseConstructor.prototype = SuperClass.prototype; + ChildClass.prototype = new BaseConstructor(); + ChildClass.__super__ = SuperClass.prototype; + + return ChildClass; + }; + + function getMethods (theClass) { + var proto = theClass.prototype; + + var methods = []; + + for (var methodName in proto) { + var m = proto[methodName]; + + if (typeof m !== 'function') { + continue; + } + + if (methodName === 'constructor') { + continue; + } + + methods.push(methodName); + } + + return methods; + } + + Utils.Decorate = function (SuperClass, DecoratorClass) { + var decoratedMethods = getMethods(DecoratorClass); + var superMethods = getMethods(SuperClass); + + function DecoratedClass () { + var unshift = Array.prototype.unshift; + + var argCount = DecoratorClass.prototype.constructor.length; + + var calledConstructor = SuperClass.prototype.constructor; + + if (argCount > 0) { + unshift.call(arguments, SuperClass.prototype.constructor); + + calledConstructor = DecoratorClass.prototype.constructor; + } + + calledConstructor.apply(this, arguments); + } + + DecoratorClass.displayName = SuperClass.displayName; + + function ctr () { + this.constructor = DecoratedClass; + } + + DecoratedClass.prototype = new ctr(); + + for (var m = 0; m < superMethods.length; m++) { + var superMethod = superMethods[m]; + + DecoratedClass.prototype[superMethod] = + SuperClass.prototype[superMethod]; + } + + var calledMethod = function (methodName) { + // Stub out the original method if it's not decorating an actual method + var originalMethod = function () {}; + + if (methodName in DecoratedClass.prototype) { + originalMethod = DecoratedClass.prototype[methodName]; + } + + var decoratedMethod = DecoratorClass.prototype[methodName]; + + return function () { + var unshift = Array.prototype.unshift; + + unshift.call(arguments, originalMethod); + + return decoratedMethod.apply(this, arguments); + }; + }; + + for (var d = 0; d < decoratedMethods.length; d++) { + var decoratedMethod = decoratedMethods[d]; + + DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod); + } + + return DecoratedClass; + }; + + var Observable = function () { + this.listeners = {}; + }; + + Observable.prototype.on = function (event, callback) { + this.listeners = this.listeners || {}; + + if (event in this.listeners) { + this.listeners[event].push(callback); + } else { + this.listeners[event] = [callback]; + } + }; + + Observable.prototype.trigger = function (event) { + var slice = Array.prototype.slice; + var params = slice.call(arguments, 1); + + this.listeners = this.listeners || {}; + + // Params should always come in as an array + if (params == null) { + params = []; + } + + // If there are no arguments to the event, use a temporary object + if (params.length === 0) { + params.push({}); + } + + // Set the `_type` of the first object to the event + params[0]._type = event; + + if (event in this.listeners) { + this.invoke(this.listeners[event], slice.call(arguments, 1)); + } + + if ('*' in this.listeners) { + this.invoke(this.listeners['*'], arguments); + } + }; + + Observable.prototype.invoke = function (listeners, params) { + for (var i = 0, len = listeners.length; i < len; i++) { + listeners[i].apply(this, params); + } + }; + + Utils.Observable = Observable; + + Utils.generateChars = function (length) { + var chars = ''; + + for (var i = 0; i < length; i++) { + var randomChar = Math.floor(Math.random() * 36); + chars += randomChar.toString(36); + } + + return chars; + }; + + Utils.bind = function (func, context) { + return function () { + func.apply(context, arguments); + }; + }; + + Utils._convertData = function (data) { + for (var originalKey in data) { + var keys = originalKey.split('-'); + + var dataLevel = data; + + if (keys.length === 1) { + continue; + } + + for (var k = 0; k < keys.length; k++) { + var key = keys[k]; + + // Lowercase the first letter + // By default, dash-separated becomes camelCase + key = key.substring(0, 1).toLowerCase() + key.substring(1); + + if (!(key in dataLevel)) { + dataLevel[key] = {}; + } + + if (k == keys.length - 1) { + dataLevel[key] = data[originalKey]; + } + + dataLevel = dataLevel[key]; + } + + delete data[originalKey]; + } + + return data; + }; + + Utils.hasScroll = function (index, el) { + // Adapted from the function created by @ShadowScripter + // and adapted by @BillBarry on the Stack Exchange Code Review website. + // The original code can be found at + // http://codereview.stackexchange.com/q/13338 + // and was designed to be used with the Sizzle selector engine. + + var $el = $(el); + var overflowX = el.style.overflowX; + var overflowY = el.style.overflowY; + + //Check both x and y declarations + if (overflowX === overflowY && + (overflowY === 'hidden' || overflowY === 'visible')) { + return false; + } + + if (overflowX === 'scroll' || overflowY === 'scroll') { + return true; + } + + return ($el.innerHeight() < el.scrollHeight || + $el.innerWidth() < el.scrollWidth); + }; + + Utils.escapeMarkup = function (markup) { + var replaceMap = { + '\\': '\', + '&': '&', + '<': '<', + '>': '>', + '"': '"', + '\'': ''', + '/': '/' + }; + + // Do not try to escape the markup if it's not a string + if (typeof markup !== 'string') { + return markup; + } + + return String(markup).replace(/[&<>"'\/\\]/g, function (match) { + return replaceMap[match]; + }); + }; + + // Append an array of jQuery nodes to a given element. + Utils.appendMany = function ($element, $nodes) { + // jQuery 1.7.x does not support $.fn.append() with an array + // Fall back to a jQuery object collection using $.fn.add() + if ($.fn.jquery.substr(0, 3) === '1.7') { + var $jqNodes = $(); + + $.map($nodes, function (node) { + $jqNodes = $jqNodes.add(node); + }); + + $nodes = $jqNodes; + } + + $element.append($nodes); + }; + + // Cache objects in Utils.__cache instead of $.data (see #4346) + Utils.__cache = {}; + + var id = 0; + Utils.GetUniqueElementId = function (element) { + // Get a unique element Id. If element has no id, + // creates a new unique number, stores it in the id + // attribute and returns the new id. + // If an id already exists, it simply returns it. + + var select2Id = element.getAttribute('data-select2-id'); + if (select2Id == null) { + // If element has id, use it. + if (element.id) { + select2Id = element.id; + element.setAttribute('data-select2-id', select2Id); + } else { + element.setAttribute('data-select2-id', ++id); + select2Id = id.toString(); + } + } + return select2Id; + }; + + Utils.StoreData = function (element, name, value) { + // Stores an item in the cache for a specified element. + // name is the cache key. + var id = Utils.GetUniqueElementId(element); + if (!Utils.__cache[id]) { + Utils.__cache[id] = {}; + } + + Utils.__cache[id][name] = value; + }; + + Utils.GetData = function (element, name) { + // Retrieves a value from the cache by its key (name) + // name is optional. If no name specified, return + // all cache items for the specified element. + // and for a specified element. + var id = Utils.GetUniqueElementId(element); + if (name) { + if (Utils.__cache[id]) { + if (Utils.__cache[id][name] != null) { + return Utils.__cache[id][name]; + } + return $(element).data(name); // Fallback to HTML5 data attribs. + } + return $(element).data(name); // Fallback to HTML5 data attribs. + } else { + return Utils.__cache[id]; + } + }; + + Utils.RemoveData = function (element) { + // Removes all cached items for a specified element. + var id = Utils.GetUniqueElementId(element); + if (Utils.__cache[id] != null) { + delete Utils.__cache[id]; + } + + element.removeAttribute('data-select2-id'); + }; + + return Utils; +}); + +S2.define('select2/results',[ + 'jquery', + './utils' +], function ($, Utils) { + function Results ($element, options, dataAdapter) { + this.$element = $element; + this.data = dataAdapter; + this.options = options; + + Results.__super__.constructor.call(this); + } + + Utils.Extend(Results, Utils.Observable); + + Results.prototype.render = function () { + var $results = $( + '<ul class="select2-results__options" role="listbox"></ul>' + ); + + if (this.options.get('multiple')) { + $results.attr('aria-multiselectable', 'true'); + } + + this.$results = $results; + + return $results; + }; + + Results.prototype.clear = function () { + this.$results.empty(); + }; + + Results.prototype.displayMessage = function (params) { + var escapeMarkup = this.options.get('escapeMarkup'); + + this.clear(); + this.hideLoading(); + + var $message = $( + '<li role="alert" aria-live="assertive"' + + ' class="select2-results__option"></li>' + ); + + var message = this.options.get('translations').get(params.message); + + $message.append( + escapeMarkup( + message(params.args) + ) + ); + + $message[0].className += ' select2-results__message'; + + this.$results.append($message); + }; + + Results.prototype.hideMessages = function () { + this.$results.find('.select2-results__message').remove(); + }; + + Results.prototype.append = function (data) { + this.hideLoading(); + + var $options = []; + + if (data.results == null || data.results.length === 0) { + if (this.$results.children().length === 0) { + this.trigger('results:message', { + message: 'noResults' + }); + } + + return; + } + + data.results = this.sort(data.results); + + for (var d = 0; d < data.results.length; d++) { + var item = data.results[d]; + + var $option = this.option(item); + + $options.push($option); + } + + this.$results.append($options); + }; + + Results.prototype.position = function ($results, $dropdown) { + var $resultsContainer = $dropdown.find('.select2-results'); + $resultsContainer.append($results); + }; + + Results.prototype.sort = function (data) { + var sorter = this.options.get('sorter'); + + return sorter(data); + }; + + Results.prototype.highlightFirstItem = function () { + var $options = this.$results + .find('.select2-results__option[aria-selected]'); + + var $selected = $options.filter('[aria-selected=true]'); + + // Check if there are any selected options + if ($selected.length > 0) { + // If there are selected options, highlight the first + $selected.first().trigger('mouseenter'); + } else { + // If there are no selected options, highlight the first option + // in the dropdown + $options.first().trigger('mouseenter'); + } + + this.ensureHighlightVisible(); + }; + + Results.prototype.setClasses = function () { + var self = this; + + this.data.current(function (selected) { + var selectedIds = $.map(selected, function (s) { + return s.id.toString(); + }); + + var $options = self.$results + .find('.select2-results__option[aria-selected]'); + + $options.each(function () { + var $option = $(this); + + var item = Utils.GetData(this, 'data'); + + // id needs to be converted to a string when comparing + var id = '' + item.id; + + if ((item.element != null && item.element.selected) || + (item.element == null && $.inArray(id, selectedIds) > -1)) { + $option.attr('aria-selected', 'true'); + } else { + $option.attr('aria-selected', 'false'); + } + }); + + }); + }; + + Results.prototype.showLoading = function (params) { + this.hideLoading(); + + var loadingMore = this.options.get('translations').get('searching'); + + var loading = { + disabled: true, + loading: true, + text: loadingMore(params) + }; + var $loading = this.option(loading); + $loading.className += ' loading-results'; + + this.$results.prepend($loading); + }; + + Results.prototype.hideLoading = function () { + this.$results.find('.loading-results').remove(); + }; + + Results.prototype.option = function (data) { + var option = document.createElement('li'); + option.className = 'select2-results__option'; + + var attrs = { + 'role': 'option', + 'aria-selected': 'false' + }; + + var matches = window.Element.prototype.matches || + window.Element.prototype.msMatchesSelector || + window.Element.prototype.webkitMatchesSelector; + + if ((data.element != null && matches.call(data.element, ':disabled')) || + (data.element == null && data.disabled)) { + delete attrs['aria-selected']; + attrs['aria-disabled'] = 'true'; + } + + if (data.id == null) { + delete attrs['aria-selected']; + } + + if (data._resultId != null) { + option.id = data._resultId; + } + + if (data.title) { + option.title = data.title; + } + + if (data.children) { + attrs.role = 'group'; + attrs['aria-label'] = data.text; + delete attrs['aria-selected']; + } + + for (var attr in attrs) { + var val = attrs[attr]; + + option.setAttribute(attr, val); + } + + if (data.children) { + var $option = $(option); + + var label = document.createElement('strong'); + label.className = 'select2-results__group'; + + var $label = $(label); + this.template(data, label); + + var $children = []; + + for (var c = 0; c < data.children.length; c++) { + var child = data.children[c]; + + var $child = this.option(child); + + $children.push($child); + } + + var $childrenContainer = $('<ul></ul>', { + 'class': 'select2-results__options select2-results__options--nested' + }); + + $childrenContainer.append($children); + + $option.append(label); + $option.append($childrenContainer); + } else { + this.template(data, option); + } + + Utils.StoreData(option, 'data', data); + + return option; + }; + + Results.prototype.bind = function (container, $container) { + var self = this; + + var id = container.id + '-results'; + + this.$results.attr('id', id); + + container.on('results:all', function (params) { + self.clear(); + self.append(params.data); + + if (container.isOpen()) { + self.setClasses(); + self.highlightFirstItem(); + } + }); + + container.on('results:append', function (params) { + self.append(params.data); + + if (container.isOpen()) { + self.setClasses(); + } + }); + + container.on('query', function (params) { + self.hideMessages(); + self.showLoading(params); + }); + + container.on('select', function () { + if (!container.isOpen()) { + return; + } + + self.setClasses(); + + if (self.options.get('scrollAfterSelect')) { + self.highlightFirstItem(); + } + }); + + container.on('unselect', function () { + if (!container.isOpen()) { + return; + } + + self.setClasses(); + + if (self.options.get('scrollAfterSelect')) { + self.highlightFirstItem(); + } + }); + + container.on('open', function () { + // When the dropdown is open, aria-expended="true" + self.$results.attr('aria-expanded', 'true'); + self.$results.attr('aria-hidden', 'false'); + + self.setClasses(); + self.ensureHighlightVisible(); + }); + + container.on('close', function () { + // When the dropdown is closed, aria-expended="false" + self.$results.attr('aria-expanded', 'false'); + self.$results.attr('aria-hidden', 'true'); + self.$results.removeAttr('aria-activedescendant'); + }); + + container.on('results:toggle', function () { + var $highlighted = self.getHighlightedResults(); + + if ($highlighted.length === 0) { + return; + } + + $highlighted.trigger('mouseup'); + }); + + container.on('results:select', function () { + var $highlighted = self.getHighlightedResults(); + + if ($highlighted.length === 0) { + return; + } + + var data = Utils.GetData($highlighted[0], 'data'); + + if ($highlighted.attr('aria-selected') == 'true') { + self.trigger('close', {}); + } else { + self.trigger('select', { + data: data + }); + } + }); + + container.on('results:previous', function () { + var $highlighted = self.getHighlightedResults(); + + var $options = self.$results.find('[aria-selected]'); + + var currentIndex = $options.index($highlighted); + + // If we are already at the top, don't move further + // If no options, currentIndex will be -1 + if (currentIndex <= 0) { + return; + } + + var nextIndex = currentIndex - 1; + + // If none are highlighted, highlight the first + if ($highlighted.length === 0) { + nextIndex = 0; + } + + var $next = $options.eq(nextIndex); + + $next.trigger('mouseenter'); + + var currentOffset = self.$results.offset().top; + var nextTop = $next.offset().top; + var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset); + + if (nextIndex === 0) { + self.$results.scrollTop(0); + } else if (nextTop - currentOffset < 0) { + self.$results.scrollTop(nextOffset); + } + }); + + container.on('results:next', function () { + var $highlighted = self.getHighlightedResults(); + + var $options = self.$results.find('[aria-selected]'); + + var currentIndex = $options.index($highlighted); + + var nextIndex = currentIndex + 1; + + // If we are at the last option, stay there + if (nextIndex >= $options.length) { + return; + } + + var $next = $options.eq(nextIndex); + + $next.trigger('mouseenter'); + + var currentOffset = self.$results.offset().top + + self.$results.outerHeight(false); + var nextBottom = $next.offset().top + $next.outerHeight(false); + var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset; + + if (nextIndex === 0) { + self.$results.scrollTop(0); + } else if (nextBottom > currentOffset) { + self.$results.scrollTop(nextOffset); + } + }); + + container.on('results:focus', function (params) { + params.element.addClass('select2-results__option--highlighted'); + }); + + container.on('results:message', function (params) { + self.displayMessage(params); + }); + + if ($.fn.mousewheel) { + this.$results.on('mousewheel', function (e) { + var top = self.$results.scrollTop(); + + var bottom = self.$results.get(0).scrollHeight - top + e.deltaY; + + var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0; + var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height(); + + if (isAtTop) { + self.$results.scrollTop(0); + + e.preventDefault(); + e.stopPropagation(); + } else if (isAtBottom) { + self.$results.scrollTop( + self.$results.get(0).scrollHeight - self.$results.height() + ); + + e.preventDefault(); + e.stopPropagation(); + } + }); + } + + this.$results.on('mouseup', '.select2-results__option[aria-selected]', + function (evt) { + var $this = $(this); + + var data = Utils.GetData(this, 'data'); + + if ($this.attr('aria-selected') === 'true') { + if (self.options.get('multiple')) { + self.trigger('unselect', { + originalEvent: evt, + data: data + }); + } else { + self.trigger('close', {}); + } + + return; + } + + self.trigger('select', { + originalEvent: evt, + data: data + }); + }); + + this.$results.on('mouseenter', '.select2-results__option[aria-selected]', + function (evt) { + var data = Utils.GetData(this, 'data'); + + self.getHighlightedResults() + .removeClass('select2-results__option--highlighted'); + + self.trigger('results:focus', { + data: data, + element: $(this) + }); + }); + }; + + Results.prototype.getHighlightedResults = function () { + var $highlighted = this.$results + .find('.select2-results__option--highlighted'); + + return $highlighted; + }; + + Results.prototype.destroy = function () { + this.$results.remove(); + }; + + Results.prototype.ensureHighlightVisible = function () { + var $highlighted = this.getHighlightedResults(); + + if ($highlighted.length === 0) { + return; + } + + var $options = this.$results.find('[aria-selected]'); + + var currentIndex = $options.index($highlighted); + + var currentOffset = this.$results.offset().top; + var nextTop = $highlighted.offset().top; + var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset); + + var offsetDelta = nextTop - currentOffset; + nextOffset -= $highlighted.outerHeight(false) * 2; + + if (currentIndex <= 2) { + this.$results.scrollTop(0); + } else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) { + this.$results.scrollTop(nextOffset); + } + }; + + Results.prototype.template = function (result, container) { + var template = this.options.get('templateResult'); + var escapeMarkup = this.options.get('escapeMarkup'); + + var content = template(result, container); + + if (content == null) { + container.style.display = 'none'; + } else if (typeof content === 'string') { + container.innerHTML = escapeMarkup(content); + } else { + $(container).append(content); + } + }; + + return Results; +}); + +S2.define('select2/keys',[ + +], function () { + var KEYS = { + BACKSPACE: 8, + TAB: 9, + ENTER: 13, + SHIFT: 16, + CTRL: 17, + ALT: 18, + ESC: 27, + SPACE: 32, + PAGE_UP: 33, + PAGE_DOWN: 34, + END: 35, + HOME: 36, + LEFT: 37, + UP: 38, + RIGHT: 39, + DOWN: 40, + DELETE: 46 + }; + + return KEYS; +}); + +S2.define('select2/selection/base',[ + 'jquery', + '../utils', + '../keys' +], function ($, Utils, KEYS) { + function BaseSelection ($element, options) { + this.$element = $element; + this.options = options; + + BaseSelection.__super__.constructor.call(this); + } + + Utils.Extend(BaseSelection, Utils.Observable); + + BaseSelection.prototype.render = function () { + var $selection = $( + '<span class="select2-selection" role="combobox" ' + + ' aria-haspopup="true" aria-expanded="false">' + + '</span>' + ); + + this._tabindex = 0; + + if (Utils.GetData(this.$element[0], 'old-tabindex') != null) { + this._tabindex = Utils.GetData(this.$element[0], 'old-tabindex'); + } else if (this.$element.attr('tabindex') != null) { + this._tabindex = this.$element.attr('tabindex'); + } + + $selection.attr('title', this.$element.attr('title')); + $selection.attr('tabindex', this._tabindex); + $selection.attr('aria-disabled', 'false'); + + this.$selection = $selection; + + return $selection; + }; + + BaseSelection.prototype.bind = function (container, $container) { + var self = this; + + var resultsId = container.id + '-results'; + + this.container = container; + + this.$selection.on('focus', function (evt) { + self.trigger('focus', evt); + }); + + this.$selection.on('blur', function (evt) { + self._handleBlur(evt); + }); + + this.$selection.on('keydown', function (evt) { + self.trigger('keypress', evt); + + if (evt.which === KEYS.SPACE) { + evt.preventDefault(); + } + }); + + container.on('results:focus', function (params) { + self.$selection.attr('aria-activedescendant', params.data._resultId); + }); + + container.on('selection:update', function (params) { + self.update(params.data); + }); + + container.on('open', function () { + // When the dropdown is open, aria-expanded="true" + self.$selection.attr('aria-expanded', 'true'); + self.$selection.attr('aria-owns', resultsId); + + self._attachCloseHandler(container); + }); + + container.on('close', function () { + // When the dropdown is closed, aria-expanded="false" + self.$selection.attr('aria-expanded', 'false'); + self.$selection.removeAttr('aria-activedescendant'); + self.$selection.removeAttr('aria-owns'); + + self.$selection.trigger('focus'); + + self._detachCloseHandler(container); + }); + + container.on('enable', function () { + self.$selection.attr('tabindex', self._tabindex); + self.$selection.attr('aria-disabled', 'false'); + }); + + container.on('disable', function () { + self.$selection.attr('tabindex', '-1'); + self.$selection.attr('aria-disabled', 'true'); + }); + }; + + BaseSelection.prototype._handleBlur = function (evt) { + var self = this; + + // This needs to be delayed as the active element is the body when the tab + // key is pressed, possibly along with others. + window.setTimeout(function () { + // Don't trigger `blur` if the focus is still in the selection + if ( + (document.activeElement == self.$selection[0]) || + ($.contains(self.$selection[0], document.activeElement)) + ) { + return; + } + + self.trigger('blur', evt); + }, 1); + }; + + BaseSelection.prototype._attachCloseHandler = function (container) { + + $(document.body).on('mousedown.select2.' + container.id, function (e) { + var $target = $(e.target); + + var $select = $target.closest('.select2'); + + var $all = $('.select2.select2-container--open'); + + $all.each(function () { + if (this == $select[0]) { + return; + } + + var $element = Utils.GetData(this, 'element'); + + $element.select2('close'); + }); + }); + }; + + BaseSelection.prototype._detachCloseHandler = function (container) { + $(document.body).off('mousedown.select2.' + container.id); + }; + + BaseSelection.prototype.position = function ($selection, $container) { + var $selectionContainer = $container.find('.selection'); + $selectionContainer.append($selection); + }; + + BaseSelection.prototype.destroy = function () { + this._detachCloseHandler(this.container); + }; + + BaseSelection.prototype.update = function (data) { + throw new Error('The `update` method must be defined in child classes.'); + }; + + /** + * Helper method to abstract the "enabled" (not "disabled") state of this + * object. + * + * @return {true} if the instance is not disabled. + * @return {false} if the instance is disabled. + */ + BaseSelection.prototype.isEnabled = function () { + return !this.isDisabled(); + }; + + /** + * Helper method to abstract the "disabled" state of this object. + * + * @return {true} if the disabled option is true. + * @return {false} if the disabled option is false. + */ + BaseSelection.prototype.isDisabled = function () { + return this.options.get('disabled'); + }; + + return BaseSelection; +}); + +S2.define('select2/selection/single',[ + 'jquery', + './base', + '../utils', + '../keys' +], function ($, BaseSelection, Utils, KEYS) { + function SingleSelection () { + SingleSelection.__super__.constructor.apply(this, arguments); + } + + Utils.Extend(SingleSelection, BaseSelection); + + SingleSelection.prototype.render = function () { + var $selection = SingleSelection.__super__.render.call(this); + + $selection.addClass('select2-selection--single'); + + $selection.html( + '<span class="select2-selection__rendered"></span>' + + '<span class="select2-selection__arrow" role="presentation">' + + '<b role="presentation"></b>' + + '</span>' + ); + + return $selection; + }; + + SingleSelection.prototype.bind = function (container, $container) { + var self = this; + + SingleSelection.__super__.bind.apply(this, arguments); + + var id = container.id + '-container'; + + this.$selection.find('.select2-selection__rendered') + .attr('id', id) + .attr('role', 'textbox') + .attr('aria-readonly', 'true'); + this.$selection.attr('aria-labelledby', id); + + this.$selection.on('mousedown', function (evt) { + // Only respond to left clicks + if (evt.which !== 1) { + return; + } + + self.trigger('toggle', { + originalEvent: evt + }); + }); + + this.$selection.on('focus', function (evt) { + // User focuses on the container + }); + + this.$selection.on('blur', function (evt) { + // User exits the container + }); + + container.on('focus', function (evt) { + if (!container.isOpen()) { + self.$selection.trigger('focus'); + } + }); + }; + + SingleSelection.prototype.clear = function () { + var $rendered = this.$selection.find('.select2-selection__rendered'); + $rendered.empty(); + $rendered.removeAttr('title'); // clear tooltip on empty + }; + + SingleSelection.prototype.display = function (data, container) { + var template = this.options.get('templateSelection'); + var escapeMarkup = this.options.get('escapeMarkup'); + + return escapeMarkup(template(data, container)); + }; + + SingleSelection.prototype.selectionContainer = function () { + return $('<span></span>'); + }; + + SingleSelection.prototype.update = function (data) { + if (data.length === 0) { + this.clear(); + return; + } + + var selection = data[0]; + + var $rendered = this.$selection.find('.select2-selection__rendered'); + var formatted = this.display(selection, $rendered); + + $rendered.empty().append(formatted); + + var title = selection.title || selection.text; + + if (title) { + $rendered.attr('title', title); + } else { + $rendered.removeAttr('title'); + } + }; + + return SingleSelection; +}); + +S2.define('select2/selection/multiple',[ + 'jquery', + './base', + '../utils' +], function ($, BaseSelection, Utils) { + function MultipleSelection ($element, options) { + MultipleSelection.__super__.constructor.apply(this, arguments); + } + + Utils.Extend(MultipleSelection, BaseSelection); + + MultipleSelection.prototype.render = function () { + var $selection = MultipleSelection.__super__.render.call(this); + + $selection.addClass('select2-selection--multiple'); + + $selection.html( + '<ul class="select2-selection__rendered"></ul>' + ); + + return $selection; + }; + + MultipleSelection.prototype.bind = function (container, $container) { + var self = this; + + MultipleSelection.__super__.bind.apply(this, arguments); + + this.$selection.on('click', function (evt) { + self.trigger('toggle', { + originalEvent: evt + }); + }); + + this.$selection.on( + 'click', + '.select2-selection__choice__remove', + function (evt) { + // Ignore the event if it is disabled + if (self.isDisabled()) { + return; + } + + var $remove = $(this); + var $selection = $remove.parent(); + + var data = Utils.GetData($selection[0], 'data'); + + self.trigger('unselect', { + originalEvent: evt, + data: data + }); + } + ); + }; + + MultipleSelection.prototype.clear = function () { + var $rendered = this.$selection.find('.select2-selection__rendered'); + $rendered.empty(); + $rendered.removeAttr('title'); + }; + + MultipleSelection.prototype.display = function (data, container) { + var template = this.options.get('templateSelection'); + var escapeMarkup = this.options.get('escapeMarkup'); + + return escapeMarkup(template(data, container)); + }; + + MultipleSelection.prototype.selectionContainer = function () { + var $container = $( + '<li class="select2-selection__choice">' + + '<span class="select2-selection__choice__remove" role="presentation">' + + '×' + + '</span>' + + '</li>' + ); + + return $container; + }; + + MultipleSelection.prototype.update = function (data) { + this.clear(); + + if (data.length === 0) { + return; + } + + var $selections = []; + + for (var d = 0; d < data.length; d++) { + var selection = data[d]; + + var $selection = this.selectionContainer(); + var formatted = this.display(selection, $selection); + + $selection.append(formatted); + + var title = selection.title || selection.text; + + if (title) { + $selection.attr('title', title); + } + + Utils.StoreData($selection[0], 'data', selection); + + $selections.push($selection); + } + + var $rendered = this.$selection.find('.select2-selection__rendered'); + + Utils.appendMany($rendered, $selections); + }; + + return MultipleSelection; +}); + +S2.define('select2/selection/placeholder',[ + '../utils' +], function (Utils) { + function Placeholder (decorated, $element, options) { + this.placeholder = this.normalizePlaceholder(options.get('placeholder')); + + decorated.call(this, $element, options); + } + + Placeholder.prototype.normalizePlaceholder = function (_, placeholder) { + if (typeof placeholder === 'string') { + placeholder = { + id: '', + text: placeholder + }; + } + + return placeholder; + }; + + Placeholder.prototype.createPlaceholder = function (decorated, placeholder) { + var $placeholder = this.selectionContainer(); + + $placeholder.html(this.display(placeholder)); + $placeholder.addClass('select2-selection__placeholder') + .removeClass('select2-selection__choice'); + + return $placeholder; + }; + + Placeholder.prototype.update = function (decorated, data) { + var singlePlaceholder = ( + data.length == 1 && data[0].id != this.placeholder.id + ); + var multipleSelections = data.length > 1; + + if (multipleSelections || singlePlaceholder) { + return decorated.call(this, data); + } + + this.clear(); + + var $placeholder = this.createPlaceholder(this.placeholder); + + this.$selection.find('.select2-selection__rendered').append($placeholder); + }; + + return Placeholder; +}); + +S2.define('select2/selection/allowClear',[ + 'jquery', + '../keys', + '../utils' +], function ($, KEYS, Utils) { + function AllowClear () { } + + AllowClear.prototype.bind = function (decorated, container, $container) { + var self = this; + + decorated.call(this, container, $container); + + if (this.placeholder == null) { + if (this.options.get('debug') && window.console && console.error) { + console.error( + 'Select2: The `allowClear` option should be used in combination ' + + 'with the `placeholder` option.' + ); + } + } + + this.$selection.on('mousedown', '.select2-selection__clear', + function (evt) { + self._handleClear(evt); + }); + + container.on('keypress', function (evt) { + self._handleKeyboardClear(evt, container); + }); + }; + + AllowClear.prototype._handleClear = function (_, evt) { + // Ignore the event if it is disabled + if (this.isDisabled()) { + return; + } + + var $clear = this.$selection.find('.select2-selection__clear'); + + // Ignore the event if nothing has been selected + if ($clear.length === 0) { + return; + } + + evt.stopPropagation(); + + var data = Utils.GetData($clear[0], 'data'); + + var previousVal = this.$element.val(); + this.$element.val(this.placeholder.id); + + var unselectData = { + data: data + }; + this.trigger('clear', unselectData); + if (unselectData.prevented) { + this.$element.val(previousVal); + return; + } + + for (var d = 0; d < data.length; d++) { + unselectData = { + data: data[d] + }; + + // Trigger the `unselect` event, so people can prevent it from being + // cleared. + this.trigger('unselect', unselectData); + + // If the event was prevented, don't clear it out. + if (unselectData.prevented) { + this.$element.val(previousVal); + return; + } + } + + this.$element.trigger('input').trigger('change'); + + this.trigger('toggle', {}); + }; + + AllowClear.prototype._handleKeyboardClear = function (_, evt, container) { + if (container.isOpen()) { + return; + } + + if (evt.which == KEYS.DELETE || evt.which == KEYS.BACKSPACE) { + this._handleClear(evt); + } + }; + + AllowClear.prototype.update = function (decorated, data) { + decorated.call(this, data); + + if (this.$selection.find('.select2-selection__placeholder').length > 0 || + data.length === 0) { + return; + } + + var removeAll = this.options.get('translations').get('removeAllItems'); + + var $remove = $( + '<span class="select2-selection__clear" title="' + removeAll() +'">' + + '×' + + '</span>' + ); + Utils.StoreData($remove[0], 'data', data); + + this.$selection.find('.select2-selection__rendered').prepend($remove); + }; + + return AllowClear; +}); + +S2.define('select2/selection/search',[ + 'jquery', + '../utils', + '../keys' +], function ($, Utils, KEYS) { + function Search (decorated, $element, options) { + decorated.call(this, $element, options); + } + + Search.prototype.render = function (decorated) { + var $search = $( + '<li class="select2-search select2-search--inline">' + + '<input class="select2-search__field" type="search" tabindex="-1"' + + ' autocomplete="off" autocorrect="off" autocapitalize="none"' + + ' spellcheck="false" role="searchbox" aria-autocomplete="list" />' + + '</li>' + ); + + this.$searchContainer = $search; + this.$search = $search.find('input'); + + var $rendered = decorated.call(this); + + this._transferTabIndex(); + + return $rendered; + }; + + Search.prototype.bind = function (decorated, container, $container) { + var self = this; + + var resultsId = container.id + '-results'; + + decorated.call(this, container, $container); + + container.on('open', function () { + self.$search.attr('aria-controls', resultsId); + self.$search.trigger('focus'); + }); + + container.on('close', function () { + self.$search.val(''); + self.$search.removeAttr('aria-controls'); + self.$search.removeAttr('aria-activedescendant'); + self.$search.trigger('focus'); + }); + + container.on('enable', function () { + self.$search.prop('disabled', false); + + self._transferTabIndex(); + }); + + container.on('disable', function () { + self.$search.prop('disabled', true); + }); + + container.on('focus', function (evt) { + self.$search.trigger('focus'); + }); + + container.on('results:focus', function (params) { + if (params.data._resultId) { + self.$search.attr('aria-activedescendant', params.data._resultId); + } else { + self.$search.removeAttr('aria-activedescendant'); + } + }); + + this.$selection.on('focusin', '.select2-search--inline', function (evt) { + self.trigger('focus', evt); + }); + + this.$selection.on('focusout', '.select2-search--inline', function (evt) { + self._handleBlur(evt); + }); + + this.$selection.on('keydown', '.select2-search--inline', function (evt) { + evt.stopPropagation(); + + self.trigger('keypress', evt); + + self._keyUpPrevented = evt.isDefaultPrevented(); + + var key = evt.which; + + if (key === KEYS.BACKSPACE && self.$search.val() === '') { + var $previousChoice = self.$searchContainer + .prev('.select2-selection__choice'); + + if ($previousChoice.length > 0) { + var item = Utils.GetData($previousChoice[0], 'data'); + + self.searchRemoveChoice(item); + + evt.preventDefault(); + } + } + }); + + this.$selection.on('click', '.select2-search--inline', function (evt) { + if (self.$search.val()) { + evt.stopPropagation(); + } + }); + + // Try to detect the IE version should the `documentMode` property that + // is stored on the document. This is only implemented in IE and is + // slightly cleaner than doing a user agent check. + // This property is not available in Edge, but Edge also doesn't have + // this bug. + var msie = document.documentMode; + var disableInputEvents = msie && msie <= 11; + + // Workaround for browsers which do not support the `input` event + // This will prevent double-triggering of events for browsers which support + // both the `keyup` and `input` events. + this.$selection.on( + 'input.searchcheck', + '.select2-search--inline', + function (evt) { + // IE will trigger the `input` event when a placeholder is used on a + // search box. To get around this issue, we are forced to ignore all + // `input` events in IE and keep using `keyup`. + if (disableInputEvents) { + self.$selection.off('input.search input.searchcheck'); + return; + } + + // Unbind the duplicated `keyup` event + self.$selection.off('keyup.search'); + } + ); + + this.$selection.on( + 'keyup.search input.search', + '.select2-search--inline', + function (evt) { + // IE will trigger the `input` event when a placeholder is used on a + // search box. To get around this issue, we are forced to ignore all + // `input` events in IE and keep using `keyup`. + if (disableInputEvents && evt.type === 'input') { + self.$selection.off('input.search input.searchcheck'); + return; + } + + var key = evt.which; + + // We can freely ignore events from modifier keys + if (key == KEYS.SHIFT || key == KEYS.CTRL || key == KEYS.ALT) { + return; + } + + // Tabbing will be handled during the `keydown` phase + if (key == KEYS.TAB) { + return; + } + + self.handleSearch(evt); + } + ); + }; + + /** + * This method will transfer the tabindex attribute from the rendered + * selection to the search box. This allows for the search box to be used as + * the primary focus instead of the selection container. + * + * @private + */ + Search.prototype._transferTabIndex = function (decorated) { + this.$search.attr('tabindex', this.$selection.attr('tabindex')); + this.$selection.attr('tabindex', '-1'); + }; + + Search.prototype.createPlaceholder = function (decorated, placeholder) { + this.$search.attr('placeholder', placeholder.text); + }; + + Search.prototype.update = function (decorated, data) { + var searchHadFocus = this.$search[0] == document.activeElement; + + this.$search.attr('placeholder', ''); + + decorated.call(this, data); + + this.$selection.find('.select2-selection__rendered') + .append(this.$searchContainer); + + this.resizeSearch(); + if (searchHadFocus) { + this.$search.trigger('focus'); + } + }; + + Search.prototype.handleSearch = function () { + this.resizeSearch(); + + if (!this._keyUpPrevented) { + var input = this.$search.val(); + + this.trigger('query', { + term: input + }); + } + + this._keyUpPrevented = false; + }; + + Search.prototype.searchRemoveChoice = function (decorated, item) { + this.trigger('unselect', { + data: item + }); + + this.$search.val(item.text); + this.handleSearch(); + }; + + Search.prototype.resizeSearch = function () { + this.$search.css('width', '25px'); + + var width = ''; + + if (this.$search.attr('placeholder') !== '') { + width = this.$selection.find('.select2-selection__rendered').width(); + } else { + var minimumWidth = this.$search.val().length + 1; + + width = (minimumWidth * 0.75) + 'em'; + } + + this.$search.css('width', width); + }; + + return Search; +}); + +S2.define('select2/selection/eventRelay',[ + 'jquery' +], function ($) { + function EventRelay () { } + + EventRelay.prototype.bind = function (decorated, container, $container) { + var self = this; + var relayEvents = [ + 'open', 'opening', + 'close', 'closing', + 'select', 'selecting', + 'unselect', 'unselecting', + 'clear', 'clearing' + ]; + + var preventableEvents = [ + 'opening', 'closing', 'selecting', 'unselecting', 'clearing' + ]; + + decorated.call(this, container, $container); + + container.on('*', function (name, params) { + // Ignore events that should not be relayed + if ($.inArray(name, relayEvents) === -1) { + return; + } + + // The parameters should always be an object + params = params || {}; + + // Generate the jQuery event for the Select2 event + var evt = $.Event('select2:' + name, { + params: params + }); + + self.$element.trigger(evt); + + // Only handle preventable events if it was one + if ($.inArray(name, preventableEvents) === -1) { + return; + } + + params.prevented = evt.isDefaultPrevented(); + }); + }; + + return EventRelay; +}); + +S2.define('select2/translation',[ + 'jquery', + 'require' +], function ($, require) { + function Translation (dict) { + this.dict = dict || {}; + } + + Translation.prototype.all = function () { + return this.dict; + }; + + Translation.prototype.get = function (key) { + return this.dict[key]; + }; + + Translation.prototype.extend = function (translation) { + this.dict = $.extend({}, translation.all(), this.dict); + }; + + // Static functions + + Translation._cache = {}; + + Translation.loadPath = function (path) { + if (!(path in Translation._cache)) { + var translations = require(path); + + Translation._cache[path] = translations; + } + + return new Translation(Translation._cache[path]); + }; + + return Translation; +}); + +S2.define('select2/diacritics',[ + +], function () { + var diacritics = { + '\u24B6': 'A', + '\uFF21': 'A', + '\u00C0': 'A', + '\u00C1': 'A', + '\u00C2': 'A', + '\u1EA6': 'A', + '\u1EA4': 'A', + '\u1EAA': 'A', + '\u1EA8': 'A', + '\u00C3': 'A', + '\u0100': 'A', + '\u0102': 'A', + '\u1EB0': 'A', + '\u1EAE': 'A', + '\u1EB4': 'A', + '\u1EB2': 'A', + '\u0226': 'A', + '\u01E0': 'A', + '\u00C4': 'A', + '\u01DE': 'A', + '\u1EA2': 'A', + '\u00C5': 'A', + '\u01FA': 'A', + '\u01CD': 'A', + '\u0200': 'A', + '\u0202': 'A', + '\u1EA0': 'A', + '\u1EAC': 'A', + '\u1EB6': 'A', + '\u1E00': 'A', + '\u0104': 'A', + '\u023A': 'A', + '\u2C6F': 'A', + '\uA732': 'AA', + '\u00C6': 'AE', + '\u01FC': 'AE', + '\u01E2': 'AE', + '\uA734': 'AO', + '\uA736': 'AU', + '\uA738': 'AV', + '\uA73A': 'AV', + '\uA73C': 'AY', + '\u24B7': 'B', + '\uFF22': 'B', + '\u1E02': 'B', + '\u1E04': 'B', + '\u1E06': 'B', + '\u0243': 'B', + '\u0182': 'B', + '\u0181': 'B', + '\u24B8': 'C', + '\uFF23': 'C', + '\u0106': 'C', + '\u0108': 'C', + '\u010A': 'C', + '\u010C': 'C', + '\u00C7': 'C', + '\u1E08': 'C', + '\u0187': 'C', + '\u023B': 'C', + '\uA73E': 'C', + '\u24B9': 'D', + '\uFF24': 'D', + '\u1E0A': 'D', + '\u010E': 'D', + '\u1E0C': 'D', + '\u1E10': 'D', + '\u1E12': 'D', + '\u1E0E': 'D', + '\u0110': 'D', + '\u018B': 'D', + '\u018A': 'D', + '\u0189': 'D', + '\uA779': 'D', + '\u01F1': 'DZ', + '\u01C4': 'DZ', + '\u01F2': 'Dz', + '\u01C5': 'Dz', + '\u24BA': 'E', + '\uFF25': 'E', + '\u00C8': 'E', + '\u00C9': 'E', + '\u00CA': 'E', + '\u1EC0': 'E', + '\u1EBE': 'E', + '\u1EC4': 'E', + '\u1EC2': 'E', + '\u1EBC': 'E', + '\u0112': 'E', + '\u1E14': 'E', + '\u1E16': 'E', + '\u0114': 'E', + '\u0116': 'E', + '\u00CB': 'E', + '\u1EBA': 'E', + '\u011A': 'E', + '\u0204': 'E', + '\u0206': 'E', + '\u1EB8': 'E', + '\u1EC6': 'E', + '\u0228': 'E', + '\u1E1C': 'E', + '\u0118': 'E', + '\u1E18': 'E', + '\u1E1A': 'E', + '\u0190': 'E', + '\u018E': 'E', + '\u24BB': 'F', + '\uFF26': 'F', + '\u1E1E': 'F', + '\u0191': 'F', + '\uA77B': 'F', + '\u24BC': 'G', + '\uFF27': 'G', + '\u01F4': 'G', + '\u011C': 'G', + '\u1E20': 'G', + '\u011E': 'G', + '\u0120': 'G', + '\u01E6': 'G', + '\u0122': 'G', + '\u01E4': 'G', + '\u0193': 'G', + '\uA7A0': 'G', + '\uA77D': 'G', + '\uA77E': 'G', + '\u24BD': 'H', + '\uFF28': 'H', + '\u0124': 'H', + '\u1E22': 'H', + '\u1E26': 'H', + '\u021E': 'H', + '\u1E24': 'H', + '\u1E28': 'H', + '\u1E2A': 'H', + '\u0126': 'H', + '\u2C67': 'H', + '\u2C75': 'H', + '\uA78D': 'H', + '\u24BE': 'I', + '\uFF29': 'I', + '\u00CC': 'I', + '\u00CD': 'I', + '\u00CE': 'I', + '\u0128': 'I', + '\u012A': 'I', + '\u012C': 'I', + '\u0130': 'I', + '\u00CF': 'I', + '\u1E2E': 'I', + '\u1EC8': 'I', + '\u01CF': 'I', + '\u0208': 'I', + '\u020A': 'I', + '\u1ECA': 'I', + '\u012E': 'I', + '\u1E2C': 'I', + '\u0197': 'I', + '\u24BF': 'J', + '\uFF2A': 'J', + '\u0134': 'J', + '\u0248': 'J', + '\u24C0': 'K', + '\uFF2B': 'K', + '\u1E30': 'K', + '\u01E8': 'K', + '\u1E32': 'K', + '\u0136': 'K', + '\u1E34': 'K', + '\u0198': 'K', + '\u2C69': 'K', + '\uA740': 'K', + '\uA742': 'K', + '\uA744': 'K', + '\uA7A2': 'K', + '\u24C1': 'L', + '\uFF2C': 'L', + '\u013F': 'L', + '\u0139': 'L', + '\u013D': 'L', + '\u1E36': 'L', + '\u1E38': 'L', + '\u013B': 'L', + '\u1E3C': 'L', + '\u1E3A': 'L', + '\u0141': 'L', + '\u023D': 'L', + '\u2C62': 'L', + '\u2C60': 'L', + '\uA748': 'L', + '\uA746': 'L', + '\uA780': 'L', + '\u01C7': 'LJ', + '\u01C8': 'Lj', + '\u24C2': 'M', + '\uFF2D': 'M', + '\u1E3E': 'M', + '\u1E40': 'M', + '\u1E42': 'M', + '\u2C6E': 'M', + '\u019C': 'M', + '\u24C3': 'N', + '\uFF2E': 'N', + '\u01F8': 'N', + '\u0143': 'N', + '\u00D1': 'N', + '\u1E44': 'N', + '\u0147': 'N', + '\u1E46': 'N', + '\u0145': 'N', + '\u1E4A': 'N', + '\u1E48': 'N', + '\u0220': 'N', + '\u019D': 'N', + '\uA790': 'N', + '\uA7A4': 'N', + '\u01CA': 'NJ', + '\u01CB': 'Nj', + '\u24C4': 'O', + '\uFF2F': 'O', + '\u00D2': 'O', + '\u00D3': 'O', + '\u00D4': 'O', + '\u1ED2': 'O', + '\u1ED0': 'O', + '\u1ED6': 'O', + '\u1ED4': 'O', + '\u00D5': 'O', + '\u1E4C': 'O', + '\u022C': 'O', + '\u1E4E': 'O', + '\u014C': 'O', + '\u1E50': 'O', + '\u1E52': 'O', + '\u014E': 'O', + '\u022E': 'O', + '\u0230': 'O', + '\u00D6': 'O', + '\u022A': 'O', + '\u1ECE': 'O', + '\u0150': 'O', + '\u01D1': 'O', + '\u020C': 'O', + '\u020E': 'O', + '\u01A0': 'O', + '\u1EDC': 'O', + '\u1EDA': 'O', + '\u1EE0': 'O', + '\u1EDE': 'O', + '\u1EE2': 'O', + '\u1ECC': 'O', + '\u1ED8': 'O', + '\u01EA': 'O', + '\u01EC': 'O', + '\u00D8': 'O', + '\u01FE': 'O', + '\u0186': 'O', + '\u019F': 'O', + '\uA74A': 'O', + '\uA74C': 'O', + '\u0152': 'OE', + '\u01A2': 'OI', + '\uA74E': 'OO', + '\u0222': 'OU', + '\u24C5': 'P', + '\uFF30': 'P', + '\u1E54': 'P', + '\u1E56': 'P', + '\u01A4': 'P', + '\u2C63': 'P', + '\uA750': 'P', + '\uA752': 'P', + '\uA754': 'P', + '\u24C6': 'Q', + '\uFF31': 'Q', + '\uA756': 'Q', + '\uA758': 'Q', + '\u024A': 'Q', + '\u24C7': 'R', + '\uFF32': 'R', + '\u0154': 'R', + '\u1E58': 'R', + '\u0158': 'R', + '\u0210': 'R', + '\u0212': 'R', + '\u1E5A': 'R', + '\u1E5C': 'R', + '\u0156': 'R', + '\u1E5E': 'R', + '\u024C': 'R', + '\u2C64': 'R', + '\uA75A': 'R', + '\uA7A6': 'R', + '\uA782': 'R', + '\u24C8': 'S', + '\uFF33': 'S', + '\u1E9E': 'S', + '\u015A': 'S', + '\u1E64': 'S', + '\u015C': 'S', + '\u1E60': 'S', + '\u0160': 'S', + '\u1E66': 'S', + '\u1E62': 'S', + '\u1E68': 'S', + '\u0218': 'S', + '\u015E': 'S', + '\u2C7E': 'S', + '\uA7A8': 'S', + '\uA784': 'S', + '\u24C9': 'T', + '\uFF34': 'T', + '\u1E6A': 'T', + '\u0164': 'T', + '\u1E6C': 'T', + '\u021A': 'T', + '\u0162': 'T', + '\u1E70': 'T', + '\u1E6E': 'T', + '\u0166': 'T', + '\u01AC': 'T', + '\u01AE': 'T', + '\u023E': 'T', + '\uA786': 'T', + '\uA728': 'TZ', + '\u24CA': 'U', + '\uFF35': 'U', + '\u00D9': 'U', + '\u00DA': 'U', + '\u00DB': 'U', + '\u0168': 'U', + '\u1E78': 'U', + '\u016A': 'U', + '\u1E7A': 'U', + '\u016C': 'U', + '\u00DC': 'U', + '\u01DB': 'U', + '\u01D7': 'U', + '\u01D5': 'U', + '\u01D9': 'U', + '\u1EE6': 'U', + '\u016E': 'U', + '\u0170': 'U', + '\u01D3': 'U', + '\u0214': 'U', + '\u0216': 'U', + '\u01AF': 'U', + '\u1EEA': 'U', + '\u1EE8': 'U', + '\u1EEE': 'U', + '\u1EEC': 'U', + '\u1EF0': 'U', + '\u1EE4': 'U', + '\u1E72': 'U', + '\u0172': 'U', + '\u1E76': 'U', + '\u1E74': 'U', + '\u0244': 'U', + '\u24CB': 'V', + '\uFF36': 'V', + '\u1E7C': 'V', + '\u1E7E': 'V', + '\u01B2': 'V', + '\uA75E': 'V', + '\u0245': 'V', + '\uA760': 'VY', + '\u24CC': 'W', + '\uFF37': 'W', + '\u1E80': 'W', + '\u1E82': 'W', + '\u0174': 'W', + '\u1E86': 'W', + '\u1E84': 'W', + '\u1E88': 'W', + '\u2C72': 'W', + '\u24CD': 'X', + '\uFF38': 'X', + '\u1E8A': 'X', + '\u1E8C': 'X', + '\u24CE': 'Y', + '\uFF39': 'Y', + '\u1EF2': 'Y', + '\u00DD': 'Y', + '\u0176': 'Y', + '\u1EF8': 'Y', + '\u0232': 'Y', + '\u1E8E': 'Y', + '\u0178': 'Y', + '\u1EF6': 'Y', + '\u1EF4': 'Y', + '\u01B3': 'Y', + '\u024E': 'Y', + '\u1EFE': 'Y', + '\u24CF': 'Z', + '\uFF3A': 'Z', + '\u0179': 'Z', + '\u1E90': 'Z', + '\u017B': 'Z', + '\u017D': 'Z', + '\u1E92': 'Z', + '\u1E94': 'Z', + '\u01B5': 'Z', + '\u0224': 'Z', + '\u2C7F': 'Z', + '\u2C6B': 'Z', + '\uA762': 'Z', + '\u24D0': 'a', + '\uFF41': 'a', + '\u1E9A': 'a', + '\u00E0': 'a', + '\u00E1': 'a', + '\u00E2': 'a', + '\u1EA7': 'a', + '\u1EA5': 'a', + '\u1EAB': 'a', + '\u1EA9': 'a', + '\u00E3': 'a', + '\u0101': 'a', + '\u0103': 'a', + '\u1EB1': 'a', + '\u1EAF': 'a', + '\u1EB5': 'a', + '\u1EB3': 'a', + '\u0227': 'a', + '\u01E1': 'a', + '\u00E4': 'a', + '\u01DF': 'a', + '\u1EA3': 'a', + '\u00E5': 'a', + '\u01FB': 'a', + '\u01CE': 'a', + '\u0201': 'a', + '\u0203': 'a', + '\u1EA1': 'a', + '\u1EAD': 'a', + '\u1EB7': 'a', + '\u1E01': 'a', + '\u0105': 'a', + '\u2C65': 'a', + '\u0250': 'a', + '\uA733': 'aa', + '\u00E6': 'ae', + '\u01FD': 'ae', + '\u01E3': 'ae', + '\uA735': 'ao', + '\uA737': 'au', + '\uA739': 'av', + '\uA73B': 'av', + '\uA73D': 'ay', + '\u24D1': 'b', + '\uFF42': 'b', + '\u1E03': 'b', + '\u1E05': 'b', + '\u1E07': 'b', + '\u0180': 'b', + '\u0183': 'b', + '\u0253': 'b', + '\u24D2': 'c', + '\uFF43': 'c', + '\u0107': 'c', + '\u0109': 'c', + '\u010B': 'c', + '\u010D': 'c', + '\u00E7': 'c', + '\u1E09': 'c', + '\u0188': 'c', + '\u023C': 'c', + '\uA73F': 'c', + '\u2184': 'c', + '\u24D3': 'd', + '\uFF44': 'd', + '\u1E0B': 'd', + '\u010F': 'd', + '\u1E0D': 'd', + '\u1E11': 'd', + '\u1E13': 'd', + '\u1E0F': 'd', + '\u0111': 'd', + '\u018C': 'd', + '\u0256': 'd', + '\u0257': 'd', + '\uA77A': 'd', + '\u01F3': 'dz', + '\u01C6': 'dz', + '\u24D4': 'e', + '\uFF45': 'e', + '\u00E8': 'e', + '\u00E9': 'e', + '\u00EA': 'e', + '\u1EC1': 'e', + '\u1EBF': 'e', + '\u1EC5': 'e', + '\u1EC3': 'e', + '\u1EBD': 'e', + '\u0113': 'e', + '\u1E15': 'e', + '\u1E17': 'e', + '\u0115': 'e', + '\u0117': 'e', + '\u00EB': 'e', + '\u1EBB': 'e', + '\u011B': 'e', + '\u0205': 'e', + '\u0207': 'e', + '\u1EB9': 'e', + '\u1EC7': 'e', + '\u0229': 'e', + '\u1E1D': 'e', + '\u0119': 'e', + '\u1E19': 'e', + '\u1E1B': 'e', + '\u0247': 'e', + '\u025B': 'e', + '\u01DD': 'e', + '\u24D5': 'f', + '\uFF46': 'f', + '\u1E1F': 'f', + '\u0192': 'f', + '\uA77C': 'f', + '\u24D6': 'g', + '\uFF47': 'g', + '\u01F5': 'g', + '\u011D': 'g', + '\u1E21': 'g', + '\u011F': 'g', + '\u0121': 'g', + '\u01E7': 'g', + '\u0123': 'g', + '\u01E5': 'g', + '\u0260': 'g', + '\uA7A1': 'g', + '\u1D79': 'g', + '\uA77F': 'g', + '\u24D7': 'h', + '\uFF48': 'h', + '\u0125': 'h', + '\u1E23': 'h', + '\u1E27': 'h', + '\u021F': 'h', + '\u1E25': 'h', + '\u1E29': 'h', + '\u1E2B': 'h', + '\u1E96': 'h', + '\u0127': 'h', + '\u2C68': 'h', + '\u2C76': 'h', + '\u0265': 'h', + '\u0195': 'hv', + '\u24D8': 'i', + '\uFF49': 'i', + '\u00EC': 'i', + '\u00ED': 'i', + '\u00EE': 'i', + '\u0129': 'i', + '\u012B': 'i', + '\u012D': 'i', + '\u00EF': 'i', + '\u1E2F': 'i', + '\u1EC9': 'i', + '\u01D0': 'i', + '\u0209': 'i', + '\u020B': 'i', + '\u1ECB': 'i', + '\u012F': 'i', + '\u1E2D': 'i', + '\u0268': 'i', + '\u0131': 'i', + '\u24D9': 'j', + '\uFF4A': 'j', + '\u0135': 'j', + '\u01F0': 'j', + '\u0249': 'j', + '\u24DA': 'k', + '\uFF4B': 'k', + '\u1E31': 'k', + '\u01E9': 'k', + '\u1E33': 'k', + '\u0137': 'k', + '\u1E35': 'k', + '\u0199': 'k', + '\u2C6A': 'k', + '\uA741': 'k', + '\uA743': 'k', + '\uA745': 'k', + '\uA7A3': 'k', + '\u24DB': 'l', + '\uFF4C': 'l', + '\u0140': 'l', + '\u013A': 'l', + '\u013E': 'l', + '\u1E37': 'l', + '\u1E39': 'l', + '\u013C': 'l', + '\u1E3D': 'l', + '\u1E3B': 'l', + '\u017F': 'l', + '\u0142': 'l', + '\u019A': 'l', + '\u026B': 'l', + '\u2C61': 'l', + '\uA749': 'l', + '\uA781': 'l', + '\uA747': 'l', + '\u01C9': 'lj', + '\u24DC': 'm', + '\uFF4D': 'm', + '\u1E3F': 'm', + '\u1E41': 'm', + '\u1E43': 'm', + '\u0271': 'm', + '\u026F': 'm', + '\u24DD': 'n', + '\uFF4E': 'n', + '\u01F9': 'n', + '\u0144': 'n', + '\u00F1': 'n', + '\u1E45': 'n', + '\u0148': 'n', + '\u1E47': 'n', + '\u0146': 'n', + '\u1E4B': 'n', + '\u1E49': 'n', + '\u019E': 'n', + '\u0272': 'n', + '\u0149': 'n', + '\uA791': 'n', + '\uA7A5': 'n', + '\u01CC': 'nj', + '\u24DE': 'o', + '\uFF4F': 'o', + '\u00F2': 'o', + '\u00F3': 'o', + '\u00F4': 'o', + '\u1ED3': 'o', + '\u1ED1': 'o', + '\u1ED7': 'o', + '\u1ED5': 'o', + '\u00F5': 'o', + '\u1E4D': 'o', + '\u022D': 'o', + '\u1E4F': 'o', + '\u014D': 'o', + '\u1E51': 'o', + '\u1E53': 'o', + '\u014F': 'o', + '\u022F': 'o', + '\u0231': 'o', + '\u00F6': 'o', + '\u022B': 'o', + '\u1ECF': 'o', + '\u0151': 'o', + '\u01D2': 'o', + '\u020D': 'o', + '\u020F': 'o', + '\u01A1': 'o', + '\u1EDD': 'o', + '\u1EDB': 'o', + '\u1EE1': 'o', + '\u1EDF': 'o', + '\u1EE3': 'o', + '\u1ECD': 'o', + '\u1ED9': 'o', + '\u01EB': 'o', + '\u01ED': 'o', + '\u00F8': 'o', + '\u01FF': 'o', + '\u0254': 'o', + '\uA74B': 'o', + '\uA74D': 'o', + '\u0275': 'o', + '\u0153': 'oe', + '\u01A3': 'oi', + '\u0223': 'ou', + '\uA74F': 'oo', + '\u24DF': 'p', + '\uFF50': 'p', + '\u1E55': 'p', + '\u1E57': 'p', + '\u01A5': 'p', + '\u1D7D': 'p', + '\uA751': 'p', + '\uA753': 'p', + '\uA755': 'p', + '\u24E0': 'q', + '\uFF51': 'q', + '\u024B': 'q', + '\uA757': 'q', + '\uA759': 'q', + '\u24E1': 'r', + '\uFF52': 'r', + '\u0155': 'r', + '\u1E59': 'r', + '\u0159': 'r', + '\u0211': 'r', + '\u0213': 'r', + '\u1E5B': 'r', + '\u1E5D': 'r', + '\u0157': 'r', + '\u1E5F': 'r', + '\u024D': 'r', + '\u027D': 'r', + '\uA75B': 'r', + '\uA7A7': 'r', + '\uA783': 'r', + '\u24E2': 's', + '\uFF53': 's', + '\u00DF': 's', + '\u015B': 's', + '\u1E65': 's', + '\u015D': 's', + '\u1E61': 's', + '\u0161': 's', + '\u1E67': 's', + '\u1E63': 's', + '\u1E69': 's', + '\u0219': 's', + '\u015F': 's', + '\u023F': 's', + '\uA7A9': 's', + '\uA785': 's', + '\u1E9B': 's', + '\u24E3': 't', + '\uFF54': 't', + '\u1E6B': 't', + '\u1E97': 't', + '\u0165': 't', + '\u1E6D': 't', + '\u021B': 't', + '\u0163': 't', + '\u1E71': 't', + '\u1E6F': 't', + '\u0167': 't', + '\u01AD': 't', + '\u0288': 't', + '\u2C66': 't', + '\uA787': 't', + '\uA729': 'tz', + '\u24E4': 'u', + '\uFF55': 'u', + '\u00F9': 'u', + '\u00FA': 'u', + '\u00FB': 'u', + '\u0169': 'u', + '\u1E79': 'u', + '\u016B': 'u', + '\u1E7B': 'u', + '\u016D': 'u', + '\u00FC': 'u', + '\u01DC': 'u', + '\u01D8': 'u', + '\u01D6': 'u', + '\u01DA': 'u', + '\u1EE7': 'u', + '\u016F': 'u', + '\u0171': 'u', + '\u01D4': 'u', + '\u0215': 'u', + '\u0217': 'u', + '\u01B0': 'u', + '\u1EEB': 'u', + '\u1EE9': 'u', + '\u1EEF': 'u', + '\u1EED': 'u', + '\u1EF1': 'u', + '\u1EE5': 'u', + '\u1E73': 'u', + '\u0173': 'u', + '\u1E77': 'u', + '\u1E75': 'u', + '\u0289': 'u', + '\u24E5': 'v', + '\uFF56': 'v', + '\u1E7D': 'v', + '\u1E7F': 'v', + '\u028B': 'v', + '\uA75F': 'v', + '\u028C': 'v', + '\uA761': 'vy', + '\u24E6': 'w', + '\uFF57': 'w', + '\u1E81': 'w', + '\u1E83': 'w', + '\u0175': 'w', + '\u1E87': 'w', + '\u1E85': 'w', + '\u1E98': 'w', + '\u1E89': 'w', + '\u2C73': 'w', + '\u24E7': 'x', + '\uFF58': 'x', + '\u1E8B': 'x', + '\u1E8D': 'x', + '\u24E8': 'y', + '\uFF59': 'y', + '\u1EF3': 'y', + '\u00FD': 'y', + '\u0177': 'y', + '\u1EF9': 'y', + '\u0233': 'y', + '\u1E8F': 'y', + '\u00FF': 'y', + '\u1EF7': 'y', + '\u1E99': 'y', + '\u1EF5': 'y', + '\u01B4': 'y', + '\u024F': 'y', + '\u1EFF': 'y', + '\u24E9': 'z', + '\uFF5A': 'z', + '\u017A': 'z', + '\u1E91': 'z', + '\u017C': 'z', + '\u017E': 'z', + '\u1E93': 'z', + '\u1E95': 'z', + '\u01B6': 'z', + '\u0225': 'z', + '\u0240': 'z', + '\u2C6C': 'z', + '\uA763': 'z', + '\u0386': '\u0391', + '\u0388': '\u0395', + '\u0389': '\u0397', + '\u038A': '\u0399', + '\u03AA': '\u0399', + '\u038C': '\u039F', + '\u038E': '\u03A5', + '\u03AB': '\u03A5', + '\u038F': '\u03A9', + '\u03AC': '\u03B1', + '\u03AD': '\u03B5', + '\u03AE': '\u03B7', + '\u03AF': '\u03B9', + '\u03CA': '\u03B9', + '\u0390': '\u03B9', + '\u03CC': '\u03BF', + '\u03CD': '\u03C5', + '\u03CB': '\u03C5', + '\u03B0': '\u03C5', + '\u03CE': '\u03C9', + '\u03C2': '\u03C3', + '\u2019': '\'' + }; + + return diacritics; +}); + +S2.define('select2/data/base',[ + '../utils' +], function (Utils) { + function BaseAdapter ($element, options) { + BaseAdapter.__super__.constructor.call(this); + } + + Utils.Extend(BaseAdapter, Utils.Observable); + + BaseAdapter.prototype.current = function (callback) { + throw new Error('The `current` method must be defined in child classes.'); + }; + + BaseAdapter.prototype.query = function (params, callback) { + throw new Error('The `query` method must be defined in child classes.'); + }; + + BaseAdapter.prototype.bind = function (container, $container) { + // Can be implemented in subclasses + }; + + BaseAdapter.prototype.destroy = function () { + // Can be implemented in subclasses + }; + + BaseAdapter.prototype.generateResultId = function (container, data) { + var id = container.id + '-result-'; + + id += Utils.generateChars(4); + + if (data.id != null) { + id += '-' + data.id.toString(); + } else { + id += '-' + Utils.generateChars(4); + } + return id; + }; + + return BaseAdapter; +}); + +S2.define('select2/data/select',[ + './base', + '../utils', + 'jquery' +], function (BaseAdapter, Utils, $) { + function SelectAdapter ($element, options) { + this.$element = $element; + this.options = options; + + SelectAdapter.__super__.constructor.call(this); + } + + Utils.Extend(SelectAdapter, BaseAdapter); + + SelectAdapter.prototype.current = function (callback) { + var data = []; + var self = this; + + this.$element.find(':selected').each(function () { + var $option = $(this); + + var option = self.item($option); + + data.push(option); + }); + + callback(data); + }; + + SelectAdapter.prototype.select = function (data) { + var self = this; + + data.selected = true; + + // If data.element is a DOM node, use it instead + if ($(data.element).is('option')) { + data.element.selected = true; + + this.$element.trigger('input').trigger('change'); + + return; + } + + if (this.$element.prop('multiple')) { + this.current(function (currentData) { + var val = []; + + data = [data]; + data.push.apply(data, currentData); + + for (var d = 0; d < data.length; d++) { + var id = data[d].id; + + if ($.inArray(id, val) === -1) { + val.push(id); + } + } + + self.$element.val(val); + self.$element.trigger('input').trigger('change'); + }); + } else { + var val = data.id; + + this.$element.val(val); + this.$element.trigger('input').trigger('change'); + } + }; + + SelectAdapter.prototype.unselect = function (data) { + var self = this; + + if (!this.$element.prop('multiple')) { + return; + } + + data.selected = false; + + if ($(data.element).is('option')) { + data.element.selected = false; + + this.$element.trigger('input').trigger('change'); + + return; + } + + this.current(function (currentData) { + var val = []; + + for (var d = 0; d < currentData.length; d++) { + var id = currentData[d].id; + + if (id !== data.id && $.inArray(id, val) === -1) { + val.push(id); + } + } + + self.$element.val(val); + + self.$element.trigger('input').trigger('change'); + }); + }; + + SelectAdapter.prototype.bind = function (container, $container) { + var self = this; + + this.container = container; + + container.on('select', function (params) { + self.select(params.data); + }); + + container.on('unselect', function (params) { + self.unselect(params.data); + }); + }; + + SelectAdapter.prototype.destroy = function () { + // Remove anything added to child elements + this.$element.find('*').each(function () { + // Remove any custom data set by Select2 + Utils.RemoveData(this); + }); + }; + + SelectAdapter.prototype.query = function (params, callback) { + var data = []; + var self = this; + + var $options = this.$element.children(); + + $options.each(function () { + var $option = $(this); + + if (!$option.is('option') && !$option.is('optgroup')) { + return; + } + + var option = self.item($option); + + var matches = self.matches(params, option); + + if (matches !== null) { + data.push(matches); + } + }); + + callback({ + results: data + }); + }; + + SelectAdapter.prototype.addOptions = function ($options) { + Utils.appendMany(this.$element, $options); + }; + + SelectAdapter.prototype.option = function (data) { + var option; + + if (data.children) { + option = document.createElement('optgroup'); + option.label = data.text; + } else { + option = document.createElement('option'); + + if (option.textContent !== undefined) { + option.textContent = data.text; + } else { + option.innerText = data.text; + } + } + + if (data.id !== undefined) { + option.value = data.id; + } + + if (data.disabled) { + option.disabled = true; + } + + if (data.selected) { + option.selected = true; + } + + if (data.title) { + option.title = data.title; + } + + var $option = $(option); + + var normalizedData = this._normalizeItem(data); + normalizedData.element = option; + + // Override the option's data with the combined data + Utils.StoreData(option, 'data', normalizedData); + + return $option; + }; + + SelectAdapter.prototype.item = function ($option) { + var data = {}; + + data = Utils.GetData($option[0], 'data'); + + if (data != null) { + return data; + } + + if ($option.is('option')) { + data = { + id: $option.val(), + text: $option.text(), + disabled: $option.prop('disabled'), + selected: $option.prop('selected'), + title: $option.prop('title') + }; + } else if ($option.is('optgroup')) { + data = { + text: $option.prop('label'), + children: [], + title: $option.prop('title') + }; + + var $children = $option.children('option'); + var children = []; + + for (var c = 0; c < $children.length; c++) { + var $child = $($children[c]); + + var child = this.item($child); + + children.push(child); + } + + data.children = children; + } + + data = this._normalizeItem(data); + data.element = $option[0]; + + Utils.StoreData($option[0], 'data', data); + + return data; + }; + + SelectAdapter.prototype._normalizeItem = function (item) { + if (item !== Object(item)) { + item = { + id: item, + text: item + }; + } + + item = $.extend({}, { + text: '' + }, item); + + var defaults = { + selected: false, + disabled: false + }; + + if (item.id != null) { + item.id = item.id.toString(); + } + + if (item.text != null) { + item.text = item.text.toString(); + } + + if (item._resultId == null && item.id && this.container != null) { + item._resultId = this.generateResultId(this.container, item); + } + + return $.extend({}, defaults, item); + }; + + SelectAdapter.prototype.matches = function (params, data) { + var matcher = this.options.get('matcher'); + + return matcher(params, data); + }; + + return SelectAdapter; +}); + +S2.define('select2/data/array',[ + './select', + '../utils', + 'jquery' +], function (SelectAdapter, Utils, $) { + function ArrayAdapter ($element, options) { + this._dataToConvert = options.get('data') || []; + + ArrayAdapter.__super__.constructor.call(this, $element, options); + } + + Utils.Extend(ArrayAdapter, SelectAdapter); + + ArrayAdapter.prototype.bind = function (container, $container) { + ArrayAdapter.__super__.bind.call(this, container, $container); + + this.addOptions(this.convertToOptions(this._dataToConvert)); + }; + + ArrayAdapter.prototype.select = function (data) { + var $option = this.$element.find('option').filter(function (i, elm) { + return elm.value == data.id.toString(); + }); + + if ($option.length === 0) { + $option = this.option(data); + + this.addOptions($option); + } + + ArrayAdapter.__super__.select.call(this, data); + }; + + ArrayAdapter.prototype.convertToOptions = function (data) { + var self = this; + + var $existing = this.$element.find('option'); + var existingIds = $existing.map(function () { + return self.item($(this)).id; + }).get(); + + var $options = []; + + // Filter out all items except for the one passed in the argument + function onlyItem (item) { + return function () { + return $(this).val() == item.id; + }; + } + + for (var d = 0; d < data.length; d++) { + var item = this._normalizeItem(data[d]); + + // Skip items which were pre-loaded, only merge the data + if ($.inArray(item.id, existingIds) >= 0) { + var $existingOption = $existing.filter(onlyItem(item)); + + var existingData = this.item($existingOption); + var newData = $.extend(true, {}, item, existingData); + + var $newOption = this.option(newData); + + $existingOption.replaceWith($newOption); + + continue; + } + + var $option = this.option(item); + + if (item.children) { + var $children = this.convertToOptions(item.children); + + Utils.appendMany($option, $children); + } + + $options.push($option); + } + + return $options; + }; + + return ArrayAdapter; +}); + +S2.define('select2/data/ajax',[ + './array', + '../utils', + 'jquery' +], function (ArrayAdapter, Utils, $) { + function AjaxAdapter ($element, options) { + this.ajaxOptions = this._applyDefaults(options.get('ajax')); + + if (this.ajaxOptions.processResults != null) { + this.processResults = this.ajaxOptions.processResults; + } + + AjaxAdapter.__super__.constructor.call(this, $element, options); + } + + Utils.Extend(AjaxAdapter, ArrayAdapter); + + AjaxAdapter.prototype._applyDefaults = function (options) { + var defaults = { + data: function (params) { + return $.extend({}, params, { + q: params.term + }); + }, + transport: function (params, success, failure) { + var $request = $.ajax(params); + + $request.then(success); + $request.fail(failure); + + return $request; + } + }; + + return $.extend({}, defaults, options, true); + }; + + AjaxAdapter.prototype.processResults = function (results) { + return results; + }; + + AjaxAdapter.prototype.query = function (params, callback) { + var matches = []; + var self = this; + + if (this._request != null) { + // JSONP requests cannot always be aborted + if ($.isFunction(this._request.abort)) { + this._request.abort(); + } + + this._request = null; + } + + var options = $.extend({ + type: 'GET' + }, this.ajaxOptions); + + if (typeof options.url === 'function') { + options.url = options.url.call(this.$element, params); + } + + if (typeof options.data === 'function') { + options.data = options.data.call(this.$element, params); + } + + function request () { + var $request = options.transport(options, function (data) { + var results = self.processResults(data, params); + + if (self.options.get('debug') && window.console && console.error) { + // Check to make sure that the response included a `results` key. + if (!results || !results.results || !$.isArray(results.results)) { + console.error( + 'Select2: The AJAX results did not return an array in the ' + + '`results` key of the response.' + ); + } + } + + callback(results); + }, function () { + // Attempt to detect if a request was aborted + // Only works if the transport exposes a status property + if ('status' in $request && + ($request.status === 0 || $request.status === '0')) { + return; + } + + self.trigger('results:message', { + message: 'errorLoading' + }); + }); + + self._request = $request; + } + + if (this.ajaxOptions.delay && params.term != null) { + if (this._queryTimeout) { + window.clearTimeout(this._queryTimeout); + } + + this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay); + } else { + request(); + } + }; + + return AjaxAdapter; +}); + +S2.define('select2/data/tags',[ + 'jquery' +], function ($) { + function Tags (decorated, $element, options) { + var tags = options.get('tags'); + + var createTag = options.get('createTag'); + + if (createTag !== undefined) { + this.createTag = createTag; + } + + var insertTag = options.get('insertTag'); + + if (insertTag !== undefined) { + this.insertTag = insertTag; + } + + decorated.call(this, $element, options); + + if ($.isArray(tags)) { + for (var t = 0; t < tags.length; t++) { + var tag = tags[t]; + var item = this._normalizeItem(tag); + + var $option = this.option(item); + + this.$element.append($option); + } + } + } + + Tags.prototype.query = function (decorated, params, callback) { + var self = this; + + this._removeOldTags(); + + if (params.term == null || params.page != null) { + decorated.call(this, params, callback); + return; + } + + function wrapper (obj, child) { + var data = obj.results; + + for (var i = 0; i < data.length; i++) { + var option = data[i]; + + var checkChildren = ( + option.children != null && + !wrapper({ + results: option.children + }, true) + ); + + var optionText = (option.text || '').toUpperCase(); + var paramsTerm = (params.term || '').toUpperCase(); + + var checkText = optionText === paramsTerm; + + if (checkText || checkChildren) { + if (child) { + return false; + } + + obj.data = data; + callback(obj); + + return; + } + } + + if (child) { + return true; + } + + var tag = self.createTag(params); + + if (tag != null) { + var $option = self.option(tag); + $option.attr('data-select2-tag', true); + + self.addOptions([$option]); + + self.insertTag(data, tag); + } + + obj.results = data; + + callback(obj); + } + + decorated.call(this, params, wrapper); + }; + + Tags.prototype.createTag = function (decorated, params) { + var term = $.trim(params.term); + + if (term === '') { + return null; + } + + return { + id: term, + text: term + }; + }; + + Tags.prototype.insertTag = function (_, data, tag) { + data.unshift(tag); + }; + + Tags.prototype._removeOldTags = function (_) { + var $options = this.$element.find('option[data-select2-tag]'); + + $options.each(function () { + if (this.selected) { + return; + } + + $(this).remove(); + }); + }; + + return Tags; +}); + +S2.define('select2/data/tokenizer',[ + 'jquery' +], function ($) { + function Tokenizer (decorated, $element, options) { + var tokenizer = options.get('tokenizer'); + + if (tokenizer !== undefined) { + this.tokenizer = tokenizer; + } + + decorated.call(this, $element, options); + } + + Tokenizer.prototype.bind = function (decorated, container, $container) { + decorated.call(this, container, $container); + + this.$search = container.dropdown.$search || container.selection.$search || + $container.find('.select2-search__field'); + }; + + Tokenizer.prototype.query = function (decorated, params, callback) { + var self = this; + + function createAndSelect (data) { + // Normalize the data object so we can use it for checks + var item = self._normalizeItem(data); + + // Check if the data object already exists as a tag + // Select it if it doesn't + var $existingOptions = self.$element.find('option').filter(function () { + return $(this).val() === item.id; + }); + + // If an existing option wasn't found for it, create the option + if (!$existingOptions.length) { + var $option = self.option(item); + $option.attr('data-select2-tag', true); + + self._removeOldTags(); + self.addOptions([$option]); + } + + // Select the item, now that we know there is an option for it + select(item); + } + + function select (data) { + self.trigger('select', { + data: data + }); + } + + params.term = params.term || ''; + + var tokenData = this.tokenizer(params, this.options, createAndSelect); + + if (tokenData.term !== params.term) { + // Replace the search term if we have the search box + if (this.$search.length) { + this.$search.val(tokenData.term); + this.$search.trigger('focus'); + } + + params.term = tokenData.term; + } + + decorated.call(this, params, callback); + }; + + Tokenizer.prototype.tokenizer = function (_, params, options, callback) { + var separators = options.get('tokenSeparators') || []; + var term = params.term; + var i = 0; + + var createTag = this.createTag || function (params) { + return { + id: params.term, + text: params.term + }; + }; + + while (i < term.length) { + var termChar = term[i]; + + if ($.inArray(termChar, separators) === -1) { + i++; + + continue; + } + + var part = term.substr(0, i); + var partParams = $.extend({}, params, { + term: part + }); + + var data = createTag(partParams); + + if (data == null) { + i++; + continue; + } + + callback(data); + + // Reset the term to not include the tokenized portion + term = term.substr(i + 1) || ''; + i = 0; + } + + return { + term: term + }; + }; + + return Tokenizer; +}); + +S2.define('select2/data/minimumInputLength',[ + +], function () { + function MinimumInputLength (decorated, $e, options) { + this.minimumInputLength = options.get('minimumInputLength'); + + decorated.call(this, $e, options); + } + + MinimumInputLength.prototype.query = function (decorated, params, callback) { + params.term = params.term || ''; + + if (params.term.length < this.minimumInputLength) { + this.trigger('results:message', { + message: 'inputTooShort', + args: { + minimum: this.minimumInputLength, + input: params.term, + params: params + } + }); + + return; + } + + decorated.call(this, params, callback); + }; + + return MinimumInputLength; +}); + +S2.define('select2/data/maximumInputLength',[ + +], function () { + function MaximumInputLength (decorated, $e, options) { + this.maximumInputLength = options.get('maximumInputLength'); + + decorated.call(this, $e, options); + } + + MaximumInputLength.prototype.query = function (decorated, params, callback) { + params.term = params.term || ''; + + if (this.maximumInputLength > 0 && + params.term.length > this.maximumInputLength) { + this.trigger('results:message', { + message: 'inputTooLong', + args: { + maximum: this.maximumInputLength, + input: params.term, + params: params + } + }); + + return; + } + + decorated.call(this, params, callback); + }; + + return MaximumInputLength; +}); + +S2.define('select2/data/maximumSelectionLength',[ + +], function (){ + function MaximumSelectionLength (decorated, $e, options) { + this.maximumSelectionLength = options.get('maximumSelectionLength'); + + decorated.call(this, $e, options); + } + + MaximumSelectionLength.prototype.bind = + function (decorated, container, $container) { + var self = this; + + decorated.call(this, container, $container); + + container.on('select', function () { + self._checkIfMaximumSelected(); + }); + }; + + MaximumSelectionLength.prototype.query = + function (decorated, params, callback) { + var self = this; + + this._checkIfMaximumSelected(function () { + decorated.call(self, params, callback); + }); + }; + + MaximumSelectionLength.prototype._checkIfMaximumSelected = + function (_, successCallback) { + var self = this; + + this.current(function (currentData) { + var count = currentData != null ? currentData.length : 0; + if (self.maximumSelectionLength > 0 && + count >= self.maximumSelectionLength) { + self.trigger('results:message', { + message: 'maximumSelected', + args: { + maximum: self.maximumSelectionLength + } + }); + return; + } + + if (successCallback) { + successCallback(); + } + }); + }; + + return MaximumSelectionLength; +}); + +S2.define('select2/dropdown',[ + 'jquery', + './utils' +], function ($, Utils) { + function Dropdown ($element, options) { + this.$element = $element; + this.options = options; + + Dropdown.__super__.constructor.call(this); + } + + Utils.Extend(Dropdown, Utils.Observable); + + Dropdown.prototype.render = function () { + var $dropdown = $( + '<span class="select2-dropdown">' + + '<span class="select2-results"></span>' + + '</span>' + ); + + $dropdown.attr('dir', this.options.get('dir')); + + this.$dropdown = $dropdown; + + return $dropdown; + }; + + Dropdown.prototype.bind = function () { + // Should be implemented in subclasses + }; + + Dropdown.prototype.position = function ($dropdown, $container) { + // Should be implemented in subclasses + }; + + Dropdown.prototype.destroy = function () { + // Remove the dropdown from the DOM + this.$dropdown.remove(); + }; + + return Dropdown; +}); + +S2.define('select2/dropdown/search',[ + 'jquery', + '../utils' +], function ($, Utils) { + function Search () { } + + Search.prototype.render = function (decorated) { + var $rendered = decorated.call(this); + + var $search = $( + '<span class="select2-search select2-search--dropdown">' + + '<input class="select2-search__field" type="search" tabindex="-1"' + + ' autocomplete="off" autocorrect="off" autocapitalize="none"' + + ' spellcheck="false" role="searchbox" aria-autocomplete="list" />' + + '</span>' + ); + + this.$searchContainer = $search; + this.$search = $search.find('input'); + + $rendered.prepend($search); + + return $rendered; + }; + + Search.prototype.bind = function (decorated, container, $container) { + var self = this; + + var resultsId = container.id + '-results'; + + decorated.call(this, container, $container); + + this.$search.on('keydown', function (evt) { + self.trigger('keypress', evt); + + self._keyUpPrevented = evt.isDefaultPrevented(); + }); + + // Workaround for browsers which do not support the `input` event + // This will prevent double-triggering of events for browsers which support + // both the `keyup` and `input` events. + this.$search.on('input', function (evt) { + // Unbind the duplicated `keyup` event + $(this).off('keyup'); + }); + + this.$search.on('keyup input', function (evt) { + self.handleSearch(evt); + }); + + container.on('open', function () { + self.$search.attr('tabindex', 0); + self.$search.attr('aria-controls', resultsId); + + self.$search.trigger('focus'); + + window.setTimeout(function () { + self.$search.trigger('focus'); + }, 0); + }); + + container.on('close', function () { + self.$search.attr('tabindex', -1); + self.$search.removeAttr('aria-controls'); + self.$search.removeAttr('aria-activedescendant'); + + self.$search.val(''); + self.$search.trigger('blur'); + }); + + container.on('focus', function () { + if (!container.isOpen()) { + self.$search.trigger('focus'); + } + }); + + container.on('results:all', function (params) { + if (params.query.term == null || params.query.term === '') { + var showSearch = self.showSearch(params); + + if (showSearch) { + self.$searchContainer.removeClass('select2-search--hide'); + } else { + self.$searchContainer.addClass('select2-search--hide'); + } + } + }); + + container.on('results:focus', function (params) { + if (params.data._resultId) { + self.$search.attr('aria-activedescendant', params.data._resultId); + } else { + self.$search.removeAttr('aria-activedescendant'); + } + }); + }; + + Search.prototype.handleSearch = function (evt) { + if (!this._keyUpPrevented) { + var input = this.$search.val(); + + this.trigger('query', { + term: input + }); + } + + this._keyUpPrevented = false; + }; + + Search.prototype.showSearch = function (_, params) { + return true; + }; + + return Search; +}); + +S2.define('select2/dropdown/hidePlaceholder',[ + +], function () { + function HidePlaceholder (decorated, $element, options, dataAdapter) { + this.placeholder = this.normalizePlaceholder(options.get('placeholder')); + + decorated.call(this, $element, options, dataAdapter); + } + + HidePlaceholder.prototype.append = function (decorated, data) { + data.results = this.removePlaceholder(data.results); + + decorated.call(this, data); + }; + + HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) { + if (typeof placeholder === 'string') { + placeholder = { + id: '', + text: placeholder + }; + } + + return placeholder; + }; + + HidePlaceholder.prototype.removePlaceholder = function (_, data) { + var modifiedData = data.slice(0); + + for (var d = data.length - 1; d >= 0; d--) { + var item = data[d]; + + if (this.placeholder.id === item.id) { + modifiedData.splice(d, 1); + } + } + + return modifiedData; + }; + + return HidePlaceholder; +}); + +S2.define('select2/dropdown/infiniteScroll',[ + 'jquery' +], function ($) { + function InfiniteScroll (decorated, $element, options, dataAdapter) { + this.lastParams = {}; + + decorated.call(this, $element, options, dataAdapter); + + this.$loadingMore = this.createLoadingMore(); + this.loading = false; + } + + InfiniteScroll.prototype.append = function (decorated, data) { + this.$loadingMore.remove(); + this.loading = false; + + decorated.call(this, data); + + if (this.showLoadingMore(data)) { + this.$results.append(this.$loadingMore); + this.loadMoreIfNeeded(); + } + }; + + InfiniteScroll.prototype.bind = function (decorated, container, $container) { + var self = this; + + decorated.call(this, container, $container); + + container.on('query', function (params) { + self.lastParams = params; + self.loading = true; + }); + + container.on('query:append', function (params) { + self.lastParams = params; + self.loading = true; + }); + + this.$results.on('scroll', this.loadMoreIfNeeded.bind(this)); + }; + + InfiniteScroll.prototype.loadMoreIfNeeded = function () { + var isLoadMoreVisible = $.contains( + document.documentElement, + this.$loadingMore[0] + ); + + if (this.loading || !isLoadMoreVisible) { + return; + } + + var currentOffset = this.$results.offset().top + + this.$results.outerHeight(false); + var loadingMoreOffset = this.$loadingMore.offset().top + + this.$loadingMore.outerHeight(false); + + if (currentOffset + 50 >= loadingMoreOffset) { + this.loadMore(); + } + }; + + InfiniteScroll.prototype.loadMore = function () { + this.loading = true; + + var params = $.extend({}, {page: 1}, this.lastParams); + + params.page++; + + this.trigger('query:append', params); + }; + + InfiniteScroll.prototype.showLoadingMore = function (_, data) { + return data.pagination && data.pagination.more; + }; + + InfiniteScroll.prototype.createLoadingMore = function () { + var $option = $( + '<li ' + + 'class="select2-results__option select2-results__option--load-more"' + + 'role="option" aria-disabled="true"></li>' + ); + + var message = this.options.get('translations').get('loadingMore'); + + $option.html(message(this.lastParams)); + + return $option; + }; + + return InfiniteScroll; +}); + +S2.define('select2/dropdown/attachBody',[ + 'jquery', + '../utils' +], function ($, Utils) { + function AttachBody (decorated, $element, options) { + this.$dropdownParent = $(options.get('dropdownParent') || document.body); + + decorated.call(this, $element, options); + } + + AttachBody.prototype.bind = function (decorated, container, $container) { + var self = this; + + decorated.call(this, container, $container); + + container.on('open', function () { + self._showDropdown(); + self._attachPositioningHandler(container); + + // Must bind after the results handlers to ensure correct sizing + self._bindContainerResultHandlers(container); + }); + + container.on('close', function () { + self._hideDropdown(); + self._detachPositioningHandler(container); + }); + + this.$dropdownContainer.on('mousedown', function (evt) { + evt.stopPropagation(); + }); + }; + + AttachBody.prototype.destroy = function (decorated) { + decorated.call(this); + + this.$dropdownContainer.remove(); + }; + + AttachBody.prototype.position = function (decorated, $dropdown, $container) { + // Clone all of the container classes + $dropdown.attr('class', $container.attr('class')); + + $dropdown.removeClass('select2'); + $dropdown.addClass('select2-container--open'); + + $dropdown.css({ + position: 'absolute', + top: -999999 + }); + + this.$container = $container; + }; + + AttachBody.prototype.render = function (decorated) { + var $container = $('<span></span>'); + + var $dropdown = decorated.call(this); + $container.append($dropdown); + + this.$dropdownContainer = $container; + + return $container; + }; + + AttachBody.prototype._hideDropdown = function (decorated) { + this.$dropdownContainer.detach(); + }; + + AttachBody.prototype._bindContainerResultHandlers = + function (decorated, container) { + + // These should only be bound once + if (this._containerResultsHandlersBound) { + return; + } + + var self = this; + + container.on('results:all', function () { + self._positionDropdown(); + self._resizeDropdown(); + }); + + container.on('results:append', function () { + self._positionDropdown(); + self._resizeDropdown(); + }); + + container.on('results:message', function () { + self._positionDropdown(); + self._resizeDropdown(); + }); + + container.on('select', function () { + self._positionDropdown(); + self._resizeDropdown(); + }); + + container.on('unselect', function () { + self._positionDropdown(); + self._resizeDropdown(); + }); + + this._containerResultsHandlersBound = true; + }; + + AttachBody.prototype._attachPositioningHandler = + function (decorated, container) { + var self = this; + + var scrollEvent = 'scroll.select2.' + container.id; + var resizeEvent = 'resize.select2.' + container.id; + var orientationEvent = 'orientationchange.select2.' + container.id; + + var $watchers = this.$container.parents().filter(Utils.hasScroll); + $watchers.each(function () { + Utils.StoreData(this, 'select2-scroll-position', { + x: $(this).scrollLeft(), + y: $(this).scrollTop() + }); + }); + + $watchers.on(scrollEvent, function (ev) { + var position = Utils.GetData(this, 'select2-scroll-position'); + $(this).scrollTop(position.y); + }); + + $(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent, + function (e) { + self._positionDropdown(); + self._resizeDropdown(); + }); + }; + + AttachBody.prototype._detachPositioningHandler = + function (decorated, container) { + var scrollEvent = 'scroll.select2.' + container.id; + var resizeEvent = 'resize.select2.' + container.id; + var orientationEvent = 'orientationchange.select2.' + container.id; + + var $watchers = this.$container.parents().filter(Utils.hasScroll); + $watchers.off(scrollEvent); + + $(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent); + }; + + AttachBody.prototype._positionDropdown = function () { + var $window = $(window); + + var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above'); + var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below'); + + var newDirection = null; + + var offset = this.$container.offset(); + + offset.bottom = offset.top + this.$container.outerHeight(false); + + var container = { + height: this.$container.outerHeight(false) + }; + + container.top = offset.top; + container.bottom = offset.top + container.height; + + var dropdown = { + height: this.$dropdown.outerHeight(false) + }; + + var viewport = { + top: $window.scrollTop(), + bottom: $window.scrollTop() + $window.height() + }; + + var enoughRoomAbove = viewport.top < (offset.top - dropdown.height); + var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height); + + var css = { + left: offset.left, + top: container.bottom + }; + + // Determine what the parent element is to use for calculating the offset + var $offsetParent = this.$dropdownParent; + + // For statically positioned elements, we need to get the element + // that is determining the offset + if ($offsetParent.css('position') === 'static') { + $offsetParent = $offsetParent.offsetParent(); + } + + var parentOffset = { + top: 0, + left: 0 + }; + + if ( + $.contains(document.body, $offsetParent[0]) || + $offsetParent[0].isConnected + ) { + parentOffset = $offsetParent.offset(); + } + + css.top -= parentOffset.top; + css.left -= parentOffset.left; + + if (!isCurrentlyAbove && !isCurrentlyBelow) { + newDirection = 'below'; + } + + if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) { + newDirection = 'above'; + } else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) { + newDirection = 'below'; + } + + if (newDirection == 'above' || + (isCurrentlyAbove && newDirection !== 'below')) { + css.top = container.top - parentOffset.top - dropdown.height; + } + + if (newDirection != null) { + this.$dropdown + .removeClass('select2-dropdown--below select2-dropdown--above') + .addClass('select2-dropdown--' + newDirection); + this.$container + .removeClass('select2-container--below select2-container--above') + .addClass('select2-container--' + newDirection); + } + + this.$dropdownContainer.css(css); + }; + + AttachBody.prototype._resizeDropdown = function () { + var css = { + width: this.$container.outerWidth(false) + 'px' + }; + + if (this.options.get('dropdownAutoWidth')) { + css.minWidth = css.width; + css.position = 'relative'; + css.width = 'auto'; + } + + this.$dropdown.css(css); + }; + + AttachBody.prototype._showDropdown = function (decorated) { + this.$dropdownContainer.appendTo(this.$dropdownParent); + + this._positionDropdown(); + this._resizeDropdown(); + }; + + return AttachBody; +}); + +S2.define('select2/dropdown/minimumResultsForSearch',[ + +], function () { + function countResults (data) { + var count = 0; + + for (var d = 0; d < data.length; d++) { + var item = data[d]; + + if (item.children) { + count += countResults(item.children); + } else { + count++; + } + } + + return count; + } + + function MinimumResultsForSearch (decorated, $element, options, dataAdapter) { + this.minimumResultsForSearch = options.get('minimumResultsForSearch'); + + if (this.minimumResultsForSearch < 0) { + this.minimumResultsForSearch = Infinity; + } + + decorated.call(this, $element, options, dataAdapter); + } + + MinimumResultsForSearch.prototype.showSearch = function (decorated, params) { + if (countResults(params.data.results) < this.minimumResultsForSearch) { + return false; + } + + return decorated.call(this, params); + }; + + return MinimumResultsForSearch; +}); + +S2.define('select2/dropdown/selectOnClose',[ + '../utils' +], function (Utils) { + function SelectOnClose () { } + + SelectOnClose.prototype.bind = function (decorated, container, $container) { + var self = this; + + decorated.call(this, container, $container); + + container.on('close', function (params) { + self._handleSelectOnClose(params); + }); + }; + + SelectOnClose.prototype._handleSelectOnClose = function (_, params) { + if (params && params.originalSelect2Event != null) { + var event = params.originalSelect2Event; + + // Don't select an item if the close event was triggered from a select or + // unselect event + if (event._type === 'select' || event._type === 'unselect') { + return; + } + } + + var $highlightedResults = this.getHighlightedResults(); + + // Only select highlighted results + if ($highlightedResults.length < 1) { + return; + } + + var data = Utils.GetData($highlightedResults[0], 'data'); + + // Don't re-select already selected resulte + if ( + (data.element != null && data.element.selected) || + (data.element == null && data.selected) + ) { + return; + } + + this.trigger('select', { + data: data + }); + }; + + return SelectOnClose; +}); + +S2.define('select2/dropdown/closeOnSelect',[ + +], function () { + function CloseOnSelect () { } + + CloseOnSelect.prototype.bind = function (decorated, container, $container) { + var self = this; + + decorated.call(this, container, $container); + + container.on('select', function (evt) { + self._selectTriggered(evt); + }); + + container.on('unselect', function (evt) { + self._selectTriggered(evt); + }); + }; + + CloseOnSelect.prototype._selectTriggered = function (_, evt) { + var originalEvent = evt.originalEvent; + + // Don't close if the control key is being held + if (originalEvent && (originalEvent.ctrlKey || originalEvent.metaKey)) { + return; + } + + this.trigger('close', { + originalEvent: originalEvent, + originalSelect2Event: evt + }); + }; + + return CloseOnSelect; +}); + +S2.define('select2/i18n/en',[],function () { + // English + return { + errorLoading: function () { + return 'The results could not be loaded.'; + }, + inputTooLong: function (args) { + var overChars = args.input.length - args.maximum; + + var message = 'Please delete ' + overChars + ' character'; + + if (overChars != 1) { + message += 's'; + } + + return message; + }, + inputTooShort: function (args) { + var remainingChars = args.minimum - args.input.length; + + var message = 'Please enter ' + remainingChars + ' or more characters'; + + return message; + }, + loadingMore: function () { + return 'Loading more results…'; + }, + maximumSelected: function (args) { + var message = 'You can only select ' + args.maximum + ' item'; + + if (args.maximum != 1) { + message += 's'; + } + + return message; + }, + noResults: function () { + return 'No results found'; + }, + searching: function () { + return 'Searching…'; + }, + removeAllItems: function () { + return 'Remove all items'; + } + }; +}); + +S2.define('select2/defaults',[ + 'jquery', + 'require', + + './results', + + './selection/single', + './selection/multiple', + './selection/placeholder', + './selection/allowClear', + './selection/search', + './selection/eventRelay', + + './utils', + './translation', + './diacritics', + + './data/select', + './data/array', + './data/ajax', + './data/tags', + './data/tokenizer', + './data/minimumInputLength', + './data/maximumInputLength', + './data/maximumSelectionLength', + + './dropdown', + './dropdown/search', + './dropdown/hidePlaceholder', + './dropdown/infiniteScroll', + './dropdown/attachBody', + './dropdown/minimumResultsForSearch', + './dropdown/selectOnClose', + './dropdown/closeOnSelect', + + './i18n/en' +], function ($, require, + + ResultsList, + + SingleSelection, MultipleSelection, Placeholder, AllowClear, + SelectionSearch, EventRelay, + + Utils, Translation, DIACRITICS, + + SelectData, ArrayData, AjaxData, Tags, Tokenizer, + MinimumInputLength, MaximumInputLength, MaximumSelectionLength, + + Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll, + AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect, + + EnglishTranslation) { + function Defaults () { + this.reset(); + } + + Defaults.prototype.apply = function (options) { + options = $.extend(true, {}, this.defaults, options); + + if (options.dataAdapter == null) { + if (options.ajax != null) { + options.dataAdapter = AjaxData; + } else if (options.data != null) { + options.dataAdapter = ArrayData; + } else { + options.dataAdapter = SelectData; + } + + if (options.minimumInputLength > 0) { + options.dataAdapter = Utils.Decorate( + options.dataAdapter, + MinimumInputLength + ); + } + + if (options.maximumInputLength > 0) { + options.dataAdapter = Utils.Decorate( + options.dataAdapter, + MaximumInputLength + ); + } + + if (options.maximumSelectionLength > 0) { + options.dataAdapter = Utils.Decorate( + options.dataAdapter, + MaximumSelectionLength + ); + } + + if (options.tags) { + options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags); + } + + if (options.tokenSeparators != null || options.tokenizer != null) { + options.dataAdapter = Utils.Decorate( + options.dataAdapter, + Tokenizer + ); + } + + if (options.query != null) { + var Query = require(options.amdBase + 'compat/query'); + + options.dataAdapter = Utils.Decorate( + options.dataAdapter, + Query + ); + } + + if (options.initSelection != null) { + var InitSelection = require(options.amdBase + 'compat/initSelection'); + + options.dataAdapter = Utils.Decorate( + options.dataAdapter, + InitSelection + ); + } + } + + if (options.resultsAdapter == null) { + options.resultsAdapter = ResultsList; + + if (options.ajax != null) { + options.resultsAdapter = Utils.Decorate( + options.resultsAdapter, + InfiniteScroll + ); + } + + if (options.placeholder != null) { + options.resultsAdapter = Utils.Decorate( + options.resultsAdapter, + HidePlaceholder + ); + } + + if (options.selectOnClose) { + options.resultsAdapter = Utils.Decorate( + options.resultsAdapter, + SelectOnClose + ); + } + } + + if (options.dropdownAdapter == null) { + if (options.multiple) { + options.dropdownAdapter = Dropdown; + } else { + var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch); + + options.dropdownAdapter = SearchableDropdown; + } + + if (options.minimumResultsForSearch !== 0) { + options.dropdownAdapter = Utils.Decorate( + options.dropdownAdapter, + MinimumResultsForSearch + ); + } + + if (options.closeOnSelect) { + options.dropdownAdapter = Utils.Decorate( + options.dropdownAdapter, + CloseOnSelect + ); + } + + if ( + options.dropdownCssClass != null || + options.dropdownCss != null || + options.adaptDropdownCssClass != null + ) { + var DropdownCSS = require(options.amdBase + 'compat/dropdownCss'); + + options.dropdownAdapter = Utils.Decorate( + options.dropdownAdapter, + DropdownCSS + ); + } + + options.dropdownAdapter = Utils.Decorate( + options.dropdownAdapter, + AttachBody + ); + } + + if (options.selectionAdapter == null) { + if (options.multiple) { + options.selectionAdapter = MultipleSelection; + } else { + options.selectionAdapter = SingleSelection; + } + + // Add the placeholder mixin if a placeholder was specified + if (options.placeholder != null) { + options.selectionAdapter = Utils.Decorate( + options.selectionAdapter, + Placeholder + ); + } + + if (options.allowClear) { + options.selectionAdapter = Utils.Decorate( + options.selectionAdapter, + AllowClear + ); + } + + if (options.multiple) { + options.selectionAdapter = Utils.Decorate( + options.selectionAdapter, + SelectionSearch + ); + } + + if ( + options.containerCssClass != null || + options.containerCss != null || + options.adaptContainerCssClass != null + ) { + var ContainerCSS = require(options.amdBase + 'compat/containerCss'); + + options.selectionAdapter = Utils.Decorate( + options.selectionAdapter, + ContainerCSS + ); + } + + options.selectionAdapter = Utils.Decorate( + options.selectionAdapter, + EventRelay + ); + } + + // If the defaults were not previously applied from an element, it is + // possible for the language option to have not been resolved + options.language = this._resolveLanguage(options.language); + + // Always fall back to English since it will always be complete + options.language.push('en'); + + var uniqueLanguages = []; + + for (var l = 0; l < options.language.length; l++) { + var language = options.language[l]; + + if (uniqueLanguages.indexOf(language) === -1) { + uniqueLanguages.push(language); + } + } + + options.language = uniqueLanguages; + + options.translations = this._processTranslations( + options.language, + options.debug + ); + + return options; + }; + + Defaults.prototype.reset = function () { + function stripDiacritics (text) { + // Used 'uni range + named function' from http://jsperf.com/diacritics/18 + function match(a) { + return DIACRITICS[a] || a; + } + + return text.replace(/[^\u0000-\u007E]/g, match); + } + + function matcher (params, data) { + // Always return the object if there is nothing to compare + if ($.trim(params.term) === '') { + return data; + } + + // Do a recursive check for options with children + if (data.children && data.children.length > 0) { + // Clone the data object if there are children + // This is required as we modify the object to remove any non-matches + var match = $.extend(true, {}, data); + + // Check each child of the option + for (var c = data.children.length - 1; c >= 0; c--) { + var child = data.children[c]; + + var matches = matcher(params, child); + + // If there wasn't a match, remove the object in the array + if (matches == null) { + match.children.splice(c, 1); + } + } + + // If any children matched, return the new object + if (match.children.length > 0) { + return match; + } + + // If there were no matching children, check just the plain object + return matcher(params, match); + } + + var original = stripDiacritics(data.text).toUpperCase(); + var term = stripDiacritics(params.term).toUpperCase(); + + // Check if the text contains the term + if (original.indexOf(term) > -1) { + return data; + } + + // If it doesn't contain the term, don't return anything + return null; + } + + this.defaults = { + amdBase: './', + amdLanguageBase: './i18n/', + closeOnSelect: true, + debug: false, + dropdownAutoWidth: false, + escapeMarkup: Utils.escapeMarkup, + language: {}, + matcher: matcher, + minimumInputLength: 0, + maximumInputLength: 0, + maximumSelectionLength: 0, + minimumResultsForSearch: 0, + selectOnClose: false, + scrollAfterSelect: false, + sorter: function (data) { + return data; + }, + templateResult: function (result) { + return result.text; + }, + templateSelection: function (selection) { + return selection.text; + }, + theme: 'default', + width: 'resolve' + }; + }; + + Defaults.prototype.applyFromElement = function (options, $element) { + var optionLanguage = options.language; + var defaultLanguage = this.defaults.language; + var elementLanguage = $element.prop('lang'); + var parentLanguage = $element.closest('[lang]').prop('lang'); + + var languages = Array.prototype.concat.call( + this._resolveLanguage(elementLanguage), + this._resolveLanguage(optionLanguage), + this._resolveLanguage(defaultLanguage), + this._resolveLanguage(parentLanguage) + ); + + options.language = languages; + + return options; + }; + + Defaults.prototype._resolveLanguage = function (language) { + if (!language) { + return []; + } + + if ($.isEmptyObject(language)) { + return []; + } + + if ($.isPlainObject(language)) { + return [language]; + } + + var languages; + + if (!$.isArray(language)) { + languages = [language]; + } else { + languages = language; + } + + var resolvedLanguages = []; + + for (var l = 0; l < languages.length; l++) { + resolvedLanguages.push(languages[l]); + + if (typeof languages[l] === 'string' && languages[l].indexOf('-') > 0) { + // Extract the region information if it is included + var languageParts = languages[l].split('-'); + var baseLanguage = languageParts[0]; + + resolvedLanguages.push(baseLanguage); + } + } + + return resolvedLanguages; + }; + + Defaults.prototype._processTranslations = function (languages, debug) { + var translations = new Translation(); + + for (var l = 0; l < languages.length; l++) { + var languageData = new Translation(); + + var language = languages[l]; + + if (typeof language === 'string') { + try { + // Try to load it with the original name + languageData = Translation.loadPath(language); + } catch (e) { + try { + // If we couldn't load it, check if it wasn't the full path + language = this.defaults.amdLanguageBase + language; + languageData = Translation.loadPath(language); + } catch (ex) { + // The translation could not be loaded at all. Sometimes this is + // because of a configuration problem, other times this can be + // because of how Select2 helps load all possible translation files + if (debug && window.console && console.warn) { + console.warn( + 'Select2: The language file for "' + language + '" could ' + + 'not be automatically loaded. A fallback will be used instead.' + ); + } + } + } + } else if ($.isPlainObject(language)) { + languageData = new Translation(language); + } else { + languageData = language; + } + + translations.extend(languageData); + } + + return translations; + }; + + Defaults.prototype.set = function (key, value) { + var camelKey = $.camelCase(key); + + var data = {}; + data[camelKey] = value; + + var convertedData = Utils._convertData(data); + + $.extend(true, this.defaults, convertedData); + }; + + var defaults = new Defaults(); + + return defaults; +}); + +S2.define('select2/options',[ + 'require', + 'jquery', + './defaults', + './utils' +], function (require, $, Defaults, Utils) { + function Options (options, $element) { + this.options = options; + + if ($element != null) { + this.fromElement($element); + } + + if ($element != null) { + this.options = Defaults.applyFromElement(this.options, $element); + } + + this.options = Defaults.apply(this.options); + + if ($element && $element.is('input')) { + var InputCompat = require(this.get('amdBase') + 'compat/inputData'); + + this.options.dataAdapter = Utils.Decorate( + this.options.dataAdapter, + InputCompat + ); + } + } + + Options.prototype.fromElement = function ($e) { + var excludedData = ['select2']; + + if (this.options.multiple == null) { + this.options.multiple = $e.prop('multiple'); + } + + if (this.options.disabled == null) { + this.options.disabled = $e.prop('disabled'); + } + + if (this.options.dir == null) { + if ($e.prop('dir')) { + this.options.dir = $e.prop('dir'); + } else if ($e.closest('[dir]').prop('dir')) { + this.options.dir = $e.closest('[dir]').prop('dir'); + } else { + this.options.dir = 'ltr'; + } + } + + $e.prop('disabled', this.options.disabled); + $e.prop('multiple', this.options.multiple); + + if (Utils.GetData($e[0], 'select2Tags')) { + if (this.options.debug && window.console && console.warn) { + console.warn( + 'Select2: The `data-select2-tags` attribute has been changed to ' + + 'use the `data-data` and `data-tags="true"` attributes and will be ' + + 'removed in future versions of Select2.' + ); + } + + Utils.StoreData($e[0], 'data', Utils.GetData($e[0], 'select2Tags')); + Utils.StoreData($e[0], 'tags', true); + } + + if (Utils.GetData($e[0], 'ajaxUrl')) { + if (this.options.debug && window.console && console.warn) { + console.warn( + 'Select2: The `data-ajax-url` attribute has been changed to ' + + '`data-ajax--url` and support for the old attribute will be removed' + + ' in future versions of Select2.' + ); + } + + $e.attr('ajax--url', Utils.GetData($e[0], 'ajaxUrl')); + Utils.StoreData($e[0], 'ajax-Url', Utils.GetData($e[0], 'ajaxUrl')); + } + + var dataset = {}; + + function upperCaseLetter(_, letter) { + return letter.toUpperCase(); + } + + // Pre-load all of the attributes which are prefixed with `data-` + for (var attr = 0; attr < $e[0].attributes.length; attr++) { + var attributeName = $e[0].attributes[attr].name; + var prefix = 'data-'; + + if (attributeName.substr(0, prefix.length) == prefix) { + // Get the contents of the attribute after `data-` + var dataName = attributeName.substring(prefix.length); + + // Get the data contents from the consistent source + // This is more than likely the jQuery data helper + var dataValue = Utils.GetData($e[0], dataName); + + // camelCase the attribute name to match the spec + var camelDataName = dataName.replace(/-([a-z])/g, upperCaseLetter); + + // Store the data attribute contents into the dataset since + dataset[camelDataName] = dataValue; + } + } + + // Prefer the element's `dataset` attribute if it exists + // jQuery 1.x does not correctly handle data attributes with multiple dashes + if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) { + dataset = $.extend(true, {}, $e[0].dataset, dataset); + } + + // Prefer our internal data cache if it exists + var data = $.extend(true, {}, Utils.GetData($e[0]), dataset); + + data = Utils._convertData(data); + + for (var key in data) { + if ($.inArray(key, excludedData) > -1) { + continue; + } + + if ($.isPlainObject(this.options[key])) { + $.extend(this.options[key], data[key]); + } else { + this.options[key] = data[key]; + } + } + + return this; + }; + + Options.prototype.get = function (key) { + return this.options[key]; + }; + + Options.prototype.set = function (key, val) { + this.options[key] = val; + }; + + return Options; +}); + +S2.define('select2/core',[ + 'jquery', + './options', + './utils', + './keys' +], function ($, Options, Utils, KEYS) { + var Select2 = function ($element, options) { + if (Utils.GetData($element[0], 'select2') != null) { + Utils.GetData($element[0], 'select2').destroy(); + } + + this.$element = $element; + + this.id = this._generateId($element); + + options = options || {}; + + this.options = new Options(options, $element); + + Select2.__super__.constructor.call(this); + + // Set up the tabindex + + var tabindex = $element.attr('tabindex') || 0; + Utils.StoreData($element[0], 'old-tabindex', tabindex); + $element.attr('tabindex', '-1'); + + // Set up containers and adapters + + var DataAdapter = this.options.get('dataAdapter'); + this.dataAdapter = new DataAdapter($element, this.options); + + var $container = this.render(); + + this._placeContainer($container); + + var SelectionAdapter = this.options.get('selectionAdapter'); + this.selection = new SelectionAdapter($element, this.options); + this.$selection = this.selection.render(); + + this.selection.position(this.$selection, $container); + + var DropdownAdapter = this.options.get('dropdownAdapter'); + this.dropdown = new DropdownAdapter($element, this.options); + this.$dropdown = this.dropdown.render(); + + this.dropdown.position(this.$dropdown, $container); + + var ResultsAdapter = this.options.get('resultsAdapter'); + this.results = new ResultsAdapter($element, this.options, this.dataAdapter); + this.$results = this.results.render(); + + this.results.position(this.$results, this.$dropdown); + + // Bind events + + var self = this; + + // Bind the container to all of the adapters + this._bindAdapters(); + + // Register any DOM event handlers + this._registerDomEvents(); + + // Register any internal event handlers + this._registerDataEvents(); + this._registerSelectionEvents(); + this._registerDropdownEvents(); + this._registerResultsEvents(); + this._registerEvents(); + + // Set the initial state + this.dataAdapter.current(function (initialData) { + self.trigger('selection:update', { + data: initialData + }); + }); + + // Hide the original select + $element.addClass('select2-hidden-accessible'); + $element.attr('aria-hidden', 'true'); + + // Synchronize any monitored attributes + this._syncAttributes(); + + Utils.StoreData($element[0], 'select2', this); + + // Ensure backwards compatibility with $element.data('select2'). + $element.data('select2', this); + }; + + Utils.Extend(Select2, Utils.Observable); + + Select2.prototype._generateId = function ($element) { + var id = ''; + + if ($element.attr('id') != null) { + id = $element.attr('id'); + } else if ($element.attr('name') != null) { + id = $element.attr('name') + '-' + Utils.generateChars(2); + } else { + id = Utils.generateChars(4); + } + + id = id.replace(/(:|\.|\[|\]|,)/g, ''); + id = 'select2-' + id; + + return id; + }; + + Select2.prototype._placeContainer = function ($container) { + $container.insertAfter(this.$element); + + var width = this._resolveWidth(this.$element, this.options.get('width')); + + if (width != null) { + $container.css('width', width); + } + }; + + Select2.prototype._resolveWidth = function ($element, method) { + var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i; + + if (method == 'resolve') { + var styleWidth = this._resolveWidth($element, 'style'); + + if (styleWidth != null) { + return styleWidth; + } + + return this._resolveWidth($element, 'element'); + } + + if (method == 'element') { + var elementWidth = $element.outerWidth(false); + + if (elementWidth <= 0) { + return 'auto'; + } + + return elementWidth + 'px'; + } + + if (method == 'style') { + var style = $element.attr('style'); + + if (typeof(style) !== 'string') { + return null; + } + + var attrs = style.split(';'); + + for (var i = 0, l = attrs.length; i < l; i = i + 1) { + var attr = attrs[i].replace(/\s/g, ''); + var matches = attr.match(WIDTH); + + if (matches !== null && matches.length >= 1) { + return matches[1]; + } + } + + return null; + } + + if (method == 'computedstyle') { + var computedStyle = window.getComputedStyle($element[0]); + + return computedStyle.width; + } + + return method; + }; + + Select2.prototype._bindAdapters = function () { + this.dataAdapter.bind(this, this.$container); + this.selection.bind(this, this.$container); + + this.dropdown.bind(this, this.$container); + this.results.bind(this, this.$container); + }; + + Select2.prototype._registerDomEvents = function () { + var self = this; + + this.$element.on('change.select2', function () { + self.dataAdapter.current(function (data) { + self.trigger('selection:update', { + data: data + }); + }); + }); + + this.$element.on('focus.select2', function (evt) { + self.trigger('focus', evt); + }); + + this._syncA = Utils.bind(this._syncAttributes, this); + this._syncS = Utils.bind(this._syncSubtree, this); + + if (this.$element[0].attachEvent) { + this.$element[0].attachEvent('onpropertychange', this._syncA); + } + + var observer = window.MutationObserver || + window.WebKitMutationObserver || + window.MozMutationObserver + ; + + if (observer != null) { + this._observer = new observer(function (mutations) { + self._syncA(); + self._syncS(null, mutations); + }); + this._observer.observe(this.$element[0], { + attributes: true, + childList: true, + subtree: false + }); + } else if (this.$element[0].addEventListener) { + this.$element[0].addEventListener( + 'DOMAttrModified', + self._syncA, + false + ); + this.$element[0].addEventListener( + 'DOMNodeInserted', + self._syncS, + false + ); + this.$element[0].addEventListener( + 'DOMNodeRemoved', + self._syncS, + false + ); + } + }; + + Select2.prototype._registerDataEvents = function () { + var self = this; + + this.dataAdapter.on('*', function (name, params) { + self.trigger(name, params); + }); + }; + + Select2.prototype._registerSelectionEvents = function () { + var self = this; + var nonRelayEvents = ['toggle', 'focus']; + + this.selection.on('toggle', function () { + self.toggleDropdown(); + }); + + this.selection.on('focus', function (params) { + self.focus(params); + }); + + this.selection.on('*', function (name, params) { + if ($.inArray(name, nonRelayEvents) !== -1) { + return; + } + + self.trigger(name, params); + }); + }; + + Select2.prototype._registerDropdownEvents = function () { + var self = this; + + this.dropdown.on('*', function (name, params) { + self.trigger(name, params); + }); + }; + + Select2.prototype._registerResultsEvents = function () { + var self = this; + + this.results.on('*', function (name, params) { + self.trigger(name, params); + }); + }; + + Select2.prototype._registerEvents = function () { + var self = this; + + this.on('open', function () { + self.$container.addClass('select2-container--open'); + }); + + this.on('close', function () { + self.$container.removeClass('select2-container--open'); + }); + + this.on('enable', function () { + self.$container.removeClass('select2-container--disabled'); + }); + + this.on('disable', function () { + self.$container.addClass('select2-container--disabled'); + }); + + this.on('blur', function () { + self.$container.removeClass('select2-container--focus'); + }); + + this.on('query', function (params) { + if (!self.isOpen()) { + self.trigger('open', {}); + } + + this.dataAdapter.query(params, function (data) { + self.trigger('results:all', { + data: data, + query: params + }); + }); + }); + + this.on('query:append', function (params) { + this.dataAdapter.query(params, function (data) { + self.trigger('results:append', { + data: data, + query: params + }); + }); + }); + + this.on('keypress', function (evt) { + var key = evt.which; + + if (self.isOpen()) { + if (key === KEYS.ESC || key === KEYS.TAB || + (key === KEYS.UP && evt.altKey)) { + self.close(evt); + + evt.preventDefault(); + } else if (key === KEYS.ENTER) { + self.trigger('results:select', {}); + + evt.preventDefault(); + } else if ((key === KEYS.SPACE && evt.ctrlKey)) { + self.trigger('results:toggle', {}); + + evt.preventDefault(); + } else if (key === KEYS.UP) { + self.trigger('results:previous', {}); + + evt.preventDefault(); + } else if (key === KEYS.DOWN) { + self.trigger('results:next', {}); + + evt.preventDefault(); + } + } else { + if (key === KEYS.ENTER || key === KEYS.SPACE || + (key === KEYS.DOWN && evt.altKey)) { + self.open(); + + evt.preventDefault(); + } + } + }); + }; + + Select2.prototype._syncAttributes = function () { + this.options.set('disabled', this.$element.prop('disabled')); + + if (this.isDisabled()) { + if (this.isOpen()) { + this.close(); + } + + this.trigger('disable', {}); + } else { + this.trigger('enable', {}); + } + }; + + Select2.prototype._isChangeMutation = function (evt, mutations) { + var changed = false; + var self = this; + + // Ignore any mutation events raised for elements that aren't options or + // optgroups. This handles the case when the select element is destroyed + if ( + evt && evt.target && ( + evt.target.nodeName !== 'OPTION' && evt.target.nodeName !== 'OPTGROUP' + ) + ) { + return; + } + + if (!mutations) { + // If mutation events aren't supported, then we can only assume that the + // change affected the selections + changed = true; + } else if (mutations.addedNodes && mutations.addedNodes.length > 0) { + for (var n = 0; n < mutations.addedNodes.length; n++) { + var node = mutations.addedNodes[n]; + + if (node.selected) { + changed = true; + } + } + } else if (mutations.removedNodes && mutations.removedNodes.length > 0) { + changed = true; + } else if ($.isArray(mutations)) { + $.each(mutations, function(evt, mutation) { + if (self._isChangeMutation(evt, mutation)) { + // We've found a change mutation. + // Let's escape from the loop and continue + changed = true; + return false; + } + }); + } + return changed; + }; + + Select2.prototype._syncSubtree = function (evt, mutations) { + var changed = this._isChangeMutation(evt, mutations); + var self = this; + + // Only re-pull the data if we think there is a change + if (changed) { + this.dataAdapter.current(function (currentData) { + self.trigger('selection:update', { + data: currentData + }); + }); + } + }; + + /** + * Override the trigger method to automatically trigger pre-events when + * there are events that can be prevented. + */ + Select2.prototype.trigger = function (name, args) { + var actualTrigger = Select2.__super__.trigger; + var preTriggerMap = { + 'open': 'opening', + 'close': 'closing', + 'select': 'selecting', + 'unselect': 'unselecting', + 'clear': 'clearing' + }; + + if (args === undefined) { + args = {}; + } + + if (name in preTriggerMap) { + var preTriggerName = preTriggerMap[name]; + var preTriggerArgs = { + prevented: false, + name: name, + args: args + }; + + actualTrigger.call(this, preTriggerName, preTriggerArgs); + + if (preTriggerArgs.prevented) { + args.prevented = true; + + return; + } + } + + actualTrigger.call(this, name, args); + }; + + Select2.prototype.toggleDropdown = function () { + if (this.isDisabled()) { + return; + } + + if (this.isOpen()) { + this.close(); + } else { + this.open(); + } + }; + + Select2.prototype.open = function () { + if (this.isOpen()) { + return; + } + + if (this.isDisabled()) { + return; + } + + this.trigger('query', {}); + }; + + Select2.prototype.close = function (evt) { + if (!this.isOpen()) { + return; + } + + this.trigger('close', { originalEvent : evt }); + }; + + /** + * Helper method to abstract the "enabled" (not "disabled") state of this + * object. + * + * @return {true} if the instance is not disabled. + * @return {false} if the instance is disabled. + */ + Select2.prototype.isEnabled = function () { + return !this.isDisabled(); + }; + + /** + * Helper method to abstract the "disabled" state of this object. + * + * @return {true} if the disabled option is true. + * @return {false} if the disabled option is false. + */ + Select2.prototype.isDisabled = function () { + return this.options.get('disabled'); + }; + + Select2.prototype.isOpen = function () { + return this.$container.hasClass('select2-container--open'); + }; + + Select2.prototype.hasFocus = function () { + return this.$container.hasClass('select2-container--focus'); + }; + + Select2.prototype.focus = function (data) { + // No need to re-trigger focus events if we are already focused + if (this.hasFocus()) { + return; + } + + this.$container.addClass('select2-container--focus'); + this.trigger('focus', {}); + }; + + Select2.prototype.enable = function (args) { + if (this.options.get('debug') && window.console && console.warn) { + console.warn( + 'Select2: The `select2("enable")` method has been deprecated and will' + + ' be removed in later Select2 versions. Use $element.prop("disabled")' + + ' instead.' + ); + } + + if (args == null || args.length === 0) { + args = [true]; + } + + var disabled = !args[0]; + + this.$element.prop('disabled', disabled); + }; + + Select2.prototype.data = function () { + if (this.options.get('debug') && + arguments.length > 0 && window.console && console.warn) { + console.warn( + 'Select2: Data can no longer be set using `select2("data")`. You ' + + 'should consider setting the value instead using `$element.val()`.' + ); + } + + var data = []; + + this.dataAdapter.current(function (currentData) { + data = currentData; + }); + + return data; + }; + + Select2.prototype.val = function (args) { + if (this.options.get('debug') && window.console && console.warn) { + console.warn( + 'Select2: The `select2("val")` method has been deprecated and will be' + + ' removed in later Select2 versions. Use $element.val() instead.' + ); + } + + if (args == null || args.length === 0) { + return this.$element.val(); + } + + var newVal = args[0]; + + if ($.isArray(newVal)) { + newVal = $.map(newVal, function (obj) { + return obj.toString(); + }); + } + + this.$element.val(newVal).trigger('input').trigger('change'); + }; + + Select2.prototype.destroy = function () { + this.$container.remove(); + + if (this.$element[0].detachEvent) { + this.$element[0].detachEvent('onpropertychange', this._syncA); + } + + if (this._observer != null) { + this._observer.disconnect(); + this._observer = null; + } else if (this.$element[0].removeEventListener) { + this.$element[0] + .removeEventListener('DOMAttrModified', this._syncA, false); + this.$element[0] + .removeEventListener('DOMNodeInserted', this._syncS, false); + this.$element[0] + .removeEventListener('DOMNodeRemoved', this._syncS, false); + } + + this._syncA = null; + this._syncS = null; + + this.$element.off('.select2'); + this.$element.attr('tabindex', + Utils.GetData(this.$element[0], 'old-tabindex')); + + this.$element.removeClass('select2-hidden-accessible'); + this.$element.attr('aria-hidden', 'false'); + Utils.RemoveData(this.$element[0]); + this.$element.removeData('select2'); + + this.dataAdapter.destroy(); + this.selection.destroy(); + this.dropdown.destroy(); + this.results.destroy(); + + this.dataAdapter = null; + this.selection = null; + this.dropdown = null; + this.results = null; + }; + + Select2.prototype.render = function () { + var $container = $( + '<span class="select2 select2-container">' + + '<span class="selection"></span>' + + '<span class="dropdown-wrapper" aria-hidden="true"></span>' + + '</span>' + ); + + $container.attr('dir', this.options.get('dir')); + + this.$container = $container; + + this.$container.addClass('select2-container--' + this.options.get('theme')); + + Utils.StoreData($container[0], 'element', this.$element); + + return $container; + }; + + return Select2; +}); + +S2.define('jquery-mousewheel',[ + 'jquery' +], function ($) { + // Used to shim jQuery.mousewheel for non-full builds. + return $; +}); + +S2.define('jquery.select2',[ + 'jquery', + 'jquery-mousewheel', + + './select2/core', + './select2/defaults', + './select2/utils' +], function ($, _, Select2, Defaults, Utils) { + if ($.fn.select2 == null) { + // All methods that should return the element + var thisMethods = ['open', 'close', 'destroy']; + + $.fn.select2 = function (options) { + options = options || {}; + + if (typeof options === 'object') { + this.each(function () { + var instanceOptions = $.extend(true, {}, options); + + var instance = new Select2($(this), instanceOptions); + }); + + return this; + } else if (typeof options === 'string') { + var ret; + var args = Array.prototype.slice.call(arguments, 1); + + this.each(function () { + var instance = Utils.GetData(this, 'select2'); + + if (instance == null && window.console && console.error) { + console.error( + 'The select2(\'' + options + '\') method was called on an ' + + 'element that is not using Select2.' + ); + } + + ret = instance[options].apply(instance, args); + }); + + // Check if we should be returning `this` + if ($.inArray(options, thisMethods) > -1) { + return this; + } + + return ret; + } else { + throw new Error('Invalid arguments for Select2: ' + options); + } + }; + } + + if ($.fn.select2.defaults == null) { + $.fn.select2.defaults = Defaults; + } + + return Select2; +}); + + // Return the AMD loader configuration so it can be used outside of this file + return { + define: S2.define, + require: S2.require + }; +}()); + + // Autoload the jQuery bindings + // We know that all of the modules exist above this, so we're safe + var select2 = S2.require('jquery.select2'); + + // Hold the AMD module references on the jQuery function that was just loaded + // This allows Select2 to use the internal loader outside of this file, such + // as in the language files. + jQuery.fn.select2.amd = S2; + + // Return the Select2 instance for anyone who is importing it. + return select2; +})); diff --git a/static_common/common/vendor/select2/select2.min.js b/static_common/common/vendor/select2/select2.min.js index b073e95d..e4214264 100644 --- a/static_common/common/vendor/select2/select2.min.js +++ b/static_common/common/vendor/select2/select2.min.js @@ -1,2 +1,2 @@ /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ -!function(n){"function"==typeof define&&define.amd?define(["jquery"],n):"object"==typeof module&&module.exports?module.exports=function(e,t){return void 0===t&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),n(t),t}:n(jQuery)}(function(u){var e=function(){if(u&&u.fn&&u.fn.select2&&u.fn.select2.amd)var e=u.fn.select2.amd;var t,n,r,h,o,s,f,g,m,v,y,_,i,a,b;function w(e,t){return i.call(e,t)}function l(e,t){var n,r,i,o,s,a,l,c,u,d,p,h=t&&t.split("/"),f=y.map,g=f&&f["*"]||{};if(e){for(s=(e=e.split("/")).length-1,y.nodeIdCompat&&b.test(e[s])&&(e[s]=e[s].replace(b,"")),"."===e[0].charAt(0)&&h&&(e=h.slice(0,h.length-1).concat(e)),u=0;u<e.length;u++)if("."===(p=e[u]))e.splice(u,1),--u;else if(".."===p){if(0===u||1===u&&".."===e[2]||".."===e[u-1])continue;0<u&&(e.splice(u-1,2),u-=2)}e=e.join("/")}if((h||g)&&f){for(u=(n=e.split("/")).length;0<u;--u){if(r=n.slice(0,u).join("/"),h)for(d=h.length;0<d;--d)if(i=(i=f[h.slice(0,d).join("/")])&&i[r]){o=i,a=u;break}if(o)break;!l&&g&&g[r]&&(l=g[r],c=u)}!o&&l&&(o=l,a=c),o&&(n.splice(0,a,o),e=n.join("/"))}return e}function A(t,n){return function(){var e=a.call(arguments,0);return"string"!=typeof e[0]&&1===e.length&&e.push(null),s.apply(h,e.concat([t,n]))}}function x(t){return function(e){m[t]=e}}function D(e){if(w(v,e)){var t=v[e];delete v[e],_[e]=!0,o.apply(h,t)}if(!w(m,e)&&!w(_,e))throw new Error("No "+e);return m[e]}function c(e){var t,n=e?e.indexOf("!"):-1;return-1<n&&(t=e.substring(0,n),e=e.substring(n+1,e.length)),[t,e]}function S(e){return e?c(e):[]}return e&&e.requirejs||(e?n=e:e={},m={},v={},y={},_={},i=Object.prototype.hasOwnProperty,a=[].slice,b=/\.js$/,f=function(e,t){var n,r,i=c(e),o=i[0],s=t[1];return e=i[1],o&&(n=D(o=l(o,s))),o?e=n&&n.normalize?n.normalize(e,(r=s,function(e){return l(e,r)})):l(e,s):(o=(i=c(e=l(e,s)))[0],e=i[1],o&&(n=D(o))),{f:o?o+"!"+e:e,n:e,pr:o,p:n}},g={require:function(e){return A(e)},exports:function(e){var t=m[e];return void 0!==t?t:m[e]={}},module:function(e){return{id:e,uri:"",exports:m[e],config:(t=e,function(){return y&&y.config&&y.config[t]||{}})};var t}},o=function(e,t,n,r){var i,o,s,a,l,c,u,d=[],p=typeof n;if(c=S(r=r||e),"undefined"==p||"function"==p){for(t=!t.length&&n.length?["require","exports","module"]:t,l=0;l<t.length;l+=1)if("require"===(o=(a=f(t[l],c)).f))d[l]=g.require(e);else if("exports"===o)d[l]=g.exports(e),u=!0;else if("module"===o)i=d[l]=g.module(e);else if(w(m,o)||w(v,o)||w(_,o))d[l]=D(o);else{if(!a.p)throw new Error(e+" missing "+o);a.p.load(a.n,A(r,!0),x(o),{}),d[l]=m[o]}s=n?n.apply(m[e],d):void 0,e&&(i&&i.exports!==h&&i.exports!==m[e]?m[e]=i.exports:s===h&&u||(m[e]=s))}else e&&(m[e]=n)},t=n=s=function(e,t,n,r,i){if("string"==typeof e)return g[e]?g[e](t):D(f(e,S(t)).f);if(!e.splice){if((y=e).deps&&s(y.deps,y.callback),!t)return;t.splice?(e=t,t=n,n=null):e=h}return t=t||function(){},"function"==typeof n&&(n=r,r=i),r?o(h,e,t,n):setTimeout(function(){o(h,e,t,n)},4),s},s.config=function(e){return s(e)},t._defined=m,(r=function(e,t,n){if("string"!=typeof e)throw new Error("See almond README: incorrect module build, no module name");t.splice||(n=t,t=[]),w(m,e)||w(v,e)||(v[e]=[e,t,n])}).amd={jQuery:!0},e.requirejs=t,e.require=n,e.define=r),e.define("almond",function(){}),e.define("jquery",[],function(){var e=u||$;return null==e&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),e}),e.define("select2/utils",["jquery"],function(o){var i={};function u(e){var t=e.prototype,n=[];for(var r in t){"function"==typeof t[r]&&"constructor"!==r&&n.push(r)}return n}i.Extend=function(e,t){var n={}.hasOwnProperty;function r(){this.constructor=e}for(var i in t)n.call(t,i)&&(e[i]=t[i]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e},i.Decorate=function(r,i){var e=u(i),t=u(r);function o(){var e=Array.prototype.unshift,t=i.prototype.constructor.length,n=r.prototype.constructor;0<t&&(e.call(arguments,r.prototype.constructor),n=i.prototype.constructor),n.apply(this,arguments)}i.displayName=r.displayName,o.prototype=new function(){this.constructor=o};for(var n=0;n<t.length;n++){var s=t[n];o.prototype[s]=r.prototype[s]}function a(e){var t=function(){};e in o.prototype&&(t=o.prototype[e]);var n=i.prototype[e];return function(){return Array.prototype.unshift.call(arguments,t),n.apply(this,arguments)}}for(var l=0;l<e.length;l++){var c=e[l];o.prototype[c]=a(c)}return o};function e(){this.listeners={}}e.prototype.on=function(e,t){this.listeners=this.listeners||{},e in this.listeners?this.listeners[e].push(t):this.listeners[e]=[t]},e.prototype.trigger=function(e){var t=Array.prototype.slice,n=t.call(arguments,1);this.listeners=this.listeners||{},null==n&&(n=[]),0===n.length&&n.push({}),(n[0]._type=e)in this.listeners&&this.invoke(this.listeners[e],t.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},e.prototype.invoke=function(e,t){for(var n=0,r=e.length;n<r;n++)e[n].apply(this,t)},i.Observable=e,i.generateChars=function(e){for(var t="",n=0;n<e;n++){t+=Math.floor(36*Math.random()).toString(36)}return t},i.bind=function(e,t){return function(){e.apply(t,arguments)}},i._convertData=function(e){for(var t in e){var n=t.split("-"),r=e;if(1!==n.length){for(var i=0;i<n.length;i++){var o=n[i];(o=o.substring(0,1).toLowerCase()+o.substring(1))in r||(r[o]={}),i==n.length-1&&(r[o]=e[t]),r=r[o]}delete e[t]}}return e},i.hasScroll=function(e,t){var n=o(t),r=t.style.overflowX,i=t.style.overflowY;return(r!==i||"hidden"!==i&&"visible"!==i)&&("scroll"===r||"scroll"===i||(n.innerHeight()<t.scrollHeight||n.innerWidth()<t.scrollWidth))},i.escapeMarkup=function(e){var t={"\\":"\","&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return"string"!=typeof e?e:String(e).replace(/[&<>"'\/\\]/g,function(e){return t[e]})},i.appendMany=function(e,t){if("1.7"===o.fn.jquery.substr(0,3)){var n=o();o.map(t,function(e){n=n.add(e)}),t=n}e.append(t)},i.__cache={};var n=0;return i.GetUniqueElementId=function(e){var t=e.getAttribute("data-select2-id");return null==t&&(e.id?(t=e.id,e.setAttribute("data-select2-id",t)):(e.setAttribute("data-select2-id",++n),t=n.toString())),t},i.StoreData=function(e,t,n){var r=i.GetUniqueElementId(e);i.__cache[r]||(i.__cache[r]={}),i.__cache[r][t]=n},i.GetData=function(e,t){var n=i.GetUniqueElementId(e);return t?i.__cache[n]&&null!=i.__cache[n][t]?i.__cache[n][t]:o(e).data(t):i.__cache[n]},i.RemoveData=function(e){var t=i.GetUniqueElementId(e);null!=i.__cache[t]&&delete i.__cache[t],e.removeAttribute("data-select2-id")},i}),e.define("select2/results",["jquery","./utils"],function(h,f){function r(e,t,n){this.$element=e,this.data=n,this.options=t,r.__super__.constructor.call(this)}return f.Extend(r,f.Observable),r.prototype.render=function(){var e=h('<ul class="select2-results__options" role="listbox"></ul>');return this.options.get("multiple")&&e.attr("aria-multiselectable","true"),this.$results=e},r.prototype.clear=function(){this.$results.empty()},r.prototype.displayMessage=function(e){var t=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var n=h('<li role="alert" aria-live="assertive" class="select2-results__option"></li>'),r=this.options.get("translations").get(e.message);n.append(t(r(e.args))),n[0].className+=" select2-results__message",this.$results.append(n)},r.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},r.prototype.append=function(e){this.hideLoading();var t=[];if(null!=e.results&&0!==e.results.length){e.results=this.sort(e.results);for(var n=0;n<e.results.length;n++){var r=e.results[n],i=this.option(r);t.push(i)}this.$results.append(t)}else 0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"})},r.prototype.position=function(e,t){t.find(".select2-results").append(e)},r.prototype.sort=function(e){return this.options.get("sorter")(e)},r.prototype.highlightFirstItem=function(){var e=this.$results.find(".select2-results__option[aria-selected]"),t=e.filter("[aria-selected=true]");0<t.length?t.first().trigger("mouseenter"):e.first().trigger("mouseenter"),this.ensureHighlightVisible()},r.prototype.setClasses=function(){var t=this;this.data.current(function(e){var r=h.map(e,function(e){return e.id.toString()});t.$results.find(".select2-results__option[aria-selected]").each(function(){var e=h(this),t=f.GetData(this,"data"),n=""+t.id;null!=t.element&&t.element.selected||null==t.element&&-1<h.inArray(n,r)?e.attr("aria-selected","true"):e.attr("aria-selected","false")})})},r.prototype.showLoading=function(e){this.hideLoading();var t={disabled:!0,loading:!0,text:this.options.get("translations").get("searching")(e)},n=this.option(t);n.className+=" loading-results",this.$results.prepend(n)},r.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},r.prototype.option=function(e){var t=document.createElement("li");t.className="select2-results__option";var n={role:"option","aria-selected":"false"},r=window.Element.prototype.matches||window.Element.prototype.msMatchesSelector||window.Element.prototype.webkitMatchesSelector;for(var i in(null!=e.element&&r.call(e.element,":disabled")||null==e.element&&e.disabled)&&(delete n["aria-selected"],n["aria-disabled"]="true"),null==e.id&&delete n["aria-selected"],null!=e._resultId&&(t.id=e._resultId),e.title&&(t.title=e.title),e.children&&(n.role="group",n["aria-label"]=e.text,delete n["aria-selected"]),n){var o=n[i];t.setAttribute(i,o)}if(e.children){var s=h(t),a=document.createElement("strong");a.className="select2-results__group";h(a);this.template(e,a);for(var l=[],c=0;c<e.children.length;c++){var u=e.children[c],d=this.option(u);l.push(d)}var p=h("<ul></ul>",{class:"select2-results__options select2-results__options--nested"});p.append(l),s.append(a),s.append(p)}else this.template(e,t);return f.StoreData(t,"data",e),t},r.prototype.bind=function(t,e){var l=this,n=t.id+"-results";this.$results.attr("id",n),t.on("results:all",function(e){l.clear(),l.append(e.data),t.isOpen()&&(l.setClasses(),l.highlightFirstItem())}),t.on("results:append",function(e){l.append(e.data),t.isOpen()&&l.setClasses()}),t.on("query",function(e){l.hideMessages(),l.showLoading(e)}),t.on("select",function(){t.isOpen()&&(l.setClasses(),l.options.get("scrollAfterSelect")&&l.highlightFirstItem())}),t.on("unselect",function(){t.isOpen()&&(l.setClasses(),l.options.get("scrollAfterSelect")&&l.highlightFirstItem())}),t.on("open",function(){l.$results.attr("aria-expanded","true"),l.$results.attr("aria-hidden","false"),l.setClasses(),l.ensureHighlightVisible()}),t.on("close",function(){l.$results.attr("aria-expanded","false"),l.$results.attr("aria-hidden","true"),l.$results.removeAttr("aria-activedescendant")}),t.on("results:toggle",function(){var e=l.getHighlightedResults();0!==e.length&&e.trigger("mouseup")}),t.on("results:select",function(){var e=l.getHighlightedResults();if(0!==e.length){var t=f.GetData(e[0],"data");"true"==e.attr("aria-selected")?l.trigger("close",{}):l.trigger("select",{data:t})}}),t.on("results:previous",function(){var e=l.getHighlightedResults(),t=l.$results.find("[aria-selected]"),n=t.index(e);if(!(n<=0)){var r=n-1;0===e.length&&(r=0);var i=t.eq(r);i.trigger("mouseenter");var o=l.$results.offset().top,s=i.offset().top,a=l.$results.scrollTop()+(s-o);0===r?l.$results.scrollTop(0):s-o<0&&l.$results.scrollTop(a)}}),t.on("results:next",function(){var e=l.getHighlightedResults(),t=l.$results.find("[aria-selected]"),n=t.index(e)+1;if(!(n>=t.length)){var r=t.eq(n);r.trigger("mouseenter");var i=l.$results.offset().top+l.$results.outerHeight(!1),o=r.offset().top+r.outerHeight(!1),s=l.$results.scrollTop()+o-i;0===n?l.$results.scrollTop(0):i<o&&l.$results.scrollTop(s)}}),t.on("results:focus",function(e){e.element.addClass("select2-results__option--highlighted")}),t.on("results:message",function(e){l.displayMessage(e)}),h.fn.mousewheel&&this.$results.on("mousewheel",function(e){var t=l.$results.scrollTop(),n=l.$results.get(0).scrollHeight-t+e.deltaY,r=0<e.deltaY&&t-e.deltaY<=0,i=e.deltaY<0&&n<=l.$results.height();r?(l.$results.scrollTop(0),e.preventDefault(),e.stopPropagation()):i&&(l.$results.scrollTop(l.$results.get(0).scrollHeight-l.$results.height()),e.preventDefault(),e.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(e){var t=h(this),n=f.GetData(this,"data");"true"!==t.attr("aria-selected")?l.trigger("select",{originalEvent:e,data:n}):l.options.get("multiple")?l.trigger("unselect",{originalEvent:e,data:n}):l.trigger("close",{})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(e){var t=f.GetData(this,"data");l.getHighlightedResults().removeClass("select2-results__option--highlighted"),l.trigger("results:focus",{data:t,element:h(this)})})},r.prototype.getHighlightedResults=function(){return this.$results.find(".select2-results__option--highlighted")},r.prototype.destroy=function(){this.$results.remove()},r.prototype.ensureHighlightVisible=function(){var e=this.getHighlightedResults();if(0!==e.length){var t=this.$results.find("[aria-selected]").index(e),n=this.$results.offset().top,r=e.offset().top,i=this.$results.scrollTop()+(r-n),o=r-n;i-=2*e.outerHeight(!1),t<=2?this.$results.scrollTop(0):(o>this.$results.outerHeight()||o<0)&&this.$results.scrollTop(i)}},r.prototype.template=function(e,t){var n=this.options.get("templateResult"),r=this.options.get("escapeMarkup"),i=n(e,t);null==i?t.style.display="none":"string"==typeof i?t.innerHTML=r(i):h(t).append(i)},r}),e.define("select2/keys",[],function(){return{BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46}}),e.define("select2/selection/base",["jquery","../utils","../keys"],function(n,r,i){function o(e,t){this.$element=e,this.options=t,o.__super__.constructor.call(this)}return r.Extend(o,r.Observable),o.prototype.render=function(){var e=n('<span class="select2-selection" role="combobox" aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=r.GetData(this.$element[0],"old-tabindex")?this._tabindex=r.GetData(this.$element[0],"old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),e.attr("title",this.$element.attr("title")),e.attr("tabindex",this._tabindex),e.attr("aria-disabled","false"),this.$selection=e},o.prototype.bind=function(e,t){var n=this,r=e.id+"-results";this.container=e,this.$selection.on("focus",function(e){n.trigger("focus",e)}),this.$selection.on("blur",function(e){n._handleBlur(e)}),this.$selection.on("keydown",function(e){n.trigger("keypress",e),e.which===i.SPACE&&e.preventDefault()}),e.on("results:focus",function(e){n.$selection.attr("aria-activedescendant",e.data._resultId)}),e.on("selection:update",function(e){n.update(e.data)}),e.on("open",function(){n.$selection.attr("aria-expanded","true"),n.$selection.attr("aria-owns",r),n._attachCloseHandler(e)}),e.on("close",function(){n.$selection.attr("aria-expanded","false"),n.$selection.removeAttr("aria-activedescendant"),n.$selection.removeAttr("aria-owns"),n.$selection.trigger("focus"),n._detachCloseHandler(e)}),e.on("enable",function(){n.$selection.attr("tabindex",n._tabindex),n.$selection.attr("aria-disabled","false")}),e.on("disable",function(){n.$selection.attr("tabindex","-1"),n.$selection.attr("aria-disabled","true")})},o.prototype._handleBlur=function(e){var t=this;window.setTimeout(function(){document.activeElement==t.$selection[0]||n.contains(t.$selection[0],document.activeElement)||t.trigger("blur",e)},1)},o.prototype._attachCloseHandler=function(e){n(document.body).on("mousedown.select2."+e.id,function(e){var t=n(e.target).closest(".select2");n(".select2.select2-container--open").each(function(){this!=t[0]&&r.GetData(this,"element").select2("close")})})},o.prototype._detachCloseHandler=function(e){n(document.body).off("mousedown.select2."+e.id)},o.prototype.position=function(e,t){t.find(".selection").append(e)},o.prototype.destroy=function(){this._detachCloseHandler(this.container)},o.prototype.update=function(e){throw new Error("The `update` method must be defined in child classes.")},o.prototype.isEnabled=function(){return!this.isDisabled()},o.prototype.isDisabled=function(){return this.options.get("disabled")},o}),e.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(e,t,n,r){function i(){i.__super__.constructor.apply(this,arguments)}return n.Extend(i,t),i.prototype.render=function(){var e=i.__super__.render.call(this);return e.addClass("select2-selection--single"),e.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),e},i.prototype.bind=function(t,e){var n=this;i.__super__.bind.apply(this,arguments);var r=t.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",r).attr("role","textbox").attr("aria-readonly","true"),this.$selection.attr("aria-labelledby",r),this.$selection.on("mousedown",function(e){1===e.which&&n.trigger("toggle",{originalEvent:e})}),this.$selection.on("focus",function(e){}),this.$selection.on("blur",function(e){}),t.on("focus",function(e){t.isOpen()||n.$selection.trigger("focus")})},i.prototype.clear=function(){var e=this.$selection.find(".select2-selection__rendered");e.empty(),e.removeAttr("title")},i.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},i.prototype.selectionContainer=function(){return e("<span></span>")},i.prototype.update=function(e){if(0!==e.length){var t=e[0],n=this.$selection.find(".select2-selection__rendered"),r=this.display(t,n);n.empty().append(r);var i=t.title||t.text;i?n.attr("title",i):n.removeAttr("title")}else this.clear()},i}),e.define("select2/selection/multiple",["jquery","./base","../utils"],function(i,e,l){function n(e,t){n.__super__.constructor.apply(this,arguments)}return l.Extend(n,e),n.prototype.render=function(){var e=n.__super__.render.call(this);return e.addClass("select2-selection--multiple"),e.html('<ul class="select2-selection__rendered"></ul>'),e},n.prototype.bind=function(e,t){var r=this;n.__super__.bind.apply(this,arguments),this.$selection.on("click",function(e){r.trigger("toggle",{originalEvent:e})}),this.$selection.on("click",".select2-selection__choice__remove",function(e){if(!r.isDisabled()){var t=i(this).parent(),n=l.GetData(t[0],"data");r.trigger("unselect",{originalEvent:e,data:n})}})},n.prototype.clear=function(){var e=this.$selection.find(".select2-selection__rendered");e.empty(),e.removeAttr("title")},n.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},n.prototype.selectionContainer=function(){return i('<li class="select2-selection__choice"><span class="select2-selection__choice__remove" role="presentation">×</span></li>')},n.prototype.update=function(e){if(this.clear(),0!==e.length){for(var t=[],n=0;n<e.length;n++){var r=e[n],i=this.selectionContainer(),o=this.display(r,i);i.append(o);var s=r.title||r.text;s&&i.attr("title",s),l.StoreData(i[0],"data",r),t.push(i)}var a=this.$selection.find(".select2-selection__rendered");l.appendMany(a,t)}},n}),e.define("select2/selection/placeholder",["../utils"],function(e){function t(e,t,n){this.placeholder=this.normalizePlaceholder(n.get("placeholder")),e.call(this,t,n)}return t.prototype.normalizePlaceholder=function(e,t){return"string"==typeof t&&(t={id:"",text:t}),t},t.prototype.createPlaceholder=function(e,t){var n=this.selectionContainer();return n.html(this.display(t)),n.addClass("select2-selection__placeholder").removeClass("select2-selection__choice"),n},t.prototype.update=function(e,t){var n=1==t.length&&t[0].id!=this.placeholder.id;if(1<t.length||n)return e.call(this,t);this.clear();var r=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(r)},t}),e.define("select2/selection/allowClear",["jquery","../keys","../utils"],function(i,r,a){function e(){}return e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(e){r._handleClear(e)}),t.on("keypress",function(e){r._handleKeyboardClear(e,t)})},e.prototype._handleClear=function(e,t){if(!this.isDisabled()){var n=this.$selection.find(".select2-selection__clear");if(0!==n.length){t.stopPropagation();var r=a.GetData(n[0],"data"),i=this.$element.val();this.$element.val(this.placeholder.id);var o={data:r};if(this.trigger("clear",o),o.prevented)this.$element.val(i);else{for(var s=0;s<r.length;s++)if(o={data:r[s]},this.trigger("unselect",o),o.prevented)return void this.$element.val(i);this.$element.trigger("input").trigger("change"),this.trigger("toggle",{})}}}},e.prototype._handleKeyboardClear=function(e,t,n){n.isOpen()||t.which!=r.DELETE&&t.which!=r.BACKSPACE||this._handleClear(t)},e.prototype.update=function(e,t){if(e.call(this,t),!(0<this.$selection.find(".select2-selection__placeholder").length||0===t.length)){var n=this.options.get("translations").get("removeAllItems"),r=i('<span class="select2-selection__clear" title="'+n()+'">×</span>');a.StoreData(r[0],"data",t),this.$selection.find(".select2-selection__rendered").prepend(r)}},e}),e.define("select2/selection/search",["jquery","../utils","../keys"],function(r,a,l){function e(e,t,n){e.call(this,t,n)}return e.prototype.render=function(e){var t=r('<li class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="none" spellcheck="false" role="searchbox" aria-autocomplete="list" /></li>');this.$searchContainer=t,this.$search=t.find("input");var n=e.call(this);return this._transferTabIndex(),n},e.prototype.bind=function(e,t,n){var r=this,i=t.id+"-results";e.call(this,t,n),t.on("open",function(){r.$search.attr("aria-controls",i),r.$search.trigger("focus")}),t.on("close",function(){r.$search.val(""),r.$search.removeAttr("aria-controls"),r.$search.removeAttr("aria-activedescendant"),r.$search.trigger("focus")}),t.on("enable",function(){r.$search.prop("disabled",!1),r._transferTabIndex()}),t.on("disable",function(){r.$search.prop("disabled",!0)}),t.on("focus",function(e){r.$search.trigger("focus")}),t.on("results:focus",function(e){e.data._resultId?r.$search.attr("aria-activedescendant",e.data._resultId):r.$search.removeAttr("aria-activedescendant")}),this.$selection.on("focusin",".select2-search--inline",function(e){r.trigger("focus",e)}),this.$selection.on("focusout",".select2-search--inline",function(e){r._handleBlur(e)}),this.$selection.on("keydown",".select2-search--inline",function(e){if(e.stopPropagation(),r.trigger("keypress",e),r._keyUpPrevented=e.isDefaultPrevented(),e.which===l.BACKSPACE&&""===r.$search.val()){var t=r.$searchContainer.prev(".select2-selection__choice");if(0<t.length){var n=a.GetData(t[0],"data");r.searchRemoveChoice(n),e.preventDefault()}}}),this.$selection.on("click",".select2-search--inline",function(e){r.$search.val()&&e.stopPropagation()});var o=document.documentMode,s=o&&o<=11;this.$selection.on("input.searchcheck",".select2-search--inline",function(e){s?r.$selection.off("input.search input.searchcheck"):r.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(e){if(s&&"input"===e.type)r.$selection.off("input.search input.searchcheck");else{var t=e.which;t!=l.SHIFT&&t!=l.CTRL&&t!=l.ALT&&t!=l.TAB&&r.handleSearch(e)}})},e.prototype._transferTabIndex=function(e){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},e.prototype.createPlaceholder=function(e,t){this.$search.attr("placeholder",t.text)},e.prototype.update=function(e,t){var n=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),e.call(this,t),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),n&&this.$search.trigger("focus")},e.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var e=this.$search.val();this.trigger("query",{term:e})}this._keyUpPrevented=!1},e.prototype.searchRemoveChoice=function(e,t){this.trigger("unselect",{data:t}),this.$search.val(t.text),this.handleSearch()},e.prototype.resizeSearch=function(){this.$search.css("width","25px");var e="";""!==this.$search.attr("placeholder")?e=this.$selection.find(".select2-selection__rendered").width():e=.75*(this.$search.val().length+1)+"em";this.$search.css("width",e)},e}),e.define("select2/selection/eventRelay",["jquery"],function(s){function e(){}return e.prototype.bind=function(e,t,n){var r=this,i=["open","opening","close","closing","select","selecting","unselect","unselecting","clear","clearing"],o=["opening","closing","selecting","unselecting","clearing"];e.call(this,t,n),t.on("*",function(e,t){if(-1!==s.inArray(e,i)){t=t||{};var n=s.Event("select2:"+e,{params:t});r.$element.trigger(n),-1!==s.inArray(e,o)&&(t.prevented=n.isDefaultPrevented())}})},e}),e.define("select2/translation",["jquery","require"],function(t,n){function r(e){this.dict=e||{}}return r.prototype.all=function(){return this.dict},r.prototype.get=function(e){return this.dict[e]},r.prototype.extend=function(e){this.dict=t.extend({},e.all(),this.dict)},r._cache={},r.loadPath=function(e){if(!(e in r._cache)){var t=n(e);r._cache[e]=t}return new r(r._cache[e])},r}),e.define("select2/diacritics",[],function(){return{"â’¶":"A","A":"A","À":"A","Ã":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ä€":"A","Ä‚":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ç ":"A","Ä":"A","Çž":"A","Ả":"A","Ã…":"A","Ǻ":"A","Ç":"A","È€":"A","È‚":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ä„":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ç¢":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","â’·":"B","ï¼¢":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Æ‚":"B","Æ":"B","â’¸":"C","ï¼£":"C","Ć":"C","Ĉ":"C","ÄŠ":"C","ÄŒ":"C","Ç":"C","Ḉ":"C","Ƈ":"C","È»":"C","Ꜿ":"C","â’¹":"D","D":"D","Ḋ":"D","ÄŽ":"D","Ḍ":"D","á¸":"D","Ḓ":"D","Ḏ":"D","Ä":"D","Æ‹":"D","ÆŠ":"D","Ɖ":"D","ê¹":"D","DZ":"DZ","Ç„":"DZ","Dz":"Dz","Ç…":"Dz","â’º":"E","ï¼¥":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ä’":"E","Ḕ":"E","Ḗ":"E","Ä”":"E","Ä–":"E","Ë":"E","Ẻ":"E","Äš":"E","È„":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Æ":"E","ÆŽ":"E","â’»":"F","F":"F","Ḟ":"F","Æ‘":"F","ê»":"F","â’¼":"G","G":"G","Ç´":"G","Äœ":"G","Ḡ":"G","Äž":"G","Ä ":"G","Ǧ":"G","Ä¢":"G","Ǥ":"G","Æ“":"G","êž ":"G","ê½":"G","ê¾":"G","â’½":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Èž":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","â±µ":"H","êž":"H","â’¾":"I","I":"I","ÃŒ":"I","Ã":"I","ÃŽ":"I","Ĩ":"I","Ī":"I","Ĭ":"I","Ä°":"I","Ã":"I","Ḯ":"I","Ỉ":"I","Ç":"I","Ȉ":"I","ÈŠ":"I","Ị":"I","Ä®":"I","Ḭ":"I","Æ—":"I","â’¿":"J","J":"J","Ä´":"J","Ɉ":"J","â“€":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","ê€":"K","ê‚":"K","ê„":"K","Ꞣ":"K","â“":"L","L":"L","Ä¿":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ä»":"L","Ḽ":"L","Ḻ":"L","Å":"L","Ƚ":"L","â±¢":"L","â± ":"L","êˆ":"L","ê†":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","â“‚":"M","ï¼":"M","Ḿ":"M","á¹€":"M","Ṃ":"M","â±®":"M","Æœ":"M","Ⓝ":"N","ï¼®":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Å…":"N","Ṋ":"N","Ṉ":"N","È ":"N","Æ":"N","êž":"N","Ꞥ":"N","ÇŠ":"NJ","Ç‹":"Nj","â“„":"O","O":"O","Ã’":"O","Ó":"O","Ô":"O","á»’":"O","á»":"O","á»–":"O","á»”":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","ÅŒ":"O","á¹":"O","á¹’":"O","ÅŽ":"O","È®":"O","È°":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Å":"O","Ç‘":"O","ÈŒ":"O","ÈŽ":"O","Æ ":"O","Ờ":"O","Ớ":"O","á» ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","ÆŸ":"O","êŠ":"O","êŒ":"O","Å’":"OE","Æ¢":"OI","êŽ":"OO","È¢":"OU","â“…":"P","ï¼°":"P","á¹”":"P","á¹–":"P","Ƥ":"P","â±£":"P","ê":"P","ê’":"P","ê”":"P","Ⓠ":"Q","ï¼±":"Q","ê–":"Q","ê˜":"Q","ÉŠ":"Q","Ⓡ":"R","ï¼²":"R","Å”":"R","Ṙ":"R","Ř":"R","È":"R","È’":"R","Ṛ":"R","Ṝ":"R","Å–":"R","Ṟ":"R","ÉŒ":"R","Ɽ":"R","êš":"R","Ꞧ":"R","êž‚":"R","Ⓢ":"S","ï¼³":"S","ẞ":"S","Åš":"S","Ṥ":"S","Åœ":"S","á¹ ":"S","Å ":"S","Ṧ":"S","á¹¢":"S","Ṩ":"S","Ș":"S","Åž":"S","â±¾":"S","Ꞩ":"S","êž„":"S","Ⓣ":"T","ï¼´":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Èš":"T","Å¢":"T","á¹°":"T","á¹®":"T","Ŧ":"T","Ƭ":"T","Æ®":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","â“Š":"U","ï¼µ":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ãœ":"U","Ç›":"U","Ç—":"U","Ç•":"U","Ç™":"U","Ủ":"U","Å®":"U","Å°":"U","Ç“":"U","È”":"U","È–":"U","Ư":"U","Ừ":"U","Ứ":"U","á»®":"U","Ử":"U","á»°":"U","Ụ":"U","á¹²":"U","Ų":"U","Ṷ":"U","á¹´":"U","É„":"U","â“‹":"V","V":"V","á¹¼":"V","á¹¾":"V","Ʋ":"V","êž":"V","É…":"V","ê ":"VY","â“Œ":"W","ï¼·":"W","Ẁ":"W","Ẃ":"W","Å´":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","â±²":"W","â“":"X","X":"X","Ẋ":"X","Ẍ":"X","â“Ž":"Y","ï¼¹":"Y","Ỳ":"Y","Ã":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","á»´":"Y","Ƴ":"Y","ÉŽ":"Y","Ỿ":"Y","â“":"Z","Z":"Z","Ź":"Z","áº":"Z","Å»":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","ê¢":"Z","â“":"a","ï½":"a","ẚ":"a","à ":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","Ä":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","Ç¡":"a","ä":"a","ÇŸ":"a","ả":"a","Ã¥":"a","Ç»":"a","ÇŽ":"a","È":"a","ȃ":"a","ạ":"a","áº":"a","ặ":"a","á¸":"a","Ä…":"a","â±¥":"a","É":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","Ç£":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","â“‘":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","Æ€":"b","ƃ":"b","É“":"b","â“’":"c","c":"c","ć":"c","ĉ":"c","Ä‹":"c","Ä":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","â““":"d","d":"d","ḋ":"d","Ä":"d","á¸":"d","ḑ":"d","ḓ":"d","á¸":"d","Ä‘":"d","ÆŒ":"d","É–":"d","É—":"d","êº":"d","dz":"dz","dž":"dz","â“”":"e","ï½…":"e","è":"e","é":"e","ê":"e","á»":"e","ế":"e","á»…":"e","ể":"e","ẽ":"e","Ä“":"e","ḕ":"e","ḗ":"e","Ä•":"e","Ä—":"e","ë":"e","ẻ":"e","Ä›":"e","È…":"e","ȇ":"e","ẹ":"e","ệ":"e","È©":"e","á¸":"e","Ä™":"e","ḙ":"e","ḛ":"e","ɇ":"e","É›":"e","Ç":"e","â“•":"f","f":"f","ḟ":"f","Æ’":"f","ê¼":"f","â“–":"g","g":"g","ǵ":"g","Ä":"g","ḡ":"g","ÄŸ":"g","Ä¡":"g","ǧ":"g","Ä£":"g","Ç¥":"g","É ":"g","êž¡":"g","áµ¹":"g","ê¿":"g","â“—":"h","h":"h","Ä¥":"h","ḣ":"h","ḧ":"h","ÈŸ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","É¥":"h","Æ•":"hv","ⓘ":"i","i":"i","ì":"i","Ã":"i","î":"i","Ä©":"i","Ä«":"i","Ä":"i","ï":"i","ḯ":"i","ỉ":"i","Ç":"i","ȉ":"i","È‹":"i","ị":"i","į":"i","á¸":"i","ɨ":"i","ı":"i","â“™":"j","j":"j","ĵ":"j","Ç°":"j","ɉ":"j","â“š":"k","k":"k","ḱ":"k","Ç©":"k","ḳ":"k","Ä·":"k","ḵ":"k","Æ™":"k","ⱪ":"k","ê":"k","êƒ":"k","ê…":"k","ꞣ":"k","â“›":"l","l":"l","Å€":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","Å¿":"l","Å‚":"l","Æš":"l","É«":"l","ⱡ":"l","ê‰":"l","êž":"l","ê‡":"l","lj":"lj","â“œ":"m","ï½":"m","ḿ":"m","á¹":"m","ṃ":"m","ɱ":"m","ɯ":"m","â“":"n","n":"n","ǹ":"n","Å„":"n","ñ":"n","á¹…":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","Æž":"n","ɲ":"n","ʼn":"n","êž‘":"n","ꞥ":"n","ÇŒ":"nj","â“ž":"o","ï½":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","á»—":"o","ổ":"o","õ":"o","á¹":"o","È":"o","á¹":"o","Å":"o","ṑ":"o","ṓ":"o","Å":"o","ȯ":"o","ȱ":"o","ö":"o","È«":"o","á»":"o","Å‘":"o","Ç’":"o","È":"o","È":"o","Æ¡":"o","á»":"o","á»›":"o","ỡ":"o","ở":"o","ợ":"o","á»":"o","á»™":"o","Ç«":"o","Ç":"o","ø":"o","Ç¿":"o","É”":"o","ê‹":"o","ê":"o","ɵ":"o","Å“":"oe","Æ£":"oi","È£":"ou","ê":"oo","â“Ÿ":"p","ï½":"p","ṕ":"p","á¹—":"p","Æ¥":"p","áµ½":"p","ê‘":"p","ê“":"p","ê•":"p","â“ ":"q","q":"q","É‹":"q","ê—":"q","ê™":"q","â“¡":"r","ï½’":"r","Å•":"r","á¹™":"r","Å™":"r","È‘":"r","È“":"r","á¹›":"r","á¹":"r","Å—":"r","ṟ":"r","É":"r","ɽ":"r","ê›":"r","ꞧ":"r","ꞃ":"r","â“¢":"s","s":"s","ß":"s","Å›":"s","á¹¥":"s","Å":"s","ṡ":"s","Å¡":"s","ṧ":"s","á¹£":"s","ṩ":"s","È™":"s","ÅŸ":"s","È¿":"s","êž©":"s","êž…":"s","ẛ":"s","â“£":"t","ï½”":"t","ṫ":"t","ẗ":"t","Å¥":"t","á¹":"t","È›":"t","Å£":"t","á¹±":"t","ṯ":"t","ŧ":"t","Æ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","Å©":"u","á¹¹":"u","Å«":"u","á¹»":"u","Å":"u","ü":"u","Çœ":"u","ǘ":"u","Ç–":"u","Çš":"u","ủ":"u","ů":"u","ű":"u","Ç”":"u","È•":"u","È—":"u","Æ°":"u","ừ":"u","ứ":"u","ữ":"u","á»":"u","á»±":"u","ụ":"u","á¹³":"u","ų":"u","á¹·":"u","á¹µ":"u","ʉ":"u","â“¥":"v","ï½–":"v","á¹½":"v","ṿ":"v","Ê‹":"v","êŸ":"v","ÊŒ":"v","ê¡":"vy","ⓦ":"w","ï½—":"w","áº":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","â±³":"w","ⓧ":"x","x":"x","ẋ":"x","áº":"x","ⓨ":"y","ï½™":"y","ỳ":"y","ý":"y","Å·":"y","ỹ":"y","ȳ":"y","áº":"y","ÿ":"y","á»·":"y","ẙ":"y","ỵ":"y","Æ´":"y","É":"y","ỿ":"y","â“©":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","È¥":"z","É€":"z","ⱬ":"z","ê£":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","ÎŒ":"Ο","ÎŽ":"Î¥","Ϋ":"Î¥","Î":"Ω","ά":"α","Î":"ε","ή":"η","ί":"ι","ÏŠ":"ι","Î":"ι","ÏŒ":"ο","Ï":"Ï…","Ï‹":"Ï…","ΰ":"Ï…","ÏŽ":"ω","Ï‚":"σ","’":"'"}}),e.define("select2/data/base",["../utils"],function(r){function n(e,t){n.__super__.constructor.call(this)}return r.Extend(n,r.Observable),n.prototype.current=function(e){throw new Error("The `current` method must be defined in child classes.")},n.prototype.query=function(e,t){throw new Error("The `query` method must be defined in child classes.")},n.prototype.bind=function(e,t){},n.prototype.destroy=function(){},n.prototype.generateResultId=function(e,t){var n=e.id+"-result-";return n+=r.generateChars(4),null!=t.id?n+="-"+t.id.toString():n+="-"+r.generateChars(4),n},n}),e.define("select2/data/select",["./base","../utils","jquery"],function(e,a,l){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return a.Extend(n,e),n.prototype.current=function(e){var n=[],r=this;this.$element.find(":selected").each(function(){var e=l(this),t=r.item(e);n.push(t)}),e(n)},n.prototype.select=function(i){var o=this;if(i.selected=!0,l(i.element).is("option"))return i.element.selected=!0,void this.$element.trigger("input").trigger("change");if(this.$element.prop("multiple"))this.current(function(e){var t=[];(i=[i]).push.apply(i,e);for(var n=0;n<i.length;n++){var r=i[n].id;-1===l.inArray(r,t)&&t.push(r)}o.$element.val(t),o.$element.trigger("input").trigger("change")});else{var e=i.id;this.$element.val(e),this.$element.trigger("input").trigger("change")}},n.prototype.unselect=function(i){var o=this;if(this.$element.prop("multiple")){if(i.selected=!1,l(i.element).is("option"))return i.element.selected=!1,void this.$element.trigger("input").trigger("change");this.current(function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n].id;r!==i.id&&-1===l.inArray(r,t)&&t.push(r)}o.$element.val(t),o.$element.trigger("input").trigger("change")})}},n.prototype.bind=function(e,t){var n=this;(this.container=e).on("select",function(e){n.select(e.data)}),e.on("unselect",function(e){n.unselect(e.data)})},n.prototype.destroy=function(){this.$element.find("*").each(function(){a.RemoveData(this)})},n.prototype.query=function(r,e){var i=[],o=this;this.$element.children().each(function(){var e=l(this);if(e.is("option")||e.is("optgroup")){var t=o.item(e),n=o.matches(r,t);null!==n&&i.push(n)}}),e({results:i})},n.prototype.addOptions=function(e){a.appendMany(this.$element,e)},n.prototype.option=function(e){var t;e.children?(t=document.createElement("optgroup")).label=e.text:void 0!==(t=document.createElement("option")).textContent?t.textContent=e.text:t.innerText=e.text,void 0!==e.id&&(t.value=e.id),e.disabled&&(t.disabled=!0),e.selected&&(t.selected=!0),e.title&&(t.title=e.title);var n=l(t),r=this._normalizeItem(e);return r.element=t,a.StoreData(t,"data",r),n},n.prototype.item=function(e){var t={};if(null!=(t=a.GetData(e[0],"data")))return t;if(e.is("option"))t={id:e.val(),text:e.text(),disabled:e.prop("disabled"),selected:e.prop("selected"),title:e.prop("title")};else if(e.is("optgroup")){t={text:e.prop("label"),children:[],title:e.prop("title")};for(var n=e.children("option"),r=[],i=0;i<n.length;i++){var o=l(n[i]),s=this.item(o);r.push(s)}t.children=r}return(t=this._normalizeItem(t)).element=e[0],a.StoreData(e[0],"data",t),t},n.prototype._normalizeItem=function(e){e!==Object(e)&&(e={id:e,text:e});return null!=(e=l.extend({},{text:""},e)).id&&(e.id=e.id.toString()),null!=e.text&&(e.text=e.text.toString()),null==e._resultId&&e.id&&null!=this.container&&(e._resultId=this.generateResultId(this.container,e)),l.extend({},{selected:!1,disabled:!1},e)},n.prototype.matches=function(e,t){return this.options.get("matcher")(e,t)},n}),e.define("select2/data/array",["./select","../utils","jquery"],function(e,f,g){function r(e,t){this._dataToConvert=t.get("data")||[],r.__super__.constructor.call(this,e,t)}return f.Extend(r,e),r.prototype.bind=function(e,t){r.__super__.bind.call(this,e,t),this.addOptions(this.convertToOptions(this._dataToConvert))},r.prototype.select=function(n){var e=this.$element.find("option").filter(function(e,t){return t.value==n.id.toString()});0===e.length&&(e=this.option(n),this.addOptions(e)),r.__super__.select.call(this,n)},r.prototype.convertToOptions=function(e){var t=this,n=this.$element.find("option"),r=n.map(function(){return t.item(g(this)).id}).get(),i=[];function o(e){return function(){return g(this).val()==e.id}}for(var s=0;s<e.length;s++){var a=this._normalizeItem(e[s]);if(0<=g.inArray(a.id,r)){var l=n.filter(o(a)),c=this.item(l),u=g.extend(!0,{},a,c),d=this.option(u);l.replaceWith(d)}else{var p=this.option(a);if(a.children){var h=this.convertToOptions(a.children);f.appendMany(p,h)}i.push(p)}}return i},r}),e.define("select2/data/ajax",["./array","../utils","jquery"],function(e,t,o){function n(e,t){this.ajaxOptions=this._applyDefaults(t.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),n.__super__.constructor.call(this,e,t)}return t.Extend(n,e),n.prototype._applyDefaults=function(e){var t={data:function(e){return o.extend({},e,{q:e.term})},transport:function(e,t,n){var r=o.ajax(e);return r.then(t),r.fail(n),r}};return o.extend({},t,e,!0)},n.prototype.processResults=function(e){return e},n.prototype.query=function(n,r){var i=this;null!=this._request&&(o.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var t=o.extend({type:"GET"},this.ajaxOptions);function e(){var e=t.transport(t,function(e){var t=i.processResults(e,n);i.options.get("debug")&&window.console&&console.error&&(t&&t.results&&o.isArray(t.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),r(t)},function(){"status"in e&&(0===e.status||"0"===e.status)||i.trigger("results:message",{message:"errorLoading"})});i._request=e}"function"==typeof t.url&&(t.url=t.url.call(this.$element,n)),"function"==typeof t.data&&(t.data=t.data.call(this.$element,n)),this.ajaxOptions.delay&&null!=n.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(e,this.ajaxOptions.delay)):e()},n}),e.define("select2/data/tags",["jquery"],function(u){function e(e,t,n){var r=n.get("tags"),i=n.get("createTag");void 0!==i&&(this.createTag=i);var o=n.get("insertTag");if(void 0!==o&&(this.insertTag=o),e.call(this,t,n),u.isArray(r))for(var s=0;s<r.length;s++){var a=r[s],l=this._normalizeItem(a),c=this.option(l);this.$element.append(c)}}return e.prototype.query=function(e,c,u){var d=this;this._removeOldTags(),null!=c.term&&null==c.page?e.call(this,c,function e(t,n){for(var r=t.results,i=0;i<r.length;i++){var o=r[i],s=null!=o.children&&!e({results:o.children},!0);if((o.text||"").toUpperCase()===(c.term||"").toUpperCase()||s)return!n&&(t.data=r,void u(t))}if(n)return!0;var a=d.createTag(c);if(null!=a){var l=d.option(a);l.attr("data-select2-tag",!0),d.addOptions([l]),d.insertTag(r,a)}t.results=r,u(t)}):e.call(this,c,u)},e.prototype.createTag=function(e,t){var n=u.trim(t.term);return""===n?null:{id:n,text:n}},e.prototype.insertTag=function(e,t,n){t.unshift(n)},e.prototype._removeOldTags=function(e){this.$element.find("option[data-select2-tag]").each(function(){this.selected||u(this).remove()})},e}),e.define("select2/data/tokenizer",["jquery"],function(d){function e(e,t,n){var r=n.get("tokenizer");void 0!==r&&(this.tokenizer=r),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){e.call(this,t,n),this.$search=t.dropdown.$search||t.selection.$search||n.find(".select2-search__field")},e.prototype.query=function(e,t,n){var i=this;t.term=t.term||"";var r=this.tokenizer(t,this.options,function(e){var t,n=i._normalizeItem(e);if(!i.$element.find("option").filter(function(){return d(this).val()===n.id}).length){var r=i.option(n);r.attr("data-select2-tag",!0),i._removeOldTags(),i.addOptions([r])}t=n,i.trigger("select",{data:t})});r.term!==t.term&&(this.$search.length&&(this.$search.val(r.term),this.$search.trigger("focus")),t.term=r.term),e.call(this,t,n)},e.prototype.tokenizer=function(e,t,n,r){for(var i=n.get("tokenSeparators")||[],o=t.term,s=0,a=this.createTag||function(e){return{id:e.term,text:e.term}};s<o.length;){var l=o[s];if(-1!==d.inArray(l,i)){var c=o.substr(0,s),u=a(d.extend({},t,{term:c}));null!=u?(r(u),o=o.substr(s+1)||"",s=0):s++}else s++}return{term:o}},e}),e.define("select2/data/minimumInputLength",[],function(){function e(e,t,n){this.minimumInputLength=n.get("minimumInputLength"),e.call(this,t,n)}return e.prototype.query=function(e,t,n){t.term=t.term||"",t.term.length<this.minimumInputLength?this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:t.term,params:t}}):e.call(this,t,n)},e}),e.define("select2/data/maximumInputLength",[],function(){function e(e,t,n){this.maximumInputLength=n.get("maximumInputLength"),e.call(this,t,n)}return e.prototype.query=function(e,t,n){t.term=t.term||"",0<this.maximumInputLength&&t.term.length>this.maximumInputLength?this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:t.term,params:t}}):e.call(this,t,n)},e}),e.define("select2/data/maximumSelectionLength",[],function(){function e(e,t,n){this.maximumSelectionLength=n.get("maximumSelectionLength"),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("select",function(){r._checkIfMaximumSelected()})},e.prototype.query=function(e,t,n){var r=this;this._checkIfMaximumSelected(function(){e.call(r,t,n)})},e.prototype._checkIfMaximumSelected=function(e,n){var r=this;this.current(function(e){var t=null!=e?e.length:0;0<r.maximumSelectionLength&&t>=r.maximumSelectionLength?r.trigger("results:message",{message:"maximumSelected",args:{maximum:r.maximumSelectionLength}}):n&&n()})},e}),e.define("select2/dropdown",["jquery","./utils"],function(t,e){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return e.Extend(n,e.Observable),n.prototype.render=function(){var e=t('<span class="select2-dropdown"><span class="select2-results"></span></span>');return e.attr("dir",this.options.get("dir")),this.$dropdown=e},n.prototype.bind=function(){},n.prototype.position=function(e,t){},n.prototype.destroy=function(){this.$dropdown.remove()},n}),e.define("select2/dropdown/search",["jquery","../utils"],function(o,e){function t(){}return t.prototype.render=function(e){var t=e.call(this),n=o('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="none" spellcheck="false" role="searchbox" aria-autocomplete="list" /></span>');return this.$searchContainer=n,this.$search=n.find("input"),t.prepend(n),t},t.prototype.bind=function(e,t,n){var r=this,i=t.id+"-results";e.call(this,t,n),this.$search.on("keydown",function(e){r.trigger("keypress",e),r._keyUpPrevented=e.isDefaultPrevented()}),this.$search.on("input",function(e){o(this).off("keyup")}),this.$search.on("keyup input",function(e){r.handleSearch(e)}),t.on("open",function(){r.$search.attr("tabindex",0),r.$search.attr("aria-controls",i),r.$search.trigger("focus"),window.setTimeout(function(){r.$search.trigger("focus")},0)}),t.on("close",function(){r.$search.attr("tabindex",-1),r.$search.removeAttr("aria-controls"),r.$search.removeAttr("aria-activedescendant"),r.$search.val(""),r.$search.trigger("blur")}),t.on("focus",function(){t.isOpen()||r.$search.trigger("focus")}),t.on("results:all",function(e){null!=e.query.term&&""!==e.query.term||(r.showSearch(e)?r.$searchContainer.removeClass("select2-search--hide"):r.$searchContainer.addClass("select2-search--hide"))}),t.on("results:focus",function(e){e.data._resultId?r.$search.attr("aria-activedescendant",e.data._resultId):r.$search.removeAttr("aria-activedescendant")})},t.prototype.handleSearch=function(e){if(!this._keyUpPrevented){var t=this.$search.val();this.trigger("query",{term:t})}this._keyUpPrevented=!1},t.prototype.showSearch=function(e,t){return!0},t}),e.define("select2/dropdown/hidePlaceholder",[],function(){function e(e,t,n,r){this.placeholder=this.normalizePlaceholder(n.get("placeholder")),e.call(this,t,n,r)}return e.prototype.append=function(e,t){t.results=this.removePlaceholder(t.results),e.call(this,t)},e.prototype.normalizePlaceholder=function(e,t){return"string"==typeof t&&(t={id:"",text:t}),t},e.prototype.removePlaceholder=function(e,t){for(var n=t.slice(0),r=t.length-1;0<=r;r--){var i=t[r];this.placeholder.id===i.id&&n.splice(r,1)}return n},e}),e.define("select2/dropdown/infiniteScroll",["jquery"],function(n){function e(e,t,n,r){this.lastParams={},e.call(this,t,n,r),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return e.prototype.append=function(e,t){this.$loadingMore.remove(),this.loading=!1,e.call(this,t),this.showLoadingMore(t)&&(this.$results.append(this.$loadingMore),this.loadMoreIfNeeded())},e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("query",function(e){r.lastParams=e,r.loading=!0}),t.on("query:append",function(e){r.lastParams=e,r.loading=!0}),this.$results.on("scroll",this.loadMoreIfNeeded.bind(this))},e.prototype.loadMoreIfNeeded=function(){var e=n.contains(document.documentElement,this.$loadingMore[0]);if(!this.loading&&e){var t=this.$results.offset().top+this.$results.outerHeight(!1);this.$loadingMore.offset().top+this.$loadingMore.outerHeight(!1)<=t+50&&this.loadMore()}},e.prototype.loadMore=function(){this.loading=!0;var e=n.extend({},{page:1},this.lastParams);e.page++,this.trigger("query:append",e)},e.prototype.showLoadingMore=function(e,t){return t.pagination&&t.pagination.more},e.prototype.createLoadingMore=function(){var e=n('<li class="select2-results__option select2-results__option--load-more"role="option" aria-disabled="true"></li>'),t=this.options.get("translations").get("loadingMore");return e.html(t(this.lastParams)),e},e}),e.define("select2/dropdown/attachBody",["jquery","../utils"],function(f,a){function e(e,t,n){this.$dropdownParent=f(n.get("dropdownParent")||document.body),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("open",function(){r._showDropdown(),r._attachPositioningHandler(t),r._bindContainerResultHandlers(t)}),t.on("close",function(){r._hideDropdown(),r._detachPositioningHandler(t)}),this.$dropdownContainer.on("mousedown",function(e){e.stopPropagation()})},e.prototype.destroy=function(e){e.call(this),this.$dropdownContainer.remove()},e.prototype.position=function(e,t,n){t.attr("class",n.attr("class")),t.removeClass("select2"),t.addClass("select2-container--open"),t.css({position:"absolute",top:-999999}),this.$container=n},e.prototype.render=function(e){var t=f("<span></span>"),n=e.call(this);return t.append(n),this.$dropdownContainer=t},e.prototype._hideDropdown=function(e){this.$dropdownContainer.detach()},e.prototype._bindContainerResultHandlers=function(e,t){if(!this._containerResultsHandlersBound){var n=this;t.on("results:all",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("results:append",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("results:message",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("select",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("unselect",function(){n._positionDropdown(),n._resizeDropdown()}),this._containerResultsHandlersBound=!0}},e.prototype._attachPositioningHandler=function(e,t){var n=this,r="scroll.select2."+t.id,i="resize.select2."+t.id,o="orientationchange.select2."+t.id,s=this.$container.parents().filter(a.hasScroll);s.each(function(){a.StoreData(this,"select2-scroll-position",{x:f(this).scrollLeft(),y:f(this).scrollTop()})}),s.on(r,function(e){var t=a.GetData(this,"select2-scroll-position");f(this).scrollTop(t.y)}),f(window).on(r+" "+i+" "+o,function(e){n._positionDropdown(),n._resizeDropdown()})},e.prototype._detachPositioningHandler=function(e,t){var n="scroll.select2."+t.id,r="resize.select2."+t.id,i="orientationchange.select2."+t.id;this.$container.parents().filter(a.hasScroll).off(n),f(window).off(n+" "+r+" "+i)},e.prototype._positionDropdown=function(){var e=f(window),t=this.$dropdown.hasClass("select2-dropdown--above"),n=this.$dropdown.hasClass("select2-dropdown--below"),r=null,i=this.$container.offset();i.bottom=i.top+this.$container.outerHeight(!1);var o={height:this.$container.outerHeight(!1)};o.top=i.top,o.bottom=i.top+o.height;var s=this.$dropdown.outerHeight(!1),a=e.scrollTop(),l=e.scrollTop()+e.height(),c=a<i.top-s,u=l>i.bottom+s,d={left:i.left,top:o.bottom},p=this.$dropdownParent;"static"===p.css("position")&&(p=p.offsetParent());var h={top:0,left:0};(f.contains(document.body,p[0])||p[0].isConnected)&&(h=p.offset()),d.top-=h.top,d.left-=h.left,t||n||(r="below"),u||!c||t?!c&&u&&t&&(r="below"):r="above",("above"==r||t&&"below"!==r)&&(d.top=o.top-h.top-s),null!=r&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+r),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+r)),this.$dropdownContainer.css(d)},e.prototype._resizeDropdown=function(){var e={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(e.minWidth=e.width,e.position="relative",e.width="auto"),this.$dropdown.css(e)},e.prototype._showDropdown=function(e){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},e}),e.define("select2/dropdown/minimumResultsForSearch",[],function(){function e(e,t,n,r){this.minimumResultsForSearch=n.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),e.call(this,t,n,r)}return e.prototype.showSearch=function(e,t){return!(function e(t){for(var n=0,r=0;r<t.length;r++){var i=t[r];i.children?n+=e(i.children):n++}return n}(t.data.results)<this.minimumResultsForSearch)&&e.call(this,t)},e}),e.define("select2/dropdown/selectOnClose",["../utils"],function(o){function e(){}return e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("close",function(e){r._handleSelectOnClose(e)})},e.prototype._handleSelectOnClose=function(e,t){if(t&&null!=t.originalSelect2Event){var n=t.originalSelect2Event;if("select"===n._type||"unselect"===n._type)return}var r=this.getHighlightedResults();if(!(r.length<1)){var i=o.GetData(r[0],"data");null!=i.element&&i.element.selected||null==i.element&&i.selected||this.trigger("select",{data:i})}},e}),e.define("select2/dropdown/closeOnSelect",[],function(){function e(){}return e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("select",function(e){r._selectTriggered(e)}),t.on("unselect",function(e){r._selectTriggered(e)})},e.prototype._selectTriggered=function(e,t){var n=t.originalEvent;n&&(n.ctrlKey||n.metaKey)||this.trigger("close",{originalEvent:n,originalSelect2Event:t})},e}),e.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Please delete "+t+" character";return 1!=t&&(n+="s"),n},inputTooShort:function(e){return"Please enter "+(e.minimum-e.input.length)+" or more characters"},loadingMore:function(){return"Loading more results…"},maximumSelected:function(e){var t="You can only select "+e.maximum+" item";return 1!=e.maximum&&(t+="s"),t},noResults:function(){return"No results found"},searching:function(){return"Searching…"},removeAllItems:function(){return"Remove all items"}}}),e.define("select2/defaults",["jquery","require","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./i18n/en"],function(c,u,d,p,h,f,g,m,v,y,s,t,_,$,b,w,A,x,D,S,E,C,O,T,q,L,I,j,e){function n(){this.reset()}return n.prototype.apply=function(e){if(null==(e=c.extend(!0,{},this.defaults,e)).dataAdapter){if(null!=e.ajax?e.dataAdapter=b:null!=e.data?e.dataAdapter=$:e.dataAdapter=_,0<e.minimumInputLength&&(e.dataAdapter=y.Decorate(e.dataAdapter,x)),0<e.maximumInputLength&&(e.dataAdapter=y.Decorate(e.dataAdapter,D)),0<e.maximumSelectionLength&&(e.dataAdapter=y.Decorate(e.dataAdapter,S)),e.tags&&(e.dataAdapter=y.Decorate(e.dataAdapter,w)),null==e.tokenSeparators&&null==e.tokenizer||(e.dataAdapter=y.Decorate(e.dataAdapter,A)),null!=e.query){var t=u(e.amdBase+"compat/query");e.dataAdapter=y.Decorate(e.dataAdapter,t)}if(null!=e.initSelection){var n=u(e.amdBase+"compat/initSelection");e.dataAdapter=y.Decorate(e.dataAdapter,n)}}if(null==e.resultsAdapter&&(e.resultsAdapter=d,null!=e.ajax&&(e.resultsAdapter=y.Decorate(e.resultsAdapter,T)),null!=e.placeholder&&(e.resultsAdapter=y.Decorate(e.resultsAdapter,O)),e.selectOnClose&&(e.resultsAdapter=y.Decorate(e.resultsAdapter,I))),null==e.dropdownAdapter){if(e.multiple)e.dropdownAdapter=E;else{var r=y.Decorate(E,C);e.dropdownAdapter=r}if(0!==e.minimumResultsForSearch&&(e.dropdownAdapter=y.Decorate(e.dropdownAdapter,L)),e.closeOnSelect&&(e.dropdownAdapter=y.Decorate(e.dropdownAdapter,j)),null!=e.dropdownCssClass||null!=e.dropdownCss||null!=e.adaptDropdownCssClass){var i=u(e.amdBase+"compat/dropdownCss");e.dropdownAdapter=y.Decorate(e.dropdownAdapter,i)}e.dropdownAdapter=y.Decorate(e.dropdownAdapter,q)}if(null==e.selectionAdapter){if(e.multiple?e.selectionAdapter=h:e.selectionAdapter=p,null!=e.placeholder&&(e.selectionAdapter=y.Decorate(e.selectionAdapter,f)),e.allowClear&&(e.selectionAdapter=y.Decorate(e.selectionAdapter,g)),e.multiple&&(e.selectionAdapter=y.Decorate(e.selectionAdapter,m)),null!=e.containerCssClass||null!=e.containerCss||null!=e.adaptContainerCssClass){var o=u(e.amdBase+"compat/containerCss");e.selectionAdapter=y.Decorate(e.selectionAdapter,o)}e.selectionAdapter=y.Decorate(e.selectionAdapter,v)}e.language=this._resolveLanguage(e.language),e.language.push("en");for(var s=[],a=0;a<e.language.length;a++){var l=e.language[a];-1===s.indexOf(l)&&s.push(l)}return e.language=s,e.translations=this._processTranslations(e.language,e.debug),e},n.prototype.reset=function(){function a(e){return e.replace(/[^\u0000-\u007E]/g,function(e){return t[e]||e})}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:y.escapeMarkup,language:{},matcher:function e(t,n){if(""===c.trim(t.term))return n;if(n.children&&0<n.children.length){for(var r=c.extend(!0,{},n),i=n.children.length-1;0<=i;i--)null==e(t,n.children[i])&&r.children.splice(i,1);return 0<r.children.length?r:e(t,r)}var o=a(n.text).toUpperCase(),s=a(t.term).toUpperCase();return-1<o.indexOf(s)?n:null},minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,scrollAfterSelect:!1,sorter:function(e){return e},templateResult:function(e){return e.text},templateSelection:function(e){return e.text},theme:"default",width:"resolve"}},n.prototype.applyFromElement=function(e,t){var n=e.language,r=this.defaults.language,i=t.prop("lang"),o=t.closest("[lang]").prop("lang"),s=Array.prototype.concat.call(this._resolveLanguage(i),this._resolveLanguage(n),this._resolveLanguage(r),this._resolveLanguage(o));return e.language=s,e},n.prototype._resolveLanguage=function(e){if(!e)return[];if(c.isEmptyObject(e))return[];if(c.isPlainObject(e))return[e];var t;t=c.isArray(e)?e:[e];for(var n=[],r=0;r<t.length;r++)if(n.push(t[r]),"string"==typeof t[r]&&0<t[r].indexOf("-")){var i=t[r].split("-")[0];n.push(i)}return n},n.prototype._processTranslations=function(e,t){for(var n=new s,r=0;r<e.length;r++){var i=new s,o=e[r];if("string"==typeof o)try{i=s.loadPath(o)}catch(e){try{o=this.defaults.amdLanguageBase+o,i=s.loadPath(o)}catch(e){t&&window.console&&console.warn&&console.warn('Select2: The language file for "'+o+'" could not be automatically loaded. A fallback will be used instead.')}}else i=c.isPlainObject(o)?new s(o):o;n.extend(i)}return n},n.prototype.set=function(e,t){var n={};n[c.camelCase(e)]=t;var r=y._convertData(n);c.extend(!0,this.defaults,r)},new n}),e.define("select2/options",["require","jquery","./defaults","./utils"],function(r,d,i,p){function e(e,t){if(this.options=e,null!=t&&this.fromElement(t),null!=t&&(this.options=i.applyFromElement(this.options,t)),this.options=i.apply(this.options),t&&t.is("input")){var n=r(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=p.Decorate(this.options.dataAdapter,n)}}return e.prototype.fromElement=function(e){var t=["select2"];null==this.options.multiple&&(this.options.multiple=e.prop("multiple")),null==this.options.disabled&&(this.options.disabled=e.prop("disabled")),null==this.options.dir&&(e.prop("dir")?this.options.dir=e.prop("dir"):e.closest("[dir]").prop("dir")?this.options.dir=e.closest("[dir]").prop("dir"):this.options.dir="ltr"),e.prop("disabled",this.options.disabled),e.prop("multiple",this.options.multiple),p.GetData(e[0],"select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),p.StoreData(e[0],"data",p.GetData(e[0],"select2Tags")),p.StoreData(e[0],"tags",!0)),p.GetData(e[0],"ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),e.attr("ajax--url",p.GetData(e[0],"ajaxUrl")),p.StoreData(e[0],"ajax-Url",p.GetData(e[0],"ajaxUrl")));var n={};function r(e,t){return t.toUpperCase()}for(var i=0;i<e[0].attributes.length;i++){var o=e[0].attributes[i].name,s="data-";if(o.substr(0,s.length)==s){var a=o.substring(s.length),l=p.GetData(e[0],a);n[a.replace(/-([a-z])/g,r)]=l}}d.fn.jquery&&"1."==d.fn.jquery.substr(0,2)&&e[0].dataset&&(n=d.extend(!0,{},e[0].dataset,n));var c=d.extend(!0,{},p.GetData(e[0]),n);for(var u in c=p._convertData(c))-1<d.inArray(u,t)||(d.isPlainObject(this.options[u])?d.extend(this.options[u],c[u]):this.options[u]=c[u]);return this},e.prototype.get=function(e){return this.options[e]},e.prototype.set=function(e,t){this.options[e]=t},e}),e.define("select2/core",["jquery","./options","./utils","./keys"],function(o,c,u,r){var d=function(e,t){null!=u.GetData(e[0],"select2")&&u.GetData(e[0],"select2").destroy(),this.$element=e,this.id=this._generateId(e),t=t||{},this.options=new c(t,e),d.__super__.constructor.call(this);var n=e.attr("tabindex")||0;u.StoreData(e[0],"old-tabindex",n),e.attr("tabindex","-1");var r=this.options.get("dataAdapter");this.dataAdapter=new r(e,this.options);var i=this.render();this._placeContainer(i);var o=this.options.get("selectionAdapter");this.selection=new o(e,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,i);var s=this.options.get("dropdownAdapter");this.dropdown=new s(e,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,i);var a=this.options.get("resultsAdapter");this.results=new a(e,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var l=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(e){l.trigger("selection:update",{data:e})}),e.addClass("select2-hidden-accessible"),e.attr("aria-hidden","true"),this._syncAttributes(),u.StoreData(e[0],"select2",this),e.data("select2",this)};return u.Extend(d,u.Observable),d.prototype._generateId=function(e){return"select2-"+(null!=e.attr("id")?e.attr("id"):null!=e.attr("name")?e.attr("name")+"-"+u.generateChars(2):u.generateChars(4)).replace(/(:|\.|\[|\]|,)/g,"")},d.prototype._placeContainer=function(e){e.insertAfter(this.$element);var t=this._resolveWidth(this.$element,this.options.get("width"));null!=t&&e.css("width",t)},d.prototype._resolveWidth=function(e,t){var n=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==t){var r=this._resolveWidth(e,"style");return null!=r?r:this._resolveWidth(e,"element")}if("element"==t){var i=e.outerWidth(!1);return i<=0?"auto":i+"px"}if("style"!=t)return"computedstyle"!=t?t:window.getComputedStyle(e[0]).width;var o=e.attr("style");if("string"!=typeof o)return null;for(var s=o.split(";"),a=0,l=s.length;a<l;a+=1){var c=s[a].replace(/\s/g,"").match(n);if(null!==c&&1<=c.length)return c[1]}return null},d.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},d.prototype._registerDomEvents=function(){var t=this;this.$element.on("change.select2",function(){t.dataAdapter.current(function(e){t.trigger("selection:update",{data:e})})}),this.$element.on("focus.select2",function(e){t.trigger("focus",e)}),this._syncA=u.bind(this._syncAttributes,this),this._syncS=u.bind(this._syncSubtree,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._syncA);var e=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=e?(this._observer=new e(function(e){t._syncA(),t._syncS(null,e)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})):this.$element[0].addEventListener&&(this.$element[0].addEventListener("DOMAttrModified",t._syncA,!1),this.$element[0].addEventListener("DOMNodeInserted",t._syncS,!1),this.$element[0].addEventListener("DOMNodeRemoved",t._syncS,!1))},d.prototype._registerDataEvents=function(){var n=this;this.dataAdapter.on("*",function(e,t){n.trigger(e,t)})},d.prototype._registerSelectionEvents=function(){var n=this,r=["toggle","focus"];this.selection.on("toggle",function(){n.toggleDropdown()}),this.selection.on("focus",function(e){n.focus(e)}),this.selection.on("*",function(e,t){-1===o.inArray(e,r)&&n.trigger(e,t)})},d.prototype._registerDropdownEvents=function(){var n=this;this.dropdown.on("*",function(e,t){n.trigger(e,t)})},d.prototype._registerResultsEvents=function(){var n=this;this.results.on("*",function(e,t){n.trigger(e,t)})},d.prototype._registerEvents=function(){var n=this;this.on("open",function(){n.$container.addClass("select2-container--open")}),this.on("close",function(){n.$container.removeClass("select2-container--open")}),this.on("enable",function(){n.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){n.$container.addClass("select2-container--disabled")}),this.on("blur",function(){n.$container.removeClass("select2-container--focus")}),this.on("query",function(t){n.isOpen()||n.trigger("open",{}),this.dataAdapter.query(t,function(e){n.trigger("results:all",{data:e,query:t})})}),this.on("query:append",function(t){this.dataAdapter.query(t,function(e){n.trigger("results:append",{data:e,query:t})})}),this.on("keypress",function(e){var t=e.which;n.isOpen()?t===r.ESC||t===r.TAB||t===r.UP&&e.altKey?(n.close(e),e.preventDefault()):t===r.ENTER?(n.trigger("results:select",{}),e.preventDefault()):t===r.SPACE&&e.ctrlKey?(n.trigger("results:toggle",{}),e.preventDefault()):t===r.UP?(n.trigger("results:previous",{}),e.preventDefault()):t===r.DOWN&&(n.trigger("results:next",{}),e.preventDefault()):(t===r.ENTER||t===r.SPACE||t===r.DOWN&&e.altKey)&&(n.open(),e.preventDefault())})},d.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.isDisabled()?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},d.prototype._isChangeMutation=function(e,t){var n=!1,r=this;if(!e||!e.target||"OPTION"===e.target.nodeName||"OPTGROUP"===e.target.nodeName){if(t)if(t.addedNodes&&0<t.addedNodes.length)for(var i=0;i<t.addedNodes.length;i++){t.addedNodes[i].selected&&(n=!0)}else t.removedNodes&&0<t.removedNodes.length?n=!0:o.isArray(t)&&o.each(t,function(e,t){if(r._isChangeMutation(e,t))return!(n=!0)});else n=!0;return n}},d.prototype._syncSubtree=function(e,t){var n=this._isChangeMutation(e,t),r=this;n&&this.dataAdapter.current(function(e){r.trigger("selection:update",{data:e})})},d.prototype.trigger=function(e,t){var n=d.__super__.trigger,r={open:"opening",close:"closing",select:"selecting",unselect:"unselecting",clear:"clearing"};if(void 0===t&&(t={}),e in r){var i=r[e],o={prevented:!1,name:e,args:t};if(n.call(this,i,o),o.prevented)return void(t.prevented=!0)}n.call(this,e,t)},d.prototype.toggleDropdown=function(){this.isDisabled()||(this.isOpen()?this.close():this.open())},d.prototype.open=function(){this.isOpen()||this.isDisabled()||this.trigger("query",{})},d.prototype.close=function(e){this.isOpen()&&this.trigger("close",{originalEvent:e})},d.prototype.isEnabled=function(){return!this.isDisabled()},d.prototype.isDisabled=function(){return this.options.get("disabled")},d.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},d.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},d.prototype.focus=function(e){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},d.prototype.enable=function(e){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),null!=e&&0!==e.length||(e=[!0]);var t=!e[0];this.$element.prop("disabled",t)},d.prototype.data=function(){this.options.get("debug")&&0<arguments.length&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var t=[];return this.dataAdapter.current(function(e){t=e}),t},d.prototype.val=function(e){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==e||0===e.length)return this.$element.val();var t=e[0];o.isArray(t)&&(t=o.map(t,function(e){return e.toString()})),this.$element.val(t).trigger("input").trigger("change")},d.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._syncA),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&(this.$element[0].removeEventListener("DOMAttrModified",this._syncA,!1),this.$element[0].removeEventListener("DOMNodeInserted",this._syncS,!1),this.$element[0].removeEventListener("DOMNodeRemoved",this._syncS,!1)),this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",u.GetData(this.$element[0],"old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),u.RemoveData(this.$element[0]),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null},d.prototype.render=function(){var e=o('<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>');return e.attr("dir",this.options.get("dir")),this.$container=e,this.$container.addClass("select2-container--"+this.options.get("theme")),u.StoreData(e[0],"element",this.$element),e},d}),e.define("jquery-mousewheel",["jquery"],function(e){return e}),e.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults","./select2/utils"],function(i,e,o,t,s){if(null==i.fn.select2){var a=["open","close","destroy"];i.fn.select2=function(t){if("object"==typeof(t=t||{}))return this.each(function(){var e=i.extend(!0,{},t);new o(i(this),e)}),this;if("string"!=typeof t)throw new Error("Invalid arguments for Select2: "+t);var n,r=Array.prototype.slice.call(arguments,1);return this.each(function(){var e=s.GetData(this,"select2");null==e&&window.console&&console.error&&console.error("The select2('"+t+"') method was called on an element that is not using Select2."),n=e[t].apply(e,r)}),-1<i.inArray(t,a)?this:n}}return null==i.fn.select2.defaults&&(i.fn.select2.defaults=t),o}),{define:e.define,require:e.require}}(),t=e.require("jquery.select2");return u.fn.select2.amd=e,t}); +!function(n){"function"==typeof define&&define.amd?define(["jquery"],n):"object"==typeof module&&module.exports?module.exports=function(e,t){return void 0===t&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),n(t),t}:n(jQuery)}(function(u){var e=function(){if(u&&u.fn&&u.fn.select2&&u.fn.select2.amd)var e=u.fn.select2.amd;var t,n,r,h,o,s,f,g,m,v,y,_,i,a,b;function w(e,t){return i.call(e,t)}function l(e,t){var n,r,i,o,s,a,l,c,u,d,p,h=t&&t.split("/"),f=y.map,g=f&&f["*"]||{};if(e){for(s=(e=e.split("/")).length-1,y.nodeIdCompat&&b.test(e[s])&&(e[s]=e[s].replace(b,"")),"."===e[0].charAt(0)&&h&&(e=h.slice(0,h.length-1).concat(e)),u=0;u<e.length;u++)if("."===(p=e[u]))e.splice(u,1),u-=1;else if(".."===p){if(0===u||1===u&&".."===e[2]||".."===e[u-1])continue;0<u&&(e.splice(u-1,2),u-=2)}e=e.join("/")}if((h||g)&&f){for(u=(n=e.split("/")).length;0<u;u-=1){if(r=n.slice(0,u).join("/"),h)for(d=h.length;0<d;d-=1)if(i=(i=f[h.slice(0,d).join("/")])&&i[r]){o=i,a=u;break}if(o)break;!l&&g&&g[r]&&(l=g[r],c=u)}!o&&l&&(o=l,a=c),o&&(n.splice(0,a,o),e=n.join("/"))}return e}function A(t,n){return function(){var e=a.call(arguments,0);return"string"!=typeof e[0]&&1===e.length&&e.push(null),s.apply(h,e.concat([t,n]))}}function x(t){return function(e){m[t]=e}}function D(e){if(w(v,e)){var t=v[e];delete v[e],_[e]=!0,o.apply(h,t)}if(!w(m,e)&&!w(_,e))throw new Error("No "+e);return m[e]}function c(e){var t,n=e?e.indexOf("!"):-1;return-1<n&&(t=e.substring(0,n),e=e.substring(n+1,e.length)),[t,e]}function S(e){return e?c(e):[]}return e&&e.requirejs||(e?n=e:e={},m={},v={},y={},_={},i=Object.prototype.hasOwnProperty,a=[].slice,b=/\.js$/,f=function(e,t){var n,r=c(e),i=r[0],o=t[1];return e=r[1],i&&(n=D(i=l(i,o))),i?e=n&&n.normalize?n.normalize(e,function(t){return function(e){return l(e,t)}}(o)):l(e,o):(i=(r=c(e=l(e,o)))[0],e=r[1],i&&(n=D(i))),{f:i?i+"!"+e:e,n:e,pr:i,p:n}},g={require:function(e){return A(e)},exports:function(e){var t=m[e];return void 0!==t?t:m[e]={}},module:function(e){return{id:e,uri:"",exports:m[e],config:function(e){return function(){return y&&y.config&&y.config[e]||{}}}(e)}}},o=function(e,t,n,r){var i,o,s,a,l,c,u,d=[],p=typeof n;if(c=S(r=r||e),"undefined"==p||"function"==p){for(t=!t.length&&n.length?["require","exports","module"]:t,l=0;l<t.length;l+=1)if("require"===(o=(a=f(t[l],c)).f))d[l]=g.require(e);else if("exports"===o)d[l]=g.exports(e),u=!0;else if("module"===o)i=d[l]=g.module(e);else if(w(m,o)||w(v,o)||w(_,o))d[l]=D(o);else{if(!a.p)throw new Error(e+" missing "+o);a.p.load(a.n,A(r,!0),x(o),{}),d[l]=m[o]}s=n?n.apply(m[e],d):void 0,e&&(i&&i.exports!==h&&i.exports!==m[e]?m[e]=i.exports:s===h&&u||(m[e]=s))}else e&&(m[e]=n)},t=n=s=function(e,t,n,r,i){if("string"==typeof e)return g[e]?g[e](t):D(f(e,S(t)).f);if(!e.splice){if((y=e).deps&&s(y.deps,y.callback),!t)return;t.splice?(e=t,t=n,n=null):e=h}return t=t||function(){},"function"==typeof n&&(n=r,r=i),r?o(h,e,t,n):setTimeout(function(){o(h,e,t,n)},4),s},s.config=function(e){return s(e)},t._defined=m,(r=function(e,t,n){if("string"!=typeof e)throw new Error("See almond README: incorrect module build, no module name");t.splice||(n=t,t=[]),w(m,e)||w(v,e)||(v[e]=[e,t,n])}).amd={jQuery:!0},e.requirejs=t,e.require=n,e.define=r),e.define("almond",function(){}),e.define("jquery",[],function(){var e=u||$;return null==e&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),e}),e.define("select2/utils",["jquery"],function(o){var i={};function u(e){var t=e.prototype,n=[];for(var r in t){"function"==typeof t[r]&&"constructor"!==r&&n.push(r)}return n}i.Extend=function(e,t){var n={}.hasOwnProperty;function r(){this.constructor=e}for(var i in t)n.call(t,i)&&(e[i]=t[i]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e},i.Decorate=function(r,i){var e=u(i),t=u(r);function o(){var e=Array.prototype.unshift,t=i.prototype.constructor.length,n=r.prototype.constructor;0<t&&(e.call(arguments,r.prototype.constructor),n=i.prototype.constructor),n.apply(this,arguments)}i.displayName=r.displayName,o.prototype=new function(){this.constructor=o};for(var n=0;n<t.length;n++){var s=t[n];o.prototype[s]=r.prototype[s]}function a(e){var t=function(){};e in o.prototype&&(t=o.prototype[e]);var n=i.prototype[e];return function(){return Array.prototype.unshift.call(arguments,t),n.apply(this,arguments)}}for(var l=0;l<e.length;l++){var c=e[l];o.prototype[c]=a(c)}return o};function e(){this.listeners={}}e.prototype.on=function(e,t){this.listeners=this.listeners||{},e in this.listeners?this.listeners[e].push(t):this.listeners[e]=[t]},e.prototype.trigger=function(e){var t=Array.prototype.slice,n=t.call(arguments,1);this.listeners=this.listeners||{},null==n&&(n=[]),0===n.length&&n.push({}),(n[0]._type=e)in this.listeners&&this.invoke(this.listeners[e],t.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},e.prototype.invoke=function(e,t){for(var n=0,r=e.length;n<r;n++)e[n].apply(this,t)},i.Observable=e,i.generateChars=function(e){for(var t="",n=0;n<e;n++){t+=Math.floor(36*Math.random()).toString(36)}return t},i.bind=function(e,t){return function(){e.apply(t,arguments)}},i._convertData=function(e){for(var t in e){var n=t.split("-"),r=e;if(1!==n.length){for(var i=0;i<n.length;i++){var o=n[i];(o=o.substring(0,1).toLowerCase()+o.substring(1))in r||(r[o]={}),i==n.length-1&&(r[o]=e[t]),r=r[o]}delete e[t]}}return e},i.hasScroll=function(e,t){var n=o(t),r=t.style.overflowX,i=t.style.overflowY;return(r!==i||"hidden"!==i&&"visible"!==i)&&("scroll"===r||"scroll"===i||(n.innerHeight()<t.scrollHeight||n.innerWidth()<t.scrollWidth))},i.escapeMarkup=function(e){var t={"\\":"\","&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return"string"!=typeof e?e:String(e).replace(/[&<>"'\/\\]/g,function(e){return t[e]})},i.appendMany=function(e,t){if("1.7"===o.fn.jquery.substr(0,3)){var n=o();o.map(t,function(e){n=n.add(e)}),t=n}e.append(t)},i.__cache={};var n=0;return i.GetUniqueElementId=function(e){var t=e.getAttribute("data-select2-id");return null==t&&(e.id?(t=e.id,e.setAttribute("data-select2-id",t)):(e.setAttribute("data-select2-id",++n),t=n.toString())),t},i.StoreData=function(e,t,n){var r=i.GetUniqueElementId(e);i.__cache[r]||(i.__cache[r]={}),i.__cache[r][t]=n},i.GetData=function(e,t){var n=i.GetUniqueElementId(e);return t?i.__cache[n]&&null!=i.__cache[n][t]?i.__cache[n][t]:o(e).data(t):i.__cache[n]},i.RemoveData=function(e){var t=i.GetUniqueElementId(e);null!=i.__cache[t]&&delete i.__cache[t],e.removeAttribute("data-select2-id")},i}),e.define("select2/results",["jquery","./utils"],function(h,f){function r(e,t,n){this.$element=e,this.data=n,this.options=t,r.__super__.constructor.call(this)}return f.Extend(r,f.Observable),r.prototype.render=function(){var e=h('<ul class="select2-results__options" role="listbox"></ul>');return this.options.get("multiple")&&e.attr("aria-multiselectable","true"),this.$results=e},r.prototype.clear=function(){this.$results.empty()},r.prototype.displayMessage=function(e){var t=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var n=h('<li role="alert" aria-live="assertive" class="select2-results__option"></li>'),r=this.options.get("translations").get(e.message);n.append(t(r(e.args))),n[0].className+=" select2-results__message",this.$results.append(n)},r.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},r.prototype.append=function(e){this.hideLoading();var t=[];if(null!=e.results&&0!==e.results.length){e.results=this.sort(e.results);for(var n=0;n<e.results.length;n++){var r=e.results[n],i=this.option(r);t.push(i)}this.$results.append(t)}else 0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"})},r.prototype.position=function(e,t){t.find(".select2-results").append(e)},r.prototype.sort=function(e){return this.options.get("sorter")(e)},r.prototype.highlightFirstItem=function(){var e=this.$results.find(".select2-results__option[aria-selected]"),t=e.filter("[aria-selected=true]");0<t.length?t.first().trigger("mouseenter"):e.first().trigger("mouseenter"),this.ensureHighlightVisible()},r.prototype.setClasses=function(){var t=this;this.data.current(function(e){var r=h.map(e,function(e){return e.id.toString()});t.$results.find(".select2-results__option[aria-selected]").each(function(){var e=h(this),t=f.GetData(this,"data"),n=""+t.id;null!=t.element&&t.element.selected||null==t.element&&-1<h.inArray(n,r)?e.attr("aria-selected","true"):e.attr("aria-selected","false")})})},r.prototype.showLoading=function(e){this.hideLoading();var t={disabled:!0,loading:!0,text:this.options.get("translations").get("searching")(e)},n=this.option(t);n.className+=" loading-results",this.$results.prepend(n)},r.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},r.prototype.option=function(e){var t=document.createElement("li");t.className="select2-results__option";var n={role:"option","aria-selected":"false"},r=window.Element.prototype.matches||window.Element.prototype.msMatchesSelector||window.Element.prototype.webkitMatchesSelector;for(var i in(null!=e.element&&r.call(e.element,":disabled")||null==e.element&&e.disabled)&&(delete n["aria-selected"],n["aria-disabled"]="true"),null==e.id&&delete n["aria-selected"],null!=e._resultId&&(t.id=e._resultId),e.title&&(t.title=e.title),e.children&&(n.role="group",n["aria-label"]=e.text,delete n["aria-selected"]),n){var o=n[i];t.setAttribute(i,o)}if(e.children){var s=h(t),a=document.createElement("strong");a.className="select2-results__group";h(a);this.template(e,a);for(var l=[],c=0;c<e.children.length;c++){var u=e.children[c],d=this.option(u);l.push(d)}var p=h("<ul></ul>",{class:"select2-results__options select2-results__options--nested"});p.append(l),s.append(a),s.append(p)}else this.template(e,t);return f.StoreData(t,"data",e),t},r.prototype.bind=function(t,e){var l=this,n=t.id+"-results";this.$results.attr("id",n),t.on("results:all",function(e){l.clear(),l.append(e.data),t.isOpen()&&(l.setClasses(),l.highlightFirstItem())}),t.on("results:append",function(e){l.append(e.data),t.isOpen()&&l.setClasses()}),t.on("query",function(e){l.hideMessages(),l.showLoading(e)}),t.on("select",function(){t.isOpen()&&(l.setClasses(),l.options.get("scrollAfterSelect")&&l.highlightFirstItem())}),t.on("unselect",function(){t.isOpen()&&(l.setClasses(),l.options.get("scrollAfterSelect")&&l.highlightFirstItem())}),t.on("open",function(){l.$results.attr("aria-expanded","true"),l.$results.attr("aria-hidden","false"),l.setClasses(),l.ensureHighlightVisible()}),t.on("close",function(){l.$results.attr("aria-expanded","false"),l.$results.attr("aria-hidden","true"),l.$results.removeAttr("aria-activedescendant")}),t.on("results:toggle",function(){var e=l.getHighlightedResults();0!==e.length&&e.trigger("mouseup")}),t.on("results:select",function(){var e=l.getHighlightedResults();if(0!==e.length){var t=f.GetData(e[0],"data");"true"==e.attr("aria-selected")?l.trigger("close",{}):l.trigger("select",{data:t})}}),t.on("results:previous",function(){var e=l.getHighlightedResults(),t=l.$results.find("[aria-selected]"),n=t.index(e);if(!(n<=0)){var r=n-1;0===e.length&&(r=0);var i=t.eq(r);i.trigger("mouseenter");var o=l.$results.offset().top,s=i.offset().top,a=l.$results.scrollTop()+(s-o);0===r?l.$results.scrollTop(0):s-o<0&&l.$results.scrollTop(a)}}),t.on("results:next",function(){var e=l.getHighlightedResults(),t=l.$results.find("[aria-selected]"),n=t.index(e)+1;if(!(n>=t.length)){var r=t.eq(n);r.trigger("mouseenter");var i=l.$results.offset().top+l.$results.outerHeight(!1),o=r.offset().top+r.outerHeight(!1),s=l.$results.scrollTop()+o-i;0===n?l.$results.scrollTop(0):i<o&&l.$results.scrollTop(s)}}),t.on("results:focus",function(e){e.element.addClass("select2-results__option--highlighted")}),t.on("results:message",function(e){l.displayMessage(e)}),h.fn.mousewheel&&this.$results.on("mousewheel",function(e){var t=l.$results.scrollTop(),n=l.$results.get(0).scrollHeight-t+e.deltaY,r=0<e.deltaY&&t-e.deltaY<=0,i=e.deltaY<0&&n<=l.$results.height();r?(l.$results.scrollTop(0),e.preventDefault(),e.stopPropagation()):i&&(l.$results.scrollTop(l.$results.get(0).scrollHeight-l.$results.height()),e.preventDefault(),e.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(e){var t=h(this),n=f.GetData(this,"data");"true"!==t.attr("aria-selected")?l.trigger("select",{originalEvent:e,data:n}):l.options.get("multiple")?l.trigger("unselect",{originalEvent:e,data:n}):l.trigger("close",{})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(e){var t=f.GetData(this,"data");l.getHighlightedResults().removeClass("select2-results__option--highlighted"),l.trigger("results:focus",{data:t,element:h(this)})})},r.prototype.getHighlightedResults=function(){return this.$results.find(".select2-results__option--highlighted")},r.prototype.destroy=function(){this.$results.remove()},r.prototype.ensureHighlightVisible=function(){var e=this.getHighlightedResults();if(0!==e.length){var t=this.$results.find("[aria-selected]").index(e),n=this.$results.offset().top,r=e.offset().top,i=this.$results.scrollTop()+(r-n),o=r-n;i-=2*e.outerHeight(!1),t<=2?this.$results.scrollTop(0):(o>this.$results.outerHeight()||o<0)&&this.$results.scrollTop(i)}},r.prototype.template=function(e,t){var n=this.options.get("templateResult"),r=this.options.get("escapeMarkup"),i=n(e,t);null==i?t.style.display="none":"string"==typeof i?t.innerHTML=r(i):h(t).append(i)},r}),e.define("select2/keys",[],function(){return{BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46}}),e.define("select2/selection/base",["jquery","../utils","../keys"],function(n,r,i){function o(e,t){this.$element=e,this.options=t,o.__super__.constructor.call(this)}return r.Extend(o,r.Observable),o.prototype.render=function(){var e=n('<span class="select2-selection" role="combobox" aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=r.GetData(this.$element[0],"old-tabindex")?this._tabindex=r.GetData(this.$element[0],"old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),e.attr("title",this.$element.attr("title")),e.attr("tabindex",this._tabindex),e.attr("aria-disabled","false"),this.$selection=e},o.prototype.bind=function(e,t){var n=this,r=e.id+"-results";this.container=e,this.$selection.on("focus",function(e){n.trigger("focus",e)}),this.$selection.on("blur",function(e){n._handleBlur(e)}),this.$selection.on("keydown",function(e){n.trigger("keypress",e),e.which===i.SPACE&&e.preventDefault()}),e.on("results:focus",function(e){n.$selection.attr("aria-activedescendant",e.data._resultId)}),e.on("selection:update",function(e){n.update(e.data)}),e.on("open",function(){n.$selection.attr("aria-expanded","true"),n.$selection.attr("aria-owns",r),n._attachCloseHandler(e)}),e.on("close",function(){n.$selection.attr("aria-expanded","false"),n.$selection.removeAttr("aria-activedescendant"),n.$selection.removeAttr("aria-owns"),n.$selection.trigger("focus"),n._detachCloseHandler(e)}),e.on("enable",function(){n.$selection.attr("tabindex",n._tabindex),n.$selection.attr("aria-disabled","false")}),e.on("disable",function(){n.$selection.attr("tabindex","-1"),n.$selection.attr("aria-disabled","true")})},o.prototype._handleBlur=function(e){var t=this;window.setTimeout(function(){document.activeElement==t.$selection[0]||n.contains(t.$selection[0],document.activeElement)||t.trigger("blur",e)},1)},o.prototype._attachCloseHandler=function(e){n(document.body).on("mousedown.select2."+e.id,function(e){var t=n(e.target).closest(".select2");n(".select2.select2-container--open").each(function(){this!=t[0]&&r.GetData(this,"element").select2("close")})})},o.prototype._detachCloseHandler=function(e){n(document.body).off("mousedown.select2."+e.id)},o.prototype.position=function(e,t){t.find(".selection").append(e)},o.prototype.destroy=function(){this._detachCloseHandler(this.container)},o.prototype.update=function(e){throw new Error("The `update` method must be defined in child classes.")},o.prototype.isEnabled=function(){return!this.isDisabled()},o.prototype.isDisabled=function(){return this.options.get("disabled")},o}),e.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(e,t,n,r){function i(){i.__super__.constructor.apply(this,arguments)}return n.Extend(i,t),i.prototype.render=function(){var e=i.__super__.render.call(this);return e.addClass("select2-selection--single"),e.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),e},i.prototype.bind=function(t,e){var n=this;i.__super__.bind.apply(this,arguments);var r=t.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",r).attr("role","textbox").attr("aria-readonly","true"),this.$selection.attr("aria-labelledby",r),this.$selection.on("mousedown",function(e){1===e.which&&n.trigger("toggle",{originalEvent:e})}),this.$selection.on("focus",function(e){}),this.$selection.on("blur",function(e){}),t.on("focus",function(e){t.isOpen()||n.$selection.trigger("focus")})},i.prototype.clear=function(){var e=this.$selection.find(".select2-selection__rendered");e.empty(),e.removeAttr("title")},i.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},i.prototype.selectionContainer=function(){return e("<span></span>")},i.prototype.update=function(e){if(0!==e.length){var t=e[0],n=this.$selection.find(".select2-selection__rendered"),r=this.display(t,n);n.empty().append(r);var i=t.title||t.text;i?n.attr("title",i):n.removeAttr("title")}else this.clear()},i}),e.define("select2/selection/multiple",["jquery","./base","../utils"],function(i,e,l){function n(e,t){n.__super__.constructor.apply(this,arguments)}return l.Extend(n,e),n.prototype.render=function(){var e=n.__super__.render.call(this);return e.addClass("select2-selection--multiple"),e.html('<ul class="select2-selection__rendered"></ul>'),e},n.prototype.bind=function(e,t){var r=this;n.__super__.bind.apply(this,arguments),this.$selection.on("click",function(e){r.trigger("toggle",{originalEvent:e})}),this.$selection.on("click",".select2-selection__choice__remove",function(e){if(!r.isDisabled()){var t=i(this).parent(),n=l.GetData(t[0],"data");r.trigger("unselect",{originalEvent:e,data:n})}})},n.prototype.clear=function(){var e=this.$selection.find(".select2-selection__rendered");e.empty(),e.removeAttr("title")},n.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},n.prototype.selectionContainer=function(){return i('<li class="select2-selection__choice"><span class="select2-selection__choice__remove" role="presentation">×</span></li>')},n.prototype.update=function(e){if(this.clear(),0!==e.length){for(var t=[],n=0;n<e.length;n++){var r=e[n],i=this.selectionContainer(),o=this.display(r,i);i.append(o);var s=r.title||r.text;s&&i.attr("title",s),l.StoreData(i[0],"data",r),t.push(i)}var a=this.$selection.find(".select2-selection__rendered");l.appendMany(a,t)}},n}),e.define("select2/selection/placeholder",["../utils"],function(e){function t(e,t,n){this.placeholder=this.normalizePlaceholder(n.get("placeholder")),e.call(this,t,n)}return t.prototype.normalizePlaceholder=function(e,t){return"string"==typeof t&&(t={id:"",text:t}),t},t.prototype.createPlaceholder=function(e,t){var n=this.selectionContainer();return n.html(this.display(t)),n.addClass("select2-selection__placeholder").removeClass("select2-selection__choice"),n},t.prototype.update=function(e,t){var n=1==t.length&&t[0].id!=this.placeholder.id;if(1<t.length||n)return e.call(this,t);this.clear();var r=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(r)},t}),e.define("select2/selection/allowClear",["jquery","../keys","../utils"],function(i,r,a){function e(){}return e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(e){r._handleClear(e)}),t.on("keypress",function(e){r._handleKeyboardClear(e,t)})},e.prototype._handleClear=function(e,t){if(!this.isDisabled()){var n=this.$selection.find(".select2-selection__clear");if(0!==n.length){t.stopPropagation();var r=a.GetData(n[0],"data"),i=this.$element.val();this.$element.val(this.placeholder.id);var o={data:r};if(this.trigger("clear",o),o.prevented)this.$element.val(i);else{for(var s=0;s<r.length;s++)if(o={data:r[s]},this.trigger("unselect",o),o.prevented)return void this.$element.val(i);this.$element.trigger("input").trigger("change"),this.trigger("toggle",{})}}}},e.prototype._handleKeyboardClear=function(e,t,n){n.isOpen()||t.which!=r.DELETE&&t.which!=r.BACKSPACE||this._handleClear(t)},e.prototype.update=function(e,t){if(e.call(this,t),!(0<this.$selection.find(".select2-selection__placeholder").length||0===t.length)){var n=this.options.get("translations").get("removeAllItems"),r=i('<span class="select2-selection__clear" title="'+n()+'">×</span>');a.StoreData(r[0],"data",t),this.$selection.find(".select2-selection__rendered").prepend(r)}},e}),e.define("select2/selection/search",["jquery","../utils","../keys"],function(r,a,l){function e(e,t,n){e.call(this,t,n)}return e.prototype.render=function(e){var t=r('<li class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="none" spellcheck="false" role="searchbox" aria-autocomplete="list" /></li>');this.$searchContainer=t,this.$search=t.find("input");var n=e.call(this);return this._transferTabIndex(),n},e.prototype.bind=function(e,t,n){var r=this,i=t.id+"-results";e.call(this,t,n),t.on("open",function(){r.$search.attr("aria-controls",i),r.$search.trigger("focus")}),t.on("close",function(){r.$search.val(""),r.$search.removeAttr("aria-controls"),r.$search.removeAttr("aria-activedescendant"),r.$search.trigger("focus")}),t.on("enable",function(){r.$search.prop("disabled",!1),r._transferTabIndex()}),t.on("disable",function(){r.$search.prop("disabled",!0)}),t.on("focus",function(e){r.$search.trigger("focus")}),t.on("results:focus",function(e){e.data._resultId?r.$search.attr("aria-activedescendant",e.data._resultId):r.$search.removeAttr("aria-activedescendant")}),this.$selection.on("focusin",".select2-search--inline",function(e){r.trigger("focus",e)}),this.$selection.on("focusout",".select2-search--inline",function(e){r._handleBlur(e)}),this.$selection.on("keydown",".select2-search--inline",function(e){if(e.stopPropagation(),r.trigger("keypress",e),r._keyUpPrevented=e.isDefaultPrevented(),e.which===l.BACKSPACE&&""===r.$search.val()){var t=r.$searchContainer.prev(".select2-selection__choice");if(0<t.length){var n=a.GetData(t[0],"data");r.searchRemoveChoice(n),e.preventDefault()}}}),this.$selection.on("click",".select2-search--inline",function(e){r.$search.val()&&e.stopPropagation()});var o=document.documentMode,s=o&&o<=11;this.$selection.on("input.searchcheck",".select2-search--inline",function(e){s?r.$selection.off("input.search input.searchcheck"):r.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(e){if(s&&"input"===e.type)r.$selection.off("input.search input.searchcheck");else{var t=e.which;t!=l.SHIFT&&t!=l.CTRL&&t!=l.ALT&&t!=l.TAB&&r.handleSearch(e)}})},e.prototype._transferTabIndex=function(e){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},e.prototype.createPlaceholder=function(e,t){this.$search.attr("placeholder",t.text)},e.prototype.update=function(e,t){var n=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),e.call(this,t),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),n&&this.$search.trigger("focus")},e.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var e=this.$search.val();this.trigger("query",{term:e})}this._keyUpPrevented=!1},e.prototype.searchRemoveChoice=function(e,t){this.trigger("unselect",{data:t}),this.$search.val(t.text),this.handleSearch()},e.prototype.resizeSearch=function(){this.$search.css("width","25px");var e="";""!==this.$search.attr("placeholder")?e=this.$selection.find(".select2-selection__rendered").width():e=.75*(this.$search.val().length+1)+"em";this.$search.css("width",e)},e}),e.define("select2/selection/eventRelay",["jquery"],function(s){function e(){}return e.prototype.bind=function(e,t,n){var r=this,i=["open","opening","close","closing","select","selecting","unselect","unselecting","clear","clearing"],o=["opening","closing","selecting","unselecting","clearing"];e.call(this,t,n),t.on("*",function(e,t){if(-1!==s.inArray(e,i)){t=t||{};var n=s.Event("select2:"+e,{params:t});r.$element.trigger(n),-1!==s.inArray(e,o)&&(t.prevented=n.isDefaultPrevented())}})},e}),e.define("select2/translation",["jquery","require"],function(t,n){function r(e){this.dict=e||{}}return r.prototype.all=function(){return this.dict},r.prototype.get=function(e){return this.dict[e]},r.prototype.extend=function(e){this.dict=t.extend({},e.all(),this.dict)},r._cache={},r.loadPath=function(e){if(!(e in r._cache)){var t=n(e);r._cache[e]=t}return new r(r._cache[e])},r}),e.define("select2/diacritics",[],function(){return{"â’¶":"A","A":"A","À":"A","Ã":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ä€":"A","Ä‚":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ç ":"A","Ä":"A","Çž":"A","Ả":"A","Ã…":"A","Ǻ":"A","Ç":"A","È€":"A","È‚":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ä„":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ç¢":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","â’·":"B","ï¼¢":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Æ‚":"B","Æ":"B","â’¸":"C","ï¼£":"C","Ć":"C","Ĉ":"C","ÄŠ":"C","ÄŒ":"C","Ç":"C","Ḉ":"C","Ƈ":"C","È»":"C","Ꜿ":"C","â’¹":"D","D":"D","Ḋ":"D","ÄŽ":"D","Ḍ":"D","á¸":"D","Ḓ":"D","Ḏ":"D","Ä":"D","Æ‹":"D","ÆŠ":"D","Ɖ":"D","ê¹":"D","DZ":"DZ","Ç„":"DZ","Dz":"Dz","Ç…":"Dz","â’º":"E","ï¼¥":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ä’":"E","Ḕ":"E","Ḗ":"E","Ä”":"E","Ä–":"E","Ë":"E","Ẻ":"E","Äš":"E","È„":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Æ":"E","ÆŽ":"E","â’»":"F","F":"F","Ḟ":"F","Æ‘":"F","ê»":"F","â’¼":"G","G":"G","Ç´":"G","Äœ":"G","Ḡ":"G","Äž":"G","Ä ":"G","Ǧ":"G","Ä¢":"G","Ǥ":"G","Æ“":"G","êž ":"G","ê½":"G","ê¾":"G","â’½":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Èž":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","â±µ":"H","êž":"H","â’¾":"I","I":"I","ÃŒ":"I","Ã":"I","ÃŽ":"I","Ĩ":"I","Ī":"I","Ĭ":"I","Ä°":"I","Ã":"I","Ḯ":"I","Ỉ":"I","Ç":"I","Ȉ":"I","ÈŠ":"I","Ị":"I","Ä®":"I","Ḭ":"I","Æ—":"I","â’¿":"J","J":"J","Ä´":"J","Ɉ":"J","â“€":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","ê€":"K","ê‚":"K","ê„":"K","Ꞣ":"K","â“":"L","L":"L","Ä¿":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ä»":"L","Ḽ":"L","Ḻ":"L","Å":"L","Ƚ":"L","â±¢":"L","â± ":"L","êˆ":"L","ê†":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","â“‚":"M","ï¼":"M","Ḿ":"M","á¹€":"M","Ṃ":"M","â±®":"M","Æœ":"M","Ⓝ":"N","ï¼®":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Å…":"N","Ṋ":"N","Ṉ":"N","È ":"N","Æ":"N","êž":"N","Ꞥ":"N","ÇŠ":"NJ","Ç‹":"Nj","â“„":"O","O":"O","Ã’":"O","Ó":"O","Ô":"O","á»’":"O","á»":"O","á»–":"O","á»”":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","ÅŒ":"O","á¹":"O","á¹’":"O","ÅŽ":"O","È®":"O","È°":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Å":"O","Ç‘":"O","ÈŒ":"O","ÈŽ":"O","Æ ":"O","Ờ":"O","Ớ":"O","á» ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","ÆŸ":"O","êŠ":"O","êŒ":"O","Å’":"OE","Æ¢":"OI","êŽ":"OO","È¢":"OU","â“…":"P","ï¼°":"P","á¹”":"P","á¹–":"P","Ƥ":"P","â±£":"P","ê":"P","ê’":"P","ê”":"P","Ⓠ":"Q","ï¼±":"Q","ê–":"Q","ê˜":"Q","ÉŠ":"Q","Ⓡ":"R","ï¼²":"R","Å”":"R","Ṙ":"R","Ř":"R","È":"R","È’":"R","Ṛ":"R","Ṝ":"R","Å–":"R","Ṟ":"R","ÉŒ":"R","Ɽ":"R","êš":"R","Ꞧ":"R","êž‚":"R","Ⓢ":"S","ï¼³":"S","ẞ":"S","Åš":"S","Ṥ":"S","Åœ":"S","á¹ ":"S","Å ":"S","Ṧ":"S","á¹¢":"S","Ṩ":"S","Ș":"S","Åž":"S","â±¾":"S","Ꞩ":"S","êž„":"S","Ⓣ":"T","ï¼´":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Èš":"T","Å¢":"T","á¹°":"T","á¹®":"T","Ŧ":"T","Ƭ":"T","Æ®":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","â“Š":"U","ï¼µ":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ãœ":"U","Ç›":"U","Ç—":"U","Ç•":"U","Ç™":"U","Ủ":"U","Å®":"U","Å°":"U","Ç“":"U","È”":"U","È–":"U","Ư":"U","Ừ":"U","Ứ":"U","á»®":"U","Ử":"U","á»°":"U","Ụ":"U","á¹²":"U","Ų":"U","Ṷ":"U","á¹´":"U","É„":"U","â“‹":"V","V":"V","á¹¼":"V","á¹¾":"V","Ʋ":"V","êž":"V","É…":"V","ê ":"VY","â“Œ":"W","ï¼·":"W","Ẁ":"W","Ẃ":"W","Å´":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","â±²":"W","â“":"X","X":"X","Ẋ":"X","Ẍ":"X","â“Ž":"Y","ï¼¹":"Y","Ỳ":"Y","Ã":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","á»´":"Y","Ƴ":"Y","ÉŽ":"Y","Ỿ":"Y","â“":"Z","Z":"Z","Ź":"Z","áº":"Z","Å»":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","ê¢":"Z","â“":"a","ï½":"a","ẚ":"a","à ":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","Ä":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","Ç¡":"a","ä":"a","ÇŸ":"a","ả":"a","Ã¥":"a","Ç»":"a","ÇŽ":"a","È":"a","ȃ":"a","ạ":"a","áº":"a","ặ":"a","á¸":"a","Ä…":"a","â±¥":"a","É":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","Ç£":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","â“‘":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","Æ€":"b","ƃ":"b","É“":"b","â“’":"c","c":"c","ć":"c","ĉ":"c","Ä‹":"c","Ä":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","â““":"d","d":"d","ḋ":"d","Ä":"d","á¸":"d","ḑ":"d","ḓ":"d","á¸":"d","Ä‘":"d","ÆŒ":"d","É–":"d","É—":"d","êº":"d","dz":"dz","dž":"dz","â“”":"e","ï½…":"e","è":"e","é":"e","ê":"e","á»":"e","ế":"e","á»…":"e","ể":"e","ẽ":"e","Ä“":"e","ḕ":"e","ḗ":"e","Ä•":"e","Ä—":"e","ë":"e","ẻ":"e","Ä›":"e","È…":"e","ȇ":"e","ẹ":"e","ệ":"e","È©":"e","á¸":"e","Ä™":"e","ḙ":"e","ḛ":"e","ɇ":"e","É›":"e","Ç":"e","â“•":"f","f":"f","ḟ":"f","Æ’":"f","ê¼":"f","â“–":"g","g":"g","ǵ":"g","Ä":"g","ḡ":"g","ÄŸ":"g","Ä¡":"g","ǧ":"g","Ä£":"g","Ç¥":"g","É ":"g","êž¡":"g","áµ¹":"g","ê¿":"g","â“—":"h","h":"h","Ä¥":"h","ḣ":"h","ḧ":"h","ÈŸ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","É¥":"h","Æ•":"hv","ⓘ":"i","i":"i","ì":"i","Ã":"i","î":"i","Ä©":"i","Ä«":"i","Ä":"i","ï":"i","ḯ":"i","ỉ":"i","Ç":"i","ȉ":"i","È‹":"i","ị":"i","į":"i","á¸":"i","ɨ":"i","ı":"i","â“™":"j","j":"j","ĵ":"j","Ç°":"j","ɉ":"j","â“š":"k","k":"k","ḱ":"k","Ç©":"k","ḳ":"k","Ä·":"k","ḵ":"k","Æ™":"k","ⱪ":"k","ê":"k","êƒ":"k","ê…":"k","ꞣ":"k","â“›":"l","l":"l","Å€":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","Å¿":"l","Å‚":"l","Æš":"l","É«":"l","ⱡ":"l","ê‰":"l","êž":"l","ê‡":"l","lj":"lj","â“œ":"m","ï½":"m","ḿ":"m","á¹":"m","ṃ":"m","ɱ":"m","ɯ":"m","â“":"n","n":"n","ǹ":"n","Å„":"n","ñ":"n","á¹…":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","Æž":"n","ɲ":"n","ʼn":"n","êž‘":"n","ꞥ":"n","ÇŒ":"nj","â“ž":"o","ï½":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","á»—":"o","ổ":"o","õ":"o","á¹":"o","È":"o","á¹":"o","Å":"o","ṑ":"o","ṓ":"o","Å":"o","ȯ":"o","ȱ":"o","ö":"o","È«":"o","á»":"o","Å‘":"o","Ç’":"o","È":"o","È":"o","Æ¡":"o","á»":"o","á»›":"o","ỡ":"o","ở":"o","ợ":"o","á»":"o","á»™":"o","Ç«":"o","Ç":"o","ø":"o","Ç¿":"o","É”":"o","ê‹":"o","ê":"o","ɵ":"o","Å“":"oe","Æ£":"oi","È£":"ou","ê":"oo","â“Ÿ":"p","ï½":"p","ṕ":"p","á¹—":"p","Æ¥":"p","áµ½":"p","ê‘":"p","ê“":"p","ê•":"p","â“ ":"q","q":"q","É‹":"q","ê—":"q","ê™":"q","â“¡":"r","ï½’":"r","Å•":"r","á¹™":"r","Å™":"r","È‘":"r","È“":"r","á¹›":"r","á¹":"r","Å—":"r","ṟ":"r","É":"r","ɽ":"r","ê›":"r","ꞧ":"r","ꞃ":"r","â“¢":"s","s":"s","ß":"s","Å›":"s","á¹¥":"s","Å":"s","ṡ":"s","Å¡":"s","ṧ":"s","á¹£":"s","ṩ":"s","È™":"s","ÅŸ":"s","È¿":"s","êž©":"s","êž…":"s","ẛ":"s","â“£":"t","ï½”":"t","ṫ":"t","ẗ":"t","Å¥":"t","á¹":"t","È›":"t","Å£":"t","á¹±":"t","ṯ":"t","ŧ":"t","Æ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","Å©":"u","á¹¹":"u","Å«":"u","á¹»":"u","Å":"u","ü":"u","Çœ":"u","ǘ":"u","Ç–":"u","Çš":"u","ủ":"u","ů":"u","ű":"u","Ç”":"u","È•":"u","È—":"u","Æ°":"u","ừ":"u","ứ":"u","ữ":"u","á»":"u","á»±":"u","ụ":"u","á¹³":"u","ų":"u","á¹·":"u","á¹µ":"u","ʉ":"u","â“¥":"v","ï½–":"v","á¹½":"v","ṿ":"v","Ê‹":"v","êŸ":"v","ÊŒ":"v","ê¡":"vy","ⓦ":"w","ï½—":"w","áº":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","â±³":"w","ⓧ":"x","x":"x","ẋ":"x","áº":"x","ⓨ":"y","ï½™":"y","ỳ":"y","ý":"y","Å·":"y","ỹ":"y","ȳ":"y","áº":"y","ÿ":"y","á»·":"y","ẙ":"y","ỵ":"y","Æ´":"y","É":"y","ỿ":"y","â“©":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","È¥":"z","É€":"z","ⱬ":"z","ê£":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","ÎŒ":"Ο","ÎŽ":"Î¥","Ϋ":"Î¥","Î":"Ω","ά":"α","Î":"ε","ή":"η","ί":"ι","ÏŠ":"ι","Î":"ι","ÏŒ":"ο","Ï":"Ï…","Ï‹":"Ï…","ΰ":"Ï…","ÏŽ":"ω","Ï‚":"σ","’":"'"}}),e.define("select2/data/base",["../utils"],function(r){function n(e,t){n.__super__.constructor.call(this)}return r.Extend(n,r.Observable),n.prototype.current=function(e){throw new Error("The `current` method must be defined in child classes.")},n.prototype.query=function(e,t){throw new Error("The `query` method must be defined in child classes.")},n.prototype.bind=function(e,t){},n.prototype.destroy=function(){},n.prototype.generateResultId=function(e,t){var n=e.id+"-result-";return n+=r.generateChars(4),null!=t.id?n+="-"+t.id.toString():n+="-"+r.generateChars(4),n},n}),e.define("select2/data/select",["./base","../utils","jquery"],function(e,a,l){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return a.Extend(n,e),n.prototype.current=function(e){var n=[],r=this;this.$element.find(":selected").each(function(){var e=l(this),t=r.item(e);n.push(t)}),e(n)},n.prototype.select=function(i){var o=this;if(i.selected=!0,l(i.element).is("option"))return i.element.selected=!0,void this.$element.trigger("input").trigger("change");if(this.$element.prop("multiple"))this.current(function(e){var t=[];(i=[i]).push.apply(i,e);for(var n=0;n<i.length;n++){var r=i[n].id;-1===l.inArray(r,t)&&t.push(r)}o.$element.val(t),o.$element.trigger("input").trigger("change")});else{var e=i.id;this.$element.val(e),this.$element.trigger("input").trigger("change")}},n.prototype.unselect=function(i){var o=this;if(this.$element.prop("multiple")){if(i.selected=!1,l(i.element).is("option"))return i.element.selected=!1,void this.$element.trigger("input").trigger("change");this.current(function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n].id;r!==i.id&&-1===l.inArray(r,t)&&t.push(r)}o.$element.val(t),o.$element.trigger("input").trigger("change")})}},n.prototype.bind=function(e,t){var n=this;(this.container=e).on("select",function(e){n.select(e.data)}),e.on("unselect",function(e){n.unselect(e.data)})},n.prototype.destroy=function(){this.$element.find("*").each(function(){a.RemoveData(this)})},n.prototype.query=function(r,e){var i=[],o=this;this.$element.children().each(function(){var e=l(this);if(e.is("option")||e.is("optgroup")){var t=o.item(e),n=o.matches(r,t);null!==n&&i.push(n)}}),e({results:i})},n.prototype.addOptions=function(e){a.appendMany(this.$element,e)},n.prototype.option=function(e){var t;e.children?(t=document.createElement("optgroup")).label=e.text:void 0!==(t=document.createElement("option")).textContent?t.textContent=e.text:t.innerText=e.text,void 0!==e.id&&(t.value=e.id),e.disabled&&(t.disabled=!0),e.selected&&(t.selected=!0),e.title&&(t.title=e.title);var n=l(t),r=this._normalizeItem(e);return r.element=t,a.StoreData(t,"data",r),n},n.prototype.item=function(e){var t={};if(null!=(t=a.GetData(e[0],"data")))return t;if(e.is("option"))t={id:e.val(),text:e.text(),disabled:e.prop("disabled"),selected:e.prop("selected"),title:e.prop("title")};else if(e.is("optgroup")){t={text:e.prop("label"),children:[],title:e.prop("title")};for(var n=e.children("option"),r=[],i=0;i<n.length;i++){var o=l(n[i]),s=this.item(o);r.push(s)}t.children=r}return(t=this._normalizeItem(t)).element=e[0],a.StoreData(e[0],"data",t),t},n.prototype._normalizeItem=function(e){e!==Object(e)&&(e={id:e,text:e});return null!=(e=l.extend({},{text:""},e)).id&&(e.id=e.id.toString()),null!=e.text&&(e.text=e.text.toString()),null==e._resultId&&e.id&&null!=this.container&&(e._resultId=this.generateResultId(this.container,e)),l.extend({},{selected:!1,disabled:!1},e)},n.prototype.matches=function(e,t){return this.options.get("matcher")(e,t)},n}),e.define("select2/data/array",["./select","../utils","jquery"],function(e,f,g){function r(e,t){this._dataToConvert=t.get("data")||[],r.__super__.constructor.call(this,e,t)}return f.Extend(r,e),r.prototype.bind=function(e,t){r.__super__.bind.call(this,e,t),this.addOptions(this.convertToOptions(this._dataToConvert))},r.prototype.select=function(n){var e=this.$element.find("option").filter(function(e,t){return t.value==n.id.toString()});0===e.length&&(e=this.option(n),this.addOptions(e)),r.__super__.select.call(this,n)},r.prototype.convertToOptions=function(e){var t=this,n=this.$element.find("option"),r=n.map(function(){return t.item(g(this)).id}).get(),i=[];function o(e){return function(){return g(this).val()==e.id}}for(var s=0;s<e.length;s++){var a=this._normalizeItem(e[s]);if(0<=g.inArray(a.id,r)){var l=n.filter(o(a)),c=this.item(l),u=g.extend(!0,{},a,c),d=this.option(u);l.replaceWith(d)}else{var p=this.option(a);if(a.children){var h=this.convertToOptions(a.children);f.appendMany(p,h)}i.push(p)}}return i},r}),e.define("select2/data/ajax",["./array","../utils","jquery"],function(e,t,o){function n(e,t){this.ajaxOptions=this._applyDefaults(t.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),n.__super__.constructor.call(this,e,t)}return t.Extend(n,e),n.prototype._applyDefaults=function(e){var t={data:function(e){return o.extend({},e,{q:e.term})},transport:function(e,t,n){var r=o.ajax(e);return r.then(t),r.fail(n),r}};return o.extend({},t,e,!0)},n.prototype.processResults=function(e){return e},n.prototype.query=function(n,r){var i=this;null!=this._request&&(o.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var t=o.extend({type:"GET"},this.ajaxOptions);function e(){var e=t.transport(t,function(e){var t=i.processResults(e,n);i.options.get("debug")&&window.console&&console.error&&(t&&t.results&&o.isArray(t.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),r(t)},function(){"status"in e&&(0===e.status||"0"===e.status)||i.trigger("results:message",{message:"errorLoading"})});i._request=e}"function"==typeof t.url&&(t.url=t.url.call(this.$element,n)),"function"==typeof t.data&&(t.data=t.data.call(this.$element,n)),this.ajaxOptions.delay&&null!=n.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(e,this.ajaxOptions.delay)):e()},n}),e.define("select2/data/tags",["jquery"],function(u){function e(e,t,n){var r=n.get("tags"),i=n.get("createTag");void 0!==i&&(this.createTag=i);var o=n.get("insertTag");if(void 0!==o&&(this.insertTag=o),e.call(this,t,n),u.isArray(r))for(var s=0;s<r.length;s++){var a=r[s],l=this._normalizeItem(a),c=this.option(l);this.$element.append(c)}}return e.prototype.query=function(e,c,u){var d=this;this._removeOldTags(),null!=c.term&&null==c.page?e.call(this,c,function e(t,n){for(var r=t.results,i=0;i<r.length;i++){var o=r[i],s=null!=o.children&&!e({results:o.children},!0);if((o.text||"").toUpperCase()===(c.term||"").toUpperCase()||s)return!n&&(t.data=r,void u(t))}if(n)return!0;var a=d.createTag(c);if(null!=a){var l=d.option(a);l.attr("data-select2-tag",!0),d.addOptions([l]),d.insertTag(r,a)}t.results=r,u(t)}):e.call(this,c,u)},e.prototype.createTag=function(e,t){var n=u.trim(t.term);return""===n?null:{id:n,text:n}},e.prototype.insertTag=function(e,t,n){t.unshift(n)},e.prototype._removeOldTags=function(e){this.$element.find("option[data-select2-tag]").each(function(){this.selected||u(this).remove()})},e}),e.define("select2/data/tokenizer",["jquery"],function(d){function e(e,t,n){var r=n.get("tokenizer");void 0!==r&&(this.tokenizer=r),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){e.call(this,t,n),this.$search=t.dropdown.$search||t.selection.$search||n.find(".select2-search__field")},e.prototype.query=function(e,t,n){var r=this;t.term=t.term||"";var i=this.tokenizer(t,this.options,function(e){var t=r._normalizeItem(e);if(!r.$element.find("option").filter(function(){return d(this).val()===t.id}).length){var n=r.option(t);n.attr("data-select2-tag",!0),r._removeOldTags(),r.addOptions([n])}!function(e){r.trigger("select",{data:e})}(t)});i.term!==t.term&&(this.$search.length&&(this.$search.val(i.term),this.$search.trigger("focus")),t.term=i.term),e.call(this,t,n)},e.prototype.tokenizer=function(e,t,n,r){for(var i=n.get("tokenSeparators")||[],o=t.term,s=0,a=this.createTag||function(e){return{id:e.term,text:e.term}};s<o.length;){var l=o[s];if(-1!==d.inArray(l,i)){var c=o.substr(0,s),u=a(d.extend({},t,{term:c}));null!=u?(r(u),o=o.substr(s+1)||"",s=0):s++}else s++}return{term:o}},e}),e.define("select2/data/minimumInputLength",[],function(){function e(e,t,n){this.minimumInputLength=n.get("minimumInputLength"),e.call(this,t,n)}return e.prototype.query=function(e,t,n){t.term=t.term||"",t.term.length<this.minimumInputLength?this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:t.term,params:t}}):e.call(this,t,n)},e}),e.define("select2/data/maximumInputLength",[],function(){function e(e,t,n){this.maximumInputLength=n.get("maximumInputLength"),e.call(this,t,n)}return e.prototype.query=function(e,t,n){t.term=t.term||"",0<this.maximumInputLength&&t.term.length>this.maximumInputLength?this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:t.term,params:t}}):e.call(this,t,n)},e}),e.define("select2/data/maximumSelectionLength",[],function(){function e(e,t,n){this.maximumSelectionLength=n.get("maximumSelectionLength"),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("select",function(){r._checkIfMaximumSelected()})},e.prototype.query=function(e,t,n){var r=this;this._checkIfMaximumSelected(function(){e.call(r,t,n)})},e.prototype._checkIfMaximumSelected=function(e,n){var r=this;this.current(function(e){var t=null!=e?e.length:0;0<r.maximumSelectionLength&&t>=r.maximumSelectionLength?r.trigger("results:message",{message:"maximumSelected",args:{maximum:r.maximumSelectionLength}}):n&&n()})},e}),e.define("select2/dropdown",["jquery","./utils"],function(t,e){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return e.Extend(n,e.Observable),n.prototype.render=function(){var e=t('<span class="select2-dropdown"><span class="select2-results"></span></span>');return e.attr("dir",this.options.get("dir")),this.$dropdown=e},n.prototype.bind=function(){},n.prototype.position=function(e,t){},n.prototype.destroy=function(){this.$dropdown.remove()},n}),e.define("select2/dropdown/search",["jquery","../utils"],function(o,e){function t(){}return t.prototype.render=function(e){var t=e.call(this),n=o('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="none" spellcheck="false" role="searchbox" aria-autocomplete="list" /></span>');return this.$searchContainer=n,this.$search=n.find("input"),t.prepend(n),t},t.prototype.bind=function(e,t,n){var r=this,i=t.id+"-results";e.call(this,t,n),this.$search.on("keydown",function(e){r.trigger("keypress",e),r._keyUpPrevented=e.isDefaultPrevented()}),this.$search.on("input",function(e){o(this).off("keyup")}),this.$search.on("keyup input",function(e){r.handleSearch(e)}),t.on("open",function(){r.$search.attr("tabindex",0),r.$search.attr("aria-controls",i),r.$search.trigger("focus"),window.setTimeout(function(){r.$search.trigger("focus")},0)}),t.on("close",function(){r.$search.attr("tabindex",-1),r.$search.removeAttr("aria-controls"),r.$search.removeAttr("aria-activedescendant"),r.$search.val(""),r.$search.trigger("blur")}),t.on("focus",function(){t.isOpen()||r.$search.trigger("focus")}),t.on("results:all",function(e){null!=e.query.term&&""!==e.query.term||(r.showSearch(e)?r.$searchContainer.removeClass("select2-search--hide"):r.$searchContainer.addClass("select2-search--hide"))}),t.on("results:focus",function(e){e.data._resultId?r.$search.attr("aria-activedescendant",e.data._resultId):r.$search.removeAttr("aria-activedescendant")})},t.prototype.handleSearch=function(e){if(!this._keyUpPrevented){var t=this.$search.val();this.trigger("query",{term:t})}this._keyUpPrevented=!1},t.prototype.showSearch=function(e,t){return!0},t}),e.define("select2/dropdown/hidePlaceholder",[],function(){function e(e,t,n,r){this.placeholder=this.normalizePlaceholder(n.get("placeholder")),e.call(this,t,n,r)}return e.prototype.append=function(e,t){t.results=this.removePlaceholder(t.results),e.call(this,t)},e.prototype.normalizePlaceholder=function(e,t){return"string"==typeof t&&(t={id:"",text:t}),t},e.prototype.removePlaceholder=function(e,t){for(var n=t.slice(0),r=t.length-1;0<=r;r--){var i=t[r];this.placeholder.id===i.id&&n.splice(r,1)}return n},e}),e.define("select2/dropdown/infiniteScroll",["jquery"],function(n){function e(e,t,n,r){this.lastParams={},e.call(this,t,n,r),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return e.prototype.append=function(e,t){this.$loadingMore.remove(),this.loading=!1,e.call(this,t),this.showLoadingMore(t)&&(this.$results.append(this.$loadingMore),this.loadMoreIfNeeded())},e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("query",function(e){r.lastParams=e,r.loading=!0}),t.on("query:append",function(e){r.lastParams=e,r.loading=!0}),this.$results.on("scroll",this.loadMoreIfNeeded.bind(this))},e.prototype.loadMoreIfNeeded=function(){var e=n.contains(document.documentElement,this.$loadingMore[0]);if(!this.loading&&e){var t=this.$results.offset().top+this.$results.outerHeight(!1);this.$loadingMore.offset().top+this.$loadingMore.outerHeight(!1)<=t+50&&this.loadMore()}},e.prototype.loadMore=function(){this.loading=!0;var e=n.extend({},{page:1},this.lastParams);e.page++,this.trigger("query:append",e)},e.prototype.showLoadingMore=function(e,t){return t.pagination&&t.pagination.more},e.prototype.createLoadingMore=function(){var e=n('<li class="select2-results__option select2-results__option--load-more"role="option" aria-disabled="true"></li>'),t=this.options.get("translations").get("loadingMore");return e.html(t(this.lastParams)),e},e}),e.define("select2/dropdown/attachBody",["jquery","../utils"],function(f,a){function e(e,t,n){this.$dropdownParent=f(n.get("dropdownParent")||document.body),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("open",function(){r._showDropdown(),r._attachPositioningHandler(t),r._bindContainerResultHandlers(t)}),t.on("close",function(){r._hideDropdown(),r._detachPositioningHandler(t)}),this.$dropdownContainer.on("mousedown",function(e){e.stopPropagation()})},e.prototype.destroy=function(e){e.call(this),this.$dropdownContainer.remove()},e.prototype.position=function(e,t,n){t.attr("class",n.attr("class")),t.removeClass("select2"),t.addClass("select2-container--open"),t.css({position:"absolute",top:-999999}),this.$container=n},e.prototype.render=function(e){var t=f("<span></span>"),n=e.call(this);return t.append(n),this.$dropdownContainer=t},e.prototype._hideDropdown=function(e){this.$dropdownContainer.detach()},e.prototype._bindContainerResultHandlers=function(e,t){if(!this._containerResultsHandlersBound){var n=this;t.on("results:all",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("results:append",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("results:message",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("select",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("unselect",function(){n._positionDropdown(),n._resizeDropdown()}),this._containerResultsHandlersBound=!0}},e.prototype._attachPositioningHandler=function(e,t){var n=this,r="scroll.select2."+t.id,i="resize.select2."+t.id,o="orientationchange.select2."+t.id,s=this.$container.parents().filter(a.hasScroll);s.each(function(){a.StoreData(this,"select2-scroll-position",{x:f(this).scrollLeft(),y:f(this).scrollTop()})}),s.on(r,function(e){var t=a.GetData(this,"select2-scroll-position");f(this).scrollTop(t.y)}),f(window).on(r+" "+i+" "+o,function(e){n._positionDropdown(),n._resizeDropdown()})},e.prototype._detachPositioningHandler=function(e,t){var n="scroll.select2."+t.id,r="resize.select2."+t.id,i="orientationchange.select2."+t.id;this.$container.parents().filter(a.hasScroll).off(n),f(window).off(n+" "+r+" "+i)},e.prototype._positionDropdown=function(){var e=f(window),t=this.$dropdown.hasClass("select2-dropdown--above"),n=this.$dropdown.hasClass("select2-dropdown--below"),r=null,i=this.$container.offset();i.bottom=i.top+this.$container.outerHeight(!1);var o={height:this.$container.outerHeight(!1)};o.top=i.top,o.bottom=i.top+o.height;var s=this.$dropdown.outerHeight(!1),a=e.scrollTop(),l=e.scrollTop()+e.height(),c=a<i.top-s,u=l>i.bottom+s,d={left:i.left,top:o.bottom},p=this.$dropdownParent;"static"===p.css("position")&&(p=p.offsetParent());var h={top:0,left:0};(f.contains(document.body,p[0])||p[0].isConnected)&&(h=p.offset()),d.top-=h.top,d.left-=h.left,t||n||(r="below"),u||!c||t?!c&&u&&t&&(r="below"):r="above",("above"==r||t&&"below"!==r)&&(d.top=o.top-h.top-s),null!=r&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+r),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+r)),this.$dropdownContainer.css(d)},e.prototype._resizeDropdown=function(){var e={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(e.minWidth=e.width,e.position="relative",e.width="auto"),this.$dropdown.css(e)},e.prototype._showDropdown=function(e){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},e}),e.define("select2/dropdown/minimumResultsForSearch",[],function(){function e(e,t,n,r){this.minimumResultsForSearch=n.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),e.call(this,t,n,r)}return e.prototype.showSearch=function(e,t){return!(function e(t){for(var n=0,r=0;r<t.length;r++){var i=t[r];i.children?n+=e(i.children):n++}return n}(t.data.results)<this.minimumResultsForSearch)&&e.call(this,t)},e}),e.define("select2/dropdown/selectOnClose",["../utils"],function(o){function e(){}return e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("close",function(e){r._handleSelectOnClose(e)})},e.prototype._handleSelectOnClose=function(e,t){if(t&&null!=t.originalSelect2Event){var n=t.originalSelect2Event;if("select"===n._type||"unselect"===n._type)return}var r=this.getHighlightedResults();if(!(r.length<1)){var i=o.GetData(r[0],"data");null!=i.element&&i.element.selected||null==i.element&&i.selected||this.trigger("select",{data:i})}},e}),e.define("select2/dropdown/closeOnSelect",[],function(){function e(){}return e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("select",function(e){r._selectTriggered(e)}),t.on("unselect",function(e){r._selectTriggered(e)})},e.prototype._selectTriggered=function(e,t){var n=t.originalEvent;n&&(n.ctrlKey||n.metaKey)||this.trigger("close",{originalEvent:n,originalSelect2Event:t})},e}),e.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Please delete "+t+" character";return 1!=t&&(n+="s"),n},inputTooShort:function(e){return"Please enter "+(e.minimum-e.input.length)+" or more characters"},loadingMore:function(){return"Loading more results…"},maximumSelected:function(e){var t="You can only select "+e.maximum+" item";return 1!=e.maximum&&(t+="s"),t},noResults:function(){return"No results found"},searching:function(){return"Searching…"},removeAllItems:function(){return"Remove all items"}}}),e.define("select2/defaults",["jquery","require","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./i18n/en"],function(c,u,d,p,h,f,g,m,v,y,s,t,_,$,b,w,A,x,D,S,E,C,O,T,q,L,I,j,e){function n(){this.reset()}return n.prototype.apply=function(e){if(null==(e=c.extend(!0,{},this.defaults,e)).dataAdapter){if(null!=e.ajax?e.dataAdapter=b:null!=e.data?e.dataAdapter=$:e.dataAdapter=_,0<e.minimumInputLength&&(e.dataAdapter=y.Decorate(e.dataAdapter,x)),0<e.maximumInputLength&&(e.dataAdapter=y.Decorate(e.dataAdapter,D)),0<e.maximumSelectionLength&&(e.dataAdapter=y.Decorate(e.dataAdapter,S)),e.tags&&(e.dataAdapter=y.Decorate(e.dataAdapter,w)),null==e.tokenSeparators&&null==e.tokenizer||(e.dataAdapter=y.Decorate(e.dataAdapter,A)),null!=e.query){var t=u(e.amdBase+"compat/query");e.dataAdapter=y.Decorate(e.dataAdapter,t)}if(null!=e.initSelection){var n=u(e.amdBase+"compat/initSelection");e.dataAdapter=y.Decorate(e.dataAdapter,n)}}if(null==e.resultsAdapter&&(e.resultsAdapter=d,null!=e.ajax&&(e.resultsAdapter=y.Decorate(e.resultsAdapter,T)),null!=e.placeholder&&(e.resultsAdapter=y.Decorate(e.resultsAdapter,O)),e.selectOnClose&&(e.resultsAdapter=y.Decorate(e.resultsAdapter,I))),null==e.dropdownAdapter){if(e.multiple)e.dropdownAdapter=E;else{var r=y.Decorate(E,C);e.dropdownAdapter=r}if(0!==e.minimumResultsForSearch&&(e.dropdownAdapter=y.Decorate(e.dropdownAdapter,L)),e.closeOnSelect&&(e.dropdownAdapter=y.Decorate(e.dropdownAdapter,j)),null!=e.dropdownCssClass||null!=e.dropdownCss||null!=e.adaptDropdownCssClass){var i=u(e.amdBase+"compat/dropdownCss");e.dropdownAdapter=y.Decorate(e.dropdownAdapter,i)}e.dropdownAdapter=y.Decorate(e.dropdownAdapter,q)}if(null==e.selectionAdapter){if(e.multiple?e.selectionAdapter=h:e.selectionAdapter=p,null!=e.placeholder&&(e.selectionAdapter=y.Decorate(e.selectionAdapter,f)),e.allowClear&&(e.selectionAdapter=y.Decorate(e.selectionAdapter,g)),e.multiple&&(e.selectionAdapter=y.Decorate(e.selectionAdapter,m)),null!=e.containerCssClass||null!=e.containerCss||null!=e.adaptContainerCssClass){var o=u(e.amdBase+"compat/containerCss");e.selectionAdapter=y.Decorate(e.selectionAdapter,o)}e.selectionAdapter=y.Decorate(e.selectionAdapter,v)}e.language=this._resolveLanguage(e.language),e.language.push("en");for(var s=[],a=0;a<e.language.length;a++){var l=e.language[a];-1===s.indexOf(l)&&s.push(l)}return e.language=s,e.translations=this._processTranslations(e.language,e.debug),e},n.prototype.reset=function(){function a(e){return e.replace(/[^\u0000-\u007E]/g,function(e){return t[e]||e})}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:y.escapeMarkup,language:{},matcher:function e(t,n){if(""===c.trim(t.term))return n;if(n.children&&0<n.children.length){for(var r=c.extend(!0,{},n),i=n.children.length-1;0<=i;i--)null==e(t,n.children[i])&&r.children.splice(i,1);return 0<r.children.length?r:e(t,r)}var o=a(n.text).toUpperCase(),s=a(t.term).toUpperCase();return-1<o.indexOf(s)?n:null},minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,scrollAfterSelect:!1,sorter:function(e){return e},templateResult:function(e){return e.text},templateSelection:function(e){return e.text},theme:"default",width:"resolve"}},n.prototype.applyFromElement=function(e,t){var n=e.language,r=this.defaults.language,i=t.prop("lang"),o=t.closest("[lang]").prop("lang"),s=Array.prototype.concat.call(this._resolveLanguage(i),this._resolveLanguage(n),this._resolveLanguage(r),this._resolveLanguage(o));return e.language=s,e},n.prototype._resolveLanguage=function(e){if(!e)return[];if(c.isEmptyObject(e))return[];if(c.isPlainObject(e))return[e];var t;t=c.isArray(e)?e:[e];for(var n=[],r=0;r<t.length;r++)if(n.push(t[r]),"string"==typeof t[r]&&0<t[r].indexOf("-")){var i=t[r].split("-")[0];n.push(i)}return n},n.prototype._processTranslations=function(e,t){for(var n=new s,r=0;r<e.length;r++){var i=new s,o=e[r];if("string"==typeof o)try{i=s.loadPath(o)}catch(e){try{o=this.defaults.amdLanguageBase+o,i=s.loadPath(o)}catch(e){t&&window.console&&console.warn&&console.warn('Select2: The language file for "'+o+'" could not be automatically loaded. A fallback will be used instead.')}}else i=c.isPlainObject(o)?new s(o):o;n.extend(i)}return n},n.prototype.set=function(e,t){var n={};n[c.camelCase(e)]=t;var r=y._convertData(n);c.extend(!0,this.defaults,r)},new n}),e.define("select2/options",["require","jquery","./defaults","./utils"],function(r,d,i,p){function e(e,t){if(this.options=e,null!=t&&this.fromElement(t),null!=t&&(this.options=i.applyFromElement(this.options,t)),this.options=i.apply(this.options),t&&t.is("input")){var n=r(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=p.Decorate(this.options.dataAdapter,n)}}return e.prototype.fromElement=function(e){var t=["select2"];null==this.options.multiple&&(this.options.multiple=e.prop("multiple")),null==this.options.disabled&&(this.options.disabled=e.prop("disabled")),null==this.options.dir&&(e.prop("dir")?this.options.dir=e.prop("dir"):e.closest("[dir]").prop("dir")?this.options.dir=e.closest("[dir]").prop("dir"):this.options.dir="ltr"),e.prop("disabled",this.options.disabled),e.prop("multiple",this.options.multiple),p.GetData(e[0],"select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),p.StoreData(e[0],"data",p.GetData(e[0],"select2Tags")),p.StoreData(e[0],"tags",!0)),p.GetData(e[0],"ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),e.attr("ajax--url",p.GetData(e[0],"ajaxUrl")),p.StoreData(e[0],"ajax-Url",p.GetData(e[0],"ajaxUrl")));var n={};function r(e,t){return t.toUpperCase()}for(var i=0;i<e[0].attributes.length;i++){var o=e[0].attributes[i].name,s="data-";if(o.substr(0,s.length)==s){var a=o.substring(s.length),l=p.GetData(e[0],a);n[a.replace(/-([a-z])/g,r)]=l}}d.fn.jquery&&"1."==d.fn.jquery.substr(0,2)&&e[0].dataset&&(n=d.extend(!0,{},e[0].dataset,n));var c=d.extend(!0,{},p.GetData(e[0]),n);for(var u in c=p._convertData(c))-1<d.inArray(u,t)||(d.isPlainObject(this.options[u])?d.extend(this.options[u],c[u]):this.options[u]=c[u]);return this},e.prototype.get=function(e){return this.options[e]},e.prototype.set=function(e,t){this.options[e]=t},e}),e.define("select2/core",["jquery","./options","./utils","./keys"],function(o,c,u,r){var d=function(e,t){null!=u.GetData(e[0],"select2")&&u.GetData(e[0],"select2").destroy(),this.$element=e,this.id=this._generateId(e),t=t||{},this.options=new c(t,e),d.__super__.constructor.call(this);var n=e.attr("tabindex")||0;u.StoreData(e[0],"old-tabindex",n),e.attr("tabindex","-1");var r=this.options.get("dataAdapter");this.dataAdapter=new r(e,this.options);var i=this.render();this._placeContainer(i);var o=this.options.get("selectionAdapter");this.selection=new o(e,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,i);var s=this.options.get("dropdownAdapter");this.dropdown=new s(e,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,i);var a=this.options.get("resultsAdapter");this.results=new a(e,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var l=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(e){l.trigger("selection:update",{data:e})}),e.addClass("select2-hidden-accessible"),e.attr("aria-hidden","true"),this._syncAttributes(),u.StoreData(e[0],"select2",this),e.data("select2",this)};return u.Extend(d,u.Observable),d.prototype._generateId=function(e){return"select2-"+(null!=e.attr("id")?e.attr("id"):null!=e.attr("name")?e.attr("name")+"-"+u.generateChars(2):u.generateChars(4)).replace(/(:|\.|\[|\]|,)/g,"")},d.prototype._placeContainer=function(e){e.insertAfter(this.$element);var t=this._resolveWidth(this.$element,this.options.get("width"));null!=t&&e.css("width",t)},d.prototype._resolveWidth=function(e,t){var n=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==t){var r=this._resolveWidth(e,"style");return null!=r?r:this._resolveWidth(e,"element")}if("element"==t){var i=e.outerWidth(!1);return i<=0?"auto":i+"px"}if("style"!=t)return"computedstyle"!=t?t:window.getComputedStyle(e[0]).width;var o=e.attr("style");if("string"!=typeof o)return null;for(var s=o.split(";"),a=0,l=s.length;a<l;a+=1){var c=s[a].replace(/\s/g,"").match(n);if(null!==c&&1<=c.length)return c[1]}return null},d.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},d.prototype._registerDomEvents=function(){var t=this;this.$element.on("change.select2",function(){t.dataAdapter.current(function(e){t.trigger("selection:update",{data:e})})}),this.$element.on("focus.select2",function(e){t.trigger("focus",e)}),this._syncA=u.bind(this._syncAttributes,this),this._syncS=u.bind(this._syncSubtree,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._syncA);var e=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=e?(this._observer=new e(function(e){t._syncA(),t._syncS(null,e)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})):this.$element[0].addEventListener&&(this.$element[0].addEventListener("DOMAttrModified",t._syncA,!1),this.$element[0].addEventListener("DOMNodeInserted",t._syncS,!1),this.$element[0].addEventListener("DOMNodeRemoved",t._syncS,!1))},d.prototype._registerDataEvents=function(){var n=this;this.dataAdapter.on("*",function(e,t){n.trigger(e,t)})},d.prototype._registerSelectionEvents=function(){var n=this,r=["toggle","focus"];this.selection.on("toggle",function(){n.toggleDropdown()}),this.selection.on("focus",function(e){n.focus(e)}),this.selection.on("*",function(e,t){-1===o.inArray(e,r)&&n.trigger(e,t)})},d.prototype._registerDropdownEvents=function(){var n=this;this.dropdown.on("*",function(e,t){n.trigger(e,t)})},d.prototype._registerResultsEvents=function(){var n=this;this.results.on("*",function(e,t){n.trigger(e,t)})},d.prototype._registerEvents=function(){var n=this;this.on("open",function(){n.$container.addClass("select2-container--open")}),this.on("close",function(){n.$container.removeClass("select2-container--open")}),this.on("enable",function(){n.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){n.$container.addClass("select2-container--disabled")}),this.on("blur",function(){n.$container.removeClass("select2-container--focus")}),this.on("query",function(t){n.isOpen()||n.trigger("open",{}),this.dataAdapter.query(t,function(e){n.trigger("results:all",{data:e,query:t})})}),this.on("query:append",function(t){this.dataAdapter.query(t,function(e){n.trigger("results:append",{data:e,query:t})})}),this.on("keypress",function(e){var t=e.which;n.isOpen()?t===r.ESC||t===r.TAB||t===r.UP&&e.altKey?(n.close(e),e.preventDefault()):t===r.ENTER?(n.trigger("results:select",{}),e.preventDefault()):t===r.SPACE&&e.ctrlKey?(n.trigger("results:toggle",{}),e.preventDefault()):t===r.UP?(n.trigger("results:previous",{}),e.preventDefault()):t===r.DOWN&&(n.trigger("results:next",{}),e.preventDefault()):(t===r.ENTER||t===r.SPACE||t===r.DOWN&&e.altKey)&&(n.open(),e.preventDefault())})},d.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.isDisabled()?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},d.prototype._isChangeMutation=function(e,t){var n=!1,r=this;if(!e||!e.target||"OPTION"===e.target.nodeName||"OPTGROUP"===e.target.nodeName){if(t)if(t.addedNodes&&0<t.addedNodes.length)for(var i=0;i<t.addedNodes.length;i++){t.addedNodes[i].selected&&(n=!0)}else t.removedNodes&&0<t.removedNodes.length?n=!0:o.isArray(t)&&o.each(t,function(e,t){if(r._isChangeMutation(e,t))return!(n=!0)});else n=!0;return n}},d.prototype._syncSubtree=function(e,t){var n=this._isChangeMutation(e,t),r=this;n&&this.dataAdapter.current(function(e){r.trigger("selection:update",{data:e})})},d.prototype.trigger=function(e,t){var n=d.__super__.trigger,r={open:"opening",close:"closing",select:"selecting",unselect:"unselecting",clear:"clearing"};if(void 0===t&&(t={}),e in r){var i=r[e],o={prevented:!1,name:e,args:t};if(n.call(this,i,o),o.prevented)return void(t.prevented=!0)}n.call(this,e,t)},d.prototype.toggleDropdown=function(){this.isDisabled()||(this.isOpen()?this.close():this.open())},d.prototype.open=function(){this.isOpen()||this.isDisabled()||this.trigger("query",{})},d.prototype.close=function(e){this.isOpen()&&this.trigger("close",{originalEvent:e})},d.prototype.isEnabled=function(){return!this.isDisabled()},d.prototype.isDisabled=function(){return this.options.get("disabled")},d.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},d.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},d.prototype.focus=function(e){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},d.prototype.enable=function(e){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),null!=e&&0!==e.length||(e=[!0]);var t=!e[0];this.$element.prop("disabled",t)},d.prototype.data=function(){this.options.get("debug")&&0<arguments.length&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var t=[];return this.dataAdapter.current(function(e){t=e}),t},d.prototype.val=function(e){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==e||0===e.length)return this.$element.val();var t=e[0];o.isArray(t)&&(t=o.map(t,function(e){return e.toString()})),this.$element.val(t).trigger("input").trigger("change")},d.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._syncA),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&(this.$element[0].removeEventListener("DOMAttrModified",this._syncA,!1),this.$element[0].removeEventListener("DOMNodeInserted",this._syncS,!1),this.$element[0].removeEventListener("DOMNodeRemoved",this._syncS,!1)),this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",u.GetData(this.$element[0],"old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),u.RemoveData(this.$element[0]),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null},d.prototype.render=function(){var e=o('<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>');return e.attr("dir",this.options.get("dir")),this.$container=e,this.$container.addClass("select2-container--"+this.options.get("theme")),u.StoreData(e[0],"element",this.$element),e},d}),e.define("jquery-mousewheel",["jquery"],function(e){return e}),e.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults","./select2/utils"],function(i,e,o,t,s){if(null==i.fn.select2){var a=["open","close","destroy"];i.fn.select2=function(t){if("object"==typeof(t=t||{}))return this.each(function(){var e=i.extend(!0,{},t);new o(i(this),e)}),this;if("string"!=typeof t)throw new Error("Invalid arguments for Select2: "+t);var n,r=Array.prototype.slice.call(arguments,1);return this.each(function(){var e=s.GetData(this,"select2");null==e&&window.console&&console.error&&console.error("The select2('"+t+"') method was called on an element that is not using Select2."),n=e[t].apply(e,r)}),-1<i.inArray(t,a)?this:n}}return null==i.fn.select2.defaults&&(i.fn.select2.defaults=t),o}),{define:e.define,require:e.require}}(),t=e.require("jquery.select2");return u.fn.select2.amd=e,t}); \ No newline at end of file diff --git a/templates/admin/base_site.html b/templates/admin/base_site.html index 5bbc5bc0..c8c5a1a9 100644 --- a/templates/admin/base_site.html +++ b/templates/admin/base_site.html @@ -15,7 +15,7 @@ {% block extrahead %} <!-- Load bootstrap, jquery and fontawesome--> {% bootstrap_javascript %} - <script src="{% static 'common/vendor/jquery/jquery-3.3.1.min.js' %}"></script> + <script src="{% static 'common/vendor/jquery/jquery-3.6.3.min.js' %}"></script> {% fontawesome_6_static %} <style> diff --git a/templates/base.html b/templates/base.html index 21bb6f1e..34ebb647 100644 --- a/templates/base.html +++ b/templates/base.html @@ -15,7 +15,7 @@ <!-- Load bootstrap, jquery and fontawesome--> {% bootstrap_css %} {% bootstrap_javascript %} - <script src="{% static 'common/vendor/jquery/jquery-3.3.1.min.js' %}"></script> + <script src="{% static 'common/vendor/jquery/jquery-3.6.3.min.js' %}"></script> {% fontawesome_6_static %} <link rel="stylesheet" href="{% static 'common/css/custom.css' %}"> -- GitLab