!function(n,t,i,r){n.site=n.fn.site=function(u){var f,o,l=(new Date).getTime(),h=[],y=arguments[0],b="string"==typeof y,k=[].slice.call(arguments,1),e=n.isPlainObject(u)?n.extend(!0,{},n.site.settings,u):n.extend({},n.site.settings),a=e.namespace,p=e.error,v="module-"+a,d=n(i),c=d,w=this,s=c.data(v);return f={initialize:function(){f.instantiate()},instantiate:function(){f.verbose("Storing instance of site",f);s=f;c.data(v,f)},normalize:function(){f.fix.console();f.fix.requestAnimationFrame()},fix:{console:function(){f.debug("Normalizing window.console");console!==r&&console.log!==r||(f.verbose("Console not available, normalizing events"),f.disable.console());"undefined"!=typeof console.group&&"undefined"!=typeof console.groupEnd&&"undefined"!=typeof console.groupCollapsed||(f.verbose("Console group not available, normalizing events"),t.console.group=function(){},t.console.groupEnd=function(){},t.console.groupCollapsed=function(){});"undefined"==typeof console.markTimeline&&(f.verbose("Mark timeline not available, normalizing events"),t.console.markTimeline=function(){})},consoleClear:function(){f.debug("Disabling programmatic console clearing");t.console.clear=function(){}},requestAnimationFrame:function(){f.debug("Normalizing requestAnimationFrame");t.requestAnimationFrame===r&&(f.debug("RequestAnimationFrame not available, normalizing event"),t.requestAnimationFrame=t.requestAnimationFrame||t.mozRequestAnimationFrame||t.webkitRequestAnimationFrame||t.msRequestAnimationFrame||function(n){setTimeout(n,0)})}},moduleExists:function(t){return n.fn[t]!==r&&n.fn[t].settings!==r},enabled:{modules:function(t){var i=[];return t=t||e.modules,n.each(t,function(n,t){f.moduleExists(t)&&i.push(t)}),i}},disabled:{modules:function(t){var i=[];return t=t||e.modules,n.each(t,function(n,t){f.moduleExists(t)||i.push(t)}),i}},change:{setting:function(t,i,u,o){u="string"==typeof u?"all"===u?e.modules:[u]:u||e.modules;o=o===r||o;n.each(u,function(r,u){var e,s=!f.moduleExists(u)||n.fn[u].settings.namespace||!1;f.moduleExists(u)&&(f.verbose("Changing default setting",t,i,u),n.fn[u].settings[t]=i,o&&s&&(e=n(":data(module-"+s+")"),e.length>0&&(f.verbose("Modifying existing settings",e),e[u]("setting",t,i))))})},settings:function(t,i,u){i="string"==typeof i?[i]:i||e.modules;u=u===r||u;n.each(i,function(i,r){var e;f.moduleExists(r)&&(f.verbose("Changing default setting",t,r),n.extend(!0,n.fn[r].settings,t),u&&a&&(e=n(":data(module-"+a+")"),e.length>0&&(f.verbose("Modifying existing settings",e),e[r]("setting",t))))})}},enable:{console:function(){f.console(!0)},debug:function(n,t){n=n||e.modules;f.debug("Enabling debug for modules",n);f.change.setting("debug",!0,n,t)},verbose:function(n,t){n=n||e.modules;f.debug("Enabling verbose debug for modules",n);f.change.setting("verbose",!0,n,t)}},disable:{console:function(){f.console(!1)},debug:function(n,t){n=n||e.modules;f.debug("Disabling debug for modules",n);f.change.setting("debug",!1,n,t)},verbose:function(n,t){n=n||e.modules;f.debug("Disabling verbose debug for modules",n);f.change.setting("verbose",!1,n,t)}},console:function(n){if(n){if(s.cache.console===r)return void f.error(p.console);f.debug("Restoring console function");t.console=s.cache.console}else f.debug("Disabling console function"),s.cache.console=t.console,t.console={clear:function(){},error:function(){},group:function(){},groupCollapsed:function(){},groupEnd:function(){},info:function(){},log:function(){},markTimeline:function(){},warn:function(){}}},destroy:function(){f.verbose("Destroying previous site for",c);c.removeData(v)},cache:{},setting:function(t,i){if(n.isPlainObject(t))n.extend(!0,e,t);else{if(i===r)return e[t];e[t]=i}},internal:function(t,i){if(n.isPlainObject(t))n.extend(!0,f,t);else{if(i===r)return f[t];f[t]=i}},debug:function(){e.debug&&(e.performance?f.performance.log(arguments):(f.debug=Function.prototype.bind.call(console.info,console,e.name+":"),f.debug.apply(console,arguments)))},verbose:function(){e.verbose&&e.debug&&(e.performance?f.performance.log(arguments):(f.verbose=Function.prototype.bind.call(console.info,console,e.name+":"),f.verbose.apply(console,arguments)))},error:function(){f.error=Function.prototype.bind.call(console.error,console,e.name+":");f.error.apply(console,arguments)},performance:{log:function(n){var t,i,r;e.performance&&(t=(new Date).getTime(),r=l||t,i=t-r,l=t,h.push({Element:w,Name:n[0],Arguments:[].slice.call(n,1)||"","Execution Time":i}));clearTimeout(f.performance.timer);f.performance.timer=setTimeout(f.performance.display,500)},display:function(){var t=e.name+":",i=0;l=!1;clearTimeout(f.performance.timer);n.each(h,function(n,t){i+=t["Execution Time"]});t+=" "+i+"ms";(console.group!==r||console.table!==r)&&h.length>0&&(console.groupCollapsed(t),console.table?console.table(h):n.each(h,function(n,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd());h=[]}},invoke:function(t,i,u){var l,h,c,e=s;return i=i||k,u=w||u,"string"==typeof t&&e!==r&&(t=t.split(/[\. ]/),l=t.length-1,n.each(t,function(i,u){var o=i!=l?u+t[i+1].charAt(0).toUpperCase()+t[i+1].slice(1):t;if(n.isPlainObject(e[o])&&i!=l)e=e[o];else{if(e[o]!==r)return h=e[o],!1;if(!n.isPlainObject(e[u])||i==l)return e[u]!==r?(h=e[u],!1):(f.error(p.method,t),!1);e=e[u]}})),n.isFunction(h)?c=h.apply(u,i):h!==r&&(c=h),n.isArray(o)?o.push(c):o!==r?o=[o,c]:c!==r&&(o=c),h}},b?(s===r&&f.initialize(),f.invoke(y)):(s!==r&&f.destroy(),f.initialize()),o!==r?o:this};n.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:{}}};n.extend(n.expr[":"],{data:n.expr.createPseudo?n.expr.createPseudo(function(t){return function(i){return!!n.data(i,t)}}):function(t,i,r){return!!n.data(t,r[3])}})}(jQuery,window,document),function(n,t,i,r){"use strict";t="undefined"!=typeof t&&t.Math==Math?t:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();n.fn.dropdown=function(u){var f,e=n(this),o=n(i),a=e.selector||"",h="ontouchstart"in i.documentElement,c=(new Date).getTime(),s=[],l=arguments[0],v="string"==typeof l,y=[].slice.call(arguments,1);return e.each(function(p){var ti,pt,bt,ht,kt,ct,wt,w,b=n.isPlainObject(u)?n.extend(!0,{},n.fn.dropdown.settings,u):n.extend({},n.fn.dropdown.settings),k=b.className,at=b.message,ei=b.fields,ft=b.keys,ut=b.metadata,oi=b.namespace,dt=b.regExp,d=b.selector,lt=b.error,ii=b.templates,tt="."+oi,ri="module-"+oi,g=n(this),si=n(b.context),st=g.find(d.text),et=g.find(d.search),gt=g.find(d.sizer),rt=g.find(d.input),hi=g.find(d.icon),ni=g.prev().find(d.text).length>0?g.prev().find(d.text):g.prev(),nt=g.children(d.menu),it=nt.find(d.item),vt=!1,ui=!1,fi=!1,ot=this,yt=g.data(ri);w={initialize:function(){w.debug("Initializing dropdown",b);w.is.alreadySetup()?w.setup.reference():(w.setup.layout(),w.refreshData(),w.save.defaults(),w.restore.selected(),w.create.id(),w.bind.events(),w.observeChanges(),w.instantiate())},instantiate:function(){w.verbose("Storing instance of dropdown",w);yt=w;g.data(ri,w)},destroy:function(){w.verbose("Destroying previous dropdown",g);w.remove.tabbable();g.off(tt).removeData(ri);nt.off(tt);o.off(ht);w.disconnect.menuObserver();w.disconnect.selectObserver()},observeChanges:function(){"MutationObserver"in t&&(ct=new MutationObserver(w.event.select.mutation),wt=new MutationObserver(w.event.menu.mutation),w.debug("Setting up mutation observer",ct,wt),w.observe.select(),w.observe.menu())},disconnect:{menuObserver:function(){wt&&wt.disconnect()},selectObserver:function(){ct&&ct.disconnect()}},observe:{select:function(){w.has.input()&&ct.observe(rt[0],{childList:!0,subtree:!0})},menu:function(){w.has.menu()&&wt.observe(nt[0],{childList:!0,subtree:!0})}},create:{id:function(){kt=(Math.random().toString(16)+"000000000").substr(2,8);ht="."+kt;w.verbose("Creating unique id for element",kt)},userChoice:function(t){var u,i,f;return!!(t=t||w.get.userValues())&&(t=n.isArray(t)?t:[t],n.each(t,function(t,e){w.get.item(e)===!1&&(f=b.templates.addition(w.add.variables(at.addResult,e)),i=n("<div />").html(f).attr("data-"+ut.value,e).attr("data-"+ut.text,e).addClass(k.addition).addClass(k.item),b.hideAdditions&&i.addClass(k.hidden),u=u===r?i:u.add(i),w.verbose("Creating user choices for value",e,i))}),u)},userLabels:function(){var t=w.get.userValues();t&&(w.debug("Adding user labels",t),n.each(t,function(n,t){w.verbose("Adding custom user value");w.add.label(t,t)}))},menu:function(){nt=n("<div />").addClass(k.menu).appendTo(g)},sizer:function(){gt=n("<span />").addClass(k.sizer).insertAfter(et)}},search:function(n){n=n!==r?n:w.get.query();w.verbose("Searching for query",n);w.has.minCharacters(n)?w.filter(n):w.hide()},select:{firstUnfiltered:function(){w.verbose("Selecting first non-filtered element");w.remove.selectedItem();it.not(d.unselectable).not(d.addition+d.hidden).eq(0).addClass(k.selected)},nextAvailable:function(n){n=n.eq(0);var t=n.nextAll(d.item).not(d.unselectable).eq(0),i=n.prevAll(d.item).not(d.unselectable).eq(0),r=t.length>0;r?(w.verbose("Moving selection to",t),t.addClass(k.selected)):(w.verbose("Moving selection to",i),i.addClass(k.selected))}},setup:{api:function(){var n={debug:b.debug,urlData:{value:w.get.value(),query:w.get.query()},on:!1};w.verbose("First request, initializing API");g.api(n)},layout:function(){g.is("select")&&(w.setup.select(),w.setup.returnedObject());w.has.menu()||w.create.menu();w.is.search()&&!w.has.search()&&(w.verbose("Adding search input"),et=n("<input />").addClass(k.search).prop("autocomplete","off").insertBefore(st));w.is.multiple()&&w.is.searchSelection()&&!w.has.sizer()&&w.create.sizer();b.allowTab&&w.set.tabbable()},select:function(){var t=w.get.selectValues();w.debug("Dropdown initialized on a select",t);g.is("select")&&(rt=g);rt.parent(d.dropdown).length>0?(w.debug("UI dropdown already exists. Creating dropdown menu only"),g=rt.closest(d.dropdown),w.has.menu()||w.create.menu(),nt=g.children(d.menu),w.setup.menu(t)):(w.debug("Creating entire dropdown from select"),g=n("<div />").attr("class",rt.attr("class")).addClass(k.selection).addClass(k.dropdown).html(ii.dropdown(t)).insertBefore(rt),rt.hasClass(k.multiple)&&rt.prop("multiple")===!1&&(w.error(lt.missingMultiple),rt.prop("multiple",!0)),rt.is("[multiple]")&&w.set.multiple(),rt.prop("disabled")&&(w.debug("Disabling dropdown"),g.addClass(k.disabled)),rt.removeAttr("class").detach().prependTo(g));w.refresh()},menu:function(n){nt.html(ii.menu(n,ei));it=nt.find(d.item)},reference:function(){w.debug("Dropdown behavior was called on select, replacing with closest dropdown");g=g.parent(d.dropdown);w.refresh();w.setup.returnedObject();v&&(yt=w,w.invoke(l))},returnedObject:function(){var n=e.slice(0,p),t=e.slice(p+1);e=n.add(g).add(t)}},refresh:function(){w.refreshSelectors();w.refreshData()},refreshItems:function(){it=nt.find(d.item)},refreshSelectors:function(){w.verbose("Refreshing selector cache");st=g.find(d.text);et=g.find(d.search);rt=g.find(d.input);hi=g.find(d.icon);ni=g.prev().find(d.text).length>0?g.prev().find(d.text):g.prev();nt=g.children(d.menu);it=nt.find(d.item)},refreshData:function(){w.verbose("Refreshing cached metadata");it.removeData(ut.text).removeData(ut.value)},clearData:function(){w.verbose("Clearing metadata");it.removeData(ut.text).removeData(ut.value);g.removeData(ut.defaultText).removeData(ut.defaultValue).removeData(ut.placeholderText)},toggle:function(){w.verbose("Toggling menu visibility");w.is.active()?w.hide():w.show()},show:function(t){if(t=n.isFunction(t)?t:function(){},w.can.show()&&!w.is.active()){if(w.debug("Showing dropdown"),!w.has.message()||w.has.maxSelections()||w.has.allResultsFiltered()||w.remove.message(),w.is.allFiltered())return!0;b.onShow.call(ot)!==!1&&w.animate.show(function(){w.can.click()&&w.bind.intent();w.has.menuSearch()&&w.focusSearch();w.set.visible();t.call(ot)})}},hide:function(t){t=n.isFunction(t)?t:function(){};w.is.active()&&(w.debug("Hiding dropdown"),b.onHide.call(ot)!==!1&&w.animate.hide(function(){w.remove.visible();t.call(ot)}))},hideOthers:function(){w.verbose("Finding other dropdowns to hide");e.not(g).has(d.menu+"."+k.visible).dropdown("hide")},hideMenu:function(){w.verbose("Hiding menu  instantaneously");w.remove.active();w.remove.visible();nt.transition("hide")},hideSubMenus:function(){var n=nt.children(d.item).find(d.menu);w.verbose("Hiding sub menus",n);n.transition("hide")},bind:{events:function(){h&&w.bind.touchEvents();w.bind.keyboardEvents();w.bind.inputEvents();w.bind.mouseEvents()},touchEvents:function(){w.debug("Touch device detected binding additional touch events");w.is.searchSelection()||w.is.single()&&g.on("touchstart"+tt,w.event.test.toggle);nt.on("touchstart"+tt,d.item,w.event.item.mouseenter)},keyboardEvents:function(){w.verbose("Binding keyboard events");g.on("keydown"+tt,w.event.keydown);w.has.search()&&g.on(w.get.inputEvent()+tt,d.search,w.event.input);w.is.multiple()&&o.on("keydown"+ht,w.event.document.keydown)},inputEvents:function(){w.verbose("Binding input change events");g.on("change"+tt,d.input,w.event.change)},mouseEvents:function(){w.verbose("Binding mouse events");w.is.multiple()&&g.on("click"+tt,d.label,w.event.label.click).on("click"+tt,d.remove,w.event.remove.click);w.is.searchSelection()?(g.on("mousedown"+tt,w.event.mousedown).on("mouseup"+tt,w.event.mouseup).on("mousedown"+tt,d.menu,w.event.menu.mousedown).on("mouseup"+tt,d.menu,w.event.menu.mouseup).on("click"+tt,d.icon,w.event.icon.click).on("focus"+tt,d.search,w.event.search.focus).on("click"+tt,d.search,w.event.search.focus).on("blur"+tt,d.search,w.event.search.blur).on("click"+tt,d.text,w.event.text.focus),w.is.multiple()&&g.on("click"+tt,w.event.click)):("click"==b.on?g.on("click"+tt,d.icon,w.event.icon.click).on("click"+tt,w.event.test.toggle):"hover"==b.on?g.on("mouseenter"+tt,w.delay.show).on("mouseleave"+tt,w.delay.hide):g.on(b.on+tt,w.toggle),g.on("mousedown"+tt,w.event.mousedown).on("mouseup"+tt,w.event.mouseup).on("focus"+tt,w.event.focus).on("blur"+tt,w.event.blur));nt.on("mouseenter"+tt,d.item,w.event.item.mouseenter).on("mouseleave"+tt,d.item,w.event.item.mouseleave).on("click"+tt,d.item,w.event.item.click)},intent:function(){w.verbose("Binding hide intent event to document");h&&o.on("touchstart"+ht,w.event.test.touch).on("touchmove"+ht,w.event.test.touch);o.on("click"+ht,w.event.test.hide)}},unbind:{intent:function(){w.verbose("Removing hide intent event from document");h&&o.off("touchstart"+ht).off("touchmove"+ht);o.off("click"+ht)}},filter:function(n){var t=n!==r?n:w.get.query(),i=function(){w.is.multiple()&&w.filterActive();w.select.firstUnfiltered();w.has.allResultsFiltered()?b.onNoResults.call(ot,t)?b.allowAdditions?b.hideAdditions&&(w.verbose("User addition with no menu, setting empty style"),w.set.empty(),w.hideMenu()):(w.verbose("All items filtered, showing message",t),w.add.message(at.noResults)):(w.verbose("All items filtered, hiding dropdown",t),w.hideMenu()):(w.remove.empty(),w.remove.message());b.allowAdditions&&w.add.userSuggestion(n);w.is.searchSelection()&&w.can.show()&&w.is.focusedOnSearch()&&w.show()};b.useLabels&&w.has.maxSelections()||(b.apiSettings?w.can.useAPI()?w.queryRemote(t,function(){i()}):w.error(lt.noAPI):(w.filterItems(t),i()))},queryRemote:function(t,i){var r={errorDuration:!1,cache:"local",throttle:b.throttle,urlData:{query:t},onError:function(){w.add.message(at.serverError);i()},onFailure:function(){w.add.message(at.serverError);i()},onSuccess:function(n){w.remove.message();w.setup.menu({values:n[ei.remoteValues]});i()}};g.api("get request")||w.setup.api();r=n.extend(!0,{},r,b.apiSettings);g.api("setting",r).api("query")},filterItems:function(t){var u=t!==r?t:w.get.query(),i=null,e=w.escape.regExp(u),f=new RegExp("^"+e,"igm");w.has.query()&&(i=[],w.verbose("Searching for matching values",u),it.each(function(){var t,r,e=n(this);return("both"==b.match||"text"==b.match)&&((t=String(w.get.choiceText(e,!1)),t.search(f)!==-1)||"exact"===b.fullTextSearch&&w.exactSearch(u,t)||b.fullTextSearch===!0&&w.fuzzySearch(u,t))?(i.push(this),!0):("both"==b.match||"value"==b.match)&&((r=String(w.get.choiceValue(e,t)),r.search(f)!==-1)||b.fullTextSearch&&w.fuzzySearch(u,r))?(i.push(this),!0):void 0}));w.debug("Showing only matched items",u);w.remove.filteredItem();i&&it.not(i).addClass(k.filtered)},fuzzySearch:function(n,t){var r=t.length,u=n.length,i,f,e;if(n=n.toLowerCase(),t=t.toLowerCase(),u>r)return!1;if(u===r)return n===t;n:for(i=0,f=0;i<u;i++){for(e=n.charCodeAt(i);f<r;)if(t.charCodeAt(f++)===e)continue n;return!1}return!0},exactSearch:function(n,t){return n=n.toLowerCase(),t=t.toLowerCase(),t.indexOf(n)>-1},filterActive:function(){b.useLabels&&it.filter("."+k.active).addClass(k.filtered)},focusSearch:function(n){w.has.search()&&!w.is.focusedOnSearch()&&(n?(g.off("focus"+tt,d.search),et.focus(),g.on("focus"+tt,d.search,w.event.search.focus)):et.focus())},forceSelection:function(){var t=it.not(k.filtered).filter("."+k.selected).eq(0),i=it.not(k.filtered).filter("."+k.active).eq(0),n=t.length>0?t:i,r=n.length>0;return r?(w.debug("Forcing partial selection to selected item",n),void w.event.item.click.call(n,{},!0)):void(b.allowAdditions?(w.set.selected(w.get.query()),w.remove.searchTerm()):w.remove.searchTerm())},event:{change:function(){fi||(w.debug("Input changed, updating selection"),w.set.selected())},focus:function(){b.showOnFocus&&!vt&&w.is.hidden()&&!pt&&w.show()},blur:function(){pt=i.activeElement===this;vt||pt||(w.remove.activeLabel(),w.hide())},mousedown:function(){w.is.searchSelection()?bt=!0:vt=!0},mouseup:function(){w.is.searchSelection()?bt=!1:vt=!1},click:function(t){var i=n(t.target);i.is(g)&&(w.is.focusedOnSearch()?w.show():w.focusSearch())},search:{focus:function(){vt=!0;w.is.multiple()&&w.remove.activeLabel();b.showOnFocus&&w.search()},blur:function(){pt=i.activeElement===this;bt||ui||pt||(b.forceSelection&&w.forceSelection(),w.hide());bt=!1}},icon:{click:function(){w.toggle()}},text:{focus:function(){vt=!0;w.focusSearch()}},input:function(){(w.is.multiple()||w.is.searchSelection())&&w.set.filtered();clearTimeout(w.timer);w.timer=setTimeout(w.search,b.delay.search)},label:{click:function(t){var i=n(this),u=g.find(d.label),r=u.filter("."+k.active),f=i.nextAll("."+k.active),e=i.prevAll("."+k.active),o=f.length>0?i.nextUntil(f).add(r).add(i):i.prevUntil(e).add(r).add(i);t.shiftKey?(r.removeClass(k.active),o.addClass(k.active)):t.ctrlKey?i.toggleClass(k.active):(r.removeClass(k.active),i.addClass(k.active));b.onLabelSelect.apply(this,u.filter("."+k.active))}},remove:{click:function(){var t=n(this).parent();t.hasClass(k.active)?w.remove.activeLabels():w.remove.activeLabels(t)}},test:{toggle:function(n){var t=w.is.multiple()?w.show:w.toggle;w.is.bubbledLabelClick(n)||w.is.bubbledIconClick(n)||w.determine.eventOnElement(n,t)&&n.preventDefault()},touch:function(n){w.determine.eventOnElement(n,function(){"touchstart"==n.type?w.timer=setTimeout(function(){w.hide()},b.delay.touch):"touchmove"==n.type&&clearTimeout(w.timer)});n.stopPropagation()},hide:function(n){w.determine.eventInModule(n,w.hide)}},select:{mutation:function(){w.debug("<select> modified, recreating menu");w.setup.select()}},menu:{mutation:function(t){var i=t[0],u=n(i.addedNodes?i.addedNodes[0]:!1),f=n(i.removedNodes?i.removedNodes[0]:!1),r=u.add(f),e=r.is(d.addition)||r.closest(d.addition).length>0,o=r.is(d.message)||r.closest(d.message).length>0;e||o?(w.debug("Updating item selector cache"),w.refreshItems()):(w.debug("Menu modified, updating selector cache"),w.refresh())},mousedown:function(){ui=!0},mouseup:function(){ui=!1}},item:{mouseenter:function(t){var u=n(t.target),r=n(this),i=r.children(d.menu),f=r.siblings(d.item).children(d.menu),e=i.length>0,o=i.find(u).length>0;!o&&e&&(clearTimeout(w.itemTimer),w.itemTimer=setTimeout(function(){w.verbose("Showing sub-menu",i);n.each(f,function(){w.animate.hide(!1,n(this))});w.animate.show(!1,i)},b.delay.show),t.preventDefault())},mouseleave:function(){var t=n(this).children(d.menu);t.length>0&&(clearTimeout(w.itemTimer),w.itemTimer=setTimeout(function(){w.verbose("Hiding sub-menu",t);w.animate.hide(!1,t)},b.delay.hide))},click:function(t,i){var r=n(this),e=n(t?t.target:""),u=r.find(d.menu),f=w.get.choiceText(r),o=w.get.choiceValue(r,f),s=u.length>0,h=u.find(e).length>0;h||s&&!b.allowCategorySelection||(w.is.searchSelection()&&(b.allowAdditions&&w.remove.userAddition(),w.remove.searchTerm(),w.is.focusedOnSearch()||1==i||w.focusSearch(!0)),b.useLabels||(w.remove.filteredItem(),w.set.scrollPosition(r)),w.determine.selectAction.call(this,f,o))}},document:{keydown:function(n){var u=n.which,a=w.is.inObject(u,ft);if(a){var i=g.find(d.label),t=i.filter("."+k.active),o=(t.data(ut.value),i.index(t)),v=i.length,r=t.length>0,s=t.length>1,y=0===o,h=o+1==v,e=w.is.searchSelection(),f=w.is.focusedOnSearch(),c=w.is.focused(),l=f&&0===w.get.caretPosition();if(e&&!r&&!f)return;u==ft.leftArrow?!c&&!l||r?r&&(n.shiftKey?w.verbose("Adding previous label to selection"):(w.verbose("Selecting previous label"),i.removeClass(k.active)),y&&!s?t.addClass(k.active):t.prev(d.siblingLabel).addClass(k.active).end(),n.preventDefault()):(w.verbose("Selecting previous label"),i.last().addClass(k.active)):u==ft.rightArrow?(c&&!r&&i.first().addClass(k.active),r&&(n.shiftKey?w.verbose("Adding next label to selection"):(w.verbose("Selecting next label"),i.removeClass(k.active)),h?e?f?i.removeClass(k.active):w.focusSearch():s?t.next(d.siblingLabel).addClass(k.active):t.addClass(k.active):t.next(d.siblingLabel).addClass(k.active),n.preventDefault())):u==ft.deleteKey||u==ft.backspace?r?(w.verbose("Removing active labels"),h&&e&&!f&&w.focusSearch(),t.last().next(d.siblingLabel).addClass(k.active),w.remove.activeLabels(t),n.preventDefault()):l&&!r&&u==ft.backspace&&(w.verbose("Removing last label on input backspace"),t=i.last().addClass(k.active),w.remove.activeLabels(t)):t.removeClass(k.active)}}},keydown:function(n){var t=n.which,v=w.is.inObject(t,ft);if(v){var r,s,h=it.not(d.unselectable).filter("."+k.selected).eq(0),y=nt.children("."+k.active).eq(0),i=h.length>0?h:y,p=i.length>0?i.siblings(":not(."+k.filtered+")").addBack():nt.children(":not(."+k.filtered+")"),e=i.children(d.menu),u=i.closest(d.menu),c=u.hasClass(k.visible)||u.hasClass(k.animating)||u.parent(d.menu).length>0,l=e.length>0,f=i.length>0,a=i.not(d.unselectable).length>0,o=t==ft.delimiter&&b.allowAdditions&&w.is.multiple(),g=b.allowAdditions&&b.hideAdditions&&(t==ft.enter||o)&&a;if(g&&(w.verbose("Selecting item from keyboard shortcut",i),w.event.item.click.call(i,n),w.is.searchSelection()&&w.remove.searchTerm()),w.is.visible()){if((t==ft.enter||o)&&(t==ft.enter&&f&&l&&!b.allowCategorySelection?(w.verbose("Pressed enter on unselectable category, opening sub menu"),t=ft.rightArrow):a&&(w.verbose("Selecting item from keyboard shortcut",i),w.event.item.click.call(i,n),w.is.searchSelection()&&w.remove.searchTerm()),n.preventDefault()),f&&(t==ft.leftArrow&&(s=u[0]!==nt[0],s&&(w.verbose("Left key pressed, closing sub-menu"),w.animate.hide(!1,u),i.removeClass(k.selected),u.closest(d.item).addClass(k.selected),n.preventDefault())),t==ft.rightArrow&&l&&(w.verbose("Right key pressed, opening sub-menu"),w.animate.show(!1,e),i.removeClass(k.selected),e.find(d.item).eq(0).addClass(k.selected),n.preventDefault())),t==ft.upArrow){if(r=f&&c?i.prevAll(d.item+":not("+d.unselectable+")").eq(0):it.eq(0),p.index(r)<0)return w.verbose("Up key pressed but reached top of current menu"),void n.preventDefault();w.verbose("Up key pressed, changing active item");i.removeClass(k.selected);r.addClass(k.selected);w.set.scrollPosition(r);b.selectOnKeydown&&w.is.single()&&w.set.selectedItem(r);n.preventDefault()}if(t==ft.downArrow){if(r=f&&c?r=i.nextAll(d.item+":not("+d.unselectable+")").eq(0):it.eq(0),0===r.length)return w.verbose("Down key pressed but reached bottom of current menu"),void n.preventDefault();w.verbose("Down key pressed, changing active item");it.removeClass(k.selected);r.addClass(k.selected);w.set.scrollPosition(r);b.selectOnKeydown&&w.is.single()&&w.set.selectedItem(r);n.preventDefault()}t==ft.pageUp&&(w.scrollPage("up"),n.preventDefault());t==ft.pageDown&&(w.scrollPage("down"),n.preventDefault());t==ft.escape&&(w.verbose("Escape key pressed, closing dropdown"),w.hide())}else o&&n.preventDefault(),t!=ft.downArrow||w.is.visible()||(w.verbose("Down key pressed, showing dropdown"),w.select.firstUnfiltered(),w.show(),n.preventDefault())}else w.has.search()||w.set.selectedLetter(String.fromCharCode(t))}},trigger:{change:function(){var n=i.createEvent("HTMLEvents"),t=rt[0];t&&(w.verbose("Triggering native change event"),n.initEvent("change",!0,!1),t.dispatchEvent(n))}},determine:{selectAction:function(t,i){w.verbose("Determining action",b.action);n.isFunction(w.action[b.action])?(w.verbose("Triggering preset action",b.action,t,i),w.action[b.action].call(ot,t,i,this)):n.isFunction(b.action)?(w.verbose("Triggering user action",b.action,t,i),b.action.call(ot,t,i,this)):w.error(lt.action,b.action)},eventInModule:function(t,r){var u=n(t.target),f=u.closest(i.documentElement).length>0,e=u.closest(g).length>0;return r=n.isFunction(r)?r:function(){},f&&!e?(w.verbose("Triggering event",r),r(),!0):(w.verbose("Event occurred in dropdown, canceling callback"),!1)},eventOnElement:function(t,r){var u=n(t.target),f=u.closest(d.siblingLabel),e=i.body.contains(t.target),o=0===g.find(f).length,s=0===u.closest(nt).length;return r=n.isFunction(r)?r:function(){},e&&o&&s?(w.verbose("Triggering event",r),r(),!0):(w.verbose("Event occurred in dropdown menu, canceling callback"),!1)}},action:{nothing:function(){},activate:function(t,i,u){if(i=i!==r?i:t,w.can.activate(n(u))){if(w.set.selected(i,n(u)),w.is.multiple()&&!w.is.allFiltered())return;w.hideAndClear()}},select:function(t,i,u){if(i=i!==r?i:t,w.can.activate(n(u))){if(w.set.value(i,n(u)),w.is.multiple()&&!w.is.allFiltered())return;w.hideAndClear()}},combo:function(t,i,u){i=i!==r?i:t;w.set.selected(i,n(u));w.hideAndClear()},hide:function(n,t){w.set.value(t,n);w.hideAndClear()}},get:{id:function(){return kt},defaultText:function(){return g.data(ut.defaultText)},defaultValue:function(){return g.data(ut.defaultValue)},placeholderText:function(){return g.data(ut.placeholderText)||""},text:function(){return st.text()},query:function(){return n.trim(et.val())},searchWidth:function(n){return n=n!==r?n:et.val(),gt.text(n),Math.ceil(gt.width()+1)},selectionCount:function(){var t=w.get.values();return w.is.multiple()?n.isArray(t)?t.length:0:""!==w.get.value()?1:0},transition:function(n){return"auto"==b.transition?w.is.upward(n)?"slide up":"slide down":b.transition},userValues:function(){var t=w.get.values();return!!t&&(t=n.isArray(t)?t:[t],n.grep(t,function(n){return w.get.item(n)===!1}))},uniqueArray:function(t){return n.grep(t,function(i,r){return n.inArray(i,t)===r})},caretPosition:function(){var n,r,t=et.get(0);return"selectionStart"in t?t.selectionStart:i.selection?(t.focus(),n=i.selection.createRange(),r=n.text.length,n.moveStart("character",-t.value.length),n.text.length-r):void 0},value:function(){var t=rt.length>0?rt.val():g.data(ut.value),i=n.isArray(t)&&1===t.length&&""===t[0];return t===r||i?"":t},values:function(){var n=w.get.value();return""===n?"":!w.has.selectInput()&&w.is.multiple()?"string"==typeof n?n.split(b.delimiter):"":n},remoteValues:function(){var t=w.get.values(),i=!1;return t&&("string"==typeof t&&(t=[t]),n.each(t,function(n,t){var r=w.read.remoteData(t);w.verbose("Restoring value from session data",r,t);r&&(i||(i={}),i[t]=r)})),i},choiceText:function(t,i){if(i=i!==r?i:b.preserveHTML,t)return t.find(d.menu).length>0&&(w.verbose("Retrieving text of element with sub-menu"),t=t.clone(),t.find(d.menu).remove(),t.find(d.menuIcon).remove()),t.data(ut.text)!==r?t.data(ut.text):i?n.trim(t.html()):n.trim(t.text())},choiceValue:function(t,i){return i=i||w.get.choiceText(t),!!t&&(t.data(ut.value)!==r?String(t.data(ut.value)):"string"==typeof i?n.trim(i.toLowerCase()):String(i))},inputEvent:function(){var n=et[0];return!!n&&(n.oninput!==r?"input":n.onpropertychange!==r?"propertychange":"keyup")},selectValues:function(){var t={};return t.values=[],g.find("option").each(function(){var i=n(this),u=i.html(),e=i.attr("disabled"),f=i.attr("value")!==r?i.attr("value"):u;"auto"===b.placeholder&&""===f?t.placeholder=u:t.values.push({name:u,value:f,disabled:e})}),b.placeholder&&"auto"!==b.placeholder&&(w.debug("Setting placeholder value to",b.placeholder),t.placeholder=b.placeholder),b.sortSelect?(t.values.sort(function(n,t){return n.name>t.name?1:-1}),w.debug("Retrieved and sorted values from select",t)):w.debug("Retrieved values from select",t),t},activeItem:function(){return it.filter("."+k.active)},selectedItem:function(){var n=it.not(d.unselectable).filter("."+k.selected);return n.length>0?n:it.eq(0)},itemWithAdditions:function(n){var t=w.get.item(n),i=w.create.userChoice(n),r=i&&i.length>0;return r&&(t=t.length>0?t.add(i):i),t},item:function(t,i){var e,f,u=!1;return t=t!==r?t:w.get.values()!==r?w.get.values():w.get.text(),e=f?t.length>0:t!==r&&null!==t,f=w.is.multiple()&&n.isArray(t),i=""===t||0===t||i||!1,e&&it.each(function(){var e=n(this),s=w.get.choiceText(e),o=w.get.choiceValue(e,s);if(null!==o&&o!==r)if(f)n.inArray(String(o),t)===-1&&n.inArray(s,t)===-1||(u=u?u.add(e):e);else if(i){if(w.verbose("Ambiguous dropdown value using strict type check",e,t),o===t||s===t)return u=e,!0}else if(String(o)==String(t)||s==t)return w.verbose("Found select item by value",o,t),u=e,!0}),u}},check:{maxSelections:function(n){return!b.maxSelections||(n=n!==r?n:w.get.selectionCount(),n>=b.maxSelections?(w.debug("Maximum selection count reached"),b.useLabels&&(it.addClass(k.filtered),w.add.message(at.maxSelections)),!0):(w.verbose("No longer at maximum selection count"),w.remove.message(),w.remove.filteredItem(),w.is.searchSelection()&&w.filterItems(),!1))}},restore:{defaults:function(){w.clear();w.restore.defaultText();w.restore.defaultValue()},defaultText:function(){var n=w.get.defaultText(),t=w.get.placeholderText;n===t?(w.debug("Restoring default placeholder text",n),w.set.placeholderText(n)):(w.debug("Restoring default text",n),w.set.text(n))},placeholderText:function(){w.set.placeholderText()},defaultValue:function(){var n=w.get.defaultValue();n!==r&&(w.debug("Restoring default value",n),""!==n?(w.set.value(n),w.set.selected()):(w.remove.activeItem(),w.remove.selectedItem()))},labels:function(){b.allowAdditions&&(b.useLabels||(w.error(lt.labels),b.useLabels=!0),w.debug("Restoring selected values"),w.create.userLabels());w.check.maxSelections()},selected:function(){w.restore.values();w.is.multiple()?(w.debug("Restoring previously selected values and labels"),w.restore.labels()):w.debug("Restoring previously selected values")},values:function(){w.set.initialLoad();b.apiSettings&&b.saveRemoteData&&w.get.remoteValues()?w.restore.remoteValues():w.set.selected();w.remove.initialLoad()},remoteValues:function(){var t=w.get.remoteValues();w.debug("Recreating selected from session data",t);t&&(w.is.single()?n.each(t,function(n,t){w.set.text(t)}):n.each(t,function(n,t){w.add.label(n,t)}))}},read:{remoteData:function(n){var i;return t.Storage===r?void w.error(lt.noStorage):(i=sessionStorage.getItem(n),i!==r&&i)}},save:{defaults:function(){w.save.defaultText();w.save.placeholderText();w.save.defaultValue()},defaultValue:function(){var n=w.get.value();w.verbose("Saving default value as",n);g.data(ut.defaultValue,n)},defaultText:function(){var n=w.get.text();w.verbose("Saving default text as",n);g.data(ut.defaultText,n)},placeholderText:function(){var n;b.placeholder!==!1&&st.hasClass(k.placeholder)&&(n=w.get.text(),w.verbose("Saving placeholder text as",n),g.data(ut.placeholderText,n))},remoteData:function(n,i){return t.Storage===r?void w.error(lt.noStorage):(w.verbose("Saving remote data to session storage",i,n),void sessionStorage.setItem(i,n))}},clear:function(){w.is.multiple()&&b.useLabels?w.remove.labels():(w.remove.activeItem(),w.remove.selectedItem());w.set.placeholderText();w.clearValue()},clearValue:function(){w.set.value("")},scrollPage:function(n,t){var h,r,u,f=t||w.get.selectedItem(),e=f.closest(d.menu),l=e.outerHeight(),c=e.scrollTop(),s=it.eq(0).outerHeight(),o=Math.floor(l/s),a=(e.prop("scrollHeight"),"up"==n?c-s*o:c+s*o),i=it.not(d.unselectable);u="up"==n?i.index(f)-o:i.index(f)+o;h="up"==n?u>=0:u<i.length;r=h?i.eq(u):"up"==n?i.first():i.last();r.length>0&&(w.debug("Scrolling page",n,r),f.removeClass(k.selected),r.addClass(k.selected),b.selectOnKeydown&&w.is.single()&&w.set.selectedItem(r),e.scrollTop(a))},set:{filtered:function(){var n=w.is.multiple(),i=w.is.searchSelection(),r=n&&i,t=i?w.get.query():"",u="string"==typeof t&&t.length>0,f=w.get.searchWidth(),e=""!==t;n&&u&&(w.verbose("Adjusting input width",f,b.glyphWidth),et.css("width",f));u||r&&e?(w.verbose("Hiding placeholder text"),st.addClass(k.filtered)):(!n||r&&!e)&&(w.verbose("Showing placeholder text"),st.removeClass(k.filtered))},empty:function(){g.addClass(k.empty)},loading:function(){g.addClass(k.loading)},placeholderText:function(n){n=n||w.get.placeholderText();w.debug("Setting placeholder text",n);w.set.text(n);st.addClass(k.placeholder)},tabbable:function(){w.has.search()?(w.debug("Added tabindex to searchable dropdown"),et.val("").attr("tabindex",0),nt.attr("tabindex",-1)):(w.debug("Added tabindex to dropdown"),g.attr("tabindex")===r&&(g.attr("tabindex",0),nt.attr("tabindex",-1)))},initialLoad:function(){w.verbose("Setting initial load");ti=!0},activeItem:function(n){b.allowAdditions&&n.filter(d.addition).length>0?n.addClass(k.filtered):n.addClass(k.active)},partialSearch:function(n){var t=w.get.query().length;et.val(n.substr(0,t))},scrollPosition:function(n,t){var i,o,u,e,s,f,h,c,l,a=5;n=n||w.get.selectedItem();i=n.closest(d.menu);o=n&&n.length>0;t=t!==r&&t;n&&i.length>0&&o&&(e=n.position().top,i.addClass(k.loading),f=i.scrollTop(),s=i.offset().top,e=n.offset().top,u=f-s+e,t||(h=i.height(),l=f+h<u+a,c=u-a<f),w.debug("Scrolling to active item",u),(t||c||l)&&i.scrollTop(u),i.removeClass(k.loading))},text:function(n){"select"!==b.action&&("combo"==b.action?(w.debug("Changing combo button text",n,ni),b.preserveHTML?ni.html(n):ni.text(n)):(n!==w.get.placeholderText()&&st.removeClass(k.placeholder),w.debug("Changing text",n,st),st.removeClass(k.filtered),b.preserveHTML?st.html(n):st.text(n)))},selectedItem:function(n){var i=w.get.choiceValue(n),t=w.get.choiceText(n,!1);w.debug("Setting user selection to item",n);w.remove.activeItem();w.set.partialSearch(t);w.set.activeItem(n);w.set.selected(i,n);w.set.text(t)},selectedLetter:function(t){var u,r=it.filter("."+k.selected),f=r.length>0&&w.has.firstLetter(r,t),i=!1;f&&(u=r.nextAll(it).eq(0),w.has.firstLetter(u,t)&&(i=u));i||it.each(function(){if(w.has.firstLetter(n(this),t))return i=n(this),!1});i&&(w.verbose("Scrolling to next value with letter",t),w.set.scrollPosition(i),r.removeClass(k.selected),i.addClass(k.selected),b.selectOnKeydown&&w.is.single()&&w.set.selectedItem(i))},direction:function(n){"auto"==b.direction?w.is.onScreen(n)?w.remove.upward(n):w.set.upward(n):"upward"==b.direction&&w.set.upward(n)},upward:function(n){var t=n||g;t.addClass(k.upward)},value:function(n,t,i){var u=w.escape.value(n),o=rt.length>0,f=(!w.has.value(n),w.get.values()),e=n!==r?String(n):n;if(o){if(!b.allowReselection&&e==f&&(w.verbose("Skipping value update already same value",n,f),!w.is.initialLoad()))return;w.is.single()&&w.has.selectInput()&&w.can.extendSelect()&&(w.debug("Adding user option",n),w.add.optionValue(n));w.debug("Updating input value",u,f);fi=!0;rt.val(u);b.fireOnInit===!1&&w.is.initialLoad()?w.debug("Input native change event ignored on initial load"):w.trigger.change();fi=!1}else w.verbose("Storing value in metadata",u,rt),u!==f&&g.data(ut.value,e);b.fireOnInit===!1&&w.is.initialLoad()?w.verbose("No callback on initial load",b.onChange):b.onChange.call(ot,n,t,i)},active:function(){g.addClass(k.active)},multiple:function(){g.addClass(k.multiple)},visible:function(){g.addClass(k.visible)},exactly:function(n,t){w.debug("Setting selected to exact values");w.clear();w.set.selected(n,t)},selected:function(t,i){var r=w.is.multiple();i=b.allowAdditions?i||w.get.itemWithAdditions(t):i||w.get.item(t);i&&(w.debug("Setting selected menu item to",i),w.is.multiple()&&w.remove.searchWidth(),w.is.single()?(w.remove.activeItem(),w.remove.selectedItem()):b.useLabels&&w.remove.selectedItem(),i.each(function(){var t=n(this),u=w.get.choiceText(t),f=w.get.choiceValue(t,u),e=t.hasClass(k.filtered),o=t.hasClass(k.active),s=t.hasClass(k.addition),h=r&&1==i.length;r?!o||s?(b.apiSettings&&b.saveRemoteData&&w.save.remoteData(u,f),b.useLabels?(w.add.value(f,u,t),w.add.label(f,u,h),w.set.activeItem(t),w.filterActive(),w.select.nextAvailable(i)):(w.add.value(f,u,t),w.set.text(w.add.variables(at.count)),w.set.activeItem(t))):e||(w.debug("Selected active value, removing label"),w.remove.selected(f)):(b.apiSettings&&b.saveRemoteData&&w.save.remoteData(u,f),w.set.text(u),w.set.value(f,u,t),t.addClass(k.active).addClass(k.selected))}))}},add:{label:function(t,i,r){var u,e=w.is.searchSelection()?et:st,f=w.escape.value(t);return u=n("<a />").addClass(k.label).attr("data-value",f).html(ii.label(f,i)),u=b.onLabelCreate.call(u,f,i),w.has.label(t)?void w.debug("Label already exists, skipping",f):(b.label.variation&&u.addClass(b.label.variation),void(r===!0?(w.debug("Animating in label",u),u.addClass(k.hidden).insertBefore(e).transition(b.label.transition,b.label.duration)):(w.debug("Adding selection label",u),u.insertBefore(e))))},message:function(t){var i=nt.children(d.message),r=b.templates.message(w.add.variables(t));i.length>0?i.html(r):i=n("<div/>").html(r).addClass(k.message).appendTo(nt)},optionValue:function(t){var i=w.escape.value(t),r=rt.find('option[value="'+i+'"]'),u=r.length>0;u||(w.disconnect.selectObserver(),w.is.single()&&(w.verbose("Removing previous user addition"),rt.find("option."+k.addition).remove()),n("<option/>").prop("value",i).addClass(k.addition).html(t).appendTo(rt),w.verbose("Adding user addition as an <option>",t),w.observe.select())},userSuggestion:function(n){var i,t=nt.children(d.addition),r=w.get.item(n),u=r&&r.not(d.addition).length,f=t.length>0;if(!b.useLabels||!w.has.maxSelections()){if(""===n||u)return void t.remove();f?(t.data(ut.value,n).data(ut.text,n).attr("data-"+ut.value,n).attr("data-"+ut.text,n).removeClass(k.filtered),b.hideAdditions||(i=b.templates.addition(w.add.variables(at.addResult,n)),t.html(i)),w.verbose("Replacing user suggestion with new value",t)):(t=w.create.userChoice(n),t.prependTo(nt),w.verbose("Adding item choice to menu corresponding with user choice addition",t));b.hideAdditions&&!w.is.allFiltered()||t.addClass(k.selected).siblings().removeClass(k.selected);w.refreshItems()}},variables:function(n,t){var i,r,u=n.search("{count}")!==-1,f=n.search("{maxCount}")!==-1,e=n.search("{term}")!==-1;return w.verbose("Adding templated variables to message",n),u&&(i=w.get.selectionCount(),n=n.replace("{count}",i)),f&&(i=w.get.selectionCount(),n=n.replace("{maxCount}",b.maxSelections)),e&&(r=t||w.get.query(),n=n.replace("{term}",r)),n},value:function(t,i,r){var u,f=w.get.values();return""===t?void w.debug("Cannot select blank values from multiselect"):(n.isArray(f)?(u=f.concat([t]),u=w.get.uniqueArray(u)):u=[t],w.has.selectInput()?w.can.extendSelect()&&(w.debug("Adding value to select",t,u,rt),w.add.optionValue(t)):(u=u.join(b.delimiter),w.debug("Setting hidden input to delimited value",u,rt)),b.fireOnInit===!1&&w.is.initialLoad()?w.verbose("Skipping onadd callback on initial load",b.onAdd):b.onAdd.call(ot,t,i,r),w.set.value(u,t,i,r),void w.check.maxSelections())}},remove:{active:function(){g.removeClass(k.active)},activeLabel:function(){g.find(d.label).removeClass(k.active)},empty:function(){g.removeClass(k.empty)},loading:function(){g.removeClass(k.loading)},initialLoad:function(){ti=!1},upward:function(n){var t=n||g;t.removeClass(k.upward)},visible:function(){g.removeClass(k.visible)},activeItem:function(){it.removeClass(k.active)},filteredItem:function(){b.useLabels&&w.has.maxSelections()||(b.useLabels&&w.is.multiple()?it.not("."+k.active).removeClass(k.filtered):it.removeClass(k.filtered),w.remove.empty())},optionValue:function(n){var i=w.escape.value(n),t=rt.find('option[value="'+i+'"]'),r=t.length>0;r&&t.hasClass(k.addition)&&(ct&&(ct.disconnect(),w.verbose("Temporarily disconnecting mutation observer")),t.remove(),w.verbose("Removing user addition as an <option>",i),ct&&ct.observe(rt[0],{childList:!0,subtree:!0}))},message:function(){nt.children(d.message).remove()},searchWidth:function(){et.css("width","")},searchTerm:function(){w.verbose("Cleared search term");et.val("");w.set.filtered()},userAddition:function(){it.filter(d.addition).remove()},selected:function(t,i){return!!(i=b.allowAdditions?i||w.get.itemWithAdditions(t):i||w.get.item(t))&&void i.each(function(){var t=n(this),i=w.get.choiceText(t),r=w.get.choiceValue(t,i);w.is.multiple()?b.useLabels?(w.remove.value(r,i,t),w.remove.label(r)):(w.remove.value(r,i,t),0===w.get.selectionCount()?w.set.placeholderText():w.set.text(w.add.variables(at.count))):w.remove.value(r,i,t);t.removeClass(k.filtered).removeClass(k.active);b.useLabels&&t.removeClass(k.selected)})},selectedItem:function(){it.removeClass(k.selected)},value:function(n,t,i){var r,u=w.get.values();w.has.selectInput()?(w.verbose("Input is <select> removing selected option",n),r=w.remove.arrayValue(n,u),w.remove.optionValue(n)):(w.verbose("Removing from delimited values",n),r=w.remove.arrayValue(n,u),r=r.join(b.delimiter));b.fireOnInit===!1&&w.is.initialLoad()?w.verbose("No callback on initial load",b.onRemove):b.onRemove.call(ot,n,t,i);w.set.value(r,t,i);w.check.maxSelections()},arrayValue:function(t,i){return n.isArray(i)||(i=[i]),i=n.grep(i,function(n){return t!=n}),w.verbose("Removed value from delimited string",t,i),i},label:function(n){var i=g.find(d.label),t=i.filter('[data-value="'+n+'"]');w.verbose("Removing label",t);t.remove()},activeLabels:function(n){n=n||g.find(d.label).filter("."+k.active);w.verbose("Removing active label selections",n);w.remove.labels(n)},labels:function(t){t=t||g.find(d.label);w.verbose("Removing labels",t);t.each(function(){var u=n(this),t=u.data(ut.value),i=t!==r?String(t):t,f=w.is.userValue(i);return b.onLabelRemove.call(u,t)===!1?void w.debug("Label remove callback cancelled removal"):(w.remove.message(),void(f?(w.remove.value(i),w.remove.label(i)):w.remove.selected(i)))})},tabbable:function(){w.has.search()?(w.debug("Searchable dropdown initialized"),et.removeAttr("tabindex"),nt.removeAttr("tabindex")):(w.debug("Simple selection dropdown initialized"),g.removeAttr("tabindex"),nt.removeAttr("tabindex"))}},has:{menuSearch:function(){return w.has.search()&&et.closest(nt).length>0},search:function(){return et.length>0},sizer:function(){return gt.length>0},selectInput:function(){return rt.is("select")},minCharacters:function(n){return!b.minCharacters||(n=n!==r?String(n):String(w.get.query()),n.length>=b.minCharacters)},firstLetter:function(n,t){var i,r;return!(!n||0===n.length||"string"!=typeof t)&&(i=w.get.choiceText(n,!1),t=t.toLowerCase(),r=String(i).charAt(0).toLowerCase(),t==r)},input:function(){return rt.length>0},items:function(){return it.length>0},menu:function(){return nt.length>0},message:function(){return 0!==nt.children(d.message).length},label:function(n){var t=w.escape.value(n),i=g.find(d.label);return i.filter('[data-value="'+t+'"]').length>0},maxSelections:function(){return b.maxSelections&&w.get.selectionCount()>=b.maxSelections},allResultsFiltered:function(){var n=it.not(d.addition);return n.filter(d.unselectable).length===n.length},userSuggestion:function(){return nt.children(d.addition).length>0},query:function(){return""!==w.get.query()},value:function(t){var i=w.get.values(),r=n.isArray(i)?i&&n.inArray(t,i)!==-1:i==t;return!!r}},is:{active:function(){return g.hasClass(k.active)},bubbledLabelClick:function(t){return n(t.target).is("select, input")&&g.closest("label").length>0},bubbledIconClick:function(t){return n(t.target).closest(hi).length>0},alreadySetup:function(){return g.is("select")&&g.parent(d.dropdown).length>0&&0===g.prev().length},animating:function(n){return n?n.transition&&n.transition("is animating"):nt.transition&&nt.transition("is animating")},disabled:function(){return g.hasClass(k.disabled)},focused:function(){return i.activeElement===g[0]},focusedOnSearch:function(){return i.activeElement===et[0]},allFiltered:function(){return(w.is.multiple()||w.has.search())&&!(0==b.hideAdditions&&w.has.userSuggestion())&&!w.has.message()&&w.has.allResultsFiltered()},hidden:function(n){return!w.is.visible(n)},initialLoad:function(){return ti},onScreen:function(n){var t,r=n||nt,u=!0,i={};return r.addClass(k.loading),t={context:{scrollTop:si.scrollTop(),height:si.outerHeight()},menu:{offset:r.offset(),height:r.outerHeight()}},i={above:t.context.scrollTop<=t.menu.offset.top-t.menu.height,below:t.context.scrollTop+t.context.height>=t.menu.offset.top+t.menu.height},i.below?(w.verbose("Dropdown can fit in context downward",i),u=!0):i.below||i.above?(w.verbose("Dropdown cannot fit below, opening upward",i),u=!1):(w.verbose("Dropdown cannot fit in either direction, favoring downward",i),u=!0),r.removeClass(k.loading),u},inObject:function(t,i){var r=!1;return n.each(i,function(n,i){if(i==t)return r=!0,!0}),r},multiple:function(){return g.hasClass(k.multiple)},single:function(){return!w.is.multiple()},selectMutation:function(t){var i=!1;return n.each(t,function(t,r){if(r.target&&n(r.target).is("select"))return i=!0,!0}),i},search:function(){return g.hasClass(k.search)},searchSelection:function(){return w.has.search()&&1===et.parent(d.dropdown).length},selection:function(){return g.hasClass(k.selection)},userValue:function(t){return n.inArray(t,w.get.userValues())!==-1},upward:function(n){var t=n||g;return t.hasClass(k.upward)},visible:function(n){return n?n.hasClass(k.visible):nt.hasClass(k.visible)}},can:{activate:function(n){return!!b.useLabels||!w.has.maxSelections()||!(!w.has.maxSelections()||!n.hasClass(k.active))},click:function(){return h||"click"==b.on},extendSelect:function(){return b.allowAdditions||b.apiSettings},show:function(){return!w.is.disabled()&&(w.has.items()||w.has.message())},useAPI:function(){return n.fn.api!==r}},animate:{show:function(t,i){var f,u=i||nt,e=i?function(){}:function(){w.hideSubMenus();w.hideOthers();w.set.active()};t=n.isFunction(t)?t:function(){};w.verbose("Doing menu show animation",u);w.set.direction(i);f=w.get.transition(i);w.is.selection()&&w.set.scrollPosition(w.get.selectedItem(),!0);(w.is.hidden(u)||w.is.animating(u))&&("none"==f?(e(),u.transition("show"),t.call(ot)):n.fn.transition!==r&&g.transition("is supported")?u.transition({animation:f+" in",debug:b.debug,verbose:b.verbose,duration:b.duration,queue:!0,onStart:e,onComplete:function(){t.call(ot)}}):w.error(lt.noTransition,f))},hide:function(t,i){var u=i||nt,f=(i?.9*b.duration:b.duration,i?function(){}:function(){w.can.click()&&w.unbind.intent();w.remove.active()}),e=w.get.transition(i);t=n.isFunction(t)?t:function(){};(w.is.visible(u)||w.is.animating(u))&&(w.verbose("Doing menu hide animation",u),"none"==e?(f(),u.transition("hide"),t.call(ot)):n.fn.transition!==r&&g.transition("is supported")?u.transition({animation:e+" out",duration:b.duration,debug:b.debug,verbose:b.verbose,queue:!0,onStart:f,onComplete:function(){"auto"==b.direction&&w.remove.upward(i);t.call(ot)}}):w.error(lt.transition))}},hideAndClear:function(){w.remove.searchTerm();w.has.maxSelections()||(w.has.search()?w.hide(function(){w.remove.filteredItem()}):w.hide())},delay:{show:function(){w.verbose("Delaying show event to ensure user intent");clearTimeout(w.timer);w.timer=setTimeout(w.show,b.delay.show)},hide:function(){w.verbose("Delaying hide event to ensure user intent");clearTimeout(w.timer);w.timer=setTimeout(w.hide,b.delay.hide)}},escape:{value:function(t){var i=n.isArray(t),r="string"==typeof t,f=!r&&!i,e=r&&t.search(dt.quote)!==-1,u=[];return w.has.selectInput()&&!f&&e?(w.debug("Encoding quote values for use in select",t),i?(n.each(t,function(n,t){u.push(t.replace(dt.quote,"&quot;"))}),u):t.replace(dt.quote,"&quot;")):t},regExp:function(n){return n=String(n),n.replace(dt.escape,"\\$&")}},setting:function(t,i){if(w.debug("Changing setting",t,i),n.isPlainObject(t))n.extend(!0,b,t);else{if(i===r)return b[t];n.isPlainObject(b[t])?n.extend(!0,b[t],i):b[t]=i}},internal:function(t,i){if(n.isPlainObject(t))n.extend(!0,w,t);else{if(i===r)return w[t];w[t]=i}},debug:function(){!b.silent&&b.debug&&(b.performance?w.performance.log(arguments):(w.debug=Function.prototype.bind.call(console.info,console,b.name+":"),w.debug.apply(console,arguments)))},verbose:function(){!b.silent&&b.verbose&&b.debug&&(b.performance?w.performance.log(arguments):(w.verbose=Function.prototype.bind.call(console.info,console,b.name+":"),w.verbose.apply(console,arguments)))},error:function(){b.silent||(w.error=Function.prototype.bind.call(console.error,console,b.name+":"),w.error.apply(console,arguments))},performance:{log:function(n){var t,i,r;b.performance&&(t=(new Date).getTime(),r=c||t,i=t-r,c=t,s.push({Name:n[0],Arguments:[].slice.call(n,1)||"",Element:ot,"Execution Time":i}));clearTimeout(w.performance.timer);w.performance.timer=setTimeout(w.performance.display,500)},display:function(){var t=b.name+":",i=0;c=!1;clearTimeout(w.performance.timer);n.each(s,function(n,t){i+=t["Execution Time"]});t+=" "+i+"ms";a&&(t+=" '"+a+"'");(console.group!==r||console.table!==r)&&s.length>0&&(console.groupCollapsed(t),console.table?console.table(s):n.each(s,function(n,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd());s=[]}},invoke:function(t,i,u){var h,o,s,e=yt;return i=i||y,u=ot||u,"string"==typeof t&&e!==r&&(t=t.split(/[\. ]/),h=t.length-1,n.each(t,function(i,u){var f=i!=h?u+t[i+1].charAt(0).toUpperCase()+t[i+1].slice(1):t;if(n.isPlainObject(e[f])&&i!=h)e=e[f];else{if(e[f]!==r)return o=e[f],!1;if(!n.isPlainObject(e[u])||i==h)return e[u]!==r?(o=e[u],!1):(w.error(lt.method,t),!1);e=e[u]}})),n.isFunction(o)?s=o.apply(u,i):o!==r&&(s=o),n.isArray(f)?f.push(s):f!==r?f=[f,s]:s!==r&&(f=s),o}};v?(yt===r&&w.initialize(),w.invoke(l)):(yt!==r&&yt.invoke("destroy"),w.initialize())}),f!==r?f:e};n.fn.dropdown.settings={silent:!1,debug:!1,verbose:!1,performance:!0,on:"click",action:"activate",apiSettings:!1,selectOnKeydown:!0,minCharacters:0,saveRemoteData:!0,throttle:200,context:t,direction:"auto",keepOnScreen:!0,match:"both",fullTextSearch:!1,placeholder:"auto",preserveHTML:!0,sortSelect:!1,forceSelection:!0,allowAdditions:!1,hideAdditions:!0,maxSelections:!1,useLabels:!0,delimiter:",",showOnFocus:!0,allowReselection:!1,allowTab:!0,allowCategorySelection:!1,fireOnInit:!1,transition:"auto",duration:200,glyphWidth:1.037,label:{transition:"scale",duration:200,variation:!1},delay:{hide:300,show:200,search:20,touch:50},onChange:function(){},onAdd:function(){},onRemove:function(){},onLabelSelect:function(){},onLabelCreate:function(){return n(this)},onLabelRemove:function(){return!0},onNoResults:function(){return!0},onShow:function(){},onHide:function(){},name:"Dropdown",namespace:"dropdown",message:{addResult:"Add <b>{term}<\/b>",count:"{count} selected",maxSelections:"Max {maxCount} selections",noResults:"No results found.",serverError:"There was an error contacting the server"},error:{action:"You called a dropdown action that was not defined",alreadySetup:"Once a select has been initialized behaviors must be called on the created ui dropdown",labels:"Allowing user additions currently requires the use of labels.",missingMultiple:"<select> requires multiple property to be set to correctly preserve multiple values",method:"The method you called is not defined.",noAPI:"The API module is required to load resources remotely",noStorage:"Saving remote data requires session storage",noTransition:"This module requires ui transitions <https://github.com/Semantic-Org/UI-Transition>"},regExp:{escape:/[-[\]{}()*+?.,\\^$|#\s]/g,quote:/"/g},metadata:{defaultText:"defaultText",defaultValue:"defaultValue",placeholderText:"placeholder",text:"text",value:"value"},fields:{remoteValues:"results",values:"values",disabled:"disabled",name:"name",value:"value",text:"text"},keys:{backspace:8,delimiter:188,deleteKey:46,enter:13,escape:27,pageUp:33,pageDown:34,leftArrow:37,upArrow:38,rightArrow:39,downArrow:40},selector:{addition:".addition",dropdown:".ui.dropdown",hidden:".hidden",icon:"> .dropdown.icon",input:'> input[type="hidden"], > select',item:".item",label:"> .label",remove:"> .label > .delete.icon",siblingLabel:".label",menu:".menu",message:".message",menuIcon:".dropdown.icon",search:"input.search, .menu > .search > input, .menu input.search",sizer:"> input.sizer",text:"> .text:not(.icon)",unselectable:".disabled, .filtered"},className:{active:"active",addition:"addition",animating:"animating",disabled:"disabled",empty:"empty",dropdown:"ui dropdown",filtered:"filtered",hidden:"hidden transition",item:"item",label:"ui label",loading:"loading",menu:"menu",message:"message",multiple:"multiple",placeholder:"default",sizer:"sizer",search:"search",selected:"selected",selection:"selection",upward:"upward",visible:"visible"}};n.fn.dropdown.settings.templates={dropdown:function(t){var r=t.placeholder||!1,i=(t.values||{},"");return i+='<i class="dropdown icon"><\/i>',i+=t.placeholder?'<div class="default text">'+r+"<\/div>":'<div class="text"><\/div>',i+='<div class="menu">',n.each(t.values,function(n,t){i+=t.disabled?'<div class="disabled item" data-value="'+t.value+'">'+t.name+"<\/div>":'<div class="item" data-value="'+t.value+'">'+t.name+"<\/div>"}),i+="<\/div>"},menu:function(t,i){var u=t[i.values]||{},r="";return n.each(u,function(n,t){var u=t[i.text]?'data-text="'+t[i.text]+'"':"",f=t[i.disabled]?"disabled ":"";r+='<div class="'+f+'item" data-value="'+t[i.value]+'"'+u+">";r+=t[i.name];r+="<\/div>"}),r},label:function(n,t){return t+'<i class="delete icon"><\/i>'},message:function(n){return n},addition:function(n){return n}}}(jQuery,window,document),function(n,t,i,r){"use strict";t="undefined"!=typeof t&&t.Math==Math?t:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();n.fn.popup=function(u){var f,l=n(this),s=n(i),o=n(t),h=n("body"),a=l.selector||"",y=!0,c=(new Date).getTime(),e=[],v=arguments[0],p="string"==typeof v,w=[].slice.call(arguments,1);return l.each(function(){var k,rt,st,ut,lt,l,b=n.isPlainObject(u)?n.extend(!0,{},n.fn.popup.settings,u):n.extend({},n.fn.popup.settings),ht=b.selector,nt=b.className,ct=b.error,tt=b.metadata,kt=b.namespace,ft="."+b.namespace,yt="module-"+kt,d=n(this),wt=n(b.context),bt=n(b.scrollContext),at=n(b.boundary),it=b.target?n(b.target):d,vt=0,et=!1,pt=!1,g=this,ot=d.data(yt);l={initialize:function(){l.debug("Initializing",d);l.createID();l.bind.events();!l.exists()&&b.preserve&&l.create();b.observeChanges&&l.observeChanges();l.instantiate()},instantiate:function(){l.verbose("Storing instance",l);ot=l;d.data(yt,ot)},observeChanges:function(){"MutationObserver"in t&&(st=new MutationObserver(l.event.documentChanged),st.observe(i,{childList:!0,subtree:!0}),l.debug("Setting up mutation observer",st))},refresh:function(){b.popup?k=n(b.popup).eq(0):b.inline&&(k=it.nextAll(ht.popup).eq(0),b.popup=k);b.popup?(k.addClass(nt.loading),rt=l.get.offsetParent(),k.removeClass(nt.loading),b.movePopup&&l.has.popup()&&l.get.offsetParent(k)[0]!==rt[0]&&(l.debug("Moving popup to the same offset parent as activating element"),k.detach().appendTo(rt))):rt=b.inline?l.get.offsetParent(it):l.has.popup()?l.get.offsetParent(k):h;rt.is("html")&&rt[0]!==h[0]&&(l.debug("Setting page as offset parent"),rt=h);l.get.variation()&&l.set.variation()},reposition:function(){l.refresh();l.set.position()},destroy:function(){l.debug("Destroying previous module");st&&st.disconnect();k&&!b.preserve&&l.removePopup();clearTimeout(l.hideTimer);clearTimeout(l.showTimer);l.unbind.close();l.unbind.events();d.removeData(yt)},event:{start:function(){var t=n.isPlainObject(b.delay)?b.delay.show:b.delay;clearTimeout(l.hideTimer);pt||(l.showTimer=setTimeout(l.show,t))},end:function(){var t=n.isPlainObject(b.delay)?b.delay.hide:b.delay;clearTimeout(l.showTimer);l.hideTimer=setTimeout(l.hide,t)},touchstart:function(){pt=!0;l.show()},resize:function(){l.is.visible()&&l.set.position()},documentChanged:function(t){[].forEach.call(t,function(t){t.removedNodes&&[].forEach.call(t.removedNodes,function(t){(t==g||n(t).find(g).length>0)&&(l.debug("Element removed from DOM, tearing down events"),l.destroy())})})},hideGracefully:function(t){var r=n(t.target),u=n.contains(i.documentElement,t.target),f=r.closest(ht.popup).length>0;t&&!f&&u?(l.debug("Click occurred outside popup hiding popup"),l.hide()):l.debug("Click was inside popup, keeping popup open")}},create:function(){var t=l.get.html(),i=l.get.title(),r=l.get.content();t||r||i?(l.debug("Creating pop-up html"),t||(t=b.templates.popup({title:i,content:r})),k=n("<div/>").addClass(nt.popup).data(tt.activator,d).html(t),b.inline?(l.verbose("Inserting popup element inline",k),k.insertAfter(d)):(l.verbose("Appending popup element to body",k),k.appendTo(wt)),l.refresh(),l.set.variation(),b.hoverable&&l.bind.popup(),b.onCreate.call(k,g)):0!==it.next(ht.popup).length?(l.verbose("Pre-existing popup found"),b.inline=!0,b.popup=it.next(ht.popup).data(tt.activator,d),l.refresh(),b.hoverable&&l.bind.popup()):b.popup?(n(b.popup).data(tt.activator,d),l.verbose("Used popup specified in settings"),l.refresh(),b.hoverable&&l.bind.popup()):l.debug("No content specified skipping display",g)},createID:function(){lt=(Math.random().toString(16)+"000000000").substr(2,8);ut="."+lt;l.verbose("Creating unique id for element",lt)},toggle:function(){l.debug("Toggling pop-up");l.is.hidden()?(l.debug("Popup is hidden, showing pop-up"),l.unbind.close(),l.show()):(l.debug("Popup is visible, hiding pop-up"),l.hide())},show:function(n){if(n=n||function(){},l.debug("Showing pop-up",b.transition),l.is.hidden()&&(!l.is.active()||!l.is.dropdown())){if(l.exists()||l.create(),b.onShow.call(k,g)===!1)return void l.debug("onShow callback returned false, cancelling popup animation");b.preserve||b.popup||l.refresh();k&&l.set.position()&&(l.save.conditions(),b.exclusive&&l.hideAll(),l.animate.show(n))}},hide:function(n){if(n=n||function(){},l.is.visible()||l.is.animating()){if(b.onHide.call(k,g)===!1)return void l.debug("onHide callback returned false, cancelling popup animation");l.remove.visible();l.unbind.close();l.restore.conditions();l.animate.hide(n)}},hideAll:function(){n(ht.popup).filter("."+nt.visible).each(function(){n(this).data(tt.activator).popup("hide")})},exists:function(){return!!k&&(b.inline||b.popup?l.has.popup():k.closest(wt).length>=1)},removePopup:function(){l.has.popup()&&!b.popup&&(l.debug("Removing popup",k),k.remove(),k=r,b.onRemove.call(k,g))},save:{conditions:function(){l.cache={title:d.attr("title")};l.cache.title&&d.removeAttr("title");l.verbose("Saving original attributes",l.cache.title)}},restore:{conditions:function(){return l.cache&&l.cache.title&&(d.attr("title",l.cache.title),l.verbose("Restoring original attributes",l.cache.title)),!0}},supports:{svg:function(){return typeof SVGGraphicsElement===r}},animate:{show:function(t){t=n.isFunction(t)?t:function(){};b.transition&&n.fn.transition!==r&&d.transition("is supported")?(l.set.visible(),k.transition({animation:b.transition+" in",queue:!1,debug:b.debug,verbose:b.verbose,duration:b.duration,onComplete:function(){l.bind.close();t.call(k,g);b.onVisible.call(k,g)}})):l.error(ct.noTransition)},hide:function(t){return t=n.isFunction(t)?t:function(){},l.debug("Hiding pop-up"),b.onHide.call(k,g)===!1?void l.debug("onHide callback returned false, cancelling popup animation"):void(b.transition&&n.fn.transition!==r&&d.transition("is supported")?k.transition({animation:b.transition+" out",queue:!1,duration:b.duration,debug:b.debug,verbose:b.verbose,onComplete:function(){l.reset();t.call(k,g);b.onHidden.call(k,g)}}):l.error(ct.noTransition))}},change:{content:function(n){k.html(n)}},get:{html:function(){return d.removeData(tt.html),d.data(tt.html)||b.html},title:function(){return d.removeData(tt.title),d.data(tt.title)||b.title},content:function(){return d.removeData(tt.content),d.data(tt.content)||d.attr("title")||b.content},variation:function(){return d.removeData(tt.variation),d.data(tt.variation)||b.variation},popup:function(){return k},popupOffset:function(){return k.offset()},calculations:function(){var n,r=it[0],u=at[0]==t,f=b.inline||b.popup&&b.movePopup?it.position():it.offset(),e=u?{top:0,left:0}:at.offset(),i={},s=u?{top:o.scrollTop(),left:o.scrollLeft()}:{top:0,left:0};return i={target:{element:it[0],width:it.outerWidth(),height:it.outerHeight(),top:f.top,left:f.left,margin:{}},popup:{width:k.outerWidth(),height:k.outerHeight()},parent:{width:rt.outerWidth(),height:rt.outerHeight()},screen:{top:e.top,left:e.left,scroll:{top:s.top,left:s.left},width:at.width(),height:at.height()}},b.setFluidWidth&&l.is.fluid()&&(i.container={width:k.parent().outerWidth()},i.popup.width=i.container.width),i.target.margin.top=b.inline?parseInt(t.getComputedStyle(r).getPropertyValue("margin-top"),10):0,i.target.margin.left=b.inline?l.is.rtl()?parseInt(t.getComputedStyle(r).getPropertyValue("margin-right"),10):parseInt(t.getComputedStyle(r).getPropertyValue("margin-left"),10):0,n=i.screen,i.boundary={top:n.top+n.scroll.top,bottom:n.top+n.scroll.top+n.height,left:n.left+n.scroll.left,right:n.left+n.scroll.left+n.width},i},id:function(){return lt},startEvent:function(){return"hover"==b.on?"mouseenter":"focus"==b.on&&"focus"},scrollEvent:function(){return"scroll"},endEvent:function(){return"hover"==b.on?"mouseleave":"focus"==b.on&&"blur"},distanceFromBoundary:function(n,t){var r,i,u={};return t=t||l.get.calculations(),r=t.popup,i=t.boundary,n&&(u={top:n.top-i.top,left:n.left-i.left,right:i.right-(n.left+r.width),bottom:i.bottom-(n.top+r.height)},l.verbose("Distance from boundaries determined",n,u)),u},offsetParent:function(t){var s=t!==r?t[0]:d[0],u=s.parentNode,i=n(u);if(u)for(var f="none"===i.css("transform"),e="static"===i.css("position"),o=i.is("html");u&&!o&&e&&f;)u=u.parentNode,i=n(u),f="none"===i.css("transform"),e="static"===i.css("position"),o=i.is("html");return i&&i.length>0?i:n()},positions:function(){return{"top left":!1,"top center":!1,"top right":!1,"bottom left":!1,"bottom center":!1,"bottom right":!1,"left center":!1,"right center":!1}},nextPosition:function(n){var r=n.split(" "),i=r[0],u=r[1],o="top"==i||"bottom"==i,f=!1,e=!1,t=!1;return et||(l.verbose("All available positions available"),et=l.get.positions()),l.debug("Recording last position tried",n),et[n]=!0,"opposite"===b.prefer&&(t=[{top:"bottom",bottom:"top",left:"right",right:"left"}[i],u],t=t.join(" "),f=et[t]===!0,l.debug("Trying opposite strategy",t)),"adjacent"===b.prefer&&o&&(t=[i,{left:"center",center:"right",right:"left"}[u]],t=t.join(" "),e=et[t]===!0,l.debug("Trying adjacent strategy",t)),(e||f)&&(l.debug("Using backup position",t),t={"top left":"top center","top center":"top right","top right":"right center","right center":"bottom right","bottom right":"bottom center","bottom center":"bottom left","bottom left":"left center","left center":"top left"}[n]),t}},set:{position:function(n,t){if(0===it.length||0===k.length)return void l.error(ct.notFound);var u,f,i,s,o,e,h,c;if(t=t||l.get.calculations(),n=n||d.data(tt.position)||b.position,u=d.data(tt.offset)||b.offset,f=b.distanceAway,i=t.target,s=t.popup,o=t.parent,0===i.width&&0===i.height&&!l.is.svg(i.element))return l.debug("Popup target is hidden, no action taken"),!1;switch(b.inline&&(l.debug("Adding margin to calculation",i.margin),"left center"==n||"right center"==n?(u+=i.margin.top,f+=-i.margin.left):"top left"==n||"top center"==n||"top right"==n?(u+=i.margin.left,f-=i.margin.top):(u+=i.margin.left,f+=i.margin.top)),l.debug("Determining popup position from calculations",n,t),l.is.rtl()&&(n=n.replace(/left|right/g,function(n){return"left"==n?"right":"left"}),l.debug("RTL: Popup position updated",n)),vt==b.maxSearchDepth&&"string"==typeof b.lastResort&&(n=b.lastResort),n){case"top left":e={top:"auto",bottom:o.height-i.top+f,left:i.left+u,right:"auto"};break;case"top center":e={bottom:o.height-i.top+f,left:i.left+i.width/2-s.width/2+u,top:"auto",right:"auto"};break;case"top right":e={bottom:o.height-i.top+f,right:o.width-i.left-i.width-u,top:"auto",left:"auto"};break;case"left center":e={top:i.top+i.height/2-s.height/2+u,right:o.width-i.left+f,left:"auto",bottom:"auto"};break;case"right center":e={top:i.top+i.height/2-s.height/2+u,left:i.left+i.width+f,bottom:"auto",right:"auto"};break;case"bottom left":e={top:i.top+i.height+f,left:i.left+u,bottom:"auto",right:"auto"};break;case"bottom center":e={top:i.top+i.height+f,left:i.left+i.width/2-s.width/2+u,bottom:"auto",right:"auto"};break;case"bottom right":e={top:i.top+i.height+f,right:o.width-i.left-i.width-u,left:"auto",bottom:"auto"}}if(e===r&&l.error(ct.invalidPosition,n),l.debug("Calculated popup positioning values",e),k.css(e).removeClass(nt.position).addClass(n).addClass(nt.loading),h=l.get.popupOffset(),c=l.get.distanceFromBoundary(h,t),l.is.offstage(c,n)){if(l.debug("Position is outside viewport",n),vt<b.maxSearchDepth)return vt++,n=l.get.nextPosition(n),l.debug("Trying new position",n),!!k&&l.set.position(n,t);if(!b.lastResort)return l.debug("Popup could not find a position to display",k),l.error(ct.cannotPlace,g),l.remove.attempts(),l.remove.loading(),l.reset(),b.onUnplaceable.call(k,g),!1;l.debug("No position found, showing with last position")}return l.debug("Position is on stage",n),l.remove.attempts(),l.remove.loading(),b.setFluidWidth&&l.is.fluid()&&l.set.fluidWidth(t),!0},fluidWidth:function(n){n=n||l.get.calculations();l.debug("Automatically setting element width to parent width",n.parent.width);k.css("width",n.container.width)},variation:function(n){n=n||l.get.variation();n&&l.has.popup()&&(l.verbose("Adding variation to popup",n),k.addClass(n))},visible:function(){d.addClass(nt.visible)}},remove:{loading:function(){k.removeClass(nt.loading)},variation:function(n){n=n||l.get.variation();n&&(l.verbose("Removing variation",n),k.removeClass(n))},visible:function(){d.removeClass(nt.visible)},attempts:function(){l.verbose("Resetting all searched positions");vt=0;et=!1}},bind:{events:function(){l.debug("Binding popup events to module");"click"==b.on&&d.on("click"+ft,l.toggle);"hover"==b.on&&y&&d.on("touchstart"+ft,l.event.touchstart);l.get.startEvent()&&d.on(l.get.startEvent()+ft,l.event.start).on(l.get.endEvent()+ft,l.event.end);b.target&&l.debug("Target set to element",it);o.on("resize"+ut,l.event.resize)},popup:function(){l.verbose("Allowing hover events on popup to prevent closing");k&&l.has.popup()&&k.on("mouseenter"+ft,l.event.start).on("mouseleave"+ft,l.event.end)},close:function(){(b.hideOnScroll===!0||"auto"==b.hideOnScroll&&"click"!=b.on)&&bt.one(l.get.scrollEvent()+ut,l.event.hideGracefully);"hover"==b.on&&pt&&(l.verbose("Binding popup close event to document"),s.on("touchstart"+ut,function(n){l.verbose("Touched away from popup");l.event.hideGracefully.call(g,n)}));"click"==b.on&&b.closable&&(l.verbose("Binding popup close event to document"),s.on("click"+ut,function(n){l.verbose("Clicked away from popup");l.event.hideGracefully.call(g,n)}))}},unbind:{events:function(){o.off(ut);d.off(ft)},close:function(){s.off(ut);bt.off(ut)}},has:{popup:function(){return k&&k.length>0}},is:{offstage:function(t,i){var r=[];return n.each(t,function(n,t){t<-b.jitter&&(l.debug("Position exceeds allowable distance from edge",n,t,i),r.push(n))}),r.length>0},svg:function(n){return l.supports.svg()&&n instanceof SVGGraphicsElement},active:function(){return d.hasClass(nt.active)},animating:function(){return k!==r&&k.hasClass(nt.animating)},fluid:function(){return k!==r&&k.hasClass(nt.fluid)},visible:function(){return k!==r&&k.hasClass(nt.visible)},dropdown:function(){return d.hasClass(nt.dropdown)},hidden:function(){return!l.is.visible()},rtl:function(){return"rtl"==d.css("direction")}},reset:function(){l.remove.visible();b.preserve?n.fn.transition!==r&&k.transition("remove transition"):l.removePopup()},setting:function(t,i){if(n.isPlainObject(t))n.extend(!0,b,t);else{if(i===r)return b[t];b[t]=i}},internal:function(t,i){if(n.isPlainObject(t))n.extend(!0,l,t);else{if(i===r)return l[t];l[t]=i}},debug:function(){!b.silent&&b.debug&&(b.performance?l.performance.log(arguments):(l.debug=Function.prototype.bind.call(console.info,console,b.name+":"),l.debug.apply(console,arguments)))},verbose:function(){!b.silent&&b.verbose&&b.debug&&(b.performance?l.performance.log(arguments):(l.verbose=Function.prototype.bind.call(console.info,console,b.name+":"),l.verbose.apply(console,arguments)))},error:function(){b.silent||(l.error=Function.prototype.bind.call(console.error,console,b.name+":"),l.error.apply(console,arguments))},performance:{log:function(n){var t,i,r;b.performance&&(t=(new Date).getTime(),r=c||t,i=t-r,c=t,e.push({Name:n[0],Arguments:[].slice.call(n,1)||"",Element:g,"Execution Time":i}));clearTimeout(l.performance.timer);l.performance.timer=setTimeout(l.performance.display,500)},display:function(){var t=b.name+":",i=0;c=!1;clearTimeout(l.performance.timer);n.each(e,function(n,t){i+=t["Execution Time"]});t+=" "+i+"ms";a&&(t+=" '"+a+"'");(console.group!==r||console.table!==r)&&e.length>0&&(console.groupCollapsed(t),console.table?console.table(e):n.each(e,function(n,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd());e=[]}},invoke:function(t,i,u){var h,o,s,e=ot;return i=i||w,u=g||u,"string"==typeof t&&e!==r&&(t=t.split(/[\. ]/),h=t.length-1,n.each(t,function(i,u){var f=i!=h?u+t[i+1].charAt(0).toUpperCase()+t[i+1].slice(1):t;if(n.isPlainObject(e[f])&&i!=h)e=e[f];else{if(e[f]!==r)return o=e[f],!1;if(!n.isPlainObject(e[u])||i==h)return e[u]!==r&&(o=e[u],!1);e=e[u]}})),n.isFunction(o)?s=o.apply(u,i):o!==r&&(s=o),n.isArray(f)?f.push(s):f!==r?f=[f,s]:s!==r&&(f=s),o}};p?(ot===r&&l.initialize(),l.invoke(v)):(ot!==r&&ot.invoke("destroy"),l.initialize())}),f!==r?f:this};n.fn.popup.settings={name:"Popup",silent:!1,debug:!1,verbose:!1,performance:!0,namespace:"popup",observeChanges:!0,onCreate:function(){},onRemove:function(){},onShow:function(){},onVisible:function(){},onHide:function(){},onUnplaceable:function(){},onHidden:function(){},on:"hover",boundary:t,addTouchEvents:!0,position:"top left",variation:"",movePopup:!0,target:!1,popup:!1,inline:!1,preserve:!1,hoverable:!1,content:!1,html:!1,title:!1,closable:!0,hideOnScroll:"auto",exclusive:!1,context:"body",scrollContext:t,prefer:"opposite",lastResort:!1,delay:{show:50,hide:70},setFluidWidth:!0,duration:200,transition:"scale",distanceAway:0,jitter:2,offset:0,maxSearchDepth:15,error:{invalidPosition:"The position you specified is not a valid position",cannotPlace:"Popup does not fit within the boundaries of the viewport",method:"The method you called is not defined.",noTransition:"This module requires ui transitions <https://github.com/Semantic-Org/UI-Transition>",notFound:"The target or popup you specified does not exist on the page"},metadata:{activator:"activator",content:"content",html:"html",offset:"offset",position:"position",title:"title",variation:"variation"},className:{active:"active",animating:"animating",dropdown:"dropdown",fluid:"fluid",loading:"loading",popup:"ui popup",position:"top left center bottom right",visible:"visible"},selector:{popup:".ui.popup"},templates:{escape:function(n){var t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},i=function(n){return t[n]};return/[&<>"'`]/.test(n)?n.replace(/[&<>"'`]/g,i):n},popup:function(t){var i="",u=n.fn.popup.settings.templates.escape;return typeof t!==r&&(typeof t.title!==r&&t.title&&(t.title=u(t.title),i+='<div class="header">'+t.title+"<\/div>"),typeof t.content!==r&&t.content&&(t.content=u(t.content),i+='<div class="content">'+t.content+"<\/div>")),i}}}}(jQuery,window,document),function(n,t,i,r){"use strict";t="undefined"!=typeof t&&t.Math==Math?t:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();n.fn.search=function(u){var f,o=n(this),h=o.selector||"",s=(new Date).getTime(),e=[],c=arguments[0],l="string"==typeof c,a=[].slice.call(arguments,1);return n(this).each(function(){var v,y=n.isPlainObject(u)?n.extend(!0,{},n.fn.search.settings,u):n.extend({},n.fn.search.settings),b=y.className,d=y.metadata,ht=y.regExp,g=y.fields,w=y.selector,it=y.error,ct=y.namespace,nt="."+ct,ft=ct+"-module",p=n(this),tt=p.find(w.prompt),et=p.find(w.searchButton),k=p.find(w.results),ot=p.find(w.result),lt=p.find(w.category),rt=this,ut=p.data(ft),st=!1;v={initialize:function(){v.verbose("Initializing module");v.determine.searchFields();v.bind.events();v.set.type();v.create.results();v.instantiate()},instantiate:function(){v.verbose("Storing instance of module",v);ut=v;p.data(ft,v)},destroy:function(){v.verbose("Destroying instance");p.off(nt).removeData(ft)},refresh:function(){v.debug("Refreshing selector cache");tt=p.find(w.prompt);et=p.find(w.searchButton);lt=p.find(w.category);k=p.find(w.results);ot=p.find(w.result)},refreshResults:function(){k=p.find(w.results);ot=p.find(w.result)},bind:{events:function(){v.verbose("Binding events to search");y.automatic&&(p.on(v.get.inputEvent()+nt,w.prompt,v.event.input),tt.attr("autocomplete","off"));p.on("focus"+nt,w.prompt,v.event.focus).on("blur"+nt,w.prompt,v.event.blur).on("keydown"+nt,w.prompt,v.handleKeyboard).on("click"+nt,w.searchButton,v.query).on("mousedown"+nt,w.results,v.event.result.mousedown).on("mouseup"+nt,w.results,v.event.result.mouseup).on("click"+nt,w.result,v.event.result.click)}},determine:{searchFields:function(){u&&u.searchFields!==r&&(y.searchFields=u.searchFields)}},event:{input:function(){clearTimeout(v.timer);v.timer=setTimeout(v.query,y.searchDelay)},focus:function(){v.set.focus();v.has.minimumCharacters()&&(v.query(),v.can.show()&&v.showResults())},blur:function(){var t=i.activeElement===this,n=function(){v.cancel.query();v.remove.focus();v.timer=setTimeout(v.hideResults,y.hideDelay)};t||(v.resultsClicked?(v.debug("Determining if user action caused search to close"),p.one("click.close"+nt,w.results,function(t){return v.is.inMessage(t)||st?void tt.focus():(st=!1,void(v.is.animating()||v.is.hidden()||n()))})):(v.debug("Input blurred without user action, closing results"),n()))},result:{mousedown:function(){v.resultsClicked=!0},mouseup:function(){v.resultsClicked=!1},click:function(i){v.debug("Search result selected");var r=n(this),u=r.find(w.title).eq(0),f=r.is("a[href]")?r:r.find("a[href]").eq(0),e=f.attr("href")||!1,h=f.attr("target")||!1,o=(u.html(),u.length>0&&u.text()),s=v.get.results(),c=r.data(d.result)||v.get.result(o,s);return n.isFunction(y.onSelect)&&y.onSelect.call(rt,c,s)===!1?(v.debug("Custom onSelect callback cancelled default select action"),void(st=!0)):(v.hideResults(),o&&v.set.value(o),void(e&&(v.verbose("Opening search link found in result",f),"_blank"==h||i.ctrlKey?t.open(e):t.location.href=e)))}}},handleKeyboard:function(n){var f,t=p.find(w.result),e=p.find(w.category),o=t.filter("."+b.active),i=t.index(o),s=t.length,h=o.length>0,r=n.which,u={backspace:8,enter:13,escape:27,upArrow:38,downArrow:40};if(r==u.escape&&(v.verbose("Escape key pressed, blurring search field"),v.trigger.blur()),v.is.visible())if(r==u.enter){if(v.verbose("Enter key pressed, selecting active result"),t.filter("."+b.active).length>0)return v.event.result.click.call(t.filter("."+b.active),n),n.preventDefault(),!1}else r==u.upArrow&&h?(v.verbose("Up key pressed, changing active result"),f=i-1<0?i:i-1,e.removeClass(b.active),t.removeClass(b.active).eq(f).addClass(b.active).closest(e).addClass(b.active),n.preventDefault()):r==u.downArrow&&(v.verbose("Down key pressed, changing active result"),f=i+1>=s?i:i+1,e.removeClass(b.active),t.removeClass(b.active).eq(f).addClass(b.active).closest(e).addClass(b.active),n.preventDefault());else r==u.enter&&(v.verbose("Enter key pressed, executing query"),v.query(),v.set.buttonPressed(),tt.one("keyup",v.remove.buttonFocus))},setup:{api:function(t){var i={debug:y.debug,on:!1,cache:!0,action:"search",urlData:{query:t},onSuccess:function(n){v.parse.response.call(rt,n,t)},onAbort:function(){},onFailure:function(){v.displayMessage(it.serverError)},onError:v.error};n.extend(!0,i,y.apiSettings);v.verbose("Setting up API request",i);p.api(i)}},can:{useAPI:function(){return n.fn.api!==r},show:function(){return v.is.focused()&&!v.is.visible()&&!v.is.empty()},transition:function(){return y.transition&&n.fn.transition!==r&&p.transition("is supported")}},is:{animating:function(){return k.hasClass(b.animating)},hidden:function(){return k.hasClass(b.hidden)},inMessage:function(t){if(t.target){var r=n(t.target),u=n.contains(i.documentElement,t.target);return u&&r.closest(w.message).length>0}},empty:function(){return""===k.html()},visible:function(){return k.filter(":visible").length>0},focused:function(){return tt.filter(":focus").length>0}},trigger:{blur:function(){var n=i.createEvent("HTMLEvents"),t=tt[0];t&&(v.verbose("Triggering native blur event"),n.initEvent("blur",!1,!1),t.dispatchEvent(n))}},get:{inputEvent:function(){var n=tt[0];return n!==r&&n.oninput!==r?"input":n!==r&&n.onpropertychange!==r?"propertychange":"keyup"},value:function(){return tt.val()},results:function(){return p.data(d.results)},result:function(t,i){var f=["title","id"],u=!1;return t=t!==r?t:v.get.value(),i=i!==r?i:v.get.results(),"category"===y.type?(v.debug("Finding result that matches",t),n.each(i,function(i,r){if(n.isArray(r.results)&&(u=v.search.object(t,r.results,f)[0]))return!1})):(v.debug("Finding result in results object",t),u=v.search.object(t,i,f)[0]),u||!1}},select:{firstResult:function(){v.verbose("Selecting first result");ot.first().addClass(b.active)}},set:{focus:function(){p.addClass(b.focus)},loading:function(){p.addClass(b.loading)},value:function(n){v.verbose("Setting search input value",n);tt.val(n)},type:function(n){n=n||y.type;"category"==y.type&&p.addClass(y.type)},buttonPressed:function(){et.addClass(b.pressed)}},remove:{loading:function(){p.removeClass(b.loading)},focus:function(){p.removeClass(b.focus)},buttonPressed:function(){et.removeClass(b.pressed)}},query:function(){var t=v.get.value(),i=v.read.cache(t);v.has.minimumCharacters()?(i?(v.debug("Reading result from cache",t),v.save.results(i.results),v.addResults(i.html),v.inject.id(i.results)):(v.debug("Querying for",t),n.isPlainObject(y.source)||n.isArray(y.source)?v.search.local(t):v.can.useAPI()?v.search.remote(t):v.error(it.source)),y.onSearchQuery.call(rt,t)):v.hideResults()},search:{local:function(n){var i,t=v.search.object(n,y.content);v.set.loading();v.save.results(t);v.debug("Returned local search results",t);i=v.generateResults({results:t});v.remove.loading();v.addResults(i);v.inject.id(t);v.write.cache(n,{html:i,results:t})},remote:function(n){p.api("is loading")&&p.api("abort");v.setup.api(n);p.api("query")},object:function(t,i,u){var f=[],e=[],s=t.toString().replace(ht.escape,"\\$&"),h=new RegExp(ht.beginsWith+s,"i"),o=function(t,i){var r=n.inArray(i,f)==-1,u=n.inArray(i,e)==-1;r&&u&&t.push(i)};return i=i||y.source,u=u!==r?u:y.searchFields,n.isArray(u)||(u=[u]),i===r||i===!1?(v.error(it.source),[]):(n.each(u,function(r,u){n.each(i,function(n,i){var r="string"==typeof i[u];r&&(i[u].search(h)!==-1?o(f,i):y.searchFullText&&v.fuzzySearch(t,i[u])&&o(e,i))})}),n.merge(f,e))}},fuzzySearch:function(n,t){var r=t.length,u=n.length,i,f,e;if("string"!=typeof n||(n=n.toLowerCase(),t=t.toLowerCase(),u>r))return!1;if(u===r)return n===t;n:for(i=0,f=0;i<u;i++){for(e=n.charCodeAt(i);f<r;)if(t.charCodeAt(f++)===e)continue n;return!1}return!0},parse:{response:function(n,t){var i=v.generateResults(n);v.verbose("Parsing server response",n);n!==r&&t!==r&&n[g.results]!==r&&(v.addResults(i),v.inject.id(n[g.results]),v.write.cache(t,{html:i,results:n[g.results]}),v.save.results(n[g.results]))}},cancel:{query:function(){v.can.useAPI()&&p.api("abort")}},has:{minimumCharacters:function(){var n=v.get.value(),t=n.length;return t>=y.minCharacters}},clear:{cache:function(n){var t=p.data(d.cache);n?n&&t&&t[n]&&(v.debug("Removing value from cache",n),delete t[n],p.data(d.cache,t)):(v.debug("Clearing cache",n),p.removeData(d.cache))}},read:{cache:function(n){var t=p.data(d.cache);return!!y.cache&&(v.verbose("Checking cache for generated html for query",n),"object"==typeof t&&t[n]!==r&&t[n])}},create:{id:function(n,t){var u,i,f=n+1;return t!==r?(u=String.fromCharCode(97+t),i=u+f,v.verbose("Creating category result id",i)):(i=f,v.verbose("Creating result id",i)),i},results:function(){0===k.length&&(k=n("<div />").addClass(b.results).appendTo(p))}},inject:{result:function(n,t,i){v.verbose("Injecting result into results");var u=i!==r?k.children().eq(i).children(w.result).eq(t):k.children(w.result).eq(t);v.verbose("Injecting results metadata",u);u.data(d.result,n)},id:function(t){v.debug("Injecting unique ids into results");var u=0,i=0;return"category"===y.type?n.each(t,function(t,f){i=0;n.each(f.results,function(n){var t=f.results[n];t.id===r&&(t.id=v.create.id(i,u));v.inject.result(t,i,u);i++});u++}):n.each(t,function(n){var u=t[n];u.id===r&&(u.id=v.create.id(i));v.inject.result(u,i);i++}),t}},save:{results:function(n){v.verbose("Saving current search results to metadata",n);p.data(d.results,n)}},write:{cache:function(n,t){var i=p.data(d.cache)!==r?p.data(d.cache):{};y.cache&&(v.verbose("Writing generated html to cache",n,t),i[n]=t,p.data(d.cache,i))}},addResults:function(t){return n.isFunction(y.onResultsAdd)&&y.onResultsAdd.call(k,t)===!1?(v.debug("onResultsAdd callback cancelled default action"),!1):void(t?(k.html(t),v.refreshResults(),y.selectFirstResult&&v.select.firstResult(),v.showResults()):v.hideResults())},showResults:function(){v.is.visible()||(v.can.transition()?(v.debug("Showing results with css animations"),k.transition({animation:y.transition+" in",debug:y.debug,verbose:y.verbose,duration:y.duration,queue:!0})):(v.debug("Showing results with javascript"),k.stop().fadeIn(y.duration,y.easing)),y.onResultsOpen.call(k))},hideResults:function(){v.is.visible()&&(v.can.transition()?(v.debug("Hiding results with css animations"),k.transition({animation:y.transition+" out",debug:y.debug,verbose:y.verbose,duration:y.duration,queue:!0})):(v.debug("Hiding results with javascript"),k.stop().fadeOut(y.duration,y.easing)),y.onResultsClose.call(k))},generateResults:function(t){v.debug("Generating html from response",t);var r=y.templates[y.type],u=n.isPlainObject(t[g.results])&&!n.isEmptyObject(t[g.results]),f=n.isArray(t[g.results])&&t[g.results].length>0,i="";return u||f?(y.maxResults>0&&(u?"standard"==y.type&&v.error(it.maxResults):t[g.results]=t[g.results].slice(0,y.maxResults)),n.isFunction(r)?i=r(t,g):v.error(it.noTemplate,!1)):y.showNoResults&&(i=v.displayMessage(it.noResults,"empty")),y.onResults.call(rt,t),i},displayMessage:function(n,t){return t=t||"standard",v.debug("Displaying message",n,t),v.addResults(y.templates.message(n,t)),y.templates.message(n,t)},setting:function(t,i){if(n.isPlainObject(t))n.extend(!0,y,t);else{if(i===r)return y[t];y[t]=i}},internal:function(t,i){if(n.isPlainObject(t))n.extend(!0,v,t);else{if(i===r)return v[t];v[t]=i}},debug:function(){!y.silent&&y.debug&&(y.performance?v.performance.log(arguments):(v.debug=Function.prototype.bind.call(console.info,console,y.name+":"),v.debug.apply(console,arguments)))},verbose:function(){!y.silent&&y.verbose&&y.debug&&(y.performance?v.performance.log(arguments):(v.verbose=Function.prototype.bind.call(console.info,console,y.name+":"),v.verbose.apply(console,arguments)))},error:function(){y.silent||(v.error=Function.prototype.bind.call(console.error,console,y.name+":"),v.error.apply(console,arguments))},performance:{log:function(n){var t,i,r;y.performance&&(t=(new Date).getTime(),r=s||t,i=t-r,s=t,e.push({Name:n[0],Arguments:[].slice.call(n,1)||"",Element:rt,"Execution Time":i}));clearTimeout(v.performance.timer);v.performance.timer=setTimeout(v.performance.display,500)},display:function(){var t=y.name+":",i=0;s=!1;clearTimeout(v.performance.timer);n.each(e,function(n,t){i+=t["Execution Time"]});t+=" "+i+"ms";h&&(t+=" '"+h+"'");o.length>1&&(t+=" ("+o.length+")");(console.group!==r||console.table!==r)&&e.length>0&&(console.groupCollapsed(t),console.table?console.table(e):n.each(e,function(n,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd());e=[]}},invoke:function(t,i,u){var h,o,s,e=ut;return i=i||a,u=rt||u,"string"==typeof t&&e!==r&&(t=t.split(/[\. ]/),h=t.length-1,n.each(t,function(i,u){var f=i!=h?u+t[i+1].charAt(0).toUpperCase()+t[i+1].slice(1):t;if(n.isPlainObject(e[f])&&i!=h)e=e[f];else{if(e[f]!==r)return o=e[f],!1;if(!n.isPlainObject(e[u])||i==h)return e[u]!==r&&(o=e[u],!1);e=e[u]}})),n.isFunction(o)?s=o.apply(u,i):o!==r&&(s=o),n.isArray(f)?f.push(s):f!==r?f=[f,s]:s!==r&&(f=s),o}};l?(ut===r&&v.initialize(),v.invoke(c)):(ut!==r&&ut.invoke("destroy"),v.initialize())}),f!==r?f:this};n.fn.search.settings={name:"Search",namespace:"search",silent:!1,debug:!1,verbose:!1,performance:!0,type:"standard",minCharacters:1,selectFirstResult:!1,apiSettings:!1,source:!1,searchFields:["title","description"],displayField:"",searchFullText:!0,automatic:!0,hideDelay:0,searchDelay:200,maxResults:7,cache:!0,showNoResults:!0,transition:"scale",duration:200,easing:"easeOutExpo",onSelect:!1,onResultsAdd:!1,onSearchQuery:function(){},onResults:function(){},onResultsOpen:function(){},onResultsClose:function(){},className:{animating:"animating",active:"active",empty:"empty",focus:"focus",hidden:"hidden",loading:"loading",results:"results",pressed:"down"},error:{source:"Cannot search. No source used, and Semantic API module was not included",noResults:"Your search returned no results",logging:"Error in debug logging, exiting.",noEndpoint:"No search endpoint was specified",noTemplate:"A valid template name was not specified.",serverError:"There was an issue querying the server.",maxResults:"Results must be an array to use maxResults setting",method:"The method you called is not defined."},metadata:{cache:"cache",results:"results",result:"result"},regExp:{escape:/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,beginsWith:"(?:s|^)"},fields:{categories:"results",categoryName:"name",categoryResults:"results",description:"description",image:"image",price:"price",results:"results",title:"title",url:"url",action:"action",actionText:"text",actionURL:"url"},selector:{prompt:".prompt",searchButton:".search.button",results:".results",message:".results > .message",category:".category",result:".result",title:".title, .name"},templates:{escape:function(n){var t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},i=function(n){return t[n]};return/[&<>"'`]/.test(n)?n.replace(/[&<>"'`]/g,i):n},message:function(n,t){var i="";return n!==r&&t!==r&&(i+='<div class="message '+t+'">',i+="empty"==t?'<div class="header">No Results<\/div class="header"><div class="description">'+n+'<\/div class="description">':' <div class="description">'+n+"<\/div>",i+="<\/div>"),i},category:function(t,i){var u="";return n.fn.search.settings.templates.escape,t[i.categoryResults]!==r&&(n.each(t[i.categoryResults],function(t,f){f[i.results]!==r&&f.results.length>0&&(u+='<div class="category">',f[i.categoryName]!==r&&(u+='<div class="name">'+f[i.categoryName]+"<\/div>"),n.each(f.results,function(n,t){u+=t[i.url]?'<a class="result" href="'+t[i.url]+'">':'<a class="result">';t[i.image]!==r&&(u+='<div class="image"> <img src="'+t[i.image]+'"><\/div>');u+='<div class="content">';t[i.price]!==r&&(u+='<div class="price">'+t[i.price]+"<\/div>");t[i.title]!==r&&(u+='<div class="title">'+t[i.title]+"<\/div>");t[i.description]!==r&&(u+='<div class="description">'+t[i.description]+"<\/div>");u+="<\/div>";u+="<\/a>"}),u+="<\/div>")}),t[i.action]&&(u+='<a href="'+t[i.action][i.actionURL]+'" class="action">'+t[i.action][i.actionText]+"<\/a>"),u)},standard:function(t,i){var u="";return t[i.results]!==r&&(n.each(t[i.results],function(n,t){u+=t[i.url]?'<a class="result" href="'+t[i.url]+'">':'<a class="result">';t[i.image]!==r&&(u+='<div class="image"> <img src="'+t[i.image]+'"><\/div>');u+='<div class="content">';t[i.price]!==r&&(u+='<div class="price">'+t[i.price]+"<\/div>");t[i.title]!==r&&(u+='<div class="title">'+t[i.title]+"<\/div>");t[i.description]!==r&&(u+='<div class="description">'+t[i.description]+"<\/div>");u+="<\/div>";u+="<\/a>"}),t[i.action]&&(u+='<a href="'+t[i.action][i.actionURL]+'" class="action">'+t[i.action][i.actionText]+"<\/a>"),u)}}}}(jQuery,window,document),function(n,t,i,r){"use strict";t="undefined"!=typeof t&&t.Math==Math?t:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();n.fn.sidebar=function(u){var f,l=n(this),s=n(t),h=n(i),a=n("html"),p=n("head"),v=l.selector||"",c=(new Date).getTime(),e=[],y=arguments[0],w="string"==typeof y,b=[].slice.call(arguments,1),o=t.requestAnimationFrame||t.mozRequestAnimationFrame||t.webkitRequestAnimationFrame||t.msRequestAnimationFrame||function(n){setTimeout(n,0)};return l.each(function(){var et,it,lt,yt,ft,l,k=n.isPlainObject(u)?n.extend(!0,{},n.fn.sidebar.settings,u):n.extend({},n.fn.sidebar.settings),rt=k.selector,g=k.className,pt=k.namespace,at=k.regExp,st=k.error,ht="."+pt,vt="module-"+pt,d=n(this),tt=n(k.context),ot=d.children(rt.sidebar),wt=tt.children(rt.fixed),ut=tt.children(rt.pusher),nt=this,ct=d.data(vt);l={initialize:function(){l.debug("Initializing sidebar",u);l.create.id();ft=l.get.transitionEvent();l.is.ios()&&l.set.ios();k.delaySetup?o(l.setup.layout):l.setup.layout();o(function(){l.setup.cache()});l.instantiate()},instantiate:function(){l.verbose("Storing instance of module",l);ct=l;d.data(vt,l)},create:{id:function(){lt=(Math.random().toString(16)+"000000000").substr(2,8);it="."+lt;l.verbose("Creating unique id for element",lt)}},destroy:function(){l.verbose("Destroying previous module for",d);d.off(ht).removeData(vt);l.is.ios()&&l.remove.ios();tt.off(it);s.off(it);h.off(it)},event:{clickaway:function(n){var t=ut.find(n.target).length>0||ut.is(n.target),i=tt.is(n.target);t&&(l.verbose("User clicked on dimmed page"),l.hide());i&&(l.verbose("User clicked on dimmable context (scaled out page)"),l.hide())},touch:function(){},containScroll:function(){nt.scrollTop<=0&&(nt.scrollTop=1);nt.scrollTop+nt.offsetHeight>=nt.scrollHeight&&(nt.scrollTop=nt.scrollHeight-nt.offsetHeight-1)},scroll:function(t){0===n(t.target).closest(rt.sidebar).length&&t.preventDefault()}},bind:{clickaway:function(){l.verbose("Adding clickaway events to context",tt);k.closable&&tt.on("click"+it,l.event.clickaway).on("touchend"+it,l.event.clickaway)},scrollLock:function(){k.scrollLock&&(l.debug("Disabling page scroll"),s.on("DOMMouseScroll"+it,l.event.scroll));l.verbose("Adding events to contain sidebar scroll");h.on("touchmove"+it,l.event.touch);d.on("scroll"+ht,l.event.containScroll)}},unbind:{clickaway:function(){l.verbose("Removing clickaway events from context",tt);tt.off(it)},scrollLock:function(){l.verbose("Removing scroll lock from page");h.off(it);s.off(it);d.off("scroll"+ht)}},add:{inlineCSS:function(){var r,u=l.cache.width||d.outerWidth(),f=l.cache.height||d.outerHeight(),e=l.is.rtl(),t=l.get.direction(),i={left:u,right:-u,top:f,bottom:-f};e&&(l.verbose("RTL detected, flipping widths"),i.left=-u,i.right=u);r="<style>";"left"===t||"right"===t?(l.debug("Adding CSS rules for animation distance",u),r+=" .ui.visible."+t+".sidebar ~ .fixed, .ui.visible."+t+".sidebar ~ .pusher {   -webkit-transform: translate3d("+i[t]+"px, 0, 0);           transform: translate3d("+i[t]+"px, 0, 0); }"):"top"!==t&&"bottom"!=t||(r+=" .ui.visible."+t+".sidebar ~ .fixed, .ui.visible."+t+".sidebar ~ .pusher {   -webkit-transform: translate3d(0, "+i[t]+"px, 0);           transform: translate3d(0, "+i[t]+"px, 0); }");l.is.ie()&&("left"===t||"right"===t?(l.debug("Adding CSS rules for animation distance",u),r+=" body.pushable > .ui.visible."+t+".sidebar ~ .pusher:after {   -webkit-transform: translate3d("+i[t]+"px, 0, 0);           transform: translate3d("+i[t]+"px, 0, 0); }"):"top"!==t&&"bottom"!=t||(r+=" body.pushable > .ui.visible."+t+".sidebar ~ .pusher:after {   -webkit-transform: translate3d(0, "+i[t]+"px, 0);           transform: translate3d(0, "+i[t]+"px, 0); }"),r+=" body.pushable > .ui.visible.left.sidebar ~ .ui.visible.right.sidebar ~ .pusher:after, body.pushable > .ui.visible.right.sidebar ~ .ui.visible.left.sidebar ~ .pusher:after {   -webkit-transform: translate3d(0px, 0, 0);           transform: translate3d(0px, 0, 0); }");r+="<\/style>";et=n(r).appendTo(p);l.debug("Adding sizing css to head",et)}},refresh:function(){l.verbose("Refreshing selector cache");tt=n(k.context);ot=tt.children(rt.sidebar);ut=tt.children(rt.pusher);wt=tt.children(rt.fixed);l.clear.cache()},refreshSidebars:function(){l.verbose("Refreshing other sidebars");ot=tt.children(rt.sidebar)},repaint:function(){l.verbose("Forcing repaint event");nt.style.display="none";nt.offsetHeight;nt.scrollTop=nt.scrollTop;nt.style.display=""},setup:{cache:function(){l.cache={width:d.outerWidth(),height:d.outerHeight(),rtl:"rtl"==d.css("direction")}},layout:function(){0===tt.children(rt.pusher).length&&(l.debug("Adding wrapper element for sidebar"),l.error(st.pusher),ut=n('<div class="pusher" />'),tt.children().not(rt.omitted).not(ot).wrapAll(ut),l.refresh());0!==d.nextAll(rt.pusher).length&&d.nextAll(rt.pusher)[0]===ut[0]||(l.debug("Moved sidebar to correct parent element"),l.error(st.movedSidebar,nt),d.detach().prependTo(tt),l.refresh());l.clear.cache();l.set.pushable();l.set.direction()}},attachEvents:function(t,i){var r=n(t);i=n.isFunction(l[i])?l[i]:l.toggle;r.length>0?(l.debug("Attaching sidebar events to element",t,i),r.on("click"+ht,i)):l.error(st.notFound,t)},show:function(t){if(t=n.isFunction(t)?t:function(){},l.is.hidden()){if(l.refreshSidebars(),k.overlay&&(l.error(st.overlay),k.transition="overlay"),l.refresh(),l.othersActive())if(l.debug("Other sidebars currently visible"),k.exclusive){if("overlay"!=k.transition)return void l.hideOthers(l.show);l.hideOthers()}else k.transition="overlay";l.pushPage(function(){t.call(nt);k.onShow.call(nt)});k.onChange.call(nt);k.onVisible.call(nt)}else l.debug("Sidebar is already visible")},hide:function(t){t=n.isFunction(t)?t:function(){};(l.is.visible()||l.is.animating())&&(l.debug("Hiding sidebar",t),l.refreshSidebars(),l.pullPage(function(){t.call(nt);k.onHidden.call(nt)}),k.onChange.call(nt),k.onHide.call(nt))},othersAnimating:function(){return ot.not(d).filter("."+g.animating).length>0},othersVisible:function(){return ot.not(d).filter("."+g.visible).length>0},othersActive:function(){return l.othersVisible()||l.othersAnimating()},hideOthers:function(n){var t=ot.not(d).filter("."+g.visible),r=t.length,i=0;n=n||function(){};t.sidebar("hide",function(){i++;i==r&&n()})},toggle:function(){l.verbose("Determining toggled direction");l.is.hidden()?l.show():l.hide()},pushPage:function(t){var u,f,r,e=l.get.transition(),i="overlay"===e||l.othersActive()?d:ut;t=n.isFunction(t)?t:function(){};"scale down"==k.transition&&l.scrollToTop();l.set.transition(e);l.repaint();u=function(){l.bind.clickaway();l.add.inlineCSS();l.set.animating();l.set.visible()};f=function(){l.set.dimmed()};r=function(n){n.target==i[0]&&(i.off(ft+it,r),l.remove.animating(),l.bind.scrollLock(),t.call(nt))};i.off(ft+it);i.on(ft+it,r);o(u);k.dimPage&&!l.othersVisible()&&o(f)},pullPage:function(t){var f,r,u=l.get.transition(),i="overlay"==u||l.othersActive()?d:ut;t=n.isFunction(t)?t:function(){};l.verbose("Removing context push state",l.get.direction());l.unbind.clickaway();l.unbind.scrollLock();f=function(){l.set.transition(u);l.set.animating();l.remove.visible();k.dimPage&&!l.othersVisible()&&ut.removeClass(g.dimmed)};r=function(n){n.target==i[0]&&(i.off(ft+it,r),l.remove.animating(),l.remove.transition(),l.remove.inlineCSS(),("scale down"==u||k.returnScroll&&l.is.mobile())&&l.scrollBack(),t.call(nt))};i.off(ft+it);i.on(ft+it,r);o(f)},scrollToTop:function(){l.verbose("Scrolling to top of page to avoid animation issues");yt=n(t).scrollTop();d.scrollTop(0);t.scrollTo(0,0)},scrollBack:function(){l.verbose("Scrolling back to original page position");t.scrollTo(0,yt)},clear:{cache:function(){l.verbose("Clearing cached dimensions");l.cache={}}},set:{ios:function(){a.addClass(g.ios)},pushed:function(){tt.addClass(g.pushed)},pushable:function(){tt.addClass(g.pushable)},dimmed:function(){ut.addClass(g.dimmed)},active:function(){d.addClass(g.active)},animating:function(){d.addClass(g.animating)},transition:function(n){n=n||l.get.transition();d.addClass(n)},direction:function(n){n=n||l.get.direction();d.addClass(g[n])},visible:function(){d.addClass(g.visible)},overlay:function(){d.addClass(g.overlay)}},remove:{inlineCSS:function(){l.debug("Removing inline css styles",et);et&&et.length>0&&et.remove()},ios:function(){a.removeClass(g.ios)},pushed:function(){tt.removeClass(g.pushed)},pushable:function(){tt.removeClass(g.pushable)},active:function(){d.removeClass(g.active)},animating:function(){d.removeClass(g.animating)},transition:function(n){n=n||l.get.transition();d.removeClass(n)},direction:function(n){n=n||l.get.direction();d.removeClass(g[n])},visible:function(){d.removeClass(g.visible)},overlay:function(){d.removeClass(g.overlay)}},get:{direction:function(){return d.hasClass(g.top)?g.top:d.hasClass(g.right)?g.right:d.hasClass(g.bottom)?g.bottom:g.left},transition:function(){var n,t=l.get.direction();return n=l.is.mobile()?"auto"==k.mobileTransition?k.defaultTransition.mobile[t]:k.mobileTransition:"auto"==k.transition?k.defaultTransition.computer[t]:k.transition,l.verbose("Determined transition",n),n},transitionEvent:function(){var n,u=i.createElement("element"),t={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(n in t)if(u.style[n]!==r)return t[n]}},is:{ie:function(){var n=!t.ActiveXObject&&"ActiveXObject"in t,i="ActiveXObject"in t;return n||i},ios:function(){var n=navigator.userAgent,t=n.match(at.ios),i=n.match(at.mobileChrome);return!(!t||i)&&(l.verbose("Browser was found to be iOS",n),!0)},mobile:function(){var n=navigator.userAgent,t=n.match(at.mobile);return t?(l.verbose("Browser was found to be mobile",n),!0):(l.verbose("Browser is not mobile, using regular transition",n),!1)},hidden:function(){return!l.is.visible()},visible:function(){return d.hasClass(g.visible)},open:function(){return l.is.visible()},closed:function(){return l.is.hidden()},vertical:function(){return d.hasClass(g.top)},animating:function(){return tt.hasClass(g.animating)},rtl:function(){return l.cache.rtl===r&&(l.cache.rtl="rtl"==d.css("direction")),l.cache.rtl}},setting:function(t,i){if(l.debug("Changing setting",t,i),n.isPlainObject(t))n.extend(!0,k,t);else{if(i===r)return k[t];n.isPlainObject(k[t])?n.extend(!0,k[t],i):k[t]=i}},internal:function(t,i){if(n.isPlainObject(t))n.extend(!0,l,t);else{if(i===r)return l[t];l[t]=i}},debug:function(){!k.silent&&k.debug&&(k.performance?l.performance.log(arguments):(l.debug=Function.prototype.bind.call(console.info,console,k.name+":"),l.debug.apply(console,arguments)))},verbose:function(){!k.silent&&k.verbose&&k.debug&&(k.performance?l.performance.log(arguments):(l.verbose=Function.prototype.bind.call(console.info,console,k.name+":"),l.verbose.apply(console,arguments)))},error:function(){k.silent||(l.error=Function.prototype.bind.call(console.error,console,k.name+":"),l.error.apply(console,arguments))},performance:{log:function(n){var t,i,r;k.performance&&(t=(new Date).getTime(),r=c||t,i=t-r,c=t,e.push({Name:n[0],Arguments:[].slice.call(n,1)||"",Element:nt,"Execution Time":i}));clearTimeout(l.performance.timer);l.performance.timer=setTimeout(l.performance.display,500)},display:function(){var t=k.name+":",i=0;c=!1;clearTimeout(l.performance.timer);n.each(e,function(n,t){i+=t["Execution Time"]});t+=" "+i+"ms";v&&(t+=" '"+v+"'");(console.group!==r||console.table!==r)&&e.length>0&&(console.groupCollapsed(t),console.table?console.table(e):n.each(e,function(n,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd());e=[]}},invoke:function(t,i,u){var h,o,s,e=ct;return i=i||b,u=nt||u,"string"==typeof t&&e!==r&&(t=t.split(/[\. ]/),h=t.length-1,n.each(t,function(i,u){var f=i!=h?u+t[i+1].charAt(0).toUpperCase()+t[i+1].slice(1):t;if(n.isPlainObject(e[f])&&i!=h)e=e[f];else{if(e[f]!==r)return o=e[f],!1;if(!n.isPlainObject(e[u])||i==h)return e[u]!==r?(o=e[u],!1):(l.error(st.method,t),!1);e=e[u]}})),n.isFunction(o)?s=o.apply(u,i):o!==r&&(s=o),n.isArray(f)?f.push(s):f!==r?f=[f,s]:s!==r&&(f=s),o}};w?(ct===r&&l.initialize(),l.invoke(y)):(ct!==r&&l.invoke("destroy"),l.initialize())}),f!==r?f:this};n.fn.sidebar.settings={name:"Sidebar",namespace:"sidebar",silent:!1,debug:!1,verbose:!1,performance:!0,transition:"auto",mobileTransition:"auto",defaultTransition:{computer:{left:"uncover",right:"uncover",top:"overlay",bottom:"overlay"},mobile:{left:"uncover",right:"uncover",top:"overlay",bottom:"overlay"}},context:"body",exclusive:!1,closable:!0,dimPage:!0,scrollLock:!1,returnScroll:!1,delaySetup:!1,duration:500,onChange:function(){},onShow:function(){},onHide:function(){},onHidden:function(){},onVisible:function(){},className:{active:"active",animating:"animating",dimmed:"dimmed",ios:"ios",pushable:"pushable",pushed:"pushed",right:"right",top:"top",left:"left",bottom:"bottom",visible:"visible"},selector:{fixed:".fixed",omitted:"script, link, style, .ui.modal, .ui.dimmer, .ui.nag, .ui.fixed",pusher:".pusher",sidebar:".ui.sidebar"},regExp:{ios:/(iPad|iPhone|iPod)/g,mobileChrome:/(CriOS)/g,mobile:/Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune/g},error:{method:"The method you called is not defined.",pusher:"Had to add pusher element. For optimal performance make sure body content is inside a pusher element",movedSidebar:"Had to move sidebar. For optimal performance make sure sidebar and pusher are direct children of your body tag",overlay:"The overlay setting is no longer supported, use animation: overlay",notFound:"There were no elements that matched the specified selector"}}}(jQuery,window,document),function(n,t,i,r){"use strict";t="undefined"!=typeof t&&t.Math==Math?t:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();n.fn.transition=function(){var u,e=n(this),h=e.selector||"",o=(new Date).getTime(),f=[],c=arguments,l=c[0],a=[].slice.call(arguments,1),s="string"==typeof l;return t.requestAnimationFrame||t.mozRequestAnimationFrame||t.webkitRequestAnimationFrame||t.msRequestAnimationFrame||function(n){setTimeout(n,0)},e.each(function(t){var y,d,it,w,nt,k,tt,g,v,p=n(this),b=this;v={initialize:function(){y=v.get.settings.apply(b,c);w=y.className;it=y.error;nt=y.metadata;g="."+y.namespace;tt="module-"+y.namespace;d=p.data(tt)||v;k=v.get.animationEndEvent();s&&(s=v.invoke(l));s===!1&&(v.verbose("Converted arguments into settings object",y),y.interval?v.delay(y.animate):v.animate(),v.instantiate())},instantiate:function(){v.verbose("Storing instance of module",v);d=v;p.data(tt,d)},destroy:function(){v.verbose("Destroying previous module for",b);p.removeData(tt)},refresh:function(){v.verbose("Refreshing display type on next animation");delete v.displayType},forceRepaint:function(){v.verbose("Forcing element repaint");var t=p.parent(),n=p.next();0===n.length?p.detach().appendTo(t):p.detach().insertBefore(n)},repaint:function(){v.verbose("Repainting element");b.offsetWidth},delay:function(n){var f,i,u=v.get.animationDirection();u||(u=v.can.transition()?v.get.direction():"static");n=n!==r?n:y.interval;f="auto"==y.reverse&&u==w.outward;i=f||1==y.reverse?(e.length-t)*y.interval:t*y.interval;v.debug("Delaying animation by",i);setTimeout(v.animate,i)},animate:function(n){if(y=n||y,!v.is.supported())return v.error(it.support),!1;if(v.debug("Preparing animation",y.animation),v.is.animating()){if(y.queue)return!y.allowRepeats&&v.has.direction()&&v.is.occurring()&&v.queuing!==!0?v.debug("Animation is currently occurring, preventing queueing same animation",y.animation):v.queue(y.animation),!1;if(!y.allowRepeats&&v.is.occurring())return v.debug("Animation is already occurring, will not execute repeated animation",y.animation),!1;v.debug("New animation started, completing previous early",y.animation);d.complete()}v.can.animate()?v.set.animating(y.animation):v.error(it.noAnimation,y.animation,b)},reset:function(){v.debug("Resetting animation to beginning conditions");v.remove.animationCallbacks();v.restore.conditions();v.remove.animating()},queue:function(n){v.debug("Queueing animation of",n);v.queuing=!0;p.one(k+".queue"+g,function(){v.queuing=!1;v.repaint();v.animate.apply(this,y)})},complete:function(){v.debug("Animation complete",y.animation);v.remove.completeCallback();v.remove.failSafe();v.is.looping()||(v.is.outward()?(v.verbose("Animation is outward, hiding element"),v.restore.conditions(),v.hide()):v.is.inward()?(v.verbose("Animation is outward, showing element"),v.restore.conditions(),v.show()):(v.verbose("Static animation completed"),v.restore.conditions(),y.onComplete.call(b)))},force:{visible:function(){var t=p.attr("style"),i=v.get.userStyle(),n=v.get.displayType(),u=i+"display: "+n+" !important;",f=p.css("display"),e=t===r||""===t;f!==n?(v.verbose("Overriding default display to show element",n),p.attr("style",u)):e&&p.removeAttr("style")},hidden:function(){var n=p.attr("style"),t=p.css("display"),i=n===r||""===n;"none"===t||v.is.hidden()?i&&p.removeAttr("style"):(v.verbose("Overriding default display to hide element"),p.css("display","none"))}},has:{direction:function(t){var i=!1;return t=t||y.animation,"string"==typeof t&&(t=t.split(" "),n.each(t,function(n,t){t!==w.inward&&t!==w.outward||(i=!0)})),i},inlineDisplay:function(){var t=p.attr("style")||"";return n.isArray(t.match(/display.*?;/,""))}},set:{animating:function(n){var t;v.remove.completeCallback();n=n||y.animation;t=v.get.animationClass(n);v.save.animation(t);v.force.visible();v.remove.hidden();v.remove.direction();v.start.animation(t)},duration:function(n,t){t=t||y.duration;t="number"==typeof t?t+"ms":t;(t||0===t)&&(v.verbose("Setting animation duration",t),p.css({"animation-duration":t}))},direction:function(n){n=n||v.get.direction();n==w.inward?v.set.inward():v.set.outward()},looping:function(){v.debug("Transition set to loop");p.addClass(w.looping)},hidden:function(){p.addClass(w.transition).addClass(w.hidden)},inward:function(){v.debug("Setting direction to inward");p.removeClass(w.outward).addClass(w.inward)},outward:function(){v.debug("Setting direction to outward");p.removeClass(w.inward).addClass(w.outward)},visible:function(){p.addClass(w.transition).addClass(w.visible)}},start:{animation:function(n){n=n||v.get.animationClass();v.debug("Starting tween",n);p.addClass(n).one(k+".complete"+g,v.complete);y.useFailSafe&&v.add.failSafe();v.set.duration(y.duration);y.onStart.call(b)}},save:{animation:function(n){v.cache||(v.cache={});v.cache.animation=n},displayType:function(n){"none"!==n&&p.data(nt.displayType,n)},transitionExists:function(t,i){n.fn.transition.exists[t]=i;v.verbose("Saving existence of transition",t,i)}},restore:{conditions:function(){var n=v.get.currentAnimation();n&&(p.removeClass(n),v.verbose("Removing animation class",v.cache));v.remove.duration()}},add:{failSafe:function(){var n=v.get.duration();v.timer=setTimeout(function(){p.triggerHandler(k)},n+y.failSafeDelay);v.verbose("Adding fail safe timer",v.timer)}},remove:{animating:function(){p.removeClass(w.animating)},animationCallbacks:function(){v.remove.queueCallback();v.remove.completeCallback()},queueCallback:function(){p.off(".queue"+g)},completeCallback:function(){p.off(".complete"+g)},display:function(){p.css("display","")},direction:function(){p.removeClass(w.inward).removeClass(w.outward)},duration:function(){p.css("animation-duration","")},failSafe:function(){v.verbose("Removing fail safe timer",v.timer);v.timer&&clearTimeout(v.timer)},hidden:function(){p.removeClass(w.hidden)},visible:function(){p.removeClass(w.visible)},looping:function(){v.debug("Transitions are no longer looping");v.is.looping()&&(v.reset(),p.removeClass(w.looping))},transition:function(){p.removeClass(w.visible).removeClass(w.hidden)}},get:{settings:function(t,i,r){return"object"==typeof t?n.extend(!0,{},n.fn.transition.settings,t):"function"==typeof r?n.extend({},n.fn.transition.settings,{animation:t,onComplete:r,duration:i}):"string"==typeof i||"number"==typeof i?n.extend({},n.fn.transition.settings,{animation:t,duration:i}):"object"==typeof i?n.extend({},n.fn.transition.settings,i,{animation:t}):"function"==typeof i?n.extend({},n.fn.transition.settings,{animation:t,onComplete:i}):n.extend({},n.fn.transition.settings,{animation:t})},animationClass:function(n){var t=n||y.animation,i=v.can.transition()&&!v.has.direction()?v.get.direction()+" ":"";return w.animating+" "+w.transition+" "+i+t},currentAnimation:function(){return!(!v.cache||v.cache.animation===r)&&v.cache.animation},currentDirection:function(){return v.is.inward()?w.inward:w.outward},direction:function(){return v.is.hidden()||!v.is.visible()?w.inward:w.outward},animationDirection:function(t){var i;return t=t||y.animation,"string"==typeof t&&(t=t.split(" "),n.each(t,function(n,t){t===w.inward?i=w.inward:t===w.outward&&(i=w.outward)})),!!i&&i},duration:function(n){return n=n||y.duration,n===!1&&(n=p.css("animation-duration")||0),"string"==typeof n?n.indexOf("ms")>-1?parseFloat(n):1e3*parseFloat(n):n},displayType:function(n){return n=n===r||n,y.displayType?y.displayType:(n&&p.data(nt.displayType)===r&&v.can.transition(!0),p.data(nt.displayType))},userStyle:function(n){return n=n||p.attr("style")||"",n.replace(/display.*?;/,"")},transitionExists:function(t){return n.fn.transition.exists[t]},animationStartEvent:function(){var n,u=i.createElement("div"),t={animation:"animationstart",OAnimation:"oAnimationStart",MozAnimation:"mozAnimationStart",WebkitAnimation:"webkitAnimationStart"};for(n in t)if(u.style[n]!==r)return t[n];return!1},animationEndEvent:function(){var n,u=i.createElement("div"),t={animation:"animationend",OAnimation:"oAnimationEnd",MozAnimation:"mozAnimationEnd",WebkitAnimation:"webkitAnimationEnd"};for(n in t)if(u.style[n]!==r)return t[n];return!1}},can:{transition:function(t){var s,c,u,e,l,o,i=y.animation,h=v.get.transitionExists(i),f=v.get.displayType(!1);if(h===r||t){if(v.verbose("Determining whether animation exists"),s=p.attr("class"),c=p.prop("tagName"),u=n("<"+c+" />").addClass(s).insertAfter(p),e=u.addClass(i).removeClass(w.inward).removeClass(w.outward).addClass(w.animating).addClass(w.transition).css("animationName"),l=u.addClass(w.inward).css("animationName"),f||(f=u.attr("class",s).removeAttr("style").removeClass(w.hidden).removeClass(w.visible).show().css("display"),v.verbose("Determining final display state",f),v.save.displayType(f)),u.remove(),e!=l)v.debug("Direction exists for animation",i),o=!0;else{if("none"==e||!e)return void v.debug("No animation defined in css",i);v.debug("Static animation found",i,f);o=!1}v.save.transitionExists(i,o)}return h!==r?h:o},animate:function(){return v.can.transition()!==r}},is:{animating:function(){return p.hasClass(w.animating)},inward:function(){return p.hasClass(w.inward)},outward:function(){return p.hasClass(w.outward)},looping:function(){return p.hasClass(w.looping)},occurring:function(n){return n=n||y.animation,n="."+n.replace(" ","."),p.filter(n).length>0},visible:function(){return p.is(":visible")},hidden:function(){return"hidden"===p.css("visibility")},supported:function(){return k!==!1}},hide:function(){v.verbose("Hiding element");v.is.animating()&&v.reset();b.blur();v.remove.display();v.remove.visible();v.set.hidden();v.force.hidden();y.onHide.call(b);y.onComplete.call(b)},show:function(n){v.verbose("Showing element",n);v.remove.hidden();v.set.visible();v.force.visible();y.onShow.call(b);y.onComplete.call(b)},toggle:function(){v.is.visible()?v.hide():v.show()},stop:function(){v.debug("Stopping current animation");p.triggerHandler(k)},stopAll:function(){v.debug("Stopping all animation");v.remove.queueCallback();p.triggerHandler(k)},clear:{queue:function(){v.debug("Clearing animation queue");v.remove.queueCallback()}},enable:function(){v.verbose("Starting animation");p.removeClass(w.disabled)},disable:function(){v.debug("Stopping animation");p.addClass(w.disabled)},setting:function(t,i){if(v.debug("Changing setting",t,i),n.isPlainObject(t))n.extend(!0,y,t);else{if(i===r)return y[t];n.isPlainObject(y[t])?n.extend(!0,y[t],i):y[t]=i}},internal:function(t,i){if(n.isPlainObject(t))n.extend(!0,v,t);else{if(i===r)return v[t];v[t]=i}},debug:function(){!y.silent&&y.debug&&(y.performance?v.performance.log(arguments):(v.debug=Function.prototype.bind.call(console.info,console,y.name+":"),v.debug.apply(console,arguments)))},verbose:function(){!y.silent&&y.verbose&&y.debug&&(y.performance?v.performance.log(arguments):(v.verbose=Function.prototype.bind.call(console.info,console,y.name+":"),v.verbose.apply(console,arguments)))},error:function(){y.silent||(v.error=Function.prototype.bind.call(console.error,console,y.name+":"),v.error.apply(console,arguments))},performance:{log:function(n){var t,i,r;y.performance&&(t=(new Date).getTime(),r=o||t,i=t-r,o=t,f.push({Name:n[0],Arguments:[].slice.call(n,1)||"",Element:b,"Execution Time":i}));clearTimeout(v.performance.timer);v.performance.timer=setTimeout(v.performance.display,500)},display:function(){var t=y.name+":",i=0;o=!1;clearTimeout(v.performance.timer);n.each(f,function(n,t){i+=t["Execution Time"]});t+=" "+i+"ms";h&&(t+=" '"+h+"'");e.length>1&&(t+=" ("+e.length+")");(console.group!==r||console.table!==r)&&f.length>0&&(console.groupCollapsed(t),console.table?console.table(f):n.each(f,function(n,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd());f=[]}},invoke:function(t,i,f){var h,o,s,e=d;return i=i||a,f=b||f,"string"==typeof t&&e!==r&&(t=t.split(/[\. ]/),h=t.length-1,n.each(t,function(i,u){var f=i!=h?u+t[i+1].charAt(0).toUpperCase()+t[i+1].slice(1):t;if(n.isPlainObject(e[f])&&i!=h)e=e[f];else{if(e[f]!==r)return o=e[f],!1;if(!n.isPlainObject(e[u])||i==h)return e[u]!==r&&(o=e[u],!1);e=e[u]}})),n.isFunction(o)?s=o.apply(f,i):o!==r&&(s=o),n.isArray(u)?u.push(s):u!==r?u=[u,s]:s!==r&&(u=s),o!==r&&o}};v.initialize()}),u!==r?u:this};n.fn.transition.exists={};n.fn.transition.settings={name:"Transition",silent:!1,debug:!1,verbose:!1,performance:!0,namespace:"transition",interval:0,reverse:"auto",onStart:function(){},onComplete:function(){},onShow:function(){},onHide:function(){},useFailSafe:!0,failSafeDelay:100,allowRepeats:!1,displayType:!1,animation:"fade",duration:!1,queue:!0,metadata:{displayType:"display"},className:{animating:"animating",disabled:"disabled",hidden:"hidden",inward:"in",loading:"loading",looping:"looping",outward:"out",transition:"transition",visible:"visible"},error:{noAnimation:"Element is no longer attached to DOM. Unable to animate.  Use silent setting to surpress this warning in production.",repeated:"That animation is already occurring, cancelling repeated animation",method:"The method you called is not defined",support:"This browser does not support CSS animations"}}}(jQuery,window,document),function(n,t,i,r){"use strict";var t="undefined"!=typeof t&&t.Math==Math?t:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();n.api=n.fn.api=function(i){var u,o=n(n.isFunction(this)?t:this),s=o.selector||"",e=(new Date).getTime(),f=[],h=arguments[0],c="string"==typeof h,l=[].slice.call(arguments,1);return o.each(function(){var k,nt,y,tt,rt,o,a=n.isPlainObject(i)?n.extend(!0,{},n.fn.api.settings,i):n.extend({},n.fn.api.settings),ft=a.namespace,et=a.metadata,ot=a.selector,w=a.error,it=a.className,st="."+ft,ut="module-"+ft,v=n(this),ht=v.closest(ot.form),p=a.stateContext?n(a.stateContext):v,d=this,b=p[0],g=v.data(ut);o={initialize:function(){c||o.bind.events();o.instantiate()},instantiate:function(){o.verbose("Storing instance of module",o);g=o;v.data(ut,g)},destroy:function(){o.verbose("Destroying previous module for",d);v.removeData(ut).off(st)},bind:{events:function(){var n=o.get.event();n?(o.verbose("Attaching API events to element",n),v.on(n+st,o.event.trigger)):"now"==a.on&&(o.debug("Querying API endpoint immediately"),o.query())}},decode:{json:function(n){if(n!==r&&"string"==typeof n)try{n=JSON.parse(n)}catch(t){}return n}},read:{cachedResponse:function(n){var i;return t.Storage===r?void o.error(w.noStorage):(i=sessionStorage.getItem(n),o.debug("Using cached response",n,i),i=o.decode.json(i))}},write:{cachedResponse:function(i,u){return u&&""===u?void o.debug("Response empty, not caching",u):t.Storage===r?void o.error(w.noStorage):(n.isPlainObject(u)&&(u=JSON.stringify(u)),sessionStorage.setItem(i,u),void o.verbose("Storing cached response for url",i,u))}},query:function(){if(o.is.disabled())return void o.debug("Element is disabled API request aborted");if(o.is.loading()){if(!a.interruptRequests)return void o.debug("Cancelling request, previous request is still pending");o.debug("Interrupting previous request");o.abort()}return a.defaultData&&n.extend(!0,a.urlData,o.get.defaultData()),a.serializeForm&&(a.data=o.add.formData(a.data)),nt=o.get.settings(),nt===!1?(o.cancelled=!0,void o.error(w.beforeSend)):(o.cancelled=!1,y=o.get.templatedURL(),y||o.is.mocked()?(y=o.add.urlData(y),y||o.is.mocked()?(nt.url=a.base+y,k=n.extend(!0,{},a,{type:a.method||a.type,data:tt,url:a.base+y,beforeSend:a.beforeXHR,success:function(){},failure:function(){},complete:function(){}}),o.debug("Querying URL",k.url),o.verbose("Using AJAX settings",k),"local"===a.cache&&o.read.cachedResponse(y)?(o.debug("Response returned from local cache"),o.request=o.create.request(),void o.request.resolveWith(b,[o.read.cachedResponse(y)])):void(a.throttle?a.throttleFirstRequest||o.timer?(o.debug("Throttling request",a.throttle),clearTimeout(o.timer),o.timer=setTimeout(function(){o.timer&&delete o.timer;o.debug("Sending throttled request",tt,k.method);o.send.request()},a.throttle)):(o.debug("Sending request",tt,k.method),o.send.request(),o.timer=setTimeout(function(){},a.throttle)):(o.debug("Sending request",tt,k.method),o.send.request()))):void 0):void o.error(w.missingURL))},should:{removeError:function(){return a.hideError===!0||"auto"===a.hideError&&!o.is.form()}},is:{disabled:function(){return v.filter(ot.disabled).length>0},expectingJSON:function(){return"json"===a.dataType||"jsonp"===a.dataType},form:function(){return v.is("form")||p.is("form")},mocked:function(){return a.mockResponse||a.mockResponseAsync||a.response||a.responseAsync},input:function(){return v.is("input")},loading:function(){return!!o.request&&"pending"==o.request.state()},abortedRequest:function(n){return n&&n.readyState!==r&&0===n.readyState?(o.verbose("XHR request determined to be aborted"),!0):(o.verbose("XHR request was not aborted"),!1)},validResponse:function(t){return o.is.expectingJSON()&&n.isFunction(a.successTest)?(o.debug("Checking JSON returned success",a.successTest,t),a.successTest(t)?(o.debug("Response passed success test",t),!0):(o.debug("Response failed success test",t),!1)):(o.verbose("Response is not JSON, skipping validation",a.successTest,t),!0)}},was:{cancelled:function(){return o.cancelled||!1},succesful:function(){return o.request&&"resolved"==o.request.state()},failure:function(){return o.request&&"rejected"==o.request.state()},complete:function(){return o.request&&("resolved"==o.request.state()||"rejected"==o.request.state())}},add:{urlData:function(t,i){var u,f;return t&&(u=t.match(a.regExp.required),f=t.match(a.regExp.optional),i=i||a.urlData,u&&(o.debug("Looking for required URL variables",u),n.each(u,function(u,f){var e=f.indexOf("$")!==-1?f.substr(2,f.length-3):f.substr(1,f.length-2),s=n.isPlainObject(i)&&i[e]!==r?i[e]:v.data(e)!==r?v.data(e):p.data(e)!==r?p.data(e):i[e];return s===r?(o.error(w.requiredParameter,e,t),t=!1,!1):(o.verbose("Found required variable",e,s),s=a.encodeParameters?o.get.urlEncodedValue(s):s,t=t.replace(f,s),void 0)})),f&&(o.debug("Looking for optional URL variables",u),n.each(f,function(u,f){var e=f.indexOf("$")!==-1?f.substr(3,f.length-4):f.substr(2,f.length-3),s=n.isPlainObject(i)&&i[e]!==r?i[e]:v.data(e)!==r?v.data(e):p.data(e)!==r?p.data(e):i[e];s!==r?(o.verbose("Optional variable Found",e,s),t=t.replace(f,s)):(o.verbose("Optional variable not found",e),t=t.indexOf("/"+f)!==-1?t.replace("/"+f,""):t.replace(f,""))}))),t},formData:function(t){var u,f=n.fn.serializeObject!==r,i=f?ht.serializeObject():ht.serialize();return t=t||a.data,u=n.isPlainObject(t),u?f?(o.debug("Extending existing data with form data",t,i),t=n.extend(!0,{},t,i)):(o.error(w.missingSerialize),o.debug("Cant extend data. Replacing data with form data",t,i),t=i):(o.debug("Adding form data",i),t=i),t}},send:{request:function(){o.set.loading();o.request=o.create.request();o.is.mocked()?o.mockedXHR=o.create.mockedXHR():o.xhr=o.create.xhr();a.onRequest.call(b,o.request,o.xhr)}},event:{trigger:function(n){o.query();"submit"!=n.type&&"click"!=n.type||n.preventDefault()},xhr:{always:function(){},done:function(t,i,r){var f=this,s=(new Date).getTime()-rt,u=a.loadingDuration-s,e=!!n.isFunction(a.onResponse)&&(o.is.expectingJSON()?a.onResponse.call(f,n.extend(!0,{},t)):a.onResponse.call(f,t));u=u>0?u:0;e&&(o.debug("Modified API response in onResponse callback",a.onResponse,e,t),t=e);u>0&&o.debug("Response completed early delaying state change by",u);setTimeout(function(){o.is.validResponse(t)?o.request.resolveWith(f,[t,r]):o.request.rejectWith(f,[r,"invalid"])},u)},fail:function(n,t,i){var u=this,f=(new Date).getTime()-rt,r=a.loadingDuration-f;r=r>0?r:0;r>0&&o.debug("Response completed early delaying state change by",r);setTimeout(function(){o.is.abortedRequest(n)?o.request.rejectWith(u,[n,"aborted",i]):o.request.rejectWith(u,[n,"error",t,i])},r)}},request:{done:function(n,t){o.debug("Successful API Response",n);"local"===a.cache&&y&&(o.write.cachedResponse(y,n),o.debug("Saving server response locally",o.cache));a.onSuccess.call(b,n,v,t)},complete:function(n,t){var i,r;o.was.succesful()?(r=n,i=t):(i=n,r=o.get.responseFromXHR(i));o.remove.loading();a.onComplete.call(b,r,v,i)},fail:function(n,t,i){var u=o.get.responseFromXHR(n),f=o.get.errorFromRequest(u,t,i);return"aborted"==t?(o.debug("XHR Aborted (Most likely caused by page navigation or CORS Policy)",t,i),a.onAbort.call(b,t,v,n),!0):("invalid"==t?o.debug("JSON did not pass success test. A server-side error has most likely occurred",u):"error"==t&&n!==r&&(o.debug("XHR produced a server error",t,i),200!=n.status&&i!==r&&""!==i&&o.error(w.statusMessage+i,k.url),a.onError.call(b,f,v,n)),a.errorDuration&&"aborted"!==t&&(o.debug("Adding error state"),o.set.error(),o.should.removeError()&&setTimeout(o.remove.error,a.errorDuration)),o.debug("API Request failed",f,n),void a.onFailure.call(b,u,v,n))}}},create:{request:function(){return n.Deferred().always(o.event.request.complete).done(o.event.request.done).fail(o.event.request.fail)},mockedXHR:function(){var f,r,i,e=!1,s=!1,h=!1,t=a.mockResponse||a.response,u=a.mockResponseAsync||a.responseAsync;return i=n.Deferred().always(o.event.xhr.complete).done(o.event.xhr.done).fail(o.event.xhr.fail),t?(n.isFunction(t)?(o.debug("Using specified synchronous callback",t),r=t.call(b,nt)):(o.debug("Using settings specified response",t),r=t),i.resolveWith(b,[r,e,{responseText:r}])):n.isFunction(u)&&(f=function(n){o.debug("Async callback returned response",n);n?i.resolveWith(b,[n,e,{responseText:n}]):i.rejectWith(b,[{responseText:n},s,h])},o.debug("Using specified async response callback",u),u.call(b,nt,f)),i},xhr:function(){var t;return t=n.ajax(k).always(o.event.xhr.always).done(o.event.xhr.done).fail(o.event.xhr.fail),o.verbose("Created server request",t,k),t}},set:{error:function(){o.verbose("Adding error state to element",p);p.addClass(it.error)},loading:function(){o.verbose("Adding loading state to element",p);p.addClass(it.loading);rt=(new Date).getTime()}},remove:{error:function(){o.verbose("Removing error state from element",p);p.removeClass(it.error)},loading:function(){o.verbose("Removing loading state from element",p);p.removeClass(it.loading)}},get:{responseFromXHR:function(t){return!!n.isPlainObject(t)&&(o.is.expectingJSON()?o.decode.json(t.responseText):t.responseText)},errorFromRequest:function(t,i,u){return n.isPlainObject(t)&&t.error!==r?t.error:a.error[i]!==r?a.error[i]:u},request:function(){return o.request||!1},xhr:function(){return o.xhr||!1},settings:function(){var t;return t=a.beforeSend.call(b,a),t&&(t.success!==r&&(o.debug("Legacy success callback detected",t),o.error(w.legacyParameters,t.success),t.onSuccess=t.success),t.failure!==r&&(o.debug("Legacy failure callback detected",t),o.error(w.legacyParameters,t.failure),t.onFailure=t.failure),t.complete!==r&&(o.debug("Legacy complete callback detected",t),o.error(w.legacyParameters,t.complete),t.onComplete=t.complete)),t===r&&o.error(w.noReturnedValue),t===!1?t:t!==r?n.extend(!0,{},t):n.extend(!0,{},a)},urlEncodedValue:function(n){var r=t.decodeURIComponent(n),i=t.encodeURIComponent(n),u=r!==n;return u?(o.debug("URL value is already encoded, avoiding double encoding",n),n):(o.verbose("Encoding value using encodeURIComponent",n,i),i)},defaultData:function(){var t={};return n.isWindow(d)||(o.is.input()?t.value=v.val():o.is.form()||(t.text=v.text())),t},event:function(){return n.isWindow(d)||"now"==a.on?(o.debug("API called without element, no events attached"),!1):"auto"==a.on?v.is("input")?d.oninput!==r?"input":d.onpropertychange!==r?"propertychange":"keyup":v.is("form")?"submit":"click":a.on},templatedURL:function(n){if(n=n||v.data(et.action)||a.action||!1,y=v.data(et.url)||a.url||!1)return o.debug("Using specified url",y),y;if(n){if(o.debug("Looking up url for action",n,a.api),a.api[n]===r&&!o.is.mocked())return void o.error(w.missingAction,a.action,a.api);y=a.api[n]}else o.is.form()&&(y=v.attr("action")||p.attr("action")||!1,o.debug("No url or action specified, defaulting to form action",y));return y}},abort:function(){var n=o.get.xhr();n&&"resolved"!==n.state()&&(o.debug("Cancelling API request"),n.abort())},reset:function(){o.remove.error();o.remove.loading()},setting:function(t,i){if(o.debug("Changing setting",t,i),n.isPlainObject(t))n.extend(!0,a,t);else{if(i===r)return a[t];n.isPlainObject(a[t])?n.extend(!0,a[t],i):a[t]=i}},internal:function(t,i){if(n.isPlainObject(t))n.extend(!0,o,t);else{if(i===r)return o[t];o[t]=i}},debug:function(){!a.silent&&a.debug&&(a.performance?o.performance.log(arguments):(o.debug=Function.prototype.bind.call(console.info,console,a.name+":"),o.debug.apply(console,arguments)))},verbose:function(){!a.silent&&a.verbose&&a.debug&&(a.performance?o.performance.log(arguments):(o.verbose=Function.prototype.bind.call(console.info,console,a.name+":"),o.verbose.apply(console,arguments)))},error:function(){a.silent||(o.error=Function.prototype.bind.call(console.error,console,a.name+":"),o.error.apply(console,arguments))},performance:{log:function(n){var t,i,r;a.performance&&(t=(new Date).getTime(),r=e||t,i=t-r,e=t,f.push({Name:n[0],Arguments:[].slice.call(n,1)||"","Execution Time":i}));clearTimeout(o.performance.timer);o.performance.timer=setTimeout(o.performance.display,500)},display:function(){var t=a.name+":",i=0;e=!1;clearTimeout(o.performance.timer);n.each(f,function(n,t){i+=t["Execution Time"]});t+=" "+i+"ms";s&&(t+=" '"+s+"'");(console.group!==r||console.table!==r)&&f.length>0&&(console.groupCollapsed(t),console.table?console.table(f):n.each(f,function(n,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd());f=[]}},invoke:function(t,i,f){var c,s,h,e=g;return i=i||l,f=d||f,"string"==typeof t&&e!==r&&(t=t.split(/[\. ]/),c=t.length-1,n.each(t,function(i,u){var f=i!=c?u+t[i+1].charAt(0).toUpperCase()+t[i+1].slice(1):t;if(n.isPlainObject(e[f])&&i!=c)e=e[f];else{if(e[f]!==r)return s=e[f],!1;if(!n.isPlainObject(e[u])||i==c)return e[u]!==r?(s=e[u],!1):(o.error(w.method,t),!1);e=e[u]}})),n.isFunction(s)?h=s.apply(f,i):s!==r&&(h=s),n.isArray(u)?u.push(h):u!==r?u=[u,h]:h!==r&&(u=h),s}};c?(g===r&&o.initialize(),o.invoke(h)):(g!==r&&g.invoke("destroy"),o.initialize())}),u!==r?u:this};n.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(n){return n},beforeXHR:function(){},onRequest:function(){},onResponse:!1,onSuccess:function(){},onComplete:function(){},onFailure:function(){},onError:function(){},onAbort:function(){},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)