(t=>{if(!t)return;const{currency:e,products:o,purchase:a,add_to_cart:i,eventsToTrack:n}=globalThis._googlesitekit?.wcdata||{},c=n?.includes("add_to_cart"),r=n?.includes("purchase");if(i&&c){const{price:t}=i,o=d(t,e,i);globalThis._googlesitekit?.gtagEvent?.("add_to_cart",o)}if(a&&r){const{id:t,totals:e,items:o,user_data:i}=a,n=d(e.total_price,e.currency_code,o,t,e.shipping_total,e.tax_total);globalThis._googlesitekit?.gtagUserData&&i&&(n.user_data=i),globalThis._googlesitekit?.gtagEvent?.("purchase",n)}const s=t("body");function d(t,e,o){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;const c={value:u(t),currency:e,items:[]};if(a&&(c.transaction_id=a),"number"==typeof i&&(c.shipping=i),"number"==typeof n&&(c.tax=n),o&&o.length)for(const t of o)c.items.push(l(t));else o&&o.id&&(c.items=[l(o)]);return c}function l(t){const{id:e,name:o,price:a,variation:i,quantity:n,categories:c}=t,r={item_id:e,item_name:o,price:u(a)};if(n&&(r.quantity=n),i&&(r.item_variant=i),c&&c?.length){let t=1;for(const e of c)r[t>1?`item_category${t}`:"item_category"]=e.name,t++}return r}function u(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return parseInt(t,10)/10**e}c&&(s.on("added_to_cart",(t,a,i,n)=>{if(!n?.jquery)return;const c=parseInt(n.data("product_id"),10);if(!c)return;const r=o?.find(t=>t?.id===c)||{},{price:s}=r,l=d(s,e,r);globalThis._googlesitekit?.gtagEvent?.("add_to_cart",l)}),t(".products-block-post-template .product, .wc-block-product-template .product").each(function(){const a=t(this),i=parseInt(a.find("[data-product_id]").attr("data-product_id"),10);i&&a.on("click",a=>{const n=t(a.target).closest(".wc-block-components-product-button [data-product_id]");if(!n.length||!n.hasClass("add_to_cart_button")||n.hasClass("product_type_variable"))return;const c=o?.find(t=>t?.id===i)||{},{price:r}=c,s=d(r,e,c);globalThis._googlesitekit?.gtagEvent?.("add_to_cart",s)})}))})(globalThis.jQuery);
;(
function(window, $, undefined){
;
(
function(){
var VERSION='2.2.3',
pluginName='wpcdpk',
autoInitSelector='.wpcdpk-here',
$body, $wpcdpksContainer,
containerBuilt=false,
baseTemplate='' +
'<div class="wpcdpk">' +
'<i class="wpcdpk--pointer"></i>' +
'<nav class="wpcdpk--nav"></nav>' +
'<div class="wpcdpk--content"></div>' +
'</div>',
defaults={
classes: '',
inline: false,
language: 'en',
startDate: new Date(),
firstDay: '',
weekends: [6, 0],
dateFormat: '',
altField: '',
altFieldDateFormat: '@',
toggleSelected: true,
keyboardNav: true,
position: 'bottom left',
offset: 12,
view: 'days',
minView: 'days',
showOtherMonths: true,
selectOtherMonths: true,
moveToOtherMonthsOnSelect: true,
showOtherYears: true,
selectOtherYears: true,
moveToOtherYearsOnSelect: true,
minDate: '',
maxDate: '',
disableNavWhenOutOfRange: true,
multipleDates: false,
multipleDatesSeparator: ',',
range: false,
todayButton: false,
clearButton: false,
showEvent: 'focus',
autoClose: false,
monthsField: 'monthsShort',
prevHtml: '<svg><path d="M 17,12 l -5,5 l 5,5"></path></svg>',
nextHtml: '<svg><path d="M 14,12 l 5,5 l -5,5"></path></svg>',
navTitles: {
days: 'MM, <i>yyyy</i>',
months: 'yyyy',
years: 'yyyy1 - yyyy2',
},
timepicker: false,
onlyTimepicker: false,
dateTimeSeparator: ' ',
timeFormat: '',
minHours: 0,
maxHours: 24,
minMinutes: 0,
maxMinutes: 59,
hoursStep: 1,
minutesStep: 1,
onSelect: '',
onShow: '',
onHide: '',
onChangeMonth: '',
onChangeYear: '',
onChangeDecade: '',
onChangeView: '',
onRenderCell: '',
},
hotKeys={
'ctrlRight': [17, 39],
'ctrlUp': [17, 38],
'ctrlLeft': [17, 37],
'ctrlDown': [17, 40],
'shiftRight': [16, 39],
'shiftUp': [16, 38],
'shiftLeft': [16, 37],
'shiftDown': [16, 40],
'altUp': [18, 38],
'altRight': [18, 39],
'altLeft': [18, 37],
'altDown': [18, 40],
'ctrlShiftUp': [16, 17, 38],
},
wpcdpk;
var Wpcdpk=function(el, options){
this.el=el;
this.$el=$(el);
this.opts=$.extend(true, {}, defaults, options,
this.$el.data());
if($body==undefined){
$body=$('body');
}
if(!this.opts.startDate){
this.opts.startDate=new Date();
}
if(this.el.nodeName=='INPUT'){
this.elIsInput=true;
}
if(this.opts.altField){
this.$altField=typeof this.opts.altField=='string' ?
$(this.opts.altField) :
this.opts.altField;
}
this.inited=false;
this.visible=false;
this.silent=false;
this.currentDate=this.opts.startDate;
this.currentView=this.opts.view;
this._createShortCuts();
this.selectedDates=[];
this.views={};
this.keys=[];
this.minRange='';
this.maxRange='';
this._prevOnSelectValue='';
this.init();
};
wpcdpk=Wpcdpk;
wpcdpk.prototype={
VERSION: VERSION,
viewIndexes: ['days', 'months', 'years'],
init: function(){
if(!containerBuilt&&!this.opts.inline&&this.elIsInput){
this._buildWpcdpksContainer();
}
this._buildBaseHtml();
this._defineLocale(this.opts.language);
this._syncWithMinMaxDates();
if(this.elIsInput){
if(!this.opts.inline){
this._setPositionClasses(this.opts.position);
this._bindEvents();
}
if(this.opts.keyboardNav&&!this.opts.onlyTimepicker){
this._bindKeyboardEvents();
}
this.$wpcdpk.on('mousedown',
this._onMouseDownWpcdpk.bind(this));
this.$wpcdpk.on('mouseup',
this._onMouseUpWpcdpk.bind(this));
}
if(this.opts.classes){
this.$wpcdpk.addClass(this.opts.classes);
}
if(this.opts.timepicker){
this.timepicker=new $.fn.wpcdpk.Timepicker(this, this.opts);
this._bindTimepickerEvents();
}
if(this.opts.onlyTimepicker){
this.$wpcdpk.addClass('-only-timepicker-');
}
this.views[this.currentView]=new $.fn.wpcdpk.Body(this,
this.currentView, this.opts);
this.views[this.currentView].show();
this.nav=new $.fn.wpcdpk.Navigation(this, this.opts);
this.view=this.currentView;
this.$el.on('clickCell.adp', this._onClickCell.bind(this));
this.$wpcdpk.on('mouseenter', '.wpcdpk--cell',
this._onMouseEnterCell.bind(this));
this.$wpcdpk.on('mouseleave', '.wpcdpk--cell',
this._onMouseLeaveCell.bind(this));
this.inited=true;
},
_createShortCuts: function(){
this.minDate=this.opts.minDate ?
this.opts.minDate :
new Date(-8639999913600000);
this.maxDate=this.opts.maxDate ?
this.opts.maxDate :
new Date(8639999913600000);
},
_bindEvents: function(){
this.$el.on(this.opts.showEvent + '.adp',
this._onShowEvent.bind(this));
this.$el.on('mouseup.adp', this._onMouseUpEl.bind(this));
this.$el.on('blur.adp', this._onBlur.bind(this));
this.$el.on('keyup.adp', this._onKeyUpGeneral.bind(this));
$(window).on('resize.adp', this._onResize.bind(this));
$('body').on('mouseup.adp', this._onMouseUpBody.bind(this));
},
_bindKeyboardEvents: function(){
this.$el.on('keydown.adp', this._onKeyDown.bind(this));
this.$el.on('keyup.adp', this._onKeyUp.bind(this));
this.$el.on('hotKey.adp', this._onHotKey.bind(this));
},
_bindTimepickerEvents: function(){
this.$el.on('timeChange.adp', this._onTimeChange.bind(this));
},
isWeekend: function(day){
return this.opts.weekends.indexOf(day)!==-1;
},
_defineLocale: function(lang){
if(typeof lang=='string'){
this.loc=$.fn.wpcdpk.language[lang];
if(!this.loc){
console.warn('Can\'t find language "' + lang +
'" in Wpcdpk.language, will use "ru" instead');
this.loc=$.extend(true, {}, $.fn.wpcdpk.language.ru);
}
this.loc=$.extend(true, {}, $.fn.wpcdpk.language.ru,
$.fn.wpcdpk.language[lang]);
}else{
this.loc=$.extend(true, {}, $.fn.wpcdpk.language.ru, lang);
}
if(this.opts.dateFormat){
this.loc.dateFormat=this.opts.dateFormat;
}
if(this.opts.timeFormat){
this.loc.timeFormat=this.opts.timeFormat;
}
if(this.opts.firstDay!==''){
this.loc.firstDay=this.opts.firstDay;
}
if(this.opts.timepicker){
this.loc.dateFormat=[
this.loc.dateFormat,
this.loc.timeFormat,
].join(this.opts.dateTimeSeparator);
}
if(this.opts.onlyTimepicker){
this.loc.dateFormat=this.loc.timeFormat;
}
var boundary=this._getWordBoundaryRegExp;
if(this.loc.timeFormat.match(boundary('aa')) ||
this.loc.timeFormat.match(boundary('AA'))
){
this.ampm=true;
}},
_buildWpcdpksContainer: function(){
containerBuilt=true;
$body.append('<div class="wpcdpks-container" id="wpcdpks-container"></div>');
$wpcdpksContainer=$('#wpcdpks-container');
},
_buildBaseHtml: function(){
var $appendTarget,
$inline=$('<div class="wpcdpk-inline">');
if(this.el.nodeName=='INPUT'){
if(!this.opts.inline){
$appendTarget=$wpcdpksContainer;
}else{
$appendTarget=$inline.insertAfter(this.$el);
}}else{
$appendTarget=$inline.appendTo(this.$el);
}
this.$wpcdpk=$(baseTemplate).appendTo($appendTarget);
this.$content=$('.wpcdpk--content', this.$wpcdpk);
this.$nav=$('.wpcdpk--nav', this.$wpcdpk);
},
_triggerOnChange: function(){
if(!this.selectedDates.length){
if(this._prevOnSelectValue===''){
return;
}
this._prevOnSelectValue='';
return this.opts.onSelect('', '', this);
}
var selectedDates=this.selectedDates,
parsedSelected=wpcdpk.getParsedDate(selectedDates[0]),
formattedDates,
_this=this,
dates=new Date(
parsedSelected.year,
parsedSelected.month,
parsedSelected.date,
parsedSelected.hours,
parsedSelected.minutes,
);
formattedDates=selectedDates.map(function(date){
return _this.formatDate(_this.loc.dateFormat, date);
}).join(this.opts.multipleDatesSeparator);
if(this.opts.multipleDates||this.opts.range){
dates=selectedDates.map(function(date){
var parsedDate=wpcdpk.getParsedDate(date);
return new Date(
parsedDate.year,
parsedDate.month,
parsedDate.date,
parsedDate.hours,
parsedDate.minutes,
);
});
}
this._prevOnSelectValue=formattedDates;
this.opts.onSelect(formattedDates, dates, this);
},
next: function(){
var d=this.parsedDate,
o=this.opts;
switch (this.view){
case 'days':
this.date=new Date(d.year, d.month + 1, 1);
if(o.onChangeMonth){
o.onChangeMonth(this.parsedDate.month,
this.parsedDate.year);
}
break;
case 'months':
this.date=new Date(d.year + 1, d.month, 1);
if(o.onChangeYear){
o.onChangeYear(this.parsedDate.year);
}
break;
case 'years':
this.date=new Date(d.year + 10, 0, 1);
if(o.onChangeDecade){
o.onChangeDecade(this.curDecade);
}
break;
}},
prev: function(){
var d=this.parsedDate,
o=this.opts;
switch (this.view){
case 'days':
this.date=new Date(d.year, d.month - 1, 1);
if(o.onChangeMonth){
o.onChangeMonth(this.parsedDate.month,
this.parsedDate.year);
}
break;
case 'months':
this.date=new Date(d.year - 1, d.month, 1);
if(o.onChangeYear){
o.onChangeYear(this.parsedDate.year);
}
break;
case 'years':
this.date=new Date(d.year - 10, 0, 1);
if(o.onChangeDecade){
o.onChangeDecade(this.curDecade);
}
break;
}},
formatDate: function(string, date){
date=date||this.date;
var result=string,
boundary=this._getWordBoundaryRegExp,
locale=this.loc,
leadingZero=wpcdpk.getLeadingZeroNum,
decade=wpcdpk.getDecade(date),
d=wpcdpk.getParsedDate(date),
fullHours=d.fullHours,
hours=d.hours,
ampm=string.match(boundary('aa')) ||
string.match(boundary('AA')),
dayPeriod='am',
replacer=this._replacer,
validHours;
if(this.opts.timepicker&&this.timepicker&&ampm){
validHours=this.timepicker._getValidHoursFromDate(date,
ampm);
fullHours=leadingZero(validHours.hours);
hours=validHours.hours;
dayPeriod=validHours.dayPeriod;
}
switch (true){
case /@/.test(result):
result=result.replace(/@/, date.getTime());
case /aa/.test(result):
result=replacer(result, boundary('aa'), dayPeriod);
case /AA/.test(result):
result=replacer(result, boundary('AA'),
dayPeriod.toUpperCase());
case /dd/.test(result):
result=replacer(result, boundary('dd'), d.fullDate);
case /d/.test(result):
result=replacer(result, boundary('d'), d.date);
case /DD/.test(result):
result=replacer(result, boundary('DD'),
locale.days[d.day]);
case /D/.test(result):
result=replacer(result, boundary('D'),
locale.daysShort[d.day]);
case /mm/.test(result):
result=replacer(result, boundary('mm'), d.fullMonth);
case /m/.test(result):
result=replacer(result, boundary('m'), d.month + 1);
case /MM/.test(result):
result=replacer(result, boundary('MM'),
this.loc.months[d.month]);
case /M/.test(result):
result=replacer(result, boundary('M'),
locale.monthsShort[d.month]);
case /ii/.test(result):
result=replacer(result, boundary('ii'), d.fullMinutes);
case /i/.test(result):
result=replacer(result, boundary('i'), d.minutes);
case /hh/.test(result):
result=replacer(result, boundary('hh'), fullHours);
case /h/.test(result):
result=replacer(result, boundary('h'), hours);
case /yyyy/.test(result):
result=replacer(result, boundary('yyyy'), d.year);
case /yyyy1/.test(result):
result=replacer(result, boundary('yyyy1'), decade[0]);
case /yyyy2/.test(result):
result=replacer(result, boundary('yyyy2'), decade[1]);
case /yy/.test(result):
result=replacer(result, boundary('yy'),
d.year.toString().slice(-2));
}
return result;
},
_replacer: function(str, reg, data){
return str.replace(reg, function(match, p1, p2, p3){
return p1 + data + p3;
});
},
_getWordBoundaryRegExp: function(sign){
var symbols='\\s|\\.|-|/|\\\\|,|\\$|\\!|\\?|:|;';
return new RegExp(
'(^|>|' + symbols + ')(' + sign + ')($|<|' + symbols + ')',
'g');
},
selectDate: function(date){
var _this=this,
opts=_this.opts,
d=_this.parsedDate,
selectedDates=_this.selectedDates,
len=selectedDates.length,
newDate='';
if(Array.isArray(date)){
date.forEach(function(d){
_this.selectDate(d);
});
return;
}
if(!(
date instanceof Date
)){
return;
}
this.lastSelectedDate=date;
if(this.timepicker){
this.timepicker._setTime(date);
}
_this._trigger('selectDate', date);
if(this.timepicker){
date.setHours(this.timepicker.hours);
date.setMinutes(this.timepicker.minutes);
}
if(_this.view=='days'){
if(date.getMonth()!=d.month &&
opts.moveToOtherMonthsOnSelect){
newDate=new Date(date.getFullYear(), date.getMonth(), 1);
}}
if(_this.view=='years'){
if(date.getFullYear()!=d.year &&
opts.moveToOtherYearsOnSelect){
newDate=new Date(date.getFullYear(), 0, 1);
}}
if(newDate){
_this.silent=true;
_this.date=newDate;
_this.silent=false;
_this.nav._render();
}
if(opts.multipleDates&&!opts.range){
if(len===opts.multipleDates){
return;
}
if(!_this._isSelected(date)){
_this.selectedDates.push(date);
}}else if(opts.range){
if(len==2){
_this.selectedDates=[date];
_this.minRange=date;
_this.maxRange='';
}else if(len==1){
_this.selectedDates.push(date);
if(!_this.maxRange){
_this.maxRange=date;
}else{
_this.minRange=date;
}
if(wpcdpk.bigger(_this.maxRange, _this.minRange)){
_this.maxRange=_this.minRange;
_this.minRange=date;
}
_this.selectedDates=[_this.minRange, _this.maxRange];
}else{
_this.selectedDates=[date];
_this.minRange=date;
}}else{
_this.selectedDates=[date];
}
_this._setInputValue();
if(opts.onSelect){
_this._triggerOnChange();
}
if(opts.autoClose&&!this.timepickerIsActive){
if(!opts.multipleDates&&!opts.range){
_this.hide();
}else if(opts.range&&_this.selectedDates.length==2){
_this.hide();
}}
_this.views[this.currentView]._render();
},
removeDate: function(date){
var selected=this.selectedDates,
_this=this;
if(!(
date instanceof Date
)){
return;
}
return selected.some(function(curDate, i){
if(wpcdpk.isSame(curDate, date)){
selected.splice(i, 1);
if(!_this.selectedDates.length){
_this.minRange='';
_this.maxRange='';
_this.lastSelectedDate='';
}else{
_this.lastSelectedDate=_this.selectedDates[_this.selectedDates.length -
1];
}
_this.views[_this.currentView]._render();
_this._setInputValue();
if(_this.opts.onSelect){
_this._triggerOnChange();
}
return true;
}});
},
today: function(){
this.silent=true;
this.view=this.opts.minView;
this.silent=false;
this.date=new Date();
if(this.opts.todayButton instanceof Date){
this.selectDate(this.opts.todayButton);
}},
clear: function(){
this.selectedDates=[];
this.minRange='';
this.maxRange='';
this.views[this.currentView]._render();
this._setInputValue();
if(this.opts.onSelect){
this._triggerOnChange();
}},
update: function(param, value){
var len=arguments.length,
lastSelectedDate=this.lastSelectedDate;
if(len==2){
this.opts[param]=value;
}else if(len==1&&typeof param=='object'){
this.opts=$.extend(true, this.opts, param);
}
this._createShortCuts();
this._syncWithMinMaxDates();
this._defineLocale(this.opts.language);
this.nav._addButtonsIfNeed();
if(!this.opts.onlyTimepicker){
this.nav._render();
}
this.views[this.currentView]._render();
if(this.elIsInput&&!this.opts.inline){
this._setPositionClasses(this.opts.position);
if(this.visible){
this.setPosition(this.opts.position);
}}
if(this.opts.classes){
this.$wpcdpk.addClass(this.opts.classes);
}
if(this.opts.onlyTimepicker){
this.$wpcdpk.addClass('-only-timepicker-');
}
if(this.opts.timepicker){
if(lastSelectedDate){
this.timepicker._handleDate(lastSelectedDate);
}
this.timepicker._updateRanges();
this.timepicker._updateCurrentTime();
if(lastSelectedDate){
lastSelectedDate.setHours(this.timepicker.hours);
lastSelectedDate.setMinutes(this.timepicker.minutes);
}}
this._setInputValue();
return this;
},
_syncWithMinMaxDates: function(){
var curTime=this.date.getTime();
this.silent=true;
if(this.minTime > curTime){
this.date=this.minDate;
}
if(this.maxTime < curTime){
this.date=this.maxDate;
}
this.silent=false;
},
_isSelected: function(checkDate, cellType){
var res=false;
this.selectedDates.some(function(date){
if(wpcdpk.isSame(date, checkDate, cellType)){
res=date;
return true;
}});
return res;
},
_setInputValue: function(){
var _this=this,
opts=_this.opts,
format=_this.loc.dateFormat,
altFormat=opts.altFieldDateFormat,
value=_this.selectedDates.map(function(date){
return _this.formatDate(format, date);
}),
altValues;
if(opts.altField&&_this.$altField.length){
altValues=this.selectedDates.map(function(date){
return _this.formatDate(altFormat, date);
});
altValues=altValues.join(this.opts.multipleDatesSeparator);
this.$altField.val(altValues);
}
value=value.join(this.opts.multipleDatesSeparator);
this.$el.val(value);
},
_isInRange: function(date, type){
var time=date.getTime(),
d=wpcdpk.getParsedDate(date),
min=wpcdpk.getParsedDate(this.minDate),
max=wpcdpk.getParsedDate(this.maxDate),
dMinTime=new Date(d.year, d.month, min.date).getTime(),
dMaxTime=new Date(d.year, d.month, max.date).getTime(),
types={
day: time >=this.minTime&&time <=this.maxTime,
month: dMinTime >=this.minTime&&dMaxTime <=
this.maxTime,
year: d.year >=min.year&&d.year <=max.year,
};
return type ? types[type]:types.day;
},
_getDimensions: function($el){
var offset=$el.offset();
return {
width: $el.outerWidth(),
height: $el.outerHeight(),
left: offset.left,
top: offset.top,
};},
_getDateFromCell: function(cell){
var curDate=this.parsedDate,
year=cell.data('year')||curDate.year,
month=cell.data('month')==undefined ?
curDate.month :
cell.data('month'),
date=cell.data('date')||1;
return new Date(year, month, date);
},
_setPositionClasses: function(pos){
pos=pos.split(' ');
var main=pos[0],
sec=pos[1],
classes='wpcdpk -' + main + '-' + sec + '- -from-' +
main + '-';
if(this.visible){
classes +=' active';
}
this.$wpcdpk.removeAttr('class').addClass(classes);
},
setPosition: function(position){
position=position||this.opts.position;
var dims=this._getDimensions(this.$el),
selfDims=this._getDimensions(this.$wpcdpk),
pos=position.split(' '),
top, left,
offset=this.opts.offset,
main=pos[0],
secondary=pos[1];
switch (main){
case 'top':
top=dims.top - selfDims.height - offset;
break;
case 'right':
left=dims.left + dims.width + offset;
break;
case 'bottom':
top=dims.top + dims.height + offset;
break;
case 'left':
left=dims.left - selfDims.width - offset;
break;
}
switch (secondary){
case 'top':
top=dims.top;
break;
case 'right':
left=dims.left + dims.width - selfDims.width;
break;
case 'bottom':
top=dims.top + dims.height - selfDims.height;
break;
case 'left':
left=dims.left;
break;
case 'center':
if(/left|right/.test(main)){
top=dims.top + dims.height / 2 - selfDims.height / 2;
}else{
left=dims.left + dims.width / 2 - selfDims.width / 2;
}}
this.$wpcdpk.css({
left: left,
top: top,
});
},
show: function(){
var onShow=this.opts.onShow;
this.setPosition(this.opts.position);
this.$wpcdpk.addClass('active');
this.visible=true;
if(onShow){
this._bindVisionEvents(onShow);
}},
hide: function(){
var onHide=this.opts.onHide;
this.$wpcdpk.removeClass('active').css({
left: '-100000px',
});
this.focused='';
this.keys=[];
this.inFocus=false;
this.visible=false;
this.$el.blur();
if(onHide){
this._bindVisionEvents(onHide);
}},
down: function(date){
this._changeView(date, 'down');
},
up: function(date){
this._changeView(date, 'up');
},
_bindVisionEvents: function(event){
this.$wpcdpk.off('transitionend.dp');
event(this, false);
this.$wpcdpk.one('transitionend.dp',
event.bind(this, this, true));
},
_changeView: function(date, dir){
date=date||this.focused||this.date;
var nextView=dir=='up' ?
this.viewIndex + 1 :
this.viewIndex - 1;
if(nextView > 2){
nextView=2;
}
if(nextView < 0){
nextView=0;
}
this.silent=true;
this.date=new Date(date.getFullYear(), date.getMonth(), 1);
this.silent=false;
this.view=this.viewIndexes[nextView];
},
_handleHotKey: function(key){
var date=wpcdpk.getParsedDate(this._getFocusedDate()),
focusedParsed,
o=this.opts,
newDate,
totalDaysInNextMonth,
monthChanged=false,
yearChanged=false,
decadeChanged=false,
y=date.year,
m=date.month,
d=date.date;
switch (key){
case 'ctrlRight':
case 'ctrlUp':
m +=1;
monthChanged=true;
break;
case 'ctrlLeft':
case 'ctrlDown':
m -=1;
monthChanged=true;
break;
case 'shiftRight':
case 'shiftUp':
yearChanged=true;
y +=1;
break;
case 'shiftLeft':
case 'shiftDown':
yearChanged=true;
y -=1;
break;
case 'altRight':
case 'altUp':
decadeChanged=true;
y +=10;
break;
case 'altLeft':
case 'altDown':
decadeChanged=true;
y -=10;
break;
case 'ctrlShiftUp':
this.up();
break;
}
totalDaysInNextMonth=wpcdpk.getDaysCount(new Date(y, m));
newDate=new Date(y, m, d);
if(totalDaysInNextMonth < d){
d=totalDaysInNextMonth;
}
if(newDate.getTime() < this.minTime){
newDate=this.minDate;
}else if(newDate.getTime() > this.maxTime){
newDate=this.maxDate;
}
this.focused=newDate;
focusedParsed=wpcdpk.getParsedDate(newDate);
if(monthChanged&&o.onChangeMonth){
o.onChangeMonth(focusedParsed.month, focusedParsed.year);
}
if(yearChanged&&o.onChangeYear){
o.onChangeYear(focusedParsed.year);
}
if(decadeChanged&&o.onChangeDecade){
o.onChangeDecade(this.curDecade);
}},
_registerKey: function(key){
var exists=this.keys.some(function(curKey){
return curKey==key;
});
if(!exists){
this.keys.push(key);
}},
_unRegisterKey: function(key){
var index=this.keys.indexOf(key);
this.keys.splice(index, 1);
},
_isHotKeyPressed: function(){
var currentHotKey,
found=false,
_this=this,
pressedKeys=this.keys.sort();
for (var hotKey in hotKeys){
currentHotKey=hotKeys[hotKey];
if(pressedKeys.length!=currentHotKey.length){
continue;
}
if(currentHotKey.every(function(key, i){
return key==pressedKeys[i];
})){
_this._trigger('hotKey', hotKey);
found=true;
}}
return found;
},
_trigger: function(event, args){
this.$el.trigger(event, args);
},
_focusNextCell: function(keyCode, type){
type=type||this.cellType;
var date=wpcdpk.getParsedDate(this._getFocusedDate()),
y=date.year,
m=date.month,
d=date.date;
if(this._isHotKeyPressed()){
return;
}
switch (keyCode){
case 37:
type=='day' ? (
d -=1
):'';
type=='month' ? (
m -=1
):'';
type=='year' ? (
y -=1
):'';
break;
case 38:
type=='day' ? (
d -=7
):'';
type=='month' ? (
m -=3
):'';
type=='year' ? (
y -=4
):'';
break;
case 39:
type=='day' ? (
d +=1
):'';
type=='month' ? (
m +=1
):'';
type=='year' ? (
y +=1
):'';
break;
case 40:
type=='day' ? (
d +=7
):'';
type=='month' ? (
m +=3
):'';
type=='year' ? (
y +=4
):'';
break;
}
var nd=new Date(y, m, d);
if(nd.getTime() < this.minTime){
nd=this.minDate;
}else if(nd.getTime() > this.maxTime){
nd=this.maxDate;
}
this.focused=nd;
},
_getFocusedDate: function(){
var focused=this.focused ||
this.selectedDates[this.selectedDates.length - 1],
d=this.parsedDate;
if(!focused){
switch (this.view){
case 'days':
focused=new Date(d.year, d.month, new Date().getDate());
break;
case 'months':
focused=new Date(d.year, d.month, 1);
break;
case 'years':
focused=new Date(d.year, 0, 1);
break;
}}
return focused;
},
_getCell: function(date, type){
type=type||this.cellType;
var d=wpcdpk.getParsedDate(date),
selector='.wpcdpk--cell[data-year="' + d.year + '"]',
$cell;
switch (type){
case 'month':
selector='[data-month="' + d.month + '"]';
break;
case 'day':
selector +='[data-month="' + d.month + '"][data-date="' +
d.date + '"]';
break;
}
$cell=this.views[this.currentView].$el.find(selector);
return $cell.length ? $cell:$('');
},
destroy: function(){
var _this=this;
_this.$el.off('.adp').data('wpcdpk', '');
_this.selectedDates=[];
_this.focused='';
_this.views={};
_this.keys=[];
_this.minRange='';
_this.maxRange='';
if(_this.opts.inline||!_this.elIsInput){
_this.$wpcdpk.closest('.wpcdpk-inline').remove();
}else{
_this.$wpcdpk.remove();
}},
_handleAlreadySelectedDates: function(
alreadySelected, selectedDate){
if(this.opts.range){
if(!this.opts.toggleSelected){
if(this.selectedDates.length!=2){
this._trigger('clickCell', selectedDate);
}}else{
this.removeDate(selectedDate);
}}else if(this.opts.toggleSelected){
this.removeDate(selectedDate);
}
if(!this.opts.toggleSelected){
this.lastSelectedDate=alreadySelected;
if(this.opts.timepicker){
this.timepicker._setTime(alreadySelected);
this.timepicker.update();
}}
},
_onShowEvent: function(e){
if(!this.visible){
this.show();
}},
_onBlur: function(){
if(!this.inFocus&&this.visible){
this.hide();
}},
_onMouseDownWpcdpk: function(e){
this.inFocus=true;
},
_onMouseUpWpcdpk: function(e){
this.inFocus=false;
e.originalEvent.inFocus=true;
if(!e.originalEvent.timepickerFocus){
this.$el.focus();
}},
_onKeyUpGeneral: function(e){
var val=this.$el.val();
if(!val){
this.clear();
}},
_onResize: function(){
if(this.visible){
this.setPosition();
}},
_onMouseUpBody: function(e){
if(e.originalEvent.inFocus){
return;
}
if(this.visible&&!this.inFocus){
this.hide();
}},
_onMouseUpEl: function(e){
e.originalEvent.inFocus=true;
setTimeout(this._onKeyUpGeneral.bind(this), 4);
},
_onKeyDown: function(e){
var code=e.which;
this._registerKey(code);
if(code >=37&&code <=40){
e.preventDefault();
this._focusNextCell(code);
}
if(code==13){
if(this.focused){
if(this._getCell(this.focused).hasClass('-disabled-')){
return;
}
if(this.view!=this.opts.minView){
this.down();
}else{
var alreadySelected=this._isSelected(this.focused,
this.cellType);
if(!alreadySelected){
if(this.timepicker){
this.focused.setHours(this.timepicker.hours);
this.focused.setMinutes(this.timepicker.minutes);
}
this.selectDate(this.focused);
return;
}
this._handleAlreadySelectedDates(alreadySelected,
this.focused);
}}
}
if(code==27){
this.hide();
}},
_onKeyUp: function(e){
var code=e.which;
this._unRegisterKey(code);
},
_onHotKey: function(e, hotKey){
this._handleHotKey(hotKey);
},
_onMouseEnterCell: function(e){
var $cell=$(e.target).closest('.wpcdpk--cell'),
date=this._getDateFromCell($cell);
this.silent=true;
if(this.focused){
this.focused='';
}
$cell.addClass('-focus-');
this.focused=date;
this.silent=false;
if(this.opts.range&&this.selectedDates.length==1){
this.minRange=this.selectedDates[0];
this.maxRange='';
if(wpcdpk.less(this.minRange, this.focused)){
this.maxRange=this.minRange;
this.minRange='';
}
this.views[this.currentView]._update();
}},
_onMouseLeaveCell: function(e){
var $cell=$(e.target).closest('.wpcdpk--cell');
$cell.removeClass('-focus-');
this.silent=true;
this.focused='';
this.silent=false;
},
_onTimeChange: function(e, h, m){
var date=new Date(),
selectedDates=this.selectedDates,
selected=false;
if(selectedDates.length){
selected=true;
date=this.lastSelectedDate;
}
date.setHours(h);
date.setMinutes(m);
if(!selected&&!this._getCell(date).hasClass('-disabled-')){
this.selectDate(date);
}else{
this._setInputValue();
if(this.opts.onSelect){
this._triggerOnChange();
}}
},
_onClickCell: function(e, date){
if(this.timepicker){
date.setHours(this.timepicker.hours);
date.setMinutes(this.timepicker.minutes);
}
this.selectDate(date);
},
set focused(val){
if(!val&&this.focused){
var $cell=this._getCell(this.focused);
if($cell.length){
$cell.removeClass('-focus-');
}}
this._focused=val;
if(this.opts.range&&this.selectedDates.length==1){
this.minRange=this.selectedDates[0];
this.maxRange='';
if(wpcdpk.less(this.minRange, this._focused)){
this.maxRange=this.minRange;
this.minRange='';
}}
if(this.silent){
return;
}
this.date=val;
},
get focused(){
return this._focused;
},
get parsedDate(){
return wpcdpk.getParsedDate(this.date);
},
set date(val){
if(!(
val instanceof Date
)){
return;
}
this.currentDate=val;
if(this.inited&&!this.silent){
this.views[this.view]._render();
this.nav._render();
if(this.visible&&this.elIsInput){
this.setPosition();
}}
return val;
},
get date(){
return this.currentDate;
},
set view(val){
this.viewIndex=this.viewIndexes.indexOf(val);
if(this.viewIndex < 0){
return;
}
this.prevView=this.currentView;
this.currentView=val;
if(this.inited){
if(!this.views[val]){
this.views[val]=new $.fn.wpcdpk.Body(this, val,
this.opts);
}else{
this.views[val]._render();
}
this.views[this.prevView].hide();
this.views[val].show();
this.nav._render();
if(this.opts.onChangeView){
this.opts.onChangeView(val);
}
if(this.elIsInput&&this.visible){
this.setPosition();
}}
return val;
},
get view(){
return this.currentView;
},
get cellType(){
return this.view.substring(0, this.view.length - 1);
},
get minTime(){
var min=wpcdpk.getParsedDate(this.minDate);
return new Date(min.year, min.month, min.date).getTime();
},
get maxTime(){
var max=wpcdpk.getParsedDate(this.maxDate);
return new Date(max.year, max.month, max.date).getTime();
},
get curDecade(){
return wpcdpk.getDecade(this.date);
},
};
wpcdpk.getDaysCount=function(date){
return new Date(date.getFullYear(), date.getMonth() + 1,
0).getDate();
};
wpcdpk.getParsedDate=function(date){
return {
year: date.getFullYear(),
month: date.getMonth(),
fullMonth: (
date.getMonth() + 1
) < 10 ? '0' + (
date.getMonth() + 1
):date.getMonth() + 1,
date: date.getDate(),
fullDate: date.getDate() < 10 ?
'0' + date.getDate() :
date.getDate(),
day: date.getDay(),
hours: date.getHours(),
fullHours: date.getHours() < 10 ?
'0' + date.getHours() :
date.getHours(),
minutes: date.getMinutes(),
fullMinutes: date.getMinutes() < 10 ?
'0' + date.getMinutes() :
date.getMinutes(),
};};
wpcdpk.getDecade=function(date){
var firstYear=Math.floor(date.getFullYear() / 10) * 10;
return [firstYear, firstYear + 9];
};
wpcdpk.template=function(str, data){
return str.replace(/#\{([\w]+)\}/g, function(source, match){
if(data[match]||data[match]===0){
return data[match];
}});
};
wpcdpk.isSame=function(date1, date2, type){
if(!date1||!date2){
return false;
}
var d1=wpcdpk.getParsedDate(date1),
d2=wpcdpk.getParsedDate(date2),
_type=type ? type:'day',
conditions={
day: d1.date==d2.date&&d1.month==d2.month &&
d1.year==d2.year,
month: d1.month==d2.month&&d1.year==d2.year,
year: d1.year==d2.year,
};
return conditions[_type];
};
wpcdpk.less=function(dateCompareTo, date, type){
if(!dateCompareTo||!date){
return false;
}
return date.getTime() < dateCompareTo.getTime();
};
wpcdpk.bigger=function(dateCompareTo, date, type){
if(!dateCompareTo||!date){
return false;
}
return date.getTime() > dateCompareTo.getTime();
};
wpcdpk.getLeadingZeroNum=function(num){
return parseInt(num) < 10 ? '0' + num:num;
};
wpcdpk.resetTime=function(date){
if(typeof date!='object'){
return;
}
date=wpcdpk.getParsedDate(date);
return new Date(date.year, date.month, date.date);
};
$.fn.wpcdpk=function(options){
return this.each(function(){
if(!$.data(this, pluginName)){
$.data(this, pluginName,
new Wpcdpk(this, options));
}else{
var _this=$.data(this, pluginName);
_this.opts=$.extend(true, _this.opts, options);
_this.update();
}});
};
$.fn.wpcdpk.Constructor=Wpcdpk;
$.fn.wpcdpk.language={
en: {
days: [
'Sunday',
'Monday',
'Tuesday',
'Wednesday',
'Thursday',
'Friday',
'Saturday'],
daysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
daysMin: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
months: [
'January',
'February',
'March',
'April',
'May',
'June',
'July',
'August',
'September',
'October',
'November',
'December',
],
monthsShort: [
'Jan',
'Feb',
'Mar',
'Apr',
'May',
'Jun',
'Jul',
'Aug',
'Sep',
'Oct',
'Nov',
'Dec',
],
today: 'Today',
clear: 'Clear',
dateFormat: 'mm/dd/yyyy',
timeFormat: 'hh:ii aa',
firstDay: 0,
},
};
$(function(){
$(autoInitSelector).wpcdpk();
});
}
)();
;
(
function(){
var templates={
days: '' +
'<div class="wpcdpk--days wpcdpk--body">' +
'<div class="wpcdpk--days-names"></div>' +
'<div class="wpcdpk--cells wpcdpk--cells-days"></div>' +
'</div>',
months: '' +
'<div class="wpcdpk--months wpcdpk--body">' +
'<div class="wpcdpk--cells wpcdpk--cells-months"></div>' +
'</div>',
years: '' +
'<div class="wpcdpk--years wpcdpk--body">' +
'<div class="wpcdpk--cells wpcdpk--cells-years"></div>' +
'</div>',
},
wpcdpk=$.fn.wpcdpk,
dp=wpcdpk.Constructor;
wpcdpk.Body=function(d, type, opts){
this.d=d;
this.type=type;
this.opts=opts;
this.$el=$('');
if(this.opts.onlyTimepicker){
return;
}
this.init();
};
wpcdpk.Body.prototype={
init: function(){
this._buildBaseHtml();
this._render();
this._bindEvents();
},
_bindEvents: function(){
this.$el.on('click', '.wpcdpk--cell',
$.proxy(this._onClickCell, this));
},
_buildBaseHtml: function(){
this.$el=$(templates[this.type]).appendTo(this.d.$content);
this.$names=$('.wpcdpk--days-names', this.$el);
this.$cells=$('.wpcdpk--cells', this.$el);
},
_getDayNamesHtml: function(firstDay, curDay, html, i){
curDay=curDay!=undefined ? curDay:firstDay;
html=html ? html:'';
i=i!=undefined ? i:0;
if(i > 7){
return html;
}
if(curDay==7){
return this._getDayNamesHtml(firstDay, 0, html, ++i);
}
html +='<div class="wpcdpk--day-name' + (
this.d.isWeekend(curDay) ? ' -weekend-':''
) + '">' + this.d.loc.daysMin[curDay] + '</div>';
return this._getDayNamesHtml(firstDay, ++curDay, html, ++i);
},
_getCellContents: function(date, type){
var classes='wpcdpk--cell wpcdpk--cell-' + type,
currentDate=new Date(),
parent=this.d,
minRange=dp.resetTime(parent.minRange),
maxRange=dp.resetTime(parent.maxRange),
opts=parent.opts,
d=dp.getParsedDate(date),
render={},
html=d.date;
switch (type){
case 'day':
if(parent.isWeekend(d.day)){
classes +=' -weekend-';
}
if(d.month!=this.d.parsedDate.month){
classes +=' -other-month-';
if(!opts.selectOtherMonths){
classes +=' -disabled-';
}
if(!opts.showOtherMonths){
html='';
}}
break;
case 'month':
html=parent.loc[parent.opts.monthsField][d.month];
break;
case 'year':
var decade=parent.curDecade;
html=d.year;
if(d.year < decade[0]||d.year > decade[1]){
classes +=' -other-decade-';
if(!opts.selectOtherYears){
classes +=' -disabled-';
}
if(!opts.showOtherYears){
html='';
}}
break;
}
if(opts.onRenderCell){
render=opts.onRenderCell(date, type)||{};
html=render.html ? render.html:html;
classes +=render.classes ? ' ' + render.classes:'';
}
if(opts.range){
if(dp.isSame(minRange, date, type)){
classes +=' -range-from-';
}
if(dp.isSame(maxRange, date, type)){
classes +=' -range-to-';
}
if(parent.selectedDates.length==1&&parent.focused){
if((
dp.bigger(minRange, date) &&
dp.less(parent.focused, date)
) ||
(
dp.less(maxRange, date) &&
dp.bigger(parent.focused, date)
)){
classes +=' -in-range-';
}
if(dp.less(maxRange, date) &&
dp.isSame(parent.focused, date)){
classes +=' -range-from-';
}
if(dp.bigger(minRange, date) &&
dp.isSame(parent.focused, date)){
classes +=' -range-to-';
}}else if(parent.selectedDates.length==2){
if(dp.bigger(minRange, date)&&dp.less(maxRange, date)){
classes +=' -in-range-';
}}
}
if(dp.isSame(currentDate, date, type)){
classes +=' -current-';
}
if(parent.focused&&dp.isSame(date, parent.focused, type)){
classes +=' -focus-';
}
if(parent._isSelected(date, type)){
classes +=' -selected-';
}
if(!parent._isInRange(date, type)||render.disabled){
classes +=' -disabled-';
}
return {
html: html,
classes: classes,
};},
_getDaysHtml: function(date){
var totalMonthDays=dp.getDaysCount(date),
firstMonthDay=new Date(date.getFullYear(),
date.getMonth(), 1).getDay(),
lastMonthDay=new Date(date.getFullYear(), date.getMonth(),
totalMonthDays).getDay(),
daysFromPevMonth=firstMonthDay - this.d.loc.firstDay,
daysFromNextMonth=6 - lastMonthDay + this.d.loc.firstDay;
daysFromPevMonth=daysFromPevMonth < 0 ?
daysFromPevMonth + 7 :
daysFromPevMonth;
daysFromNextMonth=daysFromNextMonth > 6 ?
daysFromNextMonth - 7 :
daysFromNextMonth;
var startDayIndex=-daysFromPevMonth + 1,
m, y,
html='';
for (var i=startDayIndex, max=totalMonthDays +
daysFromNextMonth; i <=max; i++){
y=date.getFullYear();
m=date.getMonth();
html +=this._getDayHtml(new Date(y, m, i));
}
return html;
},
_getDayHtml: function(date){
var content=this._getCellContents(date, 'day');
return '<div class="' + content.classes + '" ' +
'data-date="' + date.getDate() + '" ' +
'data-month="' + date.getMonth() + '" ' +
'data-year="' + date.getFullYear() + '">' + content.html +
'</div>';
},
_getMonthsHtml: function(date){
var html='',
d=dp.getParsedDate(date),
i=0;
while (i < 12){
html +=this._getMonthHtml(new Date(d.year, i));
i++;
}
return html;
},
_getMonthHtml: function(date){
var content=this._getCellContents(date, 'month');
return '<div class="' + content.classes + '" data-month="' +
date.getMonth() + '">' + content.html + '</div>';
},
_getYearsHtml: function(date){
var d=dp.getParsedDate(date),
decade=dp.getDecade(date),
firstYear=decade[0] - 1,
html='',
i=firstYear;
for (i; i <=decade[1] + 1; i++){
html +=this._getYearHtml(new Date(i, 0));
}
return html;
},
_getYearHtml: function(date){
var content=this._getCellContents(date, 'year');
return '<div class="' + content.classes + '" data-year="' +
date.getFullYear() + '">' + content.html + '</div>';
},
_renderTypes: {
days: function(){
var dayNames=this._getDayNamesHtml(this.d.loc.firstDay),
days=this._getDaysHtml(this.d.currentDate);
this.$cells.html(days);
this.$names.html(dayNames);
},
months: function(){
var html=this._getMonthsHtml(this.d.currentDate);
this.$cells.html(html);
},
years: function(){
var html=this._getYearsHtml(this.d.currentDate);
this.$cells.html(html);
},
},
_render: function(){
if(this.opts.onlyTimepicker){
return;
}
this._renderTypes[this.type].bind(this)();
},
_update: function(){
var $cells=$('.wpcdpk--cell', this.$cells),
_this=this,
classes,
$cell,
date;
$cells.each(function(cell, i){
$cell=$(this);
date=_this.d._getDateFromCell($(this));
classes=_this._getCellContents(date, _this.d.cellType);
$cell.attr('class', classes.classes);
});
},
show: function(){
if(this.opts.onlyTimepicker){
return;
}
this.$el.addClass('active');
this.acitve=true;
},
hide: function(){
this.$el.removeClass('active');
this.active=false;
},
_handleClick: function(el){
var date=el.data('date')||1,
month=el.data('month')||0,
year=el.data('year')||this.d.parsedDate.year,
dp=this.d;
if(dp.view!=this.opts.minView){
dp.down(new Date(year, month, date));
return;
}
var selectedDate=new Date(year, month, date),
alreadySelected=this.d._isSelected(selectedDate,
this.d.cellType);
if(!alreadySelected){
dp._trigger('clickCell', selectedDate);
return;
}
dp._handleAlreadySelectedDates.bind(dp, alreadySelected,
selectedDate)();
},
_onClickCell: function(e){
var $el=$(e.target).closest('.wpcdpk--cell');
if($el.hasClass('-disabled-')){
return;
}
this._handleClick.bind(this)($el);
},
};}
)();
;
(
function(){
var template='' +
'<div class="wpcdpk--nav-action" data-action="prev">#{prevHtml}</div>' +
'<div class="wpcdpk--nav-title">#{title}</div>' +
'<div class="wpcdpk--nav-action" data-action="next">#{nextHtml}</div>',
buttonsContainerTemplate='<div class="wpcdpk--buttons"></div>',
button='<span class="wpcdpk--button" data-action="#{action}">#{label}</span>',
wpcdpk=$.fn.wpcdpk,
dp=wpcdpk.Constructor;
wpcdpk.Navigation=function(d, opts){
this.d=d;
this.opts=opts;
this.$buttonsContainer='';
this.init();
};
wpcdpk.Navigation.prototype={
init: function(){
this._buildBaseHtml();
this._bindEvents();
},
_bindEvents: function(){
this.d.$nav.on('click', '.wpcdpk--nav-action',
$.proxy(this._onClickNavButton, this));
this.d.$nav.on('click', '.wpcdpk--nav-title',
$.proxy(this._onClickNavTitle, this));
this.d.$wpcdpk.on('click', '.wpcdpk--button',
$.proxy(this._onClickNavButton, this));
},
_buildBaseHtml: function(){
if(!this.opts.onlyTimepicker){
this._render();
}
this._addButtonsIfNeed();
},
_addButtonsIfNeed: function(){
if(this.opts.todayButton){
this._addButton('today');
}
if(this.opts.clearButton){
this._addButton('clear');
}},
_render: function(){
var title=this._getTitle(this.d.currentDate),
html=dp.template(template,
$.extend({title: title}, this.opts));
this.d.$nav.html(html);
if(this.d.view=='years'){
$('.wpcdpk--nav-title', this.d.$nav).addClass('-disabled-');
}
this.setNavStatus();
},
_getTitle: function(date){
return this.d.formatDate(this.opts.navTitles[this.d.view],
date);
},
_addButton: function(type){
if(!this.$buttonsContainer.length){
this._addButtonsContainer();
}
var data={
action: type,
label: this.d.loc[type],
},
html=dp.template(button, data);
if($('[data-action=' + type + ']',
this.$buttonsContainer).length){
return;
}
this.$buttonsContainer.append(html);
},
_addButtonsContainer: function(){
this.d.$wpcdpk.append(buttonsContainerTemplate);
this.$buttonsContainer=$('.wpcdpk--buttons', this.d.$wpcdpk);
},
setNavStatus: function(){
if(!(
this.opts.minDate||this.opts.maxDate
)||!this.opts.disableNavWhenOutOfRange){
return;
}
var date=this.d.parsedDate,
m=date.month,
y=date.year,
d=date.date;
switch (this.d.view){
case 'days':
if(!this.d._isInRange(new Date(y, m - 1, 1), 'month')){
this._disableNav('prev');
}
if(!this.d._isInRange(new Date(y, m + 1, 1), 'month')){
this._disableNav('next');
}
break;
case 'months':
if(!this.d._isInRange(new Date(y - 1, m, d), 'year')){
this._disableNav('prev');
}
if(!this.d._isInRange(new Date(y + 1, m, d), 'year')){
this._disableNav('next');
}
break;
case 'years':
var decade=dp.getDecade(this.d.date);
if(!this.d._isInRange(new Date(decade[0] - 1, 0, 1),
'year')){
this._disableNav('prev');
}
if(!this.d._isInRange(new Date(decade[1] + 1, 0, 1),
'year')){
this._disableNav('next');
}
break;
}},
_disableNav: function(nav){
$('[data-action="' + nav + '"]', this.d.$nav).
addClass('-disabled-');
},
_activateNav: function(nav){
$('[data-action="' + nav + '"]', this.d.$nav).
removeClass('-disabled-');
},
_onClickNavButton: function(e){
var $el=$(e.target).closest('[data-action]'),
action=$el.data('action');
this.d[action]();
},
_onClickNavTitle: function(e){
if($(e.target).hasClass('-disabled-')){
return;
}
if(this.d.view=='days'){
return this.d.view='months';
}
this.d.view='years';
},
};}
)();
;
(
function(){
var template='<div class="wpcdpk--time">' +
'<div class="wpcdpk--time-current">' +
'   <span class="wpcdpk--time-current-hours">#{hourVisible}</span>' +
'   <span class="wpcdpk--time-current-colon">:</span>' +
'   <span class="wpcdpk--time-current-minutes">#{minValue}</span>' +
'</div>' +
'<div class="wpcdpk--time-sliders">' +
'   <div class="wpcdpk--time-row">' +
'      <input type="range" name="hours" value="#{hourValue}" min="#{hourMin}" max="#{hourMax}" step="#{hourStep}"/>' +
'   </div>' +
'   <div class="wpcdpk--time-row">' +
'      <input type="range" name="minutes" value="#{minValue}" min="#{minMin}" max="#{minMax}" step="#{minStep}"/>' +
'   </div>' +
'</div>' +
'</div>',
wpcdpk=$.fn.wpcdpk,
dp=wpcdpk.Constructor;
wpcdpk.Timepicker=function(inst, opts){
this.d=inst;
this.opts=opts;
this.init();
};
wpcdpk.Timepicker.prototype={
init: function(){
var input='input';
this._setTime(this.d.date);
this._buildHTML();
if(navigator.userAgent.match(/trident/gi)){
input='change';
}
this.d.$el.on('selectDate', this._onSelectDate.bind(this));
this.$ranges.on(input, this._onChangeRange.bind(this));
this.$ranges.on('mouseup', this._onMouseUpRange.bind(this));
this.$ranges.on('mousemove focus ',
this._onMouseEnterRange.bind(this));
this.$ranges.on('mouseout blur',
this._onMouseOutRange.bind(this));
},
_setTime: function(date){
var _date=dp.getParsedDate(date);
this._handleDate(date);
this.hours=_date.hours < this.minHours ?
this.minHours :
_date.hours;
this.minutes=_date.minutes < this.minMinutes ?
this.minMinutes :
_date.minutes;
},
_setMinTimeFromDate: function(date){
this.minHours=date.getHours();
this.minMinutes=date.getMinutes();
if(this.d.lastSelectedDate){
if(this.d.lastSelectedDate.getHours() > date.getHours()){
this.minMinutes=this.opts.minMinutes;
}}
},
_setMaxTimeFromDate: function(date){
this.maxHours=date.getHours();
this.maxMinutes=date.getMinutes();
if(this.d.lastSelectedDate){
if(this.d.lastSelectedDate.getHours() < date.getHours()){
this.maxMinutes=this.opts.maxMinutes;
}}
},
_setDefaultMinMaxTime: function(){
var maxHours=23,
maxMinutes=59,
opts=this.opts;
this.minHours=opts.minHours < 0||opts.minHours > maxHours ?
0 :
opts.minHours;
this.minMinutes=opts.minMinutes < 0||opts.minMinutes >
maxMinutes ? 0:opts.minMinutes;
this.maxHours=opts.maxHours < 0||opts.maxHours > maxHours ?
maxHours :
opts.maxHours;
this.maxMinutes=opts.maxMinutes < 0||opts.maxMinutes >
maxMinutes ? maxMinutes:opts.maxMinutes;
},
_validateHoursMinutes: function(date){
if(this.hours < this.minHours){
this.hours=this.minHours;
}else if(this.hours > this.maxHours){
this.hours=this.maxHours;
}
if(this.minutes < this.minMinutes){
this.minutes=this.minMinutes;
}else if(this.minutes > this.maxMinutes){
this.minutes=this.maxMinutes;
}},
_buildHTML: function(){
var lz=dp.getLeadingZeroNum,
data={
hourMin: this.minHours,
hourMax: lz(this.maxHours),
hourStep: this.opts.hoursStep,
hourValue: this.hours,
hourVisible: lz(this.displayHours),
minMin: this.minMinutes,
minMax: lz(this.maxMinutes),
minStep: this.opts.minutesStep,
minValue: lz(this.minutes),
},
_template=dp.template(template, data);
this.$timepicker=$(_template).appendTo(this.d.$wpcdpk);
this.$ranges=$('[type="range"]', this.$timepicker);
this.$hours=$('[name="hours"]', this.$timepicker);
this.$minutes=$('[name="minutes"]', this.$timepicker);
this.$hoursText=$('.wpcdpk--time-current-hours',
this.$timepicker);
this.$minutesText=$('.wpcdpk--time-current-minutes',
this.$timepicker);
if(this.d.ampm){
this.$ampm=$('<span class="wpcdpk--time-current-ampm">').
appendTo($('.wpcdpk--time-current', this.$timepicker)).
html(this.dayPeriod);
this.$timepicker.addClass('-am-pm-');
}},
_updateCurrentTime: function(){
var h=dp.getLeadingZeroNum(this.displayHours),
m=dp.getLeadingZeroNum(this.minutes);
this.$hoursText.html(h);
this.$minutesText.html(m);
if(this.d.ampm){
this.$ampm.html(this.dayPeriod);
}},
_updateRanges: function(){
this.$hours.attr({
min: this.minHours,
max: this.maxHours,
}).val(this.hours);
this.$minutes.attr({
min: this.minMinutes,
max: this.maxMinutes,
}).val(this.minutes);
},
_handleDate: function(date){
this._setDefaultMinMaxTime();
if(date){
if(dp.isSame(date, this.d.opts.minDate)){
this._setMinTimeFromDate(this.d.opts.minDate);
}else if(dp.isSame(date, this.d.opts.maxDate)){
this._setMaxTimeFromDate(this.d.opts.maxDate);
}}
this._validateHoursMinutes(date);
},
update: function(){
this._updateRanges();
this._updateCurrentTime();
},
_getValidHoursFromDate: function(date, ampm){
var d=date,
hours=date;
if(date instanceof Date){
d=dp.getParsedDate(date);
hours=d.hours;
}
var _ampm=ampm||this.d.ampm,
dayPeriod='am';
if(_ampm){
switch (true){
case hours==0:
hours=12;
break;
case hours==12:
dayPeriod='pm';
break;
case hours > 11:
hours=hours - 12;
dayPeriod='pm';
break;
default:
break;
}}
return {
hours: hours,
dayPeriod: dayPeriod,
};},
set hours(val){
this._hours=val;
var displayHours=this._getValidHoursFromDate(val);
this.displayHours=displayHours.hours;
this.dayPeriod=displayHours.dayPeriod;
},
get hours(){
return this._hours;
},
_onChangeRange: function(e){
var $target=$(e.target),
name=$target.attr('name');
this.d.timepickerIsActive=true;
this[name]=$target.val();
this._updateCurrentTime();
this.d._trigger('timeChange', [this.hours, this.minutes]);
this._handleDate(this.d.lastSelectedDate);
this.update();
},
_onSelectDate: function(e, data){
this._handleDate(data);
this.update();
},
_onMouseEnterRange: function(e){
var name=$(e.target).attr('name');
$('.wpcdpk--time-current-' + name, this.$timepicker).
addClass('-focus-');
},
_onMouseOutRange: function(e){
var name=$(e.target).attr('name');
if(this.d.inFocus){
return;
}
$('.wpcdpk--time-current-' + name, this.$timepicker).
removeClass('-focus-');
},
_onMouseUpRange: function(e){
this.d.timepickerIsActive=false;
},
};}
)();
}
)(window, jQuery);
!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)}(function(x){"use strict";var t,e,i,n,W,C,o,s,r,l,a,h,u;function E(t,e,i){return[parseFloat(t[0])*(a.test(t[0])?e/100:1),parseFloat(t[1])*(a.test(t[1])?i/100:1)]}function L(t,e){return parseInt(x.css(t,e),10)||0}function N(t){return null!=t&&t===t.window}x.ui=x.ui||{},x.ui.version="1.13.3",
x.extend(x.expr.pseudos,{data:x.expr.createPseudo?x.expr.createPseudo(function(e){return function(t){return!!x.data(t,e)}}):function(t,e,i){return!!x.data(t,i[3])}}),
x.fn.extend({disableSelection:(t="onselectstart"in document.createElement("div")?"selectstart":"mousedown",function(){return this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}),enableSelection:function(){return this.off(".ui-disableSelection")}}),
x.ui.focusable=function(t,e){var i,n,o,s=t.nodeName.toLowerCase();return"area"===s?(o=(i=t.parentNode).name,!(!t.href||!o||"map"!==i.nodeName.toLowerCase())&&0<(i=x("img[usemap='#"+o+"']")).length&&i.is(":visible")):(/^(input|select|textarea|button|object)$/.test(s)?(n=!t.disabled)&&(o=x(t).closest("fieldset")[0])&&(n=!o.disabled):n="a"===s&&t.href||e,n&&x(t).is(":visible")&&function(t){var e=t.css("visibility");for(;"inherit"===e;)t=t.parent(),e=t.css("visibility");return"visible"===e}(x(t)))},x.extend(x.expr.pseudos,{focusable:function(t){return x.ui.focusable(t,null!=x.attr(t,"tabindex"))}}),x.fn._form=function(){return"string"==typeof this[0].form?this.closest("form"):x(this[0].form)},
x.ui.formResetMixin={_formResetHandler:function(){var e=x(this);setTimeout(function(){var t=e.data("ui-form-reset-instances");x.each(t,function(){this.refresh()})})},_bindFormResetHandler:function(){var t;this.form=this.element._form(),this.form.length&&((t=this.form.data("ui-form-reset-instances")||[]).length||this.form.on("reset.ui-form-reset",this._formResetHandler),t.push(this),this.form.data("ui-form-reset-instances",t))},_unbindFormResetHandler:function(){var t;this.form.length&&((t=this.form.data("ui-form-reset-instances")).splice(x.inArray(this,t),1),t.length?this.form.data("ui-form-reset-instances",t):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset"))}},x.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),
x.expr.pseudos||(x.expr.pseudos=x.expr[":"]),x.uniqueSort||(x.uniqueSort=x.unique),x.escapeSelector||(e=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,i=function(t,e){return e?"\0"===t?"�":t.slice(0,-1)+"\\"+t.charCodeAt(t.length-1).toString(16)+" ":"\\"+t},x.escapeSelector=function(t){return(t+"").replace(e,i)}),x.fn.even&&x.fn.odd||x.fn.extend({even:function(){return this.filter(function(t){return t%2==0})},odd:function(){return this.filter(function(t){return t%2==1})}}),
x.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},
x.fn.labels=function(){var t,e,i;return this.length?this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(e=this.eq(0).parents("label"),(t=this.attr("id"))&&(i=(i=this.eq(0).parents().last()).add((i.length?i:this).siblings()),t="label[for='"+x.escapeSelector(t)+"']",e=e.add(i.find(t).addBack(t))),this.pushStack(e)):this.pushStack([])},x.ui.plugin={add:function(t,e,i){var n,o=x.ui[t].prototype;for(n in i)o.plugins[n]=o.plugins[n]||[],o.plugins[n].push([e,i[n]])},call:function(t,e,i,n){var o,s=t.plugins[e];if(s&&(n||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(o=0;o<s.length;o++)t.options[s[o][0]]&&s[o][1].apply(t.element,i)}},
W=Math.max,C=Math.abs,o=/left|center|right/,s=/top|center|bottom/,r=/[\+\-]\d+(\.[\d]+)?%?/,l=/^\w+/,a=/%$/,h=x.fn.position,x.position={scrollbarWidth:function(){var t,e,i;return void 0!==n?n:(i=(e=x("<div style='display:block;position:absolute;width:200px;height:200px;overflow:hidden;'><div style='height:300px;width:auto;'></div></div>")).children()[0],x("body").append(e),t=i.offsetWidth,e.css("overflow","scroll"),t===(i=i.offsetWidth)&&(i=e[0].clientWidth),e.remove(),n=t-i)},getScrollInfo:function(t){var e=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),i=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),e="scroll"===e||"auto"===e&&t.width<t.element[0].scrollWidth;return{width:"scroll"===i||"auto"===i&&t.height<t.element[0].scrollHeight?x.position.scrollbarWidth():0,height:e?x.position.scrollbarWidth():0}},getWithinInfo:function(t){var e=x(t||window),i=N(e[0]),n=!!e[0]&&9===e[0].nodeType;return{element:e,isWindow:i,isDocument:n,offset:!i&&!n?x(t).offset():{left:0,top:0},scrollLeft:e.scrollLeft(),scrollTop:e.scrollTop(),width:e.outerWidth(),height:e.outerHeight()}}},x.fn.position=function(f){var c,d,p,g,m,v,y,w,b,_,t,e;return f&&f.of?(v="string"==typeof(f=x.extend({},f)).of?x(document).find(f.of):x(f.of),y=x.position.getWithinInfo(f.within),w=x.position.getScrollInfo(y),b=(f.collision||"flip").split(" "),_={},e=9===(e=(t=v)[0]).nodeType?{width:t.width(),height:t.height(),offset:{top:0,left:0}}:N(e)?{width:t.width(),height:t.height(),offset:{top:t.scrollTop(),left:t.scrollLeft()}}:e.preventDefault?{width:0,height:0,offset:{top:e.pageY,left:e.pageX}}:{width:t.outerWidth(),height:t.outerHeight(),offset:t.offset()},v[0].preventDefault&&(f.at="left top"),d=e.width,p=e.height,m=x.extend({},g=e.offset),x.each(["my","at"],function(){var t,e,i=(f[this]||"").split(" ");(i=1===i.length?o.test(i[0])?i.concat(["center"]):s.test(i[0])?["center"].concat(i):["center","center"]:i)[0]=o.test(i[0])?i[0]:"center",i[1]=s.test(i[1])?i[1]:"center",t=r.exec(i[0]),e=r.exec(i[1]),_[this]=[t?t[0]:0,e?e[0]:0],f[this]=[l.exec(i[0])[0],l.exec(i[1])[0]]}),1===b.length&&(b[1]=b[0]),"right"===f.at[0]?m.left+=d:"center"===f.at[0]&&(m.left+=d/2),"bottom"===f.at[1]?m.top+=p:"center"===f.at[1]&&(m.top+=p/2),c=E(_.at,d,p),m.left+=c[0],m.top+=c[1],this.each(function(){var i,t,r=x(this),l=r.outerWidth(),a=r.outerHeight(),e=L(this,"marginLeft"),n=L(this,"marginTop"),o=l+e+L(this,"marginRight")+w.width,s=a+n+L(this,"marginBottom")+w.height,h=x.extend({},m),u=E(_.my,r.outerWidth(),r.outerHeight());"right"===f.my[0]?h.left-=l:"center"===f.my[0]&&(h.left-=l/2),"bottom"===f.my[1]?h.top-=a:"center"===f.my[1]&&(h.top-=a/2),h.left+=u[0],h.top+=u[1],i={marginLeft:e,marginTop:n},x.each(["left","top"],function(t,e){x.ui.position[b[t]]&&x.ui.position[b[t]][e](h,{targetWidth:d,targetHeight:p,elemWidth:l,elemHeight:a,collisionPosition:i,collisionWidth:o,collisionHeight:s,offset:[c[0]+u[0],c[1]+u[1]],my:f.my,at:f.at,within:y,elem:r})}),f.using&&(t=function(t){var e=g.left-h.left,i=e+d-l,n=g.top-h.top,o=n+p-a,s={target:{element:v,left:g.left,top:g.top,width:d,height:p},element:{element:r,left:h.left,top:h.top,width:l,height:a},horizontal:i<0?"left":0<e?"right":"center",vertical:o<0?"top":0<n?"bottom":"middle"};d<l&&C(e+i)<d&&(s.horizontal="center"),p<a&&C(n+o)<p&&(s.vertical="middle"),W(C(e),C(i))>W(C(n),C(o))?s.important="horizontal":s.important="vertical",f.using.call(this,t,s)}),r.offset(x.extend(h,{using:t}))})):h.apply(this,arguments)},x.ui.position={fit:{left:function(t,e){var i,n=e.within,o=n.isWindow?n.scrollLeft:n.offset.left,n=n.width,s=t.left-e.collisionPosition.marginLeft,r=o-s,l=s+e.collisionWidth-n-o;e.collisionWidth>n?0<r&&l<=0?(i=t.left+r+e.collisionWidth-n-o,t.left+=r-i):t.left=!(0<l&&r<=0)&&l<r?o+n-e.collisionWidth:o:0<r?t.left+=r:0<l?t.left-=l:t.left=W(t.left-s,t.left)},top:function(t,e){var i,n=e.within,n=n.isWindow?n.scrollTop:n.offset.top,o=e.within.height,s=t.top-e.collisionPosition.marginTop,r=n-s,l=s+e.collisionHeight-o-n;e.collisionHeight>o?0<r&&l<=0?(i=t.top+r+e.collisionHeight-o-n,t.top+=r-i):t.top=!(0<l&&r<=0)&&l<r?n+o-e.collisionHeight:n:0<r?t.top+=r:0<l?t.top-=l:t.top=W(t.top-s,t.top)}},flip:{left:function(t,e){var i=e.within,n=i.offset.left+i.scrollLeft,o=i.width,i=i.isWindow?i.scrollLeft:i.offset.left,s=t.left-e.collisionPosition.marginLeft,r=s-i,s=s+e.collisionWidth-o-i,l="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,a="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,h=-2*e.offset[0];r<0?((o=t.left+l+a+h+e.collisionWidth-o-n)<0||o<C(r))&&(t.left+=l+a+h):0<s&&(0<(n=t.left-e.collisionPosition.marginLeft+l+a+h-i)||C(n)<s)&&(t.left+=l+a+h)},top:function(t,e){var i=e.within,n=i.offset.top+i.scrollTop,o=i.height,i=i.isWindow?i.scrollTop:i.offset.top,s=t.top-e.collisionPosition.marginTop,r=s-i,s=s+e.collisionHeight-o-i,l="top"===e.my[1]?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,a="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,h=-2*e.offset[1];r<0?((o=t.top+l+a+h+e.collisionHeight-o-n)<0||o<C(r))&&(t.top+=l+a+h):0<s&&(0<(n=t.top-e.collisionPosition.marginTop+l+a+h-i)||C(n)<s)&&(t.top+=l+a+h)}},flipfit:{left:function(){x.ui.position.flip.left.apply(this,arguments),x.ui.position.fit.left.apply(this,arguments)},top:function(){x.ui.position.flip.top.apply(this,arguments),x.ui.position.fit.top.apply(this,arguments)}}},x.ui.safeActiveElement=function(e){var i;try{i=e.activeElement}catch(t){i=e.body}return i=(i=i||e.body).nodeName?i:e.body},x.ui.safeBlur=function(t){t&&"body"!==t.nodeName.toLowerCase()&&x(t).trigger("blur")},
x.fn.scrollParent=function(t){var e=this.css("position"),i="absolute"===e,n=t?/(auto|scroll|hidden)/:/(auto|scroll)/,t=this.parents().filter(function(){var t=x(this);return(!i||"static"!==t.css("position"))&&n.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==e&&t.length?t:x(this[0].ownerDocument||document)},
x.extend(x.expr.pseudos,{tabbable:function(t){var e=x.attr(t,"tabindex"),i=null!=e;return(!i||0<=e)&&x.ui.focusable(t,i)}}),
x.fn.extend({uniqueId:(u=0,function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++u)})}),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&x(this).removeAttr("id")})}});
var f,c=0,d=Array.prototype.hasOwnProperty,p=Array.prototype.slice;x.cleanData=(f=x.cleanData,function(t){for(var e,i,n=0;null!=(i=t[n]);n++)(e=x._data(i,"events"))&&e.remove&&x(i).triggerHandler("remove");f(t)}),x.widget=function(t,i,e){var n,o,s,r={},l=t.split(".")[0],a=l+"-"+(t=t.split(".")[1]);return e||(e=i,i=x.Widget),Array.isArray(e)&&(e=x.extend.apply(null,[{}].concat(e))),x.expr.pseudos[a.toLowerCase()]=function(t){return!!x.data(t,a)},x[l]=x[l]||{},n=x[l][t],o=x[l][t]=function(t,e){if(!this||!this._createWidget)return new o(t,e);arguments.length&&this._createWidget(t,e)},x.extend(o,n,{version:e.version,_proto:x.extend({},e),_childConstructors:[]}),(s=new i).options=x.widget.extend({},s.options),x.each(e,function(e,n){function o(){return i.prototype[e].apply(this,arguments)}function s(t){return i.prototype[e].apply(this,t)}r[e]="function"!=typeof n?n:function(){var t,e=this._super,i=this._superApply;return this._super=o,this._superApply=s,t=n.apply(this,arguments),this._super=e,this._superApply=i,t}}),o.prototype=x.widget.extend(s,{widgetEventPrefix:n&&s.widgetEventPrefix||t},r,{constructor:o,namespace:l,widgetName:t,widgetFullName:a}),n?(x.each(n._childConstructors,function(t,e){var i=e.prototype;x.widget(i.namespace+"."+i.widgetName,o,e._proto)}),delete n._childConstructors):i._childConstructors.push(o),x.widget.bridge(t,o),o},x.widget.extend=function(t){for(var e,i,n=p.call(arguments,1),o=0,s=n.length;o<s;o++)for(e in n[o])i=n[o][e],d.call(n[o],e)&&void 0!==i&&(x.isPlainObject(i)?t[e]=x.isPlainObject(t[e])?x.widget.extend({},t[e],i):x.widget.extend({},i):t[e]=i);return t},x.widget.bridge=function(s,e){var r=e.prototype.widgetFullName||s;x.fn[s]=function(i){var t="string"==typeof i,n=p.call(arguments,1),o=this;return t?this.length||"instance"!==i?this.each(function(){var t,e=x.data(this,r);return"instance"===i?(o=e,!1):e?"function"!=typeof e[i]||"_"===i.charAt(0)?x.error("no such method '"+i+"' for "+s+" widget instance"):(t=e[i].apply(e,n))!==e&&void 0!==t?(o=t&&t.jquery?o.pushStack(t.get()):t,!1):void 0:x.error("cannot call methods on "+s+" prior to initialization; attempted to call method '"+i+"'")}):o=void 0:(n.length&&(i=x.widget.extend.apply(null,[i].concat(n))),this.each(function(){var t=x.data(this,r);t?(t.option(i||{}),t._init&&t._init()):x.data(this,r,new e(i,this))})),o}},x.Widget=function(){},x.Widget._childConstructors=[],x.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{classes:{},disabled:!1,create:null},_createWidget:function(t,e){e=x(e||this.defaultElement||this)[0],this.element=x(e),this.uuid=c++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=x(),this.hoverable=x(),this.focusable=x(),this.classesElementLookup={},e!==this&&(x.data(e,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===e&&this.destroy()}}),this.document=x(e.style?e.ownerDocument:e.document||e),this.window=x(this.document[0].defaultView||this.document[0].parentWindow)),this.options=x.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:x.noop,_create:x.noop,_init:x.noop,destroy:function(){var i=this;this._destroy(),x.each(this.classesElementLookup,function(t,e){i._removeClass(e,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:x.noop,widget:function(){return this.element},option:function(t,e){var i,n,o,s=t;if(0===arguments.length)return x.widget.extend({},this.options);if("string"==typeof t)if(s={},t=(i=t.split(".")).shift(),i.length){for(n=s[t]=x.widget.extend({},this.options[t]),o=0;o<i.length-1;o++)n[i[o]]=n[i[o]]||{},n=n[i[o]];if(t=i.pop(),1===arguments.length)return void 0===n[t]?null:n[t];n[t]=e}else{if(1===arguments.length)return void 0===this.options[t]?null:this.options[t];s[t]=e}return this._setOptions(s),this},_setOptions:function(t){for(var e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(t){var e,i,n;for(e in t)n=this.classesElementLookup[e],t[e]!==this.options.classes[e]&&n&&n.length&&(i=x(n.get()),this._removeClass(n,e),i.addClass(this._classes({element:i,keys:e,classes:t,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(o){var s=[],r=this;function t(t,e){for(var i,n=0;n<t.length;n++)i=r.classesElementLookup[t[n]]||x(),i=o.add?(function(){var i=[];o.element.each(function(t,e){x.map(r.classesElementLookup,function(t){return t}).some(function(t){return t.is(e)})||i.push(e)}),r._on(x(i),{remove:"_untrackClassesElement"})}(),x(x.uniqueSort(i.get().concat(o.element.get())))):x(i.not(o.element).get()),r.classesElementLookup[t[n]]=i,s.push(t[n]),e&&o.classes[t[n]]&&s.push(o.classes[t[n]])}return(o=x.extend({element:this.element,classes:this.options.classes||{}},o)).keys&&t(o.keys.match(/\S+/g)||[],!0),o.extra&&t(o.extra.match(/\S+/g)||[]),s.join(" ")},_untrackClassesElement:function(i){var n=this;x.each(n.classesElementLookup,function(t,e){-1!==x.inArray(i.target,e)&&(n.classesElementLookup[t]=x(e.not(i.target).get()))}),this._off(x(i.target))},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,n){var o="string"==typeof t||null===t,e={extra:o?e:i,keys:o?t:e,element:o?this.element:t,add:n="boolean"==typeof n?n:i};return e.element.toggleClass(this._classes(e),n),this},_on:function(o,s,t){var r,l=this;"boolean"!=typeof o&&(t=s,s=o,o=!1),t?(s=r=x(s),this.bindings=this.bindings.add(s)):(t=s,s=this.element,r=this.widget()),x.each(t,function(t,e){function i(){if(o||!0!==l.options.disabled&&!x(this).hasClass("ui-state-disabled"))return("string"==typeof e?l[e]:e).apply(l,arguments)}"string"!=typeof e&&(i.guid=e.guid=e.guid||i.guid||x.guid++);var t=t.match(/^([\w:-]*)\s*(.*)$/),n=t[1]+l.eventNamespace,t=t[2];t?r.on(n,t,i):s.on(n,i)})},_off:function(t,e){e=(e||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.off(e),this.bindings=x(this.bindings.not(t).get()),this.focusable=x(this.focusable.not(t).get()),this.hoverable=x(this.hoverable.not(t).get())},_delay:function(t,e){var i=this;return setTimeout(function(){return("string"==typeof t?i[t]:t).apply(i,arguments)},e||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){this._addClass(x(t.currentTarget),null,"ui-state-hover")},mouseleave:function(t){this._removeClass(x(t.currentTarget),null,"ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){this._addClass(x(t.currentTarget),null,"ui-state-focus")},focusout:function(t){this._removeClass(x(t.currentTarget),null,"ui-state-focus")}})},_trigger:function(t,e,i){var n,o,s=this.options[t];if(i=i||{},(e=x.Event(e)).type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),e.target=this.element[0],o=e.originalEvent)for(n in o)n in e||(e[n]=o[n]);return this.element.trigger(e,i),!("function"==typeof s&&!1===s.apply(this.element[0],[e].concat(i))||e.isDefaultPrevented())}},x.each({show:"fadeIn",hide:"fadeOut"},function(s,r){x.Widget.prototype["_"+s]=function(e,t,i){var n,o=(t="string"==typeof t?{effect:t}:t)?!0!==t&&"number"!=typeof t&&t.effect||r:s;"number"==typeof(t=t||{})?t={duration:t}:!0===t&&(t={}),n=!x.isEmptyObject(t),t.complete=i,t.delay&&e.delay(t.delay),n&&x.effects&&x.effects.effect[o]?e[s](t):o!==s&&e[o]?e[o](t.duration,t.easing,i):e.queue(function(t){x(this)[s](),i&&i.call(e[0]),t()})}})});
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery","../ie","../version","../widget"],e):e(jQuery)}(function(o){"use strict";var n=!1;return o(document).on("mouseup",function(){n=!1}),o.widget("ui.mouse",{version:"1.13.3",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.on("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).on("click."+this.widgetName,function(e){if(!0===o.data(e.target,t.widgetName+".preventClickEvent"))return o.removeData(e.target,t.widgetName+".preventClickEvent"),e.stopImmediatePropagation(),!1}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){var t,i,s;if(!n)return this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),i=1===(this._mouseDownEvent=e).which,s=!("string"!=typeof(t=this).options.cancel||!e.target.nodeName)&&o(e.target).closest(this.options.cancel).length,i&&!s&&this._mouseCapture(e)&&(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){t.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=!1!==this._mouseStart(e),!this._mouseStarted)?e.preventDefault():(!0===o.data(e.target,this.widgetName+".preventClickEvent")&&o.removeData(e.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return t._mouseMove(e)},this._mouseUpDelegate=function(e){return t._mouseUp(e)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),n=!0)),!0},_mouseMove:function(e){if(this._mouseMoved){if(o.ui.ie&&(!document.documentMode||document.documentMode<9)&&!e.button)return this._mouseUp(e);if(!e.which)if(e.originalEvent.altKey||e.originalEvent.ctrlKey||e.originalEvent.metaKey||e.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(e)}return(e.which||e.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=!1!==this._mouseStart(this._mouseDownEvent,e),this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&o.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,n=!1,e.preventDefault()},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})});
!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery","./mouse","../data","../plugin","../safe-active-element","../safe-blur","../scroll-parent","../version","../widget"],t):t(jQuery)}(function(P){"use strict";return P.widget("ui.draggable",P.ui.mouse,{version:"1.13.3",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this._addClass("ui-draggable"),this._setHandleClassName(),this._mouseInit()},_setOption:function(t,e){this._super(t,e),"handle"===t&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){(this.helper||this.element).is(".ui-draggable-dragging")?this.destroyOnClear=!0:(this._removeHandleClassName(),this._mouseDestroy())},_mouseCapture:function(t){var e=this.options;return!(this.helper||e.disabled||0<P(t.target).closest(".ui-resizable-handle").length||(this.handle=this._getHandle(t),!this.handle)||(this._blurActiveElement(t),this._blockFrames(!0===e.iframeFix?"iframe":e.iframeFix),0))},_blockFrames:function(t){this.iframeBlocks=this.document.find(t).map(function(){var t=P(this);return P("<div>").css("position","absolute").appendTo(t.parent()).outerWidth(t.outerWidth()).outerHeight(t.outerHeight()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(t){var e=P.ui.safeActiveElement(this.document[0]);P(t.target).closest(e).length||P.ui.safeBlur(e)},_mouseStart:function(t){var e=this.options;return this.helper=this._createHelper(t),this._addClass(this.helper,"ui-draggable-dragging"),this._cacheHelperProportions(),P.ui.ddmanager&&(P.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=0<this.helper.parents().filter(function(){return"fixed"===P(this).css("position")}).length,this.positionAbs=this.element.offset(),this._refreshOffsets(t),this.originalPosition=this.position=this._generatePosition(t,!1),this.originalPageX=t.pageX,this.originalPageY=t.pageY,e.cursorAt&&this._adjustOffsetFromHelper(e.cursorAt),this._setContainment(),!1===this._trigger("start",t)?(this._clear(),!1):(this._cacheHelperProportions(),P.ui.ddmanager&&!e.dropBehaviour&&P.ui.ddmanager.prepareOffsets(this,t),this._mouseDrag(t,!0),P.ui.ddmanager&&P.ui.ddmanager.dragStart(this,t),!0)},_refreshOffsets:function(t){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:t.pageX-this.offset.left,top:t.pageY-this.offset.top}},_mouseDrag:function(t,e){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t,!0),this.positionAbs=this._convertPositionTo("absolute"),!e){e=this._uiHash();if(!1===this._trigger("drag",t,e))return this._mouseUp(new P.Event("mouseup",t)),!1;this.position=e.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",P.ui.ddmanager&&P.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var e=this,s=!1;return P.ui.ddmanager&&!this.options.dropBehaviour&&(s=P.ui.ddmanager.drop(this,t)),this.dropped&&(s=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||!0===this.options.revert||"function"==typeof this.options.revert&&this.options.revert.call(this.element,s)?P(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){!1!==e._trigger("stop",t)&&e._clear()}):!1!==this._trigger("stop",t)&&this._clear(),!1},_mouseUp:function(t){return this._unblockFrames(),P.ui.ddmanager&&P.ui.ddmanager.dragStop(this,t),this.handleElement.is(t.target)&&this.element.trigger("focus"),P.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp(new P.Event("mouseup",{target:this.element[0]})):this._clear(),this},_getHandle:function(t){return!this.options.handle||!!P(t.target).closest(this.element.find(this.options.handle)).length},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this._addClass(this.handleElement,"ui-draggable-handle")},_removeHandleClassName:function(){this._removeClass(this.handleElement,"ui-draggable-handle")},_createHelper:function(t){var e=this.options,s="function"==typeof e.helper,t=s?P(e.helper.apply(this.element[0],[t])):"clone"===e.helper?this.element.clone().removeAttr("id"):this.element;return t.parents("body").length||t.appendTo("parent"===e.appendTo?this.element[0].parentNode:e.appendTo),s&&t[0]===this.element[0]&&this._setPositionRelative(),t[0]===this.element[0]||/(fixed|absolute)/.test(t.css("position"))||t.css("position","absolute"),t},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),"left"in(t=Array.isArray(t)?{left:+t[0],top:+t[1]||0}:t)&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_isRootNode:function(t){return/(html|body)/i.test(t.tagName)||t===this.document[0]},_getParentOffset:function(){var t=this.offsetParent.offset(),e=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==e&&P.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),{top:(t=this._isRootNode(this.offsetParent[0])?{top:0,left:0}:t).top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){var t,e;return"relative"!==this.cssPosition?{top:0,left:0}:(t=this.element.position(),e=this._isRootNode(this.scrollParent[0]),{top:t.top-(parseInt(this.helper.css("top"),10)||0)+(e?0:this.scrollParent.scrollTop()),left:t.left-(parseInt(this.helper.css("left"),10)||0)+(e?0:this.scrollParent.scrollLeft())})},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,e=this.options,s=this.document[0];this.relativeContainer=null,e.containment?"window"===e.containment?this.containment=[P(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,P(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,P(window).scrollLeft()+P(window).width()-this.helperProportions.width-this.margins.left,P(window).scrollTop()+(P(window).height()||s.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]:"document"===e.containment?this.containment=[0,0,P(s).width()-this.helperProportions.width-this.margins.left,(P(s).height()||s.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]:e.containment.constructor===Array?this.containment=e.containment:("parent"===e.containment&&(e.containment=this.helper[0].parentNode),(e=(s=P(e.containment))[0])&&(t=/(scroll|auto)/.test(s.css("overflow")),this.containment=[(parseInt(s.css("borderLeftWidth"),10)||0)+(parseInt(s.css("paddingLeft"),10)||0),(parseInt(s.css("borderTopWidth"),10)||0)+(parseInt(s.css("paddingTop"),10)||0),(t?Math.max(e.scrollWidth,e.offsetWidth):e.offsetWidth)-(parseInt(s.css("borderRightWidth"),10)||0)-(parseInt(s.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(e.scrollHeight,e.offsetHeight):e.offsetHeight)-(parseInt(s.css("borderBottomWidth"),10)||0)-(parseInt(s.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=s)):this.containment=null},_convertPositionTo:function(t,e){e=e||this.position;var t="absolute"===t?1:-1,s=this._isRootNode(this.scrollParent[0]);return{top:e.top+this.offset.relative.top*t+this.offset.parent.top*t-("fixed"===this.cssPosition?-this.offset.scroll.top:s?0:this.offset.scroll.top)*t,left:e.left+this.offset.relative.left*t+this.offset.parent.left*t-("fixed"===this.cssPosition?-this.offset.scroll.left:s?0:this.offset.scroll.left)*t}},_generatePosition:function(t,e){var s,i=this.options,o=this._isRootNode(this.scrollParent[0]),n=t.pageX,r=t.pageY;return o&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),{top:(r=e&&(this.containment&&(s=this.relativeContainer?(e=this.relativeContainer.offset(),[this.containment[0]+e.left,this.containment[1]+e.top,this.containment[2]+e.left,this.containment[3]+e.top]):this.containment,t.pageX-this.offset.click.left<s[0]&&(n=s[0]+this.offset.click.left),t.pageY-this.offset.click.top<s[1]&&(r=s[1]+this.offset.click.top),t.pageX-this.offset.click.left>s[2]&&(n=s[2]+this.offset.click.left),t.pageY-this.offset.click.top>s[3])&&(r=s[3]+this.offset.click.top),i.grid&&(e=i.grid[1]?this.originalPageY+Math.round((r-this.originalPageY)/i.grid[1])*i.grid[1]:this.originalPageY,r=!s||e-this.offset.click.top>=s[1]||e-this.offset.click.top>s[3]?e:e-this.offset.click.top>=s[1]?e-i.grid[1]:e+i.grid[1],t=i.grid[0]?this.originalPageX+Math.round((n-this.originalPageX)/i.grid[0])*i.grid[0]:this.originalPageX,n=!s||t-this.offset.click.left>=s[0]||t-this.offset.click.left>s[2]?t:t-this.offset.click.left>=s[0]?t-i.grid[0]:t+i.grid[0]),"y"===i.axis&&(n=this.originalPageX),"x"===i.axis)?this.originalPageY:r)-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:o?0:this.offset.scroll.top),left:n-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:o?0:this.offset.scroll.left)}},_clear:function(){this._removeClass(this.helper,"ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_trigger:function(t,e,s){return s=s||this._uiHash(),P.ui.plugin.call(this,t,[e,s,this],!0),/^(drag|start|stop)/.test(t)&&(this.positionAbs=this._convertPositionTo("absolute"),s.offset=this.positionAbs),P.Widget.prototype._trigger.call(this,t,e,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),P.ui.plugin.add("draggable","connectToSortable",{start:function(e,t,s){var i=P.extend({},t,{item:s.element});s.sortables=[],P(s.options.connectToSortable).each(function(){var t=P(this).sortable("instance");t&&!t.options.disabled&&(s.sortables.push(t),t.refreshPositions(),t._trigger("activate",e,i))})},stop:function(e,t,s){var i=P.extend({},t,{item:s.element});s.cancelHelperRemoval=!1,P.each(s.sortables,function(){var t=this;t.isOver?(t.isOver=0,s.cancelHelperRemoval=!0,t.cancelHelperRemoval=!1,t._storedCSS={position:t.placeholder.css("position"),top:t.placeholder.css("top"),left:t.placeholder.css("left")},t._mouseStop(e),t.options.helper=t.options._helper):(t.cancelHelperRemoval=!0,t._trigger("deactivate",e,i))})},drag:function(s,i,o){P.each(o.sortables,function(){var t=!1,e=this;e.positionAbs=o.positionAbs,e.helperProportions=o.helperProportions,e.offset.click=o.offset.click,e._intersectsWith(e.containerCache)&&(t=!0,P.each(o.sortables,function(){return this.positionAbs=o.positionAbs,this.helperProportions=o.helperProportions,this.offset.click=o.offset.click,t=this!==e&&this._intersectsWith(this.containerCache)&&P.contains(e.element[0],this.element[0])?!1:t})),t?(e.isOver||(e.isOver=1,o._parent=i.helper.parent(),e.currentItem=i.helper.appendTo(e.element).data("ui-sortable-item",!0),e.options._helper=e.options.helper,e.options.helper=function(){return i.helper[0]},s.target=e.currentItem[0],e._mouseCapture(s,!0),e._mouseStart(s,!0,!0),e.offset.click.top=o.offset.click.top,e.offset.click.left=o.offset.click.left,e.offset.parent.left-=o.offset.parent.left-e.offset.parent.left,e.offset.parent.top-=o.offset.parent.top-e.offset.parent.top,o._trigger("toSortable",s),o.dropped=e.element,P.each(o.sortables,function(){this.refreshPositions()}),o.currentItem=o.element,e.fromOutside=o),e.currentItem&&(e._mouseDrag(s),i.position=e.position)):e.isOver&&(e.isOver=0,e.cancelHelperRemoval=!0,e.options._revert=e.options.revert,e.options.revert=!1,e._trigger("out",s,e._uiHash(e)),e._mouseStop(s,!0),e.options.revert=e.options._revert,e.options.helper=e.options._helper,e.placeholder&&e.placeholder.remove(),i.helper.appendTo(o._parent),o._refreshOffsets(s),i.position=o._generatePosition(s,!0),o._trigger("fromSortable",s),o.dropped=!1,P.each(o.sortables,function(){this.refreshPositions()}))})}}),P.ui.plugin.add("draggable","cursor",{start:function(t,e,s){var i=P("body"),s=s.options;i.css("cursor")&&(s._cursor=i.css("cursor")),i.css("cursor",s.cursor)},stop:function(t,e,s){s=s.options;s._cursor&&P("body").css("cursor",s._cursor)}}),P.ui.plugin.add("draggable","opacity",{start:function(t,e,s){e=P(e.helper),s=s.options;e.css("opacity")&&(s._opacity=e.css("opacity")),e.css("opacity",s.opacity)},stop:function(t,e,s){s=s.options;s._opacity&&P(e.helper).css("opacity",s._opacity)}}),P.ui.plugin.add("draggable","scroll",{start:function(t,e,s){s.scrollParentNotHidden||(s.scrollParentNotHidden=s.helper.scrollParent(!1)),s.scrollParentNotHidden[0]!==s.document[0]&&"HTML"!==s.scrollParentNotHidden[0].tagName&&(s.overflowOffset=s.scrollParentNotHidden.offset())},drag:function(t,e,s){var i=s.options,o=!1,n=s.scrollParentNotHidden[0],r=s.document[0];n!==r&&"HTML"!==n.tagName?(i.axis&&"x"===i.axis||(s.overflowOffset.top+n.offsetHeight-t.pageY<i.scrollSensitivity?n.scrollTop=o=n.scrollTop+i.scrollSpeed:t.pageY-s.overflowOffset.top<i.scrollSensitivity&&(n.scrollTop=o=n.scrollTop-i.scrollSpeed)),i.axis&&"y"===i.axis||(s.overflowOffset.left+n.offsetWidth-t.pageX<i.scrollSensitivity?n.scrollLeft=o=n.scrollLeft+i.scrollSpeed:t.pageX-s.overflowOffset.left<i.scrollSensitivity&&(n.scrollLeft=o=n.scrollLeft-i.scrollSpeed))):(i.axis&&"x"===i.axis||(t.pageY-P(r).scrollTop()<i.scrollSensitivity?o=P(r).scrollTop(P(r).scrollTop()-i.scrollSpeed):P(window).height()-(t.pageY-P(r).scrollTop())<i.scrollSensitivity&&(o=P(r).scrollTop(P(r).scrollTop()+i.scrollSpeed))),i.axis&&"y"===i.axis||(t.pageX-P(r).scrollLeft()<i.scrollSensitivity?o=P(r).scrollLeft(P(r).scrollLeft()-i.scrollSpeed):P(window).width()-(t.pageX-P(r).scrollLeft())<i.scrollSensitivity&&(o=P(r).scrollLeft(P(r).scrollLeft()+i.scrollSpeed)))),!1!==o&&P.ui.ddmanager&&!i.dropBehaviour&&P.ui.ddmanager.prepareOffsets(s,t)}}),P.ui.plugin.add("draggable","snap",{start:function(t,e,s){var i=s.options;s.snapElements=[],P(i.snap.constructor!==String?i.snap.items||":data(ui-draggable)":i.snap).each(function(){var t=P(this),e=t.offset();this!==s.element[0]&&s.snapElements.push({item:this,width:t.outerWidth(),height:t.outerHeight(),top:e.top,left:e.left})})},drag:function(t,e,s){for(var i,o,n,r,l,a,h,p,c,f=s.options,d=f.snapTolerance,g=e.offset.left,u=g+s.helperProportions.width,m=e.offset.top,v=m+s.helperProportions.height,_=s.snapElements.length-1;0<=_;_--)a=(l=s.snapElements[_].left-s.margins.left)+s.snapElements[_].width,p=(h=s.snapElements[_].top-s.margins.top)+s.snapElements[_].height,u<l-d||a+d<g||v<h-d||p+d<m||!P.contains(s.snapElements[_].item.ownerDocument,s.snapElements[_].item)?(s.snapElements[_].snapping&&s.options.snap.release&&s.options.snap.release.call(s.element,t,P.extend(s._uiHash(),{snapItem:s.snapElements[_].item})),s.snapElements[_].snapping=!1):("inner"!==f.snapMode&&(i=Math.abs(h-v)<=d,o=Math.abs(p-m)<=d,n=Math.abs(l-u)<=d,r=Math.abs(a-g)<=d,i&&(e.position.top=s._convertPositionTo("relative",{top:h-s.helperProportions.height,left:0}).top),o&&(e.position.top=s._convertPositionTo("relative",{top:p,left:0}).top),n&&(e.position.left=s._convertPositionTo("relative",{top:0,left:l-s.helperProportions.width}).left),r)&&(e.position.left=s._convertPositionTo("relative",{top:0,left:a}).left),c=i||o||n||r,"outer"!==f.snapMode&&(i=Math.abs(h-m)<=d,o=Math.abs(p-v)<=d,n=Math.abs(l-g)<=d,r=Math.abs(a-u)<=d,i&&(e.position.top=s._convertPositionTo("relative",{top:h,left:0}).top),o&&(e.position.top=s._convertPositionTo("relative",{top:p-s.helperProportions.height,left:0}).top),n&&(e.position.left=s._convertPositionTo("relative",{top:0,left:l}).left),r)&&(e.position.left=s._convertPositionTo("relative",{top:0,left:a-s.helperProportions.width}).left),!s.snapElements[_].snapping&&(i||o||n||r||c)&&s.options.snap.snap&&s.options.snap.snap.call(s.element,t,P.extend(s._uiHash(),{snapItem:s.snapElements[_].item})),s.snapElements[_].snapping=i||o||n||r||c)}}),P.ui.plugin.add("draggable","stack",{start:function(t,e,s){var i,s=s.options,s=P.makeArray(P(s.stack)).sort(function(t,e){return(parseInt(P(t).css("zIndex"),10)||0)-(parseInt(P(e).css("zIndex"),10)||0)});s.length&&(i=parseInt(P(s[0]).css("zIndex"),10)||0,P(s).each(function(t){P(this).css("zIndex",i+t)}),this.css("zIndex",i+s.length))}}),P.ui.plugin.add("draggable","zIndex",{start:function(t,e,s){e=P(e.helper),s=s.options;e.css("zIndex")&&(s._zIndex=e.css("zIndex")),e.css("zIndex",s.zIndex)},stop:function(t,e,s){s=s.options;s._zIndex&&P(e.helper).css("zIndex",s._zIndex)}}),P.ui.draggable});
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery","./mouse","../keycode","../version","../widget"],e):e(jQuery)}(function(o){"use strict";return o.widget("ui.slider",o.ui.mouse,{version:"1.13.3",widgetEventPrefix:"slide",options:{animate:!1,classes:{"ui-slider":"ui-corner-all","ui-slider-handle":"ui-corner-all","ui-slider-range":"ui-corner-all ui-widget-header"},distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},numPages:5,_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this._calculateNewMax(),this._addClass("ui-slider ui-slider-"+this.orientation,"ui-widget ui-widget-content"),this._refresh(),this._animateOff=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var e,t=this.options,i=this.element.find(".ui-slider-handle"),s=[],a=t.values&&t.values.length||1;for(i.length>a&&(i.slice(a).remove(),i=i.slice(0,a)),e=i.length;e<a;e++)s.push("<span tabindex='0'></span>");this.handles=i.add(o(s.join("")).appendTo(this.element)),this._addClass(this.handles,"ui-slider-handle","ui-state-default"),this.handle=this.handles.eq(0),this.handles.each(function(e){o(this).data("ui-slider-handle-index",e).attr("tabIndex",0)})},_createRange:function(){var e=this.options;e.range?(!0===e.range&&(e.values?e.values.length&&2!==e.values.length?e.values=[e.values[0],e.values[0]]:Array.isArray(e.values)&&(e.values=e.values.slice(0)):e.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?(this._removeClass(this.range,"ui-slider-range-min ui-slider-range-max"),this.range.css({left:"",bottom:""})):(this.range=o("<div>").appendTo(this.element),this._addClass(this.range,"ui-slider-range")),"min"!==e.range&&"max"!==e.range||this._addClass(this.range,"ui-slider-range-"+e.range)):(this.range&&this.range.remove(),this.range=null)},_setupEvents:function(){this._off(this.handles),this._on(this.handles,this._handleEvents),this._hoverable(this.handles),this._focusable(this.handles)},_destroy:function(){this.handles.remove(),this.range&&this.range.remove(),this._mouseDestroy()},_mouseCapture:function(e){var i,s,a,n,t,h,l=this,u=this.options;return!u.disabled&&(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),t={x:e.pageX,y:e.pageY},i=this._normValueFromMouse(t),s=this._valueMax()-this._valueMin()+1,this.handles.each(function(e){var t=Math.abs(i-l.values(e));(t<s||s===t&&(e===l._lastChangedValue||l.values(e)===u.min))&&(s=t,a=o(this),n=e)}),!1!==this._start(e,n))&&(this._mouseSliding=!0,this._handleIndex=n,this._addClass(a,null,"ui-state-active"),a.trigger("focus"),t=a.offset(),h=!o(e.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=h?{left:0,top:0}:{left:e.pageX-t.left-a.width()/2,top:e.pageY-t.top-a.height()/2-(parseInt(a.css("borderTopWidth"),10)||0)-(parseInt(a.css("borderBottomWidth"),10)||0)+(parseInt(a.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(e,n,i),this._animateOff=!0)},_mouseStart:function(){return!0},_mouseDrag:function(e){var t={x:e.pageX,y:e.pageY},t=this._normValueFromMouse(t);return this._slide(e,this._handleIndex,t),!1},_mouseStop:function(e){return this._removeClass(this.handles,null,"ui-state-active"),this._mouseSliding=!1,this._stop(e,this._handleIndex),this._change(e,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(e){var t,e="horizontal"===this.orientation?(t=this.elementSize.width,e.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(t=this.elementSize.height,e.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),e=e/t;return(e=1<e?1:e)<0&&(e=0),"vertical"===this.orientation&&(e=1-e),t=this._valueMax()-this._valueMin(),e=this._valueMin()+e*t,this._trimAlignValue(e)},_uiHash:function(e,t,i){var s={handle:this.handles[e],handleIndex:e,value:void 0!==t?t:this.value()};return this._hasMultipleValues()&&(s.value=void 0!==t?t:this.values(e),s.values=i||this.values()),s},_hasMultipleValues:function(){return this.options.values&&this.options.values.length},_start:function(e,t){return this._trigger("start",e,this._uiHash(t))},_slide:function(e,t,i){var s,a=this.value(),n=this.values();this._hasMultipleValues()&&(s=this.values(t?0:1),a=this.values(t),2===this.options.values.length&&!0===this.options.range&&(i=0===t?Math.min(s,i):Math.max(s,i)),n[t]=i),i!==a&&!1!==this._trigger("slide",e,this._uiHash(t,i,n))&&(this._hasMultipleValues()?this.values(t,i):this.value(i))},_stop:function(e,t){this._trigger("stop",e,this._uiHash(t))},_change:function(e,t){this._keySliding||this._mouseSliding||(this._lastChangedValue=t,this._trigger("change",e,this._uiHash(t)))},value:function(e){if(!arguments.length)return this._value();this.options.value=this._trimAlignValue(e),this._refreshValue(),this._change(null,0)},values:function(e,t){var i,s,a;if(1<arguments.length)this.options.values[e]=this._trimAlignValue(t),this._refreshValue(),this._change(null,e);else{if(!arguments.length)return this._values();if(!Array.isArray(e))return this._hasMultipleValues()?this._values(e):this.value();for(i=this.options.values,s=e,a=0;a<i.length;a+=1)i[a]=this._trimAlignValue(s[a]),this._change(null,a);this._refreshValue()}},_setOption:function(e,t){var i,s=0;switch("range"===e&&!0===this.options.range&&("min"===t?(this.options.value=this._values(0),this.options.values=null):"max"===t&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),Array.isArray(this.options.values)&&(s=this.options.values.length),this._super(e,t),e){case"orientation":this._detectOrientation(),this._removeClass("ui-slider-horizontal ui-slider-vertical")._addClass("ui-slider-"+this.orientation),this._refreshValue(),this.options.range&&this._refreshRange(t),this.handles.css("horizontal"===t?"bottom":"left","");break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),i=s-1;0<=i;i--)this._change(null,i);this._animateOff=!1;break;case"step":case"min":case"max":this._animateOff=!0,this._calculateNewMax(),this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_setOptionDisabled:function(e){this._super(e),this._toggleClass(null,"ui-state-disabled",!!e)},_value:function(){var e=this.options.value;return this._trimAlignValue(e)},_values:function(e){var t,i;if(arguments.length)return e=this.options.values[e],this._trimAlignValue(e);if(this._hasMultipleValues()){for(t=this.options.values.slice(),i=0;i<t.length;i+=1)t[i]=this._trimAlignValue(t[i]);return t}return[]},_trimAlignValue:function(e){var t,i;return e<=this._valueMin()?this._valueMin():e>=this._valueMax()?this._valueMax():(t=0<this.options.step?this.options.step:1,i=e-(e=(e-this._valueMin())%t),2*Math.abs(e)>=t&&(i+=0<e?t:-t),parseFloat(i.toFixed(5)))},_calculateNewMax:function(){var e=this.options.max,t=this._valueMin(),i=this.options.step;(e=Math.round((e-t)/i)*i+t)>this.options.max&&(e-=i),this.max=parseFloat(e.toFixed(this._precision()))},_precision:function(){var e=this._precisionOf(this.options.step);return e=null!==this.options.min?Math.max(e,this._precisionOf(this.options.min)):e},_precisionOf:function(e){var e=e.toString(),t=e.indexOf(".");return-1===t?0:e.length-t-1},_valueMin:function(){return this.options.min},_valueMax:function(){return this.max},_refreshRange:function(e){"vertical"===e&&this.range.css({width:"",left:""}),"horizontal"===e&&this.range.css({height:"",bottom:""})},_refreshValue:function(){var t,i,e,s,a,n=this.options.range,h=this.options,l=this,u=!this._animateOff&&h.animate,r={};this._hasMultipleValues()?this.handles.each(function(e){i=(l.values(e)-l._valueMin())/(l._valueMax()-l._valueMin())*100,r["horizontal"===l.orientation?"left":"bottom"]=i+"%",o(this).stop(1,1)[u?"animate":"css"](r,h.animate),!0===l.options.range&&("horizontal"===l.orientation?(0===e&&l.range.stop(1,1)[u?"animate":"css"]({left:i+"%"},h.animate),1===e&&l.range[u?"animate":"css"]({width:i-t+"%"},{queue:!1,duration:h.animate})):(0===e&&l.range.stop(1,1)[u?"animate":"css"]({bottom:i+"%"},h.animate),1===e&&l.range[u?"animate":"css"]({height:i-t+"%"},{queue:!1,duration:h.animate}))),t=i}):(e=this.value(),s=this._valueMin(),a=this._valueMax(),i=a!==s?(e-s)/(a-s)*100:0,r["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[u?"animate":"css"](r,h.animate),"min"===n&&"horizontal"===this.orientation&&this.range.stop(1,1)[u?"animate":"css"]({width:i+"%"},h.animate),"max"===n&&"horizontal"===this.orientation&&this.range.stop(1,1)[u?"animate":"css"]({width:100-i+"%"},h.animate),"min"===n&&"vertical"===this.orientation&&this.range.stop(1,1)[u?"animate":"css"]({height:i+"%"},h.animate),"max"===n&&"vertical"===this.orientation&&this.range.stop(1,1)[u?"animate":"css"]({height:100-i+"%"},h.animate))},_handleEvents:{keydown:function(e){var t,i,s,a=o(e.target).data("ui-slider-handle-index");switch(e.keyCode){case o.ui.keyCode.HOME:case o.ui.keyCode.END:case o.ui.keyCode.PAGE_UP:case o.ui.keyCode.PAGE_DOWN:case o.ui.keyCode.UP:case o.ui.keyCode.RIGHT:case o.ui.keyCode.DOWN:case o.ui.keyCode.LEFT:if(e.preventDefault(),this._keySliding||(this._keySliding=!0,this._addClass(o(e.target),null,"ui-state-active"),!1!==this._start(e,a)))break;return}switch(s=this.options.step,t=i=this._hasMultipleValues()?this.values(a):this.value(),e.keyCode){case o.ui.keyCode.HOME:i=this._valueMin();break;case o.ui.keyCode.END:i=this._valueMax();break;case o.ui.keyCode.PAGE_UP:i=this._trimAlignValue(t+(this._valueMax()-this._valueMin())/this.numPages);break;case o.ui.keyCode.PAGE_DOWN:i=this._trimAlignValue(t-(this._valueMax()-this._valueMin())/this.numPages);break;case o.ui.keyCode.UP:case o.ui.keyCode.RIGHT:if(t===this._valueMax())return;i=this._trimAlignValue(t+s);break;case o.ui.keyCode.DOWN:case o.ui.keyCode.LEFT:if(t===this._valueMin())return;i=this._trimAlignValue(t-s)}this._slide(e,a,i)},keyup:function(e){var t=o(e.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(e,t),this._change(e,t),this._removeClass(o(e.target),null,"ui-state-active"))}}})});
(function(b){b.support.touch="ontouchend" in document;if(!b.support.touch){return}var c=b.ui.mouse.prototype,e=c._mouseInit,a;function d(g,h){if(g.originalEvent.touches.length>1){return}g.preventDefault();var i=g.originalEvent.changedTouches[0],f=document.createEvent("MouseEvents");f.initMouseEvent(h,true,true,window,1,i.screenX,i.screenY,i.clientX,i.clientY,false,false,false,false,0,null);g.target.dispatchEvent(f)}c._touchStart=function(g){var f=this;if(a||!f._mouseCapture(g.originalEvent.changedTouches[0])){return}a=true;f._touchMoved=false;d(g,"mouseover");d(g,"mousemove");d(g,"mousedown")};c._touchMove=function(f){if(!a){return}this._touchMoved=true;d(f,"mousemove")};c._touchEnd=function(f){if(!a){return}d(f,"mouseup");d(f,"mouseout");if(!this._touchMoved){d(f,"click")}a=false};c._mouseInit=function(){var f=this;f.element.bind("touchstart",b.proxy(f,"_touchStart")).bind("touchmove",b.proxy(f,"_touchMove")).bind("touchend",b.proxy(f,"_touchEnd"));e.call(f)}})(jQuery);
!function(a,b){function c(){var b,c,d="backgroundImage";j?k="filter":(b=a('<div id="iris-gradtest" />'),c="linear-gradient(top,#fff,#000)",a.each(l,function(a,e){if(b.css(d,e+c),b.css(d).match("gradient"))return k=a,!1}),!1===k&&(b.css("background","-webkit-gradient(linear,0% 0%,0% 100%,from(#fff),to(#000))"),b.css(d).match("gradient")&&(k="webkit")),b.remove())}function d(a,b){return a="top"===a?"top":"left",b=Array.isArray(b)?b:Array.prototype.slice.call(arguments,1),"webkit"===k?f(a,b):l[k]+"linear-gradient("+a+", "+b.join(", ")+")"}function e(b,c){var d,e,f,h,i,j,k,l,m;b="top"===b?"top":"left",c=Array.isArray(c)?c:Array.prototype.slice.call(arguments,1),d="top"===b?0:1,e=a(this),f=c.length-1,h="filter",i=1===d?"left":"top",j=1===d?"right":"bottom",k=1===d?"height":"width",l='<div class="iris-ie-gradient-shim" style="position:absolute;'+k+":100%;"+i+":%start%;"+j+":%end%;"+h+':%filter%;" data-color:"%color%"></div>',m="","static"===e.css("position")&&e.css({position:"relative"}),c=g(c),a.each(c,function(a,b){var e,g,h;if(a===f)return!1;e=c[a+1],b.stop!==e.stop&&(g=100-parseFloat(e.stop)+"%",b.octoHex=new Color(b.color).toIEOctoHex(),e.octoHex=new Color(e.color).toIEOctoHex(),h="progid:DXImageTransform.Microsoft.Gradient(GradientType="+d+", StartColorStr='"+b.octoHex+"', EndColorStr='"+e.octoHex+"')",m+=l.replace("%start%",b.stop).replace("%end%",g).replace("%filter%",h))}),e.find(".iris-ie-gradient-shim").remove(),a(m).prependTo(e)}function f(b,c){var d=[];return b="top"===b?"0% 0%,0% 100%,":"0% 100%,100% 100%,",c=g(c),a.each(c,function(a,b){d.push("color-stop("+parseFloat(b.stop)/100+", "+b.color+")")}),"-webkit-gradient(linear,"+b+d.join(",")+")"}function g(b){var c=[],d=[],e=[],f=b.length-1;return a.each(b,function(a,b){var e=b,f=!1,g=b.match(/1?[0-9]{1,2}%$/);g&&(e=b.replace(/\s?1?[0-9]{1,2}%$/,""),f=g.shift()),c.push(e),d.push(f)}),!1===d[0]&&(d[0]="0%"),!1===d[f]&&(d[f]="100%"),d=h(d),a.each(d,function(a){e[a]={color:c[a],stop:d[a]}}),e}function h(b){var c,d,e,f,g=0,i=b.length-1,j=0,k=!1;if(b.length<=2||a.inArray(!1,b)<0)return b;for(;j<b.length-1;)k||!1!==b[j]?k&&!1!==b[j]&&(i=j,j=b.length):(g=j-1,k=!0),j++;for(d=i-g,f=parseInt(b[g].replace("%"),10),c=(parseFloat(b[i].replace("%"))-f)/d,j=g+1,e=1;j<i;)b[j]=f+e*c+"%",e++,j++;return h(b)}var i,j,k,l,m,n,o,p,q;if(i='<div class="iris-picker"><div class="iris-picker-inner"><div class="iris-square"><a class="iris-square-value" href="#"><span class="iris-square-handle ui-slider-handle"></span></a><div class="iris-square-inner iris-square-horiz"></div><div class="iris-square-inner iris-square-vert"></div></div><div class="iris-slider iris-strip"><div class="iris-slider-offset"></div></div></div></div>',m='.iris-picker{display:block;position:relative}.iris-picker,.iris-picker *{-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input+.iris-picker{margin-top:4px}.iris-error{background-color:#ffafaf}.iris-border{border-radius:3px;border:1px solid #aaa;width:200px;background-color:#fff}.iris-picker-inner{position:absolute;top:0;right:0;left:0;bottom:0}.iris-border .iris-picker-inner{top:10px;right:10px;left:10px;bottom:10px}.iris-picker .iris-square-inner{position:absolute;left:0;right:0;top:0;bottom:0}.iris-picker .iris-square,.iris-picker .iris-slider,.iris-picker .iris-square-inner,.iris-picker .iris-palette{border-radius:3px;box-shadow:inset 0 0 5px rgba(0,0,0,.4);height:100%;width:12.5%;float:left;margin-right:5%}.iris-only-strip .iris-slider{width:100%}.iris-picker .iris-square{width:76%;margin-right:10%;position:relative}.iris-only-strip .iris-square{display:none}.iris-picker .iris-square-inner{width:auto;margin:0}.iris-ie-9 .iris-square,.iris-ie-9 .iris-slider,.iris-ie-9 .iris-square-inner,.iris-ie-9 .iris-palette{box-shadow:none;border-radius:0}.iris-ie-9 .iris-square,.iris-ie-9 .iris-slider,.iris-ie-9 .iris-palette{outline:1px solid rgba(0,0,0,.1)}.iris-ie-lt9 .iris-square,.iris-ie-lt9 .iris-slider,.iris-ie-lt9 .iris-square-inner,.iris-ie-lt9 .iris-palette{outline:1px solid #aaa}.iris-ie-lt9 .iris-square .ui-slider-handle{outline:1px solid #aaa;background-color:#fff;-ms-filter:"alpha(Opacity=30)"}.iris-ie-lt9 .iris-square .iris-square-handle{background:0 0;border:3px solid #fff;-ms-filter:"alpha(Opacity=50)"}.iris-picker .iris-strip{margin-right:0;position:relative}.iris-picker .iris-strip .ui-slider-handle{position:absolute;background:0 0;margin:0;right:-3px;left:-3px;border:4px solid #aaa;border-width:4px 3px;width:auto;height:6px;border-radius:4px;box-shadow:0 1px 2px rgba(0,0,0,.2);opacity:.9;z-index:5;cursor:ns-resize}.iris-strip-horiz .iris-strip .ui-slider-handle{right:auto;left:auto;bottom:-3px;top:-3px;height:auto;width:6px;cursor:ew-resize}.iris-strip .ui-slider-handle:before{content:" ";position:absolute;left:-2px;right:-2px;top:-3px;bottom:-3px;border:2px solid #fff;border-radius:3px}.iris-picker .iris-slider-offset{position:absolute;top:11px;left:0;right:0;bottom:-3px;width:auto;height:auto;background:transparent;border:0;border-radius:0}.iris-strip-horiz .iris-slider-offset{top:0;bottom:0;right:11px;left:-3px}.iris-picker .iris-square-handle{background:transparent;border:5px solid #aaa;border-radius:50%;border-color:rgba(128,128,128,.5);box-shadow:none;width:12px;height:12px;position:absolute;left:-10px;top:-10px;cursor:move;opacity:1;z-index:10}.iris-picker .ui-state-focus .iris-square-handle{opacity:.8}.iris-picker .iris-square-handle:hover{border-color:#999}.iris-picker .iris-square-value:focus .iris-square-handle{box-shadow:0 0 2px rgba(0,0,0,.75);opacity:.8}.iris-picker .iris-square-handle:hover::after{border-color:#fff}.iris-picker .iris-square-handle::after{position:absolute;bottom:-4px;right:-4px;left:-4px;top:-4px;border:3px solid #f9f9f9;border-color:rgba(255,255,255,.8);border-radius:50%;content:" "}.iris-picker .iris-square-value{width:8px;height:8px;position:absolute}.iris-ie-lt9 .iris-square-value,.iris-mozilla .iris-square-value{width:1px;height:1px}.iris-palette-container{position:absolute;bottom:0;left:0;margin:0;padding:0}.iris-border .iris-palette-container{left:10px;bottom:10px}.iris-picker .iris-palette{margin:0;cursor:pointer}.iris-square-handle,.ui-slider-handle{border:0;outline:0}',o=navigator.userAgent.toLowerCase(),p="Microsoft Internet Explorer"===navigator.appName,q=p?parseFloat(o.match(/msie ([0-9]{1,}[\.0-9]{0,})/)[1]):0,j=p&&q<10,k=!1,l=["-moz-","-webkit-","-o-","-ms-"],j&&q<=7)return a.fn.iris=a.noop,void(a.support.iris=!1);a.support.iris=!0,a.fn.gradient=function(){var b=arguments;return this.each(function(){j?e.apply(this,b):a(this).css("backgroundImage",d.apply(this,b))})},a.fn.rainbowGradient=function(b,c){var d,e,f,g;for(b=b||"top",d=a.extend({},{s:100,l:50},c),e="hsl(%h%,"+d.s+"%,"+d.l+"%)",f=0,g=[];f<=360;)g.push(e.replace("%h%",f)),f+=30;return this.each(function(){a(this).gradient(b,g)})},n={options:{color:!1,mode:"hsl",controls:{horiz:"s",vert:"l",strip:"h"},hide:!0,border:!0,target:!1,width:200,palettes:!1,type:"full",slider:"horizontal"},_color:"",_palettes:["#000","#fff","#d33","#d93","#ee2","#81d742","#1e73be","#8224e3"],_inited:!1,_defaultHSLControls:{horiz:"s",vert:"l",strip:"h"},_defaultHSVControls:{horiz:"h",vert:"v",strip:"s"},_scale:{h:360,s:100,l:100,v:100},_create:function(){var b=this,d=b.element,e=b.options.color||d.val();!1===k&&c(),d.is("input")?(b.options.target?b.picker=a(i).appendTo(b.options.target):b.picker=a(i).insertAfter(d),b._addInputListeners(d)):(d.append(i),b.picker=d.find(".iris-picker")),p?9===q?b.picker.addClass("iris-ie-9"):q<=8&&b.picker.addClass("iris-ie-lt9"):o.indexOf("compatible")<0&&o.indexOf("khtml")<0&&o.match(/mozilla/)&&b.picker.addClass("iris-mozilla"),b.options.palettes&&b._addPalettes(),b.onlySlider="hue"===b.options.type,b.horizontalSlider=b.onlySlider&&"horizontal"===b.options.slider,b.onlySlider&&(b.options.controls.strip="h",e||(e="hsl(10,100,50)")),b._color=new Color(e).setHSpace(b.options.mode),b.options.color=b._color.toString(),b.controls={square:b.picker.find(".iris-square"),squareDrag:b.picker.find(".iris-square-value"),horiz:b.picker.find(".iris-square-horiz"),vert:b.picker.find(".iris-square-vert"),strip:b.picker.find(".iris-strip"),stripSlider:b.picker.find(".iris-strip .iris-slider-offset")},"hsv"===b.options.mode&&b._has("l",b.options.controls)?b.options.controls=b._defaultHSVControls:"hsl"===b.options.mode&&b._has("v",b.options.controls)&&(b.options.controls=b._defaultHSLControls),b.hue=b._color.h(),b.options.hide&&b.picker.hide(),b.options.border&&!b.onlySlider&&b.picker.addClass("iris-border"),b._initControls(),b.active="external",b._dimensions(),b._change()},_has:function(b,c){var d=!1;return a.each(c,function(a,c){if(b===c)return d=!0,!1}),d},_addPalettes:function(){var b=a('<div class="iris-palette-container" />'),c=a('<a class="iris-palette" tabindex="0" />'),d=Array.isArray(this.options.palettes)?this.options.palettes:this._palettes;this.picker.find(".iris-palette-container").length&&(b=this.picker.find(".iris-palette-container").detach().html("")),a.each(d,function(a,d){c.clone().data("color",d).css("backgroundColor",d).appendTo(b).height(10).width(10)}),this.picker.append(b)},_paint:function(){var a=this;a.horizontalSlider?a._paintDimension("left","strip"):a._paintDimension("top","strip"),a._paintDimension("top","vert"),a._paintDimension("left","horiz")},_paintDimension:function(a,b){var c,d=this,e=d._color,f=d.options.mode,g=d._getHSpaceColor(),h=d.controls[b],i=d.options.controls;if(b!==d.active&&("square"!==d.active||"strip"===b))switch(i[b]){case"h":if("hsv"===f){switch(g=e.clone(),b){case"horiz":g[i.vert](100);break;case"vert":g[i.horiz](100);break;case"strip":g.setHSpace("hsl")}c=g.toHsl()}else c="strip"===b?{s:g.s,l:g.l}:{s:100,l:g.l};h.rainbowGradient(a,c);break;case"s":"hsv"===f?"vert"===b?c=[e.clone().a(0).s(0).toCSS("rgba"),e.clone().a(1).s(0).toCSS("rgba")]:"strip"===b?c=[e.clone().s(100).toCSS("hsl"),e.clone().s(0).toCSS("hsl")]:"horiz"===b&&(c=["#fff","hsl("+g.h+",100%,50%)"]):c="vert"===b&&"h"===d.options.controls.horiz?["hsla(0, 0%, "+g.l+"%, 0)","hsla(0, 0%, "+g.l+"%, 1)"]:["hsl("+g.h+",0%,50%)","hsl("+g.h+",100%,50%)"],h.gradient(a,c);break;case"l":c="strip"===b?["hsl("+g.h+",100%,100%)","hsl("+g.h+", "+g.s+"%,50%)","hsl("+g.h+",100%,0%)"]:["#fff","rgba(255,255,255,0) 50%","rgba(0,0,0,0) 50%","rgba(0,0,0,1)"],h.gradient(a,c);break;case"v":c="strip"===b?[e.clone().v(100).toCSS(),e.clone().v(0).toCSS()]:["rgba(0,0,0,0)","#000"],h.gradient(a,c)}},_getHSpaceColor:function(){return"hsv"===this.options.mode?this._color.toHsv():this._color.toHsl()},_stripOnlyDimensions:function(){var a=this,b=this.options.width,c=.12*b;a.horizontalSlider?a.picker.css({width:b,height:c}).addClass("iris-only-strip iris-strip-horiz"):a.picker.css({width:c,height:b}).addClass("iris-only-strip iris-strip-vert")},_dimensions:function(b){if("hue"===this.options.type)return this._stripOnlyDimensions();var c,d,e,f,g=this,h=g.options,i=g.controls,j=i.square,k=g.picker.find(".iris-strip"),l="77.5%",m="12%",n=20,o=h.border?h.width-n:h.width,p=Array.isArray(h.palettes)?h.palettes.length:g._palettes.length;if(b&&(j.css("width",""),k.css("width",""),g.picker.css({width:"",height:""})),l=o*(parseFloat(l)/100),m=o*(parseFloat(m)/100),c=h.border?l+n:l,j.width(l).height(l),k.height(l).width(m),g.picker.css({width:h.width,height:c}),!h.palettes)return g.picker.css("paddingBottom","");d=2*l/100,f=l-(p-1)*d,e=f/p,g.picker.find(".iris-palette").each(function(b){var c=0===b?0:d;a(this).css({width:e,height:e,marginLeft:c})}),g.picker.css("paddingBottom",e+d),k.height(e+d+l)},_addInputListeners:function(a){var b=this,c=function(c){var d=new Color(a.val()),e=a.val().replace(/^#/,"");a.removeClass("iris-error"),d.error?""!==e&&a.addClass("iris-error"):d.toString()!==b._color.toString()&&("keyup"===c.type&&e.match(/^[0-9a-fA-F]{3}$/)||b._setOption("color",d.toString()))};a.on("change",c).on("keyup",b._debounce(c,100)),b.options.hide&&a.one("focus",function(){b.show()})},_initControls:function(){var b=this,c=b.controls,d=c.square,e=b.options.controls,f=b._scale[e.strip],g=b.horizontalSlider?"horizontal":"vertical";c.stripSlider.slider({orientation:g,max:f,slide:function(a,c){b.active="strip","h"===e.strip&&"vertical"===g&&(c.value=f-c.value),b._color[e.strip](c.value),b._change.apply(b,arguments)}}),c.squareDrag.draggable({containment:c.square.find(".iris-square-inner"),zIndex:1e3,cursor:"move",drag:function(a,c){b._squareDrag(a,c)},start:function(){d.addClass("iris-dragging"),a(this).addClass("ui-state-focus")},stop:function(){d.removeClass("iris-dragging"),a(this).removeClass("ui-state-focus")}}).on("mousedown mouseup",function(c){var d="ui-state-focus";c.preventDefault(),"mousedown"===c.type?(b.picker.find("."+d).removeClass(d).trigger("blur"),a(this).addClass(d).trigger("focus")):a(this).removeClass(d)}).on("keydown",function(a){var d=c.square,e=c.squareDrag,f=e.position(),g=b.options.width/100;switch(a.altKey&&(g*=10),a.keyCode){case 37:f.left-=g;break;case 38:f.top-=g;break;case 39:f.left+=g;break;case 40:f.top+=g;break;default:return!0}f.left=Math.max(0,Math.min(f.left,d.width())),f.top=Math.max(0,Math.min(f.top,d.height())),e.css(f),b._squareDrag(a,{position:f}),a.preventDefault()}),d.on("mousedown",function(c){var d,e;1===c.which&&a(c.target).is("div")&&(d=b.controls.square.offset(),e={top:c.pageY-d.top,left:c.pageX-d.left},c.preventDefault(),b._squareDrag(c,{position:e}),c.target=b.controls.squareDrag.get(0),b.controls.squareDrag.css(e).trigger(c))}),b.options.palettes&&b._paletteListeners()},_paletteListeners:function(){var b=this;b.picker.find(".iris-palette-container").on("click.palette",".iris-palette",function(){b._color.fromCSS(a(this).data("color")),b.active="external",b._change()}).on("keydown.palette",".iris-palette",function(b){if(13!==b.keyCode&&32!==b.keyCode)return!0;b.stopPropagation(),a(this).trigger("click")})},_squareDrag:function(a,b){var c=this,d=c.options.controls,e=c._squareDimensions(),f=Math.round((e.h-b.position.top)/e.h*c._scale[d.vert]),g=c._scale[d.horiz]-Math.round((e.w-b.position.left)/e.w*c._scale[d.horiz]);c._color[d.horiz](g)[d.vert](f),c.active="square",c._change.apply(c,arguments)},_setOption:function(b,c){var d,e,f=this,g=f.options[b],h=!1;switch(f.options[b]=c,b){case"color":f.onlySlider?(c=parseInt(c,10),c=isNaN(c)||c<0||c>359?g:"hsl("+c+",100,50)",f.options.color=f.options[b]=c,f._color=new Color(c).setHSpace(f.options.mode),f.active="external",f._change()):(c=""+c,c.replace(/^#/,""),d=new Color(c).setHSpace(f.options.mode),d.error?f.options[b]=g:(f._color=d,f.options.color=f.options[b]=f._color.toString(),f.active="external",f._change()));break;case"palettes":h=!0,c?f._addPalettes():f.picker.find(".iris-palette-container").remove(),g||f._paletteListeners();break;case"width":h=!0;break;case"border":h=!0,e=c?"addClass":"removeClass",f.picker[e]("iris-border");break;case"mode":case"controls":if(g===c)return;return e=f.element,g=f.options,g.hide=!f.picker.is(":visible"),f.destroy(),f.picker.remove(),a(f.element).iris(g)}h&&f._dimensions(!0)},_squareDimensions:function(a){var c,d=this.controls.square;return a!==b&&d.data("dimensions")?d.data("dimensions"):(this.controls.squareDrag,c={w:d.width(),h:d.height()},d.data("dimensions",c),c)},_isNonHueControl:function(a,b){return"square"===a&&"h"===this.options.controls.strip||"external"!==b&&("h"!==b||"strip"!==a)},_change:function(){var b=this,c=b.controls,d=b._getHSpaceColor(),e=["square","strip"],f=b.options.controls,g=f[b.active]||"external",h=b.hue;"strip"===b.active?e=[]:"external"!==b.active&&e.pop(),a.each(e,function(a,e){var g,h,i;if(e!==b.active)switch(e){case"strip":g="h"!==f.strip||b.horizontalSlider?d[f.strip]:b._scale[f.strip]-d[f.strip],c.stripSlider.slider("value",g);break;case"square":h=b._squareDimensions(),i={left:d[f.horiz]/b._scale[f.horiz]*h.w,top:h.h-d[f.vert]/b._scale[f.vert]*h.h},b.controls.squareDrag.css(i)}}),d.h!==h&&b._isNonHueControl(b.active,g)&&b._color.h(h),b.hue=b._color.h(),b.options.color=b._color.toString(),b._inited&&b._trigger("change",{type:b.active},{color:b._color}),b.element.is(":input")&&!b._color.error&&(b.element.removeClass("iris-error"),b.onlySlider?b.element.val()!==b.hue&&b.element.val(b.hue):b.element.val()!==b._color.toString()&&b.element.val(b._color.toString())),b._paint(),b._inited=!0,b.active=!1},_debounce:function(a,b,c){var d,e;return function(){var f,g,h=this,i=arguments;return f=function(){d=null,c||(e=a.apply(h,i))},g=c&&!d,clearTimeout(d),d=setTimeout(f,b),g&&(e=a.apply(h,i)),e}},show:function(){this.picker.show()},hide:function(){this.picker.hide()},toggle:function(){this.picker.toggle()},color:function(a){return!0===a?this._color.clone():a===b?this._color.toString():void this.option("color",a)}},a.widget("a8c.iris",n),a('<style id="iris-css">'+m+"</style>").appendTo("head")}(jQuery),function(a,b){var c=function(a,b){return this instanceof c?this._init(a,b):new c(a,b)};c.fn=c.prototype={_color:0,_alpha:1,error:!1,_hsl:{h:0,s:0,l:0},_hsv:{h:0,s:0,v:0},_hSpace:"hsl",_init:function(a){var c="noop";switch(typeof a){case"object":return a.a!==b&&this.a(a.a),c=a.r!==b?"fromRgb":a.l!==b?"fromHsl":a.v!==b?"fromHsv":c,this[c](a);case"string":return this.fromCSS(a);case"number":return this.fromInt(parseInt(a,10))}return this},_error:function(){return this.error=!0,this},clone:function(){for(var a=new c(this.toInt()),b=["_alpha","_hSpace","_hsl","_hsv","error"],d=b.length-1;d>=0;d--)a[b[d]]=this[b[d]];return a},setHSpace:function(a){return this._hSpace="hsv"===a?a:"hsl",this},noop:function(){return this},fromCSS:function(a){var b,c=/^(rgb|hs(l|v))a?\(/;if(this.error=!1,a=a.replace(/^\s+/,"").replace(/\s+$/,"").replace(/;$/,""),a.match(c)&&a.match(/\)$/)){if(b=a.replace(/(\s|%)/g,"").replace(c,"").replace(/,?\);?$/,"").split(","),b.length<3)return this._error();if(4===b.length&&(this.a(parseFloat(b.pop())),this.error))return this;for(var d=b.length-1;d>=0;d--)if(b[d]=parseInt(b[d],10),isNaN(b[d]))return this._error();return a.match(/^rgb/)?this.fromRgb({r:b[0],g:b[1],b:b[2]}):a.match(/^hsv/)?this.fromHsv({h:b[0],s:b[1],v:b[2]}):this.fromHsl({h:b[0],s:b[1],l:b[2]})}return this.fromHex(a)},fromRgb:function(a,c){return"object"!=typeof a||a.r===b||a.g===b||a.b===b?this._error():(this.error=!1,this.fromInt(parseInt((a.r<<16)+(a.g<<8)+a.b,10),c))},fromHex:function(a){return a=a.replace(/^#/,"").replace(/^0x/,""),3===a.length&&(a=a[0]+a[0]+a[1]+a[1]+a[2]+a[2]),this.error=!/^[0-9A-F]{6}$/i.test(a),this.fromInt(parseInt(a,16))},fromHsl:function(a){var c,d,e,f,g,h,i,j;return"object"!=typeof a||a.h===b||a.s===b||a.l===b?this._error():(this._hsl=a,this._hSpace="hsl",h=a.h/360,i=a.s/100,j=a.l/100,0===i?c=d=e=j:(f=j<.5?j*(1+i):j+i-j*i,g=2*j-f,c=this.hue2rgb(g,f,h+1/3),d=this.hue2rgb(g,f,h),e=this.hue2rgb(g,f,h-1/3)),this.fromRgb({r:255*c,g:255*d,b:255*e},!0))},fromHsv:function(a){var c,d,e,f,g,h,i,j,k,l,m;if("object"!=typeof a||a.h===b||a.s===b||a.v===b)return this._error();switch(this._hsv=a,this._hSpace="hsv",c=a.h/360,d=a.s/100,e=a.v/100,i=Math.floor(6*c),j=6*c-i,k=e*(1-d),l=e*(1-j*d),m=e*(1-(1-j)*d),i%6){case 0:f=e,g=m,h=k;break;case 1:f=l,g=e,h=k;break;case 2:f=k,g=e,h=m;break;case 3:f=k,g=l,h=e;break;case 4:f=m,g=k,h=e;break;case 5:f=e,g=k,h=l}return this.fromRgb({r:255*f,g:255*g,b:255*h},!0)},fromInt:function(a,c){return this._color=parseInt(a,10),isNaN(this._color)&&(this._color=0),this._color>16777215?this._color=16777215:this._color<0&&(this._color=0),c===b&&(this._hsv.h=this._hsv.s=this._hsl.h=this._hsl.s=0),this},hue2rgb:function(a,b,c){return c<0&&(c+=1),c>1&&(c-=1),c<1/6?a+6*(b-a)*c:c<.5?b:c<2/3?a+(b-a)*(2/3-c)*6:a},toString:function(){var a=parseInt(this._color,10).toString(16);if(this.error)return"";if(a.length<6)for(var b=6-a.length-1;b>=0;b--)a="0"+a;return"#"+a},toCSS:function(a,b){switch(a=a||"hex",b=parseFloat(b||this._alpha),a){case"rgb":case"rgba":var c=this.toRgb();return b<1?"rgba("+c.r+", "+c.g+", "+c.b+", "+b+")":"rgb("+c.r+", "+c.g+", "+c.b+")";case"hsl":case"hsla":var d=this.toHsl();return b<1?"hsla("+d.h+", "+d.s+"%, "+d.l+"%, "+b+")":"hsl("+d.h+", "+d.s+"%, "+d.l+"%)";default:return this.toString()}},toRgb:function(){return{r:255&this._color>>16,g:255&this._color>>8,b:255&this._color}},toHsl:function(){var a,b,c=this.toRgb(),d=c.r/255,e=c.g/255,f=c.b/255,g=Math.max(d,e,f),h=Math.min(d,e,f),i=(g+h)/2;if(g===h)a=b=0;else{var j=g-h;switch(b=i>.5?j/(2-g-h):j/(g+h),g){case d:a=(e-f)/j+(e<f?6:0);break;case e:a=(f-d)/j+2;break;case f:a=(d-e)/j+4}a/=6}return a=Math.round(360*a),0===a&&this._hsl.h!==a&&(a=this._hsl.h),b=Math.round(100*b),0===b&&this._hsl.s&&(b=this._hsl.s),{h:a,s:b,l:Math.round(100*i)}},toHsv:function(){var a,b,c=this.toRgb(),d=c.r/255,e=c.g/255,f=c.b/255,g=Math.max(d,e,f),h=Math.min(d,e,f),i=g,j=g-h;if(b=0===g?0:j/g,g===h)a=b=0;else{switch(g){case d:a=(e-f)/j+(e<f?6:0);break;case e:a=(f-d)/j+2;break;case f:a=(d-e)/j+4}a/=6}return a=Math.round(360*a),0===a&&this._hsv.h!==a&&(a=this._hsv.h),b=Math.round(100*b),0===b&&this._hsv.s&&(b=this._hsv.s),{h:a,s:b,v:Math.round(100*i)}},toInt:function(){return this._color},toIEOctoHex:function(){var a=this.toString(),b=parseInt(255*this._alpha,10).toString(16);return 1===b.length&&(b="0"+b),"#"+b+a.replace(/^#/,"")},toLuminosity:function(){var a=this.toRgb(),b={};for(var c in a)if(a.hasOwnProperty(c)){var d=a[c]/255;b[c]=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4)}return.2126*b.r+.7152*b.g+.0722*b.b},getDistanceLuminosityFrom:function(a){if(!(a instanceof c))throw"getDistanceLuminosityFrom requires a Color object";var b=this.toLuminosity(),d=a.toLuminosity();return b>d?(b+.05)/(d+.05):(d+.05)/(b+.05)},getMaxContrastColor:function(){var a=this.getDistanceLuminosityFrom(new c("#000")),b=this.getDistanceLuminosityFrom(new c("#fff"));return new c(a>=b?"#000":"#fff")},getReadableContrastingColor:function(a,d){if(!(a instanceof c))return this;var e,f,g=d===b?5:d,h=a.getDistanceLuminosityFrom(this);if(h>=g)return this;if(e=a.getMaxContrastColor(),e.getDistanceLuminosityFrom(a)<=g)return e;for(f=0===e.toInt()?-1:1;h<g&&(this.l(f,!0),h=this.getDistanceLuminosityFrom(a),0!==this._color&&16777215!==this._color););return this},a:function(a){if(a===b)return this._alpha;var c=parseFloat(a);return isNaN(c)?this._error():(this._alpha=c,this)},darken:function(a){return a=a||5,this.l(-a,!0)},lighten:function(a){return a=a||5,this.l(a,!0)},saturate:function(a){return a=a||15,this.s(a,!0)},desaturate:function(a){return a=a||15,this.s(-a,!0)},toGrayscale:function(){return this.setHSpace("hsl").s(0)},getComplement:function(){return this.h(180,!0)},getSplitComplement:function(a){a=a||1;var b=180+30*a;return this.h(b,!0)},getAnalog:function(a){a=a||1;var b=30*a;return this.h(b,!0)},getTetrad:function(a){a=a||1;var b=60*a;return this.h(b,!0)},getTriad:function(a){a=a||1;var b=120*a;return this.h(b,!0)},_partial:function(a){var c=d[a];return function(d,e){var f=this._spaceFunc("to",c.space);return d===b?f[a]:(!0===e&&(d=f[a]+d),c.mod&&(d%=c.mod),c.range&&(d=d<c.range[0]?c.range[0]:d>c.range[1]?c.range[1]:d),f[a]=d,this._spaceFunc("from",c.space,f))}},_spaceFunc:function(a,b,c){var d=b||this._hSpace;return this[a+d.charAt(0).toUpperCase()+d.substr(1)](c)}};var d={h:{mod:360},s:{range:[0,100]},l:{space:"hsl",range:[0,100]},v:{space:"hsv",range:[0,100]},r:{space:"rgb",range:[0,255]},g:{space:"rgb",range:[0,255]},b:{space:"rgb",range:[0,255]}};for(var e in d)d.hasOwnProperty(e)&&(c.fn[e]=c.fn._partial(e));"object"==typeof exports?module.exports=c:a.Color=c}(this);
!function(i,t){var a=wp.i18n.__;i.widget("wp.wpColorPicker",{options:{defaultColor:!1,change:!1,clear:!1,hide:!0,palettes:!0,width:255,mode:"hsv",type:"full",slider:"horizontal"},_createHueOnly:function(){var e,o=this,t=o.element;t.hide(),e="hsl("+t.val()+", 100, 50)",t.iris({mode:"hsl",type:"hue",hide:!1,color:e,change:function(e,t){"function"==typeof o.options.change&&o.options.change.call(this,e,t)},width:o.options.width,slider:o.options.slider})},_create:function(){if(i.support.iris){var o=this,e=o.element;if(i.extend(o.options,e.data()),"hue"===o.options.type)return o._createHueOnly();o.close=o.close.bind(o),o.initialValue=e.val(),e.addClass("wp-color-picker"),e.parent("label").length||(e.wrap("<label></label>"),o.wrappingLabelText=i('<span class="screen-reader-text"></span>').insertBefore(e).text(a("Color value"))),o.wrappingLabel=e.parent(),o.wrappingLabel.wrap('<div class="wp-picker-container" />'),o.wrap=o.wrappingLabel.parent(),o.toggler=i('<button type="button" class="button wp-color-result" aria-expanded="false"><span class="wp-color-result-text"></span></button>').insertBefore(o.wrappingLabel).css({backgroundColor:o.initialValue}),o.toggler.find(".wp-color-result-text").text(a("Select Color")),o.pickerContainer=i('<div class="wp-picker-holder" />').insertAfter(o.wrappingLabel),o.button=i('<input type="button" class="button button-small" />'),o.options.defaultColor?o.button.addClass("wp-picker-default").val(a("Default")).attr("aria-label",a("Select default color")):o.button.addClass("wp-picker-clear").val(a("Clear")).attr("aria-label",a("Clear color")),o.wrappingLabel.wrap('<span class="wp-picker-input-wrap hidden" />').after(o.button),o.inputWrapper=e.closest(".wp-picker-input-wrap"),e.iris({target:o.pickerContainer,hide:o.options.hide,width:o.options.width,mode:o.options.mode,palettes:o.options.palettes,change:function(e,t){o.toggler.css({backgroundColor:t.color.toString()}),"function"==typeof o.options.change&&o.options.change.call(this,e,t)}}),e.val(o.initialValue),o._addListeners(),o.options.hide||o.toggler.click()}},_addListeners:function(){var o=this;o.wrap.on("click.wpcolorpicker",function(e){e.stopPropagation()}),o.toggler.on("click",function(){o.toggler.hasClass("wp-picker-open")?o.close():o.open()}),o.element.on("change",function(e){var t=i(this).val();""!==t&&"#"!==t||(o.toggler.css("backgroundColor",""),"function"==typeof o.options.clear&&o.options.clear.call(this,e))}),o.button.on("click",function(e){var t=i(this);t.hasClass("wp-picker-clear")?(o.element.val(""),o.toggler.css("backgroundColor",""),"function"==typeof o.options.clear&&o.options.clear.call(this,e)):t.hasClass("wp-picker-default")&&o.element.val(o.options.defaultColor).change()})},open:function(){this.element.iris("toggle"),this.inputWrapper.removeClass("hidden"),this.wrap.addClass("wp-picker-active"),this.toggler.addClass("wp-picker-open").attr("aria-expanded","true"),i("body").trigger("click.wpcolorpicker").on("click.wpcolorpicker",this.close)},close:function(){this.element.iris("toggle"),this.inputWrapper.addClass("hidden"),this.wrap.removeClass("wp-picker-active"),this.toggler.removeClass("wp-picker-open").attr("aria-expanded","false"),i("body").off("click.wpcolorpicker",this.close)},color:function(e){if(e===t)return this.element.iris("option","color");this.element.iris("option","color",e)},defaultColor:function(e){if(e===t)return this.options.defaultColor;this.options.defaultColor=e}})}(jQuery);