/* * # Fomantic UI - 2.8.8 * https://github.com/fomantic/Fomantic-UI * http://fomantic-ui.com/ * * Copyright 2022 Contributors * Released under the MIT license * http://opensource.org/licenses/MIT * */ !function(w,e,C){"use strict";w.isFunction=w.isFunction||function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},e=void 0!==e&&e.Math==Math?e:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),w.fn.state=function(v){var g,b=w(this),x=b.selector||"",p=(new Date).getTime(),h=[],m=v,T="string"==typeof m,y=[].slice.call(arguments,1);return b.each(function(){var i=w.isPlainObject(v)?w.extend(!0,{},w.fn.state.settings,v):w.extend({},w.fn.state.settings),u=i.error,n=i.metadata,t=i.className,d=i.namespace,a=i.states,o=i.text,e="."+d,f=d+"-module",s=w(this),c=this,r=s.data(f),l={initialize:function(){l.verbose("Initializing module"),i.automatic&&l.add.defaults(),i.context&&""!==x?w(i.context).on(x,"mouseenter"+e,l.change.text).on(x,"mouseleave"+e,l.reset.text).on(x,"click"+e,l.toggle.state):s.on("mouseenter"+e,l.change.text).on("mouseleave"+e,l.reset.text).on("click"+e,l.toggle.state),l.instantiate()},instantiate:function(){l.verbose("Storing instance of module",l),r=l,s.data(f,l)},destroy:function(){l.verbose("Destroying previous module",r),s.off(e).removeData(f)},refresh:function(){l.verbose("Refreshing selector cache"),s=w(c)},add:{defaults:function(){var n=v&&w.isPlainObject(v.states)?v.states:{};w.each(i.defaults,function(e,t){l.is[e]!==C&&l.is[e]()&&(l.verbose("Adding default states",e,c),w.extend(i.states,t,n))})}},is:{active:function(){return s.hasClass(t.active)},loading:function(){return s.hasClass(t.loading)},inactive:function(){return!s.hasClass(t.active)},state:function(e){return t[e]!==C&&s.hasClass(t[e])},enabled:function(){return!s.is(i.filter.active)},disabled:function(){return s.is(i.filter.active)},textEnabled:function(){return!s.is(i.filter.text)},button:function(){return s.is(".button:not(a, .submit)")},input:function(){return s.is("input")},progress:function(){return s.is(".ui.progress")}},allow:function(e){l.debug("Now allowing state",e),a[e]=!0},disallow:function(e){l.debug("No longer allowing",e),a[e]=!1},allows:function(e){return a[e]||!1},enable:function(){s.removeClass(t.disabled)},disable:function(){s.addClass(t.disabled)},setState:function(e){l.allows(e)&&s.addClass(t[e])},removeState:function(e){l.allows(e)&&s.removeClass(t[e])},toggle:{state:function(){var e;if(l.allows("active")&&l.is.enabled()){if(l.refresh(),w.fn.api!==C)if(e=s.api("get request"),s.api("was cancelled"))l.debug("API Request cancelled by beforesend"),i.activateTest=function(){return!1},i.deactivateTest=function(){return!1};else if(e)return void l.listenTo(e);l.change.state()}}},listenTo:function(e){l.debug("API request detected, waiting for state signal",e),e&&(o.loading&&l.update.text(o.loading),w.when(e).then(function(){"resolved"==e.state()?(l.debug("API request succeeded"),i.activateTest=function(){return!0},i.deactivateTest=function(){return!0}):(l.debug("API request failed"),i.activateTest=function(){return!1},i.deactivateTest=function(){return!1}),l.change.state()}))},change:{state:function(){l.debug("Determining state change direction"),l.is.inactive()?l.activate():l.deactivate(),i.sync&&l.sync(),i.onChange.call(c)},text:function(){l.is.textEnabled()&&(l.is.disabled()?(l.verbose("Changing text to disabled text",o.hover),l.update.text(o.disabled)):l.is.active()?o.hover?(l.verbose("Changing text to hover text",o.hover),l.update.text(o.hover)):o.deactivate&&(l.verbose("Changing text to deactivating text",o.deactivate),l.update.text(o.deactivate)):o.hover?(l.verbose("Changing text to hover text",o.hover),l.update.text(o.hover)):o.activate&&(l.verbose("Changing text to activating text",o.activate),l.update.text(o.activate)))}},activate:function(){i.activateTest.call(c)&&(l.debug("Setting state to active"),s.addClass(t.active),l.update.text(o.active),i.onActivate.call(c))},deactivate:function(){i.deactivateTest.call(c)&&(l.debug("Setting state to inactive"),s.removeClass(t.active),l.update.text(o.inactive),i.onDeactivate.call(c))},sync:function(){l.verbose("Syncing other buttons to current state"),l.is.active()?b.not(s).state("activate"):b.not(s).state("deactivate")},get:{text:function(){return i.selector.text?s.find(i.selector.text).text():s.html()},textFor:function(e){return o[e]||!1}},flash:{text:function(e,t,n){var a=l.get.text();l.debug("Flashing text message",e,t),e=e||i.text.flash,t=t||i.flashDuration,n=n||function(){},l.update.text(e),setTimeout(function(){l.update.text(a),n.call(c)},t)}},reset:{text:function(){var e=o.active||s.data(n.storedText),t=o.inactive||s.data(n.storedText);l.is.textEnabled()&&(l.is.active()&&e?(l.verbose("Resetting active text",e),l.update.text(e)):t&&(l.verbose("Resetting inactive text",e),l.update.text(t)))}},update:{text:function(e){var t=l.get.text();e&&e!==t?(l.debug("Updating text",e),i.selector.text?s.data(n.storedText,e).find(i.selector.text).text(e):s.data(n.storedText,e).html(e)):l.debug("Text is already set, ignoring update",e)}},setting:function(e,t){if(l.debug("Changing setting",e,t),w.isPlainObject(e))w.extend(!0,i,e);else{if(t===C)return i[e];w.isPlainObject(i[e])?w.extend(!0,i[e],t):i[e]=t}},internal:function(e,t){if(w.isPlainObject(e))w.extend(!0,l,e);else{if(t===C)return l[e];l[e]=t}},debug:function(){!i.silent&&i.debug&&(i.performance?l.performance.log(arguments):(l.debug=Function.prototype.bind.call(console.info,console,i.name+":"),l.debug.apply(console,arguments)))},verbose:function(){!i.silent&&i.verbose&&i.debug&&(i.performance?l.performance.log(arguments):(l.verbose=Function.prototype.bind.call(console.info,console,i.name+":"),l.verbose.apply(console,arguments)))},error:function(){i.silent||(l.error=Function.prototype.bind.call(console.error,console,i.name+":"),l.error.apply(console,arguments))},performance:{log:function(e){var t,n;i.performance&&(n=(t=(new Date).getTime())-(p||t),p=t,h.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:c,"Execution Time":n})),clearTimeout(l.performance.timer),l.performance.timer=setTimeout(l.performance.display,500)},display:function(){var e=i.name+":",n=0;p=!1,clearTimeout(l.performance.timer),w.each(h,function(e,t){n+=t["Execution Time"]}),e+=" "+n+"ms",x&&(e+=" '"+x+"'"),(console.group!==C||console.table!==C)&&0