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