/* * # Fomantic UI - 2.9.3 * https://github.com/fomantic/Fomantic-UI * https://fomantic-ui.com/ * * Copyright 2023 Contributors * Released under the MIT license * https://opensource.org/licenses/MIT * */ !function(P,j,n){"use strict";function C(e){return null!==e&&e===e.window}function E(e){return"function"==typeof e&&"number"!=typeof e.nodeType}j=void 0!==j&&j.Math===Math?j:globalThis,P.fn.api=function(x){var A,e=E(this)?P(j):P(this),k=Date.now(),S=[],T=x,w="string"==typeof T,D=[].slice.call(arguments,1),O=function(e,t){var r;return 0<=[j,n].indexOf(e)?r=P(e):0===(r=P(t.document).find(e)).length&&(r=t.frameElement?O(e,t.parent):j),r};return e.each(function(){var a,n,r,e,i,o,s=P.isPlainObject(x)?P.extend(!0,{},P.fn.api.settings,x):P.extend({},P.fn.api.settings),f=s.regExp,t=s.namespace,u=s.metadata,c=s.selector,d=s.error,l=s.className,p="."+t,g="module-"+t,m=P(this),v=m.closest(c.form),b=s.stateContext?O(s.stateContext,j):m,h=this,y=b[0],R=m.data(g),q={initialize:function(){w||(o=s.data,q.bind.events()),q.instantiate()},instantiate:function(){q.verbose("Storing instance of module",q),R=q,m.data(g,R)},destroy:function(){q.verbose("Destroying previous module for",h),m.removeData(g).off(p)},bind:{events:function(){var e=q.get.event();e?(q.verbose("Attaching API events to element",e),m.on(e+p,q.event.trigger)):"now"===s.on&&(q.debug("Querying API endpoint immediately"),q.query())}},decode:{json:function(e){if(void 0!==e&&"string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}},read:{cachedResponse:function(e){var t;if(void 0!==j.Storage)return t=sessionStorage.getItem(e+q.get.normalizedData()),q.debug("Using cached response",e,s.data,t),q.decode.json(t);q.error(d.noStorage)}},write:{cachedResponse:function(e,t){void 0===j.Storage?q.error(d.noStorage):(P.isPlainObject(t)&&(t=JSON.stringify(t)),sessionStorage.setItem(e+q.get.normalizedData(),t),q.verbose("Storing cached response for url",e,s.data,t))}},query:function(){if(q.is.disabled())q.debug("Element is disabled API request aborted");else{if(q.is.loading()){if(!s.interruptRequests)return void q.debug("Cancelling request, previous request is still pending");q.debug("Interrupting previous request"),q.abort()}if(s.defaultData&&P.extend(!0,s.urlData,q.get.defaultData()),s.serializeForm&&(s.data=q.add.formData(o||s.data)),!1===(n=q.get.settings()))return q.cancelled=!0,void q.error(d.beforeSend);if(q.cancelled=!1,(r=q.get.templatedURL())||q.is.mocked()){if((r=q.add.urlData(r))||q.is.mocked()){if(n.url=s.base+r,a=P.extend(!0,{},s,{type:s.method||s.type,data:e,url:s.base+r,beforeSend:s.beforeXHR,success:function(){},failure:function(){},complete:function(){}}),q.debug("Querying URL",a.url),q.verbose("Using AJAX settings",a),"local"===s.cache&&q.read.cachedResponse(r))return q.debug("Response returned from local cache"),q.request=q.create.request(),void q.request.resolveWith(y,[q.read.cachedResponse(r)]);s.throttle?s.throttleFirstRequest||q.timer?(q.debug("Throttling request",s.throttle),clearTimeout(q.timer),q.timer=setTimeout(function(){q.timer&&delete q.timer,q.debug("Sending throttled request",e,a.method),q.send.request()},s.throttle)):(q.debug("Sending request",e,a.method),q.send.request(),q.timer=setTimeout(function(){},s.throttle)):(q.debug("Sending request",e,a.method),q.send.request())}}else q.error(d.missingURL)}},should:{removeError:function(){return!0===s.hideError||"auto"===s.hideError&&!q.is.form()}},is:{disabled:function(){return 0