/* * # Fomantic UI - 2.9.0-beta.298+8d87844 * https://github.com/fomantic/Fomantic-UI * http://fomantic-ui.com/ * * Copyright 2022 Contributors * Released under the MIT license * http://opensource.org/licenses/MIT * */ !function(q,k,D,E){"use strict";q.isFunction=q.isFunction||function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},k=void 0!==k&&k.Math==Math?k:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),q.fn.search=function(R){var x,C=q(this),w=C.selector||"",S=(new Date).getTime(),T=[],F=R,j="string"==typeof F,A=[].slice.call(arguments,1);return q(this).each(function(){var l=q.isPlainObject(R)?q.extend(!0,{},q.fn.search.settings,R):q.extend({},q.fn.search.settings),d=l.className,c=l.metadata,n=l.regExp,i=l.fields,f=l.selector,g=l.error,e=l.namespace,r="."+e,t=e+"-module",h=q(this),p=h.find(f.prompt),s=h.find(f.searchButton),a=h.find(f.results),o=h.find(f.result),u=(h.find(f.category),this),m=h.data(t),v=!1,y=!1,b={initialize:function(){b.verbose("Initializing module"),b.get.settings(),b.determine.searchFields(),b.bind.events(),b.set.type(),b.create.results(),b.instantiate()},instantiate:function(){b.verbose("Storing instance of module",b),m=b,h.data(t,b)},destroy:function(){b.verbose("Destroying instance"),h.off(r).removeData(t)},refresh:function(){b.debug("Refreshing selector cache"),p=h.find(f.prompt),s=h.find(f.searchButton),h.find(f.category),a=h.find(f.results),o=h.find(f.result)},refreshResults:function(){a=h.find(f.results),o=h.find(f.result)},bind:{events:function(){b.verbose("Binding events to search"),l.automatic&&(h.on(b.get.inputEvent()+r,f.prompt,b.event.input),p.attr("autocomplete",b.is.chrome()?"fomantic-search":"off")),h.on("focus"+r,f.prompt,b.event.focus).on("blur"+r,f.prompt,b.event.blur).on("keydown"+r,f.prompt,b.handleKeyboard).on("click"+r,f.searchButton,b.query).on("mousedown"+r,f.results,b.event.result.mousedown).on("mouseup"+r,f.results,b.event.result.mouseup).on("click"+r,f.result,b.event.result.click)}},determine:{searchFields:function(){R&&R.searchFields!==E&&(l.searchFields=R.searchFields)}},event:{input:function(){l.searchDelay?(clearTimeout(b.timer),b.timer=setTimeout(function(){b.is.focused()&&b.query()},l.searchDelay)):b.query()},focus:function(){b.set.focus(),l.searchOnFocus&&b.has.minimumCharacters()&&b.query(function(){b.can.show()&&b.showResults()})},blur:function(e){function t(){b.cancel.query(),b.remove.focus(),b.timer=setTimeout(b.hideResults,l.hideDelay)}var s=D.activeElement===this;s||(y=!1,b.resultsClicked?(b.debug("Determining if user action caused search to close"),h.one("click.close"+r,f.results,function(e){b.is.inMessage(e)||v?p.focus():(v=!1,b.is.animating()||b.is.hidden()||t())})):(b.debug("Input blurred without user action, closing results"),t()))},result:{mousedown:function(){b.resultsClicked=!0},mouseup:function(){b.resultsClicked=!1},click:function(e){b.debug("Search result selected");var t=q(this),s=t.find(f.title).eq(0),n=t.is("a[href]")?t:t.find("a[href]").eq(0),r=n.attr("href")||!1,i=n.attr("target")||!1,s=0=l.minCharacters},results:function(){return 0!==a.length&&""!=a.html()}},clear:{cache:function(e){var t=h.data(c.cache);e?t&&t[e]&&(b.debug("Removing value from cache",e),delete t[e],h.data(c.cache,t)):(b.debug("Clearing cache",e),h.removeData(c.cache))}},read:{cache:function(e){var t=h.data(c.cache);return!!l.cache&&(b.verbose("Checking cache for generated html for query",e),"object"==typeof t&&t[e]!==E&&t[e])}},create:{categoryResults:function(e){var s={};return q.each(e,function(e,t){t.category&&(s[t.category]===E?(b.verbose("Creating new category of results",t.category),s[t.category]={name:t.category,results:[t]}):s[t.category].results.push(t))}),s},id:function(e,t){var s,e=e+1;return t!==E?(t=String.fromCharCode(97+t),b.verbose("Creating category result id",s=t+e)):b.verbose("Creating result id",s=e),s},results:function(){0===a.length&&(a=q("
").addClass(d.results).appendTo(h))}},inject:{result:function(e,t,s){b.verbose("Injecting result into results");s=(s!==E?a.children().eq(s).children(f.results).first():a).children(f.result).eq(t);b.verbose("Injecting results metadata",s),s.data(c.result,e)},id:function(e){b.debug("Injecting unique ids into results");var s=0,n=0;return"category"===l.type?q.each(e,function(e,t){0 as a polyfill.'},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(e,t){if(t)return e;var s={"<":"<",">":">",'"':""","'":"'","`":"`"};return/[&<>"'`]/.test(e)?(e=e.replace(/&(?![a-z0-9#]{1,6};)/,"&")).replace(/[<>"'`]/g,function(e){return s[e]}):e},message:function(e,t,s){var n="";return e!==E&&t!==E&&(n+='
',s&&(n+='
'+s+"
"),n=n+'
'+e+"
"),n},category:function(e,s,n){var r="",i=q.fn.search.settings.templates.escape;return e[s.categoryResults]!==E&&(q.each(e[s.categoryResults],function(e,t){t[s.results]!==E&&0',t[s.categoryName]!==E&&(r+='
'+i(t[s.categoryName],n)+"
"),r+='
")}),e[s.action]&&(!1===s.actionURL?r+='
'+i(e[s.action][s.actionText],n)+"
":r+=''+i(e[s.action][s.actionText],n)+""),r)},standard:function(e,s,n){var r="",i=q.fn.search.settings.templates.escape;return e[s.results]!==E&&(q.each(e[s.results],function(e,t){t[s.url]?r+='':r+='',t[s.image]!==E&&(r+='
'),r+='
',t[s.price]!==E&&(r+='
'+i(t[s.price],n)+"
"),t[s.title]!==E&&(r+='
'+i(t[s.title],n)+"
"),t[s.description]!==E&&(r+='
'+i(t[s.description],n)+"
"),r+="
"}),e[s.action]&&(!1===s.actionURL?r+='
'+i(e[s.action][s.actionText],n)+"
":r+=''+i(e[s.action][s.actionText],n)+""),r)}}}}(jQuery,window,document);