!function(a,b){"object"==typeof module&&module.exports?module.exports=b():"function"==typeof define&&define.amd?define(b):a.Spinner=b()}(this,function(){"use strict";function a(a,b){var c,d=document.createElement(a||"div");for(c in b)d[c]=b[c];return d}function b(a){for(var b=1,c=arguments.length;b<c;b++)a.appendChild(arguments[b]);return a}function c(a,b,c,d){var e=["opacity",b,~~(100*a),c,d].join("-"),f=.01+c/d*100,g=Math.max(1-(1-a)/b*(100-f),a),h=j.substring(0,j.indexOf("Animation")).toLowerCase(),i=h&&"-"+h+"-"||"";return m[e]||(k.insertRule("@"+i+"keyframes "+e+"{0%{opacity:"+g+"}"+f+"%{opacity:"+a+"}"+(f+.01)+"%{opacity:1}"+(f+b)%100+"%{opacity:"+a+"}100%{opacity:"+g+"}}",k.cssRules.length),m[e]=1),e}function d(a,b){var c,d,e=a.style;if(b=b.charAt(0).toUpperCase()+b.slice(1),void 0!==e[b])return b;for(d=0;d<l.length;d++)if(c=l[d]+b,void 0!==e[c])return c}function e(a,b){for(var c in b)a.style[d(a,c)||c]=b[c];return a}function f(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)void 0===a[d]&&(a[d]=c[d])}return a}function g(a,b){return"string"==typeof a?a:a[b%a.length]}function h(a){this.opts=f(a||{},h.defaults,n)}function i(){function c(b,c){return a("<"+b+' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">',c)}k.addRule(".spin-vml","behavior:url(#default#VML)"),h.prototype.lines=function(a,d){function f(){return e(c("group",{coordsize:k+" "+k,coordorigin:-j+" "+-j}),{width:k,height:k})}function h(a,h,i){b(m,b(e(f(),{rotation:360/d.lines*a+"deg",left:~~h}),b(e(c("roundrect",{arcsize:d.corners}),{width:j,height:d.scale*d.width,left:d.scale*d.radius,top:-d.scale*d.width>>1,filter:i}),c("fill",{color:g(d.color,a),opacity:d.opacity}),c("stroke",{opacity:0}))))}var i,j=d.scale*(d.length+d.width),k=2*d.scale*j,l=-(d.width+d.length)*d.scale*2+"px",m=e(f(),{position:"absolute",top:l,left:l});if(d.shadow)for(i=1;i<=d.lines;i++)h(i,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(i=1;i<=d.lines;i++)h(i);return b(a,m)},h.prototype.opacity=function(a,b,c,d){var e=a.firstChild;d=d.shadow&&d.lines||0,e&&b+d<e.childNodes.length&&(e=e.childNodes[b+d],e=e&&e.firstChild,(e=e&&e.firstChild)&&(e.opacity=c))}}var j,k,l=["webkit","Moz","ms","O"],m={},n={lines:12,length:7,width:5,radius:10,scale:1,corners:1,color:"#000",opacity:.25,rotate:0,direction:1,speed:1,trail:100,fps:20,zIndex:2e9,className:"spinner",top:"50%",left:"50%",shadow:!1,hwaccel:!1,position:"absolute"};if(h.defaults={},f(h.prototype,{spin:function(b){this.stop();var c=this,d=c.opts,f=c.el=a(null,{className:d.className});if(e(f,{position:d.position,width:0,zIndex:d.zIndex,left:d.left,top:d.top}),b&&b.insertBefore(f,b.firstChild||null),f.setAttribute("role","progressbar"),c.lines(f,c.opts),!j){var g,h=0,i=(d.lines-1)*(1-d.direction)/2,k=d.fps,l=k/d.speed,m=(1-d.opacity)/(l*d.trail/100),n=l/d.lines;!function a(){h++;for(var b=0;b<d.lines;b++)g=Math.max(1-(h+(d.lines-b)*n)%l*m,d.opacity),c.opacity(f,b*d.direction+i,g,d);c.timeout=c.el&&setTimeout(a,~~(1e3/k))}()}return c},stop:function(){var a=this.el;return a&&(clearTimeout(this.timeout),a.parentNode&&a.parentNode.removeChild(a),this.el=void 0),this},lines:function(d,f){function h(b,c){return e(a(),{position:"absolute",width:f.scale*(f.length+f.width)+"px",height:f.scale*f.width+"px",background:b,boxShadow:c,transformOrigin:"left",transform:"rotate("+~~(360/f.lines*k+f.rotate)+"deg) translate("+f.scale*f.radius+"px,0)",borderRadius:(f.corners*f.scale*f.width>>1)+"px"})}for(var i,k=0,l=(f.lines-1)*(1-f.direction)/2;k<f.lines;k++)i=e(a(),{position:"absolute",top:1+~(f.scale*f.width/2)+"px",transform:f.hwaccel?"translate3d(0,0,0)":"",opacity:f.opacity,animation:j&&c(f.opacity,f.trail,l+k*f.direction,f.lines)+" "+1/f.speed+"s linear infinite"}),f.shadow&&b(i,e(h("#000","0 0 4px #000"),{top:"2px"})),b(d,b(i,h(g(f.color,k),"0 0 1px rgba(0,0,0,.1)")));return d},opacity:function(a,b,c){b<a.childNodes.length&&(a.childNodes[b].style.opacity=c)}}),"undefined"!=typeof document){k=function(){var c=a("style",{type:"text/css"});return b(document.getElementsByTagName("head")[0],c),c.sheet||c.styleSheet}();var o=e(a("group"),{behavior:"url(#default#VML)"});!d(o,"transform")&&o.adj?i():j=d(o,"animation")}return h}),function(a){function b(a){this.config=null,this.input_el=a,this.results_id=null,this.results_el=null,this.parent_el=null,this.results_showing=!1,this.form_el=null,this.timer=!1,this.last_string="",this.spinner=null,this.spinner_showing=!1,this.has_results=!1,this.current_request=!1,this.results_destroy_on_blur=!0,this.a11y_keys=[27,40,13,38,9],this.init()}var c="searchwp_live_search";b.prototype={init:function(){var b=this,c=this.input_el;this.form_el=c.parents("form:eq(0)"),this.results_id=this.uniqid("searchwp_live_search_results_");var d=!1,e=c.data("swpconfig");if(e&&void 0!==e)for(var f in searchwp_live_search_params.config)e===f&&(d=!0,this.config=searchwp_live_search_params.config[f]);else for(var g in searchwp_live_search_params.config)"default"===g&&(d=!0,this.config=searchwp_live_search_params.config[g]);if(d){var h=c.data("swpengine");h&&(this.config.engine=h),c.data("swpengine",this.config.engine),c.attr("autocomplete","off");var i=this.results_id+"_instructions";c.attr("aria-describedby",i),c.attr("aria-owns",this.results_id),c.attr("aria-expanded","false"),c.attr("aria-autocomplete","both"),c.attr("aria-activedescendant",""),c.after('<p class="searchwp-live-search-instructions screen-reader-text" id="'+i+'">'+searchwp_live_search_params.aria_instructions+"</p>");var j='<div class="searchwp-live-search-results" id="'+this.results_id+'" role="listbox" tabindex="0"></div>',k=c.data("swpparentel");k?(this.parent_el=a(k),this.parent_el.html(j)):this.config.parent_el?(this.parent_el=a(this.config.parent_el),this.parent_el.html(j)):a("body").append(a(j)),this.results_el=a("#"+this.results_id),this.position_results(),a(window).resize(function(){b.position_results()}),this.config.spinner&&(this.spinner=new Spinner(this.config.spinner)),void 0===this.config.abort_on_enter&&(this.config.abort_on_enter=!0),c.keyup(function(c){a.inArray(c.keyCode,b.a11y_keys)>-1||(b.current_request&&b.config.abort_on_enter&&13===c.keyCode&&b.current_request.abort(),a.trim(b.input_el.val()).length?b.results_showing||(b.position_results(),b.results_el.addClass("searchwp-live-search-results-showing"),b.show_spinner(),b.results_showing=!0):b.destroy_results(),b.has_results&&!b.spinner_showing&&b.last_string!==a.trim(b.input_el.val())&&(b.results_el.empty(),b.show_spinner()),c.currentTarget.value.length>=b.config.input.min_chars?b.results_el.removeClass("searchwp-live-search-no-min-chars"):b.results_el.addClass("searchwp-live-search-no-min-chars"))}).keyup(a.proxy(this.maybe_search,this)),(this.config.results_destroy_on_blur||void 0===this.config.results_destroy_on_blur)&&a("html").click(function(){b.destroy_results()}),c.click(function(a){a.stopPropagation()}),this.results_el.click(function(a){a.stopPropagation()})}else alert(searchwp_live_search_params.msg_no_config_found)},keyboard_navigation:function(){var b=this,c=this.input_el,d=this.results_el,e="searchwp-live-search-result--focused",f=".searchwp-live-search-result",g=this.a11y_keys;a(document).off("keyup.searchwp_a11y").on("keyup.searchwp_a11y",function(h){if(!d.hasClass("searchwp-live-search-results-showing"))return void a(document).off("keyup.searchwp_a11y");if(-1!==a.inArray(h.keyCode,g)){if(h.preventDefault(),27===h.keyCode&&!c.is(":focus"))return b.destroy_results(),a(document).off("keyup.searchwp_a11y"),c.focus(),void a(document).trigger("searchwp_live_escape_results");if(40===h.keyCode){console.log("down!");var i=a(d[0]).find("."+e);1===i.length&&1===i.next().length?(i.removeClass(e).attr("aria-selected","false").next().addClass(e).attr("aria-selected","true").find("a").focus(),b.aria_activedescendant(!0)):(i.removeClass(e).attr("aria-selected","false"),d.find(f+":first").addClass(e).attr("aria-selected","true").find("a").focus(),d.find(f+":first").length>0?b.aria_activedescendant(!0):b.aria_activedescendant(!1)),a(document).trigger("searchwp_live_key_arrowdown_pressed")}if(38===h.keyCode){var j=a(d[0]).find("."+e);1===j.length&&1===j.prev().length?(j.removeClass(e).attr("aria-selected","false").prev().addClass(e).attr("aria-selected","true").find("a").focus(),b.aria_activedescendant(!0)):(j.removeClass(e).attr("aria-selected","false"),d.find(f+":last").addClass(e).attr("aria-selected","true").find("a").focus(),d.find(f+":last").length>0?b.aria_activedescendant(!0):b.aria_activedescendant(!1)),a(document).trigger("searchwp_live_key_arrowup_pressed")}13===h.keyCode&&a(document).trigger("searchwp_live_key_enter_pressed"),9===h.keyCode&&a(document).trigger("searchwp_live_key_tab_pressed")}}),a(document).trigger("searchwp_live_keyboad_navigation")},aria_expanded:function(b){var c=this.input_el;b?c.attr("aria-expanded","true"):(c.attr("aria-expanded","false"),this.aria_activedescendant(!1)),a(document).trigger("searchwp_live_aria_expanded")},aria_activedescendant:function(b){var c=this.input_el;b?c.attr("aria-activedescendant","selectedOption"):c.attr("aria-activedescendant",""),a(document).trigger("searchwp_live_aria_activedescendant")},position_results:function(){var b=this.input_el,c=b.offset(),d=this.results_el,e=0;if(!b.is(":hidden")){switch(c.left+=parseInt(this.config.results.offset.x,10),c.top+=parseInt(this.config.results.offset.y,10),this.config.results.position){case"top":e=0-d.height();break;default:e=b.outerHeight()}d.css("left",c.left),d.css("top",c.top+e+"px"),"auto"===this.config.results.width&&d.width(b.outerWidth()-parseInt(d.css("paddingRight").replace("px",""),10)-parseInt(d.css("paddingLeft").replace("px",""),10)),a(document).trigger("searchwp_live_position_results",[d.css("left"),d.css("top"),d.width()])}},destroy_results:function(b){this.hide_spinner(),this.aria_expanded(!1),this.results_el.empty().removeClass("searchwp-live-search-results-showing"),this.results_showing=!1,this.has_results=!1,a(document).trigger("searchwp_live_destroy_results")},maybe_search:function(b){a.inArray(b.keyCode,this.a11y_keys)>-1||(clearTimeout(this.timer),b.currentTarget.value.length>=this.config.input.min_chars&&(this.timer=setTimeout(a.proxy(this.search,this,b),this.config.input.delay)))},show_spinner:function(){this.config.spinner&&!this.spinner_showing&&(this.spinner.spin(document.getElementById(this.results_id)),this.spinner_showing=!0,a(document).trigger("searchwp_live_show_spinner"))},hide_spinner:function(){this.config.spinner&&(this.spinner.stop(),this.spinner_showing=!1,a(document).trigger("searchwp_live_hide_spinner"))},search:function(b){var c=this,d=this.form_el,e=d.serialize(),f=d.attr("action")?d.attr("action"):"",g=this.input_el,h=this.results_el;a(document).trigger("searchwp_live_search_start",[g,h,d,f,e]),this.aria_expanded(!1),e+="&action=searchwp_live_search&swpengine="+g.data("swpengine")+"&swpquery="+g.val(),-1!==f.indexOf("?")&&(f=f.split("?"),e+="&"+f[1]),this.last_string=g.val(),this.has_results=!0,this.current_request=a.ajax({url:searchwp_live_search_params.ajaxurl,type:"POST",data:e,complete:function(){a(document).trigger("searchwp_live_search_complete",[g,h,d,f,e]),c.spinner_showing=!1,c.hide_spinner(),this.current_request=!1},success:function(b){0===b&&(b=""),a(document).trigger("searchwp_live_search_success",[g,h,d,f,e]),c.position_results(),h.html(b),c.aria_expanded(!0),c.keyboard_navigation()}})},uniqid:function(a,b){void 0===a&&(a="");var c,d=function(a,b){return a=parseInt(a,10).toString(16),b<a.length?a.slice(a.length-b):b>a.length?new Array(b-a.length+1).join("0")+a:a};return this.php_js||(this.php_js={}),this.php_js.uniqidSeed||(this.php_js.uniqidSeed=Math.floor(123456789*Math.random())),this.php_js.uniqidSeed++,c=a,c+=d(parseInt((new Date).getTime()/1e3,10),8),c+=d(this.php_js.uniqidSeed,5),b&&(c+=(10*Math.random()).toFixed(8).toString()),c}},a.fn[c]=function(d){return this.each(function(){a.data(this,"plugin_"+c)||a.data(this,"plugin_"+c,new b(a(this),d))}),this}}(jQuery),jQuery(document).ready(function(a){a('input[data-swplive="true"]').searchwp_live_search()});
!function(d,l){"use strict";var e=!1,n=!1;if(l.querySelector)if(d.addEventListener)e=!0;if(d.wp=d.wp||{},!d.wp.receiveEmbedMessage)if(d.wp.receiveEmbedMessage=function(e){var t=e.data;if(t)if(t.secret||t.message||t.value)if(!/[^a-zA-Z0-9]/.test(t.secret)){for(var r,i,a,s=l.querySelectorAll('iframe[data-secret="'+t.secret+'"]'),n=l.querySelectorAll('blockquote[data-secret="'+t.secret+'"]'),o=new RegExp("^https?:$","i"),c=0;c<n.length;c++)n[c].style.display="none";for(c=0;c<s.length;c++)if(r=s[c],e.source===r.contentWindow){if(r.removeAttribute("style"),"height"===t.message){if(1e3<(a=parseInt(t.value,10)))a=1e3;else if(~~a<200)a=200;r.height=a}if("link"===t.message)if(i=l.createElement("a"),a=l.createElement("a"),i.href=r.getAttribute("src"),a.href=t.value,o.test(a.protocol))if(a.host===i.host)if(l.activeElement===r)d.top.location.href=t.value}}},e)d.addEventListener("message",d.wp.receiveEmbedMessage,!1),l.addEventListener("DOMContentLoaded",t,!1),d.addEventListener("load",t,!1);function t(){if(!n){n=!0;for(var e,t,r=-1!==navigator.appVersion.indexOf("MSIE 10"),i=!!navigator.userAgent.match(/Trident.*rv:11\./),a=l.querySelectorAll("iframe.wp-embedded-content"),s=0;s<a.length;s++){if(!(e=a[s]).getAttribute("data-secret"))t=Math.random().toString(36).substr(2,10),e.src+="#?secret="+t,e.setAttribute("data-secret",t);if(r||i)(t=e.cloneNode(!0)).removeAttribute("security"),e.parentNode.replaceChild(t,e)}}}}(window,document);