1 2!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.moment=t()}(this,function(){"use strict";var H;function f(){return H.apply(null,arguments)}function a(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function F(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function c(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function L(e){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;for(var t in e)if(c(e,t))return;return 1}function o(e){return void 0===e}function u(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function V(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function G(e,t){for(var n=[],s=e.length,i=0;i<s;++i)n.push(t(e[i],i));return n}function E(e,t){for(var n in t)c(t,n)&&(e[n]=t[n]);return c(t,"toString")&&(e.toString=t.toString),c(t,"valueOf")&&(e.valueOf=t.valueOf),e}function l(e,t,n,s){return Pt(e,t,n,s,!0).utc()}function m(e){return null==e._pf&&(e._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}),e._pf}function A(e){if(null==e._isValid){var t=m(e),n=j.call(t.parsedDateParts,function(e){return null!=e}),n=!isNaN(e._d.getTime())&&t.overflow<0&&!t.empty&&!t.invalidEra&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&n);if(e._strict&&(n=n&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour),null!=Object.isFrozen&&Object.isFrozen(e))return n;e._isValid=n}return e._isValid}function I(e){var t=l(NaN);return null!=e?E(m(t),e):m(t).userInvalidated=!0,t}var j=Array.prototype.some||function(e){for(var t=Object(this),n=t.length>>>0,s=0;s<n;s++)if(s in t&&e.call(this,t[s],s,t))return!0;return!1},Z=f.momentProperties=[],z=!1;function $(e,t){var n,s,i,r=Z.length;if(o(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),o(t._i)||(e._i=t._i),o(t._f)||(e._f=t._f),o(t._l)||(e._l=t._l),o(t._strict)||(e._strict=t._strict),o(t._tzm)||(e._tzm=t._tzm),o(t._isUTC)||(e._isUTC=t._isUTC),o(t._offset)||(e._offset=t._offset),o(t._pf)||(e._pf=m(t)),o(t._locale)||(e._locale=t._locale),0<r)for(n=0;n<r;n++)o(i=t[s=Z[n]])||(e[s]=i);return e}function q(e){$(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),!1===z&&(z=!0,f.updateOffset(this),z=!1)}function h(e){return e instanceof q||null!=e&&null!=e._isAMomentObject}function B(e){!1===f.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function e(r,a){var o=!0;return E(function(){if(null!=f.deprecationHandler&&f.deprecationHandler(null,r),o){for(var e,t,n=[],s=arguments.length,i=0;i<s;i++){if(e="","object"==typeof arguments[i]){for(t in e+="\n["+i+"] ",arguments[0])c(arguments[0],t)&&(e+=t+": "+arguments[0][t]+", ");e=e.slice(0,-2)}else e=arguments[i];n.push(e)}B(r+"\nArguments: "+Array.prototype.slice.call(n).join("")+"\n"+(new Error).stack),o=!1}return a.apply(this,arguments)},a)}var J={};function Q(e,t){null!=f.deprecationHandler&&f.deprecationHandler(e,t),J[e]||(B(t),J[e]=!0)}function d(e){return"undefined"!=typeof Function&&e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function X(e,t){var n,s=E({},e);for(n in t)c(t,n)&&(F(e[n])&&F(t[n])?(s[n]={},E(s[n],e[n]),E(s[n],t[n])):null!=t[n]?s[n]=t[n]:delete s[n]);for(n in e)c(e,n)&&!c(t,n)&&F(e[n])&&(s[n]=E({},s[n]));return s}function K(e){null!=e&&this.set(e)}f.suppressDeprecationWarnings=!1,f.deprecationHandler=null;var ee=Object.keys||function(e){var t,n=[];for(t in e)c(e,t)&&n.push(t);return n};function r(e,t,n){var s=""+Math.abs(e);return(0<=e?n?"+":"":"-")+Math.pow(10,Math.max(0,t-s.length)).toString().substr(1)+s}var te=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}
2|x|X|zz?|ZZ?|.)/g,ne=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,se={},ie={};function s(e,t,n,s){var i="string"==typeof s?function(){return this[s]()}:s;e&&(ie[e]=i),t&&(ie[t[0]]=function(){return r(i.apply(this,arguments),t[1],t[2])}),n&&(ie[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function re(e,t){return e.isValid()?(t=ae(t,e.localeData()),se[t]=se[t]||function(s){for(var e,i=s.match(te),t=0,r=i.length;t<r;t++)ie[i[t]]?i[t]=ie[i[t]]:i[t]=(e=i[t]).match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"");return function(e){for(var t="",n=0;n<r;n++)t+=d(i[n])?i[n].call(e,s):i[n];return t}}(t),se[t](e)):e.localeData().invalidDate()}function ae(e,t){var n=5;function s(e){return t.longDateFormat(e)||e}for(ne.lastIndex=0;0<=n&&ne.test(e);)e=e.replace(ne,s),ne.lastIndex=0,--n;return e}var oe={};function t(e,t){var n=e.toLowerCase();oe[n]=oe[n+"s"]=oe[t]=e}function _(e){return"string"==typeof e?oe[e]||oe[e.toLowerCase()]:void 0}function ue(e){var t,n,s={};for(n in e)c(e,n)&&(t=_(n))&&(s[t]=e[n]);return s}var le={};function n(e,t){le[e]=t}function he(e){return e%4==0&&e%100!=0||e%400==0}function y(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function g(e){var e=+e,t=0;return t=0!=e&&isFinite(e)?y(e):t}function de(t,n){return function(e){return null!=e?(fe(this,t,e),f.updateOffset(this,n),this):ce(this,t)}}function ce(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function fe(e,t,n){e.isValid()&&!isNaN(n)&&("FullYear"===t&&he(e.year())&&1===e.month()&&29===e.date()?(n=g(n),e._d["set"+(e._isUTC?"UTC":"")+t](n,e.month(),We(n,e.month()))):e._d["set"+(e._isUTC?"UTC":"")+t](n))}var i=/\d/,w=/\d\d/,me=/\d{3}/,_e=/\d{4}/,ye=/[+-]?\d{6}/,p=/\d\d?/,ge=/\d\d\d\d?/,we=/\d\d\d\d\d\d?/,pe=/\d{1,3}/,ve=/\d{1,4}/,ke=/[+-]?\d{1,6}/,Me=/\d+/,De=/[+-]?\d+/,Se=/Z|[+-]\d\d:?\d\d/gi,Ye=/Z|[+-]\d\d(?::?\d\d)?/gi,v=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i;function k(e,n,s){be[e]=d(n)?n:function(e,t){return e&&s?s:n}}function Oe(e,t){return c(be,e)?be[e](t._strict,t._locale):new RegExp(M(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,n,s,i){return t||n||s||i})))}function M(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var be={},xe={};function D(e,n){var t,s,i=n;for("string"==typeof e&&(e=[e]),u(n)&&(i=function(e,t){t[n]=g(e)}),s=e.length,t=0;t<s;t++)xe[e[t]]=i}function Te(e,i){D(e,function(e,t,n,s){n._w=n._w||{},i(e,n._w,n,s)})}var S,Y=0,O=1,b=2,x=3,T=4,N=5,Ne=6,Pe=7,Re=8;function We(e,t){if(isNaN(e)||isNaN(t))return NaN;var n=(t%(n=12)+n)%n;return e+=(t-n)/12,1==n?he(e)?29:28:31-n%7%2}S=Array.prototype.indexOf||function(e){for(var t=0;t<this.length;++t)if(this[t]===e)return t;return-1},s("M",["MM",2],"Mo",function(){return this.month()+1}),s("MMM",0,0,function(e){return this.localeData().monthsShort(this,e)}),s("MMMM",0,0,function(e){return this.localeData().months(this,e)}),t("month","M"),n("month",8),k("M",p),k("MM",p,w),k("MMM",function(e,t){return t.monthsShortRegex(e)}),k("MMMM",function(e,t){return t.monthsRegex(e)}),D(["M","MM"],function(e,t){t[O]=g(e)-1}),D(["MMM","MMMM"],function(e,t,n,s){s=n._locale.monthsParse(e,s,n._strict);null!=s?t[O]=s:m(n).invalidMonth=e});var Ce="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Ue="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),He=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Fe=v,Le=v;function Ve(e,t){var n;if(e.isValid()){if("string"==typeof t)if(/^\d+$/.test(t))t=g(t);else if(!u(t=e.localeData().monthsParse(t)))return;n=Math.min(e.date(),We(e.year(),t)),e._d["set"+(e._isUTC?"UTC":"")+"Month"](t,n)}}function Ge(e){return null!=e?(Ve(this,e),f.updateOffset(this,!0),this):ce(this,"Month")}function Ee(){function e(e,t){return t.length-e.length}for(var t,n=[],s=[],i=[],r=0;r<12;r++)t=l([2e3,r]),n.push(this.monthsShort(t,"")),s.push(this.months(t,"")),i.push(this.months(t,"")),i.push(this.monthsShort(t,""));for(n.sort(e),s.sort(e),i.sort(e),r=0;r<12;r++)n[r]=M(n[r]),s[r]=M(s[r]);for(r=0;r<24;r++)i[r]=M(i[r]);this._monthsRegex=new RegExp("^("+i.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+s.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+n.join("|")+")","i")}function Ae(e){return he(e)?366:365}s("Y",0,0,function(){var e=this.year();
vendor: 46,184 bytes, line 2
2return e<=9999?r(e,4):"+"+e}),s(0,["YY",2],0,function(){return this.year()%100}),s(0,["YYYY",4],0,"year"),s(0,["YYYYY",5],0,"year"),s(0,["YYYYYY",6,!0],0,"year"),t("year","y"),n("year",1),k("Y",De),k("YY",p,w),k("YYYY",ve,_e),k("YYYYY",ke,ye),k("YYYYYY",ke,ye),D(["YYYYY","YYYYYY"],Y),D("YYYY",function(e,t){t[Y]=2===e.length?f.parseTwoDigitYear(e):g(e)}),D("YY",function(e,t){t[Y]=f.parseTwoDigitYear(e)}),D("Y",function(e,t){t[Y]=parseInt(e,10)}),f.parseTwoDigitYear=function(e){return g(e)+(68<g(e)?1900:2e3)};var Ie=de("FullYear",!0);function je(e,t,n,s,i,r,a){var o;return e<100&&0<=e?(o=new Date(e+400,t,n,s,i,r,a),isFinite(o.getFullYear())&&o.setFullYear(e)):o=new Date(e,t,n,s,i,r,a),o}function Ze(e){var t;return e<100&&0<=e?((t=Array.prototype.slice.call(arguments))[0]=e+400,t=new Date(Date.UTC.apply(null,t)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function ze(e,t,n){n=7+t-n;return n-(7+Ze(e,0,n).getUTCDay()-t)%7-1}function $e(e,t,n,s,i){var r,t=1+7*(t-1)+(7+n-s)%7+ze(e,s,i),n=t<=0?Ae(r=e-1)+t:t>Ae(e)?(r=e+1,t-Ae(e)):(r=e,t);return{year:r,dayOfYear:n}}function qe(e,t,n){var s,i,r=ze(e.year(),t,n),r=Math.floor((e.dayOfYear()-r-1)/7)+1;return r<1?s=r+P(i=e.year()-1,t,n):r>P(e.year(),t,n)?(s=r-P(e.year(),t,n),i=e.year()+1):(i=e.year(),s=r),{week:s,year:i}}function P(e,t,n){var s=ze(e,t,n),t=ze(e+1,t,n);return(Ae(e)-s+t)/7}s("w",["ww",2],"wo","week"),s("W",["WW",2],"Wo","isoWeek"),t("week","w"),t("isoWeek","W"),n("week",5),n("isoWeek",5),k("w",p),k("ww",p,w),k("W",p),k("WW",p,w),Te(["w","ww","W","WW"],function(e,t,n,s){t[s.substr(0,1)]=g(e)});function Be(e,t){return e.slice(t,7).concat(e.slice(0,t))}s("d",0,"do","day"),s("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),s("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),s("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),s("e",0,0,"weekday"),s("E",0,0,"isoWeekday"),t("day","d"),t("weekday","e"),t("isoWeekday","E"),n("day",11),n("weekday",11),n("isoWeekday",11),k("d",p),k("e",p),k("E",p),k("dd",function(e,t){return t.weekdaysMinRegex(e)}),k("ddd",function(e,t){return t.weekdaysShortRegex(e)}),k("dddd",function(e,t){return t.weekdaysRegex(e)}),Te(["dd","ddd","dddd"],function(e,t,n,s){s=n._locale.weekdaysParse(e,s,n._strict);null!=s?t.d=s:m(n).invalidWeekday=e}),Te(["d","e","E"],function(e,t,n,s){t[s]=g(e)});var Je="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Qe="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Xe="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Ke=v,et=v,tt=v;function nt(){function e(e,t){return t.length-e.length}for(var t,n,s,i=[],r=[],a=[],o=[],u=0;u<7;u++)s=l([2e3,1]).day(u),t=M(this.weekdaysMin(s,"")),n=M(this.weekdaysShort(s,"")),s=M(this.weekdays(s,"")),i.push(t),r.push(n),a.push(s),o.push(t),o.push(n),o.push(s);i.sort(e),r.sort(e),a.sort(e),o.sort(e),this._weekdaysRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+r.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+i.join("|")+")","i")}function st(){return this.hours()%12||12}function it(e,t){s(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function rt(e,t){return t._meridiemParse}s("H",["HH",2],0,"hour"),s("h",["hh",2],0,st),s("k",["kk",2],0,function(){return this.hours()||24}),s("hmm",0,0,function(){return""+st.apply(this)+r(this.minutes(),2)}),s("hmmss",0,0,function(){return""+st.apply(this)+r(this.minutes(),2)+r(this.seconds(),2)}),s("Hmm",0,0,function(){return""+this.hours()+r(this.minutes(),2)}),s("Hmmss",0,0,function(){return""+this.hours()+r(this.minutes(),2)+r(this.seconds(),2)}),it("a",!0),it("A",!1),t("hour","h"),n("hour",13),k("a",rt),k("A",rt),k("H",p),k("h",p),k("k",p),k("HH",p,w),k("hh",p,w),k("kk",p,w),k("hmm",ge),k("hmmss",we),k("Hmm",ge),k("Hmmss",we),D(["H","HH"],x),D(["k","kk"],function(e,t,n){e=g(e);t[x]=24===e?0:e}),D(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),D(["h","hh"],function(e,t,n){t[x]=g(e),m(n).bigHour=!0}),D("hmm",function(e,t,n){var s=e.length-2;t[x]=g(e.substr(0,s)),t[T]=g(e.substr(s)),m(n).bigHour=!0}),D("hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[x]=g(e.substr(0,s)),t[T]=g(e.substr(s,2)),t[N]=g(e.substr(i)),m(n).bigHour=!0}),D("Hmm",function(e,t,n){var s=e.length-2;t[x]=g(e.substr(0,s)),t[T]=g(e.substr(s))}),D("Hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[x]=g(e.substr(0,s)),t[T]=g(e.substr(s,2)),t[N]=g(e.substr(i))});v=de("Hours",!0);var at,ot={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:Ce,monthsShort:Ue,week:{dow:0,doy:6},weekdays:Je,weekdaysMin:Xe,weekdaysShort:Qe,meridiemParse:/[ap]\.?m?\.?/i},R={},ut={};function lt(e){return e&&e.toLowerCase().replace("_","-")}function ht(e){for(var t,n,s,i,r=0;r<e.length;){for(t=(i=lt(e[r]).split("-")).length,n=(n=lt(e[r+1]))?n.split("-"):null;0<t;){if(s=dt(i.slice(0,t).join("-")))return s;if(n&&n.length>=t&&function(e,t){for(var n=Math.min(e.length,t.length),s=0;s<n;s+=1)if(e[s]!==t[s])return s;return n}(i,n)>=t-1)break;t--}r++}return at}function dt(t){var e;if(void 0===R[t]&&"undefined"!=typeof module&&module&&module.exports&&null!=t.match("^[^/\\\\]*$"))try{e=at._abbr,require("./locale/"+t),ct(e)}catch(e){R[t]=null}return R[t]}function ct(e,t){return e&&((t=o(t)?mt(e):ft(e,t))?at=t:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),at._abbr}function ft(e,t){if(null===t)return delete R[e],null;var n,s=ot;if(t.abbr=e,null!=R[e])Q("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=R[e]._config;else if(null!=t.parentLocale)if(null!=R[t.parentLocale])s=R[t.parentLocale]._config;else{if(null==(n=dt(t.parentLocale)))return ut[t.parentLocale]||(ut[t.parentLocale]=[]),ut[t.parentLocale].push({name:e,config:t}),null;s=n._config}return R[e]=new K(X(s,t)),ut[e]&&ut[e].forEach(function(e){ft(e.name,e.config)}),ct(e),R[e]}function mt(e){var t;if(!(e=e&&e._locale&&e._locale._abbr?e._locale._abbr:e))return at;if(!a(e)){if(t=dt(e))return t;e=[e]}return ht(e)}function _t(e){var t=e._a;return t&&-2===m(e).overflow&&(t=t[O]<0||11<t[O]?O:t[b]<1||t[b]>We(t[Y],t[O])?b:t[x]<0||24<t[x]||24===t[x]&&(0!==t[T]||0!==t[N]||0!==t[Ne])?x:t[T]<0||59<t[T]?T:t[N]<0||59<t[N]?N:t[Ne]<0||999<t[Ne]?Ne:-1,m(e)._overflowDayOfYear&&(t<Y||b<t)&&(t=b),m(e)._overflowWeeks&&-1===t&&(t=Pe),m(e)._overflowWeekday&&-1===t&&(t=Re),m(e).overflow=t),e}var yt=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,gt=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,wt=/Z|[+-]\d\d(?::?\d\d)?/,pt=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],vt=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],kt=/^\/?Date\((-?\d+)/i,Mt=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,Dt={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function St(e){var t,n,s,i,r,a,o=e._i,u=yt.exec(o)||gt.exec(o),o=pt.length,l=vt.length;if(u){for(m(e).iso=!0,t=0,n=o;t<n;t++)if(pt[t][1].exec(u[1])){i=pt[t][0],s=!1!==pt[t][2];break}if(null==i)e._isValid=!1;else{if(u[3]){for(t=0,n=l;t<n;t++)if(vt[t][1].exec(u[3])){r=(u[2]||" ")+vt[t][0];break}if(null==r)return void(e._isValid=!1)}if(s||null==r){if(u[4]){if(!wt.exec(u[4]))return void(e._isValid=!1);a="Z"}e._f=i+(r||"")+(a||""),Tt(e)}else e._isValid=!1}}else e._isValid=!1}function Yt(e,t,n,s,i,r){e=[function(e){e=parseInt(e,10);{if(e<=49)return 2e3+e;if(e<=999)return 1900+e}return e}(e),Ue.indexOf(t),parseInt(n,10),parseInt(s,10),parseInt(i,10)];return r&&e.push(parseInt(r,10)),e}function Ot(e){var t,n,s,i,r=Mt.exec(e._i.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,""));r?(t=Yt(r[4],r[3],r[2],r[5],r[6],r[7]),n=r[1],s=t,i=e,n&&Qe.indexOf(n)!==new Date(s[0],s[1],s[2]).getDay()?(m(i).weekdayMismatch=!0,i._isValid=!1):(e._a=t,e._tzm=(n=r[8],s=r[9],i=r[10],n?Dt[n]:s?0:60*(((n=parseInt(i,10))-(s=n%100))/100)+s),e._d=Ze.apply(null,e._a),e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),m(e).rfc2822=!0)):e._isValid=!1}function bt(e,t,n){return null!=e?e:null!=t?t:n}function xt(e){var t,n,s,i,r,a,o,u,l,h,d,c=[];if(!e._d){for(s=e,i=new Date(f.now()),n=s._useUTC?[i.getUTCFullYear(),i.getUTCMonth(),i.getUTCDate()]:[i.getFullYear(),i.getMonth(),i.getDate()],e._w&&null==e._a[b]&&null==e._a[O]&&(null!=(i=(s=e)._w).GG||null!=i.W||null!=i.E?(u=1,l=4,r=bt(i.GG,s._a[Y],qe(W(),1,4).year),a=bt(i.W,1),((o=bt(i.E,1))<1||7<o)&&(h=!0)):(u=s._locale._week.dow,l=s._locale._week.doy,d=qe(W(),u,l),r=bt(i.gg,s._a[Y],d.year),a=bt(i.w,d.week),null!=i.d?((o=i.d)<0||6<o)&&(h=!0):null!=i.e?(o=i.e+u,(i.e<0||6<i.e)&&(h=!0)):o=u),a<1||a>P(r,u,l)?m(s)._overflowWeeks=!0:null!=h?m(s)._overflowWeekday=!0:(d=$e(r,a,o,u,l),s._a[Y]=d.year,s._dayOfYear=d.dayOfYear)),null!=e._dayOfYear&&(i=bt(e._a[Y],n[Y]),(e._dayOfYear>Ae(i)||0===e._dayOfYear)&&(m(e)._overflowDayOfYear=!0),h=Ze(i,0,e._dayOfYear),e._a[O]=h.getUTCMonth(),e._a[b]=h.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=c[t]=n[t];for(;t<7;t++)e._a[t]=c[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[x]&&0===e._a[T]&&0===e._a[N]&&0===e._a[Ne]&&(e._nextDay=!0,e._a[x]=0),e._d=(e._useUTC?Ze:je).apply(null,c),r=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[x]=24),e._w&&void 0!==e._w.d&&e._w.d!==r&&(m(e).weekdayMismatch=!0)}}function Tt(e){if(e._f===f.ISO_8601)St(e);else if(e._f===f.RFC_2822)Ot(e);else{e._a=[],m(e).empty=!0;for(var t,n,s,i,r,a=""+e._i,o=a.length,u=0,l=ae(e._f,e._locale).match(te)||[],h=l.length,d=0;d<h;d++)n=l[d],(t=(a.match(Oe(n,e))||[])[0])&&(0<(s=a.substr(0,a.indexOf(t))).length&&m(e).unusedInput.push(s),a=a.slice(a.indexOf(t)+t.length),u+=t.length),ie[n]?(t?m(e).empty=!1:m(e).unusedTokens.push(n),s=n,r=e,null!=(i=t)&&c(xe,s)&&xe[s](i,r._a,r,s)):e._strict&&!t&&m(e).unusedTokens.push(n);m(e).charsLeftOver=o-u,0<a.length&&m(e).unusedInput.push(a),e._a[x]<=12&&!0===m(e).bigHour&&0<e._a[x]&&(m(e).bigHour=void 0),m(e).parsedDateParts=e._a.slice(0),m(e).meridiem=e._meridiem,e._a[x]=function(e,t,n){if(null==n)return t;return null!=e.meridiemHour?e.meridiemHour(t,n):null!=e.isPM?((e=e.isPM(n))&&t<12&&(t+=12),t=e||12!==t?t:0):t}(e._locale,e._a[x],e._meridiem),null!==(o=m(e).era)&&(e._a[Y]=e._locale.erasConvertYear(o,e._a[Y])),xt(e),_t(e)}}function Nt(e){var t,n,s,i=e._i,r=e._f;if(e._locale=e._locale||mt(e._l),null===i||void 0===r&&""===i)return I({nullInput:!0});if("string"==typeof i&&(e._i=i=e._locale.preparse(i)),h(i))return new q(_t(i));if(V(i))e._d=i;else if(a(r))!function(e){var t,n,s,i,r,a,o=!1,u=e._f.length;if(0===u)return m(e).invalidFormat=!0,e._d=new Date(NaN);for(i=0;i<u;i++)r=0,a=!1,t=$({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._f=e._f[i],Tt(t),A(t)&&(a=!0),r=(r+=m(t).charsLeftOver)+10*m(t).unusedTokens.length,m(t).score=r,o?r<s&&(s=r,n=t):(null==s||r<s||a)&&(s=r,n=t,a&&(o=!0));E(e,n||t)}(e);else if(r)Tt(e);else if(o(r=(i=e)._i))i._d=new Date(f.now());else V(r)?i._d=new Date(r.valueOf()):"string"==typeof r?(n=i,null!==(t=kt.exec(n._i))?n._d=new Date(+t[1]):(St(n),!1===n._isValid&&(delete n._isValid,Ot(n),!1===n._isValid&&(delete n._isValid,n._strict?n._isValid=!1:f.createFromInputFallback(n))))):a(r)?(i._a=G(r.slice(0),function(e){return parseInt(e,10)}),xt(i)):F(r)?(t=i)._d||(s=void 0===(n=ue(t._i)).day?n.date:n.day,t._a=G([n.year,n.month,s,n.hour,n.minute,n.second,n.millisecond],function(e){return e&&parseInt(e,10)}),xt(t)):u(r)?i._d=new Date(r):f.createFromInputFallback(i);return A(e)||(e._d=null),e}function Pt(e,t,n,s,i){var r={};return!0!==t&&!1!==t||(s=t,t=void 0),!0!==n&&!1!==n||(s=n,n=void 0),(F(e)&&L(e)||a(e)&&0===e.length)&&(e=void 0),r._isAMomentObject=!0,r._useUTC=r._isUTC=i,r._l=n,r._i=e,r._f=t,r._strict=s,(i=new q(_t(Nt(i=r))))._nextDay&&(i.add(1,"d"),i._nextDay=void 0),i}function W(e,t,n,s){return Pt(e,t,n,s,!1)}f.createFromInputFallback=e("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))}),f.ISO_8601=function(){},f.RFC_2822=function(){};ge=e("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=W.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:I()}),we=e("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=W.apply(null,arguments);return this.isValid()&&e.isValid()?this<e?this:e:I()});function Rt(e,t){var n,s;if(!(t=1===t.length&&a(t[0])?t[0]:t).length)return W();for(n=t[0],s=1;s<t.length;++s)t[s].isValid()&&!t[s][e](n)||(n=t[s]);return n}var Wt=["year","quarter","month","week","day","hour","minute","second","millisecond"];function Ct(e){var e=ue(e),t=e.year||0,n=e.quarter||0,s=e.month||0,i=e.week||e.isoWeek||0,r=e.day||0,a=e.hour||0,o=e.minute||0,u=e.second||0,l=e.millisecond||0;this._isValid=function(e){var t,n,s=!1,i=Wt.length;for(t in e)if(c(e,t)&&(-1===S.call(Wt,t)||null!=e[t]&&isNaN(e[t])))return!1;for(n=0;n<i;++n)if(e[Wt[n]]){if(s)return!1;parseFloat(e[Wt[n]])!==g(e[Wt[n]])&&(s=!0)}return!0}(e),this._milliseconds=+l+1e3*u+6e4*o+1e3*a*60*60,this._days=+r+7*i,this._months=+s+3*n+12*t,this._data={},this._locale=mt(),this._bubble()}function Ut(e){return e instanceof Ct}function Ht(e){return e<0?-1*Math.round(-1*e):Math.round(e)}function Ft(e,n){s(e,0,0,function(){var e=this.utcOffset(),t="+";return e<0&&(e=-e,t="-"),t+r(~~(e/60),2)+n+r(~~e%60,2)})}Ft("Z",":"),Ft("ZZ",""),k("Z",Ye),k("ZZ",Ye),D(["Z","ZZ"],function(e,t,n){n._useUTC=!0,n._tzm=Vt(Ye,e)});var Lt=/([\+\-]|\d\d)/gi;function Vt(e,t){var t=(t||"").match(e);return null===t?null:0===(t=60*(e=((t[t.length-1]||[])+"").match(Lt)||["-",0,0])[1]+g(e[2]))?0:"+"===e[0]?t:-t}function Gt(e,t){var n;return t._isUTC?(t=t.clone(),n=(h(e)||V(e)?e:W(e)).valueOf()-t.valueOf(),t._d.setTime(t._d.valueOf()+n),f.updateOffset(t,!1),t):W(e).local()}function Et(e){return-Math.round(e._d.getTimezoneOffset())}function At(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}f.updateOffset=function(){};var It=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,jt=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function C(e,t){var n,s=e,i=null;return Ut(e)?s={ms:e._milliseconds,d:e._days,M:e._months}:u(e)||!isNaN(+e)?(s={},t?s[t]=+e:s.milliseconds=+e):(i=It.exec(e))?(n="-"===i[1]?-1:1,s={y:0,d:g(i[b])*n,h:g(i[x])*n,m:g(i[T])*n,s:g(i[N])*n,ms:g(Ht(1e3*i[Ne]))*n}):(i=jt.exec(e))?(n="-"===i[1]?-1:1,s={y:Zt(i[2],n),M:Zt(i[3],n),w:Zt(i[4],n),d:Zt(i[5],n),h:Zt(i[6],n),m:Zt(i[7],n),s:Zt(i[8],n)}):null==s?s={}:"object"==typeof s&&("from"in s||"to"in s)&&(t=function(e,t){var n;if(!e.isValid()||!t.isValid())return{milliseconds:0,months:0};t=Gt(t,e),e.isBefore(t)?n=zt(e,t):((n=zt(t,e)).milliseconds=-n.milliseconds,n.months=-n.months);return n}(W(s.from),W(s.to)),(s={}).ms=t.milliseconds,s.M=t.months),i=new Ct(s),Ut(e)&&c(e,"_locale")&&(i._locale=e._locale),Ut(e)&&c(e,"_isValid")&&(i._isValid=e._isValid),i}function Zt(e,t){e=e&&parseFloat(e.replace(",","."));return(isNaN(e)?0:e)*t}function zt(e,t){var n={};return n.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(n.months,"M").isAfter(t)&&--n.months,n.milliseconds=+t-+e.clone().add(n.months,"M"),n}function $t(s,i){return function(e,t){var n;return null===t||isNaN(+t)||(Q(i,"moment()."+i+"(period, number) is deprecated. Please use moment()."+i+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),n=e,e=t,t=n),qt(this,C(e,t),s),this}}function qt(e,t,n,s){var i=t._milliseconds,r=Ht(t._days),t=Ht(t._months);e.isValid()&&(s=null==s||s,t&&Ve(e,ce(e,"Month")+t*n),r&&fe(e,"Date",ce(e,"Date")+r*n),i&&e._d.setTime(e._d.valueOf()+i*n),s&&f.updateOffset(e,r||t))}C.fn=Ct.prototype,C.invalid=function(){return C(NaN)};Ce=$t(1,"add"),Je=$t(-1,"subtract");function Bt(e){return"string"==typeof e||e instanceof String}function Jt(e){return h(e)||V(e)||Bt(e)||u(e)||function(t){var e=a(t),n=!1;e&&(n=0===t.filter(function(e){return!u(e)&&Bt(t)}).length);return e&&n}(e)||function(e){var t,n,s=F(e)&&!L(e),i=!1,r=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],a=r.length;for(t=0;t<a;t+=1)n=r[t],i=i||c(e,n);return s&&i}(e)||null==e}function Qt(e,t){if(e.date()<t.date())return-Qt(t,e);var n=12*(t.year()-e.year())+(t.month()-e.month()),s=e.clone().add(n,"months"),t=t-s<0?(t-s)/(s-e.clone().add(n-1,"months")):(t-s)/(e.clone().add(1+n,"months")-s);return-(n+t)||0}function Xt(e){return void 0===e?this._locale._abbr:(null!=(e=mt(e))&&(this._locale=e),this)}f.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",f.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";Xe=e("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return void 0===e?this.localeData():this.locale(e)});function Kt(){return this._locale}var en=126227808e5;function tn(e,t){return(e%t+t)%t}function nn(e,t,n){return e<100&&0<=e?new Date(e+400,t,n)-en:new Date(e,t,n).valueOf()}function sn(e,t,n){return e<100&&0<=e?Date.UTC(e+400,t,n)-en:Date.UTC(e,t,n)}function rn(e,t){return t.erasAbbrRegex(e)}function an(){for(var e=[],t=[],n=[],s=[],i=this.eras(),r=0,a=i.length;r<a;++r)t.push(M(i[r].name)),e.push(M(i[r].abbr)),n.push(M(i[r].narrow)),s.push(M(i[r].name)),s.push(M(i[r].abbr)),s.push(M(i[r].narrow));this._erasRegex=new RegExp("^("+s.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+t.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+e.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+n.join("|")+")","i")}function on(e,t){s(0,[e,e.length],0,t)}function un(e,t,n,s,i){var r;return null==e?qe(this,s,i).year:(r=P(e,s,i),function(e,t,n,s,i){e=$e(e,t,n,s,i),t=Ze(e.year,0,e.dayOfYear);return this.year(t.getUTCFullYear()),this.month(t.getUTCMonth()),this.date(t.getUTCDate()),this}.call(this,e,t=r<t?r:t,n,s,i))}s("N",0,0,"eraAbbr"),s("NN",0,0,"eraAbbr"),s("NNN",0,0,"eraAbbr"),s("NNNN",0,0,"eraName"),s("NNNNN",0,0,"eraNarrow"),s("y",["y",1],"yo","eraYear"),s("y",["yy",2],0,"eraYear"),s("y",["yyy",3],0,"eraYear"),s("y",["yyyy",4],0,"eraYear"),k("N",rn),k("NN",rn),k("NNN",rn),k("NNNN",function(e,t){return t.erasNameRegex(e)}),k("NNNNN",function(e,t){return t.erasNarrowRegex(e)}),D(["N","NN","NNN","NNNN","NNNNN"],function(e,t,n,s){s=n._locale.erasParse(e,s,n._strict);s?m(n).era=s:m(n).invalidEra=e}),k("y",Me),k("yy",Me),k("yyy",Me),k("yyyy",Me),k("yo",function(e,t){return t._eraYearOrdinalRegex||Me}),D(["y","yy","yyy","yyyy"],Y),D(["yo"],function(e,t,n,s){var i;n._locale._eraYearOrdinalRegex&&(i=e.match(n._locale._eraYearOrdinalRegex)),n._locale.eraYearOrdinalParse?t[Y]=n._locale.eraYearOrdinalParse(e,i):t[Y]=parseInt(e,10)}),s(0,["gg",2],0,function(){return this.weekYear()%100}),s(0,["GG",2],0,function(){return this.isoWeekYear()%100}),on("gggg","weekYear"),on("ggggg","weekYear"),on("GGGG","isoWeekYear"),on("GGGGG","isoWeekYear"),t("weekYear","gg"),t("isoWeekYear","GG"),n("weekYear",1),n("isoWeekYear",1),k("G",De),k("g",De),k("GG",p,w),k("gg",p,w),k("GGGG",ve,_e),k("gggg",ve,_e),k("GGGGG",ke,ye),k("ggggg",ke,ye),Te(["gggg","ggggg","GGGG","GGGGG"],function(e,t,n,s){t[s.substr(0,2)]=g(e)}),Te(["gg","GG"],function(e,t,n,s){t[s]=f.parseTwoDigitYear(e)}),s("Q",0,"Qo","quarter"),t("quarter","Q"),n("quarter",7),k("Q",i),D("Q",function(e,t){t[O]=3*(g(e)-1)}),s("D",["DD",2],"Do","date"),t("date","D"),n("date",9),k("D",p),k("DD",p,w),k("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),D(["D","DD"],b),D("Do",function(e,t){t[b]=g(e.match(p)[0])});ve=de("Date",!0);s("DDD",["DDDD",3],"DDDo","dayOfYear"),t("dayOfYear","DDD"),n("dayOfYear",4),k("DDD",pe),k("DDDD",me),D(["DDD","DDDD"],function(e,t,n){n._dayOfYear=g(e)}),s("m",["mm",2],0,"minute"),t("minute","m"),n("minute",14),k("m",p),k("mm",p,w),D(["m","mm"],T);var ln,_e=de("Minutes",!1),ke=(s("s",["ss",2],0,"second"),t("second","s"),n("second",15),k("s",p),k("ss",p,w),D(["s","ss"],N),de("Seconds",!1));for(s("S",0,0,function(){return~~(this.millisecond()/100)}),s(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),s(0,["SSS",3],0,"millisecond"),s(0,["SSSS",4],0,function(){return 10*this.millisecond()}),s(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),s(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),s(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),s(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),s(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),t("millisecond","ms"),n("millisecond",16),k("S",pe,i),k("SS",pe,w),k("SSS",pe,me),ln="SSSS";ln.length<=9;ln+="S")k(ln,Me);function hn(e,t){t[Ne]=g(1e3*("0."+e))}for(ln="S";ln.length<=9;ln+="S")D(ln,hn);ye=de("Milliseconds",!1),s("z",0,0,"zoneAbbr"),s("zz",0,0,"zoneName");i=q.prototype;function dn(e){return e}i.add=Ce,i.calendar=function(e,t){1===arguments.length&&(arguments[0]?Jt(arguments[0])?(e=arguments[0],t=void 0):function(e){for(var t=F(e)&&!L(e),n=!1,s=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],i=0;i<s.length;i+=1)n=n||c(e,s[i]);return t&&n}(arguments[0])&&(t=arguments[0],e=void 0):t=e=void 0);var e=e||W(),n=Gt(e,this).startOf("day"),n=f.calendarFormat(this,n)||"sameElse",t=t&&(d(t[n])?t[n].call(this,e):t[n]);return this.format(t||this.localeData().calendar(n,this,W(e)))},i.clone=function(){return new q(this)},i.diff=function(e,t,n){var s,i,r;if(!this.isValid())return NaN;if(!(s=Gt(e,this)).isValid())return NaN;switch(i=6e4*(s.utcOffset()-this.utcOffset()),t=_(t)){case"year":r=Qt(this,s)/12;break;case"month":r=Qt(this,s);break;case"quarter":r=Qt(this,s)/3;break;case"second":r=(this-s)/1e3;break;case"minute":r=(this-s)/6e4;break;case"hour":r=(this-s)/36e5;break;case"day":r=(this-s-i)/864e5;break;case"week":r=(this-s-i)/6048e5;break;default:r=this-s}return n?r:y(r)},i.endOf=function(e){var t,n;if(void 0===(e=_(e))||"millisecond"===e||!this.isValid())return this;switch(n=this._isUTC?sn:nn,e){case"year":t=n(this.year()+1,0,1)-1;break;case"quarter":t=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=n(this.year(),this.month()+1,1)-1;break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf(),t+=36e5-tn(t+(this._isUTC?0:6e4*this.utcOffset()),36e5)-1;break;case"minute":t=this._d.valueOf(),t+=6e4-tn(t,6e4)-1;break;case"second":t=this._d.valueOf(),t+=1e3-tn(t,1e3)-1}return this._d.setTime(t),f.updateOffset(this,!0),this},i.format=function(e){return e=e||(this.isUtc()?f.defaultFormatUtc:f.defaultFormat),e=re(this,e),this.localeData().postformat(e)},i.from=function(e,t){return this.isValid()&&(h(e)&&e.isValid()||W(e).isValid())?C({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},i.fromNow=function(e){return this.from(W(),e)},i.to=function(e,t){return this.isValid()&&(h(e)&&e.isValid()||W(e).isValid())?C({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},i.toNow=function(e){return this.to(W(),e)},i.get=function(e){return d(this[e=_(e)])?this[e]():this},i.invalidAt=function(){return m(this).overflow},i.isAfter=function(e,t){return e=h(e)?e:W(e),!(!this.isValid()||!e.isValid())&&("millisecond"===(t=_(t)||"millisecond")?this.valueOf()>e.valueOf():e.valueOf()<this.clone().startOf(t).valueOf())},i.isBefore=function(e,t){return e=h(e)?e:W(e),!(!this.isValid()||!e.isValid())&&("millisecond"===(t=_(t)||"millisecond")?this.valueOf()<e.valueOf():this.clone().endOf(t).valueOf()<e.valueOf())},i.isBetween=function(e,t,n,s){return e=h(e)?e:W(e),t=h(t)?t:W(t),!!(this.isValid()&&e.isValid()&&t.isValid())&&(("("===(s=s||"()")[0]?this.isAfter(e,n):!this.isBefore(e,n))&&(")"===s[1]?this.isBefore(t,n):!this.isAfter(t,n)))},i.isSame=function(e,t){var e=h(e)?e:W(e);return!(!this.isValid()||!e.isValid())&&("millisecond"===(t=_(t)||"millisecond")?this.valueOf()===e.valueOf():(e=e.valueOf(),this.clone().startOf(t).valueOf()<=e&&e<=this.clone().endOf(t).valueOf()))},i.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)},i.isSameOrBefore=function(e,t){return this.isSame(e,t)||this.isBefore(e,t)},i.isValid=function(){return A(this)},i.lang=Xe,i.locale=Xt,i.localeData=Kt,i.max=we,i.min=ge,i.parsingFlags=function(){return E({},m(this))},i.set=function(e,t){if("object"==typeof e)for(var n=function(e){var t,n=[];for(t in e)c(e,t)&&n.push({unit:t,priority:le[t]});return n.sort(function(e,t){return e.priority-t.priority}),n}(e=ue(e)),s=n.length,i=0;i<s;i++)this[n[i].unit](e[n[i].unit]);else if(d(this[e=_(e)]))return this[e](t);return this},i.startOf=function(e){var t,n;if(void 0===(e=_(e))||"millisecond"===e||!this.isValid())return this;switch(n=this._isUTC?sn:nn,e){case"year":t=n(this.year(),0,1);break;case"quarter":t=n(this.year(),this.month()-this.month()%3,1);break;case"month":t=n(this.year(),this.month(),1);break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=n(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf(),t-=tn(t+(this._isUTC?0:6e4*this.utcOffset()),36e5);break;case"minute":t=this._d.valueOf(),t-=tn(t,6e4);break;case"second":t=this._d.valueOf(),t-=tn(t,1e3)}return this._d.setTime(t),f.updateOffset(this,!0),this},i.subtract=Je,i.toArray=function(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]},i.toObject=function(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}},i.toDate=function(){return new Date(this.valueOf())},i.toISOString=function(e){if(!this.isValid())return null;var t=(e=!0!==e)?this.clone().utc():this;return t.year()<0||9999<t.year()?re(t,e?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):d(Date.prototype.toISOString)?e?this.toDate().toISOString():new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",re(t,"Z")):re(t,e?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")},i.inspect=function(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e,t="moment",n="";return this.isLocal()||(t=0===this.utcOffset()?"moment.utc":"moment.parseZone",n="Z"),t="["+t+'("]',e=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",this.format(t+e+"-MM-DD[T]HH:mm:ss.SSS"+(n+'[")]'))},"undefined"!=typeof Symbol&&null!=Symbol.for&&(i[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),i.toJSON=function(){return this.isValid()?this.toISOString():null},i.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},i.unix=function(){return Math.floor(this.valueOf()/1e3)},i.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},i.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},i.eraName=function(){for(var e,t=this.localeData().eras(),n=0,s=t.length;n<s;++n){if(e=this.clone().startOf("day").valueOf(),t[n].since<=e&&e<=t[n].until)return t[n].name;if(t[n].until<=e&&e<=t[n].since)return t[n].name}return""},i.eraNarrow=function(){for(var e,t=this.localeData().eras(),n=0,s=t.length;n<s;++n){if(e=this.clone().startOf("day").valueOf(),t[n].since<=e&&e<=t[n].until)return t[n].narrow;if(t[n].until<=e&&e<=t[n].since)return t[n].narrow}return""},i.eraAbbr=function(){for(var e,t=this.localeData().eras(),n=0,s=t.length;n<s;++n){if(e=this.clone().startOf("day").valueOf(),t[n].since<=e&&e<=t[n].until)return t[n].abbr;if(t[n].until<=e&&e<=t[n].since)return t[n].abbr}return""},i.eraYear=function(){for(var e,t,n=this.localeData().eras(),s=0,i=n.length;s<i;++s)if(e=n[s].since<=n[s].until?1:-1,t=this.clone().startOf("day").valueOf(),n[s].since<=t&&t<=n[s].until||n[s].until<=t&&t<=n[s].since)return(this.year()-f(n[s].since).year())*e+n[s].offset;return this.year()},i.year=Ie,i.isLeapYear=function(){return he(this.year())},i.weekYear=function(e){return un.call(this,e,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)},i.isoWeekYear=function(e){return un.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)},i.quarter=i.quarters=function(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)},i.month=Ge,i.daysInMonth=function(){return We(this.year(),this.month())},i.week=i.weeks=function(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")},i.isoWeek=i.isoWeeks=function(e){var t=qe(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")},i.weeksInYear=function(){var e=this.localeData()._week;return P(this.year(),e.dow,e.doy)},i.weeksInWeekYear=function(){var e=this.localeData()._week;return P(this.weekYear(),e.dow,e.doy)},i.isoWeeksInYear=function(){return P(this.year(),1,4)},i.isoWeeksInISOWeekYear=function(){return P(this.isoWeekYear(),1,4)},i.date=ve,i.day=i.days=function(e){if(!this.isValid())return null!=e?this:NaN;var t,n,s=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=e?(t=e,n=this.localeData(),e="string"!=typeof t?t:isNaN(t)?"number"==typeof(t=n.weekdaysParse(t))?t:null:parseInt(t,10),this.add(e-s,"d")):s},i.weekday=function(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")},i.isoWeekday=function(e){return this.isValid()?null!=e?(t=e,n=this.localeData(),n="string"==typeof t?n.weekdaysParse(t)%7||7:isNaN(t)?null:t,this.day(this.day()%7?n:n-7)):this.day()||7:null!=e?this:NaN;var t,n},i.dayOfYear=function(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")},i.hour=i.hours=v,i.minute=i.minutes=_e,i.second=i.seconds=ke,i.millisecond=i.milliseconds=ye,i.utcOffset=function(e,t,n){var s,i=this._offset||0;if(!this.isValid())return null!=e?this:NaN;if(null==e)return this._isUTC?i:Et(this);if("string"==typeof e){if(null===(e=Vt(Ye,e)))return this}else Math.abs(e)<16&&!n&&(e*=60);return!this._isUTC&&t&&(s=Et(this)),this._offset=e,this._isUTC=!0,null!=s&&this.add(s,"m"),i!==e&&(!t||this._changeInProgress?qt(this,C(e-i,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,f.updateOffset(this,!0),this._changeInProgress=null)),this},i.utc=function(e){return this.utcOffset(0,e)},i.local=function(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(Et(this),"m")),this},i.parseZone=function(){var e;return null!=this._tzm?this.utcOffset(this._tzm,!1,!0):"string"==typeof this._i&&(null!=(e=Vt(Se,this._i))?this.utcOffset(e):this.utcOffset(0,!0)),this},i.hasAlignedHourOffset=function(e){return!!this.isValid()&&(e=e?W(e).utcOffset():0,(this.utcOffset()-e)%60==0)},i.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},i.isLocal=function(){return!!this.isValid()&&!this._isUTC},i.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},i.isUtc=At,i.isUTC=At,i.zoneAbbr=function(){return this._isUTC?"UTC":""},i.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},i.dates=e("dates accessor is deprecated. Use date instead.",ve),i.months=e("months accessor is deprecated. Use month instead",Ge),i.years=e("years accessor is deprecated. Use year instead",Ie),i.zone=e("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?(this.utcOffset(e="string"!=typeof e?-e:e,t),this):-this.utcOffset()}),i.isDSTShifted=e("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!o(this._isDSTShifted))return this._isDSTShifted;var e,t={};return $(t,this),(t=Nt(t))._a?(e=(t._isUTC?l:W)(t._a),this._isDSTShifted=this.isValid()&&0<function(e,t,n){for(var s=Math.min(e.length,t.length),i=Math.abs(e.length-t.length),r=0,a=0;a<s;a++)(n&&e[a]!==t[a]||!n&&g(e[a])!==g(t[a]))&&r++;return r+i}(t._a,e.toArray())):this._isDSTShifted=!1,this._isDSTShifted});w=K.prototype;function cn(e,t,n,s){var i=mt(),s=l().set(s,t);return i[n](s,e)}function fn(e,t,n){if(u(e)&&(t=e,e=void 0),e=e||"",null!=t)return cn(e,t,n,"month");for(var s=[],i=0;i<12;i++)s[i]=cn(e,i,n,"month");return s}function mn(e,t,n,s){t=("boolean"==typeof e?u(t)&&(n=t,t=void 0):(t=e,e=!1,u(n=t)&&(n=t,t=void 0)),t||"");var i,r=mt(),a=e?r._week.dow:0,o=[];if(null!=n)return cn(t,(n+a)%7,s,"day");for(i=0;i<7;i++)o[i]=cn(t,(i+a)%7,s,"day");return o}w.calendar=function(e,t,n){return d(e=this._calendar[e]||this._calendar.sameElse)?e.call(t,n):e},w.longDateFormat=function(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.match(te).map(function(e){return"MMMM"===e||"MM"===e||"DD"===e||"dddd"===e?e.slice(1):e}).join(""),this._longDateFormat[e])},w.invalidDate=function(){return this._invalidDate},w.ordinal=function(e){return this._ordinal.replace("%d",e)},w.preparse=dn,w.postformat=dn,w.relativeTime=function(e,t,n,s){var i=this._relativeTime[n];return d(i)?i(e,t,n,s):i.replace(/%d/i,e)},w.pastFuture=function(e,t){return d(e=this._relativeTime[0<e?"future":"past"])?e(t):e.replace(/%s/i,t)},w.set=function(e){var t,n;for(n in e)c(e,n)&&(d(t=e[n])?this[n]=t:this["_"+n]=t);this._config=e,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},w.eras=function(e,t){for(var n,s=this._eras||mt("en")._eras,i=0,r=s.length;i<r;++i)switch("string"==typeof s[i].since&&(n=f(s[i].since).startOf("day"),s[i].since=n.valueOf()),typeof s[i].until){case"undefined":s[i].until=1/0;break;case"string":n=f(s[i].until).startOf("day").valueOf(),s[i].until=n.valueOf()}return s},w.erasParse=function(e,t,n){var s,i,r,a,o,u=this.eras();for(e=e.toUpperCase(),s=0,i=u.length;s<i;++s)if(r=u[s].name.toUpperCase(),a=u[s].abbr.toUpperCase(),o=u[s].narrow.toUpperCase(),n)switch(t){case"N":case"NN":case"NNN":if(a===e)return u[s];break;case"NNNN":if(r===e)return u[s];break;case"NNNNN":if(o===e)return u[s]}else if(0<=[r,a,o].indexOf(e))return u[s]},w.erasConvertYear=function(e,t){var n=e.since<=e.until?1:-1;return void 0===t?f(e.since).year():f(e.since).year()+(t-e.offset)*n},w.erasAbbrRegex=function(e){return c(this,"_erasAbbrRegex")||an.call(this),e?this._erasAbbrRegex:this._erasRegex},w.erasNameRegex=function(e){return c(this,"_erasNameRegex")||an.call(this),e?this._erasNameRegex:this._erasRegex},w.erasNarrowRegex=function(e){return c(this,"_erasNarrowRegex")||an.call(this),e?this._erasNarrowRegex:this._erasRegex},w.months=function(e,t){return e?(a(this._months)?this._months:this._months[(this._months.isFormat||He).test(t)?"format":"standalone"])[e.month()]:a(this._months)?this._months:this._months.standalone},w.monthsShort=function(e,t){return e?(a(this._monthsShort)?this._monthsShort:this._monthsShort[He.test(t)?"format":"standalone"])[e.month()]:a(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},w.monthsParse=function(e,t,n){var s,i;if(this._monthsParseExact)return function(e,t,n){var s,i,r,e=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],s=0;s<12;++s)r=l([2e3,s]),this._shortMonthsParse[s]=this.monthsShort(r,"").toLocaleLowerCase(),this._longMonthsParse[s]=this.months(r,"").toLocaleLowerCase();return n?"MMM"===t?-1!==(i=S.call(this._shortMonthsParse,e))?i:null:-1!==(i=S.call(this._longMonthsParse,e))?i:null:"MMM"===t?-1!==(i=S.call(this._shortMonthsParse,e))||-1!==(i=S.call(this._longMonthsParse,e))?i:null:-1!==(i=S.call(this._longMonthsParse,e))||-1!==(i=S.call(this._shortMonthsParse,e))?i:null}.call(this,e,t,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),s=0;s<12;s++){if(i=l([2e3,s]),n&&!this._longMonthsParse[s]&&(this._longMonthsParse[s]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[s]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),n||this._monthsParse[s]||(i="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[s]=new RegExp(i.replace(".",""),"i")),n&&"MMMM"===t&&this._longMonthsParse[s].test(e))return s;if(n&&"MMM"===t&&this._shortMonthsParse[s].test(e))return s;if(!n&&this._monthsParse[s].test(e))return s}},w.monthsRegex=function(e){return this._monthsParseExact?(c(this,"_monthsRegex")||Ee.call(this),e?this._monthsStrictRegex:this._monthsRegex):(c(this,"_monthsRegex")||(this._monthsRegex=Le),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)},w.monthsShortRegex=function(e){return this._monthsParseExact?(c(this,"_monthsRegex")||Ee.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(c(this,"_monthsShortRegex")||(this._monthsShortRegex=Fe),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)},w.week=function(e){return qe(e,this._week.dow,this._week.doy).week},w.firstDayOfYear=function(){return this._week.doy},w.firstDayOfWeek=function(){return this._week.dow},w.weekdays=function(e,t){return t=a(this._weekdays)?this._weekdays:this._weekdays[e&&!0!==e&&this._weekdays.isFormat.test(t)?"format":"standalone"],!0===e?Be(t,this._week.dow):e?t[e.day()]:t},w.weekdaysMin=function(e){return!0===e?Be(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin},w.weekdaysShort=function(e){return!0===e?Be(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort},w.weekdaysParse=function(e,t,n){var s,i;if(this._weekdaysParseExact)return function(e,t,n){var s,i,r,e=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],s=0;s<7;++s)r=l([2e3,1]).day(s),this._minWeekdaysParse[s]=this.weekdaysMin(r,"").toLocaleLowerCase(),this._shortWeekdaysParse[s]=this.weekdaysShort(r,"").toLocaleLowerCase(),this._weekdaysParse[s]=this.weekdays(r,"").toLocaleLowerCase();return n?"dddd"===t?-1!==(i=S.call(this._weekdaysParse,e))?i:null:"ddd"===t?-1!==(i=S.call(this._shortWeekdaysParse,e))?i:null:-1!==(i=S.call(this._minWeekdaysParse,e))?i:null:"dddd"===t?-1!==(i=S.call(this._weekdaysParse,e))||-1!==(i=S.call(this._shortWeekdaysParse,e))||-1!==(i=S.call(this._minWeekdaysParse,e))?i:null:"ddd"===t?-1!==(i=S.call(this._shortWeekdaysParse,e))||-1!==(i=S.call(this._weekdaysParse,e))||-1!==(i=S.call(this._minWeekdaysParse,e))?i:null:-1!==(i=S.call(this._minWeekdaysParse,e))||-1!==(i=S.call(this._weekdaysParse,e))||-1!==(i=S.call(this._shortWeekdaysParse,e))?i:null}.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),s=0;s<7;s++){if(i=l([2e3,1]).day(s),n&&!this._fullWeekdaysParse[s]&&(this._fullWeekdaysParse[s]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[s]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[s]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[s]||(i="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[s]=new RegExp(i.replace(".",""),"i")),n&&"dddd"===t&&this._fullWeekdaysParse[s].test(e))return s;if(n&&"ddd"===t&&this._shortWeekdaysParse[s].test(e))return s;if(n&&"dd"===t&&this._minWeekdaysParse[s].test(e))return s;if(!n&&this._weekdaysParse[s].test(e))return s}},w.weekdaysRegex=function(e){return this._weekdaysParseExact?(c(this,"_weekdaysRegex")||nt.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(c(this,"_weekdaysRegex")||(this._weekdaysRegex=Ke),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)},w.weekdaysShortRegex=function(e){return this._weekdaysParseExact?(c(this,"_weekdaysRegex")||nt.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(c(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=et),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},w.weekdaysMinRegex=function(e){return this._weekdaysParseExact?(c(this,"_weekdaysRegex")||nt.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(c(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=tt),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},w.isPM=function(e){return"p"===(e+"").toLowerCase().charAt(0)},w.meridiem=function(e,t,n){return 11<e?n?"pm":"PM":n?"am":"AM"},ct("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1===g(e%100/10)?"th":1==t?"st":2==t?"nd":3==t?"rd":"th")}}),f.lang=e("moment.lang is deprecated. Use moment.locale instead.",ct),f.langData=e("moment.langData is deprecated. Use moment.localeData instead.",mt);var _n=Math.abs;function yn(e,t,n,s){t=C(t,n);return e._milliseconds+=s*t._milliseconds,e._days+=s*t._days,e._months+=s*t._months,e._bubble()}function gn(e){return e<0?Math.floor(e):Math.ceil(e)}function wn(e){return 4800*e/146097}function pn(e){return 146097*e/4800}function vn(e){return function(){return this.as(e)}}pe=vn("ms"),me=vn("s"),Ce=vn("m"),we=vn("h"),ge=vn("d"),Je=vn("w"),v=vn("M"),_e=vn("Q"),ke=vn("y");function kn(e){return function(){return this.isValid()?this._data[e]:NaN}}var ye=kn("milliseconds"),ve=kn("seconds"),Ie=kn("minutes"),w=kn("hours"),Mn=kn("days"),Dn=kn("months"),Sn=kn("years");var Yn=Math.round,On={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function bn(e,t,n,s){var i=C(e).abs(),r=Yn(i.as("s")),a=Yn(i.as("m")),o=Yn(i.as("h")),u=Yn(i.as("d")),l=Yn(i.as("M")),h=Yn(i.as("w")),i=Yn(i.as("y")),r=(r<=n.ss?["s",r]:r<n.s&&["ss",r])||a<=1&&["m"]||a<n.m&&["mm",a]||o<=1&&["h"]||o<n.h&&["hh",o]||u<=1&&["d"]||u<n.d&&["dd",u];return(r=(r=null!=n.w?r||h<=1&&["w"]||h<n.w&&["ww",h]:r)||l<=1&&["M"]||l<n.M&&["MM",l]||i<=1&&["y"]||["yy",i])[2]=t,r[3]=0<+e,r[4]=s,function(e,t,n,s,i){return i.relativeTime(t||1,!!n,e,s)}.apply(null,r)}var xn=Math.abs;function Tn(e){return(0<e)-(e<0)||+e}function Nn(){if(!this.isValid())return this.localeData().invalidDate();var e,t,n,s,i,r,a,o=xn(this._milliseconds)/1e3,u=xn(this._days),l=xn(this._months),h=this.asSeconds();return h?(e=y(o/60),t=y(e/60),o%=60,e%=60,n=y(l/12),l%=12,s=o?o.toFixed(3).replace(/\.?0+$/,""):"",i=Tn(this._months)!==Tn(h)?"-":"",r=Tn(this._days)!==Tn(h)?"-":"",a=Tn(this._milliseconds)!==Tn(h)?"-":"",(h<0?"-":"")+"P"+(n?i+n+"Y":"")+(l?i+l+"M":"")+(u?r+u+"D":"")+(t||e||o?"T":"")+(t?a+t+"H":"")+(e?a+e+"M":"")+(o?a+s+"S":"")):"P0D"}var U=Ct.prototype;return U.isValid=function(){return this._isValid},U.abs=function(){var e=this._data;return this._milliseconds=_n(this._milliseconds),this._days=_n(this._days),this._months=_n(this._months),e.milliseconds=_n(e.milliseconds),e.seconds=_n(e.seconds),e.minutes=_n(e.minutes),e.hours=_n(e.hours),e.months=_n(e.months),e.years=_n(e.years),this},U.add=function(e,t){return yn(this,e,t,1)},U.subtract=function(e,t){return yn(this,e,t,-1)},U.as=function(e){if(!this.isValid())return NaN;var t,n,s=this._milliseconds;if("month"===(e=_(e))||"quarter"===e||"year"===e)switch(t=this._days+s/864e5,n=this._months+wn(t),e){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(t=this._days+Math.round(pn(this._months)),e){case"week":return t/7+s/6048e5;case"day":return t+s/864e5;case"hour":return 24*t+s/36e5;case"minute":return 1440*t+s/6e4;case"second":return 86400*t+s/1e3;case"millisecond":return Math.floor(864e5*t)+s;default:throw new Error("Unknown unit "+e)}},U.asMilliseconds=pe,U.asSeconds=me,U.asMinutes=Ce,U.asHours=we,U.asDays=ge,U.asWeeks=Je,U.asMonths=v,U.asQuarters=_e,U.asYears=ke,
2U.valueOf=function(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*g(this._months/12):NaN},U._bubble=function(){var e=this._milliseconds,t=this._days,n=this._months,s=this._data;return 0<=e&&0<=t&&0<=n||e<=0&&t<=0&&n<=0||(e+=864e5*gn(pn(n)+t),n=t=0),s.milliseconds=e%1e3,e=y(e/1e3),s.seconds=e%60,e=y(e/60),s.minutes=e%60,e=y(e/60),s.hours=e%24,t+=y(e/24),n+=e=y(wn(t)),t-=gn(pn(e)),e=y(n/12),n%=12,s.days=t,s.months=n,s.years=e,this},U.clone=function(){return C(this)},U.get=function(e){return e=_(e),this.isValid()?this[e+"s"]():NaN},U.milliseconds=ye,U.seconds=ve,U.minutes=Ie,U.hours=w,U.days=Mn,U.weeks=function(){return y(this.days()/7)},U.months=Dn,U.years=Sn,U.humanize=function(e,t){if(!this.isValid())return this.localeData().invalidDate();var n=!1,s=On;return"object"==typeof e&&(t=e,e=!1),"boolean"==typeof e&&(n=e),"object"==typeof t&&(s=Object.assign({},On,t),null!=t.s&&null==t.ss&&(s.ss=t.s-1)),e=this.localeData(),t=bn(this,!n,s,e),n&&(t=e.pastFuture(+this,t)),e.postformat(t)},U.toISOString=Nn,U.toString=Nn,U.toJSON=Nn,U.locale=Xt,U.localeData=Kt,U.toIsoString=e("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Nn),U.lang=Xe,s("X",0,0,"unix"),s("x",0,0,"valueOf"),k("x",De),k("X",/[+-]?\d+(\.\d{1,3})?/),D("X",function(e,t,n){n._d=new Date(1e3*parseFloat(e))}),D("x",function(e,t,n){n._d=new Date(g(e))}),f.version="2.29.4",H=W,f.fn=i,f.min=function(){return Rt("isBefore",[].slice.call(arguments,0))},f.max=function(){return Rt("isAfter",[].slice.call(arguments,0))},f.now=function(){return Date.now?Date.now():+new Date},f.utc=l,f.unix=function(e){return W(1e3*e)},f.months=function(e,t){return fn(e,t,"months")},f.isDate=V,f.locale=ct,f.invalid=I,f.duration=C,f.isMoment=h,f.weekdays=function(e,t,n){return mn(e,t,n,"weekdays")},f.parseZone=function(){return W.apply(null,arguments).parseZone()},f.localeData=mt,f.isDuration=Ut,f.monthsShort=function(e,t){return fn(e,t,"monthsShort")},f.weekdaysMin=function(e,t,n){return mn(e,t,n,"weekdaysMin")},f.defineLocale=ft,f.updateLocale=function(e,t){var n,s;return null!=t?(s=ot,null!=R[e]&&null!=R[e].parentLocale?R[e].set(X(R[e]._config,t)):(t=X(s=null!=(n=dt(e))?n._config:s,t),null==n&&(t.abbr=e),(s=new K(t)).parentLocale=R[e],R[e]=s),ct(e)):null!=R[e]&&(null!=R[e].parentLocale?(R[e]=R[e].parentLocale,e===ct()&&ct(e)):null!=R[e]&&delete R[e]),R[e]},f.locales=function(){return ee(R)},f.weekdaysShort=function(e,t,n){return mn(e,t,n,"weekdaysShort")},f.normalizeUnits=_,f.relativeTimeRounding=function(e){return void 0===e?Yn:"function"==typeof e&&(Yn=e,!0)},f.relativeTimeThreshold=function(e,t){return void 0!==On[e]&&(void 0===t?On[e]:(On[e]=t,"s"===e&&(On.ss=t-1),!0))},f.calendarFormat=function(e,t){return(e=e.diff(t,"days",!0))<-6?"sameElse":e<-1?"lastWeek":e<0?"lastDay":e<1?"sameDay":e<2?"nextDay":e<7?"nextWeek":"sameElse"},f.prototype=i,f.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},f}); 3 4/** 5* @author: Rinat G. http://coding.kz 6* @copyright: Copyright (c) 2019 Rinat G. 7* @license: Licensed under the MIT license. See http://www.opensource.org/licenses/mit-license.php 8*/ 9 10// Following the UMD template https://github.com/umdjs/umd/blob/master/templates/returnExportsGlobal.js 11(function (root, factory) { 12 if (typeof define === 'function' && define.amd) { 13 // AMD. Make globaly available as well 14 define(['moment'], function (moment) { 15 return factory(moment); 16 }); 17 } else if (typeof module === 'object' && module.exports) { 18 // Node / Browserify 19 var moment = (typeof window != 'undefined' && typeof window.moment != 'undefined') ? window.moment : require('moment'); 20 module.exports = factory(moment); 21 } else { 22 // Browser globals 23 root.Lightpick = factory(root.moment); 24 } 25}(this, function(moment) { 26 'use strict'; 27 28 var document = window.document, 29 30 defaults = { 31 field: null, 32 secondField: null, 33 firstDay: 1, 34 parentEl: 'body', 35 lang: 'auto', 36 format: 'DD/MM/YYYY', 37 separator: ' - ', 38 numberOfMonths: 1, 39 numberOfColumns: 2, 40 singleDate: true, 41 autoclose: true, 42 repick: false, 43 startDate: null, 44 endDate: null, 45 minDate: null, 46 maxDate: null, 47 disableDates: null, 48 selectForward: false, 49 selectBackward: false, 50 minDays: null, 51 maxDays: null, 52 hoveringTooltip: true, 53 hideOnBodyClick: true, 54 footer: false, 55 disabledDatesInRange: true, 56 tooltipNights: false, 57 orientation: 'auto', 58 disableWeekends: false, 59 inline: false, 60 weekdayStyle: 'short', 61 dropdowns: { 62 years: { 63 min: 1900, 64 max: null, 65 }, 66 months: true, 67 }, 68 locale: { 69 buttons: { 70 prev: '←', 71 next: '→', 72 close: '×', 73 reset: 'Reset', 74 apply: 'Apply', 75 }, 76 tooltip: { 77 one: 'day', 78 other: 'days', 79 }, 80 tooltipOnDisabled: null, 81 pluralize: function(i, locale){ 82 if (typeof i === "string") i = parseInt(i, 10); 83 84 if (i === 1 && 'one' in locale) return locale.one; 85 if ('other' in locale) return locale.other; 86 87 return ''; 88 }, 89 }, 90 91 onSelect: null, 92 onSelectStart: null, 93 onSelectEnd: null, 94 onOpen: null, 95 onClose: null, 96 onError: null, 97 onMonthsChange: null, 98 onYearsChange: null 99 }, 100 101 renderTopButtons = function(opts) 102 { 103 return '<div class="lightpick__toolbar">' 104 + '' 105 + '<button type="button" class="lightpick__previous-action">' + opts.locale.buttons.prev + '</button>' 106 + '<button type="button" class="lightpick__next-action">' + opts.locale.buttons.next + '</button>' 107 + (!opts.autoclose && !opts.inline ? '<button type="button" class="lightpick__close-action">' + opts.locale.buttons.close + '</button>' : '') 108 + '</div>'; 109 }, 110 111 weekdayName = function(opts, day, weekdayStyle) 112 {
vendor: 36,041 bytes, lines 113-1109
113 return new Date(1970, 0, day, 12, 0, 0, 0).toLocaleString(opts.lang, { weekday: weekdayStyle || opts.weekdayStyle }); 114 }, 115 116 renderDay = function(opts, date, dummy, extraClass) 117 { 118 if (dummy) return '<div></div>'; 119 120 var date = moment(date), 121 prevMonth = moment(date).subtract(1, 'month'), 122 nextMonth = moment(date).add(1, 'month'); 123 124 var day = { 125 time: moment(date).valueOf(), 126 className: ['lightpick__day', 'is-available'] 127 }; 128 129 if (extraClass instanceof Array || Object.prototype.toString.call(extraClass) === '[object Array]') { 130 extraClass = extraClass.filter( function( el ) { 131 return ['lightpick__day', 'is-available', 'is-previous-month', 'is-next-month'].indexOf( el ) >= 0; 132 }); 133 day.className = day.className.concat(extraClass); 134 } 135 else { 136 day.className.push(extraClass); 137 } 138 139 if (opts.disableDates) { 140 for (var i = 0; i < opts.disableDates.length; i++) { 141 if (opts.disableDates[i] instanceof Array || Object.prototype.toString.call(opts.disableDates[i]) === '[object Array]') { 142 var _from = moment(opts.disableDates[i][0], opts.format), 143 _to = moment(opts.disableDates[i][1], opts.format); 144 145 if (_from.isValid() && _to.isValid() && date.isBetween(_from, _to, 'day', '[]')){ 146 day.className.push('is-disabled'); 147 } 148 } 149 else if (moment(opts.disableDates[i], opts.format).isValid() && moment(opts.disableDates[i], opts.format).isSame(date, 'day')) { 150 day.className.push('is-disabled'); 151 } 152 153 if (day.className.indexOf('is-disabled') >= 0) { 154 155 if (opts.locale.tooltipOnDisabled && (!opts.startDate || date.isAfter(opts.startDate) || opts.startDate && opts.endDate)) { 156 day.className.push('disabled-tooltip'); 157 } 158 159 if (day.className.indexOf('is-start-date') >= 0) { 160 this.setStartDate(null); 161 this.setEndDate(null); 162 } 163 else if (day.className.indexOf('is-end-date') >= 0) { 164 this.setEndDate(null); 165 } 166 } 167 } 168 } 169 170 if (opts.minDays && opts.startDate && !opts.endDate) { 171 if (date.isBetween(moment(opts.startDate).subtract(opts.minDays - 1, 'day'), moment(opts.startDate).add(opts.minDays - 1, 'day'), 'day')) { 172 day.className.push('is-disabled'); 173 174 if (opts.selectForward && date.isSameOrAfter(opts.startDate)) { 175 day.className.push('is-forward-selected'); 176 day.className.push('is-in-range'); 177 } 178 } 179 } 180 181 if (opts.maxDays && opts.startDate && !opts.endDate) { 182 if (date.isSameOrBefore(moment(opts.startDate).subtract(opts.maxDays, 'day'), 'day')) { 183 day.className.push('is-disabled'); 184 } 185 else if (date.isSameOrAfter(moment(opts.startDate).add(opts.maxDays, 'day'), 'day')) { 186 day.className.push('is-disabled'); 187 } 188 } 189 190 if (opts.repick && (opts.minDays || opts.maxDays) && opts.startDate && opts.endDate) { 191 var tempStartDate = moment(opts.repickTrigger == opts.field ? opts.endDate : opts.startDate); 192 193 if (opts.minDays) { 194 if (date.isBetween(moment(tempStartDate).subtract(opts.minDays - 1, 'day'), moment(tempStartDate).add(opts.minDays - 1, 'day'), 'day')) { 195 day.className.push('is-disabled'); 196 } 197 } 198 199 if (opts.maxDays) { 200 if (date.isSameOrBefore(moment(tempStartDate).subtract(opts.maxDays, 'day'), 'day')) { 201 day.className.push('is-disabled'); 202 } 203 else if (date.isSameOrAfter(moment(tempStartDate).add(opts.maxDays, 'day'), 'day')) { 204 day.className.push('is-disabled'); 205 } 206 } 207 } 208 209 if (date.isSame(new Date(), 'day')) { 210 day.className.push('is-today'); 211 } 212 213 if (date.isSame(opts.startDate, 'day')) { 214 day.className.push('is-start-date'); 215 } 216 217 if (date.isSame(opts.endDate, 'day')) { 218 day.className.push('is-end-date'); 219 } 220 221 if (opts.startDate && opts.endDate && date.isBetween(opts.startDate, opts.endDate, 'day', '[]')) { 222 day.className.push('is-in-range'); 223 } 224 225 if (moment().isSame(date, 'month')) { 226 227 } 228 else if (prevMonth.isSame(date, 'month')) { 229 day.className.push('is-previous-month'); 230 } 231 else if (nextMonth.isSame(date, 'month')) { 232 day.className.push('is-next-month'); 233 } 234 235 if (opts.minDate && date.isBefore(opts.minDate, 'day')) { 236 day.className.push('is-disabled'); 237 } 238 239 if (opts.maxDate && date.isAfter(opts.maxDate, 'day')) { 240 day.className.push('is-disabled'); 241 } 242 243 if (opts.selectForward && !opts.singleDate && opts.startDate && !opts.endDate && date.isBefore(opts.startDate, 'day')) { 244 day.className.push('is-disabled'); 245 } 246 247 if (opts.selectBackward && !opts.singleDate && opts.startDate && !opts.endDate && date.isAfter(opts.startDate, 'day')) { 248 day.className.push('is-disabled'); 249 } 250 251 if (opts.disableWeekends && (date.isoWeekday() == 6 || date.isoWeekday() == 7)) { 252 day.className.push('is-disabled'); 253 } 254 255 day.className = day.className.filter(function(value, index, self) { 256 return self.indexOf(value) === index; 257 }); 258 259 if (day.className.indexOf('is-disabled') >= 0 && day.className.indexOf('is-available') >= 0) { 260 day.className.splice(day.className.indexOf('is-available'), 1); 261 } 262 263 var div = document.createElement('div'); 264 div.className = day.className.join(' '); 265 div.innerHTML = date.get('date'); 266 div.setAttribute('data-time', day.time); 267 268 return div.outerHTML; 269 }, 270 271 renderMonthsList = function(date, opts) 272 { 273 var d = moment(date), 274 select = document.createElement('select'); 275 276 for (var idx = 0; idx < 12; idx++) { 277 d.set('month', idx); 278 279 var option = document.createElement('option'); 280 option.value = d.toDate().getMonth(); 281 option.text = d.toDate().toLocaleString(opts.lang, { month: 'long' }); 282 283 if (idx === date.toDate().getMonth()) { 284 option.setAttribute('selected', 'selected'); 285 } 286 287 select.appendChild(option); 288 } 289 290 select.className = 'lightpick__select lightpick__select-months'; 291 292 // for text align to right 293 select.dir = 'rtl'; 294 295 if (!opts.dropdowns || !opts.dropdowns.months) { 296 select.disabled = true; 297 } 298 299 return select.outerHTML; 300 }, 301 302 renderYearsList = function(date, opts) 303 { 304 var d = moment(date), 305 select = document.createElement('select'), 306 years = opts.dropdowns && opts.dropdowns.years ? opts.dropdowns.years : null, 307 minYear = years && years.min ? years.min : 1900, 308 maxYear = years && years.max ? years.max : Number.parseInt(moment().format('YYYY')); 309 310 if (Number.parseInt(date.format('YYYY')) < minYear) { 311 minYear = Number.parseInt(date.format('YYYY')); 312 } 313 314 if (Number.parseInt(date.format('YYYY')) > maxYear) { 315 maxYear = Number.parseInt(date.format('YYYY')); 316 } 317 318 for (var idx = minYear; idx <= maxYear; idx++) { 319 d.set('year', idx); 320 321 var option = document.createElement('option'); 322 option.value = d.toDate().getFullYear(); 323 option.text = d.toDate().getFullYear(); 324 325 if (idx === date.toDate().getFullYear()) { 326 option.setAttribute('selected', 'selected'); 327 } 328 329 select.appendChild(option); 330 } 331 332 select.className = 'lightpick__select lightpick__select-years'; 333 334 if (!opts.dropdowns || !opts.dropdowns.years) { 335 select.disabled = true; 336 } 337 338 return select.outerHTML; 339 }, 340 341 renderCalendar = function(el, opts) 342 { 343 var html = '', 344 monthDate = moment(opts.calendar[0]); 345 346 for (var i = 0; i < opts.numberOfMonths; i++) { 347 var day = moment(monthDate); 348 349 html += '<section class="lightpick__month">'; 350 html += '<header class="lightpick__month-title-bar">' 351 html += '<div class="lightpick__month-title">' 352 + renderMonthsList(day, opts) 353 + renderYearsList(day, opts) 354 + '</div>'; 355 356 if (opts.numberOfMonths === 1) { 357 html += renderTopButtons(opts, 'days'); 358 } 359 360 html += '</header>'; // lightpick__month-title-bar 361 362 html += '<div class="lightpick__days-of-the-week">'; 363 for (var w = opts.firstDay + 4; w < 7 + opts.firstDay + 4; ++w) { 364 html += '<div class="lightpick__day-of-the-week" title="' + weekdayName(opts, w, 'long') + '">' + weekdayName(opts, w) + '</div>'; 365 } 366 html += '</div>'; // lightpick__days-of-the-week 367 368 html += '<div class="lightpick__days">'; 369 370 if (day.isoWeekday() !== opts.firstDay) { 371 var prevDays = day.isoWeekday() - opts.firstDay > 0 ? day.isoWeekday() - opts.firstDay : day.isoWeekday(), 372 prevMonth = moment(day).subtract(prevDays, 'day'), 373 daysInMonth = prevMonth.daysInMonth(); 374 375 for (var d = prevMonth.get('date'); d <= daysInMonth; d++) { 376 html += renderDay(opts, prevMonth, i > 0, 'is-previous-month'); 377 378 prevMonth.add(1, 'day'); 379 } 380 } 381 382 var daysInMonth = day.daysInMonth(), 383 today = new Date(); 384 385 for (var d = 0; d < daysInMonth; d++) { 386 html += renderDay(opts, day); 387 388 day.add(1, 'day'); 389 } 390 391 var nextMonth = moment(day), 392 nextDays = 7 - nextMonth.isoWeekday() + opts.firstDay; 393 394 if (nextDays < 7) { 395 for (var d = nextMonth.get('date'); d <= nextDays; d++) { 396 html += renderDay(opts, nextMonth, i < opts.numberOfMonths - 1, 'is-next-month'); 397 398 nextMonth.add(1, 'day'); 399 } 400 } 401 402 html += '</div>'; // lightpick__days 403 404 html += '</section>'; // lightpick__month 405 406 monthDate.add(1, 'month'); 407 } 408 409 opts.calendar[1] = moment(monthDate); 410 411 el.querySelector('.lightpick__months').innerHTML = html; 412 }, 413 414 updateDates = function(el, opts) 415 { 416 var days = el.querySelectorAll('.lightpick__day'); 417 [].forEach.call(days, function(day) { 418 day.outerHTML = renderDay(opts, parseInt(day.getAttribute('data-time')), false, day.className.split(' ')); 419 }); 420 421 checkDisabledDatesInRange(el, opts); 422 }, 423 424 checkDisabledDatesInRange = function(el, opts) 425 { 426 if (opts.disabledDatesInRange || !opts.startDate || opts.endDate || !opts.disableDates) return; 427 428 var days = el.querySelectorAll('.lightpick__day'), 429 disabledArray = opts.disableDates.map(function(entry){ 430 return entry instanceof Array || Object.prototype.toString.call(entry) === '[object Array]' ? entry[0] : entry; 431 }), 432 closestPrev = moment(disabledArray.filter(function(d) { 433 return moment(d).isBefore(opts.startDate); 434 }).sort(function(a,b){ 435 return moment(b).isAfter(moment(a)); 436 })[0]), 437 closestNext = moment(disabledArray.filter(function(d) { 438 return moment(d).isAfter(opts.startDate); 439 }).sort(function(a,b){ 440 return moment(a).isAfter(moment(b)); 441 })[0]); 442 443 [].forEach.call(days, function(dayCell) { 444 var day = moment(parseInt(dayCell.getAttribute('data-time'))); 445 if ( 446 (closestPrev && day.isBefore(closestPrev) && opts.startDate.isAfter(closestPrev)) 447 || (closestNext && day.isAfter(closestNext) && closestNext.isAfter(opts.startDate)) 448 ) { 449 dayCell.classList.remove('is-available'); 450 dayCell.classList.add('is-disabled'); 451 } 452 }); 453 }, 454 455 Lightpick = function(options) 456 { 457 var self = this, 458 opts = self.config(options); 459 460 self.el = document.createElement('section'); 461 462 self.el.className = 'lightpick lightpick--' + opts.numberOfColumns + '-columns is-hidden'; 463 464 if (opts.inline) { 465 self.el.className += ' lightpick--inlined'; 466 } 467 468 var html = '<div class="lightpick__inner">' 469 + (opts.numberOfMonths > 1 ? renderTopButtons(opts, 'days') : '') 470 + '<div class="lightpick__months"></div>' 471 + '<div class="lightpick__tooltip" style="visibility: hidden"></div>'; 472 473 if (opts.footer) { 474 html += '<div class="lightpick__footer">'; 475 if (opts.footer === true) { 476 html += '<button type="button" class="lightpick__reset-action">' + opts.locale.buttons.reset + '</button>'; 477 html += '<div class="lightpick__footer-message"></div>'; 478 html += '<button type="button" class="lightpick__apply-action">' + opts.locale.buttons.apply + '</button>'; 479 } 480 else { 481 html += opts.footer; 482 } 483 html += '</div>'; 484 } 485 486 html += '</div>'; 487 488 self.el.innerHTML = html; 489 490 491 if (opts.parentEl instanceof Node) { 492 opts.parentEl.appendChild(self.el) 493 } 494 else if (opts.parentEl === 'body' && opts.inline) { 495 opts.field.parentNode.appendChild(self.el); 496 } 497 else { 498 document.querySelector(opts.parentEl).appendChild(self.el); 499 } 500 501 self._onMouseDown = function(e) 502 { 503 if (!self.isShowing) { 504 return; 505 } 506 507 e = e || window.event; 508 var target = e.target || e.srcElement; 509 if (!target) { 510 return; 511 } 512 513 e.stopPropagation(); 514 515 if (!target.classList.contains('lightpick__select')) { 516 e.preventDefault(); 517 } 518 519 var opts = self._opts; 520 521 if (target.classList.contains('lightpick__day') && target.classList.contains('is-available')) { 522 523 var day = moment(parseInt(target.getAttribute('data-time'))); 524 525 if (!opts.disabledDatesInRange && opts.disableDates && opts.startDate) { 526 var start = day.isAfter(opts.startDate) ? moment(opts.startDate) : moment(day), 527 end = day.isAfter(opts.startDate) ? moment(day) : moment(opts.startDate), 528 529 isInvalidRange = opts.disableDates.filter(function(d) { 530 if (d instanceof Array || Object.prototype.toString.call(d) === '[object Array]') { 531 var _from = moment(d[0]), 532 _to = moment(d[1]); 533 534 return _from.isValid() && _to.isValid() && (_from.isBetween(start, end, 'day', '[]') || _to.isBetween(start, end, 'day', '[]')); 535 } 536 537 return moment(d).isBetween(start, end, 'day', '[]'); 538 }); 539 540 if (isInvalidRange.length) { 541 self.setStartDate(null); 542 self.setEndDate(null); 543 544 target.dispatchEvent(new Event('mousedown')); 545 self.el.querySelector('.lightpick__tooltip').style.visibility = 'hidden'; 546 547 updateDates(self.el, opts); 548 return; 549 } 550 } 551 552 if (opts.singleDate || (!opts.startDate && !opts.endDate) || (opts.startDate && opts.endDate)) { 553 if (opts.repick && opts.startDate && opts.endDate) { 554 if (opts.repickTrigger === opts.field) { 555 self.setStartDate(day); 556 target.classList.add('is-start-date'); 557 } 558 else { 559 self.setEndDate(day); 560 target.classList.add('is-end-date'); 561 } 562 563 if (opts.startDate.isAfter(opts.endDate)) { 564 self.swapDate(); 565 } 566 567 if (opts.autoclose) { 568 setTimeout(function() { 569 self.hide(); 570 }, 100); 571 } 572 } 573 else { 574 self.setStartDate(day); 575 self.setEndDate(null); 576 577 target.classList.add('is-start-date'); 578 579 if (opts.singleDate && opts.autoclose) { 580 setTimeout(function() { 581 self.hide(); 582 }, 100); 583 } 584 else if (!opts.singleDate || opts.inline || !opts.autoclose) { 585 updateDates(self.el, opts); 586 } 587 } 588 } 589 else if (opts.startDate && !opts.endDate) { 590 self.setEndDate(day); 591 592 if (opts.startDate.isAfter(opts.endDate)) { 593 self.swapDate(); 594 } 595 596 target.classList.add('is-end-date'); 597 598 599 if (opts.autoclose) { 600 setTimeout(function() { 601 self.hide(); 602 }, 100); 603 } 604 else { 605 updateDates(self.el, opts); 606 } 607 } 608 609 if (!opts.disabledDatesInRange) { 610 if (self.el.querySelectorAll('.lightpick__day.is-available').length === 0) { 611 self.setStartDate(null); 612 updateDates(self.el, opts); 613 614 if (opts.footer) { 615 if (typeof self._opts.onError === 'function') { 616 self._opts.onError.call(self, 'Invalid range'); 617 } 618 else { 619 var footerMessage = self.el.querySelector('.lightpick__footer-message'); 620 621 if (footerMessage) { 622 footerMessage.innerHTML = opts.locale.not_allowed_range; 623 624 setTimeout(function(){ 625 footerMessage.innerHTML = ''; 626 }, 3000); 627 } 628 } 629 } 630 } 631 } 632 } 633 else if (target.classList.contains('lightpick__previous-action')) { 634 self.prevMonth(); 635 } 636 else if (target.classList.contains('lightpick__next-action')) { 637 self.nextMonth(); 638 } 639 else if (target.classList.contains('lightpick__close-action') || target.classList.contains('lightpick__apply-action')) { 640 self.hide(); 641 } 642 else if (target.classList.contains('lightpick__reset-action')) { 643 self.reset(); 644 } 645 }; 646 self._onMouseEnter = function(e) 647 { 648 if (!self.isShowing) { 649 return; 650 } 651 652 e = e || window.event; 653 var target = e.target || e.srcElement; 654 if (!target) { 655 return; 656 } 657 658 var opts = self._opts; 659 660 if (target.classList.contains('lightpick__day') && target.classList.contains('disabled-tooltip') && opts.locale.tooltipOnDisabled) { 661 self.showTooltip(target, opts.locale.tooltipOnDisabled); 662 return; 663 } 664 else { 665 self.hideTooltip(); 666 } 667 668 if (opts.singleDate || (!opts.startDate && !opts.endDate)) { 669 return; 670 } 671 672 if (!target.classList.contains('lightpick__day') && !target.classList.contains('is-available')) { 673 return; 674 } 675 676 if ((opts.startDate && !opts.endDate) || opts.repick) { 677 var hoverDate = moment(parseInt(target.getAttribute('data-time'))); 678 679 if (!hoverDate.isValid()) { 680 return; 681 } 682 683 var startDate = (opts.startDate && !opts.endDate) || (opts.repick && opts.repickTrigger === opts.secondField) ? opts.startDate : opts.endDate; 684 685 var days = self.el.querySelectorAll('.lightpick__day'); 686 [].forEach.call(days, function(day) { 687 var dt = moment(parseInt(day.getAttribute('data-time'))); 688 689 day.classList.remove('is-flipped'); 690 691 if (dt.isValid() && dt.isSameOrAfter(startDate, 'day') && dt.isSameOrBefore(hoverDate, 'day')) { 692 day.classList.add('is-in-range'); 693 694 if (opts.repickTrigger === opts.field && dt.isSameOrAfter(opts.endDate)) { 695 day.classList.add('is-flipped'); 696 } 697 } 698 else if (dt.isValid() && dt.isSameOrAfter(hoverDate, 'day') && dt.isSameOrBefore(startDate, 'day')) { 699 day.classList.add('is-in-range'); 700 701 if (((opts.startDate && !opts.endDate) || opts.repickTrigger === opts.secondField) && dt.isSameOrBefore(opts.startDate)) { 702 day.classList.add('is-flipped'); 703 } 704 } 705 else { 706 day.classList.remove('is-in-range'); 707 } 708 709 if (opts.startDate && opts.endDate && opts.repick && opts.repickTrigger === opts.field) { 710 day.classList.remove('is-start-date'); 711 } 712 else { 713 day.classList.remove('is-end-date'); 714 } 715 }); 716 717 if (opts.hoveringTooltip) { 718 days = Math.abs(hoverDate.isAfter(startDate) ? hoverDate.diff(startDate, 'day') : startDate.diff(hoverDate, 'day')); 719 720 if (!opts.tooltipNights) { 721 days += 1; 722 } 723 724 var tooltip = self.el.querySelector('.lightpick__tooltip'); 725 726 if (days > 0 && !target.classList.contains('is-disabled')) { 727 728 var pluralText = ''; 729 if (typeof opts.locale.pluralize === 'function') { 730 pluralText = opts.locale.pluralize.call(self, days, opts.locale.tooltip); 731 } 732 733 self.showTooltip(target, days + ' ' + pluralText); 734 } 735 else { 736 self.hideTooltip(); 737 } 738 } 739 740 if (opts.startDate && opts.endDate && opts.repick && opts.repickTrigger === opts.field) { 741 target.classList.add('is-start-date'); 742 } 743 else { 744 target.classList.add('is-end-date'); 745 } 746 } 747 }; 748 self._onChange = function(e) 749 { 750 e = e || window.event; 751 var target = e.target || e.srcElement; 752 if (!target) { 753 return; 754 } 755 756 if (target.classList.contains('lightpick__select-months')) { 757 if (typeof self._opts.onMonthsChange === 'function') { 758 self._opts.onMonthsChange.call(this, target.value); 759 } 760 761 self.gotoMonth(target.value); 762 } 763 else if (target.classList.contains('lightpick__select-years')) { 764 if (typeof self._opts.onYearsChange === 'function') { 765 self._opts.onYearsChange.call(this, target.value); 766 } 767 768 self.gotoYear(target.value); 769 } 770 }; 771 772 self._onInputChange = function(e) 773 { 774 var target = e.target || e.srcElement; 775 776 if (self._opts.singleDate) { 777 if (!self._opts.autoclose) { 778 self.gotoDate(opts.field.value); 779 } 780 } 781 782 self.syncFields(); 783 784 if (!self.isShowing) { 785 self.show(); 786 } 787 }; 788 789 self._onInputFocus = function(e) 790 { 791 var target = e.target || e.srcElement; 792 793 self.show(target); 794 }; 795 796 self._onInputClick = function(e) 797 { 798 var target = e.target || e.srcElement; 799 800 self.show(target); 801 }; 802 803 self._onClick = function(e) 804 { 805 e = e || window.event; 806 var target = e.target || e.srcElement, 807 parentEl = target; 808 809 if (!target) { 810 return; 811 } 812 813 do { 814 if ((parentEl.classList && parentEl.classList.contains('lightpick')) || parentEl === opts.field || (opts.secondField && parentEl === opts.secondField)) { 815 return; 816 } 817 } 818 while ((parentEl = parentEl.parentNode)); 819 820 if (self.isShowing && opts.hideOnBodyClick && target !== opts.field && parentEl !== opts.field) { 821 self.hide(); 822 } 823 }; 824 825 self.showTooltip = function(target, text) 826 { 827 var tooltip = self.el.querySelector('.lightpick__tooltip'); 828 829 var hasParentEl = self.el.classList.contains('lightpick--inlined'), 830 dayBounding = target.getBoundingClientRect(), 831 pickerBouding = hasParentEl ? self.el.parentNode.getBoundingClientRect() : self.el.getBoundingClientRect(), 832 _left = (dayBounding.left - pickerBouding.left) + (dayBounding.width / 2), 833 _top = dayBounding.top - pickerBouding.top; 834 835 tooltip.style.visibility = 'visible'; 836 tooltip.textContent = text; 837 838 var tooltipBounding = tooltip.getBoundingClientRect(); 839 840 _top -= tooltipBounding.height; 841 _left -= (tooltipBounding.width / 2); 842 843 setTimeout(function(){ 844 tooltip.style.top = _top + 'px'; 845 tooltip.style.left = _left + 'px'; 846 }, 10); 847 }; 848 849 self.hideTooltip = function() 850 { 851 var tooltip = self.el.querySelector('.lightpick__tooltip'); 852 tooltip.style.visibility = 'hidden'; 853 }; 854 855 self.el.addEventListener('mousedown', self._onMouseDown, true); 856 self.el.addEventListener('mouseenter', self._onMouseEnter, true); 857 self.el.addEventListener('touchend', self._onMouseDown, true); 858 self.el.addEventListener('change', self._onChange, true); 859 860 if (opts.inline) { 861 self.show(); 862 } 863 else { 864 self.hide(); 865 } 866 867 opts.field.addEventListener('change', self._onInputChange); 868 opts.field.addEventListener('click', self._onInputClick); 869 opts.field.addEventListener('focus', self._onInputFocus); 870 871 if (opts.secondField) { 872 opts.secondField.addEventListener('change', self._onInputChange); 873 opts.secondField.addEventListener('click', self._onInputClick); 874 opts.secondField.addEventListener('focus', self._onInputFocus); 875 } 876 }; 877 878 Lightpick.prototype = { 879 config: function(options) 880 { 881 var opts = Object.assign({}, defaults, options); 882 883 opts.field = (opts.field && opts.field.nodeName) ? opts.field : null; 884 885 opts.calendar = [moment().set('date', 1)]; 886 887 if (opts.numberOfMonths === 1 && opts.numberOfColumns > 1) { 888 opts.numberOfColumns = 1; 889 } 890 891 opts.minDate = opts.minDate && moment(opts.minDate, opts.format).isValid() ? moment(opts.minDate, opts.format) : null; 892 893 opts.maxDate = opts.maxDate && moment(opts.maxDate, opts.format).isValid() ? moment(opts.maxDate, opts.format) : null; 894 895 if (opts.lang === 'auto') { 896 var browserLang = navigator.language || navigator.userLanguage; 897 if (browserLang) { 898 opts.lang = browserLang; 899 } 900 else { 901 opts.lang = 'en-US'; 902 } 903 } 904 905 if (opts.secondField && opts.singleDate) { 906 opts.singleDate = false; 907 } 908 909 if (opts.hoveringTooltip && opts.singleDate) { 910 opts.hoveringTooltip = false; 911 } 912 913 if (Object.prototype.toString.call(options.locale) === '[object Object]') { 914 opts.locale = Object.assign({}, defaults.locale, options.locale); 915 } 916 917 if (window.innerWidth < 480 && opts.numberOfMonths > 1) { 918 opts.numberOfMonths = 1; 919 opts.numberOfColumns = 1; 920 } 921 922 if (opts.repick && !opts.secondField) { 923 opts.repick = false; 924 } 925 926 if (opts.inline) { 927 opts.autoclose = false; 928 opts.hideOnBodyClick = false; 929 } 930 931 this._opts = Object.assign({}, opts); 932 933 this.syncFields(); 934 935 this.setStartDate(this._opts.startDate, true); 936 this.setEndDate(this._opts.endDate, true); 937 938 return this._opts; 939 }, 940 941 syncFields: function() 942 { 943 if (this._opts.singleDate || this._opts.secondField) { 944 if (moment(this._opts.field.value, this._opts.format).isValid()) { 945 this._opts.startDate = moment(this._opts.field.value, this._opts.format); 946 } 947 948 if (this._opts.secondField && moment(this._opts.secondField.value, this._opts.format).isValid()) { 949 this._opts.endDate = moment(this._opts.secondField.value, this._opts.format); 950 } 951 } 952 else { 953 var dates = this._opts.field.value.split(this._opts.separator); 954 955 if (dates.length === 2) { 956 if (moment(dates[0], this._opts.format).isValid()) { 957 this._opts.startDate = moment(dates[0], this._opts.format); 958 } 959 960 if (moment(dates[1], this._opts.format).isValid()) { 961 this._opts.endDate = moment(dates[1], this._opts.format); 962 } 963 } 964 } 965 }, 966 967 swapDate: function() 968 { 969 var tmp = moment(this._opts.startDate); 970 this.setDateRange(this._opts.endDate, tmp); 971 }, 972 973 gotoToday: function() 974 { 975 this.gotoDate(new Date()); 976 }, 977 978 gotoDate: function(date) 979 { 980 var date = moment(date, this._opts.format); 981 982 if (!date.isValid()) { 983 date = moment(); 984 } 985 986 date.set('date', 1); 987 988 this._opts.calendar = [moment(date)]; 989 990 renderCalendar(this.el, this._opts); 991 }, 992 993 gotoMonth: function(month) 994 { 995 if (isNaN(month)) { 996 return; 997 } 998 999 this._opts.calendar[0].set('month', month); 1000 1001 renderCalendar(this.el, this._opts); 1002 }, 1003 1004 gotoYear: function(year) 1005 { 1006 if (isNaN(year)) { 1007 return; 1008 } 1009 1010 this._opts.calendar[0].set('year', year); 1011 1012 renderCalendar(this.el, this._opts); 1013 }, 1014 1015 prevMonth: function() 1016 { 1017 this._opts.calendar[0] = moment(this._opts.calendar[0]).subtract(this._opts.numberOfMonths, 'month'); 1018 1019 renderCalendar(this.el, this._opts); 1020 1021 checkDisabledDatesInRange(this.el, this._opts); 1022 }, 1023 1024 nextMonth: function() 1025 { 1026 this._opts.calendar[0] = moment(this._opts.calendar[1]); 1027 1028 renderCalendar(this.el, this._opts); 1029 1030 checkDisabledDatesInRange(this.el, this._opts); 1031 }, 1032 1033 updatePosition: function() 1034 { 1035 if (this.el.classList.contains('lightpick--inlined')) return; 1036 1037 // remove `is-hidden` class for getBoundingClientRect 1038 this.el.classList.remove('is-hidden'); 1039 1040 var rect = this._opts.field.getBoundingClientRect(), 1041 calRect = this.el.getBoundingClientRect(), 1042 orientation = this._opts.orientation.split(' '), 1043 top = 0, 1044 left = 0; 1045 1046 if (orientation[0] == 'auto' || !(/top|bottom/.test(orientation[0]))) { 1047 if (rect.bottom + calRect.height > window.innerHeight && window.pageYOffset > calRect.height) { 1048 top = (rect.top + window.pageYOffset) - calRect.height; 1049 } 1050 else { 1051 top = rect.bottom + window.pageYOffset; 1052 } 1053 } 1054 else { 1055 top = rect[orientation[0]] + window.pageYOffset; 1056 1057 if (orientation[0] == 'top') { 1058 top -= calRect.height; 1059 } 1060 } 1061 1062 if (!(/left|right/.test(orientation[0])) && (!orientation[1] || orientation[1] == 'auto' || !(/left|right/.test(orientation[1])))) { 1063 if (rect.left + calRect.width > window.innerWidth) { 1064 left = (rect.right + window.pageXOffset) - calRect.width; 1065 } 1066 else { 1067 left = rect.left + window.pageXOffset; 1068 } 1069 } 1070 else { 1071 if (/left|right/.test(orientation[0])) { 1072 left = rect[orientation[0]] + window.pageXOffset; 1073 } 1074 else { 1075 left = rect[orientation[1]] + window.pageXOffset; 1076 } 1077 1078 if (orientation[0] == 'right' || orientation[1] == 'right') { 1079 left -= calRect.width; 1080 } 1081 } 1082 1083 this.el.classList.add('is-hidden'); 1084 1085 this.el.style.top = top + 'px'; 1086 this.el.style.left = left + 'px'; 1087 }, 1088 1089 setStartDate: function(date, preventOnSelect) 1090 { 1091 var dateISO = moment(date, moment.ISO_8601), 1092 dateOptFormat = moment(date, this._opts.format); 1093 1094 if (!dateISO.isValid() && !dateOptFormat.isValid()) { 1095 this._opts.startDate = null; 1096 this._opts.field.value = ''; 1097 return; 1098 } 1099 1100 this._opts.startDate = moment(dateISO.isValid() ? dateISO : dateOptFormat); 1101 1102 if (this._opts.singleDate || this._opts.secondField) { 1103 this._opts.field.value = this._opts.startDate.format(this._opts.format); 1104 } 1105 else { 1106 this._opts.field.value = this._opts.startDate.format(this._opts.format) + this._opts.separator + '...' 1107 } 1108 1109 if (!preventOnSelect && typeof this._opts.onSelect === 'function') {
1110 this._opts.onSelect.call(this, this.getStartDate(), this.getEndDate()); 1111 } 1112 1113 if (!preventOnSelect && !this._opts.singleDate && typeof this._opts.onSelectStart === 'function') { 1114 this._opts.onSelectStart.call(this, this.getStartDate()); 1115 } 1116 }, 1117 1118 setEndDate: function(date, preventOnSelect) 1119 { 1120 var dateISO = moment(date, moment.ISO_8601), 1121 dateOptFormat = moment(date, this._opts.format); 1122 1123 if (!dateISO.isValid() && !dateOptFormat.isValid()) { 1124 this._opts.endDate = null; 1125 1126 if (this._opts.secondField) { 1127 this._opts.secondField.value = ''; 1128 } 1129 else if (!this._opts.singleDate && this._opts.startDate) { 1130 this._opts.field.value = this._opts.startDate.format(this._opts.format) + this._opts.separator + '...' 1131 } 1132 return; 1133 } 1134 1135 this._opts.endDate = moment(dateISO.isValid() ? dateISO : dateOptFormat); 1136 1137 if (this._opts.secondField) { 1138 this._opts.field.value = this._opts.startDate.format(this._opts.format); 1139 this._opts.secondField.value = this._opts.endDate.format(this._opts.format); 1140 } 1141 else { 1142 this._opts.field.value = this._opts.startDate.format(this._opts.format) + this._opts.separator + this._opts.endDate.format(this._opts.format); 1143 } 1144 1145 if (!preventOnSelect && typeof this._opts.onSelect === 'function') { 1146 this._opts.onSelect.call(this, this.getStartDate(), this.getEndDate()); 1147 } 1148 1149 if (!preventOnSelect && !this._opts.singleDate && typeof this._opts.onSelectEnd === 'function') { 1150 this._opts.onSelectEnd.call(this, this.getEndDate()); 1151 } 1152 }, 1153 1154 setDate: function(date, preventOnSelect) 1155 { 1156 if (!this._opts.singleDate) { 1157 return; 1158 } 1159 this.setStartDate(date, preventOnSelect); 1160 1161 if (this.isShowing) { 1162 updateDates(this.el, this._opts); 1163 } 1164 }, 1165 1166 setDateRange: function(start, end, preventOnSelect) 1167 { 1168 if (this._opts.singleDate) { 1169 return; 1170 } 1171 this.setStartDate(start, true); 1172 this.setEndDate(end, true); 1173 1174 if (this.isShowing) { 1175 updateDates(this.el, this._opts); 1176 } 1177 1178 if (!preventOnSelect && typeof this._opts.onSelect === 'function') { 1179 this._opts.onSelect.call(this, this.getStartDate(), this.getEndDate()); 1180 } 1181 }, 1182 1183 setDisableDates: function(dates) 1184 { 1185 this._opts.disableDates = dates; 1186 1187 if (this.isShowing) { 1188 updateDates(this.el, this._opts); 1189 } 1190 }, 1191 1192 getStartDate: function() 1193 { 1194 return moment(this._opts.startDate).isValid() ? this._opts.startDate.clone() : null; 1195 }, 1196 1197 getEndDate: function() 1198 { 1199 return moment(this._opts.endDate).isValid() ? this._opts.endDate.clone() : null; 1200 }, 1201 1202 getDate: function() 1203 { 1204 return moment(this._opts.startDate).isValid() ? this._opts.startDate.clone() : null; 1205 }, 1206 1207 toString: function(format) 1208 { 1209 if (this._opts.singleDate) { 1210 return moment(this._opts.startDate).isValid() ? this._opts.startDate.format(format) : ''; 1211 } 1212 1213 if (moment(this._opts.startDate).isValid() && moment(this._opts.endDate).isValid()) { 1214 return this._opts.startDate.format(format) + this._opts.separator + this._opts.endDate.format(format); 1215 } 1216 1217 if (moment(this._opts.startDate).isValid() && !moment(this._opts.endDate).isValid()) { 1218 return this._opts.startDate.format(format) + this._opts.separator + '...'; 1219 } 1220 1221 if (!moment(this._opts.startDate).isValid() && moment(this._opts.endDate).isValid()) { 1222 return '...' + this._opts.separator + this._opts.endDate.format(format); 1223 } 1224 1225 return ''; 1226 }, 1227 1228 show: function(target) 1229 { 1230 if (!this.isShowing) { 1231 this.isShowing = true; 1232 1233 if (this._opts.repick) { 1234 this._opts.repickTrigger = target; 1235 } 1236 1237 this.syncFields(); 1238 1239 if (this._opts.secondField && this._opts.secondField === target && this._opts.endDate) { 1240 this.gotoDate(this._opts.endDate); 1241 } 1242 else { 1243 this.gotoDate(this._opts.startDate); 1244 } 1245 1246 document.addEventListener('click', this._onClick); 1247 1248 this.updatePosition(); 1249 1250 this.el.classList.remove('is-hidden'); 1251 1252 if (typeof this._opts.onOpen === 'function') { 1253 this._opts.onOpen.call(this); 1254 } 1255 1256 if (document.activeElement && document.activeElement != document.body) { 1257 document.activeElement.blur(); 1258 } 1259 } 1260 }, 1261 1262 hide: function() 1263 { 1264 if (this.isShowing) { 1265 this.isShowing = false;
1266 1267 document.removeEventListener('click', this._onClick); 1268 1269 this.el.classList.add('is-hidden'); 1270 1271 this.el.querySelector('.lightpick__tooltip').style.visibility = 'hidden'; 1272 1273 if (typeof this._opts.onClose === 'function') { 1274 this._opts.onClose.call(this); 1275 } 1276 } 1277 }, 1278 1279 destroy: function() 1280 { 1281 var opts = this._opts; 1282 1283 this.hide(); 1284 1285 this.el.removeEventListener('mousedown', self._onMouseDown, true); 1286 this.el.removeEventListener('mouseenter', self._onMouseEnter, true); 1287 this.el.removeEventListener('touchend', self._onMouseDown, true); 1288 this.el.removeEventListener('change', self._onChange, true); 1289 1290 opts.field.removeEventListener('change', this._onInputChange); 1291 opts.field.removeEventListener('click', this._onInputClick); 1292 opts.field.removeEventListener('focus', this._onInputFocus); 1293 1294 if (opts.secondField) { 1295 opts.secondField.removeEventListener('change', this._onInputChange); 1296 opts.secondField.removeEventListener('click', this._onInputClick); 1297 opts.secondField.removeEventListener('focus', this._onInputFocus); 1298 } 1299 1300 if (this.el.parentNode) { 1301 this.el.parentNode.removeChild(this.el); 1302 } 1303 }, 1304 1305 reset: function() 1306 { 1307 this.setStartDate(null, true); 1308 this.setEndDate(null, true); 1309 1310 updateDates(this.el, this._opts); 1311 1312 if (typeof this._opts.onSelect === 'function') { 1313 this._opts.onSelect.call(this, this.getStartDate(), this.getEndDate()); 1314 } 1315 1316 this.el.querySelector('.lightpick__tooltip').style.visibility = 'hidden'; 1317 }, 1318 1319 reloadOptions: function(options) 1320 { 1321 var dropdowns = this._opts.dropdowns; 1322 var locale = this._opts.locale; 1323 1324 Object.assign(this._opts, this._opts, options); 1325 Object.assign(this._opts.dropdowns, dropdowns, options.dropdowns); 1326 Object.assign(this._opts.locale, locale, options.locale); 1327 } 1328 1329 }; 1330 1331 return Lightpick; 1332})); 1333 1334 1335 1336 1337document.addEventListener("DOMContentLoaded", () => { 1338 const root = document.querySelector(".find-chamber"); 1339 if (!root) return; 1340 1341 const select = root.querySelector("#establishment-select"); 1342 const container = root.querySelector(".establishments"); 1343 const items = container ? Array.from(container.getElementsByClassName("single")) : []; 1344 1345 const setTabIndex = (el, v) => { 1346 const nodes = el.querySelectorAll('a[href],button'); 1347 for (let i = 0; i < nodes.length; i++) nodes[i].tabIndex = v; 1348 }; 1349 1350 if (select && container && items.length) { 1351 let max = 0; 1352 1353 for (let i = 0; i < items.length; i++) { 1354 const h = items[i].offsetHeight; 1355 if (h > max) max = h; 1356 } 1357 1358 container.style.maxHeight = max + "px"; 1359 1360 for (let i = 0; i < items.length; i++) { 1361 items[i].style.minHeight = max + "px"; 1362 if (i) setTabIndex(items[i], -1); 1363 } 1364 1365 select.addEventListener("change", e => { 1366 const id = e.target.value; 1367 const el = container.querySelector("#" + id); 1368 if (!el) return; 1369 1370 for (let i = 0; i < items.length; i++) setTabIndex(items[i], -1); 1371 setTabIndex(el, 0); 1372 1373 container.scrollTop = el.offsetTop - container.offsetTop; 1374 }); 1375 } 1376 1377 const groups = root.querySelectorAll(".map svg g"); 1378 if (groups.length && select) { 1379 const evt = new Event("change"); 1380 for (let i = 0; i < groups.length; i++) { 1381 groups[i].addEventListener("click", e => { 1382 select.value = e.currentTarget.getAttribute("data-id"); 1383 select.dispatchEvent(evt); 1384 }); 1385 } 1386 } 1387}); 1388 1389const style = ""; 1390document.addEventListener("DOMContentLoaded", function() { 1391 document.querySelector("body"); 1392 function bodyMenuOpen(open) { 1393 if (open) { 1394 const scrollTopPosition = document.documentElement.scrollTop || document.body.scrollTop; 1395 window.onscroll = function(event) { 1396 window.scrollTo({ 1397 top: scrollTopPosition, 1398 behavior: "instant" 1399 }); 1400 }; 1401 } else { 1402 window.onscroll = function(event) { 1403 }; 1404 } 1405 } 1406 const isMobile = window.innerWidth <= 767; 1407 const alertsBanner = document.querySelector(".alerts"); 1408 const rightLinks = document.querySelector(".right-links"); 1409 const headerEvent = document.querySelector(".header-event"); 1410 if (rightLinks) { 1411 window.addEventListener("scroll", function() { 1412 const header = document.querySelector("header"); 1413 const btnMenu2 = document.querySelector("header .btn-menu"); 1414 if (window.pageYOffset > 350 && btnMenu2 && !btnMenu2.classList.contains("active")) { 1415 header.classList.add("sticky"); 1416 if (!isMobile) { 1417 if (document.querySelector(".main-header2")) { 1418 rightLinks.style.top = "215px"; 1419 } else { 1420 rightLinks.style.top = "175px"; 1421 } 1422 } 1423 } else { 1424 if (!isMobile) { 1425 if (document.querySelector(".alerts")) { 1426 rightLinks.style.top = "375px"; 1427 } else { 1428 if (document.querySelector(".main-header2")) { 1429 rightLinks.style.top = "215px"; 1430 } else { 1431 rightLinks.style.top = "175px"; 1432 } 1433 } 1434 } 1435 } 1436 }); 1437 } 1438 const event_page = document.querySelector("body.event_page"); 1439 if (event_page) { 1440 window.addEventListener("scroll", function() { 1441 const header = event_page.querySelector("header"); 1442 if (window.pageYOffset > 350) { 1443 header.classList.add("sticky"); 1444 } 1445 }); 1446 } 1447 const submenu = document.querySelector("header .submenu"); 1448 document.querySelectorAll("header .submenu button[tabindex]:not
1448(.child-mega-menu button[tabindex]), header .submenu input[tabindex]:not(.child-mega-menu input[tabindex]), header .submenu a[tabindex]:not(.child-mega-menu a[tabindex])"); 1449 if (!isMobile && submenu) { 1450 const lastSubMenu = submenu.querySelectorAll(".list-mega-menu .child-mega-menu"); 1451 let heightSubMenu = "fit-content"; 1452 lastSubMenu.forEach(function(item) { 1453 const clientHeight = item.clientHeight; 1454 if (clientHeight > 0 && clientHeight > parseFloat(heightSubMenu) || heightSubMenu === "fit-content") { 1455 heightSubMenu = clientHeight.toString() + "px"; 1456 } 1457 }); 1458 submenu.style.height = heightSubMenu; 1459 lastSubMenu.forEach(function(item) { 1460 item.style.minHeight = heightSubMenu; 1461 }); 1462 } 1463 function enableTabIndex(submenuSelector) { 1464 const firstLVLTabIndex = document.querySelectorAll(`header ${submenuSelector} button[tabindex]:not(.child-mega-menu button[tabindex]), header ${submenuSelector} input[tabindex]:not(.child-mega-menu input[tabindex]), header ${submenuSelector} a[tabindex]:not(.child-mega-menu a[tabindex])`); 1465 firstLVLTabIndex.forEach(function(element) { 1466 element.setAttribute("tabindex", "0"); 1467 }); 1468 } 1469 function disableTabIndex(submenuSelector) { 1470 const firstLVLTabIndex = document.querySelectorAll(`header ${submenuSelector} button[tabindex]:not(.child-mega-menu button[tabindex]), header ${submenuSelector} input[tabindex]:not(.child-mega-menu input[tabindex]), header ${submenuSelector} a[tabindex]`); 1471 firstLVLTabIndex.forEach(function(element) { 1472 element.setAttribute("tabindex", "-1"); 1473 }); 1474 } 1475 function closeChildMenu(submenuSelector, closeByIcon = false) { 1476 const current = document.querySelector(`header ${submenuSelector}`); 1477 const activeChildMenus = document.querySelectorAll(`header ${submenuSelector} .list-mega-menu .child-mega-menu.active`); 1478 activeChildMenus.forEach(function(childMenu) { 1479 if (isMobile) { 1480 childMenu.style.height = "0"; 1481 } else { 1482 childMenu.style.transform = "translateX(1000%)"; 1483 } 1484 }); 1485 const childMenus2 = document.querySelectorAll(`header ${submenuSelector} .list-mega-menu .child-mega-menu`); 1486 const childMenusResponsive2 = document.querySelectorAll(`header ul.submenu-responsive li.item a`); 1487 document.querySelector("header .submenu2 .sub-header"); 1488 let listChild2 = []; 1489 if (childMenus2) { 1490 listChild2.push(...childMenus2); 1491 } 1492 if (childMenusResponsive2) { 1493 listChild2.push(...childMenusResponsive2); 1494 } 1495 listChild2.forEach(function(child) { 1496 if (child) { 1497 child.classList.remove("active"); 1498 } 1499 }); 1500 if (current && closeByIcon) { 1501 current.style.transform = "translateX(200%)"; 1502 } 1503 } 1504 const btnMenu = document.querySelector("header .btn-menu"); 1505 if (btnMenu) { 1506 btnMenu.addEventListener("click", function(e) { 1507 this.classList.toggle("active"); 1508 const stateExpanded = this.getAttribute("aria-expanded"); 1509 const isExpanded = stateExpanded === "true"; 1510 this.setAttribute("aria-expanded", !isExpanded); 1511 if (this.classList.contains("active")) { 1512 if (submenu) { 1513 submenu.style.transform = "translateX(0)"; 1514 submenu.style.right = "0"; 1515 } 1516 enableTabIndex(".submenu"); 1517 } else { 1518 if (submenu) { 1519 submenu.style.transform = "translateX(100%)"; 1520 } 1521 disableTabIndex(".submenu"); 1522 closeChildMenu(".submenu"); 1523 const menuItems3 = document.querySelectorAll("header .submenu .list-mega-menu .item"); 1524 menuItems3.forEach(function(menuItem) { 1525 menuItem.classList.remove("active"); 1526 }); 1527 } 1528 }); 1529 } 1530 const btnCloseMenu = document.querySelector("header .btn-close-menu"); 1531 if (btnCloseMenu) { 1532 btnCloseMenu.addEventListener("click", function(e) { 1533 if (btnMenu) { 1534 btnMenu.classList.remove("active"); 1535 } 1536 if (submenu) { 1537 submenu.style.transform = "translateX(100%)"; 1538 } 1539 disableTabIndex(); 1540 closeChildMenu(".submenu"); 1541 const menuItems3 = document.querySelectorAll("header .submenu .list-mega-menu .item"); 1542 menuItems3.forEach(function(menuItem) { 1543 menuItem.classList.remove("active"); 1544 }); 1545 }); 1546 } 1547 const menuItems = document.querySelectorAll("header .submenu .list-mega-menu .item"); 1548 if (menuItems) {
1549 menuItems.forEach(function(menuItem) { 1550 menuItem.addEventListener("click", function(e) { 1551 closeChildMenu(".submenu"); 1552 const childId = this.getAttribute("data-target-child"); 1553 const child = document.querySelector("header .submenu .list-mega-menu .child-mega-menu#" + childId); 1554 const isThisActive = this.classList.contains("active"); 1555 const isChildActive = child.classList.contains("active"); 1556 if (isThisActive !== isChildActive || !isThisActive && !isChildActive) { 1557 this.classList.toggle("active"); 1558 child.classList.toggle("active"); 1559 } 1560 if (this.classList.contains("active")) { 1561 this.setAttribute("aria-expanded", "true"); 1562 const otherMenuItems = document.querySelectorAll('header .submenu .list-mega-menu .item:not([data-target-child="' + childId + '"])'); 1563 otherMenuItems.forEach(function(item) { 1564 item.classList.remove("active"); 1565 const elementsWithTabIndex = item.querySelectorAll("[tabindex]"); 1566 elementsWithTabIndex.forEach(function(element) { 1567 if (element.getAttribute("tabindex") !== "-1") { 1568 element.setAttribute("tabindex", "-1"); 1569 } 1570 }); 1571 }); 1572 const itemsChildActive = child.querySelectorAll("[tabindex]"); 1573 itemsChildActive.forEach(function(element) { 1574 if (element.getAttribute("tabindex") !== "0") { 1575 element.setAttribute("tabindex", "0"); 1576 } 1577 }); 1578 setTimeout(function() { 1579 itemsChildActive[0].focus(); 1580 }, 1e3); 1581 if (!isMobile) { 1582 child.style.transform = "translateX(0)"; 1583 } else { 1584 child.style.height = "auto"; 1585 } 1586 } else { 1587 this.setAttribute("aria-expanded", "false"); 1588 const itemsChildActive = child.querySelectorAll("[tabindex]"); 1589 itemsChildActive.forEach(function(element) { 1590 if (element.getAttribute("tabindex") !== "-1") { 1591 element.setAttribute("tabindex", "-1"); 1592 } 1593 }); 1594 if (!isMobile) { 1595 child.style.transform = "translateX(200%)"; 1596 } else { 1597 child.style.height = "0"; 1598 } 1599 } 1600 }); 1601 }); 1602 } 1603 const submenu2 = document.querySelector("header .submenu2"); 1604 const menuItems2 = document.querySelectorAll("header .nav ul li .item"); 1605 document.querySelector("header .submenu2 .sub-header"); 1606 if (menuItems2 && !isMobile) { 1607 menuItems2.forEach(function(menuItem) { 1608 menuItem.addEventListener("click", function(e) { 1609 menuItems2.forEach(function(item) { 1610 item.classList.remove("active"); 1611 }); 1612 const childs = document.querySelectorAll("header .submenu2 .list-mega-menu .list--desktop .child-mega-menu"); 1613 childs.forEach(function(child2) { 1614 switchTabIndex(child2, "-1"); 1615 }); 1616 submenu2.style.transform = "translateX(0)"; 1617 submenu2.style.right = "0"; 1618 closeChildMenu(".submenu2"); 1619 this.classList.toggle("active"); 1620 const childId = this.getAttribute("data-target-child"); 1621 const child = document.querySelector("header .submenu2 .list-mega-menu .list--desktop .child-mega-menu#" + childId); 1622 child.classList.toggle("active"); 1623 if (this.classList.contains("active")) { 1624 submenu2.style.transform = "translateX(200%)"; 1625 this.setAttribute("aria-expanded", "true"); 1626 const otherMenuItems2 = document.querySelectorAll('header .nav ul li a.item:not([data-target-child="' + childId + '"])'); 1627 otherMenuItems2.forEach(function(item) { 1628 item.classList.remove("active"); 1629 }); 1630 switchTabIndex(child, "0"); 1631 setTimeout(() => { 1632 submenu2.style.transform = "translateX(0)"; 1633 child.style.transform = "translateX(0)"; 1634 }, 250); 1635 } else { 1636 this.setAttribute("aria-expanded", "false"); 1637 child.style.transform = "translateX(200%)"; 1638 submenu2.style.transform = "translateX(200%)"; 1639 switchTabIndex(child, "-1"); 1640 } 1641 }); 1642 }); 1643 } 1644 const menuItems2mobile = document.querySelectorAll("header .submenu2 .list-mega-menu .item"); 1645 if (menuItems2mobile) { 1646 menuItems2mobile.forEach(function(menuItem) { 1647 menuItem.addEventListener("click", function(e) { 1648 closeChildMenu(".submenu2"); 1649 const childId = this.getAttribute("data-target-child"); 1650 const child = document.querySelector("header .submenu2 .list-mega-menu .list--mobile .child-mega-menu#" + childId
1650); 1651 const isThisActive = this.classList.contains("active"); 1652 const isChildActive = child.classList.contains("active"); 1653 if (isThisActive !== isChildActive || !isThisActive && !isChildActive) { 1654 this.classList.toggle("active"); 1655 child.classList.toggle("active"); 1656 } 1657 if (this.classList.contains("active")) { 1658 this.setAttribute("aria-expanded", "true"); 1659 const otherMenuItems = document.querySelectorAll('header .submenu2 .list-mega-menu .item:not([data-target-child="' + childId + '"])'); 1660 otherMenuItems.forEach(function(item) { 1661 item.classList.remove("active"); 1662 const elementsWithTabIndex = item.querySelectorAll("[tabindex]"); 1663 elementsWithTabIndex.forEach(function(element) { 1664 if (element.getAttribute("tabindex") !== "-1") { 1665 element.setAttribute("tabindex", "-1"); 1666 } 1667 }); 1668 }); 1669 const itemsChildActive = child.querySelectorAll("[tabindex]"); 1670 itemsChildActive.forEach(function(element) { 1671 if (element.getAttribute("tabindex") !== "0") { 1672 element.setAttribute("tabindex", "0"); 1673 } 1674 }); 1675 setTimeout(function() { 1676 itemsChildActive[0].focus(); 1677 }, 1e3); 1678 child.style.height = "auto"; 1679 } else { 1680 this.setAttribute("aria-expanded", "false"); 1681 const itemsChildActive = child.querySelectorAll("[tabindex]"); 1682 itemsChildActive.forEach(function(element) { 1683 if (element.getAttribute("tabindex") !== "-1") { 1684 element.setAttribute("tabindex", "-1"); 1685 } 1686 }); 1687 child.style.height = "0"; 1688 } 1689 }); 1690 }); 1691 } 1692 const btnCloseMenu2 = document.querySelectorAll("header.main-header2 .submenu2 .btn-unstyled.btn-close-menu"); 1693 if (btnCloseMenu2.length > 0) { 1694 btnCloseMenu2.forEach((e) => { 1695 e.addEventListener("click", function() { 1696 menuItems2.forEach((e2) => { 1697 e2.classList.remove("active"); 1698 }); 1699 closeChildMenu(".submenu2", true); 1700 }); 1701 }); 1702 } 1703 const buttonOpenSearch = document.querySelector("header.main-header2 .nav ul li.search-icon button"); 1704 const buttonCloseSearch = document.querySelector("header.main-header2 .nav .hidden-search-input button.closeInput"); 1705 const componentSearch = document.querySelector("header.main-header2 .nav .hidden-search-input"); 1706 if (buttonOpenSearch) { 1707 buttonOpenSearch.addEventListener("click", function() { 1708 componentSearch.style.right = "0"; 1709 }); 1710 } 1711 if (buttonCloseSearch) { 1712 buttonCloseSearch.addEventListener("click", function() { 1713 componentSearch.style.right = "-650px"; 1714 }); 1715 } 1716 const buttonOpenSearchEvent = document.querySelector(".navEvent2 ul li ul.bloc-submenu li.search-icon button"); 1717 const buttonCloseSearchEvent = document.querySelector(".navEvent2 .hidden-search-input button.closeInput"); 1718 const componentSearchEvent = document.querySelector(".navEvent2 .hidden-search-input"); 1719 if (buttonOpenSearchEvent) { 1720 buttonOpenSearchEvent.addEventListener("click", function() { 1721 componentSearchEvent.style.right = "0"; 1722 componentSearchEvent.setAttribute("aria-hidden", "false"); 1723 componentSearchEvent.querySelector('form input').focus(); 1724 buttonCloseSearchEvent.setAttribute("tabindex", "0"); 1725 }); 1726 } 1727 if (buttonCloseSearchEvent) { 1728 buttonCloseSearchEvent.addEventListener("click", function() { 1729 componentSearchEvent.style.right = "-650px"; 1730 componentSearchEvent.setAttribute("aria-hidden", "true"); 1731 buttonCloseSearchEvent.setAttribute("tabindex", "-1"); 1732 }); 1733 } 1734 const dropdownBtns = document.querySelectorAll(".dropdown-btn"); 1735 if (dropdownBtns) { 1736 dropdownBtns.forEach(function(btn) { 1737 btn.addEventListener("click", function() { 1738 const dropdownContent = this.nextElementSibling; 1739 const isExpanded = this.getAttribute("aria-expanded") === "true"; 1740 const otherDropdownContents = document.querySelectorAll(".dropdown-content");
1741 otherDropdownContents.forEach(function(content) { 1742 if (content !== dropdownContent) { 1743 content.classList.remove("show"); 1744 } 1745 }); 1746 const otherDropdownBtns = document.querySelectorAll(".dropdown-btn"); 1747 otherDropdownBtns.forEach(function(otherBtn) { 1748 if (otherBtn !== btn) { 1749 otherBtn.classList.remove("active"); 1750 } 1751 }); 1752 dropdownContent.classList.toggle("show"); 1753 this.classList.toggle("active"); 1754 this.setAttribute("aria-expanded", !isExpanded); 1755 }); 1756 }); 1757 } 1758 window.addEventListener("click", function(event) { 1759 const clickedElement = event.target; 1760 if (!clickedElement.classList.contains("dropdown-btn") && !(clickedElement.tagName === "use" && clickedElement.parentElement.parentElement.classList.contains("dropdown-btn"))) { 1761 const dropdownContents = document.querySelectorAll(".dropdown-content"); 1762 dropdownContents.forEach(function(content) { 1763 content.classList.remove("show"); 1764 }); 1765 const dropdownBtns2 = document.querySelectorAll(".dropdown-btn"); 1766 dropdownBtns2.forEach(function(btn) { 1767 btn.classList.remove("active"); 1768 }); 1769 } 1770 }); 1771 const video = document.getElementById("background-video-intro"); 1772 const pauseButton = document.getElementById("pause-button-video-intro"); 1773 const svgControl = document.querySelector(".icon-video-controls use"); 1774 if (video && pauseButton && svgControl) { 1775 pauseButton.addEventListener("click", function() { 1776 if (video.paused) { 1777 video.play(); 1778 svgControl.setAttribute("href", svgControl.getAttribute("data-href") + "#icon-video-pause"); 1779 pauseButton.setAttribute("aria-label", "Mettre en pause"); 1780 } else { 1781 video.pause(); 1782 svgControl.setAttribute("href", svgControl.getAttribute("data-href") + "#icon-video-play"); 1783 pauseButton.setAttribute("aria-label", "Démarrer la vidéo"); 1784 } 1785 }); 1786 } 1787 if (document.querySelector(".publications .items")) { 1788 let nextSlide2 = function() { 1789 if (currentIndex < swiperSlides.length - 1) { 1790 swiperSlides[currentIndex].classList.remove("active"); 1791 detailsSlides[currentIndex].classList.remove("active"); 1792 swiperSlides[currentIndex].classList.add("prev"); 1793 currentIndex++; 1794 swiperSlides[currentIndex].classList.remove("next"); 1795 swiperSlides[currentIndex].classList.add("active"); 1796 detailsSlides[currentIndex].classList.add("active"); 1797 swiperSlides[currentIndex + 1].classList.add("next"); 1798 } 1799 }, prevSlide2 = function() { 1800 if (currentIndex > 0) { 1801 swiperSlides[currentIndex].classList.remove("active"); 1802 detailsSlides[currentIndex].classList.remove("active"); 1803 swiperSlides[currentIndex].classList.add("next"); 1804 currentIndex--; 1805 swiperSlides[currentIndex].classList.remove("prev"); 1806 swiperSlides[currentIndex].classList.add("active"); 1807 detailsSlides[currentIndex].classList.add("active"); 1808 if (currentIndex === 0) { 1809 swiperSlides.forEach(function(element, index) { 1810 if (index !== 1) { 1811 element.classList.remove("next"); 1812 } 1813 }); 1814 } 1815 } 1816 }; 1817 var nextSlide = nextSlide2, prevSlide = prevSlide2; 1818 document.querySelector(".publications .items .content .swiper-container"); 1819 document.querySelector(".publications .items .content .swiper-wrapper"); 1820 const swiperSlides = Array.from(document.querySelectorAll(".publications .items .content .swiper-slide")); 1821 const detailsSlides = Array.from(document.querySelectorAll(".publications .items .content .details-list .details")); 1822 const prevButton = document.querySelector(".publications .items .content .swiper-prev"); 1823 const nextButton = document.querySelector(".publications .items .content .swiper-next"); 1824 let currentIndex = 0; 1825 if (prevButton) { 1826 prevButton.addEventListener("click", prevSlide2); 1827 } 1828 if (nextButton) { 1829 nextButton.addEventListener("click", nextSlide2); 1830 } 1831 } 1832 const backTopBtn = document.querySelector("button.back-top"); 1833 if (backTopBtn) { 1834 backTopBtn.addEventListener("click", function() { 1835 window.scrollTo({ 1836 top: 0, 1837 behavior: "smooth" 1838 }); 1839 }); 1840 } 1841 if (alertsBanner) { 1842 const containerItems = document.querySelector(".alerts .items"); 1843 const items = containerItems.querySelectorAll(".item"); 1844 const dots = document.querySelectorAll(".alerts .dots button"); 1845 const closeAlerts = document.querySelector(".alerts .close-alerts"); 1846 let maxHeight = items[0].clientHeight - 15; 1847 containerItems.style.maxHeight = maxHeight + "px";
1848 dots.forEach(function(dot) { 1849 dot.addEventListener("click", function() { 1850 const dataId = dot.getAttribute("data-id"); 1851 const targetElement = document.querySelector('.alerts .items .item[data-target-id="' + dataId + '"]'); 1852 if (targetElement) { 1853 dots.forEach(function(item) { 1854 item.classList.remove("active"); 1855 }); 1856 dot.classList.add("active"); 1857 closeAlerts.setAttribute("data-id-close", dataId); 1858 containerItems.style.maxHeight = targetElement.clientHeight + "px"; 1859 const containerTop = containerItems.getBoundingClientRect().top; 1860 const elementTop = targetElement.getBoundingClientRect().top; 1861 const scrollPosition = elementTop - containerTop + containerItems.scrollTop; 1862 containerItems.scrollTo({ 1863 top: scrollPosition, 1864 behavior: "smooth" 1865 }); 1866 } 1867 }); 1868 }); 1869 closeAlerts.addEventListener("click", function() { 1870 const dataId = this.getAttribute("data-id-close"); 1871 const alert = document.querySelector('.alerts .items .item[data-target-id="' + dataId + '"]'); 1872 const dot = document.querySelector('.alerts .dots button[data-id="' + dataId + '"]'); 1873 if (alert && dot) { 1874 const currentDots = document.querySelectorAll(".alerts .dots button"); 1875 if (currentDots.length) { 1876 currentDots[0].classList.add("active"); 1877 containerItems.scrollTo({ 1878 top: 0, 1879 behavior: "smooth" 1880 }); 1881 this.setAttribute("data-id-close", currentDots[0].getAttribute("data-id")); 1882 } 1883 } 1884 }); 1885 if (rightLinks) { 1886 rightLinks.style.top = rightLinks.offsetTop + alertsBanner.offsetHeight + "px"; 1887 } 1888 } 1889 const mediasChamberDivs = document.querySelectorAll(".medias-chamber"); 1890 mediasChamberDivs.forEach((mediasChamberDiv) => { 1891 const mediasPrevButton = mediasChamberDiv.querySelector(".medias-prev"); 1892 const mediasNextButton = mediasChamberDiv.querySelector(".medias-next"); 1893 const mediasDiv = mediasChamberDiv.querySelector(".medias"); 1894 const firstSingleDiv = mediasChamberDiv.querySelector(".medias .single"); 1895 if (firstSingleDiv) { 1896 let scrollLeft2 = function() { 1897 mediasDiv.scrollBy({ 1898 left: -scrollAmount, 1899 ...supportsSmoothScroll() && { behavior: "smooth" } 1900 }); 1901 }, scrollRight2 = function() { 1902 mediasDiv.scrollBy({ 1903 left: scrollAmount, 1904 ...supportsSmoothScroll() && { behavior: "smooth" } 1905 }); 1906 }; 1907 var scrollLeft = scrollLeft2, scrollRight = scrollRight2; 1908 const scrollAmount = isMobile ? firstSingleDiv.getBoundingClientRect().width : firstSingleDiv.getBoundingClientRect().width + 23; 1909 if (mediasPrevButton) { 1910 mediasPrevButton.addEventListener("click", scrollLeft2); 1911 } 1912 if (mediasNextButton) { 1913 mediasNextButton.addEventListener("click", scrollRight2); 1914 } 1915 } 1916 }); 1917 const valueToSelect = (value, targetSelect) => { 1918 targetSelect.value = value; 1919 }; 1920 const btnToSelect = document.querySelectorAll(".btnToSelect"); 1921 const selectFilter = document.querySelector(".select-hidden"); 1922 btnToSelect.forEach((element, idx) => { 1923 element.addEventListener("click", (clicked) => { 1924 valueToSelect(element.value, selectFilter); 1925 }); 1926 }); 1927 let triggerBtnBanner = Array.from(document.querySelectorAll(".trigger-btn-banner")); 1928 triggerBtnBanner.forEach((element, idx) => { 1929 element.addEventListener("mouseenter", (hover) => { 1930 element.style.transform = "translateX(0)"; 1931 }); 1932 element.addEventListener("mouseout", (hover) => { 1933 element.style.transform = ""; 1934 }); 1935 }); 1936 const accordions = document.querySelectorAll(".accordions .accordion"); 1937 accordions.forEach((accordion) => { 1938 const button = accordion.querySelector("button"); 1939 const svgControl2 = button.querySelector("svg use"); 1940 const panel = accordion.querySelector(".panel"); 1941 button.addEventListener("click", () => { 1942 const expanded = button.getAttribute("aria-expanded") === "true" || false; 1943 button.setAttribute("aria-expanded", !expanded); 1944 button.classList.toggle("active", !expanded); 1945 panel.classList.toggle("show", !expanded); 1946 const hrefBaseArray = svgControl2.getAttribute("href").split("#"); 1947 if (!expanded) { 1948 svgControl2.setAttribute("href", hrefBaseArray[0] + "#icon-less"); 1949 } else { 1950 svgControl2.setAttribute("href", hrefBaseArray[0] + "#icon-plus"); 1951 } 1952 }); 1953 }); 1954 const sectionPartenaires = document.querySelectorAll(".section-partenaires");
1955 sectionPartenaires.forEach((sectionPartenaire) => { 1956 const mediasPrevButton = sectionPartenaire.querySelector(".partenaire-prev"); 1957 const mediasNextButton = sectionPartenaire.querySelector(".partenaire-next"); 1958 const div = sectionPartenaire.querySelector(".icons"); 1959 const container = sectionPartenaire.querySelector('.container-icons') 1960 const icons = div.querySelectorAll(".icon"); 1961 const firstSingleDiv = icons[0]; 1962 const scrollAmount = firstSingleDiv.getBoundingClientRect().width; 1963 const gap = 50; 1964 let totalIconWidth = scrollAmount + gap; 1965 1966 function adjustVisibleIcons() { 1967 const containerWidth = container.clientWidth; 1968 const maxVisibleIcons = Math.floor(containerWidth / totalIconWidth); 1969 const newWidth = maxVisibleIcons * totalIconWidth - gap; 1970 div.style.width = `${newWidth + 20}px`; 1971 if (maxVisibleIcons > icons.length) { 1972 div.style.justifyContent = 'center'; 1973 mediasPrevButton.style.display = 'none'; 1974 mediasNextButton.style.display = 'none'; 1975 } 1976 } 1977 1978 if(!isMobile) { 1979 adjustVisibleIcons(); 1980 window.addEventListener("resize", adjustVisibleIcons); 1981 } else { 1982 totalIconWidth = scrollAmount; 1983 } 1984 1985 //scrollRight(); 1986 function scrollLeft() { 1987 div.scrollBy({ 1988 left: -totalIconWidth, 1989 behavior: "smooth" 1990 }); 1991 } 1992 function scrollRight() { 1993 div.scrollBy({ 1994 left: totalIconWidth, 1995 behavior: "smooth" 1996 }); 1997 } 1998 if (mediasPrevButton) { 1999 mediasPrevButton.addEventListener("click", scrollLeft); 2000 } 2001 if (mediasNextButton) { 2002 mediasNextButton.addEventListener("click", scrollRight); 2003 } 2004 }); 2005 const newsletters = document.querySelectorAll("footer .newsletter"); 2006 newsletters.forEach((newsletter) => { 2007 const prevElement = newsletter.previousElementSibling; 2008 if (prevElement && prevElement.classList.contains("links")) { 2009 prevElement.style.borderRight = "none"; 2010 } 2011 }); 2012 const btnTabsNews = document.querySelectorAll(".news-list .header-actions button"); 2013 const tabsNews = document.querySelectorAll(".news-list .news-container-tabs .content"); 2014 function switchTabIndex(element, index) { 2015 const focusableElements = element.querySelectorAll('a[href], button, input, select, textarea, [tabindex]:not([tabindex="-1"])'); 2016 focusableElements.forEach((element2) => { 2017 element2.setAttribute("tabindex", index); 2018 }); 2019 } 2020 function showTab(tabId) { 2021 tabsNews.forEach((tab) => { 2022 if (tab.getAttribute("data-tab") === tabId) { 2023 tab.classList.add("active"); 2024 switchTabIndex(tab, "0"); 2025 } else { 2026 tab.classList.remove("active"); 2027 tab.setAttribute("aria-hidden", "true"); 2028 switchTabIndex(tab, "-1"); 2029 } 2030 }); 2031 } 2032 btnTabsNews.forEach((btnTab) => { 2033 btnTab.addEventListener("click", () => { 2034 const targetTab = btnTab.getAttribute("data-target-tab"); 2035 showTab(targetTab); 2036 }); 2037 }); 2038 tabsNews.forEach((tab) => { 2039 const ariaHidden = tab.getAttribute("aria-hidden"); 2040 if (ariaHidden === "true") { 2041 switchTabIndex(tab, "-1"); 2042 } 2043 }); 2044 const containerNews = document.querySelectorAll(".container-carousel"); 2045 containerNews.forEach((item) => { 2046 const parent = item.closest(".container-carousel-parent"); 2047 if (parent) { 2048 let setActiveFrame2 = function(index) { 2049 currentIndex = index; 2050 const activeFrame = parent.querySelector(".frames.active"); 2051 if (activeFrame) { 2052 activeFrame.classList.remove("active"); 2053 } 2054 if (frames && frames[currentIndex]) { 2055 frames[currentIndex].classList.add("active"); 2056 } 2057 const dots2 = parent.querySelectorAll(".navigator .navigator-items"); 2058 if (dots2) { 2059 dots2.forEach((dot, idx) => { 2060 if (idx === currentIndex) { 2061 dot.classList.add("active-green-dot"); 2062 } else { 2063 dot.classList.remove("active-green-dot"); 2064 } 2065 }); 2066 } 2067 const dotsDark2 = parent.querySelectorAll(".navigator2 .navigator-items-dark"); 2068 dotsDark2.forEach((dot, idx) => { 2069 if (idx === currentIndex) { 2070 dot.classList.add("active-dark-dot"); 2071 } else { 2072 dot.classList.remove("active-dark-dot"); 2073 } 2074 }); 2075 let scrollValue = currentIndex * slideWidth; 2076 if (isMobile) { 2077 scrollValue += currentIndex * 10; 2078 } 2079 item.scrollTo({ 2080 left: scrollValue, 2081 behavior: "smooth" 2082 }); 2083 }, createDots2 = function() { 2084 const navigator2 = parent.querySelector(".navigator"); 2085 const navigatorDark = parent.querySelector(".navigator2"); 2086 const centerOfItemsNavigator = Math.round(frames.length / 2); 2087 for (let i = 0; i < frames.length; i++) { 2088 if (navigator2) { 2089 const dot = document.createElement("button"); 2090 const svgIcon = navigator2.querySelector("svg use"); 2091 dot.classList.add("navigator-items"); 2092 if (dot) { 2093 dot.addEventListener("click", () => {
2094 setActiveFrame2(i); 2095 isPaused = true; 2096 svgIcon.setAttribute("href", svgIcon.getAttribute("data-href") + "#icon-video-play"); 2097 }); 2098 navigator2.appendChild(dot); 2099 if (centerOfItemsNavigator === i + 1) { 2100 const svgControl2 = navigator2.querySelector("svg"); 2101 navigator2.appendChild(svgControl2); 2102 if (svgControl2) { 2103 svgControl2.addEventListener("click", () => { 2104 if (isPaused) { 2105 svgIcon.setAttribute("href", svgIcon.getAttribute("data-href") + "#icon-video-pause"); 2106 isPaused = false; 2107 } else { 2108 svgIcon.setAttribute("href", svgIcon.getAttribute("data-href") + "#icon-video-play"); 2109 isPaused = true; 2110 } 2111 }); 2112 } 2113 } 2114 } 2115 } 2116 if (navigatorDark) { 2117 while (navigatorDark.firstChild) { 2118 navigatorDark.removeChild(navigatorDark.firstChild); 2119 } 2120 for (let j = 0; j < frames.length; j++) { 2121 const dotDark = document.createElement("button"); 2122 dotDark.classList.add("navigator-items-dark"); 2123 if (j === currentIndex) { 2124 dotDark.classList.add("active-dark-dot"); 2125 } 2126 dotDark.addEventListener("click", () => {
2127 setActiveFrame2(j); 2128 }); 2129 navigatorDark.appendChild(dotDark); 2130 const svgControl2 = document.createElement("svg"); 2131 const useElement2 = document.createElement("use"); 2132 svgControl2.appendChild(useElement2); 2133 navigatorDark.appendChild(svgControl2); 2134 svgControl2.addEventListener("click", () => { 2135 if (isPaused) { 2136 useElement2.setAttribute("href", useElement2.getAttribute("data-href") + "#icon-video-pause"); 2137 isPaused = false; 2138 } else { 2139 useElement2.setAttribute("href", useElement2.getAttribute("data-href") + "#icon-video-play"); 2140 isPaused = true; 2141 } 2142 }); 2143 if (j === 0) { 2144 useElement2.setAttribute("href", useElement2.getAttribute("data-href") + "#icon-video-play"); 2145 isPaused = true; 2146 } 2147 } 2148 } 2149 } 2150 }, moveSlide2 = function() { 2151 currentIndex = (currentIndex + 1) % frames.length; 2152 setActiveFrame2(currentIndex); 2153 }; 2154 var setActiveFrame = setActiveFrame2, createDots = createDots2, moveSlide = moveSlide2; 2155 const frames = item.querySelectorAll(".frames"); 2156 const slideWidth = frames && frames[0] ? frames[0].clientWidth : 0; 2157 let currentIndex = 0; 2158 let isPaused = false; 2159 const dots = parent.querySelectorAll(".navigator-items.actualite"); 2160 if (dots && dots[0]) { 2161 dots[0].classList.add("active-green-dot"); 2162 } 2163 const dotsDark = parent.querySelectorAll(".navigator-items-dark"); 2164 if (dotsDark && dotsDark[0]) { 2165 dots[0].classList.add("active-dark-dot"); 2166 } 2167 createDots2(); 2168 setInterval(function() { 2169 if (!isPaused) { 2170 moveSlide2(); 2171 } 2172 }, 5e3); 2173 } 2174 }); 2175 let burgerButton = document.querySelector(".main-header2 button.menu-responsive"); 2176 const submenuVersion2 = document.querySelector("header.main-header2 .submenu2"); 2177 if (burgerButton) { 2178 burgerButton.addEventListener("click", function() { 2179 this.classList.toggle("active"); 2180 const stateExpanded = this.getAttribute("aria-expanded"); 2181 const isExpanded = stateExpanded === "true"; 2182 this.setAttribute("aria-expanded", !isExpanded); 2183 if (this.classList.contains("active")) { 2184 submenuVersion2.style.transform = "translateX(0)"; 2185 submenuVersion2.style.right = "0"; 2186 enableTabIndex(".submenu2"); 2187 } else { 2188 submenuVersion2.style.transform = "translateX(100%)"; 2189 disableTabIndex(); 2190 closeChildMenu(".submenu2"); 2191 } 2192 }); 2193 } 2194 const btnCloseMenuV2 = document.querySelector("header .btn-close-menu.v2"); 2195 if (btnCloseMenuV2) { 2196 btnCloseMenuV2.addEventListener("click", function(e) { 2197 if (burgerButton) { 2198 burgerButton.classList.remove("active"); 2199 } 2200 if (submenu) { 2201 submenu.style.transform = "translateX(100%)"; 2202 } 2203 disableTabIndex(".submenu"); 2204 closeChildMenu(".submenu2"); 2205 const menuItems3 = document.querySelectorAll("header .submenu .list-mega-menu .item"); 2206 menuItems3.forEach(function(menuItem) { 2207 menuItem.classList.remove("active"); 2208 }); 2209 }); 2210 } 2211 document.querySelectorAll(".section-finances .container-items").forEach((containerFinances) => { 2212 const itemsContainer = containerFinances.querySelector(".items"); 2213 if (!itemsContainer) return; 2214 2215 const firstItem = itemsContainer.querySelector(".item"); 2216 if (!firstItem) return; 2217 2218 const rect = firstItem.getBoundingClientRect(); 2219 const itemWidth = rect.width; 2220 let currentPosition = 0; 2221 2222 const scrollCarousel = function(direction) { 2223 if (direction === "prev") { 2224 currentPosition -= itemWidth; 2225 } else if (direction === "next") { 2226 currentPosition += itemWidth; 2227 } 2228 itemsContainer.scrollTo({ 2229 left: currentPosition, 2230 behavior: "smooth" 2231 }); 2232 }; 2233 2234 const prevBtn = containerFinances.querySelector(".medias-prev"); 2235 const nextBtn = containerFinances.querySelector(".medias-next"); 2236 2237 if (prevBtn) { 2238 prevBtn.addEventListener("click", () => scrollCarousel("prev")); 2239 } 2240 if (nextBtn) { 2241 nextBtn.addEventListener("click", () => scrollCarousel("next")); 2242 } 2243 }); 2244 let accordionButtonHeader2 = document.querySelectorAll(".main-header2 .submenu2 .child-mega-menu ul.group-list li.group a.title"); 2245 let accordionsListHeader2 = document.querySelectorAll(".main-header2 .submenu2 .child-mega-menu ul.group-list li.group ul"); 2246 if (accordionsListHeader2 && accordionButtonHeader2) { 2247 accordionButtonHeader2.forEach((button, index) => { 2248 button.addEventListener("click", () => { 2249 accordionsListHeader2.forEach((content, i) => { 2250 index != i ? content.classList.remove("opened") : content.classList.add("opened"); 2251 }); 2252 }); 2253 }); 2254 } 2255 const containerTabsProject = document.querySelector(".section-links"); 2256 if (containerTabsProject) { 2257 let showTabProject2 = function(tabId) {
2258 tabsProjects.forEach((tab) => { 2259 if (tab.getAttribute("data-tab") === tabId) { 2260 tab.classList.add("active"); 2261 } else { 2262 tab.classList.remove("active"); 2263 } 2264 }); 2265 }; 2266 var showTabProject = showTabProject2; 2267 const btnTabsProjects = containerTabsProject.querySelectorAll("button"); 2268 const tabsProjects = document.querySelectorAll(".project-tab"); 2269 btnTabsProjects.forEach((btnTab) => { 2270 btnTab.addEventListener("click", () => { 2271 const targetTab = btnTab.getAttribute("data-target-tab"); 2272 const parentLi = btnTab.parentNode; 2273 showTabProject2(targetTab); 2274 btnTabsProjects.forEach((btn) => { 2275 if (btn !== btnTab) { 2276 btn.parentNode.classList.remove("active"); 2277 } 2278 }); 2279 parentLi.classList.add("active"); 2280 }); 2281 }); 2282 } 2283 const modals = document.querySelectorAll("[data-modal]"); 2284 if (modals) { 2285 modals.forEach(function(trigger) { 2286 trigger.addEventListener("click", function(event) { 2287 event.preventDefault(); 2288 const modal = document.getElementById(trigger.dataset.modal); 2289 modal.classList.add("open"); 2290 const exits = modal.querySelectorAll(".modal-exit"); 2291 exits.forEach(function(exit) { 2292 exit.addEventListener("click", function(event2) { 2293 event2.preventDefault(); 2294 modal.classList.remove("open"); 2295 }); 2296 }); 2297 }); 2298 }); 2299 } 2300 if ("geolocation" in navigator) { 2301 let successGeoLoc2 = function(pos) { 2302 let crd = pos.coords; 2303 const apiUrl = `https://api-adresse.data.gouv.fr/reverse/?lon=${crd.longitude}&lat=${crd.latitude}`; 2304 fetch(apiUrl).then((response) => response.json()).then((data) => { 2305 if (locationUser) { 2306 locationUser.value = data.features[0].properties.postcode; 2307 } 2308 }).catch((error) => { 2309 console.error("Erreur lors de la requête :", error); 2310 }); 2311 }, errorGeoLoc2 = function(err) { 2312 console.warn(`ERREUR (${err.code}): ${err.message}`); 2313 }; 2314 var successGeoLoc = successGeoLoc2, errorGeoLoc = errorGeoLoc2; 2315 const getLocationButton = document.getElementById("getLocationButton"); 2316 const locationUser = document.querySelector("#locationUser"); 2317 if (getLocationButton) { 2318 getLocationButton.addEventListener("click", (e) => { 2319 if (locationUser) { 2320 locationUser.setAttribute("placeholder", "chargement..."); 2321 } 2322 navigator.geolocation.getCurrentPosition(successGeoLoc2, errorGeoLoc2, optionsGeoLoc); 2323 }); 2324 } 2325 let optionsGeoLoc = { 2326 enableHighAccuracy: true, 2327 timeout: 5e3, 2328 maximumAge: 0 2329 }; 2330 } 2331 const tableLines = document.querySelectorAll(".tableLines"); 2332 tableLines.forEach(function(line) { 2333 const firstTd = line.querySelector("td:first-child"); 2334 const secondTd = line.querySelector("td:nth-child(2)"); 2335 firstTd.addEventListener("click", function() { 2336 toggleAccordion(); 2337 }); 2338 secondTd.addEventListener("click", function() { 2339 toggleAccordion(); 2340 }); 2341 function toggleAccordion() { 2342 const accordionId = line.getAttribute("data-accordion"); 2343 const targetAccordions = document.querySelectorAll(".accordion-" + accordionId + ".enabled"); 2344 targetAccordions.forEach(function(target) { 2345 if (target.style.display === "grid") { 2346 target.style.display = "none"; 2347 line.setAttribute("aria-expanded", "false"); 2348 line.classList.remove("active"); 2349 } else { 2350 target.style.display = "grid"; 2351 line.setAttribute("aria-expanded", "true"); 2352 line.classList.add("active"); 2353 } 2354 }); 2355 } 2356 }); 2357 const tablinesTr = document.querySelectorAll(".tableLines"); 2358 const reinitCities = document.querySelector("#reinitialiserCities"); 2359 const triggerFilterCities = document.querySelector("#citiesFilters"); 2360 const buttonCitiesFilter = document.querySelector("#buttonCitiesFilter"); 2361 const lines = document.querySelectorAll(".filter_results tr"); 2362 tablinesTr[0] ? tablinesTr[0].parentNode.parentNode.classList.contains("tab-more-objects") : false;
2363 if (tablinesTr[0]) { 2364 const tableName = Array.from(document.querySelector(".b-tab-list").children); 2365 const tableList = document.querySelector(".b-tab-list"); 2366 const allTr = tableList.querySelectorAll("tr ,th"); 2367 let numberColumns = 0; 2368 if (tableName[1] && tableName[1].children[1] && tableName[1].children[1].children) { 2369 numberColumns = tableName[1].children[1].children.length; 2370 } 2371 let templateGrid; 2372 let columnCount = 0; 2373 while (columnCount <= numberColumns) { 2374 templateGrid += "1fr "; 2375 columnCount++; 2376 columnCount++; 2377 } 2378 allTr.forEach((el, id) => { 2379 if (id != 0) { 2380 el.style.gridTemplateColumn = templateGrid; 2381 } 2382 }); 2383 } 2384 let imageCitiesFilterButton; 2385 if (buttonCitiesFilter) { 2386 imageCitiesFilterButton = buttonCitiesFilter.children[0]; 2387 } 2388 if (triggerFilterCities) { 2389 const namesCitiesContainer = triggerFilterCities.querySelectorAll("button"); 2390 lines.forEach((line) => { 2391 line.classList.add("enabled"); 2392 if (line.classList.contains("accordionLine")) { 2393 line.style.display = "none"; 2394 } 2395 }); 2396 namesCitiesContainer.forEach((el) => { 2397 el.addEventListener("click", (clicked) => { 2398 buttonDateFilter.innerText = "Par Date"; 2399 buttonDateFilter.appendChild(buttonImageDateFilter); 2400 reinitDate.style.display = "none"; 2401 if (el.id === "reinitialiserCities") { 2402 if (buttonCitiesFilter) { 2403 buttonCitiesFilter.innerText = "Par Lieu"; 2404 buttonCitiesFilter.appendChild(imageCitiesFilterButton); 2405 } 2406 lines.forEach((line) => { 2407 if (reinitCities) { 2408 reinitCities.style.display = "none"; 2409 } 2410 if (line.classList.contains("accordionLine") && line.style.display === "none") { 2411 line.style.display = "none"; 2412 } else { 2413 line.style.display = "grid"; 2414 } 2415 line.classList.remove("disabled"); 2416 line.classList.add("enabled"); 2417 }); 2418 } else { 2419 const selectedCity = el.textContent.trim().toLowerCase(); 2420 if (buttonCitiesFilter) { 2421 buttonCitiesFilter.textContent = el.innerText; 2422 buttonCitiesFilter.appendChild(imageCitiesFilterButton); 2423 } 2424 if (reinitCities) { 2425 reinitCities.style.display = "block"; 2426 } 2427 lines.forEach((line) => { 2428 const dataLocalisation = line.getAttribute("data-localisation").toLowerCase(); 2429 const localisationsArray = dataLocalisation.split("/").map((city) => city.trim()); 2430 const shouldDisplay = localisationsArray.includes(selectedCity); 2431 if (shouldDisplay && line.classList.contains("accordionLine") && line.style.display === "none") { 2432 line.style.display = "none"; 2433 } else { 2434 line.style.display = shouldDisplay ? "grid" : "none"; 2435 } 2436 if (shouldDisplay) { 2437 line.classList.remove("disabled"); 2438 line.classList.add("enabled"); 2439 } else { 2440 line.classList.remove("enabled"); 2441 line.classList.add("disabled"); 2442 } 2443 }); 2444 } 2445 triggerCalcPages(); 2446 }); 2447 }); 2448 } 2449 const triggerFilterByDate = document.querySelector("#sortsByDate"); 2450 const reinitDate = document.querySelector("#reinitialiserDate"); 2451 const buttonDateFilter = document.querySelector("#buttonDateFilter"); 2452 let buttonImageDateFilter; 2453 if (buttonDateFilter) { 2454 buttonImageDateFilter = buttonDateFilter.children[0]; 2455 } 2456 if (triggerFilterByDate) { 2457 const namesCitiesDateContainer = triggerFilterByDate.querySelectorAll("button"); 2458 namesCitiesDateContainer.forEach((el) => { 2459 el.addEventListener("click", (clicked) => { 2460 if (buttonCitiesFilter) { 2461 buttonCitiesFilter.innerText = "Par Lieu"; 2462 buttonCitiesFilter.appendChild(imageCitiesFilterButton); 2463 } 2464 if (reinitCities) { 2465 reinitCities.style.display = "none"; 2466 } 2467 if (el.id === "reinitialiserDate") { 2468 if (buttonDateFilter) { 2469 buttonDateFilter.innerText = "Par Date"; 2470 buttonDateFilter.appendChild(buttonImageDateFilter); 2471 }
2472 lines.forEach((line) => { 2473 if (reinitCities) { 2474 reinitCities.style.display = "none"; 2475 } 2476 if (line.classList.contains("accordionLine") && line.style.display === "none") { 2477 line.style.display = "none"; 2478 } else { 2479 line.style.display = "grid"; 2480 } 2481 line.classList.remove("disabled"); 2482 line.classList.add("enabled"); 2483 }); 2484 } else { 2485 let currentDate; 2486 if (el.getAttribute("data-date") != null) { 2487 currentDate = el.getAttribute("data-date").split(",")[0]; 2488 } 2489 if (buttonDateFilter) { 2490 buttonDateFilter.innerText = el.innerText; 2491 buttonDateFilter.appendChild(buttonImageDateFilter); 2492 } 2493 reinitDate.style.display = "block"; 2494 lines.forEach((line) => { 2495 line.style.display = "none"; 2496 }); 2497 tablinesTr.forEach((el2, idx) => { 2498 if (el2.getAttribute("data-date") && el2.getAttribute("data-date").includes(currentDate)) { 2499 tablinesTr[idx].style.display = "grid"; 2500 el2.classList.remove("disabled"); 2501 el2.classList.add("enabled"); 2502 } else { 2503 el2.classList.remove("enabled"); 2504 el2.classList.add("disabled"); 2505 } 2506 }); 2507 } 2508 triggerCalcPages(); 2509 }); 2510 }); 2511 } 2512 const tableFormations = document.querySelector("table.tab-more-objects"); 2513 if (tableFormations) { 2514 triggerCalcPages(); 2515 const filterResults = tableFormations.querySelector(".filter_results"); 2516 const observer = new MutationObserver((mutationsList, observer2) => { 2517 mutationsList.forEach((mutation) => { 2518 if (mutation.attributeName === "data-current-page") { 2519 const newValue = filterResults.getAttribute("data-current-page"); 2520 const lines2 = filterResults.querySelectorAll("tr.tableLines.enabled"); 2521 const accordionsLines = filterResults.querySelectorAll("tr.accordionLine.enabled"); 2522 lines2.forEach((line, index) => { 2523 if (line.getAttribute("data-page") === newValue) { 2524 line.style.display = "grid"; 2525 } else { 2526 line.style.display = "none"; 2527 line.setAttribute("aria-expanded", "false"); 2528 line.classList.remove("active"); 2529 accordionsLines.forEach((li) => li.style.display = "none"); 2530 } 2531 }); 2532 } 2533 }); 2534 }); 2535 const config = { attributes: true }; 2536 observer.observe(filterResults, config); 2537 } 2538 function triggerCalcPages() { 2539 const value = calcPagesFormations(); 2540 if (value > 1) { 2541 createPaginatorFormations(value); 2542 } else { 2543 const paginatorElement = document.querySelector(".f3-widget-paginator.paginator-sessions"); 2544 if (paginatorElement) { 2545 paginatorElement.remove(); 2546 } 2547 } 2548 } 2549 function calcPagesFormations() { 2550 let page = 1; 2551 const body = tableFormations.querySelector(".filter_results"); 2552 const results = body.querySelectorAll("tr.tableLines.enabled"); 2553 results.forEach((result, index) => { 2554 let display = "grid"; 2555 if (index > parseInt(body.getAttribute("data-items")) - 1) { 2556 page++; 2557 display = "none"; 2558 } 2559 result.setAttribute("data-page", page.toString()); 2560 result.style.display = display; 2561 }); 2562 return Math.ceil(results.length / parseInt(body.getAttribute("data-items"))); 2563 } 2564 function createPaginatorFormations(nbPages) { 2565 const ul = document.createElement("ul"); 2566 ul.className = "f3-widget-paginator paginator-sessions"; 2567 const prevLi = document.createElement("li"); 2568 prevLi.className = "prev"; 2569 const prevLink = document.createElement("button"); 2570 const prevImage = document.createElement("img"); 2571 prevImage.src = "/typo3conf/ext/skin/Resources/Public/assets/images/arrow-left-green.svg"; 2572 prevLink.appendChild(prevImage); 2573 prevLi.appendChild(prevLink); 2574 ul.appendChild(prevLi); 2575 for (let page = 1; page <= nbPages; page++) { 2576 const li = document.createElement("li"); 2577 const link = document.createElement("button"); 2578 link.textContent = page.toString(); 2579 li.appendChild(link); 2580 if (page === 1) { 2581 li.classList.add("current"); 2582 } 2583 ul.appendChild(li); 2584 } 2585 const nextLi = document.createElement("li"); 2586 nextLi.className = "next"; 2587 const nextLink = document.createElement("button"); 2588 const nextImage = document.createElement("img"); 2589 nextImage.src = "/typo3conf/ext/skin/Resources/Public/assets/images/arrow-right-green.svg"; 2590 nextLink.appendChild(nextImage); 2591 nextLi.appendChild(nextLink); 2592 ul.appendChild(nextLi); 2593 ul.addEventListener("click", function(event) { 2594 const target = event.target; 2595 const parentLi = target.parentElement; 2596 if (target.tagName === "BUTTON") { 2597 const body = tableFormations.querySelector(".filter_results"); 2598 const currentPage = parseInt(body.getAttribute("data-current-page")); 2599 if (!parentLi.classList.contains("current") && !parentLi.classList.contains("prev") && !parentLi.classList.contains("next")) { 2600 const buttonPage = parseInt(target.textContent); 2601 if (buttonPage !== currentPage) { 2602 body.setAttribute("data-current-page", buttonPage.toString()); 2603 const liElements = ul.querySelectorAll("li");
2604 liElements.forEach((li) => li.classList.remove("current")); 2605 parentLi.classList.add("current"); 2606 } 2607 } 2608 } else if (target.tagName === "IMG" && target.parentElement.tagName === "BUTTON") { 2609 const parentButton = target.parentElement; 2610 const body = tableFormations.querySelector(".filter_results"); 2611 let currentPage = parseInt(body.getAttribute("data-current-page")); 2612 if (parentButton.parentElement.classList.contains("prev") && currentPage > 1) { 2613 console.log("prev"); 2614 currentPage = currentPage - 1; 2615 } else if (parentButton.parentElement.classList.contains("next") && currentPage < nbPages) { 2616 console.log("next"); 2617 currentPage = currentPage + 1; 2618 } 2619 body.setAttribute("data-current-page", currentPage.toString()); 2620 const li = ul.querySelectorAll("li"); 2621 li.forEach((el, index) => { 2622 if (el.innerText === currentPage.toString()) { 2623 el.classList.add("current"); 2624 } else { 2625 el.classList.remove("current"); 2626 } 2627 }); 2628 } 2629 }); 2630 tableFormations.insertAdjacentElement("afterend", ul); 2631 } 2632 if (document.getElementById("dateBeginningEvent") && document.getElementById("dateEndEvent")) { 2633 const beginningDate = document.getElementById("dateBeginningEvent"); 2634 const endDate = document.getElementById("dateEndEvent"); 2635 let date = (/* @__PURE__ */ new Date()).getFullYear(); 2636 new Lightpick({ 2637 field: beginningDate, 2638 secondField: endDate, 2639 singleDate: false, 2640 onSelect: function(start, end) { 2641 let str = ""; 2642 str += start ? start.format("Do MMMM YYYY") + " to " : ""; 2643 str += end ? end.format("Do MMMM YYYY") : "..."; 2644 if (start && end) { 2645 const form = endDate.closest("form"); 2646 const btnSubmit = form.querySelector('button[type="submit"]'); 2647 if (btnSubmit) { 2648 setTimeout(() => { 2649 btnSubmit.click(); 2650 }, 500); 2651 } 2652 } 2653 }, 2654 dropdowns: { 2655 years: { 2656 min: date, 2657 max: date + 1 2658 }, 2659 months: true 2660 } 2661 }); 2662 } 2663 const elRadioProfil = document.getElementsByName("profil"); 2664 elRadioProfil.forEach((element) => { 2665 element.addEventListener("click", () => { 2666 elRadioProfil.forEach((allnodes) => { 2667 if (allnodes !== element) { 2668 allnodes.checked = false; 2669 } 2670 }); 2671 }); 2672 }); 2673 document.querySelectorAll('.container-bg-color-btn').forEach((container) => { 2674 const triggerBtnContact = container.querySelector('.trigger-btn-contact'); 2675 const triggerBtnForm = container.querySelector('.trigger-btn-form'); 2676 const targetContentContact = container.querySelector('.b-content-contact'); 2677 const targetContentForm = container.querySelector('.b-content-form'); 2678 2679 const toggleOnEventListener = (elementTrigger, elementTarget, otherTarget, toggleClass) => { 2680 elementTrigger.addEventListener('click', () => { 2681 elementTarget.classList.toggle(toggleClass); 2682 if (otherTarget) { 2683 otherTarget.classList.remove(toggleClass); 2684 } 2685 }); 2686 }; 2687 2688 if (triggerBtnContact && targetContentContact) { 2689 toggleOnEventListener(triggerBtnContact, targetContentContact, targetContentForm, 'visible'); 2690 } 2691 2692 if (triggerBtnForm && targetContentForm) { 2693 toggleOnEventListener(triggerBtnForm, targetContentForm, targetContentContact, 'visible'); 2694 } 2695 }); 2696 document.querySelectorAll(".b-slider-dots").forEach((sliderWrapper) => { 2697 const frameSliderDots = sliderWrapper.querySelectorAll(".slider-item"); 2698 const dotsContainer = sliderWrapper.querySelector(".dots-slider"); 2699 if (frameSliderDots.length > 1 && dotsContainer) { 2700 dotsContainer.innerHTML = ""; 2701 frameSliderDots.forEach((frame, i) => { 2702 frame.classList.add("frame-carousel-dot"); 2703 }); 2704 frameSliderDots[0].classList.remove("frame-carousel-dot");
2705 frameSliderDots.forEach((_, i) => { 2706 let dot = document.createElement("li"); 2707 dot.classList.add("dots-carousel-navigator"); 2708 dotsContainer.appendChild(dot); 2709 if (i === 0) { 2710 dot.classList.add("dot-isActive"); 2711 } 2712 dot.addEventListener("click", () => { 2713 dotsContainer.querySelectorAll(".dots-carousel-navigator").forEach((d) => 2714 d.classList.remove("dot-isActive") 2715 ); 2716 dot.classList.add("dot-isActive"); 2717 frameSliderDots.forEach((frame) => frame.classList.add("frame-carousel-dot")); 2718 frameSliderDots[i].classList.remove("frame-carousel-dot"); 2719 }); 2720 }); 2721 } 2722 }); 2723 let triggerSeveralBlocs = Array.from(document.querySelectorAll(".trigger-several-blocs")); 2724 let resultSeveralBlocs = Array.from(document.querySelectorAll(".toggle-results")); 2725 triggerSeveralBlocs.forEach((e, i) => { 2726 e.addEventListener("click", (clicked) => { 2727 console.log("clicked"); 2728 resultSeveralBlocs.forEach((currents, index) => { 2729 currents.classList.remove("show"); 2730 triggerSeveralBlocs[index].classList.remove("show"); 2731 }); 2732 e.classList.add("show"); 2733 resultSeveralBlocs[i].classList.add("show"); 2734 }); 2735 }); 2736 const triggerModals = document.querySelectorAll(".trigger-modal-deported"); 2737 const bModalDeporteds = document.querySelectorAll(".container-modal-deported"); 2738 const modalStates = Array.from({ length: triggerModals.length }, () => false); 2739 const triangle = document.querySelectorAll(".triangle"); 2740 const translatorRelative = (XvalueBlock, XvalueButton, WidthButton, widthTriangle) => { 2741 return XvalueButton - XvalueBlock + WidthButton - widthTriangle; 2742 }; 2743 triggerModals.forEach((currentButton, index) => { 2744 currentButton.addEventListener("click", (c) => { 2745 modalStates[index] = !modalStates[index]; 2746 bModalDeporteds.forEach((modal, i) => { 2747 if (i === index && modalStates[i]) { 2748 modal.classList.add("modal-deported-visibility"); 2749 let xCoordModal = modal.getBoundingClientRect().x; 2750 let widthTriangle = triangle[index].getBoundingClientRect().width; 2751 let xCoordButton = triggerModals[index].getBoundingClientRect().x; 2752 let widthButton = triggerModals[index].getBoundingClientRect().width / 2; 2753 triangle[index].style.transform = "translateX(" + translatorRelative(xCoordModal, xCoordButton, widthButton, widthTriangle) + "px)"; 2754 } else { 2755 modal.classList.remove("modal-deported-visibility"); 2756 } 2757 }); 2758 if (modalStates[index]) { 2759 bModalDeporteds[index].classList.add("modal-deported-visibility"); 2760 } 2761 }); 2762 }); 2763 const navEvent = document.querySelector(".navEvent"); 2764 const pauseEventButton = document.querySelector("#pause-button-video-intro"); 2765 const titlepageEvent = document.querySelector(".intro-video"); 2766 if (titlepageEvent) { 2767 const items = titlepageEvent.querySelectorAll('[tabindex="-1"]'); 2768 2769 items.forEach((item) => { 2770 item.setAttribute("tabindex", "0"); 2771 }); 2772 } 2773 let isNavFixed = false; 2774 function updateStyle() { 2775 const windowWidth = window.innerWidth; 2776 } 2777 function handleScroll() { 2778 const scrollPosition = window.scrollY; 2779 const windowWidth2 = window.innerWidth; 2780 const navOffset = navEvent.offsetTop; 2781 const logoOnePage = document.querySelector(".logo-one-page"); 2782 if (scrollPosition >= navOffset && !isNavFixed) { 2783 navEvent.style.position = "fixed"; 2784 navEvent.style.top = "0"; 2785 navEvent.style.right = "0"; 2786 navEvent.style.left = "0"; 2787 logoOnePage.style.display = "block"; 2788 isNavFixed = true; 2789 logoOnePage.classList.remove("hiddenOnePage"); 2790 if (windowWidth2 <= 1600) { 2791 navEvent.style.left = "initial"; 2792 navEvent.style.position = "fixed"; 2793 } 2794 } else if (scrollPosition < titlepageEvent.offsetHeight && isNavFixed) { 2795 navEvent.style.position = "static"; 2796 isNavFixed = false; 2797 logoOnePage.classList.add("hiddenOnePage"); 2798 updateStyle(); 2799 if (windowWidth2 <= 1600) { 2800 navEvent.style.position = "fixed"; 2801 navEvent.style.left = "initial"; 2802 } 2803 } 2804 } 2805 if (navEvent) { 2806 updateStyle(); 2807 window.addEventListener("resize", updateStyle); 2808 window.addEventListener("scroll", handleScroll); 2809 } 2810 const imgBG = document.querySelector(".parallax-image"); 2811 const blocBg = document.querySelector(".bloc-bg"); 2812 if (imgBG && blocBg) { 2813 let urlBg = imgBG.getAttribute("src"); 2814 blocBg.style.background = 'url("' + urlBg + '")'; 2815 blocBg.style.backgroundAttachment = "fixed"; 2816 blocBg.style.backgroundSize = "100%"; 2817 imgBG.classList.toggle("hiddenImgBg"); 2818 } 2819 const menuButtonEvent = document.querySelector(".navEvent .btn-menu"); 2820 const menuCloseEvent = document.querySelector(".close-menu-theme"); 2821 const submenu3 = document.querySelector(".submenu3"); 2822 if (menuButtonEvent) { 2823 menuButtonEvent.addEventListener("click", function() { 2824 submenu3.classList.toggle("submenuVisibility"); 2825 }); 2826 } 2827 if (menuCloseEvent) { 2828 menuCloseEvent.addEventListener("click", function() { 2829 submenu3.classList.toggle("submenuVisibility"); 2830 }); 2831 } 2832 if (submenu3) { 2833 submenu3.querySelectorAll("ul li").forEach((element) => { 2834 const link = element.querySelector("a"); 2835 if (link && (link.hash.startsWith("#") || link.hash.startsWith("/#"))) { 2836 link.addEventListener("click", function() { 2837 submenu3.classList.toggle("submenuVisibility"); 2838 }); 2839 } 2840 }) 2841 } 2842 const submenu2Header = document.querySelector(".submenu2 .sub-header"); 2843 const elements = document.querySelectorAll(".submenu2 .content-container .list--desktop .child-mega-menu"); 2844 if (submenu2Header && elements && !isMobile) { 2845 const headerHeight = submenu2Header.offsetHeight;
2846 elements.forEach((element) => { 2847 if (element) { 2848 element.style.top = `${headerHeight}px`; 2849 const content = element.querySelector(".content"); 2850 content.addEventListener("scroll", () => { 2851 const mouse = content.querySelector(".mouse"); 2852 if (content.scrollTop > 0) { 2853 if (mouse) { 2854 mouse.classList.add("hidden"); 2855 } 2856 } else { 2857 if (mouse) { 2858 mouse.classList.remove("hidden"); 2859 } 2860 } 2861 }); 2862 } 2863 }); 2864 } 2865 const logoPageEvent = document.querySelector(".logo-event-website"); 2866 const logoPageNav = document.querySelector(".logo-event-navbar"); 2867 const barreNav = document.querySelector(".header-event"); 2868 document.querySelector(".container-banner-curved-eventpage"); 2869 const imgLeftOP = document.querySelector(".event_page .container-banner-curved-page .main-content .left"); 2870 if (barreNav) { 2871 if (logoPageEvent) { 2872 window.addEventListener("scroll", () => { 2873 if (window.scrollY > 0) { 2874 /*logoPageEvent.classList.add("navLogoHidden");*/ 2875 } 2876 barreNav.classList.remove("navScroll"); 2877 }); 2878 } else { 2879 barreNav.classList.add("navScroll"); 2880 } 2881 window.addEventListener("scroll", () => { 2882 const heightOfAlerts = getHeightOfVisibleElement(".alerts"); 2883 if (heightOfAlerts > 0) { 2884 barreNav.parentElement.style.top = ` ${heightOfAlerts}px`; 2885 } else if (heightOfAlerts < 0) { 2886 barreNav.parentElement.style.top = 0; 2887 } 2888 if (logoPageEvent) { 2889 if (window.scrollY > 0) { 2890 barreNav.classList.add("navScroll"); 2891 } 2892 } 2893 }); 2894 } 2895 const menuButtonEvent2 = document.querySelector(".navEvent2 .btn-menu"); 2896 if (menuButtonEvent2) { 2897 menuButtonEvent2.addEventListener("click", function() { 2898 submenu3.classList.toggle("submenuVisibility"); 2899 headerEvent.classList.toggle("scroll-fixed"); 2900 }); 2901 } 2902 const blocSubmenuItems = document.querySelectorAll(".bloc-submenu li"); 2903 if (blocSubmenuItems) { 2904 blocSubmenuItems.forEach((li) => { 2905 const submenuEvent = li.querySelector(".submenuEvent"); 2906 if (submenuEvent) { 2907 li.addEventListener("mouseenter", () => showSubmenu(li, submenuEvent)); 2908 li.addEventListener("mouseleave", () => hideSubmenu(li, submenuEvent)); 2909 li.addEventListener("keydown", (event) => { 2910 if (event.key === "Enter" || event.key === " ") { 2911 event.preventDefault(); 2912 showSubmenu(li, submenuEvent); 2913 } 2914 }); 2915 li.setAttribute("role", "menuitem"); 2916 submenuEvent.setAttribute("role", "menu"); 2917 submenuEvent.setAttribute("aria-hidden", "true"); 2918 const submenuLinks = submenuEvent.querySelectorAll(".container ul li a"); 2919 submenuLinks.forEach((link, index) => { 2920 link.addEventListener("keydown", (event) => { 2921 if (index === submenuLinks.length - 1 && event.key === "Tab") { 2922 hideSubmenu(li, submenuEvent); 2923 } else if (event.key === "Enter") { 2924 window.location.href = link.href; 2925 } 2926 }); 2927 }); 2928 } 2929 }); 2930 } 2931 const triggers = Array.from(document.querySelectorAll(".dropdown-trigger")); 2932 triggers.forEach((el, i) => { 2933 el.addEventListener("click", (e) => { 2934 let li = el.parentElement.parentElement; 2935 let subs = Array.from(li.children).filter((child) => child.classList.contains("dropdown-menu")); 2936 li.classList.toggle("active"); 2937 subs.forEach((sub, i2) => { 2938 sub.classList.toggle("visibility"); 2939 }); 2940 }); 2941 }); 2942 if (document.querySelector("body.event_page")) { 2943 const style2 = getComputedStyle(document.body); 2944 let color1 = style2.getPropertyValue("--color1"); 2945 color1 = color1.replace(/#/g, "%23"); 2946 const selectElements = document.querySelectorAll("select"); 2947 const dateBeginning = document.querySelector('input[id="dateBeginningEvent"]'); 2948 const dateEndEvent = document.querySelector('input[id="dateEndEvent"]'); 2949 selectElements.forEach((select) => { 2950 select.style.backgroundImage = `url('data:image/svg+xml,<svg fill="${color1}" xmlns="http://www.w3.org/2000/svg" width="15.862" height="12.441" viewBox="0 0 15.862 12.441"><path id="Icon_ionic-md-play" data-name="Icon ionic-md-play" d="M0,0V15.863L12.441,7.931Z" transform="translate(15.862) rotate(90)"/></svg>')`; 2951 }); 2952 if (dateBeginning) { 2953 dateBeginning.style.backgroundImage = `url('data:image/svg+xml,<svg fill="${color1}" xmlns="http://www.w3.org/2000/svg" width="15.862" height="12.441" viewBox="0 0 15.862 12.441"><path id="Icon_ionic-md-play" data-name="Icon ionic-md-play" d="M0,0V15.863L12.441,7.931Z" transform="translate(15.862) rotate(90)"/></svg>')`; 2954 } 2955 if (dateEndEvent) { 2956 dateEndEvent.style.backgroundImage = `url('data:image/svg+xml,<svg fill="${color1}" xmlns="http://www.w3.org/2000/svg" width="15.862" height="12.441" viewBox="0 0 15.862 12.441"><path id="Icon_ionic-md-play" data-name="Icon ionic-md-play" d="M0,0V15.863L12.441,7.931Z" transform="translate(15.862) rotate(90)"/></svg>')`; 2957 } 2958 } 2959 const elementsFs = document.querySelectorAll("*"); 2960 const decreaseBtns = document.querySelectorAll(".decrease-size"); 2961 const increaseBtns = document.querySelectorAll(".increase-size"); 2962 let fsZoom = 0; 2963 if (increaseBtns) { 2964 increaseBtns.forEach((btn, i) => { 2965 btn.addEventListener("click", (e) => { 2966 if (fsZoom < 8) { 2967 fsZoom++; 2968 adjustFontSize(elementsFs, 1, fsZoom); 2969 } 2970 }); 2971 }); 2972 } 2973 if (decreaseBtns) { 2974 decreaseBtns.forEach((btn, i) => { 2975 btn.addEventListener("click", (e) => { 2976 fsZoom--; 2977 adjustFontSize(elementsFs, -1, fsZoom); 2978 }); 2979 }); 2980 } 2981 const filtersAccordion = document.querySelector(".form2.form-accordion"); 2982 if (filtersAccordion && isMobile) { 2983 const btnTrigger = filtersAccordion.querySelector(".btn-form-container"); 2984 const formContainer = filtersAccordion.querySelector(".form-container"); 2985 if (btnTrigger && formContainer) { 2986 const spanTrigger = btnTrigger.querySelector("span"); 2987 let open = false;
2988 btnTrigger.addEventListener("click", function(e) { 2989 e.preventDefault(); 2990 if (open) { 2991 formContainer.style.height = "0"; 2992 formContainer.style.padding = "0"; 2993 if (spanTrigger) { 2994 spanTrigger.innerText = "..."; 2995 } 2996 } else { 2997 formContainer.style.height = "auto"; 2998 formContainer.style.padding = "25px 10px"; 2999 if (spanTrigger) { 3000 spanTrigger.innerText = "X"; 3001 } 3002 } 3003 open = !open; 3004 }); 3005 } 3006 } 3007 const quickAccessMobile = document.querySelector(".quick-access-component--mobile .right-links-trigger button"); 3008 if (quickAccessMobile && rightLinks) { 3009 let open = false; 3010 quickAccessMobile.addEventListener("click", function(e) { 3011 if (open) { 3012 rightLinks.style.height = "0"; 3013 rightLinks.style.padding = "0"; 3014 } else { 3015 rightLinks.style.height = "auto"; 3016 rightLinks.style.padding = "15px 0"; 3017 } 3018 open = !open; 3019 }); 3020 } 3021 const fluxRss = document.querySelector(".flux-rss"); 3022 if (fluxRss) { 3023 const rssContainer = fluxRss.querySelector(".rss-container"); 3024 if (rssContainer) { 3025 const itemsContainer = rssContainer.querySelector(".items"); 3026 const items = rssContainer.querySelectorAll(".item"); 3027 const rssNavigation = rssContainer.querySelector(".swiper-navigation"); 3028 if (items.length > 0 && rssNavigation) { 3029 let index = 0; 3030 const widthToSlide = items[0].clientWidth; 3031 const prev = rssNavigation.querySelector(".swiper-prev"); 3032 const next = rssNavigation.querySelector(".swiper-next"); 3033 const updateVisibleItems = () => { 3034 items.forEach((item, i) => { 3035 if (i >= index && i < index + 2) { 3036 item.classList.add("--bordered"); 3037 } else { 3038 item.classList.remove("--bordered"); 3039 } 3040 }); 3041 }; 3042 updateVisibleItems(); 3043 if (prev) { 3044 prev.addEventListener("click", () => { 3045 if (index > 0) { 3046 index--; 3047 itemsContainer.scrollBy({ 3048 left: -widthToSlide, 3049 behavior: "smooth" 3050 }); 3051 updateVisibleItems(); 3052 } 3053 }); 3054 } 3055 if (next) { 3056 next.addEventListener("click", () => { 3057 if (index < items.length - 3) { 3058 index++; 3059 itemsContainer.scrollBy({ 3060 left: widthToSlide, 3061 behavior: "smooth" 3062 }); 3063 updateVisibleItems(); 3064 } 3065 }); 3066 } 3067 } 3068 } 3069 } 3070 const siteMap = document.querySelector("ul.sitemap"); 3071 if (siteMap) { 3072 const triggersSiteMap = siteMap.querySelectorAll(".sitemap-accordion"); 3073 triggersSiteMap.forEach((el, i) => { 3074 el.addEventListener("click", (e) => { 3075 el.closest("li").classList.toggle("active"); 3076 let nextElement = el.nextElementSibling; 3077 if (nextElement) { 3078 nextElement.classList.toggle("hidden-element"); 3079 const stateHidden = nextElement.getAttribute("aria-hidden"); 3080 const isHidden = stateHidden === "true"; 3081 nextElement.setAttribute("aria-hidden", !isHidden); 3082 } 3083 }); 3084 }); 3085 } 3086 const formApplication = document.querySelector(".form-application"); 3087 if (formApplication) { 3088 const dateFields = formApplication.querySelectorAll("input[type=date]"); 3089 dateFields.forEach((dateField) => { 3090 dateField.addEventListener("change", () => { 3091 if (dateField.value) { 3092 dateField.classList.add("filled"); 3093 } else { 3094 dateField.classList.remove("filled"); 3095 } 3096 }); 3097 }); 3098 } 3099 function posHeader() { 3100 const header = document.querySelector("header"); 3101 const heightOfAlerts = getHeightOfVisibleElement(".alerts"); 3102 if (heightOfAlerts > 0) { 3103 header.style.top = `${heightOfAlerts}px`; 3104 } else if (heightOfAlerts < 0) { 3105 header.style.top = 0; 3106 } 3107 } 3108 3109 function showSubmenu(li, submenuEvent) { 3110 bodyMenuOpen(true); 3111 li.classList.add("active"); 3112 if (imgLeftOP) { 3113 imgLeftOP.classList.add("hidden-left"); 3114 } 3115 submenuEvent.classList.add("submenuVisibility"); 3116 submenuEvent.setAttribute("aria-expanded", "true"); 3117 if (headerEvent) { 3118 headerEvent.classList.add("scroll-fixed"); 3119 } 3120 posHeader(); 3121 } 3122 function hideSubmenu(li, submenuEvent) { 3123 bodyMenuOpen(false); 3124 if (imgLeftOP) { 3125 imgLeftOP.classList.remove("hidden-left"); 3126 } 3127 li.classList.remove("active"); 3128 submenuEvent.classList.remove("submenuVisibility"); 3129 submenuEvent.setAttribute("aria-expanded", "false"); 3130 if (headerEvent && !headerEvent.classList.contains("sticky")) { 3131 headerEvent.classList.remove("scroll-fixed"); 3132 } 3133 posHeader(); 3134 } 3135 if (alertsBanner) { 3136 const subMenuThematic = document.querySelector(".header-event .navEvent2"); 3137 if (subMenuThematic) { 3138 posHeader(); 3139 } 3140 } 3141 const bannerEvent = document.querySelector(".container-banner-curved-eventpage"); 3142 if (headerEvent) { 3143 3144 const headerHeight = headerEvent.getBoundingClientRect().height; 3145 3146 let addScrollFixedClass2 = function() { 3147 posHeader(); 3148 if (window.scrollY > headerHeight) { 3149 headerEvent.classList.add("scroll-fixed"); 3150 } else { 3151 headerEvent.classList.remove("scroll-fixed"); 3152 } 3153 }; 3154 3155 var addScrollFixedClass = addScrollFixedClass2; 3156 window.addEventListener("scroll", addScrollFixedClass2); 3157 3158 if (bannerEvent) { 3159 bannerEvent.querySelector(".logo-img"); 3160 } 3161 } 3162 OpenAccordionAnchor(); 3163 moveMenuKeyboardiOS(isMobile); 3164 const modalOpenDefault = document.querySelector(".modal.open"); 3165 modalOpenDefault && trapFocusModal(modalOpenDefault); 3166 const figures = document.querySelectorAll(".ce-textpic:not(.ce-center) figure");
3167 figures.forEach((figure) => { 3168 const img = figure.querySelector("img"); 3169 if (img) { 3170 const setMaxWidth = () => { 3171 if (img.naturalWidth > 0) { 3172 figure.style.maxWidth = img.naturalWidth + "px"; 3173 } else { 3174 setTimeout(setMaxWidth, 100); 3175 } 3176 }; 3177 img.addEventListener("load", setMaxWidth); 3178 if (img.complete) { 3179 img.dispatchEvent(new Event("load")); 3180 } 3181 } 3182 }); 3183 const loginBoxes = document.querySelectorAll(".loginBox"); 3184 loginBoxes.forEach((loginBox) => { 3185 const buttonAccount = loginBox.querySelector(".my-account"); 3186 const submenuAccount = loginBox.querySelector(".account-submenu"); 3187 if (buttonAccount && submenuAccount) { 3188 buttonAccount.addEventListener("click", function() { 3189 submenuAccount.classList.toggle("account-submenu-visible"); 3190 buttonAccount.classList.toggle("is-active"); 3191 }); 3192 } 3193 }); 3194 if (document.querySelector("#form-payment")) { 3195 let validateOnlyNumberInput2 = function(event) { 3196 event.target; 3197 const keyPressed = String.fromCharCode(event.which || event.keyCode); 3198 const isNumber = /^\d$/.test(keyPressed); 3199 if (!isNumber) { 3200 event.preventDefault(); 3201 } 3202 }, validateMaxLength2 = function(event) { 3203 const input = event.target; 3204 const maxLength = input.getAttribute("maxlength"); 3205 const currentLength = input.value.length; 3206 if (maxLength && currentLength > maxLength) { 3207 input.value = input.value.slice(0, maxLength); 3208 } 3209 }, validateInput2 = function(input) { 3210 const maxLength = input.getAttribute("maxlength"); 3211 const minLength = input.getAttribute("minLength"); 3212 const currentLength = input.value.length; 3213 if (maxLength && currentLength === parseInt(maxLength) || minLength && currentLength === parseInt(minLength)) { 3214 input.classList.add("valid"); 3215 input.classList.remove("error"); 3216 input.style.border = "2px solid green"; 3217 focusNextInput2(input); 3218 updateHiddenInput2(input.closest(".field-container-autocomplete")); 3219 } else { 3220 input.classList.add("error"); 3221 input.classList.remove("valid"); 3222 input.style.border = "2px solid #A51E00"; 3223 } 3224 }, focusNextInput2 = function(currentInput) { 3225 const inputs = currentInput.closest(".field-container-autocomplete").querySelectorAll('input[type="text"]'); 3226 for (let i = 0; i < inputs.length; i++) { 3227 if (inputs[i] === currentInput && inputs[i + 1]) { 3228 inputs[i + 1].focus(); 3229 break; 3230 } 3231 } 3232 }, updateHiddenInput2 = function(container) { 3233 const inputs = container.querySelectorAll('input[type="text"]'); 3234 const hiddenInput = container.querySelector(".invoice-reference"); 3235 let allValid = true; 3236 let values = []; 3237 inputs.forEach((input) => { 3238 if (!input.classList.contains("valid")) { 3239 allValid = false; 3240 } 3241 values.push(input.value); 3242 }); 3243 if (allValid) { 3244 hiddenInput.value = values.join("-"); 3245 } else { 3246 hiddenInput.value = ""; 3247 } 3248 }; 3249 var validateOnlyNumberInput = validateOnlyNumberInput2, validateMaxLength = validateMaxLength2, validateInput = validateInput2, focusNextInput = focusNextInput2, updateHiddenInput = updateHiddenInput2; 3250 document.querySelectorAll(".field-container-autocomplete").forEach((container) => { 3251 const inputs = container.querySelectorAll('input[type="text"]'); 3252 inputs.forEach((input) => { 3253 if (input.classList.contains("only-number")) { 3254 input.addEventListener("keypress", validateOnlyNumberInput2); 3255 input.addEventListener("input", validateMaxLength2); 3256 } 3257 input.addEventListener("input", function() { 3258 validateInput2(this); 3259 }); 3260 }); 3261 }); 3262 } 3263 const button = document.querySelector('.breadcrumb button'); 3264 const breadcrumbContainer = document.querySelector('.container--collapse'); 3265 3266 if (button && breadcrumbContainer) { 3267 button.addEventListener("click", function () { 3268 breadcrumbContainer.classList.toggle("container--collapse-expanded"); 3269 3270 const isExpanded = button.getAttribute("aria-expanded") === "true"; 3271 button.setAttribute("aria-expanded", !isExpanded); 3272 }); 3273 } 3274 3275}); 3276function moveMenuKeyboardiOS(isMobile) { 3277 if (isMobile) { 3278 const submenu2Mobile = document.querySelector(".submenu2.bg-lighterGrey"); 3279 if (submenu2Mobile) { 3280 let adjustPaddingBottom2 = function(adjust) { 3281 if (adjust) {
3282 const keyboardHeight = window.innerHeight / 2; 3283 content.style.paddingBottom = `${keyboardHeight}px`; 3284 searchField.scrollIntoView({ behavior: "smooth", block: "center" }); 3285 } else { 3286 content.style.paddingBottom = "0"; 3287 } 3288 }; 3289 const content = submenu2Mobile.querySelector(".list-mega-menu"); 3290 const searchField = content.querySelector(".search-field input"); 3291 searchField.addEventListener("focus", () => adjustPaddingBottom2(true)); 3292 searchField.addEventListener("blur", () => adjustPaddingBottom2(false)); 3293 } 3294 } 3295} 3296function OpenAccordionAnchor() { 3297 if (window.location.hash) { 3298 const targetId = window.location.hash.substring(1); 3299 const targetElement = document.getElementById(targetId); 3300 let parent = document.getElementById(targetId); 3301 while (parent && parent.tagName !== "BODY") { 3302 if (parent.classList.contains("accordion")) { 3303 const accordionButton = parent.querySelector(":scope > button"); 3304 if (accordionButton) { 3305 accordionButton.click(); 3306 setTimeout(function() { 3307 targetElement.scrollIntoView({ behavior: "smooth" }); 3308 }, 300); 3309 } 3310 break; 3311 } 3312 parent = parent.parentElement; 3313 } 3314 } 3315} 3316function adjustFontSize(elements, amount, fsZoom) { 3317 const decreaseBtns = document.querySelectorAll(".decrease-size"); 3318 if (fsZoom && decreaseBtns) { 3319 decreaseBtns.forEach((btn, i) => { 3320 btn.classList.remove("hidden"); 3321 }); 3322 } else { 3323 decreaseBtns.forEach((btn, i) => { 3324 btn.classList.add("hidden"); 3325 }); 3326 } 3327 elements.forEach(function(element) { 3328 const currentSize = window.getComputedStyle(element).fontSize; 3329 element.style.fontSize = parseFloat(currentSize) + amount + "px"; 3330 }); 3331} 3332function getHeightOfVisibleElement(selector) { 3333 const element = document.querySelector(selector); 3334 if (!element) { 3335 return 0; 3336 } 3337 const elementRect = element.getBoundingClientRect(); 3338 const windowHeight = window.innerHeight || document.documentElement.clientHeight; 3339 const elementTop = Math.max(elementRect.top, 0); 3340 const elementBottom = Math.min(elementRect.bottom, windowHeight); 3341 return elementBottom - elementTop; 3342} 3343function trapFocusModal(element) { 3344 const focusableEls = element.querySelectorAll('a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input[type="text"]:not([disabled]), input[type="radio"]:not([disabled]), input[type="checkbox"]:not([disabled]), select:not([disabled])'); 3345 const firstFocusableEl = focusableEls[0]; 3346 const lastFocusableEl = focusableEls[focusableEls.length - 1]; 3347 const KEYCODE_TAB = 9; 3348 const inputFocus = element.querySelector("input#locationUser"); 3349 inputFocus && inputFocus.focus(); 3350 element.addEventListener("keydown", function(e) { 3351 if (e.key !== "Tab" && e.keyCode !== KEYCODE_TAB) 3352 return; 3353 if (e.shiftKey) { 3354 if (document.activeElement === firstFocusableEl) {
3355 lastFocusableEl.focus(); 3356 e.preventDefault(); 3357 } 3358 } else { 3359 if (document.activeElement === lastFocusableEl) { 3360 firstFocusableEl.focus(); 3361 e.preventDefault(); 3362 } 3363 } 3364 }); 3365} 3366function supportsSmoothScroll() { 3367 const isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0; 3368 const isChrome = navigator.userAgent.includes('Chrome') && !navigator.userAgent.includes('Edg'); 3369 return !(isMac && isChrome); 3370} 3371 3372document.addEventListener("DOMContentLoaded", () => { 3373 const socialLinks = document.querySelectorAll("header .social-links li a"); 3374 const btnMenu = document.querySelector("header .btn-menu"); 3375 3376 if (socialLinks.length && btnMenu) { 3377 const lastSocialLink = socialLinks[socialLinks.length - 1]; 3378 3379 const lastLink = socialLinks[socialLinks.length - 1]; 3380 3381 lastLink.addEventListener("focusout", function (event) { 3382 if (!event.relatedTarget || !event.relatedTarget.closest(".social-links")) { 3383 btnMenu.click(); 3384 } 3385 }); 3386 } 3387 3388 const megaMenu = document.querySelector(".list-mega-menu"); 3389 3390 if (megaMenu) { 3391 const childMenus = megaMenu.querySelectorAll(".child-mega-menu"); 3392 3393 childMenus.forEach((childMenu) => { 3394 const focusableElements = childMenu.querySelectorAll( 3395 'a, button, input, [tabindex]:not([tabindex="-1"])' 3396 ); 3397 3398 if (focusableElements.length) { 3399 const lastFocusable = focusableElements[focusableElements.length - 1]; 3400 3401 lastFocusable.addEventListener("focusout", (event) => { 3402 const nextFocusedElement = event.relatedTarget; 3403 3404 if (!nextFocusedElement || !childMenu.contains(nextFocusedElement)) { 3405 const parentLi = childMenu.closest("li"); 3406 const relatedButton = parentLi?.querySelector("button.item"); 3407 3408 if (relatedButton) { 3409 relatedButton.click(); 3410 } 3411 } 3412 }); 3413 } 3414 }); 3415 } 3416}); 3417 3418 3419document.addEventListener("DOMContentLoaded", function(event) { 3420 let alertsBanner = document.querySelector(".alerts"); 3421 if (alertsBanner) { 3422 let buttonClose = document.querySelectorAll('button.js--close-alerts'); 3423 buttonClose.forEach(function (button) { 3424 button.addEventListener("click", function (event) { 3425 let idAlert = button.dataset.idClose; 3426 fetch("/?type=1689020562", { 3427 method: "POST", 3428 body: JSON.stringify({ 3429 id: idAlert 3430 }), 3431 headers: { 3432 "Content-type": "application/json; charset=UTF-8" 3433 } 3434 }) 3435 .then((response) => { 3436 return response.json(); 3437 }) 3438 .then((data) => { 3439 if (data.success === true) { 3440 let containerItems = document.querySelector(".alerts .items"); 3441 let alert = document.querySelector('.alerts .items .item[data-target-id="' + idAlert + '"]'); 3442 let dot = document.querySelector('.alerts .dots button[data-id="' + idAlert + '"]'); 3443 if (alert && dot) { 3444 alert.parentNode.removeChild(alert); 3445 dot.parentNode.removeChild(dot); 3446 const currentDots = document.querySelectorAll(".alerts .dots button"); 3447 if (currentDots.length) { 3448 currentDots[0].classList.add("active"); 3449 containerItems.scrollTo({ 3450 top: 0, 3451 behavior: "smooth" 3452 }); 3453 this.dataset.idClose = currentDots[0].dataset.id; 3454 } else { 3455 alertsBanner.parentNode.removeChild(alertsBanner); 3456 //Adjust pos of thematic header 3457 if(document.querySelector('.header-event .navEvent2')) { 3458 document.querySelector('.header-event .navEvent2').style.top = '0'; 3459 document.querySelector('.header-event').style.top = '0'; 3460 } 3461 } 3462 } 3463 } 3464 }) 3465 .catch(err => { 3466 3467 }); 3468 }); 3469 }); 3470 } 3471}); 3472 3473function scroolToElement(el) 3474{ 3475 const yOffset = -80; 3476 const y = el.getBoundingClientRect().top + window.scrollY + yOffset; 3477 window.scrollTo({top: y, behavior: 'smooth'}); 3478} 3479 3480function showElement(el) 3481{ 3482 //@TODO : Changer la fonction quand le composant sera accessible 3483 el.classList.add('visible'); 3484} 3485 3486document.addEventListener("DOMContentLoaded", function (event) { 3487 3488 let queryString = window.location.search; 3489 let hash = window.location.hash;
3490 let urlParams = new URLSearchParams(queryString); 3491 let isPerform = false; 3492 3493 urlParams.forEach(function (param, key) { 3494 if (param === 'perform' && key.indexOf('[action]')) { 3495 isPerform = true; 3496 return; 3497 } 3498 }); 3499 3500 if (isPerform && hash) { 3501 let element = document.querySelector(hash); 3502 if (element !== null) { 3503 showElement(element.parentElement); 3504 scroolToElement(element); 3505 } 3506 } 3507 3508 3509});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.