!function(C,A,a){"use strict";A=void0!==A&&A.Math===Math?A:globalThis,C.fn.state=function(g){varb,x=C(this),p=Date.now(),m=[],h=g,T="string"==typeofh,y=[].slice.call(arguments,1),w=function(e,t){varn;return0<=[A,a].indexOf(e)?n=C(e):0===(n=C(t.document).find(e)).length&&(n=t.frameElement?w(e,t.parent):A),n};returnx.each(function(){vari=C.isPlainObject(g)?C.extend(!0,{},C.fn.state.settings,g):C.extend({},C.fn.state.settings),c=i.error,n=i.metadata,t=i.className,e=i.namespace,a=i.states,o=i.text,s="."+e,r=e+"-module",l=C(this),u=i.context?w(i.context,A):l,d=this,f=l.data(r),v={initialize:function(){v.verbose("Initializing module"),i.automatic&&v.add.defaults(),u.on("mouseenter"+s,v.change.text).on("mouseleave"+s,v.reset.text).on("click"+s,v.toggle.state),v.instantiate()},instantiate:function(){v.verbose("Storing instance of module",v),f=v,l.data(r,v)},destroy:function(){v.verbose("Destroying previous module",f),u.off(s),l.removeData(n.storedText).removeData(r)},refresh:function(){v.verbose("Refreshing selector cache"),l=C(d)},add:{defaults:function(){varn=g&&C.isPlainObject(g.states)?g.states:{};C.each(i.defaults,function(e,t){void0!==v.is[e]&&v.is[e]()&&(v.verbose("Adding default states",e,d),C.extend(i.states,t,n))})}},is:{active:function(){returnl.hasClass(t.active)},loading:function(){returnl.hasClass(t.loading)},inactive:function(){return!l.hasClass(t.active)},state:function(e){returnvoid0!==t[e]&&l.hasClass(t[e])},enabled:function(){return!l.is(i.filter.active)},disabled:function(){returnl.is(i.filter.active)},textEnabled:function(){return!l.is(i.filter.text)},button:function(){returnl.is(".button:not(a, .submit)")},input:function(){returnl.is("input")},progress:function(){returnl.is(".ui.progress")}},allow:function(e){v.debug("Now allowing state",e),a[e]=!0},disallow:function(e){v.debug("No longer allowing",e),a[e]=!1},allows:function(e){returna[e]||!1},enable:function(){l.removeClass(t.disabled)},disable:function(){l.addClass(t.disabled)},setState:function(e){v.allows(e)&&l.addClass(t[e])},removeState:function(e){v.allows(e)&&l.removeClass(t[e])},toggle:{state:function(){vare;if(v.allows("active")&&v.is.enabled()){if(v.refresh(),void0!==C.fn.api)if(e=l.api("get request"),l.api("was cancelled"))v.debug("API Request cancelled by beforesend"),i.activateTest=function(){return!1},i.deactivateTest=function(){return!1};elseif(e)returnvoidv.listenTo(e);v.change.state()}}},listenTo:function(e){v.debug("API request detected, waiting for state signal",e),e&&(o.loading&&v.update.text(o.loading),C.when(e).then(function(){"resolved"===e.state()?(v.debug("API request succeeded"),i.activateTest=function(){return!0},i.deactivateTest=function(){return!0}):(v.debug("API request failed"),i.activateTest=function(){return!1},i.deactivateTest=function(){return!1}),v.change.state()}))},change:{state:function(){v.debug("Determining state change direction"),v.is.inactive()?v.activate():v.deactivate(),i.sync&&v.sync(),i.onChange.call(d)},text:function(){v.is.textEnabled()&&(v.is.disabled()?(v.verbose("Changing text to disabled text",o.hover),v.update.text(o.disabled)):v.is.active()?o.hover?(v.verbose("Changing text to hover text",o.hover),v.update.text(o.hover)):o.deactivate&&(v.verbose("Changing text to deactivating text",o.deactivate),v.update.text(o.deactivate)):o.hover?(v.verbose("Changing text to hover text",o.hover),v.update.text(o.hover)):o.activate&&(v.verbose("Changing text to activating text",o.activate),v.update.text(o.activate)))}},activate:function(){i.activateTest.call(d)&&(v.debug("Setting state to active"),l.addClass(t.active),v.update.text(o.active),i.onActivate.call(d))},deactivate:function(){i.deactivateTest.call(d)&&(v.debug("Setting state to inactive"),l.removeClass(t.active),v.update.text(o.inactive),i.onDeactivate.call(d))},sync:function(){v.verbose("Syncing other buttons to current state"),v.is.active()?x.not(l).state("activate"):x.not(l).state("deactivate")},get:{text:function(){returni.selector.text?l.find(i.selector.text).text():l.html()},textFor:function(e){returno[e]||!1}},flash:{text:fu