/*! * # Semantic UI 2.0.0 - Dropdown * http://github.com/semantic-org/semantic-ui/ * * * Copyright 2014 Contributors * Released under the MIT license * http://opensource.org/licenses/MIT * */ !function(e,t,n,i){"use strict";e.fn.dropdown=function(o){var a,s=e(this),r=e(n),l=s.selector||"",c="ontouchstart"in n.documentElement,u=(new Date).getTime(),d=[],v=arguments[0],f="string"==typeof v,m=[].slice.call(arguments,1);return s.each(function(){var h,g,p,b,w,y=e.isPlainObject(o)?e.extend(!0,{},e.fn.dropdown.settings,o):e.extend({},e.fn.dropdown.settings),x=y.className,C=y.message,S=y.metadata,T=y.namespace,k=y.regExp,A=y.selector,D=y.error,E=y.templates,L="."+T,I="module-"+T,O=e(this),q=O.find(A.text),F=O.find(A.search),R=O.find(A.input),z=O.find(A.icon),V=O.prev().find(A.text).length>0?O.prev().find(A.text):O.prev(),M=O.children(A.menu),P=M.find(A.item),j=!1,H=!1,U=this,K=O.data(I);w={initialize:function(){w.debug("Initializing dropdown",y),w.is.alreadySetup()?w.setup.reference():(w.setup.layout(),w.save.defaults(),w.set.selected(),w.create.id(),c&&w.bind.touchEvents(),w.bind.mouseEvents(),w.bind.keyboardEvents(),w.observeChanges(),w.instantiate())},instantiate:function(){w.verbose("Storing instance of dropdown",w),K=w,O.data(I,w)},destroy:function(){w.verbose("Destroying previous dropdown for",O),w.remove.tabbable(),O.off(L).removeData(I),M.off(L),r.off(h),p&&p.disconnect(),b&&b.disconnect()},observeChanges:function(){"MutationObserver"in t&&(p=new MutationObserver(function(){w.debug("").addClass(x.search).insertBefore(q)),y.allowTab&&w.set.tabbable()},select:function(){var t=w.get.selectValues();w.debug("Dropdown initialized on a select",t),O.is("select")&&(R=O),R.parent(A.dropdown).length>0?(w.debug("UI dropdown already exists. Creating dropdown menu only"),O=R.closest(A.dropdown),M=O.children(A.menu),0===M.length&&(M=e("
").addClass(x.menu).appendTo(O)),M.html(E.menu(t))):(w.debug("Creating entire dropdown from select"),O=e("
").attr("class",R.attr("class")).addClass(x.selection).addClass(x.dropdown).html(E.dropdown(t)).insertBefore(R),R.removeAttr("class").detach().prependTo(O)),R.is("[multiple]")&&w.set.multiple(),w.refresh()},reference:function(){var e,t,n=s.index(O);w.debug("Dropdown behavior was called on select, replacing with closest dropdown"),O=O.parent(A.dropdown),w.refresh(),e=s.slice(0,n),t=s.slice(n+1),s=e.add(O).add(t),f&&(K=w,w.invoke(v))}},refresh:function(){w.verbose("Refreshing selector cache"),q=O.find(A.text),F=O.find(A.search),R=O.find(A.input),z=O.find(A.icon),V=O.prev().find(A.text).length>0?O.prev().find(A.text):O.prev(),M=O.children(A.menu),P=M.find(A.item)},toggle:function(){w.verbose("Toggling menu visibility"),w.is.active()?w.hide():w.show()},show:function(t){if(t=e.isFunction(t)?t:function(){},w.can.show()&&!w.is.active()){if(w.debug("Showing dropdown"),w.is.multiple()&&!w.has.search()&&w.is.allFiltered())return!0;w.animate.show(function(){w.can.click()&&w.bind.intent(),w.set.visible(),t.call(U)}),y.onShow.call(U)}},hide:function(t){t=e.isFunction(t)?t:function(){},w.is.active()&&(w.debug("Hiding dropdown"),w.animate.hide(function(){w.remove.visible(),t.call(U)}),y.onHide.call(U))},hideOthers:function(){w.verbose("Finding other dropdowns to hide"),s.not(O).has(A.menu+":visible:not(."+x.animating+")").dropdown("hide")},hideMenu:function(){w.verbose("Hiding menu instantaneously"),w.remove.active(),w.remove.visible(),M.transition("hide")},hideSubMenus:function(){var e=M.children(A.item).find(A.menu);w.verbose("Hiding sub menus",e),e.transition("hide")},bind:{keyboardEvents:function(){w.debug("Binding keyboard events"),O.on("keydown"+L,w.event.keydown),w.has.search()&&O.on(w.get.inputEvent()+L,A.search,w.event.input),w.is.multiple()&&r.on("keydown"+h,w.event.document.keydown)},touchEvents:function(){w.debug("Touch device detected binding additional touch events"),w.is.searchSelection()||O.on("touchstart"+L,w.event.test.toggle),M.on("touchstart"+L,A.item,w.event.item.mouseenter)},mouseEvents:function(){w.verbose("Mouse detected binding mouse events"),w.is.multiple()&&O.on("click"+L,A.label,w.event.label.click).on("click"+L,A.remove,w.event.remove.click),w.is.searchSelection()?(O.on("mousedown"+L,A.menu,w.event.menu.mousedown).on("mouseup"+L,A.menu,w.event.menu.mouseup).on("click"+L,A.search,w.show).on("focus"+L,A.search,w.event.search.focus).on("blur"+L,A.search,w.event.search.blur).on("click"+L,A.text,w.event.text.focus),w.is.multiple()&&O.on("click"+L,w.event.click)):("click"==y.on?O.on("click"+L,w.event.test.toggle):"hover"==y.on?O.on("mouseenter"+L,w.delay.show).on("mouseleave"+L,w.delay.hide):O.on(y.on+L,w.toggle),O.on("mousedown"+L,w.event.mousedown).on("mouseup"+L,w.event.mouseup).on("focus"+L,w.event.focus).on("blur"+L,w.event.blur)),M.on("mouseenter"+L,A.item,w.event.item.mouseenter).on("mouseleave"+L,A.item,w.event.item.mouseleave).on("click"+L,A.item,w.event.item.click)},intent:function(){w.verbose("Binding hide intent event to document"),c&&r.on("touchstart"+h,w.event.test.touch).on("touchmove"+h,w.event.test.touch),r.on("click"+h,w.event.test.hide)}},unbind:{intent:function(){w.verbose("Removing hide intent event from document"),c&&r.off("touchstart"+h).off("touchmove"+h),r.off("click"+h)}},filter:function(t){var n=e(),i=w.escape.regExp(t),o=new RegExp("^"+i,"igm");w.verbose("Searching for matching values"),P.each(function(){var i,a,s=e(this);if("both"==y.match||"text"==y.match){if(i=String(w.get.choiceText(s,!1)),i.match(o))return n=n.add(s),!0;if(y.fullTextSearch&&w.fuzzySearch(t,i))return n=n.add(s),!0}if("both"==y.match||"value"==y.match){if(a=String(w.get.choiceValue(s,i)),a.match(o))return n=n.add(s),!0;if(y.fullTextSearch&&w.fuzzySearch(t,a))return n=n.add(s),!0}}),w.debug("Setting filter",t),w.remove.filteredItem(),P.not(n).addClass(x.filtered),w.is.multiple()&&w.filterActive(),w.select.firstUnfiltered(),w.is.allFiltered()?y.onNoResults.call(U,t)?y.allowAdditions||(w.verbose("All items filtered, showing message",t),w.add.message(C.noResults)):(w.verbose("All items filtered, hiding dropdown",t),w.hideMenu()):w.remove.message()},fuzzySearch:function(e,t){var n=t.length,i=e.length;if(e=e.toLowerCase(),t=t.toLowerCase(),i>n)return!1;if(i===n)return e===t;e:for(var o=0,a=0;i>o;o++){for(var s=e.charCodeAt(o);n>a;)if(t.charCodeAt(a++)===s)continue e;return!1}return!0},filterActive:function(){y.useLabels&&P.filter("."+x.active).addClass(x.filtered)},focusSearch:function(){w.is.search()&&!w.is.focusedOnSearch()&&F[0].focus()},forceSelection:function(){var e=P.not(x.filtered).filter("."+x.selected).eq(0),t=P.not(x.filtered).filter("."+x.active).eq(0),n=e.length>0?e:t,i=n.size()>0;i?(w.debug("Forcing partial selection to selected item",n),w.event.item.click.call(n),w.remove.filteredItem()):w.hide()},event:{focus:function(){y.showOnFocus&&!j&&w.is.hidden()&&w.show()},click:function(t){var n=e(t.target);!n.is(O)&&!n.is(z)||w.is.focusedOnSearch()||F.focus()},blur:function(){var e=n.activeElement===this;j||e||(w.remove.activeLabel(),w.hide())},mousedown:function(){j=!0},mouseup:function(){j=!1},search:{focus:function(){j=!0,w.is.multiple()&&w.remove.activeLabel(),y.showOnFocus&&w.show()},blur:function(){var e=n.activeElement===this;H||e||(w.is.multiple()?w.remove.activeLabel():y.forceSelection?w.forceSelection():w.hide())}},text:{focus:function(){j=!0,F.focus()}},input:function(){(w.is.multiple()||w.is.searchSelection())&&w.set.filtered(),clearTimeout(w.timer),w.timer=setTimeout(w.search,y.delay.search)},label:{click:function(t){var n=e(this),i=O.find(A.label),o=i.filter("."+x.active),a=n.nextAll("."+x.active),s=n.prevAll("."+x.active),r=a.length>0?n.nextUntil(a).add(o).add(n):n.prevUntil(s).add(o).add(n);t.shiftKey?(o.removeClass(x.active),r.addClass(x.active)):t.ctrlKey?n.toggleClass(x.active):(o.removeClass(x.active),n.addClass(x.active)),y.onLabelSelect.apply(this,i.filter("."+x.active))}},remove:{click:function(){var t=e(this).parent();t.hasClass(x.active)?w.remove.labels():w.remove.labels(t)}},test:{toggle:function(e){var t=w.is.multiple()?w.show:w.toggle;w.determine.eventOnElement(e,t)&&e.preventDefault()},touch:function(e){w.determine.eventOnElement(e,function(){"touchstart"==e.type?w.timer=setTimeout(w.hide,y.delay.touch):"touchmove"==e.type&&clearTimeout(w.timer)}),e.stopPropagation()},hide:function(e){w.determine.eventInModule(e,w.hide)}},menu:{mousedown:function(){H=!0},mouseup:function(){H=!1}},item:{mouseenter:function(t){var n=e(this).children(A.menu),i=e(this).siblings(A.item).children(A.menu);n.length>0&&(clearTimeout(w.itemTimer),w.itemTimer=setTimeout(function(){w.verbose("Showing sub-menu",n),e.each(i,function(){w.animate.hide(!1,e(this))}),w.animate.show(!1,n)},y.delay.show),t.preventDefault())},mouseleave:function(){var t=e(this).children(A.menu);t.length>0&&(clearTimeout(w.itemTimer),w.itemTimer=setTimeout(function(){w.verbose("Hiding sub-menu",t),w.animate.hide(!1,t)},y.delay.hide))},click:function(t){var n=e(this),i=e(t?t.target:""),o=n.find(A.menu),a=w.get.choiceText(n),s=w.get.choiceValue(n,a),r=o.length>0,l=o.find(i).length>0;l||r&&!y.allowCategorySelection||w.determine.selectAction.call(this,a,s)}},document:{keydown:function(e){var t=e.which,n=w.get.shortcutKeys(),i=w.is.inObject(t,n);if(i){var o=O.find(A.label),a=o.filter("."+x.active),s=a.data("value"),r=o.index(a),l=o.length,c=a.length>0,u=a.length>1,d=0===r,v=r+1==l,f=w.is.searchSelection(),m=w.is.focusedOnSearch(),h=w.is.focused(),g=m&&0===w.get.caretPosition();y.allowAdditions&&m&&t==n.delimiter?(w.verbose("Delimiter key pressed. Tokenizing"),e.preventDefault()):t==n.leftArrow?!h&&!g||c?c&&(e.shiftKey?w.verbose("Adding previous label to selection"):(w.verbose("Selecting previous label"),o.removeClass(x.active)),d&&!u?a.addClass(x.active):a.prev(A.siblingLabel).addClass(x.active).end(),e.preventDefault()):(w.verbose("Selecting previous label"),o.last().addClass(x.active)):t==n.rightArrow?(h&&!c&&o.first().addClass(x.active),c&&(e.shiftKey?w.verbose("Adding next label to selection"):(w.verbose("Selecting next label"),o.removeClass(x.active)),v?f&&!m?w.focusSearch():u?a.next(A.siblingLabel).addClass(x.active):a.addClass(x.active):a.next(A.siblingLabel).addClass(x.active),e.preventDefault())):t==n.deleteKey||t==n.backspace?c?(w.verbose("Removing active labels"),v&&f&&!m&&w.focusSearch(),a.last().next(A.siblingLabel).addClass(x.active),w.remove.labels(a),e.preventDefault()):g&&!c&&t==n.backspace&&(w.verbose("Removing last label on input backspace"),a=o.last().addClass(x.active),s=a.data("value"),w.remove.selected(s),e.preventDefault()):a.removeClass(x.active)}}},keydown:function(e){var t=e.which,n=w.get.shortcutKeys(),i=w.is.inObject(t,n);if(i){var o,a,s=P.not("."+x.filtered).filter("."+x.selected).eq(0),r=M.children("."+x.active).eq(0),l=s.length>0?s:r,c=l.length>0?l.siblings(":not(."+x.filtered+")").andSelf():M.children(":not(."+x.filtered+")"),u=l.children(A.menu),d=l.closest(A.menu),v=d.hasClass(x.visible)||d.hasClass(x.animating)||d.parent(A.menu).length>0,f=u.length>0,m=l.length>0,h=l.not("."+x.filtered).length>0;if(w.is.visible()){if(t==n.enter&&m&&(f&&!y.allowCategorySelection?(w.verbose("Pressed enter on unselectable category, opening sub menu"),t=n.rightArrow):h&&(w.verbose("Enter key pressed, choosing selected item"),w.event.item.click.call(l,e),y.useLabels||w.remove.searchTerm(),e.stopImmediatePropagation()),e.preventDefault()),t==n.leftArrow&&(a=d[0]!==M[0],a&&(w.verbose("Left key pressed, closing sub-menu"),w.animate.hide(!1,d),l.removeClass(x.selected),d.closest(A.item).addClass(x.selected),e.preventDefault())),t==n.rightArrow&&f&&(w.verbose("Right key pressed, opening sub-menu"),w.animate.show(!1,u),l.removeClass(x.selected),u.find(A.item).eq(0).addClass(x.selected),e.preventDefault()),t==n.upArrow){if(o=m&&v?l.prevAll(A.item+":not(."+x.filtered+")").eq(0):P.eq(0),c.index(o)<0)return w.verbose("Up key pressed but reached top of current menu"),void e.preventDefault();w.verbose("Up key pressed, changing active item"),l.removeClass(x.selected),o.addClass(x.selected),w.set.scrollPosition(o),e.preventDefault()}if(t==n.downArrow){if(o=m&&v?o=l.nextAll(A.item+":not(."+x.filtered+")").eq(0):P.eq(0),0===o.length)return w.verbose("Down key pressed but reached bottom of current menu"),void e.preventDefault();w.verbose("Down key pressed, changing active item"),P.removeClass(x.selected),o.addClass(x.selected),w.set.scrollPosition(o),e.preventDefault()}t==n.escape&&(w.verbose("Escape key pressed, closing dropdown"),w.hide())}else t==n.enter&&(w.verbose("Enter key pressed, showing dropdown"),w.show(),e.preventDefault()),t==n.downArrow&&(w.verbose("Down key pressed, showing dropdown"),w.show(),e.preventDefault())}}},determine:{selectAction:function(t,n){w.verbose("Determining action",y.action),e.isFunction(w.action[y.action])?(w.verbose("Triggering preset action",y.action,t,n),w.action[y.action].call(this,t,n)):e.isFunction(y.action)?(w.verbose("Triggering user action",y.action,t,n),y.action.call(this,t,n)):w.error(D.action,y.action)},eventInModule:function(t,n){return n=e.isFunction(n)?n:function(){},0===e(t.target).closest(O).length?(w.verbose("Triggering event",n),n(),!0):(w.verbose("Event occurred in dropdown, canceling callback"),!1)},eventOnElement:function(t,n){var i=e(t.target);return n=e.isFunction(n)?n:function(){},0===i.closest(M).length?(w.verbose("Triggering event",n),n(),!0):(w.verbose("Event occurred in dropdown menu, canceling callback"),!1)}},action:{nothing:function(){},activate:function(t,n){n=n!==i?n:t,w.set.selected(n,e(this)),(!w.is.multiple()||w.is.allFiltered())&&w.hideAndClear()},select:function(){w.action.activate.call(this)},combo:function(t,n){n=n!==i?n:t,w.set.selected(n,e(this)),w.hideAndClear()},hide:function(){w.hideAndClear()}},get:{id:function(){return g},text:function(){return q.text()},query:function(){return F.val()},uniqueArray:function(t){return e.grep(t,function(n,i){return e.inArray(n,t)===i})},caretPosition:function(){var e,t,i=F.get(0);return"selectionStart"in i?i.selectionStart:n.selection?(i.focus(),e=n.selection.createRange(),t=e.text.length,e.moveStart("character",-i.value.length),e.text.length-t):void 0},shortcutKeys:function(){return{backspace:8,delimiter:188,deleteKey:46,enter:13,escape:27,leftArrow:37,upArrow:38,rightArrow:39,downArrow:40}},value:function(){return R.length>0?R.val():O.data(S.value)},values:function(){var e=w.get.value();return""===e?"":!R.is("select")&&w.is.multiple()?"string"==typeof e?e.split(y.delimiter):"":e},choiceText:function(e,t){return t=t!==i?t:y.preserveHTML,e?(e.find(A.menu).length>0&&(w.verbose("Retreiving text of element with sub-menu"),e=e.clone(),e.find(A.menu).remove(),e.find(A.menuIcon).remove()),e.data(S.text)!==i?e.data(S.text):t?e.html().trim():e.text().trim()):void 0},choiceValue:function(e,t){return t=t||w.get.choiceText(e),e?e.data(S.value)!==i?e.data(S.value):"string"==typeof t?t.toLowerCase().trim():t:!1},inputEvent:function(){var e=F[0];return e?e.oninput!==i?"input":e.onpropertychange!==i?"propertychange":"keyup":!1},selectValues:function(){var t={};return t.values=y.sortSelect?{}:[],O.find("option").each(function(){var n=e(this).html(),o=e(this).attr("value")!==i?e(this).attr("value"):n;"auto"===y.placeholder&&""===o?t.placeholder=n:y.sortSelect?t.values[o]={name:n,value:o}:t.values.push({name:n,value:o})}),y.placeholder&&"auto"!==y.placeholder&&(w.debug("Setting placeholder value to",y.placeholder),t.placeholder=y.placeholder),y.sortSelect?w.debug("Retrieved and sorted values from select",t):w.debug("Retreived values from select",t),t},activeItem:function(){return P.filter("."+x.active)},item:function(t,n){var o,a=!1;return t=t!==i?t:w.get.values()!==i?w.get.values():w.get.text(),o=w.is.multiple()&&e.isArray(t),n=""===t||0===t?!0:n||!1,t!==i&&P.each(function(){var i=e(this),s=w.get.choiceText(i),r=w.get.choiceValue(i,s);if(o)(-1!==e.inArray(r.toString(),t)||-1!==e.inArray(s,t))&&(a=a?a.add(i):i);else if(n){if(w.verbose("Ambiguous dropdown value using strict type check",i,t),r===t||s===t)return a=i,!0}else if(r==t||s==t)return w.verbose("Found select item by value",r,t),a=i,!0}),a}},restore:{defaults:function(){w.restore.defaultText(),w.restore.defaultValue()},defaultText:function(){var e=O.data(S.defaultText);w.debug("Restoring default text",e),w.set.text(e),q.addClass(x.placeholder)},defaultValue:function(){var e=O.data(S.defaultValue);e!==i&&(w.debug("Restoring default value",e),e.length?w.set.selected(e):(w.remove.activeItem(),w.remove.selectedItem()))}},save:{defaults:function(){w.save.defaultText(),w.save.placeholderText(),w.save.defaultValue()},defaultValue:function(){O.data(S.defaultValue,w.get.value())},defaultText:function(){O.data(S.defaultText,q.text())},placeholderText:function(){q.hasClass(x.placeholder)&&O.data(S.placeholderText,q.text())}},clear:function(){w.set.placeholderText(),w.clearValue(),w.remove.activeItem(),w.remove.selectedItem()},clearValue:function(){w.set.value("")},set:{filtered:function(){var e=w.is.multiple(),t=w.is.searchSelection(),n=e&&t,i=t?w.get.query():"",o="string"==typeof i&&i.length>0,a=i.length*y.glyphWidth+"em",s=""!==R.val();e&&o&&(w.verbose("Adjusting input width",a,y.glyphWidth),F.css("width",a)),o||n&&s?(w.verbose("Hiding placeholder text"),q.addClass(x.filtered)):(!e||n&&!s)&&(w.verbose("Showing placeholder text"),q.removeClass(x.filtered))},placeholderText:function(e){w.debug("Restoring placeholder text"),e=e||O.data(S.placeholderText),w.set.text(e),q.addClass(x.placeholder)},tabbable:function(){w.has.search()?(w.debug("Searchable dropdown initialized"),F.val("").attr("tabindex",0),M.attr("tabindex","-1")):(w.debug("Simple selection dropdown initialized"),O.attr("tabindex")||(O.attr("tabindex",0),M.attr("tabindex","-1")))},scrollPosition:function(e,t){var n,o,a,s,r,l,c,u,d,v,f=5;e=e||w.get.activeItem(),n=e.closest(A.menu),o=e&&e.length>0,t=t!==i?t:!1,e&&o&&(n.hasClass(x.visible)||n.addClass(x.loading),u=n.height(),s=e.height(),c=n.scrollTop(),l=n.offset().top,r=e.offset().top,a=c-l+r,v=a+f>c+u,d=c>a-f,w.debug("Scrolling to active item",a),(d||v||t)&&n.scrollTop(a).removeClass(x.loading))},text:function(e){"select"!==y.action?(w.debug("Changing text",e,q),q.removeClass(x.filtered).removeClass(x.placeholder),y.preserveHTML?q.html(e):q.text(e)):"combo"==y.action&&(w.debug("Changing combo button text",e,V),y.preserveHTML?V.html(e):V.text(e))},value:function(t,n,i){var o=(R.length>0,w.get.values());if(R.length>0){if(w.is.multiple()&&(t=[t],e.isArray(o)&&(t=o.concat(t),t=w.get.uniqueArray(t)),R.is("select")?w.debug("Setting multiple removing selected"),R.find('option[value="'+i+'"]').prop("selected",!1)):(w.verbose("Input is csv removing value"),n=w.remove.delimitedValue(i,n),R.val(n).trigger("change")),w.is.multiple()&&(y.useLabels?w.remove.label(i):w.set.text(w.add.variables(C.count))),t.removeClass(x.filtered).removeClass(x.active),y.useLabels&&t.removeClass(x.selected))},selectedItem:function(){P.removeClass(x.selected)},delimitedValue:function(t,n){return"string"!=typeof n?!1:(n=n.split(y.delimiter),n=e.grep(n,function(e){return t!=e}),n=n.join(y.delimiter),w.verbose("Removed value from delimited string",t,n),n)},label:function(e){var t=O.find(A.label),n=t.filter('[data-value="'+e+'"]'),i=t.length,o=t.index(n)+1==i,a=1==i,s=a||o;s?(w.verbose("Animating and removing label",n),n.transition(y.label.transition,y.label.duration,function(){n.remove()})):(w.verbose("Removing label",n),n.remove())},labels:function(t){t=t||O.find(A.label).filter("."+x.active),w.verbose("Removing active label selections",t),t.each(function(){w.remove.selected(e(this).data("value"))})},tabbable:function(){w.has.search()?(w.debug("Searchable dropdown initialized"),F.attr("tabindex","-1"),M.attr("tabindex","-1")):(w.debug("Simple selection dropdown initialized"),O.attr("tabindex","-1"),M.attr("tabindex","-1"))}},has:{search:function(){return F.length>0},input:function(){return R.length>0},menu:function(){return M.length>0}},is:{active:function(){return O.hasClass(x.active)},alreadySetup:function(){return O.is("select")&&O.parent(A.dropdown).length>0},animating:function(e){return e?e.transition&&e.transition("is animating"):M.transition&&M.transition("is animating")},focused:function(){return n.activeElement===O[0]},focusedOnSearch:function(){return n.activeElement===F[0]},allFiltered:function(){return(w.is.multiple()||w.has.search())&&P.filter("."+x.filtered).length===P.length},hidden:function(e){return e?e.is(":hidden"):M.is(":hidden")},inObject:function(t,n){var i=!1;return e.each(n,function(e,n){return n==t?(i=!0,!0):void 0}),i},multiple:function(){return O.hasClass(x.multiple)},single:function(){return!w.is.multiple()},selectMutation:function(t){var n=!1;return e.each(t,function(t,i){return i.target&&e(i.target).is("select")?(n=!0,!0):void 0}),n},search:function(){return O.hasClass(x.search)},searchSelection:function(){return w.has.search()&&0===F.closest(A.menu).length},selection:function(){return O.hasClass(x.selection)},upward:function(){return O.hasClass(x.upward)},visible:function(e){return e?e.is(":visible"):M.is(":visible")}},can:{click:function(){return c||"click"==y.on},show:function(){return!O.hasClass(x.disabled)}},animate:{show:function(t,n){var o=n||M,a=n?function(){}:function(){w.hideSubMenus(),w.hideOthers(),w.set.active()};t=e.isFunction(t)?t:function(){},w.is.single()&&w.set.scrollPosition(w.get.activeItem(),!0),w.verbose("Doing menu show animation",o),(w.is.hidden(o)||w.is.animating(o))&&("auto"==y.transition&&(y.transition=w.is.upward()?"slide up":"slide down",w.verbose("Automatically determining animation based on animation direction",y.transition)),"none"==y.transition?(a(),o.transition("show"),t.call(U)):e.fn.transition!==i&&O.transition("is supported")?o.transition({animation:y.transition+" in",debug:y.debug,verbose:y.verbose,duration:y.duration,queue:!0,onStart:a,onComplete:function(){t.call(U)}}):w.error(D.noTransition,y.transition))},hide:function(t,n){var o=n||M,a=(n?.9*y.duration:y.duration,n?function(){}:function(){w.can.click()&&w.unbind.intent(),w.focusSearch(),w.remove.active()});t=e.isFunction(t)?t:function(){},(w.is.visible(o)||w.is.animating(o))&&(w.verbose("Doing menu hide animation",o),"auto"==y.transition&&(y.transition=w.is.upward()?"slide up":"slide down"),"none"==y.transition?(a(),o.transition("hide"),t.call(U)):e.fn.transition!==i&&O.transition("is supported")?o.transition({animation:y.transition+" out",duration:y.duration,debug:y.debug,verbose:y.verbose,queue:!0,onStart:a,onComplete:function(){t.call(U)}}):w.error(D.transition))}},hideAndClear:function(){w.is.searchSelection()?(w.remove.searchTerm(),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,y.delay.show)},hide:function(){w.verbose("Delaying hide event to ensure user intent"),clearTimeout(w.timer),w.timer=setTimeout(w.hide,y.delay.hide)}},escape:{regExp:function(e){return e=String(e),e.replace(k.escape,"\\$&")}},setting:function(t,n){if(w.debug("Changing setting",t,n),e.isPlainObject(t))e.extend(!0,y,t);else{if(n===i)return y[t];y[t]=n}},internal:function(t,n){if(e.isPlainObject(t))e.extend(!0,w,t);else{if(n===i)return w[t];w[t]=n}},debug:function(){y.debug&&(y.performance?w.performance.log(arguments):(w.debug=Function.prototype.bind.call(console.info,console,y.name+":"),w.debug.apply(console,arguments)))},verbose:function(){y.verbose&&y.debug&&(y.performance?w.performance.log(arguments):(w.verbose=Function.prototype.bind.call(console.info,console,y.name+":"),w.verbose.apply(console,arguments)))},error:function(){w.error=Function.prototype.bind.call(console.error,console,y.name+":"),w.error.apply(console,arguments)},performance:{log:function(e){var t,n,i;y.performance&&(t=(new Date).getTime(),i=u||t,n=t-i,u=t,d.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:U,"Execution Time":n})),clearTimeout(w.performance.timer),w.performance.timer=setTimeout(w.performance.display,500)},display:function(){var t=y.name+":",n=0;u=!1,clearTimeout(w.performance.timer),e.each(d,function(e,t){n+=t["Execution Time"]}),t+=" "+n+"ms",l&&(t+=" '"+l+"'"),(console.group!==i||console.table!==i)&&d.length>0&&(console.groupCollapsed(t),console.table?console.table(d):e.each(d,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),d=[]}},invoke:function(t,n,o){var s,r,l,c=K;return n=n||m,o=U||o,"string"==typeof t&&c!==i&&(t=t.split(/[\. ]/),s=t.length-1,e.each(t,function(n,o){var a=n!=s?o+t[n+1].charAt(0).toUpperCase()+t[n+1].slice(1):t;if(e.isPlainObject(c[a])&&n!=s)c=c[a];else{if(c[a]!==i)return r=c[a],!1;if(!e.isPlainObject(c[o])||n==s)return c[o]!==i?(r=c[o],!1):(w.error(D.method,t),!1);c=c[o]}})),e.isFunction(r)?l=r.apply(o,n):r!==i&&(l=r),e.isArray(a)?a.push(l):a!==i?a=[a,l]:l!==i&&(a=l),r}},f?(K===i&&w.initialize(),w.invoke(v)):(K!==i&&K.invoke("destroy"),w.initialize())}),a!==i?a:s},e.fn.dropdown.settings={debug:!1,verbose:!1,performance:!0,on:"click",action:"activate",allowTab:!0,showOnFocus:!0,fullTextSearch:!1,placeholder:"auto",preserveHTML:!0,sortSelect:!1,match:"both",allowCategorySelection:!1,forceSelection:!0,transition:"auto",duration:250,delay:{hide:300,show:200,search:50,touch:50},glyphWidth:1.0714,allowAdditions:!1,tokenize:"missing",delimiter:",",label:{transition:"horizontal flip",duration:150,variation:!1},useLabels:!0,onLabelSelect:function(){},onNoResults:function(){return!0},onChange:function(){},onShow:function(){},onHide:function(){},name:"Dropdown",namespace:"dropdown",message:{addResult:"Add {term}",count:"{count} selected",noResults:"No results found."},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",method:"The method you called is not defined.",noTransition:"This module requires ui transitions "},regExp:{escape:/[-[\]{}()*+?.,\\^$|#\s]/g},metadata:{defaultText:"defaultText",defaultValue:"defaultValue",placeholderText:"placeholderText",text:"text",value:"value"},selector:{dropdown:".ui.dropdown",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",text:"> .text:not(.icon)"},className:{active:"active",animating:"animating",disabled:"disabled",dropdown:"ui dropdown",filtered:"filtered",hidden:"hidden transition",label:"ui label",loading:"loading",menu:"menu",message:"message",multiple:"multiple",placeholder:"default",search:"search",selected:"selected",selection:"selection",upward:"upward",visible:"visible"}},e.fn.dropdown.settings.templates={message:function(e){return'
'+e+"
"},menu:function(t){var n=(t.placeholder||!1,t.values||{},"");return e.each(t.values,function(e,t){n+='
'+t.name+"
"}),n},label:function(e,t){return t+''},dropdown:function(t){var n=t.placeholder||!1,i=(t.values||{},"");return i+='',i+=t.placeholder?'
'+n+"
":'
',i+='"}},e.extend(e.easing,{easeOutQuad:function(e,t,n,i,o){return-i*(t/=o)*(t-2)+n}})}(jQuery,window,document);