!function(q,A,E,D){"use strict";A=void 0!==A&&A.Math==Math?A:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),q.fn.search=function(o){var C,x=q(this),w=x.selector||"",S=(new Date).getTime(),F=[],j=o,T="string"==typeof j,k=[].slice.call(arguments,1);return q(this).each(function(){var u=q.isPlainObject(o)?q.extend(!0,{},q.fn.search.settings,o):q.extend({},q.fn.search.settings),f=u.className,l=u.metadata,d=u.regExp,i=u.fields,g=u.selector,h=u.error,e=u.namespace,n="."+e,t=e+"-module",p=q(this),m=p.find(g.prompt),s=p.find(g.searchButton),r=p.find(g.results),a=p.find(g.result),v=(p.find(g.category),this),c=p.data(t),y=!1,b=!1,R={initialize:function(){R.verbose("Initializing module"),R.get.settings(),R.determine.searchFields(),R.bind.events(),R.set.type(),R.create.results(),R.instantiate()},instantiate:function(){R.verbose("Storing instance of module",R),c=R,p.data(t,R)},destroy:function(){R.verbose("Destroying instance"),p.off(n).removeData(t)},refresh:function(){R.debug("Refreshing selector cache"),m=p.find(g.prompt),s=p.find(g.searchButton),p.find(g.category),r=p.find(g.results),a=p.find(g.result)},refreshResults:function(){r=p.find(g.results),a=p.find(g.result)},bind:{events:function(){R.verbose("Binding events to search"),u.automatic&&(p.on(R.get.inputEvent()+n,g.prompt,R.event.input),m.attr("autocomplete","off")),p.on("focus"+n,g.prompt,R.event.focus).on("blur"+n,g.prompt,R.event.blur).on("keydown"+n,g.prompt,R.handleKeyboard).on("click"+n,g.searchButton,R.query).on("mousedown"+n,g.results,R.event.result.mousedown).on("mouseup"+n,g.results,R.event.result.mouseup).on("click"+n,g.result,R.event.result.click)}},determine:{searchFields:function(){o&&o.searchFields!==D&&(u.searchFields=o.searchFields)}},event:{input:function(){u.searchDelay?(clearTimeout(R.timer),R.timer=setTimeout(function(){R.is.focused()&&R.query()},u.searchDelay)):R.query()},focus:function(){R.set.focus(),u.searchOnFocus&&R.has.minimumCharacters()&&R.query(function(){R.can.show()&&R.showResults()})},blur:function(e){function t(){R.cancel.query(),R.remove.focus(),R.timer=setTimeout(R.hideResults,u.hideDelay)}var s=E.activeElement===this;s||(b=!1,R.resultsClicked?(R.debug("Determining if user action caused search to close"),p.one("click.close"+n,g.results,function(e){R.is.inMessage(e)||y?m.focus():(y=!1,R.is.animating()||R.is.hidden()||t())})):(R.debug("Input blurred without user action, closing results"),t()))},result:{mousedown:function(){R.resultsClicked=!0},mouseup:function(){R.resultsClicked=!1},click:function(e){R.debug("Search result selected");var t=q(this),s=t.find(g.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,a=(s.html(),0=u.minCharacters},results:function(){return 0!==r.length&&""!=r.html()}},clear:{cache:function(e){var t=p.data(l.cache);e?e&&t&&t[e]&&(R.debug("Removing value from cache",e),delete t[e],p.data(l.cache,t)):(R.debug("Clearing cache",e),p.removeData(l.cache))}},read:{cache:function(e){var t=p.data(l.cache);return!!u.cache&&(R.verbose("Checking cache for generated html for query",e),"object"==typeof t&&t[e]!==D&&t[e])}},create:{categoryResults:function(e){var s={};return q.each(e,function(e,t){t.category&&(s[t.category]===D?(R.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,n=e+1;return t!==D?(s=String.fromCharCode(97+t)+n,R.verbose("Creating category result id",s)):(s=n,R.verbose("Creating result id",s)),s},results:function(){0===r.length&&(r=q("
").addClass(f.results).appendTo(p))}},inject:{result:function(e,t,s){R.verbose("Injecting result into results");var n=s!==D?r.children().eq(s).children(g.results).first().children(g.result).eq(t):r.children(g.result).eq(t);R.verbose("Injecting results metadata",n),n.data(l.result,e)},id:function(n){R.debug("Injecting unique ids into results");var r=0,i=0;return"category"===u.type?q.each(n,function(e,n){i=0,q.each(n.results,function(e,t){var s=n.results[e];s.id===D&&(s.id=R.create.id(i,r)),R.inject.result(s,i,r),i++}),r++}):q.each(n,function(e,t){var s=n[e];s.id===D&&(s.id=R.create.id(i)),R.inject.result(s,i),i++}),n}},save:{results:function(e){R.verbose("Saving current search results to metadata",e),p.data(l.results,e)}},write:{cache:function(e,t){var s=p.data(l.cache)!==D?p.data(l.cache):{};u.cache&&(R.verbose("Writing generated html to cache",e,t),s[e]=t,p.data(l.cache,s))}},addResults:function(e){if(q.isFunction(u.onResultsAdd)&&!1===u.onResultsAdd.call(r,e))return R.debug("onResultsAdd callback cancelled default action"),!1;e?(r.html(e),R.refreshResults(),u.selectFirstResult&&R.select.firstResult(),R.showResults()):R.hideResults(function(){r.empty()})},showResults:function(e){e=q.isFunction(e)?e:function(){},b||!R.is.visible()&&R.has.results()&&(R.can.transition()?(R.debug("Showing results with css animations"),r.transition({animation:u.transition+" in",debug:u.debug,verbose:u.verbose,duration:u.duration,onComplete:function(){e()},queue:!0})):(R.debug("Showing results with javascript"),r.stop().fadeIn(u.duration,u.easing)),u.onResultsOpen.call(r))},hideResults:function(e){e=q.isFunction(e)?e:function(){},R.is.visible()&&(R.can.transition()?(R.debug("Hiding results with css animations"),r.transition({animation:u.transition+" out",debug:u.debug,verbose:u.verbose,duration:u.duration,onComplete:function(){e()},queue:!0})):(R.debug("Hiding results with javascript"),r.stop().fadeOut(u.duration,u.easing)),u.onResultsClose.call(r))},generateResults:function(e){R.debug("Generating html from response",e);var t=u.templates[u.type],s=q.isPlainObject(e[i.results])&&!q.isEmptyObject(e[i.results]),n=q.isArray(e[i.results])&&0 .message",category:".category",result:".result",title:".title, .name"},templates:{escape:function(e){var t={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"};return/[&<>"'`]/.test(e)?e.replace(/[&<>"'`]/g,function(e){return t[e]}):e},message:function(e,t){var s="";return e!==D&&t!==D&&(s+='
',s+="empty"==t?'
No Results
'+e+'
':'
'+e+"
",s+="
"),s},category:function(e,s){var n="";q.fn.search.settings.templates.escape;return e[s.categoryResults]!==D&&(q.each(e[s.categoryResults],function(e,t){t[s.results]!==D&&0',t[s.categoryName]!==D&&(n+='
'+t[s.categoryName]+"
"),n+='",n+="
")}),e[s.action]&&(n+=''+e[s.action][s.actionText]+""),n)},standard:function(e,s){var n="";return e[s.results]!==D&&(q.each(e[s.results],function(e,t){t[s.url]?n+='':n+='',t[s.image]!==D&&(n+='
'),n+='
',t[s.price]!==D&&(n+='
'+t[s.price]+"
"),t[s.title]!==D&&(n+='
'+t[s.title]+"
"),t[s.description]!==D&&(n+='
'+t[s.description]+"
"),n+="
",n+="
"}),e[s.action]&&(n+=''+e[s.action][s.actionText]+""),n)}}}}(jQuery,window,document);