Use Semantic UI for all HTML templates
[cacert-boardvoting.git] / static / semantic.min.js
1 /*
2 * # Semantic UI - 2.2.10
3 * https://github.com/Semantic-Org/Semantic-UI
4 * http://www.semantic-ui.com/
5 *
6 * Copyright 2014 Contributors
7 * Released under the MIT license
8 * http://opensource.org/licenses/MIT
9 *
10 */
11 !function(e,t,n,i){e.site=e.fn.site=function(i){var o,r,a=(new Date).getTime(),s=[],l=arguments[0],c="string"==typeof l,d=[].slice.call(arguments,1),u=e.isPlainObject(i)?e.extend(!0,{},e.site.settings,i):e.extend({},e.site.settings),f=u.namespace,m=u.error,g="module-"+f,v=e(n),h=v,p=this,b=h.data(g);return o={initialize:function(){o.instantiate()},instantiate:function(){o.verbose("Storing instance of site",o),b=o,h.data(g,o)},normalize:function(){o.fix.console(),o.fix.requestAnimationFrame()},fix:{console:function(){o.debug("Normalizing window.console"),void 0!==console&&void 0!==console.log||(o.verbose("Console not available, normalizing events"),o.disable.console()),void 0!==console.group&&void 0!==console.groupEnd&&void 0!==console.groupCollapsed||(o.verbose("Console group not available, normalizing events"),t.console.group=function(){},t.console.groupEnd=function(){},t.console.groupCollapsed=function(){}),void 0===console.markTimeline&&(o.verbose("Mark timeline not available, normalizing events"),t.console.markTimeline=function(){})},consoleClear:function(){o.debug("Disabling programmatic console clearing"),t.console.clear=function(){}},requestAnimationFrame:function(){o.debug("Normalizing requestAnimationFrame"),void 0===t.requestAnimationFrame&&(o.debug("RequestAnimationFrame not available, normalizing event"),t.requestAnimationFrame=t.requestAnimationFrame||t.mozRequestAnimationFrame||t.webkitRequestAnimationFrame||t.msRequestAnimationFrame||function(e){setTimeout(e,0)})}},moduleExists:function(t){return void 0!==e.fn[t]&&void 0!==e.fn[t].settings},enabled:{modules:function(t){var n=[];return t=t||u.modules,e.each(t,function(e,t){o.moduleExists(t)&&n.push(t)}),n}},disabled:{modules:function(t){var n=[];return t=t||u.modules,e.each(t,function(e,t){o.moduleExists(t)||n.push(t)}),n}},change:{setting:function(t,n,i,r){i="string"==typeof i?"all"===i?u.modules:[i]:i||u.modules,r=void 0===r||r,e.each(i,function(i,a){var s,l=!o.moduleExists(a)||(e.fn[a].settings.namespace||!1);o.moduleExists(a)&&(o.verbose("Changing default setting",t,n,a),e.fn[a].settings[t]=n,r&&l&&(s=e(":data(module-"+l+")"),s.length>0&&(o.verbose("Modifying existing settings",s),s[a]("setting",t,n))))})},settings:function(t,n,i){n="string"==typeof n?[n]:n||u.modules,i=void 0===i||i,e.each(n,function(n,r){var a;o.moduleExists(r)&&(o.verbose("Changing default setting",t,r),e.extend(!0,e.fn[r].settings,t),i&&f&&(a=e(":data(module-"+f+")"),a.length>0&&(o.verbose("Modifying existing settings",a),a[r]("setting",t))))})}},enable:{console:function(){o.console(!0)},debug:function(e,t){e=e||u.modules,o.debug("Enabling debug for modules",e),o.change.setting("debug",!0,e,t)},verbose:function(e,t){e=e||u.modules,o.debug("Enabling verbose debug for modules",e),o.change.setting("verbose",!0,e,t)}},disable:{console:function(){o.console(!1)},debug:function(e,t){e=e||u.modules,o.debug("Disabling debug for modules",e),o.change.setting("debug",!1,e,t)},verbose:function(e,t){e=e||u.modules,o.debug("Disabling verbose debug for modules",e),o.change.setting("verbose",!1,e,t)}},console:function(e){if(e){if(void 0===b.cache.console)return void o.error(m.console);o.debug("Restoring console function"),t.console=b.cache.console}else o.debug("Disabling console function"),b.cache.console=t.console,t.console={clear:function(){},error:function(){},group:function(){},groupCollapsed:function(){},groupEnd:function(){},info:function(){},log:function(){},markTimeline:function(){},warn:function(){}}},destroy:function(){o.verbose("Destroying previous site for",h),h.removeData(g)},cache:{},setting:function(t,n){if(e.isPlainObject(t))e.extend(!0,u,t);else{if(void 0===n)return u[t];u[t]=n}},internal:function(t,n){if(e.isPlainObject(t))e.extend(!0,o,t);else{if(void 0===n)return o[t];o[t]=n}},debug:function(){u.debug&&(u.performance?o.performance.log(arguments):(o.debug=Function.prototype.bind.call(console.info,console,u.name+":"),o.debug.apply(console,arguments)))},verbose:function(){u.verbose&&u.debug&&(u.performance?o.performance.log(arguments):(o.verbose=Function.prototype.bind.call(console.info,console,u.name+":"),o.verbose.apply(console,arguments)))},error:function(){o.error=Function.prototype.bind.call(console.error,console,u.name+":"),o.error.apply(console,arguments)},performance:{log:function(e){var t,n,i;u.performance&&(t=(new Date).getTime(),i=a||t,n=t-i,a=t,s.push({Element:p,Name:e[0],Arguments:[].slice.call(e,1)||"","Execution Time":n})),clearTimeout(o.performance.timer),o.performance.timer=setTimeout(o.performance.display,500)},display:function(){var t=u.name+":",n=0;a=!1,clearTimeout(o.performance.timer),e.each(s,function(e,t){n+=t["Execution Time"]}),t+=" "+n+"ms",(void 0!==console.group||void 0!==console.table)&&s.length>0&&(console.groupCollapsed(t),console.table?console.table(s):e.each(s,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),s=[]}},invoke:function(t,n,i){var a,s,l,c=b;return n=n||d,i=p||i,"string"==typeof t&&void 0!==c&&(t=t.split(/[\. ]/),a=t.length-1,e.each(t,function(n,i){var r=n!=a?i+t[n+1].charAt(0).toUpperCase()+t[n+1].slice(1):t;if(e.isPlainObject(c[r])&&n!=a)c=c[r];else{if(void 0!==c[r])return s=c[r],!1;if(!e.isPlainObject(c[i])||n==a)return void 0!==c[i]?(s=c[i],!1):(o.error(m.method,t),!1);c=c[i]}})),e.isFunction(s)?l=s.apply(i,n):void 0!==s&&(l=s),e.isArray(r)?r.push(l):void 0!==r?r=[r,l]:void 0!==l&&(r=l),s}},c?(void 0===b&&o.initialize(),o.invoke(l)):(void 0!==b&&o.destroy(),o.initialize()),void 0!==r?r:this},e.site.settings={name:"Site",namespace:"site",error:{console:"Console cannot be restored, most likely it was overwritten outside of module",method:"The method you called is not defined."},debug:!1,verbose:!1,performance:!0,modules:["accordion","api","checkbox","dimmer","dropdown","embed","form","modal","nag","popup","rating","shape","sidebar","state","sticky","tab","transition","visit","visibility"],siteNamespace:"site",namespaceStub:{cache:{},config:{},sections:{},section:{},utilities:{}}},e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(n){return!!e.data(n,t)}}):function(t,n,i){return!!e.data(t,i[3])}})}(jQuery,window,document),function(e,t,n,i){"use strict";t=void 0!==t&&t.Math==Math?t:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),e.fn.form=function(t){var i,o=e(this),r=o.selector||"",a=(new Date).getTime(),s=[],l=arguments[0],c=arguments[1],d="string"==typeof l,u=[].slice.call(arguments,1);return o.each(function(){var f,m,g,v,h,p,b,x,y,C,w,k,S,T,A,R,E,P,O,q=e(this),D=this,F=[],I=!1;O={initialize:function(){O.get.settings(),d?(void 0===P&&O.instantiate(),O.invoke(l)):(void 0!==P&&P.invoke("destroy"),O.verbose("Initializing form validation",q,x),O.bindEvents(),O.set.defaults(),O.instantiate())},instantiate:function(){O.verbose("Storing instance of module",O),P=O,q.data(R,O)},destroy:function(){O.verbose("Destroying previous module",P),O.removeEvents(),q.removeData(R)},refresh:function(){O.verbose("Refreshing selector cache"),f=q.find(w.field),m=q.find(w.group),g=q.find(w.message),v=q.find(w.prompt),h=q.find(w.submit),p=q.find(w.clear),b=q.find(w.reset)},submit:function(){O.verbose("Submitting form",q),q.submit()},attachEvents:function(t,n){n=n||"submit",e(t).on("click"+E,function(e){O[n](),e.preventDefault()})},bindEvents:function(){O.verbose("Attaching form events"),q.on("submit"+E,O.validate.form).on("blur"+E,w.field,O.event.field.blur).on("click"+E,w.submit,O.submit).on("click"+E,w.reset,O.reset).on("click"+E,w.clear,O.clear),x.keyboardShortcuts&&q.on("keydown"+E,w.field,O.event.field.keydown),f.each(function(){var t=e(this),n=t.prop("type"),i=O.get.changeEvent(n,t);e(this).on(i+E,O.event.field.change)})},clear:function(){f.each(function(){var t=e(this),n=t.parent(),i=t.closest(m),o=i.find(w.prompt),r=t.data(C.defaultValue)||"",a=n.is(w.uiCheckbox),s=n.is(w.uiDropdown);i.hasClass(k.error)&&(O.verbose("Resetting error on field",i),i.removeClass(k.error),o.remove()),s?(O.verbose("Resetting dropdown value",n,r),n.dropdown("clear")):a?t.prop("checked",!1):(O.verbose("Resetting field value",t,r),t.val(""))})},reset:function(){f.each(function(){var t=e(this),n=t.parent(),i=t.closest(m),o=i.find(w.prompt),r=t.data(C.defaultValue),a=n.is(w.uiCheckbox),s=n.is(w.uiDropdown),l=i.hasClass(k.error);void 0!==r&&(l&&(O.verbose("Resetting error on field",i),i.removeClass(k.error),o.remove()),s?(O.verbose("Resetting dropdown value",n,r),n.dropdown("restore defaults")):a?(O.verbose("Resetting checkbox value",n,r),t.prop("checked",r)):(O.verbose("Resetting field value",t,r),t.val(r)))})},determine:{isValid:function(){var t=!0;return e.each(y,function(e,n){O.validate.field(n,e,!0)||(t=!1)}),t}},is:{bracketedRule:function(e){return e.type&&e.type.match(x.regExp.bracket)},empty:function(e){return!e||0===e.length||(e.is('input[type="checkbox"]')?!e.is(":checked"):O.is.blank(e))},blank:function(t){return""===e.trim(t.val())},valid:function(t){var n=!0;return t?(O.verbose("Checking if field is valid",t),O.validate.field(y[t],t,!1)):(O.verbose("Checking if form is valid"),e.each(y,function(e,t){O.is.valid(e)||(n=!1)}),n)}},removeEvents:function(){q.off(E),f.off(E),h.off(E),f.off(E)},event:{field:{keydown:function(t){var n=e(this),i=t.which,o=n.is(w.input),r=n.is(w.checkbox),a=n.closest(w.uiDropdown).length>0,s={enter:13,escape:27};i==s.escape&&(O.verbose("Escape key pressed blurring field"),n.blur()),t.ctrlKey||i!=s.enter||!o||a||r||(I||(n.one("keyup"+E,O.event.field.keyup),O.submit(),O.debug("Enter pressed on input submitting form")),I=!0)},keyup:function(){I=!1},blur:function(t){var n=e(this),i=n.closest(m),o=O.get.validation(n);i.hasClass(k.error)?(O.debug("Revalidating field",n,o),o&&O.validate.field(o)):"blur"!=x.on&&"change"!=x.on||o&&O.validate.field(o)},change:function(t){var n=e(this),i=n.closest(m),o=O.get.validation(n);o&&("change"==x.on||i.hasClass(k.error)&&x.revalidate)&&(clearTimeout(O.timer),O.timer=setTimeout(function(){O.debug("Revalidating field",n,O.get.validation(n)),O.validate.field(o)},x.delay))}}},get:{ancillaryValue:function(e){return!(!e.type||!e.value&&!O.is.bracketedRule(e))&&(void 0!==e.value?e.value:e.type.match(x.regExp.bracket)[1]+"")},ruleName:function(e){return O.is.bracketedRule(e)?e.type.replace(e.type.match(x.regExp.bracket)[0],""):e.type},changeEvent:function(e,t){return"checkbox"==e||"radio"==e||"hidden"==e||t.is("select")?"change":O.get.inputEvent()},inputEvent:function(){return void 0!==n.createElement("input").oninput?"input":void 0!==n.createElement("input").onpropertychange?"propertychange":"keyup"},prompt:function(e,t){var n,i,o,r=O.get.ruleName(e),a=O.get.ancillaryValue(e),s=e.prompt||x.prompt[r]||x.text.unspecifiedRule,l=-1!==s.search("{value}"),c=-1!==s.search("{name}");return(c||l)&&(i=O.get.field(t.identifier)),l&&(s=s.replace("{value}",i.val())),c&&(n=i.closest(w.group).find("label").eq(0),o=1==n.length?n.text():i.prop("placeholder")||x.text.unspecifiedField,s=s.replace("{name}",o)),s=s.replace("{identifier}",t.identifier),s=s.replace("{ruleValue}",a),e.prompt||O.verbose("Using default validation prompt for type",s,r),s},settings:function(){if(e.isPlainObject(t)){var n,i=Object.keys(t),o=i.length>0&&(void 0!==t[i[0]].identifier&&void 0!==t[i[0]].rules);o?(x=e.extend(!0,{},e.fn.form.settings,c),y=e.extend({},e.fn.form.settings.defaults,t),O.error(x.error.oldSyntax,D),O.verbose("Extending settings from legacy parameters",y,x)):(t.fields&&(n=Object.keys(t.fields),("string"==typeof t.fields[n[0]]||e.isArray(t.fields[n[0]]))&&e.each(t.fields,function(n,i){"string"==typeof i&&(i=[i]),t.fields[n]={rules:[]},e.each(i,function(e,i){t.fields[n].rules.push({type:i})})})),x=e.extend(!0,{},e.fn.form.settings,t),y=e.extend({},e.fn.form.settings.defaults,x.fields),O.verbose("Extending settings",y,x))}else x=e.fn.form.settings,y=e.fn.form.settings.defaults,O.verbose("Using default form validation",y,x);A=x.namespace,C=x.metadata,w=x.selector,k=x.className,S=x.regExp,T=x.error,R="module-"+A,E="."+A,P=q.data(R),O.refresh()},field:function(t){return O.verbose("Finding field with identifier",t),t=O.escape.string(t),f.filter("#"+t).length>0?f.filter("#"+t):f.filter('[name="'+t+'"]').length>0?f.filter('[name="'+t+'"]'):f.filter('[name="'+t+'[]"]').length>0?f.filter('[name="'+t+'[]"]'):f.filter("[data-"+C.validate+'="'+t+'"]').length>0?f.filter("[data-"+C.validate+'="'+t+'"]'):e("<input/>")},fields:function(t){var n=e();return e.each(t,function(e,t){n=n.add(O.get.field(t))}),n},validation:function(t){var n,i;return!!y&&(e.each(y,function(e,o){i=o.identifier||e,O.get.field(i)[0]==t[0]&&(o.identifier=i,n=o)}),n||!1)},value:function(e){var t,n=[];return n.push(e),t=O.get.values.call(D,n),t[e]},values:function(t){var n=e.isArray(t)?O.get.fields(t):f,i={};return n.each(function(t,n){var o=e(n),r=(o.prop("type"),o.prop("name")),a=o.val(),s=o.is(w.checkbox),l=o.is(w.radio),c=-1!==r.indexOf("[]"),d=!!s&&o.is(":checked");r&&(c?(r=r.replace("[]",""),i[r]||(i[r]=[]),s?d?i[r].push(a||!0):i[r].push(!1):i[r].push(a)):l?d&&(i[r]=a):i[r]=s?!!d&&(a||!0):a)}),i}},has:{field:function(e){return O.verbose("Checking for existence of a field with identifier",e),e=O.escape.string(e),"string"!=typeof e&&O.error(T.identifier,e),f.filter("#"+e).length>0||(f.filter('[name="'+e+'"]').length>0||f.filter("[data-"+C.validate+'="'+e+'"]').length>0)}},escape:{string:function(e){return e=String(e),e.replace(S.escape,"\\$&")}},add:{prompt:function(t,n){var i=O.get.field(t),o=i.closest(m),r=o.children(w.prompt),a=0!==r.length;n="string"==typeof n?[n]:n,O.verbose("Adding field error state",t),o.addClass(k.error),x.inline&&(a||(r=x.templates.prompt(n),r.appendTo(o)),r.html(n[0]),a?O.verbose("Inline errors are disabled, no inline error added",t):x.transition&&void 0!==e.fn.transition&&q.transition("is supported")?(O.verbose("Displaying error with css transition",x.transition),r.transition(x.transition+" in",x.duration)):(O.verbose("Displaying error with fallback javascript animation"),r.fadeIn(x.duration)))},errors:function(e){O.debug("Adding form error messages",e),O.set.error(),g.html(x.templates.error(e))}},remove:{prompt:function(t){var n=O.get.field(t),i=n.closest(m),o=i.children(w.prompt);i.removeClass(k.error),x.inline&&o.is(":visible")&&(O.verbose("Removing prompt for field",t),x.transition&&void 0!==e.fn.transition&&q.transition("is supported")?o.transition(x.transition+" out",x.duration,function(){o.remove()}):o.fadeOut(x.duration,function(){o.remove()}))}},set:{success:function(){q.removeClass(k.error).addClass(k.success)},defaults:function(){f.each(function(){var t=e(this),n=t.filter(w.checkbox).length>0,i=n?t.is(":checked"):t.val();t.data(C.defaultValue,i)})},error:function(){q.removeClass(k.success).addClass(k.error)},value:function(e,t){var n={};return n[e]=t,O.set.values.call(D,n)},values:function(t){e.isEmptyObject(t)||e.each(t,function(t,n){var i,o=O.get.field(t),r=o.parent(),a=e.isArray(n),s=r.is(w.uiCheckbox),l=r.is(w.uiDropdown),c=o.is(w.radio)&&s,d=o.length>0;d&&(a&&s?(O.verbose("Selecting multiple",n,o),r.checkbox("uncheck"),e.each(n,function(e,t){i=o.filter('[value="'+t+'"]'),r=i.parent(),i.length>0&&r.checkbox("check")})):c?(O.verbose("Selecting radio value",n,o),o.filter('[value="'+n+'"]').parent(w.uiCheckbox).checkbox("check")):s?(O.verbose("Setting checkbox value",n,r),!0===n?r.checkbox("check"):r.checkbox("uncheck")):l?(O.verbose("Setting dropdown value",n,r),r.dropdown("set selected",n)):(O.verbose("Setting field value",n,o),o.val(n)))})}},validate:{form:function(e,t){var n=O.get.values();if(I)return!1;if(F=[],O.determine.isValid()){if(O.debug("Form has no validation errors, submitting"),O.set.success(),!0!==t)return x.onSuccess.call(D,e,n)}else if(O.debug("Form has errors"),O.set.error(),x.inline||O.add.errors(F),void 0!==q.data("moduleApi")&&e.stopImmediatePropagation(),!0!==t)return x.onFailure.call(D,F,n)},field:function(t,n,i){i=void 0===i||i,"string"==typeof t&&(O.verbose("Validating field",t),n=t,t=y[t]);var o=t.identifier||n,r=O.get.field(o),a=!!t.depends&&O.get.field(t.depends),s=!0,l=[];return t.identifier||(O.debug("Using field name as identifier",o),t.identifier=o),r.prop("disabled")?(O.debug("Field is disabled. Skipping",o),s=!0):t.optional&&O.is.blank(r)?(O.debug("Field is optional and blank. Skipping",o),s=!0):t.depends&&O.is.empty(a)?(O.debug("Field depends on another value that is not present or empty. Skipping",a),s=!0):void 0!==t.rules&&e.each(t.rules,function(e,n){O.has.field(o)&&!O.validate.rule(t,n)&&(O.debug("Field is invalid",o,n.type),l.push(O.get.prompt(n,t)),s=!1)}),s?(i&&(O.remove.prompt(o,l),x.onValid.call(r)),!0):(i&&(F=F.concat(l),O.add.prompt(o,l),x.onInvalid.call(r,l)),!1)},rule:function(t,n){var i=O.get.field(t.identifier),o=(n.type,i.val()),r=O.get.ancillaryValue(n),a=O.get.ruleName(n),s=x.rules[a];return e.isFunction(s)?(o=void 0===o||""===o||null===o?"":e.trim(o+""),s.call(i,o,r)):void O.error(T.noRule,a)}},setting:function(t,n){if(e.isPlainObject(t))e.extend(!0,x,t);else{if(void 0===n)return x[t];x[t]=n}},internal:function(t,n){if(e.isPlainObject(t))e.extend(!0,O,t);else{if(void 0===n)return O[t];O[t]=n}},debug:function(){!x.silent&&x.debug&&(x.performance?O.performance.log(arguments):(O.debug=Function.prototype.bind.call(console.info,console,x.name+":"),O.debug.apply(console,arguments)))},verbose:function(){!x.silent&&x.verbose&&x.debug&&(x.performance?O.performance.log(arguments):(O.verbose=Function.prototype.bind.call(console.info,console,x.name+":"),O.verbose.apply(console,arguments)))},error:function(){x.silent||(O.error=Function.prototype.bind.call(console.error,console,x.name+":"),O.error.apply(console,arguments))},performance:{log:function(e){var t,n,i;x.performance&&(t=(new Date).getTime(),i=a||t,n=t-i,a=t,s.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:D,"Execution Time":n})),clearTimeout(O.performance.timer),O.performance.timer=setTimeout(O.performance.display,500)},display:function(){var t=x.name+":",n=0;a=!1,clearTimeout(O.performance.timer),e.each(s,function(e,t){n+=t["Execution Time"]}),t+=" "+n+"ms",r&&(t+=" '"+r+"'"),o.length>1&&(t+=" ("+o.length+")"),(void 0!==console.group||void 0!==console.table)&&s.length>0&&(console.groupCollapsed(t),console.table?console.table(s):e.each(s,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),s=[]}},invoke:function(t,n,o){var r,a,s,l=P;return n=n||u,o=D||o,"string"==typeof t&&void 0!==l&&(t=t.split(/[\. ]/),r=t.length-1,e.each(t,function(n,i){var o=n!=r?i+t[n+1].charAt(0).toUpperCase()+t[n+1].slice(1):t;if(e.isPlainObject(l[o])&&n!=r)l=l[o];else{if(void 0!==l[o])return a=l[o],!1;if(!e.isPlainObject(l[i])||n==r)return void 0!==l[i]&&(a=l[i],!1);l=l[i]}})),e.isFunction(a)?s=a.apply(o,n):void 0!==a&&(s=a),e.isArray(i)?i.push(s):void 0!==i?i=[i,s]:void 0!==s&&(i=s),a}},O.initialize()}),void 0!==i?i:this},e.fn.form.settings={name:"Form",namespace:"form",debug:!1,verbose:!1,performance:!0,fields:!1,keyboardShortcuts:!0,on:"submit",inline:!1,delay:200,revalidate:!0,transition:"scale",duration:200,onValid:function(){},onInvalid:function(){},onSuccess:function(){return!0},onFailure:function(){return!1},metadata:{defaultValue:"default",validate:"validate"},regExp:{htmlID:/^[a-zA-Z][\w:.-]*$/g,bracket:/\[(.*)\]/i,decimal:/^\d+\.?\d*$/,email:/^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i,escape:/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,flags:/^\/(.*)\/(.*)?/,integer:/^\-?\d+$/,number:/^\-?\d*(\.\d+)?$/,url:/(https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/i},text:{unspecifiedRule:"Please enter a valid value",unspecifiedField:"This field"},prompt:{empty:"{name} must have a value",checked:"{name} must be checked",email:"{name} must be a valid e-mail",url:"{name} must be a valid url",regExp:"{name} is not formatted correctly",integer:"{name} must be an integer",decimal:"{name} must be a decimal number",number:"{name} must be set to a number",is:'{name} must be "{ruleValue}"',isExactly:'{name} must be exactly "{ruleValue}"',not:'{name} cannot be set to "{ruleValue}"',notExactly:'{name} cannot be set to exactly "{ruleValue}"',contain:'{name} cannot contain "{ruleValue}"',containExactly:'{name} cannot contain exactly "{ruleValue}"',doesntContain:'{name} must contain "{ruleValue}"',doesntContainExactly:'{name} must contain exactly "{ruleValue}"',minLength:"{name} must be at least {ruleValue} characters",length:"{name} must be at least {ruleValue} characters",exactLength:"{name} must be exactly {ruleValue} characters",maxLength:"{name} cannot be longer than {ruleValue} characters",match:"{name} must match {ruleValue} field",different:"{name} must have a different value than {ruleValue} field",creditCard:"{name} must be a valid credit card number",minCount:"{name} must have at least {ruleValue} choices",exactCount:"{name} must have exactly {ruleValue} choices",maxCount:"{name} must have {ruleValue} or less choices"},selector:{checkbox:'input[type="checkbox"], input[type="radio"]',clear:".clear",field:"input, textarea, select",group:".field",input:"input",message:".error.message",prompt:".prompt.label",radio:'input[type="radio"]',reset:'.reset:not([type="reset"])',submit:'.submit:not([type="submit"])',uiCheckbox:".ui.checkbox",uiDropdown:".ui.dropdown"},className:{error:"error",label:"ui prompt label",pressed:"down",success:"success"},error:{identifier:"You must specify a string identifier for each field",method:"The method you called is not defined.",noRule:"There is no rule matching the one you specified",oldSyntax:"Starting in 2.0 forms now only take a single settings object. Validation settings converted to new syntax automatically."},templates:{error:function(t){var n='<ul class="list">';return e.each(t,function(e,t){n+="<li>"+t+"</li>"}),n+="</ul>",e(n)},prompt:function(t){return e("<div/>").addClass("ui basic red pointing prompt label").html(t[0])}},rules:{empty:function(t){return!(void 0===t||""===t||e.isArray(t)&&0===t.length)},checked:function(){return e(this).filter(":checked").length>0},email:function(t){return e.fn.form.settings.regExp.email.test(t)},url:function(t){return e.fn.form.settings.regExp.url.test(t)},regExp:function(t,n){if(n instanceof RegExp)return t.match(n);var i,o=n.match(e.fn.form.settings.regExp.flags);return o&&(n=o.length>=2?o[1]:n,i=o.length>=3?o[2]:""),t.match(new RegExp(n,i))},integer:function(t,n){var i,o,r,a=e.fn.form.settings.regExp.integer;return n&&-1===["",".."].indexOf(n)&&(-1==n.indexOf("..")?a.test(n)&&(i=o=n-0):(r=n.split("..",2),a.test(r[0])&&(i=r[0]-0),a.test(r[1])&&(o=r[1]-0))),a.test(t)&&(void 0===i||t>=i)&&(void 0===o||t<=o)},decimal:function(t){return e.fn.form.settings.regExp.decimal.test(t)},number:function(t){return e.fn.form.settings.regExp.number.test(t)},is:function(e,t){return t="string"==typeof t?t.toLowerCase():t,(e="string"==typeof e?e.toLowerCase():e)==t},isExactly:function(e,t){return e==t},not:function(e,t){return e="string"==typeof e?e.toLowerCase():e,t="string"==typeof t?t.toLowerCase():t,e!=t},notExactly:function(e,t){return e!=t},contains:function(t,n){return n=n.replace(e.fn.form.settings.regExp.escape,"\\$&"),-1!==t.search(new RegExp(n,"i"))},containsExactly:function(t,n){return n=n.replace(e.fn.form.settings.regExp.escape,"\\$&"),-1!==t.search(new RegExp(n))},doesntContain:function(t,n){return n=n.replace(e.fn.form.settings.regExp.escape,"\\$&"),-1===t.search(new RegExp(n,"i"))},doesntContainExactly:function(t,n){return n=n.replace(e.fn.form.settings.regExp.escape,"\\$&"),-1===t.search(new RegExp(n))},minLength:function(e,t){return void 0!==e&&e.length>=t},length:function(e,t){return void 0!==e&&e.length>=t},exactLength:function(e,t){return void 0!==e&&e.length==t},maxLength:function(e,t){return void 0!==e&&e.length<=t},match:function(t,n){var i;e(this);return e('[data-validate="'+n+'"]').length>0?i=e('[data-validate="'+n+'"]').val():e("#"+n).length>0?i=e("#"+n).val():e('[name="'+n+'"]').length>0?i=e('[name="'+n+'"]').val():e('[name="'+n+'[]"]').length>0&&(i=e('[name="'+n+'[]"]')),void 0!==i&&t.toString()==i.toString()},different:function(t,n){var i;e(this);return e('[data-validate="'+n+'"]').length>0?i=e('[data-validate="'+n+'"]').val():e("#"+n).length>0?i=e("#"+n).val():e('[name="'+n+'"]').length>0?i=e('[name="'+n+'"]').val():e('[name="'+n+'[]"]').length>0&&(i=e('[name="'+n+'[]"]')),void 0!==i&&t.toString()!==i.toString()},creditCard:function(t,n){var i,o,r={visa:{pattern:/^4/,length:[16]},amex:{pattern:/^3[47]/,length:[15]},mastercard:{pattern:/^5[1-5]/,length:[16]},discover:{pattern:/^(6011|622(12[6-9]|1[3-9][0-9]|[2-8][0-9]{2}|9[0-1][0-9]|92[0-5]|64[4-9])|65)/,length:[16]},unionPay:{pattern:/^(62|88)/,length:[16,17,18,19]},jcb:{pattern:/^35(2[89]|[3-8][0-9])/,length:[16]},maestro:{pattern:/^(5018|5020|5038|6304|6759|676[1-3])/,length:[12,13,14,15,16,17,18,19]},dinersClub:{pattern:/^(30[0-5]|^36)/,length:[14]},laser:{pattern:/^(6304|670[69]|6771)/,length:[16,17,18,19]},visaElectron:{pattern:/^(4026|417500|4508|4844|491(3|7))/,length:[16]}},a={},s=!1,l="string"==typeof n&&n.split(",");if("string"==typeof t&&0!==t.length){if(t=t.replace(/[\-]/g,""),l&&(e.each(l,function(n,i){(o=r[i])&&(a={length:-1!==e.inArray(t.length,o.length),pattern:-1!==t.search(o.pattern)},a.length&&a.pattern&&(s=!0))}),!s))return!1;if(i={number:-1!==e.inArray(t.length,r.unionPay.length),pattern:-1!==t.search(r.unionPay.pattern)},i.number&&i.pattern)return!0;for(var c=t.length,d=0,u=[[0,1,2,3,4,5,6,7,8,9],[0,2,4,6,8,1,3,5,7,9]],f=0;c--;)f+=u[d][parseInt(t.charAt(c),10)],d^=1;return f%10==0&&f>0}},minCount:function(e,t){return 0==t||(1==t?""!==e:e.split(",").length>=t)},exactCount:function(e,t){return 0==t?""===e:1==t?""!==e&&-1===e.search(","):e.split(",").length==t},maxCount:function(e,t){return 0!=t&&(1==t?-1===e.search(","):e.split(",").length<=t)}}}}(jQuery,window,document),function(e,t,n,i){"use strict";t=void 0!==t&&t.Math==Math?t:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),e.fn.checkbox=function(i){var o,r=e(this),a=r.selector||"",s=(new Date).getTime(),l=[],c=arguments[0],d="string"==typeof c,u=[].slice.call(arguments,1);return r.each(function(){var r,f,m=e.extend(!0,{},e.fn.checkbox.settings,i),g=m.className,v=m.namespace,h=m.selector,p=m.error,b="."+v,x="module-"+v,y=e(this),C=e(this).children(h.label),w=e(this).children(h.input),k=w[0],S=!1,T=!1,A=y.data(x),R=this;f={initialize:function(){f.verbose("Initializing checkbox",m),f.create.label(),f.bind.events(),f.set.tabbable(),f.hide.input(),f.observeChanges(),f.instantiate(),f.setup()},instantiate:function(){f.verbose("Storing instance of module",f),A=f,y.data(x,f)},destroy:function(){f.verbose("Destroying module"),f.unbind.events(),f.show.input(),y.removeData(x)},fix:{reference:function(){y.is(h.input)&&(f.debug("Behavior called on <input> adjusting invoked element"),y=y.closest(h.checkbox),f.refresh())}},setup:function(){f.set.initialLoad(),f.is.indeterminate()?(f.debug("Initial value is indeterminate"),f.indeterminate()):f.is.checked()?(f.debug("Initial value is checked"),f.check()):(f.debug("Initial value is unchecked"),f.uncheck()),f.remove.initialLoad()},refresh:function(){C=y.children(h.label),w=y.children(h.input),k=w[0]},hide:{input:function(){f.verbose("Modifying <input> z-index to be unselectable"),w.addClass(g.hidden)}},show:{input:function(){f.verbose("Modifying <input> z-index to be selectable"),w.removeClass(g.hidden)}},observeChanges:function(){"MutationObserver"in t&&(r=new MutationObserver(function(e){f.debug("DOM tree modified, updating selector cache"),f.refresh()}),r.observe(R,{childList:!0,subtree:!0}),f.debug("Setting up mutation observer",r))},attachEvents:function(t,n){var i=e(t);n=e.isFunction(f[n])?f[n]:f.toggle,i.length>0?(f.debug("Attaching checkbox events to element",t,n),i.on("click"+b,n)):f.error(p.notFound)},event:{click:function(t){var n=e(t.target);return n.is(h.input)?void f.verbose("Using default check action on initialized checkbox"):n.is(h.link)?void f.debug("Clicking link inside checkbox, skipping toggle"):(f.toggle(),w.focus(),void t.preventDefault())},keydown:function(e){var t=e.which,n={enter:13,space:32,escape:27};t==n.escape?(f.verbose("Escape key pressed blurring field"),w.blur(),T=!0):e.ctrlKey||t!=n.space&&t!=n.enter?T=!1:(f.verbose("Enter/space key pressed, toggling checkbox"),f.toggle(),T=!0)},keyup:function(e){T&&e.preventDefault()}},check:function(){f.should.allowCheck()&&(f.debug("Checking checkbox",w),f.set.checked(),f.should.ignoreCallbacks()||(m.onChecked.call(k),m.onChange.call(k)))},uncheck:function(){f.should.allowUncheck()&&(f.debug("Unchecking checkbox"),f.set.unchecked(),f.should.ignoreCallbacks()||(m.onUnchecked.call(k),m.onChange.call(k)))},indeterminate:function(){if(f.should.allowIndeterminate())return void f.debug("Checkbox is already indeterminate");f.debug("Making checkbox indeterminate"),f.set.indeterminate(),f.should.ignoreCallbacks()||(m.onIndeterminate.call(k),m.onChange.call(k))},determinate:function(){if(f.should.allowDeterminate())return void f.debug("Checkbox is already determinate");f.debug("Making checkbox determinate"),f.set.determinate(),f.should.ignoreCallbacks()||(m.onDeterminate.call(k),m.onChange.call(k))},enable:function(){if(f.is.enabled())return void f.debug("Checkbox is already enabled");f.debug("Enabling checkbox"),f.set.enabled(),m.onEnable.call(k),m.onEnabled.call(k)},disable:function(){if(f.is.disabled())return void f.debug("Checkbox is already disabled");f.debug("Disabling checkbox"),f.set.disabled(),m.onDisable.call(k),m.onDisabled.call(k)},get:{radios:function(){var t=f.get.name();return e('input[name="'+t+'"]').closest(h.checkbox)},otherRadios:function(){return f.get.radios().not(y)},name:function(){return w.attr("name")}},is:{initialLoad:function(){return S},radio:function(){return w.hasClass(g.radio)||"radio"==w.attr("type")},indeterminate:function(){return void 0!==w.prop("indeterminate")&&w.prop("indeterminate")},checked:function(){return void 0!==w.prop("checked")&&w.prop("checked")},disabled:function(){return void 0!==w.prop("disabled")&&w.prop("disabled")},enabled:function(){return!f.is.disabled()},determinate:function(){return!f.is.indeterminate()},unchecked:function(){return!f.is.checked()}},should:{allowCheck:function(){return f.is.determinate()&&f.is.checked()&&!f.should.forceCallbacks()?(f.debug("Should not allow check, checkbox is already checked"),!1):!1!==m.beforeChecked.apply(k)||(f.debug("Should not allow check, beforeChecked cancelled"),!1)},allowUncheck:function(){return f.is.determinate()&&f.is.unchecked()&&!f.should.forceCallbacks()?(f.debug("Should not allow uncheck, checkbox is already unchecked"),!1):!1!==m.beforeUnchecked.apply(k)||(f.debug("Should not allow uncheck, beforeUnchecked cancelled"),!1)},allowIndeterminate:function(){return f.is.indeterminate()&&!f.should.forceCallbacks()?(f.debug("Should not allow indeterminate, checkbox is already indeterminate"),!1):!1!==m.beforeIndeterminate.apply(k)||(f.debug("Should not allow indeterminate, beforeIndeterminate cancelled"),!1)},allowDeterminate:function(){return f.is.determinate()&&!f.should.forceCallbacks()?(f.debug("Should not allow determinate, checkbox is already determinate"),!1):!1!==m.beforeDeterminate.apply(k)||(f.debug("Should not allow determinate, beforeDeterminate cancelled"),!1)},forceCallbacks:function(){return f.is.initialLoad()&&m.fireOnInit},ignoreCallbacks:function(){return S&&!m.fireOnInit}},can:{change:function(){return!(y.hasClass(g.disabled)||y.hasClass(g.readOnly)||w.prop("disabled")||w.prop("readonly"))},uncheck:function(){return"boolean"==typeof m.uncheckable?m.uncheckable:!f.is.radio()}},set:{initialLoad:function(){S=!0},checked:function(){if(f.verbose("Setting class to checked"),y.removeClass(g.indeterminate).addClass(g.checked),f.is.radio()&&f.uncheckOthers(),!f.is.indeterminate()&&f.is.checked())return void f.debug("Input is already checked, skipping input property change")
12 ;f.verbose("Setting state to checked",k),w.prop("indeterminate",!1).prop("checked",!0),f.trigger.change()},unchecked:function(){if(f.verbose("Removing checked class"),y.removeClass(g.indeterminate).removeClass(g.checked),!f.is.indeterminate()&&f.is.unchecked())return void f.debug("Input is already unchecked");f.debug("Setting state to unchecked"),w.prop("indeterminate",!1).prop("checked",!1),f.trigger.change()},indeterminate:function(){if(f.verbose("Setting class to indeterminate"),y.addClass(g.indeterminate),f.is.indeterminate())return void f.debug("Input is already indeterminate, skipping input property change");f.debug("Setting state to indeterminate"),w.prop("indeterminate",!0),f.trigger.change()},determinate:function(){if(f.verbose("Removing indeterminate class"),y.removeClass(g.indeterminate),f.is.determinate())return void f.debug("Input is already determinate, skipping input property change");f.debug("Setting state to determinate"),w.prop("indeterminate",!1)},disabled:function(){if(f.verbose("Setting class to disabled"),y.addClass(g.disabled),f.is.disabled())return void f.debug("Input is already disabled, skipping input property change");f.debug("Setting state to disabled"),w.prop("disabled","disabled"),f.trigger.change()},enabled:function(){if(f.verbose("Removing disabled class"),y.removeClass(g.disabled),f.is.enabled())return void f.debug("Input is already enabled, skipping input property change");f.debug("Setting state to enabled"),w.prop("disabled",!1),f.trigger.change()},tabbable:function(){f.verbose("Adding tabindex to checkbox"),void 0===w.attr("tabindex")&&w.attr("tabindex",0)}},remove:{initialLoad:function(){S=!1}},trigger:{change:function(){var e=n.createEvent("HTMLEvents"),t=w[0];t&&(f.verbose("Triggering native change event"),e.initEvent("change",!0,!1),t.dispatchEvent(e))}},create:{label:function(){w.prevAll(h.label).length>0?(w.prev(h.label).detach().insertAfter(w),f.debug("Moving existing label",C)):f.has.label()||(C=e("<label>").insertAfter(w),f.debug("Creating label",C))}},has:{label:function(){return C.length>0}},bind:{events:function(){f.verbose("Attaching checkbox events"),y.on("click"+b,f.event.click).on("keydown"+b,h.input,f.event.keydown).on("keyup"+b,h.input,f.event.keyup)}},unbind:{events:function(){f.debug("Removing events"),y.off(b)}},uncheckOthers:function(){var e=f.get.otherRadios();f.debug("Unchecking other radios",e),e.removeClass(g.checked)},toggle:function(){if(!f.can.change())return void(f.is.radio()||f.debug("Checkbox is read-only or disabled, ignoring toggle"));f.is.indeterminate()||f.is.unchecked()?(f.debug("Currently unchecked"),f.check()):f.is.checked()&&f.can.uncheck()&&(f.debug("Currently checked"),f.uncheck())},setting:function(t,n){if(f.debug("Changing setting",t,n),e.isPlainObject(t))e.extend(!0,m,t);else{if(void 0===n)return m[t];e.isPlainObject(m[t])?e.extend(!0,m[t],n):m[t]=n}},internal:function(t,n){if(e.isPlainObject(t))e.extend(!0,f,t);else{if(void 0===n)return f[t];f[t]=n}},debug:function(){!m.silent&&m.debug&&(m.performance?f.performance.log(arguments):(f.debug=Function.prototype.bind.call(console.info,console,m.name+":"),f.debug.apply(console,arguments)))},verbose:function(){!m.silent&&m.verbose&&m.debug&&(m.performance?f.performance.log(arguments):(f.verbose=Function.prototype.bind.call(console.info,console,m.name+":"),f.verbose.apply(console,arguments)))},error:function(){m.silent||(f.error=Function.prototype.bind.call(console.error,console,m.name+":"),f.error.apply(console,arguments))},performance:{log:function(e){var t,n,i;m.performance&&(t=(new Date).getTime(),i=s||t,n=t-i,s=t,l.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:R,"Execution Time":n})),clearTimeout(f.performance.timer),f.performance.timer=setTimeout(f.performance.display,500)},display:function(){var t=m.name+":",n=0;s=!1,clearTimeout(f.performance.timer),e.each(l,function(e,t){n+=t["Execution Time"]}),t+=" "+n+"ms",a&&(t+=" '"+a+"'"),(void 0!==console.group||void 0!==console.table)&&l.length>0&&(console.groupCollapsed(t),console.table?console.table(l):e.each(l,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),l=[]}},invoke:function(t,n,i){var r,a,s,l=A;return n=n||u,i=R||i,"string"==typeof t&&void 0!==l&&(t=t.split(/[\. ]/),r=t.length-1,e.each(t,function(n,i){var o=n!=r?i+t[n+1].charAt(0).toUpperCase()+t[n+1].slice(1):t;if(e.isPlainObject(l[o])&&n!=r)l=l[o];else{if(void 0!==l[o])return a=l[o],!1;if(!e.isPlainObject(l[i])||n==r)return void 0!==l[i]?(a=l[i],!1):(f.error(p.method,t),!1);l=l[i]}})),e.isFunction(a)?s=a.apply(i,n):void 0!==a&&(s=a),e.isArray(o)?o.push(s):void 0!==o?o=[o,s]:void 0!==s&&(o=s),a}},d?(void 0===A&&f.initialize(),f.invoke(c)):(void 0!==A&&A.invoke("destroy"),f.initialize())}),void 0!==o?o:this},e.fn.checkbox.settings={name:"Checkbox",namespace:"checkbox",silent:!1,debug:!1,verbose:!0,performance:!0,uncheckable:"auto",fireOnInit:!1,onChange:function(){},beforeChecked:function(){},beforeUnchecked:function(){},beforeDeterminate:function(){},beforeIndeterminate:function(){},onChecked:function(){},onUnchecked:function(){},onDeterminate:function(){},onIndeterminate:function(){},onEnable:function(){},onDisable:function(){},onEnabled:function(){},onDisabled:function(){},className:{checked:"checked",indeterminate:"indeterminate",disabled:"disabled",hidden:"hidden",radio:"radio",readOnly:"read-only"},error:{method:"The method you called is not defined"},selector:{checkbox:".ui.checkbox",label:"label, .box",input:'input[type="checkbox"], input[type="radio"]',link:"a[href]"}}}(jQuery,window,document),function(e,t,n,i){"use strict";t=void 0!==t&&t.Math==Math?t:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),e.fn.dropdown=function(i){var o,r=e(this),a=e(n),s=r.selector||"",l="ontouchstart"in n.documentElement,c=(new Date).getTime(),d=[],u=arguments[0],f="string"==typeof u,m=[].slice.call(arguments,1);return r.each(function(g){var v,h,p,b,x,y,C,w,k=e.isPlainObject(i)?e.extend(!0,{},e.fn.dropdown.settings,i):e.extend({},e.fn.dropdown.settings),S=k.className,T=k.message,A=k.fields,R=k.keys,E=k.metadata,P=k.namespace,O=k.regExp,q=k.selector,D=k.error,F=k.templates,I="."+P,z="module-"+P,L=e(this),V=e(k.context),j=L.find(q.text),M=L.find(q.search),N=L.find(q.sizer),U=L.find(q.input),H=L.find(q.icon),W=L.prev().find(q.text).length>0?L.prev().find(q.text):L.prev(),B=L.children(q.menu),X=B.find(q.item),Y=!1,$=!1,Z=!1,J=this,K=L.data(z);w={initialize:function(){w.debug("Initializing dropdown",k),w.is.alreadySetup()?w.setup.reference():(w.setup.layout(),w.refreshData(),w.save.defaults(),w.restore.selected(),w.create.id(),w.bind.events(),w.observeChanges(),w.instantiate())},instantiate:function(){w.verbose("Storing instance of dropdown",w),K=w,L.data(z,w)},destroy:function(){w.verbose("Destroying previous dropdown",L),w.remove.tabbable(),L.off(I).removeData(z),B.off(I),a.off(b),w.disconnect.menuObserver(),w.disconnect.selectObserver()},observeChanges:function(){"MutationObserver"in t&&(y=new MutationObserver(w.event.select.mutation),C=new MutationObserver(w.event.menu.mutation),w.debug("Setting up mutation observer",y,C),w.observe.select(),w.observe.menu())},disconnect:{menuObserver:function(){C&&C.disconnect()},selectObserver:function(){y&&y.disconnect()}},observe:{select:function(){w.has.input()&&y.observe(U[0],{childList:!0,subtree:!0})},menu:function(){w.has.menu()&&C.observe(B[0],{childList:!0,subtree:!0})}},create:{id:function(){x=(Math.random().toString(16)+"000000000").substr(2,8),b="."+x,w.verbose("Creating unique id for element",x)},userChoice:function(t){var n,i,o;return!!(t=t||w.get.userValues())&&(t=e.isArray(t)?t:[t],e.each(t,function(t,r){!1===w.get.item(r)&&(o=k.templates.addition(w.add.variables(T.addResult,r)),i=e("<div />").html(o).attr("data-"+E.value,r).attr("data-"+E.text,r).addClass(S.addition).addClass(S.item),k.hideAdditions&&i.addClass(S.hidden),n=void 0===n?i:n.add(i),w.verbose("Creating user choices for value",r,i))}),n)},userLabels:function(t){var n=w.get.userValues();n&&(w.debug("Adding user labels",n),e.each(n,function(e,t){w.verbose("Adding custom user value"),w.add.label(t,t)}))},menu:function(){B=e("<div />").addClass(S.menu).appendTo(L)},sizer:function(){N=e("<span />").addClass(S.sizer).insertAfter(M)}},search:function(e){e=void 0!==e?e:w.get.query(),w.verbose("Searching for query",e),w.has.minCharacters(e)?w.filter(e):w.hide()},select:{firstUnfiltered:function(){w.verbose("Selecting first non-filtered element"),w.remove.selectedItem(),X.not(q.unselectable).not(q.addition+q.hidden).eq(0).addClass(S.selected)},nextAvailable:function(e){e=e.eq(0);var t=e.nextAll(q.item).not(q.unselectable).eq(0),n=e.prevAll(q.item).not(q.unselectable).eq(0);t.length>0?(w.verbose("Moving selection to",t),t.addClass(S.selected)):(w.verbose("Moving selection to",n),n.addClass(S.selected))}},setup:{api:function(){var e={debug:k.debug,urlData:{value:w.get.value(),query:w.get.query()},on:!1};w.verbose("First request, initializing API"),L.api(e)},layout:function(){L.is("select")&&(w.setup.select(),w.setup.returnedObject()),w.has.menu()||w.create.menu(),w.is.search()&&!w.has.search()&&(w.verbose("Adding search input"),M=e("<input />").addClass(S.search).prop("autocomplete","off").insertBefore(j)),w.is.multiple()&&w.is.searchSelection()&&!w.has.sizer()&&w.create.sizer(),k.allowTab&&w.set.tabbable()},select:function(){var t=w.get.selectValues();w.debug("Dropdown initialized on a select",t),L.is("select")&&(U=L),U.parent(q.dropdown).length>0?(w.debug("UI dropdown already exists. Creating dropdown menu only"),L=U.closest(q.dropdown),w.has.menu()||w.create.menu(),B=L.children(q.menu),w.setup.menu(t)):(w.debug("Creating entire dropdown from select"),L=e("<div />").attr("class",U.attr("class")).addClass(S.selection).addClass(S.dropdown).html(F.dropdown(t)).insertBefore(U),U.hasClass(S.multiple)&&!1===U.prop("multiple")&&(w.error(D.missingMultiple),U.prop("multiple",!0)),U.is("[multiple]")&&w.set.multiple(),U.prop("disabled")&&(w.debug("Disabling dropdown"),L.addClass(S.disabled)),U.removeAttr("class").detach().prependTo(L)),w.refresh()},menu:function(e){B.html(F.menu(e,A)),X=B.find(q.item)},reference:function(){w.debug("Dropdown behavior was called on select, replacing with closest dropdown"),L=L.parent(q.dropdown),w.refresh(),w.setup.returnedObject(),f&&(K=w,w.invoke(u))},returnedObject:function(){var e=r.slice(0,g),t=r.slice(g+1);r=e.add(L).add(t)}},refresh:function(){w.refreshSelectors(),w.refreshData()},refreshItems:function(){X=B.find(q.item)},refreshSelectors:function(){w.verbose("Refreshing selector cache"),j=L.find(q.text),M=L.find(q.search),U=L.find(q.input),H=L.find(q.icon),W=L.prev().find(q.text).length>0?L.prev().find(q.text):L.prev(),B=L.children(q.menu),X=B.find(q.item)},refreshData:function(){w.verbose("Refreshing cached metadata"),X.removeData(E.text).removeData(E.value)},clearData:function(){w.verbose("Clearing metadata"),X.removeData(E.text).removeData(E.value),L.removeData(E.defaultText).removeData(E.defaultValue).removeData(E.placeholderText)},toggle:function(){w.verbose("Toggling menu visibility"),w.is.active()?w.hide():w.show()},show:function(t){if(t=e.isFunction(t)?t:function(){},!w.can.show()&&w.is.remote()&&(w.debug("No API results retrieved, searching before show"),w.queryRemote(w.get.query(),w.show)),w.can.show()&&!w.is.active()){if(w.debug("Showing dropdown"),!w.has.message()||w.has.maxSelections()||w.has.allResultsFiltered()||w.remove.message(),w.is.allFiltered())return!0;!1!==k.onShow.call(J)&&w.animate.show(function(){w.can.click()&&w.bind.intent(),w.has.menuSearch()&&w.focusSearch(),w.set.visible(),t.call(J)})}},hide:function(t){t=e.isFunction(t)?t:function(){},w.is.active()&&(w.debug("Hiding dropdown"),!1!==k.onHide.call(J)&&w.animate.hide(function(){w.remove.visible(),t.call(J)}))},hideOthers:function(){w.verbose("Finding other dropdowns to hide"),r.not(L).has(q.menu+"."+S.visible).dropdown("hide")},hideMenu:function(){w.verbose("Hiding menu instantaneously"),w.remove.active(),w.remove.visible(),B.transition("hide")},hideSubMenus:function(){var e=B.children(q.item).find(q.menu);w.verbose("Hiding sub menus",e),e.transition("hide")},bind:{events:function(){l&&w.bind.touchEvents(),w.bind.keyboardEvents(),w.bind.inputEvents(),w.bind.mouseEvents()},touchEvents:function(){w.debug("Touch device detected binding additional touch events"),w.is.searchSelection()||w.is.single()&&L.on("touchstart"+I,w.event.test.toggle),B.on("touchstart"+I,q.item,w.event.item.mouseenter)},keyboardEvents:function(){w.verbose("Binding keyboard events"),L.on("keydown"+I,w.event.keydown),w.has.search()&&L.on(w.get.inputEvent()+I,q.search,w.event.input),w.is.multiple()&&a.on("keydown"+b,w.event.document.keydown)},inputEvents:function(){w.verbose("Binding input change events"),L.on("change"+I,q.input,w.event.change)},mouseEvents:function(){w.verbose("Binding mouse events"),w.is.multiple()&&L.on("click"+I,q.label,w.event.label.click).on("click"+I,q.remove,w.event.remove.click),w.is.searchSelection()?(L.on("mousedown"+I,w.event.mousedown).on("mouseup"+I,w.event.mouseup).on("mousedown"+I,q.menu,w.event.menu.mousedown).on("mouseup"+I,q.menu,w.event.menu.mouseup).on("click"+I,q.icon,w.event.icon.click).on("focus"+I,q.search,w.event.search.focus).on("click"+I,q.search,w.event.search.focus).on("blur"+I,q.search,w.event.search.blur).on("click"+I,q.text,w.event.text.focus),w.is.multiple()&&L.on("click"+I,w.event.click)):("click"==k.on?L.on("click"+I,q.icon,w.event.icon.click).on("click"+I,w.event.test.toggle):"hover"==k.on?L.on("mouseenter"+I,w.delay.show).on("mouseleave"+I,w.delay.hide):L.on(k.on+I,w.toggle),L.on("mousedown"+I,w.event.mousedown).on("mouseup"+I,w.event.mouseup).on("focus"+I,w.event.focus),w.has.menuSearch()?L.on("blur"+I,q.search,w.event.search.blur):L.on("blur"+I,w.event.blur)),B.on("mouseenter"+I,q.item,w.event.item.mouseenter).on("mouseleave"+I,q.item,w.event.item.mouseleave).on("click"+I,q.item,w.event.item.click)},intent:function(){w.verbose("Binding hide intent event to document"),l&&a.on("touchstart"+b,w.event.test.touch).on("touchmove"+b,w.event.test.touch),a.on("click"+b,w.event.test.hide)}},unbind:{intent:function(){w.verbose("Removing hide intent event from document"),l&&a.off("touchstart"+b).off("touchmove"+b),a.off("click"+b)}},filter:function(e){var t=void 0!==e?e:w.get.query(),n=function(){w.is.multiple()&&w.filterActive(),w.select.firstUnfiltered(),w.has.allResultsFiltered()?k.onNoResults.call(J,t)?k.allowAdditions?k.hideAdditions&&(w.verbose("User addition with no menu, setting empty style"),w.set.empty(),w.hideMenu()):(w.verbose("All items filtered, showing message",t),w.add.message(T.noResults)):(w.verbose("All items filtered, hiding dropdown",t),w.hideMenu()):(w.remove.empty(),w.remove.message()),k.allowAdditions&&w.add.userSuggestion(e),w.is.searchSelection()&&w.can.show()&&w.is.focusedOnSearch()&&w.show()};k.useLabels&&w.has.maxSelections()||(k.apiSettings?w.can.useAPI()?w.queryRemote(t,function(){k.filterRemoteData&&w.filterItems(t),n()}):w.error(D.noAPI):(w.filterItems(t),n()))},queryRemote:function(t,n){var i={errorDuration:!1,cache:"local",throttle:k.throttle,urlData:{query:t},onError:function(){w.add.message(T.serverError),n()},onFailure:function(){w.add.message(T.serverError),n()},onSuccess:function(e){w.remove.message(),w.setup.menu({values:e[A.remoteValues]}),n()}};L.api("get request")||w.setup.api(),i=e.extend(!0,{},i,k.apiSettings),L.api("setting",i).api("query")},filterItems:function(t){var n=void 0!==t?t:w.get.query(),i=null,o=w.escape.string(n),r=new RegExp("^"+o,"igm");w.has.query()&&(i=[],w.verbose("Searching for matching values",n),X.each(function(){var t,o,a=e(this);if("both"==k.match||"text"==k.match){if(t=String(w.get.choiceText(a,!1)),-1!==t.search(r))return i.push(this),!0;if("exact"===k.fullTextSearch&&w.exactSearch(n,t))return i.push(this),!0;if(!0===k.fullTextSearch&&w.fuzzySearch(n,t))return i.push(this),!0}if("both"==k.match||"value"==k.match){if(o=String(w.get.choiceValue(a,t)),-1!==o.search(r))return i.push(this),!0;if("exact"===k.fullTextSearch&&w.exactSearch(n,o))return i.push(this),!0;if(!0===k.fullTextSearch&&w.fuzzySearch(n,o))return i.push(this),!0}})),w.debug("Showing only matched items",n),w.remove.filteredItem(),i&&X.not(i).addClass(S.filtered)},fuzzySearch:function(e,t){var n=t.length,i=e.length;if(e=e.toLowerCase(),t=t.toLowerCase(),i>n)return!1;if(i===n)return e===t;e:for(var o=0,r=0;o<i;o++){for(var a=e.charCodeAt(o);r<n;)if(t.charCodeAt(r++)===a)continue e;return!1}return!0},exactSearch:function(e,t){return e=e.toLowerCase(),t=t.toLowerCase(),t.indexOf(e)>-1},filterActive:function(){k.useLabels&&X.filter("."+S.active).addClass(S.filtered)},focusSearch:function(e){w.has.search()&&!w.is.focusedOnSearch()&&(e?(L.off("focus"+I,q.search),M.focus(),L.on("focus"+I,q.search,w.event.search.focus)):M.focus())},forceSelection:function(){var e=X.not(S.filtered).filter("."+S.selected).eq(0),t=X.not(S.filtered).filter("."+S.active).eq(0),n=e.length>0?e:t;if(n.length>0&&!w.is.multiple())return w.debug("Forcing partial selection to selected item",n),void w.event.item.click.call(n,{},!0);k.allowAdditions?(w.set.selected(w.get.query()),w.remove.searchTerm()):w.remove.searchTerm()},event:{change:function(){Z||(w.debug("Input changed, updating selection"),w.set.selected())},focus:function(){k.showOnFocus&&!Y&&w.is.hidden()&&!h&&w.show()},blur:function(e){h=n.activeElement===this,Y||h||(w.remove.activeLabel(),w.hide())},mousedown:function(){w.is.searchSelection()?p=!0:Y=!0},mouseup:function(){w.is.searchSelection()?p=!1:Y=!1},click:function(t){e(t.target).is(L)&&(w.is.focusedOnSearch()?w.show():w.focusSearch())},search:{focus:function(){Y=!0,w.is.multiple()&&w.remove.activeLabel(),k.showOnFocus&&w.search()},blur:function(e){h=n.activeElement===this,w.is.searchSelection()&&!p&&($||h||(k.forceSelection&&w.forceSelection(),w.hide())),p=!1}},icon:{click:function(e){w.toggle()}},text:{focus:function(e){Y=!0,w.focusSearch()}},input:function(e){(w.is.multiple()||w.is.searchSelection())&&w.set.filtered(),clearTimeout(w.timer),w.timer=setTimeout(w.search,k.delay.search)},label:{click:function(t){var n=e(this),i=L.find(q.label),o=i.filter("."+S.active),r=n.nextAll("."+S.active),a=n.prevAll("."+S.active),s=r.length>0?n.nextUntil(r).add(o).add(n):n.prevUntil(a).add(o).add(n);t.shiftKey?(o.removeClass(S.active),s.addClass(S.active)):t.ctrlKey?n.toggleClass(S.active):(o.removeClass(S.active),n.addClass(S.active)),k.onLabelSelect.apply(this,i.filter("."+S.active))}},remove:{click:function(){var t=e(this).parent();t.hasClass(S.active)?w.remove.activeLabels():w.remove.activeLabels(t)}},test:{toggle:function(e){var t=w.is.multiple()?w.show:w.toggle;w.is.bubbledLabelClick(e)||w.is.bubbledIconClick(e)||w.determine.eventOnElement(e,t)&&e.preventDefault()},touch:function(e){w.determine.eventOnElement(e,function(){"touchstart"==e.type?w.timer=setTimeout(function(){w.hide()},k.delay.touch):"touchmove"==e.type&&clearTimeout(w.timer)}),e.stopPropagation()},hide:function(e){w.determine.eventInModule(e,w.hide)}},select:{mutation:function(e){w.debug("<select> modified, recreating menu"),w.setup.select()}},menu:{mutation:function(t){var n=t[0],i=e(n.addedNodes?n.addedNodes[0]:!1),o=e(n.removedNodes?n.removedNodes[0]:!1),r=i.add(o),a=r.is(q.addition)||r.closest(q.addition).length>0,s=r.is(q.message)||r.closest(q.message).length>0;a||s?(w.debug("Updating item selector cache"),w.refreshItems()):(w.debug("Menu modified, updating selector cache"),w.refresh())},mousedown:function(){$=!0},mouseup:function(){$=!1}},item:{mouseenter:function(t){var n=e(t.target),i=e(this),o=i.children(q.menu),r=i.siblings(q.item).children(q.menu),a=o.length>0;!(o.find(n).length>0)&&a&&(clearTimeout(w.itemTimer),w.itemTimer=setTimeout(function(){w.verbose("Showing sub-menu",o),e.each(r,function(){w.animate.hide(!1,e(this))}),w.animate.show(!1,o)},k.delay.show),t.preventDefault())},mouseleave:function(t){var n=e(this).children(q.menu);n.length>0&&(clearTimeout(w.itemTimer),w.itemTimer=setTimeout(function(){w.verbose("Hiding sub-menu",n),w.animate.hide(!1,n)},k.delay.hide))},click:function(t,i){var o=e(this),r=e(t?t.target:""),a=o.find(q.menu),s=w.get.choiceText(o),l=w.get.choiceValue(o,s),c=a.length>0,d=a.find(r).length>0;w.has.menuSearch()&&e(n.activeElement).blur(),d||c&&!k.allowCategorySelection||(w.is.searchSelection()&&(k.allowAdditions&&w.remove.userAddition(),w.remove.searchTerm(),w.is.focusedOnSearch()||1==i||w.focusSearch(!0)),k.useLabels||(w.remove.filteredItem(),w.set.scrollPosition(o)),w.determine.selectAction.call(this,s,l))}},document:{keydown:function(e){var t=e.which;if(w.is.inObject(t,R)){var n=L.find(q.label),i=n.filter("."+S.active),o=(i.data(E.value),n.index(i)),r=n.length,a=i.length>0,s=i.length>1,l=0===o,c=o+1==r,d=w.is.searchSelection(),u=w.is.focusedOnSearch(),f=w.is.focused(),m=u&&0===w.get.caretPosition();if(d&&!a&&!u)return;t==R.leftArrow?!f&&!m||a?a&&(e.shiftKey?w.verbose("Adding previous label to selection"):(w.verbose("Selecting previous label"),n.removeClass(S.active)),l&&!s?i.addClass(S.active):i.prev(q.siblingLabel).addClass(S.active).end(),e.preventDefault()):(w.verbose("Selecting previous label"),n.last().addClass(S.active)):t==R.rightArrow?(f&&!a&&n.first().addClass(S.active),a&&(e.shiftKey?w.verbose("Adding next label to selection"):(w.verbose("Selecting next label"),n.removeClass(S.active)),c?d?u?n.removeClass(S.active):w.focusSearch():s?i.next(q.siblingLabel).addClass(S.active):i.addClass(S.active):i.next(q.siblingLabel).addClass(S.active),e.preventDefault())):t==R.deleteKey||t==R.backspace?a?(w.verbose("Removing active labels"),c&&d&&!u&&w.focusSearch(),i.last().next(q.siblingLabel).addClass(S.active),w.remove.activeLabels(i),e.preventDefault()):m&&!a&&t==R.backspace&&(w.verbose("Removing last label on input backspace"),i=n.last().addClass(S.active),w.remove.activeLabels(i)):i.removeClass(S.active)}}},keydown:function(e){var t=e.which;if(w.is.inObject(t,R)){var n,i=X.not(q.unselectable).filter("."+S.selected).eq(0),o=B.children("."+S.active).eq(0),r=i.length>0?i:o,a=r.length>0?r.siblings(":not(."+S.filtered+")").addBack():B.children(":not(."+S.filtered+")"),s=r.children(q.menu),l=r.closest(q.menu),c=l.hasClass(S.visible)||l.hasClass(S.animating)||l.parent(q.menu).length>0,d=s.length>0,u=r.length>0,f=r.not(q.unselectable).length>0,m=t==R.delimiter&&k.allowAdditions&&w.is.multiple(),g=k.allowAdditions&&k.hideAdditions&&(t==R.enter||m)&&f;if(g&&(w.verbose("Selecting item from keyboard shortcut",r),w.event.item.click.call(r,e),w.is.searchSelection()&&w.remove.searchTerm()),w.is.visible()){if((t==R.enter||m)&&(t==R.enter&&u&&d&&!k.allowCategorySelection?(w.verbose("Pressed enter on unselectable category, opening sub menu"),t=R.rightArrow):f&&(w.verbose("Selecting item from keyboard shortcut",r),w.event.item.click.call(r,e),w.is.searchSelection()&&w.remove.searchTerm()),e.preventDefault()),u&&(t==R.leftArrow&&l[0]!==B[0]&&(w.verbose("Left key pressed, closing sub-menu"),w.animate.hide(!1,l),r.removeClass(S.selected),l.closest(q.item).addClass(S.selected),e.preventDefault()),t==R.rightArrow&&d&&(w.verbose("Right key pressed, opening sub-menu"),w.animate.show(!1,s),r.removeClass(S.selected),s.find(q.item).eq(0).addClass(S.selected),e.preventDefault())),t==R.upArrow){if(n=u&&c?r.prevAll(q.item+":not("+q.unselectable+")").eq(0):X.eq(0),a.index(n)<0)return w.verbose("Up key pressed but reached top of current menu"),void e.preventDefault();w.verbose("Up key pressed, changing active item"),r.removeClass(S.selected),n.addClass(S.selected),w.set.scrollPosition(n),k.selectOnKeydown&&w.is.single()&&w.set.selectedItem(n),e.preventDefault()}if(t==R.downArrow){if(n=u&&c?n=r.nextAll(q.item+":not("+q.unselectable+")").eq(0):X.eq(0),0===n.length)return w.verbose("Down key pressed but reached bottom of current menu"),void e.preventDefault();w.verbose("Down key pressed, changing active item"),X.removeClass(S.selected),n.addClass(S.selected),w.set.scrollPosition(n),k.selectOnKeydown&&w.is.single()&&w.set.selectedItem(n),e.preventDefault()}t==R.pageUp&&(w.scrollPage("up"),e.preventDefault()),t==R.pageDown&&(w.scrollPage("down"),e.preventDefault()),t==R.escape&&(w.verbose("Escape key pressed, closing dropdown"),w.hide())}else m&&e.preventDefault(),t!=R.downArrow||w.is.visible()||(w.verbose("Down key pressed, showing dropdown"),w.select.firstUnfiltered(),w.show(),e.preventDefault())}else w.has.search()||w.set.selectedLetter(String.fromCharCode(t))}},trigger:{change:function(){var e=n.createEvent("HTMLEvents"),t=U[0];t&&(w.verbose("Triggering native change event"),e.initEvent("change",!0,!1),t.dispatchEvent(e))}},determine:{selectAction:function(t,n){w.verbose("Determining action",k.action),e.isFunction(w.action[k.action])?(w.verbose("Triggering preset action",k.action,t,n),w.action[k.action].call(J,t,n,this)):e.isFunction(k.action)?(w.verbose("Triggering user action",k.action,t,n),k.action.call(J,t,n,this)):w.error(D.action,k.action)},eventInModule:function(t,i){var o=e(t.target),r=o.closest(n.documentElement).length>0,a=o.closest(L).length>0;return i=e.isFunction(i)?i:function(){},r&&!a?(w.verbose("Triggering event",i),i(),!0):(w.verbose("Event occurred in dropdown, canceling callback"),!1)},eventOnElement:function(t,i){var o=e(t.target),r=o.closest(q.siblingLabel),a=n.body.contains(t.target),s=0===L.find(r).length,l=0===o.closest(B).length;return i=e.isFunction(i)?i:function(){},a&&s&&l?(w.verbose("Triggering event",i),i(),!0):(w.verbose("Event occurred in dropdown menu, canceling callback"),!1)}},action:{nothing:function(){},activate:function(t,n,i){if(n=void 0!==n?n:t,w.can.activate(e(i))){if(w.set.selected(n,e(i)),w.is.multiple()&&!w.is.allFiltered())return;w.hideAndClear()}},select:function(t,n,i){if(n=void 0!==n?n:t,w.can.activate(e(i))){if(w.set.value(n,e(i)),w.is.multiple()&&!w.is.allFiltered())return;w.hideAndClear()}},combo:function(t,n,i){n=void 0!==n?n:t,w.set.selected(n,e(i)),w.hideAndClear()},hide:function(e,t,n){w.set.value(t,e),w.hideAndClear()}},get:{id:function(){return x},defaultText:function(){return L.data(E.defaultText)},defaultValue:function(){return L.data(E.defaultValue)},placeholderText:function(){return L.data(E.placeholderText)||""},text:function(){return j.text()},query:function(){return e.trim(M.val())},searchWidth:function(e){return e=void 0!==e?e:M.val(),N.text(e),Math.ceil(N.width()+1)},selectionCount:function(){var t=w.get.values();return w.is.multiple()?e.isArray(t)?t.length:0:""!==w.get.value()?1:0},transition:function(e){return"auto"==k.transition?w.is.upward(e)?"slide up":"slide down":k.transition},userValues:function(){var t=w.get.values();return!!t&&(t=e.isArray(t)?t:[t],e.grep(t,function(e){return!1===w.get.item(e)}))},uniqueArray:function(t){return e.grep(t,function(n,i){return e.inArray(n,t)===i})},caretPosition:function(){var e,t,i=M.get(0);return"selectionStart"in i?i.selectionStart:n.selection?(i.focus(),e=n.selection.createRange(),t=e.text.length,e.moveStart("character",-i.value.length),e.text.length-t):void 0},value:function(){var t=U.length>0?U.val():L.data(E.value),n=e.isArray(t)&&1===t.length&&""===t[0];return void 0===t||n?"":t},values:function(){var e=w.get.value();return""===e?"":!w.has.selectInput()&&w.is.multiple()?"string"==typeof e?e.split(k.delimiter):"":e},remoteValues:function(){var t=w.get.values(),n=!1;return t&&("string"==typeof t&&(t=[t]),e.each(t,function(e,t){var i=w.read.remoteData(t);w.verbose("Restoring value from session data",i,t),i&&(n||(n={}),n[t]=i)})),n},choiceText:function(t,n){if(n=void 0!==n?n:k.preserveHTML,t)return t.find(q.menu).length>0&&(w.verbose("Retrieving text of element with sub-menu"),t=t.clone(),t.find(q.menu).remove(),t.find(q.menuIcon).remove()),void 0!==t.data(E.text)?t.data(E.text):n?e.trim(t.html()):e.trim(t.text())},choiceValue:function(t,n){return n=n||w.get.choiceText(t),!!t&&(void 0!==t.data(E.value)?String(t.data(E.value)):"string"==typeof n?e.trim(n.toLowerCase()):String(n))},inputEvent:function(){var e=M[0];return!!e&&(void 0!==e.oninput?"input":void 0!==e.onpropertychange?"propertychange":"keyup")},selectValues:function(){var t={};return t.values=[],L.find("option").each(function(){var n=e(this),i=n.html(),o=n.attr("disabled"),r=void 0!==n.attr("value")?n.attr("value"):i;"auto"===k.placeholder&&""===r?t.placeholder=i:t.values.push({name:i,value:r,disabled:o})}),k.placeholder&&"auto"!==k.placeholder&&(w.debug("Setting placeholder value to",k.placeholder),t.placeholder=k.placeholder),k.sortSelect?(t.values.sort(function(e,t){return e.name>t.name?1:-1}),w.debug("Retrieved and sorted values from select",t)):w.debug("Retrieved values from select",t),t},activeItem:function(){return X.filter("."+S.active)},selectedItem:function(){var e=X.not(q.unselectable).filter("."+S.selected);return e.length>0?e:X.eq(0)},itemWithAdditions:function(e){var t=w.get.item(e),n=w.create.userChoice(e);return n&&n.length>0&&(t=t.length>0?t.add(n):n),t},item:function(t,n){var i,o,r=!1;return t=void 0!==t?t:void 0!==w.get.values()?w.get.values():w.get.text(),i=o?t.length>0:void 0!==t&&null!==t,o=w.is.multiple()&&e.isArray(t),n=""===t||0===t||(n||!1),i&&X.each(function(){var i=e(this),a=w.get.choiceText(i),s=w.get.choiceValue(i,a);if(null!==s&&void 0!==s)if(o)-1===e.inArray(String(s),t)&&-1===e.inArray(a,t)||(r=r?r.add(i):i);else if(n){if(w.verbose("Ambiguous dropdown value using strict type check",i,t),s===t||a===t)return r=i,!0}else if(String(s)==String(t)||a==t)return w.verbose("Found select item by value",s,t),r=i,!0}),r}},check:{maxSelections:function(e){return!k.maxSelections||(e=void 0!==e?e:w.get.selectionCount(),e>=k.maxSelections?(w.debug("Maximum selection count reached"),k.useLabels&&(X.addClass(S.filtered),w.add.message(T.maxSelections)),!0):(w.verbose("No longer at maximum selection count"),w.remove.message(),w.remove.filteredItem(),w.is.searchSelection()&&w.filterItems(),!1))}},restore:{defaults:function(){w.clear(),w.restore.defaultText(),w.restore.defaultValue()},defaultText:function(){var e=w.get.defaultText();e===w.get.placeholderText?(w.debug("Restoring default placeholder text",e),w.set.placeholderText(e)):(w.debug("Restoring default text",e),w.set.text(e))},placeholderText:function(){w.set.placeholderText()},defaultValue:function(){var e=w.get.defaultValue();void 0!==e&&(w.debug("Restoring default value",e),""!==e?(w.set.value(e),w.set.selected()):(w.remove.activeItem(),w.remove.selectedItem()))},labels:function(){k.allowAdditions&&(k.useLabels||(w.error(D.labels),k.useLabels=!0),w.debug("Restoring selected values"),w.create.userLabels()),w.check.maxSelections()},selected:function(){w.restore.values(),w.is.multiple()?(w.debug("Restoring previously selected values and labels"),w.restore.labels()):w.debug("Restoring previously selected values")},values:function(){w.set.initialLoad(),k.apiSettings&&k.saveRemoteData&&w.get.remoteValues()?w.restore.remoteValues():w.set.selected(),w.remove.initialLoad()},remoteValues:function(){var t=w.get.remoteValues();w.debug("Recreating selected from session data",t),t&&(w.is.single()?e.each(t,function(e,t){w.set.text(t)}):e.each(t,function(e,t){w.add.label(e,t)}))}},read:{remoteData:function(e){var n;return void 0===t.Storage?void w.error(D.noStorage):void 0!==(n=sessionStorage.getItem(e))&&n}},save:{defaults:function(){w.save.defaultText(),w.save.placeholderText(),w.save.defaultValue()},defaultValue:function(){var e=w.get.value();w.verbose("Saving default value as",e),L.data(E.defaultValue,e)},defaultText:function(){var e=w.get.text();w.verbose("Saving default text as",e),L.data(E.defaultText,e)},placeholderText:function(){var e;!1!==k.placeholder&&j.hasClass(S.placeholder)&&(e=w.get.text(),w.verbose("Saving placeholder text as",e),L.data(E.placeholderText,e))},remoteData:function(e,n){if(void 0===t.Storage)return void w.error(D.noStorage);w.verbose("Saving remote data to session storage",n,e),sessionStorage.setItem(n,e)}},clear:function(){
13 w.is.multiple()&&k.useLabels?w.remove.labels():(w.remove.activeItem(),w.remove.selectedItem()),w.set.placeholderText(),w.clearValue()},clearValue:function(){w.set.value("")},scrollPage:function(e,t){var n,i,o,r=t||w.get.selectedItem(),a=r.closest(q.menu),s=a.outerHeight(),l=a.scrollTop(),c=X.eq(0).outerHeight(),d=Math.floor(s/c),u=(a.prop("scrollHeight"),"up"==e?l-c*d:l+c*d),f=X.not(q.unselectable);o="up"==e?f.index(r)-d:f.index(r)+d,n="up"==e?o>=0:o<f.length,i=n?f.eq(o):"up"==e?f.first():f.last(),i.length>0&&(w.debug("Scrolling page",e,i),r.removeClass(S.selected),i.addClass(S.selected),k.selectOnKeydown&&w.is.single()&&w.set.selectedItem(i),a.scrollTop(u))},set:{filtered:function(){var e=w.is.multiple(),t=w.is.searchSelection(),n=e&&t,i=t?w.get.query():"",o="string"==typeof i&&i.length>0,r=w.get.searchWidth(),a=""!==i;e&&o&&(w.verbose("Adjusting input width",r,k.glyphWidth),M.css("width",r)),o||n&&a?(w.verbose("Hiding placeholder text"),j.addClass(S.filtered)):(!e||n&&!a)&&(w.verbose("Showing placeholder text"),j.removeClass(S.filtered))},empty:function(){L.addClass(S.empty)},loading:function(){L.addClass(S.loading)},placeholderText:function(e){e=e||w.get.placeholderText(),w.debug("Setting placeholder text",e),w.set.text(e),j.addClass(S.placeholder)},tabbable:function(){w.is.searchSelection()?(w.debug("Added tabindex to searchable dropdown"),M.val("").attr("tabindex",0),B.attr("tabindex",-1)):(w.debug("Added tabindex to dropdown"),void 0===L.attr("tabindex")&&(L.attr("tabindex",0),B.attr("tabindex",-1)))},initialLoad:function(){w.verbose("Setting initial load"),v=!0},activeItem:function(e){k.allowAdditions&&e.filter(q.addition).length>0?e.addClass(S.filtered):e.addClass(S.active)},partialSearch:function(e){var t=w.get.query().length;M.val(e.substr(0,t))},scrollPosition:function(e,t){var n,i,o,r,a,s,l,c,d;e=e||w.get.selectedItem(),n=e.closest(q.menu),i=e&&e.length>0,t=void 0!==t&&t,e&&n.length>0&&i&&(r=e.position().top,n.addClass(S.loading),s=n.scrollTop(),a=n.offset().top,r=e.offset().top,o=s-a+r,t||(l=n.height(),d=s+l<o+5,c=o-5<s),w.debug("Scrolling to active item",o),(t||c||d)&&n.scrollTop(o),n.removeClass(S.loading))},text:function(e){"select"!==k.action&&("combo"==k.action?(w.debug("Changing combo button text",e,W),k.preserveHTML?W.html(e):W.text(e)):(e!==w.get.placeholderText()&&j.removeClass(S.placeholder),w.debug("Changing text",e,j),j.removeClass(S.filtered),k.preserveHTML?j.html(e):j.text(e)))},selectedItem:function(e){var t=w.get.choiceValue(e),n=w.get.choiceText(e,!1),i=w.get.choiceText(e,!0);w.debug("Setting user selection to item",e),w.remove.activeItem(),w.set.partialSearch(n),w.set.activeItem(e),w.set.selected(t,e),w.set.text(i)},selectedLetter:function(t){var n,i=X.filter("."+S.selected),o=i.length>0&&w.has.firstLetter(i,t),r=!1;o&&(n=i.nextAll(X).eq(0),w.has.firstLetter(n,t)&&(r=n)),r||X.each(function(){if(w.has.firstLetter(e(this),t))return r=e(this),!1}),r&&(w.verbose("Scrolling to next value with letter",t),w.set.scrollPosition(r),i.removeClass(S.selected),r.addClass(S.selected),k.selectOnKeydown&&w.is.single()&&w.set.selectedItem(r))},direction:function(e){"auto"==k.direction?w.is.onScreen(e)?w.remove.upward(e):w.set.upward(e):"upward"==k.direction&&w.set.upward(e)},upward:function(e){(e||L).addClass(S.upward)},value:function(e,t,n){var i=w.escape.value(e),o=U.length>0,r=(w.has.value(e),w.get.values()),a=void 0!==e?String(e):e;if(o){if(!k.allowReselection&&a==r&&(w.verbose("Skipping value update already same value",e,r),!w.is.initialLoad()))return;w.is.single()&&w.has.selectInput()&&w.can.extendSelect()&&(w.debug("Adding user option",e),w.add.optionValue(e)),w.debug("Updating input value",i,r),Z=!0,U.val(i),!1===k.fireOnInit&&w.is.initialLoad()?w.debug("Input native change event ignored on initial load"):w.trigger.change(),Z=!1}else w.verbose("Storing value in metadata",i,U),i!==r&&L.data(E.value,a);!1===k.fireOnInit&&w.is.initialLoad()?w.verbose("No callback on initial load",k.onChange):k.onChange.call(J,e,t,n)},active:function(){L.addClass(S.active)},multiple:function(){L.addClass(S.multiple)},visible:function(){L.addClass(S.visible)},exactly:function(e,t){w.debug("Setting selected to exact values"),w.clear(),w.set.selected(e,t)},selected:function(t,n){var i=w.is.multiple();(n=k.allowAdditions?n||w.get.itemWithAdditions(t):n||w.get.item(t))&&(w.debug("Setting selected menu item to",n),w.is.multiple()&&w.remove.searchWidth(),w.is.single()?(w.remove.activeItem(),w.remove.selectedItem()):k.useLabels&&w.remove.selectedItem(),n.each(function(){var t=e(this),o=w.get.choiceText(t),r=w.get.choiceValue(t,o),a=t.hasClass(S.filtered),s=t.hasClass(S.active),l=t.hasClass(S.addition),c=i&&1==n.length;i?!s||l?(k.apiSettings&&k.saveRemoteData&&w.save.remoteData(o,r),k.useLabels?(w.add.value(r,o,t),w.add.label(r,o,c),w.set.activeItem(t),w.filterActive(),w.select.nextAvailable(n)):(w.add.value(r,o,t),w.set.text(w.add.variables(T.count)),w.set.activeItem(t))):a||(w.debug("Selected active value, removing label"),w.remove.selected(r)):(k.apiSettings&&k.saveRemoteData&&w.save.remoteData(o,r),w.set.text(o),w.set.value(r,o,t),t.addClass(S.active).addClass(S.selected))}))}},add:{label:function(t,n,i){var o,r=w.is.searchSelection()?M:j,a=w.escape.value(t);if(o=e("<a />").addClass(S.label).attr("data-"+E.value,a).html(F.label(a,n)),o=k.onLabelCreate.call(o,a,n),w.has.label(t))return void w.debug("Label already exists, skipping",a);k.label.variation&&o.addClass(k.label.variation),!0===i?(w.debug("Animating in label",o),o.addClass(S.hidden).insertBefore(r).transition(k.label.transition,k.label.duration)):(w.debug("Adding selection label",o),o.insertBefore(r))},message:function(t){var n=B.children(q.message),i=k.templates.message(w.add.variables(t));n.length>0?n.html(i):n=e("<div/>").html(i).addClass(S.message).appendTo(B)},optionValue:function(t){var n=w.escape.value(t);U.find('option[value="'+w.escape.string(n)+'"]').length>0||(w.disconnect.selectObserver(),w.is.single()&&(w.verbose("Removing previous user addition"),U.find("option."+S.addition).remove()),e("<option/>").prop("value",n).addClass(S.addition).html(t).appendTo(U),w.verbose("Adding user addition as an <option>",t),w.observe.select())},userSuggestion:function(e){var t,n=B.children(q.addition),i=w.get.item(e),o=i&&i.not(q.addition).length,r=n.length>0;if(!k.useLabels||!w.has.maxSelections()){if(""===e||o)return void n.remove();r?(n.data(E.value,e).data(E.text,e).attr("data-"+E.value,e).attr("data-"+E.text,e).removeClass(S.filtered),k.hideAdditions||(t=k.templates.addition(w.add.variables(T.addResult,e)),n.html(t)),w.verbose("Replacing user suggestion with new value",n)):(n=w.create.userChoice(e),n.prependTo(B),w.verbose("Adding item choice to menu corresponding with user choice addition",n)),k.hideAdditions&&!w.is.allFiltered()||n.addClass(S.selected).siblings().removeClass(S.selected),w.refreshItems()}},variables:function(e,t){var n,i,o=-1!==e.search("{count}"),r=-1!==e.search("{maxCount}"),a=-1!==e.search("{term}");return w.verbose("Adding templated variables to message",e),o&&(n=w.get.selectionCount(),e=e.replace("{count}",n)),r&&(n=w.get.selectionCount(),e=e.replace("{maxCount}",k.maxSelections)),a&&(i=t||w.get.query(),e=e.replace("{term}",i)),e},value:function(t,n,i){var o,r=w.get.values();if(""===t)return void w.debug("Cannot select blank values from multiselect");e.isArray(r)?(o=r.concat([t]),o=w.get.uniqueArray(o)):o=[t],w.has.selectInput()?w.can.extendSelect()&&(w.debug("Adding value to select",t,o,U),w.add.optionValue(t)):(o=o.join(k.delimiter),w.debug("Setting hidden input to delimited value",o,U)),!1===k.fireOnInit&&w.is.initialLoad()?w.verbose("Skipping onadd callback on initial load",k.onAdd):k.onAdd.call(J,t,n,i),w.set.value(o,t,n,i),w.check.maxSelections()}},remove:{active:function(){L.removeClass(S.active)},activeLabel:function(){L.find(q.label).removeClass(S.active)},empty:function(){L.removeClass(S.empty)},loading:function(){L.removeClass(S.loading)},initialLoad:function(){v=!1},upward:function(e){(e||L).removeClass(S.upward)},visible:function(){L.removeClass(S.visible)},activeItem:function(){X.removeClass(S.active)},filteredItem:function(){k.useLabels&&w.has.maxSelections()||(k.useLabels&&w.is.multiple()?X.not("."+S.active).removeClass(S.filtered):X.removeClass(S.filtered),w.remove.empty())},optionValue:function(e){var t=w.escape.value(e),n=U.find('option[value="'+w.escape.string(t)+'"]');n.length>0&&n.hasClass(S.addition)&&(y&&(y.disconnect(),w.verbose("Temporarily disconnecting mutation observer")),n.remove(),w.verbose("Removing user addition as an <option>",t),y&&y.observe(U[0],{childList:!0,subtree:!0}))},message:function(){B.children(q.message).remove()},searchWidth:function(){M.css("width","")},searchTerm:function(){w.verbose("Cleared search term"),M.val(""),w.set.filtered()},userAddition:function(){X.filter(q.addition).remove()},selected:function(t,n){if(!(n=k.allowAdditions?n||w.get.itemWithAdditions(t):n||w.get.item(t)))return!1;n.each(function(){var t=e(this),n=w.get.choiceText(t),i=w.get.choiceValue(t,n);w.is.multiple()?k.useLabels?(w.remove.value(i,n,t),w.remove.label(i)):(w.remove.value(i,n,t),0===w.get.selectionCount()?w.set.placeholderText():w.set.text(w.add.variables(T.count))):w.remove.value(i,n,t),t.removeClass(S.filtered).removeClass(S.active),k.useLabels&&t.removeClass(S.selected)})},selectedItem:function(){X.removeClass(S.selected)},value:function(e,t,n){var i,o=w.get.values();w.has.selectInput()?(w.verbose("Input is <select> removing selected option",e),i=w.remove.arrayValue(e,o),w.remove.optionValue(e)):(w.verbose("Removing from delimited values",e),i=w.remove.arrayValue(e,o),i=i.join(k.delimiter)),!1===k.fireOnInit&&w.is.initialLoad()?w.verbose("No callback on initial load",k.onRemove):k.onRemove.call(J,e,t,n),w.set.value(i,t,n),w.check.maxSelections()},arrayValue:function(t,n){return e.isArray(n)||(n=[n]),n=e.grep(n,function(e){return t!=e}),w.verbose("Removed value from delimited string",t,n),n},label:function(e,t){var n=L.find(q.label),i=n.filter("[data-"+E.value+'="'+w.escape.string(e)+'"]');w.verbose("Removing label",i),i.remove()},activeLabels:function(e){e=e||L.find(q.label).filter("."+S.active),w.verbose("Removing active label selections",e),w.remove.labels(e)},labels:function(t){t=t||L.find(q.label),w.verbose("Removing labels",t),t.each(function(){var t=e(this),n=t.data(E.value),i=void 0!==n?String(n):n,o=w.is.userValue(i);if(!1===k.onLabelRemove.call(t,n))return void w.debug("Label remove callback cancelled removal");w.remove.message(),o?(w.remove.value(i),w.remove.label(i)):w.remove.selected(i)})},tabbable:function(){w.is.searchSelection()?(w.debug("Searchable dropdown initialized"),M.removeAttr("tabindex"),B.removeAttr("tabindex")):(w.debug("Simple selection dropdown initialized"),L.removeAttr("tabindex"),B.removeAttr("tabindex"))}},has:{menuSearch:function(){return w.has.search()&&M.closest(B).length>0},search:function(){return M.length>0},sizer:function(){return N.length>0},selectInput:function(){return U.is("select")},minCharacters:function(e){return!k.minCharacters||(e=void 0!==e?String(e):String(w.get.query()),e.length>=k.minCharacters)},firstLetter:function(e,t){var n,i;return!(!e||0===e.length||"string"!=typeof t)&&(n=w.get.choiceText(e,!1),t=t.toLowerCase(),i=String(n).charAt(0).toLowerCase(),t==i)},input:function(){return U.length>0},items:function(){return X.length>0},menu:function(){return B.length>0},message:function(){return 0!==B.children(q.message).length},label:function(e){var t=w.escape.value(e);return L.find(q.label).filter("[data-"+E.value+'="'+w.escape.string(t)+'"]').length>0},maxSelections:function(){return k.maxSelections&&w.get.selectionCount()>=k.maxSelections},allResultsFiltered:function(){var e=X.not(q.addition);return e.filter(q.unselectable).length===e.length},userSuggestion:function(){return B.children(q.addition).length>0},query:function(){return""!==w.get.query()},value:function(t){var n=w.get.values();return!!(e.isArray(n)?n&&-1!==e.inArray(t,n):n==t)}},is:{active:function(){return L.hasClass(S.active)},bubbledLabelClick:function(t){return e(t.target).is("select, input")&&L.closest("label").length>0},bubbledIconClick:function(t){return e(t.target).closest(H).length>0},alreadySetup:function(){return L.is("select")&&L.parent(q.dropdown).length>0&&0===L.prev().length},animating:function(e){return e?e.transition&&e.transition("is animating"):B.transition&&B.transition("is animating")},disabled:function(){return L.hasClass(S.disabled)},focused:function(){return n.activeElement===L[0]},focusedOnSearch:function(){return n.activeElement===M[0]},allFiltered:function(){return(w.is.multiple()||w.has.search())&&!(0==k.hideAdditions&&w.has.userSuggestion())&&!w.has.message()&&w.has.allResultsFiltered()},hidden:function(e){return!w.is.visible(e)},initialLoad:function(){return v},onScreen:function(e){var t,n=e||B,i=!0,o={};return n.addClass(S.loading),t={context:{scrollTop:V.scrollTop(),height:V.outerHeight()},menu:{offset:n.offset(),height:n.outerHeight()}},w.is.verticallyScrollableContext()&&(t.menu.offset.top+=t.context.scrollTop),o={above:t.context.scrollTop<=t.menu.offset.top-t.menu.height,below:t.context.scrollTop+t.context.height>=t.menu.offset.top+t.menu.height},o.below?(w.verbose("Dropdown can fit in context downward",o),i=!0):o.below||o.above?(w.verbose("Dropdown cannot fit below, opening upward",o),i=!1):(w.verbose("Dropdown cannot fit in either direction, favoring downward",o),i=!0),n.removeClass(S.loading),i},inObject:function(t,n){var i=!1;return e.each(n,function(e,n){if(n==t)return i=!0,!0}),i},multiple:function(){return L.hasClass(S.multiple)},remote:function(){return k.apiSettings&&w.can.useAPI()},single:function(){return!w.is.multiple()},selectMutation:function(t){var n=!1;return e.each(t,function(t,i){if(i.target&&e(i.target).is("select"))return n=!0,!0}),n},search:function(){return L.hasClass(S.search)},searchSelection:function(){return w.has.search()&&1===M.parent(q.dropdown).length},selection:function(){return L.hasClass(S.selection)},userValue:function(t){return-1!==e.inArray(t,w.get.userValues())},upward:function(e){return(e||L).hasClass(S.upward)},visible:function(e){return e?e.hasClass(S.visible):B.hasClass(S.visible)},verticallyScrollableContext:function(){var e=V.get(0)!==t&&V.css("overflow-y");return"auto"==e||"scroll"==e}},can:{activate:function(e){return!!k.useLabels||(!w.has.maxSelections()||!(!w.has.maxSelections()||!e.hasClass(S.active)))},click:function(){return l||"click"==k.on},extendSelect:function(){return k.allowAdditions||k.apiSettings},show:function(){return!w.is.disabled()&&(w.has.items()||w.has.message())},useAPI:function(){return void 0!==e.fn.api}},animate:{show:function(t,n){var i,o=n||B,r=n?function(){}:function(){w.hideSubMenus(),w.hideOthers(),w.set.active()};t=e.isFunction(t)?t:function(){},w.verbose("Doing menu show animation",o),w.set.direction(n),i=w.get.transition(n),w.is.selection()&&w.set.scrollPosition(w.get.selectedItem(),!0),(w.is.hidden(o)||w.is.animating(o))&&("none"==i?(r(),o.transition("show"),t.call(J)):void 0!==e.fn.transition&&L.transition("is supported")?o.transition({animation:i+" in",debug:k.debug,verbose:k.verbose,duration:k.duration,queue:!0,onStart:r,onComplete:function(){t.call(J)}}):w.error(D.noTransition,i))},hide:function(t,n){var i=n||B,o=(n?k.duration:k.duration,n?function(){}:function(){w.can.click()&&w.unbind.intent(),w.remove.active()}),r=w.get.transition(n);t=e.isFunction(t)?t:function(){},(w.is.visible(i)||w.is.animating(i))&&(w.verbose("Doing menu hide animation",i),"none"==r?(o(),i.transition("hide"),t.call(J)):void 0!==e.fn.transition&&L.transition("is supported")?i.transition({animation:r+" out",duration:k.duration,debug:k.debug,verbose:k.verbose,queue:!0,onStart:o,onComplete:function(){"auto"==k.direction&&w.remove.upward(n),t.call(J)}}):w.error(D.transition))}},hideAndClear:function(){w.remove.searchTerm(),w.has.maxSelections()||(w.has.search()?w.hide(function(){w.remove.filteredItem()}):w.hide())},delay:{show:function(){w.verbose("Delaying show event to ensure user intent"),clearTimeout(w.timer),w.timer=setTimeout(w.show,k.delay.show)},hide:function(){w.verbose("Delaying hide event to ensure user intent"),clearTimeout(w.timer),w.timer=setTimeout(w.hide,k.delay.hide)}},escape:{value:function(t){var n=e.isArray(t),i="string"==typeof t,o=!i&&!n,r=i&&-1!==t.search(O.quote),a=[];return o||!r?t:(w.debug("Encoding quote values for use in select",t),n?(e.each(t,function(e,t){a.push(t.replace(O.quote,"&quot;"))}),a):t.replace(O.quote,"&quot;"))},string:function(e){return e=String(e),e.replace(O.escape,"\\$&")}},setting:function(t,n){if(w.debug("Changing setting",t,n),e.isPlainObject(t))e.extend(!0,k,t);else{if(void 0===n)return k[t];e.isPlainObject(k[t])?e.extend(!0,k[t],n):k[t]=n}},internal:function(t,n){if(e.isPlainObject(t))e.extend(!0,w,t);else{if(void 0===n)return w[t];w[t]=n}},debug:function(){!k.silent&&k.debug&&(k.performance?w.performance.log(arguments):(w.debug=Function.prototype.bind.call(console.info,console,k.name+":"),w.debug.apply(console,arguments)))},verbose:function(){!k.silent&&k.verbose&&k.debug&&(k.performance?w.performance.log(arguments):(w.verbose=Function.prototype.bind.call(console.info,console,k.name+":"),w.verbose.apply(console,arguments)))},error:function(){k.silent||(w.error=Function.prototype.bind.call(console.error,console,k.name+":"),w.error.apply(console,arguments))},performance:{log:function(e){var t,n,i;k.performance&&(t=(new Date).getTime(),i=c||t,n=t-i,c=t,d.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:J,"Execution Time":n})),clearTimeout(w.performance.timer),w.performance.timer=setTimeout(w.performance.display,500)},display:function(){var t=k.name+":",n=0;c=!1,clearTimeout(w.performance.timer),e.each(d,function(e,t){n+=t["Execution Time"]}),t+=" "+n+"ms",s&&(t+=" '"+s+"'"),(void 0!==console.group||void 0!==console.table)&&d.length>0&&(console.groupCollapsed(t),console.table?console.table(d):e.each(d,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),d=[]}},invoke:function(t,n,i){var r,a,s,l=K;return n=n||m,i=J||i,"string"==typeof t&&void 0!==l&&(t=t.split(/[\. ]/),r=t.length-1,e.each(t,function(n,i){var o=n!=r?i+t[n+1].charAt(0).toUpperCase()+t[n+1].slice(1):t;if(e.isPlainObject(l[o])&&n!=r)l=l[o];else{if(void 0!==l[o])return a=l[o],!1;if(!e.isPlainObject(l[i])||n==r)return void 0!==l[i]?(a=l[i],!1):(w.error(D.method,t),!1);l=l[i]}})),e.isFunction(a)?s=a.apply(i,n):void 0!==a&&(s=a),e.isArray(o)?o.push(s):void 0!==o?o=[o,s]:void 0!==s&&(o=s),a}},f?(void 0===K&&w.initialize(),w.invoke(u)):(void 0!==K&&K.invoke("destroy"),w.initialize())}),void 0!==o?o:r},e.fn.dropdown.settings={silent:!1,debug:!1,verbose:!1,performance:!0,on:"click",action:"activate",apiSettings:!1,selectOnKeydown:!0,minCharacters:0,filterRemoteData:!1,saveRemoteData:!0,throttle:200,context:t,direction:"auto",keepOnScreen:!0,match:"both",fullTextSearch:!1,placeholder:"auto",preserveHTML:!0,sortSelect:!1,forceSelection:!0,allowAdditions:!1,hideAdditions:!0,maxSelections:!1,useLabels:!0,delimiter:",",showOnFocus:!0,allowReselection:!1,allowTab:!0,allowCategorySelection:!1,fireOnInit:!1,transition:"auto",duration:200,glyphWidth:1.037,label:{transition:"scale",duration:200,variation:!1},delay:{hide:300,show:200,search:20,touch:50},onChange:function(e,t,n){},onAdd:function(e,t,n){},onRemove:function(e,t,n){},onLabelSelect:function(e){},onLabelCreate:function(t,n){return e(this)},onLabelRemove:function(e){return!0},onNoResults:function(e){return!0},onShow:function(){},onHide:function(){},name:"Dropdown",namespace:"dropdown",message:{addResult:"Add <b>{term}</b>",count:"{count} selected",maxSelections:"Max {maxCount} selections",noResults:"No results found.",serverError:"There was an error contacting the server"},error:{action:"You called a dropdown action that was not defined",alreadySetup:"Once a select has been initialized behaviors must be called on the created ui dropdown",labels:"Allowing user additions currently requires the use of labels.",missingMultiple:"<select> requires multiple property to be set to correctly preserve multiple values",method:"The method you called is not defined.",noAPI:"The API module is required to load resources remotely",noStorage:"Saving remote data requires session storage",noTransition:"This module requires ui transitions <https://github.com/Semantic-Org/UI-Transition>"},regExp:{escape:/[-[\]{}()*+?.,\\^$|#\s]/g,quote:/"/g},metadata:{defaultText:"defaultText",defaultValue:"defaultValue",placeholderText:"placeholder",text:"text",value:"value"},fields:{remoteValues:"results",values:"values",disabled:"disabled",name:"name",value:"value",text:"text"},keys:{backspace:8,delimiter:188,deleteKey:46,enter:13,escape:27,pageUp:33,pageDown:34,leftArrow:37,upArrow:38,rightArrow:39,downArrow:40},selector:{addition:".addition",dropdown:".ui.dropdown",hidden:".hidden",icon:"> .dropdown.icon",input:'> input[type="hidden"], > select',item:".item",label:"> .label",remove:"> .label > .delete.icon",siblingLabel:".label",menu:".menu",message:".message",menuIcon:".dropdown.icon",search:"input.search, .menu > .search > input, .menu input.search",sizer:"> input.sizer",text:"> .text:not(.icon)",unselectable:".disabled, .filtered"},className:{active:"active",addition:"addition",animating:"animating",disabled:"disabled",empty:"empty",dropdown:"ui dropdown",filtered:"filtered",hidden:"hidden transition",item:"item",label:"ui label",loading:"loading",menu:"menu",message:"message",multiple:"multiple",placeholder:"default",sizer:"sizer",search:"search",selected:"selected",selection:"selection",upward:"upward",visible:"visible"}},e.fn.dropdown.settings.templates={dropdown:function(t){var n=t.placeholder||!1,i=(t.values,"");return i+='<i class="dropdown icon"></i>',t.placeholder?i+='<div class="default text">'+n+"</div>":i+='<div class="text"></div>',i+='<div class="menu">',e.each(t.values,function(e,t){i+=t.disabled?'<div class="disabled item" data-value="'+t.value+'">'+t.name+"</div>":'<div class="item" data-value="'+t.value+'">'+t.name+"</div>"}),i+="</div>"},menu:function(t,n){var i=t[n.values]||{},o="";return e.each(i,function(e,t){var i=t[n.text]?'data-text="'+t[n.text]+'"':"",r=t[n.disabled]?"disabled ":"";o+='<div class="'+r+'item" data-value="'+t[n.value]+'"'+i+">",o+=t[n.name],o+="</div>"}),o},label:function(e,t){return t+'<i class="delete icon"></i>'},message:function(e){return e},addition:function(e){return e}}}(jQuery,window,document),function(e,t,n,i){"use strict";t=void 0!==t&&t.Math==Math?t:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),e.fn.embed=function(n){var i,o=e(this),r=o.selector||"",a=(new Date).getTime(),s=[],l=arguments[0],c="string"==typeof l,d=[].slice.call(arguments,1);return o.each(function(){var u,f=e.isPlainObject(n)?e.extend(!0,{},e.fn.embed.settings,n):e.extend({},e.fn.embed.settings),m=f.selector,g=f.className,v=f.sources,h=f.error,p=f.metadata,b=f.namespace,x=f.templates,y="."+b,C="module-"+b,w=(e(t),e(this)),k=w.find(m.placeholder),S=w.find(m.icon),T=w.find(m.embed),A=this,R=w.data(C);u={initialize:function(){u.debug("Initializing embed"),u.determine.autoplay(),u.create(),u.bind.events(),u.instantiate()},instantiate:function(){u.verbose("Storing instance of module",u),R=u,w.data(C,u)},destroy:function(){u.verbose("Destroying previous instance of embed"),u.reset(),w.removeData(C).off(y)},refresh:function(){u.verbose("Refreshing selector cache"),k=w.find(m.placeholder),S=w.find(m.icon),T=w.find(m.embed)},bind:{events:function(){u.has.placeholder()&&(u.debug("Adding placeholder events"),w.on("click"+y,m.placeholder,u.createAndShow).on("click"+y,m.icon,u.createAndShow))}},create:function(){u.get.placeholder()?u.createPlaceholder():u.createAndShow()},createPlaceholder:function(e){var t=u.get.icon(),n=u.get.url();u.generate.embed(n);e=e||u.get.placeholder(),w.html(x.placeholder(e,t)),u.debug("Creating placeholder for embed",e,t)},createEmbed:function(t){u.refresh(),t=t||u.get.url(),T=e("<div/>").addClass(g.embed).html(u.generate.embed(t)).appendTo(w),f.onCreate.call(A,t),u.debug("Creating embed object",T)},changeEmbed:function(e){T.html(u.generate.embed(e))},createAndShow:function(){u.createEmbed(),u.show()},change:function(e,t,n){u.debug("Changing video to ",e,t,n),w.data(p.source,e).data(p.id,t),n?w.data(p.url,n):w.removeData(p.url),u.has.embed()?u.changeEmbed():u.create()},reset:function(){u.debug("Clearing embed and showing placeholder"),u.remove.active(),u.remove.embed(),u.showPlaceholder(),f.onReset.call(A)},show:function(){u.debug("Showing embed"),u.set.active(),f.onDisplay.call(A)},hide:function(){u.debug("Hiding embed"),u.showPlaceholder()},showPlaceholder:function(){u.debug("Showing placeholder image"),u.remove.active(),f.onPlaceholderDisplay.call(A)},get:{id:function(){return f.id||w.data(p.id)},placeholder:function(){return f.placeholder||w.data(p.placeholder)},icon:function(){return f.icon?f.icon:void 0!==w.data(p.icon)?w.data(p.icon):u.determine.icon()},source:function(e){return f.source?f.source:void 0!==w.data(p.source)?w.data(p.source):u.determine.source()},type:function(){var e=u.get.source();return void 0!==v[e]&&v[e].type},url:function(){return f.url?f.url:void 0!==w.data(p.url)?w.data(p.url):u.determine.url()}},determine:{autoplay:function(){u.should.autoplay()&&(f.autoplay=!0)},source:function(t){var n=!1;return t=t||u.get.url(),t&&e.each(v,function(e,i){if(-1!==t.search(i.domain))return n=e,!1}),n},icon:function(){var e=u.get.source();return void 0!==v[e]&&v[e].icon},url:function(){var e,t=f.id||w.data(p.id),n=f.source||w.data(p.source);return e=void 0!==v[n]&&v[n].url.replace("{id}",t),e&&w.data(p.url,e),e}},set:{active:function(){w.addClass(g.active)}},remove:{active:function(){w.removeClass(g.active)},embed:function(){T.empty()}},encode:{parameters:function(e){var t,n=[];for(t in e)n.push(encodeURIComponent(t)+"="+encodeURIComponent(e[t]));return n.join("&amp;")}},generate:{embed:function(e){u.debug("Generating embed html");var t,n,i=u.get.source();return e=u.get.url(e),e?(n=u.generate.parameters(i),t=x.iframe(e,n)):u.error(h.noURL,w),t},parameters:function(t,n){var i=v[t]&&void 0!==v[t].parameters?v[t].parameters(f):{};return n=n||f.parameters,n&&(i=e.extend({},i,n)),i=f.onEmbed(i),u.encode.parameters(i)}},has:{embed:function(){return T.length>0},placeholder:function(){return f.placeholder||w.data(p.placeholder)}},should:{autoplay:function(){return"auto"===f.autoplay?f.placeholder||void 0!==w.data(p.placeholder):f.autoplay}},is:{video:function(){return"video"==u.get.type()}},setting:function(t,n){if(u.debug("Changing setting",t,n),e.isPlainObject(t))e.extend(!0,f,t);else{if(void 0===n)return f[t];e.isPlainObject(f[t])?e.extend(!0,f[t],n):f[t]=n}},internal:function(t,n){if(e.isPlainObject(t))e.extend(!0,u,t);else{if(void 0===n)return u[t];u[t]=n}},debug:function(){!f.silent&&f.debug&&(f.performance?u.performance.log(arguments):(u.debug=Function.prototype.bind.call(console.info,console,f.name+":"),u.debug.apply(console,arguments)))},verbose:function(){!f.silent&&f.verbose&&f.debug&&(f.performance?u.performance.log(arguments):(u.verbose=Function.prototype.bind.call(console.info,console,f.name+":"),u.verbose.apply(console,arguments)))},error:function(){f.silent||(u.error=Function.prototype.bind.call(console.error,console,f.name+":"),u.error.apply(console,arguments))},performance:{log:function(e){var t,n,i;f.performance&&(t=(new Date).getTime(),i=a||t,n=t-i,a=t,s.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:A,"Execution Time":n})),clearTimeout(u.performance.timer),u.performance.timer=setTimeout(u.performance.display,500)},display:function(){var t=f.name+":",n=0;a=!1,clearTimeout(u.performance.timer),e.each(s,function(e,t){n+=t["Execution Time"]}),t+=" "+n+"ms",r&&(t+=" '"+r+"'"),o.length>1&&(t+=" ("+o.length+")"),(void 0!==console.group||void 0!==console.table)&&s.length>0&&(console.groupCollapsed(t),console.table?console.table(s):e.each(s,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),s=[]}},invoke:function(t,n,o){var r,a,s,l=R;return n=n||d,o=A||o,"string"==typeof t&&void 0!==l&&(t=t.split(/[\. ]/),r=t.length-1,e.each(t,function(n,i){var o=n!=r?i+t[n+1].charAt(0).toUpperCase()+t[n+1].slice(1):t;if(e.isPlainObject(l[o])&&n!=r)l=l[o];else{if(void 0!==l[o])return a=l[o],!1;if(!e.isPlainObject(l[i])||n==r)return void 0!==l[i]?(a=l[i],!1):(u.error(h.method,t),!1);l=l[i]}})),e.isFunction(a)?s=a.apply(o,n):void 0!==a&&(s=a),e.isArray(i)?i.push(s):void 0!==i?i=[i,s]:void 0!==s&&(i=s),a}},c?(void 0===R&&u.initialize(),u.invoke(l)):(void 0!==R&&R.invoke("destroy"),u.initialize())}),void 0!==i?i:this},e.fn.embed.settings={name:"Embed",namespace:"embed",silent:!1,debug:!1,verbose:!1,performance:!0,icon:!1,source:!1,url:!1,id:!1,autoplay:"auto",color:"#444444",hd:!0,brandedUI:!1,parameters:!1,onDisplay:function(){},onPlaceholderDisplay:function(){},onReset:function(){},onCreate:function(e){},onEmbed:function(e){return e},metadata:{id:"id",icon:"icon",placeholder:"placeholder",source:"source",url:"url"},error:{noURL:"No URL specified",method:"The method you called is not defined"},className:{active:"active",embed:"embed"},selector:{embed:".embed",placeholder:".placeholder",icon:".icon"},sources:{youtube:{name:"youtube",type:"video",icon:"video play",domain:"youtube.com",url:"//www.youtube.com/embed/{id}",parameters:function(e){return{autohide:!e.brandedUI,autoplay:e.autoplay,color:e.color||void 0,hq:e.hd,jsapi:e.api,modestbranding:!e.brandedUI}}},vimeo:{name:"vimeo",type:"video",icon:"video play",domain:"vimeo.com",url:"//player.vimeo.com/video/{id}",parameters:function(e){return{api:e.api,autoplay:e.autoplay,byline:e.brandedUI,color:e.color||void 0,portrait:e.brandedUI,title:e.brandedUI}}}},templates:{iframe:function(e,t){var n=e;return t&&(n+="?"+t),'<iframe src="'+n+'" width="100%" height="100%" frameborder="0" scrolling="no" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>'},placeholder:function(e,t){var n="";return t&&(n+='<i class="'+t+' icon"></i>'),e&&(n+='<img class="placeholder" src="'+e+'">'),n}},api:!1,onPause:function(){},onPlay:function(){},onStop:function(){}}}(jQuery,window,document),function(e,t,n,i){"use strict";t=void 0!==t&&t.Math==Math?t:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),e.fn.shape=function(i){var o,r=e(this),a=(e("body"),(new Date).getTime()),s=[],l=arguments[0],c="string"==typeof l,d=[].slice.call(arguments,1),u=t.requestAnimationFrame||t.mozRequestAnimationFrame||t.webkitRequestAnimationFrame||t.msRequestAnimationFrame||function(e){setTimeout(e,0)};return r.each(function(){var t,f,m,g=r.selector||"",v=e.isPlainObject(i)?e.extend(!0,{},e.fn.shape.settings,i):e.extend({},e.fn.shape.settings),h=v.namespace,p=v.selector,b=v.error,x=v.className,y="."+h,C="module-"+h,w=e(this),k=w.find(p.sides),S=w.find(p.side),T=!1,A=this,R=w.data(C);m={initialize:function(){m.verbose("Initializing module for",A),m.set.defaultSide(),m.instantiate()},instantiate:function(){m.verbose("Storing instance of module",m),R=m,w.data(C,R)},destroy:function(){m.verbose("Destroying previous module for",A),w.removeData(C).off(y)},refresh:function(){m.verbose("Refreshing selector cache for",A),w=e(A),k=e(this).find(p.shape),S=e(this).find(p.side)},repaint:function(){m.verbose("Forcing repaint event");var e=k[0]||n.createElement("div");e.offsetWidth},animate:function(e,n){m.verbose("Animating box with properties",e),n=n||function(e){m.verbose("Executing animation callback"),void 0!==e&&e.stopPropagation(),m.reset(),m.set.active()},v.beforeChange.call(f[0]),m.get.transitionEvent()?(m.verbose("Starting CSS animation"),w.addClass(x.animating),k.css(e).one(m.get.transitionEvent(),n),m.set.duration(v.duration),u(function(){w.addClass(x.animating),t.addClass(x.hidden)})):n()},queue:function(e){m.debug("Queueing animation of",e),
14 k.one(m.get.transitionEvent(),function(){m.debug("Executing queued animation"),setTimeout(function(){w.shape(e)},0)})},reset:function(){m.verbose("Animating states reset"),w.removeClass(x.animating).attr("style","").removeAttr("style"),k.attr("style","").removeAttr("style"),S.attr("style","").removeAttr("style").removeClass(x.hidden),f.removeClass(x.animating).attr("style","").removeAttr("style")},is:{complete:function(){return S.filter("."+x.active)[0]==f[0]},animating:function(){return w.hasClass(x.animating)}},set:{defaultSide:function(){t=w.find("."+v.className.active),f=t.next(p.side).length>0?t.next(p.side):w.find(p.side).first(),T=!1,m.verbose("Active side set to",t),m.verbose("Next side set to",f)},duration:function(e){e=e||v.duration,e="number"==typeof e?e+"ms":e,m.verbose("Setting animation duration",e),(v.duration||0===v.duration)&&k.add(S).css({"-webkit-transition-duration":e,"-moz-transition-duration":e,"-ms-transition-duration":e,"-o-transition-duration":e,"transition-duration":e})},currentStageSize:function(){var e=w.find("."+v.className.active),t=e.outerWidth(!0),n=e.outerHeight(!0);w.css({width:t,height:n})},stageSize:function(){var e=w.clone().addClass(x.loading),t=e.find("."+v.className.active),n=T?e.find(p.side).eq(T):t.next(p.side).length>0?t.next(p.side):e.find(p.side).first(),i="next"==v.width?n.outerWidth(!0):"initial"==v.width?w.width():v.width,o="next"==v.height?n.outerHeight(!0):"initial"==v.height?w.height():v.height;t.removeClass(x.active),n.addClass(x.active),e.insertAfter(w),e.remove(),"auto"!=v.width&&(w.css("width",i+v.jitter),m.verbose("Specifying width during animation",i)),"auto"!=v.height&&(w.css("height",o+v.jitter),m.verbose("Specifying height during animation",o))},nextSide:function(e){T=e,f=S.filter(e),T=S.index(f),0===f.length&&(m.set.defaultSide(),m.error(b.side)),m.verbose("Next side manually set to",f)},active:function(){m.verbose("Setting new side to active",f),S.removeClass(x.active),f.addClass(x.active),v.onChange.call(f[0]),m.set.defaultSide()}},flip:{up:function(){if(m.is.complete()&&!m.is.animating()&&!v.allowRepeats)return void m.debug("Side already visible",f);if(m.is.animating())m.queue("flip up");else{m.debug("Flipping up",f);var e=m.get.transform.up();m.set.stageSize(),m.stage.above(),m.animate(e)}},down:function(){if(m.is.complete()&&!m.is.animating()&&!v.allowRepeats)return void m.debug("Side already visible",f);if(m.is.animating())m.queue("flip down");else{m.debug("Flipping down",f);var e=m.get.transform.down();m.set.stageSize(),m.stage.below(),m.animate(e)}},left:function(){if(m.is.complete()&&!m.is.animating()&&!v.allowRepeats)return void m.debug("Side already visible",f);if(m.is.animating())m.queue("flip left");else{m.debug("Flipping left",f);var e=m.get.transform.left();m.set.stageSize(),m.stage.left(),m.animate(e)}},right:function(){if(m.is.complete()&&!m.is.animating()&&!v.allowRepeats)return void m.debug("Side already visible",f);if(m.is.animating())m.queue("flip right");else{m.debug("Flipping right",f);var e=m.get.transform.right();m.set.stageSize(),m.stage.right(),m.animate(e)}},over:function(){if(m.is.complete()&&!m.is.animating()&&!v.allowRepeats)return void m.debug("Side already visible",f);m.is.animating()?m.queue("flip over"):(m.debug("Flipping over",f),m.set.stageSize(),m.stage.behind(),m.animate(m.get.transform.over()))},back:function(){if(m.is.complete()&&!m.is.animating()&&!v.allowRepeats)return void m.debug("Side already visible",f);m.is.animating()?m.queue("flip back"):(m.debug("Flipping back",f),m.set.stageSize(),m.stage.behind(),m.animate(m.get.transform.back()))}},get:{transform:{up:function(){var e={y:-(t.outerHeight(!0)-f.outerHeight(!0))/2,z:-t.outerHeight(!0)/2};return{transform:"translateY("+e.y+"px) translateZ("+e.z+"px) rotateX(-90deg)"}},down:function(){var e={y:-(t.outerHeight(!0)-f.outerHeight(!0))/2,z:-t.outerHeight(!0)/2};return{transform:"translateY("+e.y+"px) translateZ("+e.z+"px) rotateX(90deg)"}},left:function(){var e={x:-(t.outerWidth(!0)-f.outerWidth(!0))/2,z:-t.outerWidth(!0)/2};return{transform:"translateX("+e.x+"px) translateZ("+e.z+"px) rotateY(90deg)"}},right:function(){var e={x:-(t.outerWidth(!0)-f.outerWidth(!0))/2,z:-t.outerWidth(!0)/2};return{transform:"translateX("+e.x+"px) translateZ("+e.z+"px) rotateY(-90deg)"}},over:function(){return{transform:"translateX("+{x:-(t.outerWidth(!0)-f.outerWidth(!0))/2}.x+"px) rotateY(180deg)"}},back:function(){return{transform:"translateX("+{x:-(t.outerWidth(!0)-f.outerWidth(!0))/2}.x+"px) rotateY(-180deg)"}}},transitionEvent:function(){var e,t=n.createElement("element"),i={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(e in i)if(void 0!==t.style[e])return i[e]},nextSide:function(){return t.next(p.side).length>0?t.next(p.side):w.find(p.side).first()}},stage:{above:function(){var e={origin:(t.outerHeight(!0)-f.outerHeight(!0))/2,depth:{active:f.outerHeight(!0)/2,next:t.outerHeight(!0)/2}};m.verbose("Setting the initial animation position as above",f,e),k.css({transform:"translateZ(-"+e.depth.active+"px)"}),t.css({transform:"rotateY(0deg) translateZ("+e.depth.active+"px)"}),f.addClass(x.animating).css({top:e.origin+"px",transform:"rotateX(90deg) translateZ("+e.depth.next+"px)"})},below:function(){var e={origin:(t.outerHeight(!0)-f.outerHeight(!0))/2,depth:{active:f.outerHeight(!0)/2,next:t.outerHeight(!0)/2}};m.verbose("Setting the initial animation position as below",f,e),k.css({transform:"translateZ(-"+e.depth.active+"px)"}),t.css({transform:"rotateY(0deg) translateZ("+e.depth.active+"px)"}),f.addClass(x.animating).css({top:e.origin+"px",transform:"rotateX(-90deg) translateZ("+e.depth.next+"px)"})},left:function(){var e={active:t.outerWidth(!0),next:f.outerWidth(!0)},n={origin:(e.active-e.next)/2,depth:{active:e.next/2,next:e.active/2}};m.verbose("Setting the initial animation position as left",f,n),k.css({transform:"translateZ(-"+n.depth.active+"px)"}),t.css({transform:"rotateY(0deg) translateZ("+n.depth.active+"px)"}),f.addClass(x.animating).css({left:n.origin+"px",transform:"rotateY(-90deg) translateZ("+n.depth.next+"px)"})},right:function(){var e={active:t.outerWidth(!0),next:f.outerWidth(!0)},n={origin:(e.active-e.next)/2,depth:{active:e.next/2,next:e.active/2}};m.verbose("Setting the initial animation position as left",f,n),k.css({transform:"translateZ(-"+n.depth.active+"px)"}),t.css({transform:"rotateY(0deg) translateZ("+n.depth.active+"px)"}),f.addClass(x.animating).css({left:n.origin+"px",transform:"rotateY(90deg) translateZ("+n.depth.next+"px)"})},behind:function(){var e={active:t.outerWidth(!0),next:f.outerWidth(!0)},n={origin:(e.active-e.next)/2,depth:{active:e.next/2,next:e.active/2}};m.verbose("Setting the initial animation position as behind",f,n),t.css({transform:"rotateY(0deg)"}),f.addClass(x.animating).css({left:n.origin+"px",transform:"rotateY(-180deg)"})}},setting:function(t,n){if(m.debug("Changing setting",t,n),e.isPlainObject(t))e.extend(!0,v,t);else{if(void 0===n)return v[t];e.isPlainObject(v[t])?e.extend(!0,v[t],n):v[t]=n}},internal:function(t,n){if(e.isPlainObject(t))e.extend(!0,m,t);else{if(void 0===n)return m[t];m[t]=n}},debug:function(){!v.silent&&v.debug&&(v.performance?m.performance.log(arguments):(m.debug=Function.prototype.bind.call(console.info,console,v.name+":"),m.debug.apply(console,arguments)))},verbose:function(){!v.silent&&v.verbose&&v.debug&&(v.performance?m.performance.log(arguments):(m.verbose=Function.prototype.bind.call(console.info,console,v.name+":"),m.verbose.apply(console,arguments)))},error:function(){v.silent||(m.error=Function.prototype.bind.call(console.error,console,v.name+":"),m.error.apply(console,arguments))},performance:{log:function(e){var t,n,i;v.performance&&(t=(new Date).getTime(),i=a||t,n=t-i,a=t,s.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:A,"Execution Time":n})),clearTimeout(m.performance.timer),m.performance.timer=setTimeout(m.performance.display,500)},display:function(){var t=v.name+":",n=0;a=!1,clearTimeout(m.performance.timer),e.each(s,function(e,t){n+=t["Execution Time"]}),t+=" "+n+"ms",g&&(t+=" '"+g+"'"),r.length>1&&(t+=" ("+r.length+")"),(void 0!==console.group||void 0!==console.table)&&s.length>0&&(console.groupCollapsed(t),console.table?console.table(s):e.each(s,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),s=[]}},invoke:function(t,n,i){var r,a,s,l=R;return n=n||d,i=A||i,"string"==typeof t&&void 0!==l&&(t=t.split(/[\. ]/),r=t.length-1,e.each(t,function(n,i){var o=n!=r?i+t[n+1].charAt(0).toUpperCase()+t[n+1].slice(1):t;if(e.isPlainObject(l[o])&&n!=r)l=l[o];else{if(void 0!==l[o])return a=l[o],!1;if(!e.isPlainObject(l[i])||n==r)return void 0!==l[i]&&(a=l[i],!1);l=l[i]}})),e.isFunction(a)?s=a.apply(i,n):void 0!==a&&(s=a),e.isArray(o)?o.push(s):void 0!==o?o=[o,s]:void 0!==s&&(o=s),a}},c?(void 0===R&&m.initialize(),m.invoke(l)):(void 0!==R&&R.invoke("destroy"),m.initialize())}),void 0!==o?o:this},e.fn.shape.settings={name:"Shape",silent:!1,debug:!1,verbose:!1,jitter:0,performance:!0,namespace:"shape",width:"initial",height:"initial",beforeChange:function(){},onChange:function(){},allowRepeats:!1,duration:!1,error:{side:"You tried to switch to a side that does not exist.",method:"The method you called is not defined"},className:{animating:"animating",hidden:"hidden",loading:"loading",active:"active"},selector:{sides:".sides",side:".side"}}}(jQuery,window,document),function(e,t,n,i){"use strict";t=void 0!==t&&t.Math==Math?t:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),e.fn.sticky=function(i){var o,r=e(this),a=r.selector||"",s=(new Date).getTime(),l=[],c=arguments[0],d="string"==typeof c,u=[].slice.call(arguments,1);return r.each(function(){var r,f,m,g,v,h=e.isPlainObject(i)?e.extend(!0,{},e.fn.sticky.settings,i):e.extend({},e.fn.sticky.settings),p=h.className,b=h.namespace,x=h.error,y="."+b,C="module-"+b,w=e(this),k=e(t),S=e(h.scrollContext),T=(w.selector,w.data(C)),A=t.requestAnimationFrame||t.mozRequestAnimationFrame||t.webkitRequestAnimationFrame||t.msRequestAnimationFrame||function(e){setTimeout(e,0)},R=this;v={initialize:function(){v.determineContainer(),v.determineContext(),v.verbose("Initializing sticky",h,r),v.save.positions(),v.checkErrors(),v.bind.events(),h.observeChanges&&v.observeChanges(),v.instantiate()},instantiate:function(){v.verbose("Storing instance of module",v),T=v,w.data(C,v)},destroy:function(){v.verbose("Destroying previous instance"),v.reset(),m&&m.disconnect(),g&&g.disconnect(),k.off("load"+y,v.event.load).off("resize"+y,v.event.resize),S.off("scrollchange"+y,v.event.scrollchange),w.removeData(C)},observeChanges:function(){"MutationObserver"in t&&(m=new MutationObserver(v.event.documentChanged),g=new MutationObserver(v.event.changed),m.observe(n,{childList:!0,subtree:!0}),g.observe(R,{childList:!0,subtree:!0}),g.observe(f[0],{childList:!0,subtree:!0}),v.debug("Setting up mutation observer",g))},determineContainer:function(){r=h.container?e(h.container):w.offsetParent()},determineContext:function(){if(f=h.context?e(h.context):r,0===f.length)return void v.error(x.invalidContext,h.context,w)},checkErrors:function(){if(v.is.hidden()&&v.error(x.visible,w),v.cache.element.height>v.cache.context.height)return v.reset(),void v.error(x.elementSize,w)},bind:{events:function(){k.on("load"+y,v.event.load).on("resize"+y,v.event.resize),S.off("scroll"+y).on("scroll"+y,v.event.scroll).on("scrollchange"+y,v.event.scrollchange)}},event:{changed:function(e){clearTimeout(v.timer),v.timer=setTimeout(function(){v.verbose("DOM tree modified, updating sticky menu",e),v.refresh()},100)},documentChanged:function(t){[].forEach.call(t,function(t){t.removedNodes&&[].forEach.call(t.removedNodes,function(t){(t==R||e(t).find(R).length>0)&&(v.debug("Element removed from DOM, tearing down events"),v.destroy())})})},load:function(){v.verbose("Page contents finished loading"),A(v.refresh)},resize:function(){v.verbose("Window resized"),A(v.refresh)},scroll:function(){A(function(){S.triggerHandler("scrollchange"+y,S.scrollTop())})},scrollchange:function(e,t){v.stick(t),h.onScroll.call(R)}},refresh:function(e){v.reset(),h.context||v.determineContext(),e&&v.determineContainer(),v.save.positions(),v.stick(),h.onReposition.call(R)},supports:{sticky:function(){var t=e("<div/>");t[0];return t.addClass(p.supported),t.css("position").match("sticky")}},save:{lastScroll:function(e){v.lastScroll=e},elementScroll:function(e){v.elementScroll=e},positions:function(){var e={height:S.height()},t={margin:{top:parseInt(w.css("margin-top"),10),bottom:parseInt(w.css("margin-bottom"),10)},offset:w.offset(),width:w.outerWidth(),height:w.outerHeight()},n={offset:f.offset(),height:f.outerHeight()};r.outerHeight();v.is.standardScroll()||(v.debug("Non-standard scroll. Removing scroll offset from element offset"),e.top=S.scrollTop(),e.left=S.scrollLeft(),t.offset.top+=e.top,n.offset.top+=e.top,t.offset.left+=e.left,n.offset.left+=e.left),v.cache={fits:t.height<e.height,scrollContext:{height:e.height},element:{margin:t.margin,top:t.offset.top-t.margin.top,left:t.offset.left,width:t.width,height:t.height,bottom:t.offset.top+t.height},context:{top:n.offset.top,height:n.height,bottom:n.offset.top+n.height}},v.set.containerSize(),v.set.size(),v.stick(),v.debug("Caching element positions",v.cache)}},get:{direction:function(e){var t="down";return e=e||S.scrollTop(),void 0!==v.lastScroll&&(v.lastScroll<e?t="down":v.lastScroll>e&&(t="up")),t},scrollChange:function(e){return e=e||S.scrollTop(),v.lastScroll?e-v.lastScroll:0},currentElementScroll:function(){return v.elementScroll?v.elementScroll:v.is.top()?Math.abs(parseInt(w.css("top"),10))||0:Math.abs(parseInt(w.css("bottom"),10))||0},elementScroll:function(e){e=e||S.scrollTop();var t=v.cache.element,n=v.cache.scrollContext,i=v.get.scrollChange(e),o=t.height-n.height+h.offset,r=v.get.currentElementScroll(),a=r+i;return r=v.cache.fits||a<0?0:a>o?o:a}},remove:{lastScroll:function(){delete v.lastScroll},elementScroll:function(e){delete v.elementScroll},offset:function(){w.css("margin-top","")}},set:{offset:function(){v.verbose("Setting offset on element",h.offset),w.css("margin-top",h.offset)},containerSize:function(){var e=r.get(0).tagName;"HTML"===e||"body"==e?v.determineContainer():Math.abs(r.outerHeight()-v.cache.context.height)>h.jitter&&(v.debug("Context has padding, specifying exact height for container",v.cache.context.height),r.css({height:v.cache.context.height}))},minimumSize:function(){var e=v.cache.element;r.css("min-height",e.height)},scroll:function(e){v.debug("Setting scroll on element",e),v.elementScroll!=e&&(v.is.top()&&w.css("bottom","").css("top",-e),v.is.bottom()&&w.css("top","").css("bottom",e))},size:function(){0!==v.cache.element.height&&0!==v.cache.element.width&&(R.style.setProperty("width",v.cache.element.width+"px","important"),R.style.setProperty("height",v.cache.element.height+"px","important"))}},is:{standardScroll:function(){return S[0]==t},top:function(){return w.hasClass(p.top)},bottom:function(){return w.hasClass(p.bottom)},initialPosition:function(){return!v.is.fixed()&&!v.is.bound()},hidden:function(){return!w.is(":visible")},bound:function(){return w.hasClass(p.bound)},fixed:function(){return w.hasClass(p.fixed)}},stick:function(e){var t=e||S.scrollTop(),n=v.cache,i=n.fits,o=n.element,r=n.scrollContext,a=n.context,s=v.is.bottom()&&h.pushing?h.bottomOffset:h.offset,e={top:t+s,bottom:t+s+r.height},l=(v.get.direction(e.top),i?0:v.get.elementScroll(e.top)),c=!i;0!==o.height&&(v.is.initialPosition()?e.top>=a.bottom?(v.debug("Initial element position is bottom of container"),v.bindBottom()):e.top>o.top&&(o.height+e.top-l>=a.bottom?(v.debug("Initial element position is bottom of container"),v.bindBottom()):(v.debug("Initial element position is fixed"),v.fixTop())):v.is.fixed()?v.is.top()?e.top<=o.top?(v.debug("Fixed element reached top of container"),v.setInitialPosition()):o.height+e.top-l>=a.bottom?(v.debug("Fixed element reached bottom of container"),v.bindBottom()):c&&(v.set.scroll(l),v.save.lastScroll(e.top),v.save.elementScroll(l)):v.is.bottom()&&(e.bottom-o.height<=o.top?(v.debug("Bottom fixed rail has reached top of container"),v.setInitialPosition()):e.bottom>=a.bottom?(v.debug("Bottom fixed rail has reached bottom of container"),v.bindBottom()):c&&(v.set.scroll(l),v.save.lastScroll(e.top),v.save.elementScroll(l))):v.is.bottom()&&(e.top<=o.top?(v.debug("Jumped from bottom fixed to top fixed, most likely used home/end button"),v.setInitialPosition()):h.pushing?v.is.bound()&&e.bottom<=a.bottom&&(v.debug("Fixing bottom attached element to bottom of browser."),v.fixBottom()):v.is.bound()&&e.top<=a.bottom-o.height&&(v.debug("Fixing bottom attached element to top of browser."),v.fixTop())))},bindTop:function(){v.debug("Binding element to top of parent container"),v.remove.offset(),w.css({left:"",top:"",marginBottom:""}).removeClass(p.fixed).removeClass(p.bottom).addClass(p.bound).addClass(p.top),h.onTop.call(R),h.onUnstick.call(R)},bindBottom:function(){v.debug("Binding element to bottom of parent container"),v.remove.offset(),w.css({left:"",top:""}).removeClass(p.fixed).removeClass(p.top).addClass(p.bound).addClass(p.bottom),h.onBottom.call(R),h.onUnstick.call(R)},setInitialPosition:function(){v.debug("Returning to initial position"),v.unfix(),v.unbind()},fixTop:function(){v.debug("Fixing element to top of page"),v.set.minimumSize(),v.set.offset(),w.css({left:v.cache.element.left,bottom:"",marginBottom:""}).removeClass(p.bound).removeClass(p.bottom).addClass(p.fixed).addClass(p.top),h.onStick.call(R)},fixBottom:function(){v.debug("Sticking element to bottom of page"),v.set.minimumSize(),v.set.offset(),w.css({left:v.cache.element.left,bottom:"",marginBottom:""}).removeClass(p.bound).removeClass(p.top).addClass(p.fixed).addClass(p.bottom),h.onStick.call(R)},unbind:function(){v.is.bound()&&(v.debug("Removing container bound position on element"),v.remove.offset(),w.removeClass(p.bound).removeClass(p.top).removeClass(p.bottom))},unfix:function(){v.is.fixed()&&(v.debug("Removing fixed position on element"),v.remove.offset(),w.removeClass(p.fixed).removeClass(p.top).removeClass(p.bottom),h.onUnstick.call(R))},reset:function(){v.debug("Resetting elements position"),v.unbind(),v.unfix(),v.resetCSS(),v.remove.offset(),v.remove.lastScroll()},resetCSS:function(){w.css({width:"",height:""}),r.css({height:""})},setting:function(t,n){if(e.isPlainObject(t))e.extend(!0,h,t);else{if(void 0===n)return h[t];h[t]=n}},internal:function(t,n){if(e.isPlainObject(t))e.extend(!0,v,t);else{if(void 0===n)return v[t];v[t]=n}},debug:function(){!h.silent&&h.debug&&(h.performance?v.performance.log(arguments):(v.debug=Function.prototype.bind.call(console.info,console,h.name+":"),v.debug.apply(console,arguments)))},verbose:function(){!h.silent&&h.verbose&&h.debug&&(h.performance?v.performance.log(arguments):(v.verbose=Function.prototype.bind.call(console.info,console,h.name+":"),v.verbose.apply(console,arguments)))},error:function(){h.silent||(v.error=Function.prototype.bind.call(console.error,console,h.name+":"),v.error.apply(console,arguments))},performance:{log:function(e){var t,n,i;h.performance&&(t=(new Date).getTime(),i=s||t,n=t-i,s=t,l.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:R,"Execution Time":n})),clearTimeout(v.performance.timer),v.performance.timer=setTimeout(v.performance.display,0)},display:function(){var t=h.name+":",n=0;s=!1,clearTimeout(v.performance.timer),e.each(l,function(e,t){n+=t["Execution Time"]}),t+=" "+n+"ms",a&&(t+=" '"+a+"'"),(void 0!==console.group||void 0!==console.table)&&l.length>0&&(console.groupCollapsed(t),console.table?console.table(l):e.each(l,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),l=[]}},invoke:function(t,n,i){var r,a,s,l=T;return n=n||u,i=R||i,"string"==typeof t&&void 0!==l&&(t=t.split(/[\. ]/),r=t.length-1,e.each(t,function(n,i){var o=n!=r?i+t[n+1].charAt(0).toUpperCase()+t[n+1].slice(1):t;if(e.isPlainObject(l[o])&&n!=r)l=l[o];else{if(void 0!==l[o])return a=l[o],!1;if(!e.isPlainObject(l[i])||n==r)return void 0!==l[i]&&(a=l[i],!1);l=l[i]}})),e.isFunction(a)?s=a.apply(i,n):void 0!==a&&(s=a),e.isArray(o)?o.push(s):void 0!==o?o=[o,s]:void 0!==s&&(o=s),a}},d?(void 0===T&&v.initialize(),v.invoke(c)):(void 0!==T&&T.invoke("destroy"),v.initialize())}),void 0!==o?o:this},e.fn.sticky.settings={name:"Sticky",namespace:"sticky",silent:!1,debug:!1,verbose:!0,performance:!0,pushing:!1,context:!1,container:!1,scrollContext:t,offset:0,bottomOffset:0,jitter:5,observeChanges:!1,onReposition:function(){},onScroll:function(){},onStick:function(){},onUnstick:function(){},onTop:function(){},onBottom:function(){},error:{container:"Sticky element must be inside a relative container",visible:"Element is hidden, you must call refresh after element becomes visible. Use silent setting to surpress this warning in production.",method:"The method you called is not defined.",invalidContext:"Context specified does not exist",elementSize:"Sticky element is larger than its container, cannot create sticky."},className:{bound:"bound",fixed:"fixed",supported:"native",top:"top",bottom:"bottom"}}}(jQuery,window,document),function(e,t,n,i){"use strict";var t=void 0!==t&&t.Math==Math?t:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();e.api=e.fn.api=function(n){var i,o=e(e.isFunction(this)?t:this),r=o.selector||"",a=(new Date).getTime(),s=[],l=arguments[0],c="string"==typeof l,d=[].slice.call(arguments,1);return o.each(function(){var o,u,f,m,g,v=e.isPlainObject(n)?e.extend(!0,{},e.fn.api.settings,n):e.extend({},e.fn.api.settings),h=v.namespace,p=v.metadata,b=v.selector,x=v.error,y=v.className,C="."+h,w="module-"+h,k=e(this),S=k.closest(b.form),T=v.stateContext?e(v.stateContext):k,A=this,R=T[0],E=k.data(w);g={initialize:function(){c||g.bind.events(),g.instantiate()},instantiate:function(){g.verbose("Storing instance of module",g),E=g,k.data(w,E)},destroy:function(){g.verbose("Destroying previous module for",A),k.removeData(w).off(C)},bind:{events:function(){var e=g.get.event();e?(g.verbose("Attaching API events to element",e),k.on(e+C,g.event.trigger)):"now"==v.on&&(g.debug("Querying API endpoint immediately"),g.query())}},decode:{json:function(e){if(void 0!==e&&"string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}},read:{cachedResponse:function(e){var n;return void 0===t.Storage?void g.error(x.noStorage):(n=sessionStorage.getItem(e),g.debug("Using cached response",e,n),n=g.decode.json(n))}},write:{cachedResponse:function(n,i){return i&&""===i?void g.debug("Response empty, not caching",i):void 0===t.Storage?void g.error(x.noStorage):(e.isPlainObject(i)&&(i=JSON.stringify(i)),sessionStorage.setItem(n,i),void g.verbose("Storing cached response for url",n,i))}},query:function(){if(g.is.disabled())return void g.debug("Element is disabled API request aborted");if(g.is.loading()){if(!v.interruptRequests)return void g.debug("Cancelling request, previous request is still pending");g.debug("Interrupting previous request"),g.abort()}if(v.defaultData&&e.extend(!0,v.urlData,g.get.defaultData()),v.serializeForm&&(v.data=g.add.formData(v.data)),!1===(u=g.get.settings()))return g.cancelled=!0,void g.error(x.beforeSend);if(g.cancelled=!1,!(f=g.get.templatedURL())&&!g.is.mocked())return void g.error(x.missingURL);if((f=g.add.urlData(f))||g.is.mocked()){if(u.url=v.base+f,o=e.extend(!0,{},v,{type:v.method||v.type,data:void 0,url:v.base+f,beforeSend:v.beforeXHR,success:function(){},failure:function(){},complete:function(){}}),g.debug("Querying URL",o.url),g.verbose("Using AJAX settings",o),"local"===v.cache&&g.read.cachedResponse(f))return g.debug("Response returned from local cache"),g.request=g.create.request(),void g.request.resolveWith(R,[g.read.cachedResponse(f)]);v.throttle?v.throttleFirstRequest||g.timer?(g.debug("Throttling request",v.throttle),clearTimeout(g.timer),g.timer=setTimeout(function(){g.timer&&delete g.timer,g.debug("Sending throttled request",void 0,o.method),g.send.request()},v.throttle)):(g.debug("Sending request",void 0,o.method),g.send.request(),g.timer=setTimeout(function(){},v.throttle)):(g.debug("Sending request",void 0,o.method),g.send.request())}},should:{removeError:function(){return!0===v.hideError||"auto"===v.hideError&&!g.is.form()}},is:{disabled:function(){return k.filter(b.disabled).length>0},expectingJSON:function(){return"json"===v.dataType||"jsonp"===v.dataType},form:function(){return k.is("form")||T.is("form")},mocked:function(){return v.mockResponse||v.mockResponseAsync||v.response||v.responseAsync},input:function(){return k.is("input")},loading:function(){return!!g.request&&"pending"==g.request.state()},abortedRequest:function(e){return e&&void 0!==e.readyState&&0===e.readyState?(g.verbose("XHR request determined to be aborted"),!0):(g.verbose("XHR request was not aborted"),!1)},validResponse:function(t){return g.is.expectingJSON()&&e.isFunction(v.successTest)?(g.debug("Checking JSON returned success",v.successTest,t),v.successTest(t)?(g.debug("Response passed success test",t),!0):(g.debug("Response failed success test",t),!1)):(g.verbose("Response is not JSON, skipping validation",v.successTest,t),!0)}},was:{cancelled:function(){return g.cancelled||!1},succesful:function(){return g.request&&"resolved"==g.request.state()},failure:function(){return g.request&&"rejected"==g.request.state()},complete:function(){return g.request&&("resolved"==g.request.state()||"rejected"==g.request.state())}},add:{urlData:function(t,n){var i,o;return t&&(i=t.match(v.regExp.required),o=t.match(v.regExp.optional),n=n||v.urlData,i&&(g.debug("Looking for required URL variables",i),e.each(i,function(i,o){var r=-1!==o.indexOf("$")?o.substr(2,o.length-3):o.substr(1,o.length-2),a=e.isPlainObject(n)&&void 0!==n[r]?n[r]:void 0!==k.data(r)?k.data(r):void 0!==T.data(r)?T.data(r):n[r];if(void 0===a)return g.error(x.requiredParameter,r,t),t=!1,!1;g.verbose("Found required variable",r,a),a=v.encodeParameters?g.get.urlEncodedValue(a):a,t=t.replace(o,a)})),o&&(g.debug("Looking for optional URL variables",i),e.each(o,function(i,o){var r=-1!==o.indexOf("$")?o.substr(3,o.length-4):o.substr(2,o.length-3),a=e.isPlainObject(n)&&void 0!==n[r]?n[r]:void 0!==k.data(r)?k.data(r):void 0!==T.data(r)?T.data(r):n[r];void 0!==a?(g.verbose("Optional variable Found",r,a),t=t.replace(o,a)):(g.verbose("Optional variable not found",r),t=-1!==t.indexOf("/"+o)?t.replace("/"+o,""):t.replace(o,""))}))),t},formData:function(t){var n,i=void 0!==e.fn.serializeObject,o=i?S.serializeObject():S.serialize();return t=t||v.data,n=e.isPlainObject(t),n?i?(g.debug("Extending existing data with form data",t,o),t=e.extend(!0,{},t,o)):(g.error(x.missingSerialize),g.debug("Cant extend data. Replacing data with form data",t,o),t=o):(g.debug("Adding form data",o),t=o),t}},send:{request:function(){g.set.loading(),g.request=g.create.request(),g.is.mocked()?g.mockedXHR=g.create.mockedXHR():g.xhr=g.create.xhr(),v.onRequest.call(R,g.request,g.xhr)}},event:{trigger:function(e){g.query(),"submit"!=e.type&&"click"!=e.type||e.preventDefault()},xhr:{always:function(){},done:function(t,n,i){var o=this,r=(new Date).getTime()-m,a=v.loadingDuration-r,s=!!e.isFunction(v.onResponse)&&(g.is.expectingJSON()?v.onResponse.call(o,e.extend(!0,{},t)):v.onResponse.call(o,t));a=a>0?a:0,s&&(g.debug("Modified API response in onResponse callback",v.onResponse,s,t),t=s),a>0&&g.debug("Response completed early delaying state change by",a),setTimeout(function(){g.is.validResponse(t)?g.request.resolveWith(o,[t,i]):g.request.rejectWith(o,[i,"invalid"])},a)},fail:function(e,t,n){var i=this,o=(new Date).getTime()-m,r=v.loadingDuration-o;r=r>0?r:0,r>0&&g.debug("Response completed early delaying state change by",r),setTimeout(function(){g.is.abortedRequest(e)?g.request.rejectWith(i,[e,"aborted",n]):g.request.rejectWith(i,[e,"error",t,n])},r)}},request:{done:function(e,t){g.debug("Successful API Response",e),"local"===v.cache&&f&&(g.write.cachedResponse(f,e),g.debug("Saving server response locally",g.cache)),v.onSuccess.call(R,e,k,t)},complete:function(e,t){var n,i;g.was.succesful()?(i=e,n=t):(n=e,i=g.get.responseFromXHR(n)),g.remove.loading(),v.onComplete.call(R,i,k,n)},fail:function(e,t,n){var i=g.get.responseFromXHR(e),r=g.get.errorFromRequest(i,t,n);if("aborted"==t)return g.debug("XHR Aborted (Most likely caused by page navigation or CORS Policy)",t,n),v.onAbort.call(R,t,k,e),!0;"invalid"==t?g.debug("JSON did not pass success test. A server-side error has most likely occurred",i):"error"==t&&void 0!==e&&(g.debug("XHR produced a server error",t,n),200!=e.status&&void 0!==n&&""!==n&&g.error(x.statusMessage+n,o.url),v.onError.call(R,r,k,e)),v.errorDuration&&"aborted"!==t&&(g.debug("Adding error state"),g.set.error(),g.should.removeError()&&setTimeout(g.remove.error,v.errorDuration)),g.debug("API Request failed",r,e),v.onFailure.call(R,i,k,e)}}},create:{request:function(){return e.Deferred().always(g.event.request.complete).done(g.event.request.done).fail(g.event.request.fail)},mockedXHR:function(){var t,n,i,o=v.mockResponse||v.response,r=v.mockResponseAsync||v.responseAsync;return i=e.Deferred().always(g.event.xhr.complete).done(g.event.xhr.done).fail(g.event.xhr.fail),o?(e.isFunction(o)?(g.debug("Using specified synchronous callback",o),n=o.call(R,u)):(g.debug("Using settings specified response",o),n=o),i.resolveWith(R,[n,!1,{responseText:n}])):e.isFunction(r)&&(t=function(e){g.debug("Async callback returned response",e),e?i.resolveWith(R,[e,!1,{responseText:e}]):i.rejectWith(R,[{responseText:e},!1,!1])},g.debug("Using specified async response callback",r),r.call(R,u,t)),i},xhr:function(){var t;return t=e.ajax(o).always(g.event.xhr.always).done(g.event.xhr.done).fail(g.event.xhr.fail),g.verbose("Created server request",t,o),t}},set:{error:function(){g.verbose("Adding error state to element",T),T.addClass(y.error)},loading:function(){g.verbose("Adding loading state to element",T),T.addClass(y.loading),m=(new Date).getTime()}},remove:{error:function(){g.verbose("Removing error state from element",T),T.removeClass(y.error)},loading:function(){g.verbose("Removing loading state from element",T),T.removeClass(y.loading)}},get:{responseFromXHR:function(t){return!!e.isPlainObject(t)&&(g.is.expectingJSON()?g.decode.json(t.responseText):t.responseText)},errorFromRequest:function(t,n,i){return e.isPlainObject(t)&&void 0!==t.error?t.error:void 0!==v.error[n]?v.error[n]:i},request:function(){return g.request||!1},xhr:function(){return g.xhr||!1},settings:function(){var t;return t=v.beforeSend.call(R,v),t&&(void 0!==t.success&&(g.debug("Legacy success callback detected",t),g.error(x.legacyParameters,t.success),t.onSuccess=t.success),void 0!==t.failure&&(g.debug("Legacy failure callback detected",t),g.error(x.legacyParameters,t.failure),t.onFailure=t.failure),void 0!==t.complete&&(g.debug("Legacy complete callback detected",t),g.error(x.legacyParameters,t.complete),t.onComplete=t.complete)),void 0===t&&g.error(x.noReturnedValue),!1===t?t:void 0!==t?e.extend(!0,{},t):e.extend(!0,{},v)},urlEncodedValue:function(e){var n=t.decodeURIComponent(e),i=t.encodeURIComponent(e);return n!==e?(g.debug("URL value is already encoded, avoiding double encoding",e),e):(g.verbose("Encoding value using encodeURIComponent",e,i),i)},defaultData:function(){var t={};return e.isWindow(A)||(g.is.input()?t.value=k.val():g.is.form()||(t.text=k.text())),t},event:function(){return e.isWindow(A)||"now"==v.on?(g.debug("API called without element, no events attached"),!1):"auto"==v.on?k.is("input")?void 0!==A.oninput?"input":void 0!==A.onpropertychange?"propertychange":"keyup":k.is("form")?"submit":"click":v.on},templatedURL:function(e){if(e=e||k.data(p.action)||v.action||!1,f=k.data(p.url)||v.url||!1)return g.debug("Using specified url",f),f;if(e){if(g.debug("Looking up url for action",e,v.api),
15 void 0===v.api[e]&&!g.is.mocked())return void g.error(x.missingAction,v.action,v.api);f=v.api[e]}else g.is.form()&&(f=k.attr("action")||T.attr("action")||!1,g.debug("No url or action specified, defaulting to form action",f));return f}},abort:function(){var e=g.get.xhr();e&&"resolved"!==e.state()&&(g.debug("Cancelling API request"),e.abort())},reset:function(){g.remove.error(),g.remove.loading()},setting:function(t,n){if(g.debug("Changing setting",t,n),e.isPlainObject(t))e.extend(!0,v,t);else{if(void 0===n)return v[t];e.isPlainObject(v[t])?e.extend(!0,v[t],n):v[t]=n}},internal:function(t,n){if(e.isPlainObject(t))e.extend(!0,g,t);else{if(void 0===n)return g[t];g[t]=n}},debug:function(){!v.silent&&v.debug&&(v.performance?g.performance.log(arguments):(g.debug=Function.prototype.bind.call(console.info,console,v.name+":"),g.debug.apply(console,arguments)))},verbose:function(){!v.silent&&v.verbose&&v.debug&&(v.performance?g.performance.log(arguments):(g.verbose=Function.prototype.bind.call(console.info,console,v.name+":"),g.verbose.apply(console,arguments)))},error:function(){v.silent||(g.error=Function.prototype.bind.call(console.error,console,v.name+":"),g.error.apply(console,arguments))},performance:{log:function(e){var t,n,i;v.performance&&(t=(new Date).getTime(),i=a||t,n=t-i,a=t,s.push({Name:e[0],Arguments:[].slice.call(e,1)||"","Execution Time":n})),clearTimeout(g.performance.timer),g.performance.timer=setTimeout(g.performance.display,500)},display:function(){var t=v.name+":",n=0;a=!1,clearTimeout(g.performance.timer),e.each(s,function(e,t){n+=t["Execution Time"]}),t+=" "+n+"ms",r&&(t+=" '"+r+"'"),(void 0!==console.group||void 0!==console.table)&&s.length>0&&(console.groupCollapsed(t),console.table?console.table(s):e.each(s,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),s=[]}},invoke:function(t,n,o){var r,a,s,l=E;return n=n||d,o=A||o,"string"==typeof t&&void 0!==l&&(t=t.split(/[\. ]/),r=t.length-1,e.each(t,function(n,i){var o=n!=r?i+t[n+1].charAt(0).toUpperCase()+t[n+1].slice(1):t;if(e.isPlainObject(l[o])&&n!=r)l=l[o];else{if(void 0!==l[o])return a=l[o],!1;if(!e.isPlainObject(l[i])||n==r)return void 0!==l[i]?(a=l[i],!1):(g.error(x.method,t),!1);l=l[i]}})),e.isFunction(a)?s=a.apply(o,n):void 0!==a&&(s=a),e.isArray(i)?i.push(s):void 0!==i?i=[i,s]:void 0!==s&&(i=s),a}},c?(void 0===E&&g.initialize(),g.invoke(l)):(void 0!==E&&E.invoke("destroy"),g.initialize())}),void 0!==i?i:this},e.api.settings={name:"API",namespace:"api",debug:!1,verbose:!1,performance:!0,api:{},cache:!0,interruptRequests:!0,on:"auto",stateContext:!1,loadingDuration:0,hideError:"auto",errorDuration:2e3,encodeParameters:!0,action:!1,url:!1,base:"",urlData:{},defaultData:!0,serializeForm:!1,throttle:0,throttleFirstRequest:!0,method:"get",data:{},dataType:"json",mockResponse:!1,mockResponseAsync:!1,response:!1,responseAsync:!1,beforeSend:function(e){return e},beforeXHR:function(e){},onRequest:function(e,t){},onResponse:!1,onSuccess:function(e,t){},onComplete:function(e,t){},onFailure:function(e,t){},onError:function(e,t){},onAbort:function(e,t){},successTest:!1,error:{beforeSend:"The before send function has aborted the request",error:"There was an error with your request",exitConditions:"API Request Aborted. Exit conditions met",JSONParse:"JSON could not be parsed during error handling",legacyParameters:"You are using legacy API success callback names",method:"The method you called is not defined",missingAction:"API action used but no url was defined",missingSerialize:"jquery-serialize-object is required to add form data to an existing data object",missingURL:"No URL specified for api event",noReturnedValue:"The beforeSend callback must return a settings object, beforeSend ignored.",noStorage:"Caching responses locally requires session storage",parseError:"There was an error parsing your request",requiredParameter:"Missing a required URL parameter: ",statusMessage:"Server gave an error: ",timeout:"Your request timed out"},regExp:{required:/\{\$*[A-z0-9]+\}/g,optional:/\{\/\$*[A-z0-9]+\}/g},className:{loading:"loading",error:"error"},selector:{disabled:".disabled",form:"form"},metadata:{action:"action",url:"url"}}}(jQuery,window,document),function(e,t,n,i){"use strict";t=void 0!==t&&t.Math==Math?t:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),e.fn.state=function(t){var i,o=e(this),r=o.selector||"",a=(n.documentElement,(new Date).getTime()),s=[],l=arguments[0],c="string"==typeof l,d=[].slice.call(arguments,1);return o.each(function(){var n,u=e.isPlainObject(t)?e.extend(!0,{},e.fn.state.settings,t):e.extend({},e.fn.state.settings),f=u.error,m=u.metadata,g=u.className,v=u.namespace,h=u.states,p=u.text,b="."+v,x=v+"-module",y=e(this),C=this,w=y.data(x);n={initialize:function(){n.verbose("Initializing module"),u.automatic&&n.add.defaults(),u.context&&""!==r?e(u.context).on(r,"mouseenter"+b,n.change.text).on(r,"mouseleave"+b,n.reset.text).on(r,"click"+b,n.toggle.state):y.on("mouseenter"+b,n.change.text).on("mouseleave"+b,n.reset.text).on("click"+b,n.toggle.state),n.instantiate()},instantiate:function(){n.verbose("Storing instance of module",n),w=n,y.data(x,n)},destroy:function(){n.verbose("Destroying previous module",w),y.off(b).removeData(x)},refresh:function(){n.verbose("Refreshing selector cache"),y=e(C)},add:{defaults:function(){var i=t&&e.isPlainObject(t.states)?t.states:{};e.each(u.defaults,function(t,o){void 0!==n.is[t]&&n.is[t]()&&(n.verbose("Adding default states",t,C),e.extend(u.states,o,i))})}},is:{active:function(){return y.hasClass(g.active)},loading:function(){return y.hasClass(g.loading)},inactive:function(){return!y.hasClass(g.active)},state:function(e){return void 0!==g[e]&&y.hasClass(g[e])},enabled:function(){return!y.is(u.filter.active)},disabled:function(){return y.is(u.filter.active)},textEnabled:function(){return!y.is(u.filter.text)},button:function(){return y.is(".button:not(a, .submit)")},input:function(){return y.is("input")},progress:function(){return y.is(".ui.progress")}},allow:function(e){n.debug("Now allowing state",e),h[e]=!0},disallow:function(e){n.debug("No longer allowing",e),h[e]=!1},allows:function(e){return h[e]||!1},enable:function(){y.removeClass(g.disabled)},disable:function(){y.addClass(g.disabled)},setState:function(e){n.allows(e)&&y.addClass(g[e])},removeState:function(e){n.allows(e)&&y.removeClass(g[e])},toggle:{state:function(){var t;if(n.allows("active")&&n.is.enabled()){if(n.refresh(),void 0!==e.fn.api)if(t=y.api("get request"),y.api("was cancelled"))n.debug("API Request cancelled by beforesend"),u.activateTest=function(){return!1},u.deactivateTest=function(){return!1};else if(t)return void n.listenTo(t);n.change.state()}}},listenTo:function(t){n.debug("API request detected, waiting for state signal",t),t&&(p.loading&&n.update.text(p.loading),e.when(t).then(function(){"resolved"==t.state()?(n.debug("API request succeeded"),u.activateTest=function(){return!0},u.deactivateTest=function(){return!0}):(n.debug("API request failed"),u.activateTest=function(){return!1},u.deactivateTest=function(){return!1}),n.change.state()}))},change:{state:function(){n.debug("Determining state change direction"),n.is.inactive()?n.activate():n.deactivate(),u.sync&&n.sync(),u.onChange.call(C)},text:function(){n.is.textEnabled()&&(n.is.disabled()?(n.verbose("Changing text to disabled text",p.hover),n.update.text(p.disabled)):n.is.active()?p.hover?(n.verbose("Changing text to hover text",p.hover),n.update.text(p.hover)):p.deactivate&&(n.verbose("Changing text to deactivating text",p.deactivate),n.update.text(p.deactivate)):p.hover?(n.verbose("Changing text to hover text",p.hover),n.update.text(p.hover)):p.activate&&(n.verbose("Changing text to activating text",p.activate),n.update.text(p.activate)))}},activate:function(){u.activateTest.call(C)&&(n.debug("Setting state to active"),y.addClass(g.active),n.update.text(p.active),u.onActivate.call(C))},deactivate:function(){u.deactivateTest.call(C)&&(n.debug("Setting state to inactive"),y.removeClass(g.active),n.update.text(p.inactive),u.onDeactivate.call(C))},sync:function(){n.verbose("Syncing other buttons to current state"),n.is.active()?o.not(y).state("activate"):o.not(y).state("deactivate")},get:{text:function(){return u.selector.text?y.find(u.selector.text).text():y.html()},textFor:function(e){return p[e]||!1}},flash:{text:function(e,t,i){var o=n.get.text();n.debug("Flashing text message",e,t),e=e||u.text.flash,t=t||u.flashDuration,i=i||function(){},n.update.text(e),setTimeout(function(){n.update.text(o),i.call(C)},t)}},reset:{text:function(){var e=p.active||y.data(m.storedText),t=p.inactive||y.data(m.storedText);n.is.textEnabled()&&(n.is.active()&&e?(n.verbose("Resetting active text",e),n.update.text(e)):t&&(n.verbose("Resetting inactive text",e),n.update.text(t)))}},update:{text:function(e){var t=n.get.text();e&&e!==t?(n.debug("Updating text",e),u.selector.text?y.data(m.storedText,e).find(u.selector.text).text(e):y.data(m.storedText,e).html(e)):n.debug("Text is already set, ignoring update",e)}},setting:function(t,i){if(n.debug("Changing setting",t,i),e.isPlainObject(t))e.extend(!0,u,t);else{if(void 0===i)return u[t];e.isPlainObject(u[t])?e.extend(!0,u[t],i):u[t]=i}},internal:function(t,i){if(e.isPlainObject(t))e.extend(!0,n,t);else{if(void 0===i)return n[t];n[t]=i}},debug:function(){!u.silent&&u.debug&&(u.performance?n.performance.log(arguments):(n.debug=Function.prototype.bind.call(console.info,console,u.name+":"),n.debug.apply(console,arguments)))},verbose:function(){!u.silent&&u.verbose&&u.debug&&(u.performance?n.performance.log(arguments):(n.verbose=Function.prototype.bind.call(console.info,console,u.name+":"),n.verbose.apply(console,arguments)))},error:function(){u.silent||(n.error=Function.prototype.bind.call(console.error,console,u.name+":"),n.error.apply(console,arguments))},performance:{log:function(e){var t,i,o;u.performance&&(t=(new Date).getTime(),o=a||t,i=t-o,a=t,s.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:C,"Execution Time":i})),clearTimeout(n.performance.timer),n.performance.timer=setTimeout(n.performance.display,500)},display:function(){var t=u.name+":",i=0;a=!1,clearTimeout(n.performance.timer),e.each(s,function(e,t){i+=t["Execution Time"]}),t+=" "+i+"ms",r&&(t+=" '"+r+"'"),(void 0!==console.group||void 0!==console.table)&&s.length>0&&(console.groupCollapsed(t),console.table?console.table(s):e.each(s,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),s=[]}},invoke:function(t,o,r){var a,s,l,c=w;return o=o||d,r=C||r,"string"==typeof t&&void 0!==c&&(t=t.split(/[\. ]/),a=t.length-1,e.each(t,function(i,o){var r=i!=a?o+t[i+1].charAt(0).toUpperCase()+t[i+1].slice(1):t;if(e.isPlainObject(c[r])&&i!=a)c=c[r];else{if(void 0!==c[r])return s=c[r],!1;if(!e.isPlainObject(c[o])||i==a)return void 0!==c[o]?(s=c[o],!1):(n.error(f.method,t),!1);c=c[o]}})),e.isFunction(s)?l=s.apply(r,o):void 0!==s&&(l=s),e.isArray(i)?i.push(l):void 0!==i?i=[i,l]:void 0!==l&&(i=l),s}},c?(void 0===w&&n.initialize(),n.invoke(l)):(void 0!==w&&w.invoke("destroy"),n.initialize())}),void 0!==i?i:this},e.fn.state.settings={name:"State",debug:!1,verbose:!1,namespace:"state",performance:!0,onActivate:function(){},onDeactivate:function(){},onChange:function(){},activateTest:function(){return!0},deactivateTest:function(){return!0},automatic:!0,sync:!1,flashDuration:1e3,filter:{text:".loading, .disabled",active:".disabled"},context:!1,error:{beforeSend:"The before send function has cancelled state change",method:"The method you called is not defined."},metadata:{promise:"promise",storedText:"stored-text"},className:{active:"active",disabled:"disabled",error:"error",loading:"loading",success:"success",warning:"warning"},selector:{text:!1},defaults:{input:{disabled:!0,loading:!0,active:!0},button:{disabled:!0,loading:!0,active:!0},progress:{active:!0,success:!0,warning:!0,error:!0}},states:{active:!0,disabled:!0,error:!0,loading:!0,success:!0,warning:!0},text:{disabled:!1,flash:!1,hover:!1,active:!1,inactive:!1,activate:!1,deactivate:!1}}}(jQuery,window,document),function(e,t,n,i){"use strict";t=void 0!==t&&t.Math==Math?t:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),e.fn.visibility=function(i){var o,r=e(this),a=r.selector||"",s=(new Date).getTime(),l=[],c=arguments[0],d="string"==typeof c,u=[].slice.call(arguments,1),f=r.length,m=0;return r.each(function(){var r,g,v,h,p=e.isPlainObject(i)?e.extend(!0,{},e.fn.visibility.settings,i):e.extend({},e.fn.visibility.settings),b=p.className,x=p.namespace,y=p.error,C=p.metadata,w="."+x,k="module-"+x,S=e(t),T=e(this),A=e(p.context),R=(T.selector,T.data(k)),E=t.requestAnimationFrame||t.mozRequestAnimationFrame||t.webkitRequestAnimationFrame||t.msRequestAnimationFrame||function(e){setTimeout(e,0)},P=this,O=!1;h={initialize:function(){h.debug("Initializing",p),h.setup.cache(),h.should.trackChanges()&&("image"==p.type&&h.setup.image(),"fixed"==p.type&&h.setup.fixed(),p.observeChanges&&h.observeChanges(),h.bind.events()),h.save.position(),h.is.visible()||h.error(y.visible,T),p.initialCheck&&h.checkVisibility(),h.instantiate()},instantiate:function(){h.debug("Storing instance",h),T.data(k,h),R=h},destroy:function(){h.verbose("Destroying previous module"),v&&v.disconnect(),g&&g.disconnect(),S.off("load"+w,h.event.load).off("resize"+w,h.event.resize),A.off("scroll"+w,h.event.scroll).off("scrollchange"+w,h.event.scrollchange),"fixed"==p.type&&(h.resetFixed(),h.remove.placeholder()),T.off(w).removeData(k)},observeChanges:function(){"MutationObserver"in t&&(g=new MutationObserver(h.event.contextChanged),v=new MutationObserver(h.event.changed),g.observe(n,{childList:!0,subtree:!0}),v.observe(P,{childList:!0,subtree:!0}),h.debug("Setting up mutation observer",v))},bind:{events:function(){h.verbose("Binding visibility events to scroll and resize"),p.refreshOnLoad&&S.on("load"+w,h.event.load),S.on("resize"+w,h.event.resize),A.off("scroll"+w).on("scroll"+w,h.event.scroll).on("scrollchange"+w,h.event.scrollchange)}},event:{changed:function(e){h.verbose("DOM tree modified, updating visibility calculations"),h.timer=setTimeout(function(){h.verbose("DOM tree modified, updating sticky menu"),h.refresh()},100)},contextChanged:function(t){[].forEach.call(t,function(t){t.removedNodes&&[].forEach.call(t.removedNodes,function(t){(t==P||e(t).find(P).length>0)&&(h.debug("Element removed from DOM, tearing down events"),h.destroy())})})},resize:function(){h.debug("Window resized"),p.refreshOnResize&&E(h.refresh)},load:function(){h.debug("Page finished loading"),E(h.refresh)},scroll:function(){p.throttle?(clearTimeout(h.timer),h.timer=setTimeout(function(){A.triggerHandler("scrollchange"+w,[A.scrollTop()])},p.throttle)):E(function(){A.triggerHandler("scrollchange"+w,[A.scrollTop()])})},scrollchange:function(e,t){h.checkVisibility(t)}},precache:function(t,i){t instanceof Array||(t=[t]);for(var o=t.length,r=0,a=[],s=n.createElement("img"),l=function(){++r>=t.length&&e.isFunction(i)&&i()};o--;)s=n.createElement("img"),s.onload=l,s.onerror=l,s.src=t[o],a.push(s)},enableCallbacks:function(){h.debug("Allowing callbacks to occur"),O=!1},disableCallbacks:function(){h.debug("Disabling all callbacks temporarily"),O=!0},should:{trackChanges:function(){return d?(h.debug("One time query, no need to bind events"),!1):(h.debug("Callbacks being attached"),!0)}},setup:{cache:function(){h.cache={occurred:{},screen:{},element:{}}},image:function(){var e=T.data(C.src);e&&(h.verbose("Lazy loading image",e),p.once=!0,p.observeChanges=!1,p.onOnScreen=function(){h.debug("Image on screen",P),h.precache(e,function(){h.set.image(e,function(){m++,m==f&&p.onAllLoaded.call(this),p.onLoad.call(this)})})})},fixed:function(){h.debug("Setting up fixed"),p.once=!1,p.observeChanges=!1,p.initialCheck=!0,p.refreshOnLoad=!0,i.transition||(p.transition=!1),h.create.placeholder(),h.debug("Added placeholder",r),p.onTopPassed=function(){h.debug("Element passed, adding fixed position",T),h.show.placeholder(),h.set.fixed(),p.transition&&void 0!==e.fn.transition&&T.transition(p.transition,p.duration)},p.onTopPassedReverse=function(){h.debug("Element returned to position, removing fixed",T),h.hide.placeholder(),h.remove.fixed()}}},create:{placeholder:function(){h.verbose("Creating fixed position placeholder"),r=T.clone(!1).css("display","none").addClass(b.placeholder).insertAfter(T)}},show:{placeholder:function(){h.verbose("Showing placeholder"),r.css("display","block").css("visibility","hidden")}},hide:{placeholder:function(){h.verbose("Hiding placeholder"),r.css("display","none").css("visibility","")}},set:{fixed:function(){h.verbose("Setting element to fixed position"),T.addClass(b.fixed).css({position:"fixed",top:p.offset+"px",left:"auto",zIndex:p.zIndex}),p.onFixed.call(P)},image:function(t,n){if(T.attr("src",t),p.transition)if(void 0!==e.fn.transition){if(T.hasClass(b.visible))return void h.debug("Transition already occurred on this image, skipping animation");T.transition(p.transition,p.duration,n)}else T.fadeIn(p.duration,n);else T.show()}},is:{onScreen:function(){return h.get.elementCalculations().onScreen},offScreen:function(){return h.get.elementCalculations().offScreen},visible:function(){return!(!h.cache||!h.cache.element)&&!(0===h.cache.element.width&&0===h.cache.element.offset.top)},verticallyScrollableContext:function(){var e=A.get(0)!==t&&A.css("overflow-y");return"auto"==e||"scroll"==e},horizontallyScrollableContext:function(){var e=A.get(0)!==t&&A.css("overflow-x");return"auto"==e||"scroll"==e}},refresh:function(){h.debug("Refreshing constants (width/height)"),"fixed"==p.type&&h.resetFixed(),h.reset(),h.save.position(),p.checkOnRefresh&&h.checkVisibility(),p.onRefresh.call(P)},resetFixed:function(){h.remove.fixed(),h.remove.occurred()},reset:function(){h.verbose("Resetting all cached values"),e.isPlainObject(h.cache)&&(h.cache.screen={},h.cache.element={})},checkVisibility:function(e){h.verbose("Checking visibility of element",h.cache.element),!O&&h.is.visible()&&(h.save.scroll(e),h.save.calculations(),h.passed(),h.passingReverse(),h.topVisibleReverse(),h.bottomVisibleReverse(),h.topPassedReverse(),h.bottomPassedReverse(),h.onScreen(),h.offScreen(),h.passing(),h.topVisible(),h.bottomVisible(),h.topPassed(),h.bottomPassed(),p.onUpdate&&p.onUpdate.call(P,h.get.elementCalculations()))},passed:function(t,n){var i=h.get.elementCalculations();if(t&&n)p.onPassed[t]=n;else{if(void 0!==t)return h.get.pixelsPassed(t)>i.pixelsPassed;i.passing&&e.each(p.onPassed,function(e,t){i.bottomVisible||i.pixelsPassed>h.get.pixelsPassed(e)?h.execute(t,e):p.once||h.remove.occurred(t)})}},onScreen:function(e){var t=h.get.elementCalculations(),n=e||p.onOnScreen;if(e&&(h.debug("Adding callback for onScreen",e),p.onOnScreen=e),t.onScreen?h.execute(n,"onScreen"):p.once||h.remove.occurred("onScreen"),void 0!==e)return t.onOnScreen},offScreen:function(e){var t=h.get.elementCalculations(),n=e||p.onOffScreen;if(e&&(h.debug("Adding callback for offScreen",e),p.onOffScreen=e),t.offScreen?h.execute(n,"offScreen"):p.once||h.remove.occurred("offScreen"),void 0!==e)return t.onOffScreen},passing:function(e){var t=h.get.elementCalculations(),n=e||p.onPassing;if(e&&(h.debug("Adding callback for passing",e),p.onPassing=e),t.passing?h.execute(n,"passing"):p.once||h.remove.occurred("passing"),void 0!==e)return t.passing},topVisible:function(e){var t=h.get.elementCalculations(),n=e||p.onTopVisible;if(e&&(h.debug("Adding callback for top visible",e),p.onTopVisible=e),t.topVisible?h.execute(n,"topVisible"):p.once||h.remove.occurred("topVisible"),void 0===e)return t.topVisible},bottomVisible:function(e){var t=h.get.elementCalculations(),n=e||p.onBottomVisible;if(e&&(h.debug("Adding callback for bottom visible",e),p.onBottomVisible=e),t.bottomVisible?h.execute(n,"bottomVisible"):p.once||h.remove.occurred("bottomVisible"),void 0===e)return t.bottomVisible},topPassed:function(e){var t=h.get.elementCalculations(),n=e||p.onTopPassed;if(e&&(h.debug("Adding callback for top passed",e),p.onTopPassed=e),t.topPassed?h.execute(n,"topPassed"):p.once||h.remove.occurred("topPassed"),void 0===e)return t.topPassed},bottomPassed:function(e){var t=h.get.elementCalculations(),n=e||p.onBottomPassed;if(e&&(h.debug("Adding callback for bottom passed",e),p.onBottomPassed=e),t.bottomPassed?h.execute(n,"bottomPassed"):p.once||h.remove.occurred("bottomPassed"),void 0===e)return t.bottomPassed},passingReverse:function(e){var t=h.get.elementCalculations(),n=e||p.onPassingReverse;if(e&&(h.debug("Adding callback for passing reverse",e),p.onPassingReverse=e),t.passing?p.once||h.remove.occurred("passingReverse"):h.get.occurred("passing")&&h.execute(n,"passingReverse"),void 0!==e)return!t.passing},topVisibleReverse:function(e){var t=h.get.elementCalculations(),n=e||p.onTopVisibleReverse;if(e&&(h.debug("Adding callback for top visible reverse",e),p.onTopVisibleReverse=e),t.topVisible?p.once||h.remove.occurred("topVisibleReverse"):h.get.occurred("topVisible")&&h.execute(n,"topVisibleReverse"),void 0===e)return!t.topVisible},bottomVisibleReverse:function(e){var t=h.get.elementCalculations(),n=e||p.onBottomVisibleReverse;if(e&&(h.debug("Adding callback for bottom visible reverse",e),p.onBottomVisibleReverse=e),t.bottomVisible?p.once||h.remove.occurred("bottomVisibleReverse"):h.get.occurred("bottomVisible")&&h.execute(n,"bottomVisibleReverse"),void 0===e)return!t.bottomVisible},topPassedReverse:function(e){var t=h.get.elementCalculations(),n=e||p.onTopPassedReverse;if(e&&(h.debug("Adding callback for top passed reverse",e),p.onTopPassedReverse=e),t.topPassed?p.once||h.remove.occurred("topPassedReverse"):h.get.occurred("topPassed")&&h.execute(n,"topPassedReverse"),void 0===e)return!t.onTopPassed},bottomPassedReverse:function(e){var t=h.get.elementCalculations(),n=e||p.onBottomPassedReverse;if(e&&(h.debug("Adding callback for bottom passed reverse",e),p.onBottomPassedReverse=e),t.bottomPassed?p.once||h.remove.occurred("bottomPassedReverse"):h.get.occurred("bottomPassed")&&h.execute(n,"bottomPassedReverse"),void 0===e)return!t.bottomPassed},execute:function(e,t){var n=h.get.elementCalculations(),i=h.get.screenCalculations();e=e||!1,e&&(p.continuous?(h.debug("Callback being called continuously",t,n),e.call(P,n,i)):h.get.occurred(t)||(h.debug("Conditions met",t,n),e.call(P,n,i))),h.save.occurred(t)},remove:{fixed:function(){h.debug("Removing fixed position"),T.removeClass(b.fixed).css({position:"",top:"",left:"",zIndex:""}),p.onUnfixed.call(P)},placeholder:function(){h.debug("Removing placeholder content"),r&&r.remove()},occurred:function(e){if(e){var t=h.cache.occurred;void 0!==t[e]&&!0===t[e]&&(h.debug("Callback can now be called again",e),h.cache.occurred[e]=!1)}else h.cache.occurred={}}},save:{calculations:function(){h.verbose("Saving all calculations necessary to determine positioning"),h.save.direction(),h.save.screenCalculations(),h.save.elementCalculations()},occurred:function(e){e&&(void 0!==h.cache.occurred[e]&&!0===h.cache.occurred[e]||(h.verbose("Saving callback occurred",e),h.cache.occurred[e]=!0))},scroll:function(e){e=e+p.offset||A.scrollTop()+p.offset,h.cache.scroll=e},direction:function(){var e,t=h.get.scroll(),n=h.get.lastScroll();return e=t>n&&n?"down":t<n&&n?"up":"static",h.cache.direction=e,h.cache.direction},elementPosition:function(){var e=h.cache.element,t=h.get.screenSize();return h.verbose("Saving element position"),e.fits=e.height<t.height,e.offset=T.offset(),e.width=T.outerWidth(),e.height=T.outerHeight(),h.is.verticallyScrollableContext()&&(e.offset.top+=A.scrollTop()-A.offset().top),h.is.horizontallyScrollableContext()&&(e.offset.left+=A.scrollLeft-A.offset().left),h.cache.element=e,e},elementCalculations:function(){var e=h.get.screenCalculations(),t=h.get.elementPosition();return p.includeMargin?(t.margin={},t.margin.top=parseInt(T.css("margin-top"),10),t.margin.bottom=parseInt(T.css("margin-bottom"),10),t.top=t.offset.top-t.margin.top,t.bottom=t.offset.top+t.height+t.margin.bottom):(t.top=t.offset.top,t.bottom=t.offset.top+t.height),t.topPassed=e.top>=t.top,t.bottomPassed=e.top>=t.bottom,t.topVisible=e.bottom>=t.top&&!t.bottomPassed,t.bottomVisible=e.bottom>=t.bottom&&!t.topPassed,t.pixelsPassed=0,t.percentagePassed=0,t.onScreen=t.topVisible&&!t.bottomPassed,t.passing=t.topPassed&&!t.bottomPassed,t.offScreen=!t.onScreen,t.passing&&(t.pixelsPassed=e.top-t.top,t.percentagePassed=(e.top-t.top)/t.height),h.cache.element=t,h.verbose("Updated element calculations",t),t},screenCalculations:function(){var e=h.get.scroll();return h.save.direction(),h.cache.screen.top=e,h.cache.screen.bottom=e+h.cache.screen.height,h.cache.screen},screenSize:function(){h.verbose("Saving window position"),h.cache.screen={height:A.height()}},position:function(){h.save.screenSize(),h.save.elementPosition()}},get:{pixelsPassed:function(e){var t=h.get.elementCalculations();return e.search("%")>-1?t.height*(parseInt(e,10)/100):parseInt(e,10)},occurred:function(e){return void 0!==h.cache.occurred&&(h.cache.occurred[e]||!1)},direction:function(){return void 0===h.cache.direction&&h.save.direction(),h.cache.direction},elementPosition:function(){return void 0===h.cache.element&&h.save.elementPosition(),h.cache.element},elementCalculations:function(){return void 0===h.cache.element&&h.save.elementCalculations(),h.cache.element},screenCalculations:function(){return void 0===h.cache.screen&&h.save.screenCalculations(),h.cache.screen},screenSize:function(){return void 0===h.cache.screen&&h.save.screenSize(),h.cache.screen},scroll:function(){return void 0===h.cache.scroll&&h.save.scroll(),h.cache.scroll},lastScroll:function(){return void 0===h.cache.screen?(h.debug("First scroll event, no last scroll could be found"),!1):h.cache.screen.top}},setting:function(t,n){if(e.isPlainObject(t))e.extend(!0,p,t);else{if(void 0===n)return p[t];p[t]=n}},internal:function(t,n){if(e.isPlainObject(t))e.extend(!0,h,t);else{if(void 0===n)return h[t];h[t]=n}},debug:function(){!p.silent&&p.debug&&(p.performance?h.performance.log(arguments):(h.debug=Function.prototype.bind.call(console.info,console,p.name+":"),h.debug.apply(console,arguments)))},verbose:function(){!p.silent&&p.verbose&&p.debug&&(p.performance?h.performance.log(arguments):(h.verbose=Function.prototype.bind.call(console.info,console,p.name+":"),h.verbose.apply(console,arguments)))},error:function(){p.silent||(h.error=Function.prototype.bind.call(console.error,console,p.name+":"),h.error.apply(console,arguments))},performance:{log:function(e){var t,n,i;p.performance&&(t=(new Date).getTime(),i=s||t,n=t-i,s=t,l.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:P,"Execution Time":n})),clearTimeout(h.performance.timer),h.performance.timer=setTimeout(h.performance.display,500)},display:function(){var t=p.name+":",n=0;s=!1,clearTimeout(h.performance.timer),e.each(l,function(e,t){n+=t["Execution Time"]}),t+=" "+n+"ms",a&&(t+=" '"+a+"'"),(void 0!==console.group||void 0!==console.table)&&l.length>0&&(console.groupCollapsed(t),console.table?console.table(l):e.each(l,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),l=[]}},invoke:function(t,n,i){var r,a,s,l=R;return n=n||u,i=P||i,"string"==typeof t&&void 0!==l&&(t=t.split(/[\. ]/),r=t.length-1,e.each(t,function(n,i){var o=n!=r?i+t[n+1].charAt(0).toUpperCase()+t[n+1].slice(1):t;if(e.isPlainObject(l[o])&&n!=r)l=l[o];else{if(void 0!==l[o])return a=l[o],!1;if(!e.isPlainObject(l[i])||n==r)return void 0!==l[i]?(a=l[i],!1):(h.error(y.method,t),!1);l=l[i]}})),e.isFunction(a)?s=a.apply(i,n):void 0!==a&&(s=a),e.isArray(o)?o.push(s):void 0!==o?o=[o,s]:void 0!==s&&(o=s),a}},d?(void 0===R&&h.initialize(),R.save.scroll(),R.save.calculations(),h.invoke(c)):(void 0!==R&&R.invoke("destroy"),h.initialize())}),void 0!==o?o:this},e.fn.visibility.settings={name:"Visibility",namespace:"visibility",debug:!1,verbose:!1,performance:!0,observeChanges:!0,initialCheck:!0,refreshOnLoad:!0,refreshOnResize:!0,checkOnRefresh:!0,once:!0,continuous:!1,offset:0,includeMargin:!1,context:t,throttle:!1,type:!1,zIndex:"10",transition:"fade in",duration:1e3,onPassed:{},onOnScreen:!1,onOffScreen:!1,onPassing:!1,onTopVisible:!1,onBottomVisible:!1,onTopPassed:!1,onBottomPassed:!1,onPassingReverse:!1,onTopVisibleReverse:!1,onBottomVisibleReverse:!1,onTopPassedReverse:!1,onBottomPassedReverse:!1,onLoad:function(){},onAllLoaded:function(){},onFixed:function(){},onUnfixed:function(){},onUpdate:!1,onRefresh:function(){},metadata:{src:"src"},className:{fixed:"fixed",placeholder:"placeholder",visible:"visible"},error:{method:"The method you called is not defined.",visible:"Element is hidden, you must call refresh after element becomes visible"}}}(jQuery,window,document);