var _____WB$wombat$assign$function_____=function(name){return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name))||self[name];};if(!self.__WB_pmw){self.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{
let window = _____WB$wombat$assign$function_____("window");
let self = _____WB$wombat$assign$function_____("self");
let document = _____WB$wombat$assign$function_____("document");
let location = _____WB$wombat$assign$function_____("location");
let top = _____WB$wombat$assign$function_____("top");
let parent = _____WB$wombat$assign$function_____("parent");
let frames = _____WB$wombat$assign$function_____("frames");
let opens = _____WB$wombat$assign$function_____("opens");
webpackJsonp([38],{0:function(h,k,b){b(2400)},2400:function(h,k){YUI.add("squarespace-search-page",function(b){b.namespace("Squarespace.Widgets");var d=b.Squarespace.Widgets.SearchPage=b.Base.create("searchPage",b.Squarespace.Widgets.SearchContainer,[],{initializer:function(a){this._isFirstSync=!0;this.get("censusEnabled")&&this._trackSearchHit(this.get("searchQuery"),this.get("collectionFilter"),b.config.doc.referrer)},destructor:function(){this._resizeEmitter&&(this._resizeEmitter.destroy(),this._resizeEmitter=
null);b.Lang.isValue(this._searchTypingTimeout)&&this._searchTypingTimeout.cancel()},renderUI:function(){d.superclass.renderUI.apply(this,arguments);var a=this.get("inputWrapper"),a=new b.Squarespace.Widgets.SearchInputBox({queryString:this.get("searchQuery"),srcNode:a,boundingBox:a,inputType:"text"});this.set("searchInputBox",a);a.render().focus();this._resizeEmitter=new b.Squarespace.ResizeEmitter({timeout:100});this._initRender()},_initRender:function(){var a=b.Squarespace.Utils.getInnerTextFromHtml(this.get("searchQuery"));
this.get("inputWrapper").one("input").set("value",a);var c=!b.Lang.isValue(this.get("resultItemEls"));c&&""!==a&&this.get("noticeEl").setContent(this.get("strings.emptyNotice")).toggleClass("hide");this.get("resultsWrapperEl").toggleClass("empty",c);a=this.get("collectionFilter");""!==a&&this.set("searchFilter",[{name:"collectionId",value:a}]);this._toggleMore(!0);this.get("outputEl").removeClass("hide")},bindUI:function(){d.superclass.bindUI.apply(this,arguments);this.get("resultEl").delegate("click",
this._onResultClick,".search-result",this);this.after("searchQueryChange",this._updateHistory,this);this.get("inputWrapper").one("input").on("keyup",this._onKeyUp,this);this.get("moreEl").on("click",this._nextPage,this);this._resizeEmitter.on("resize",this._onResize,this)},syncUI:function(){0===this.get("page")&&this.get("outputEl").addClass("hide");this._isFirstSync?(this._loadImages(),this._isFirstSync=!1,this.get("outputEl").removeClass("hide")):(d.superclass.syncUI.apply(this,arguments),this._toggleLoader(),
setTimeout(this._syncOutput.bind(this),150))},_syncOutput:function(){var a=this.get("resultsWrapperEl"),c=this.get("page"),f=this.get("perPage"),e=b.Node.create(this._getResultsTemplate());if(b.Lang.isValue(e)){e.all(".sqs-search-ui-item").removeClass("sqs-search-ui-item").addClass("sqs-search-page-item");if(0===c)a.setContent(e);else{var c=e.get("children"),d=c.size(),c=c.splice(-(0===d%f?f:d%f));a.append(c)}this.set("resultItemEls",a.get("children"))}this._loadImages();this._toggleNotice(e);this._toggleMore();
this.get("loading")||this.get("outputEl").removeClass("hide")},_loadImages:function(a){this.get("contentBox").all("img[data-src]").each(function(b){a?ImageLoader.refresh(b):ImageLoader.load(b)})},_toggleNotice:function(a){var c=this.get("noticeEl"),d=this.get("resultsWrapperEl"),e=""!==this.get("searchQuery"),g=!b.Lang.isValue(a)&&!this.get("loading");c.toggleClass("hide",!g||!e);d.toggleClass("empty",!b.Lang.isValue(a));g&&(d.empty(),c.setContent(this.get("strings.emptyNotice")))},_toggleLoader:function(){""===
this.get("searchQuery")&&this.set("loading",!1);var a=b.Lang.isValue(this.get("loading"))&&this.get("loading"),c=this.get("spinnerEls");a&&(!b.Lang.isValue(this._inputSpinner)&&!b.Lang.isValue(this._moreSpinner))&&(this._inputSpinner=new b.Squarespace.Spinner({color:"dark",size:"large",render:c.item(0)}),this._moreSpinner=new b.Squarespace.Spinner({size:"large",render:c.item(1)}));this.get("inputWrapper").toggleClass("loading",a);this.get("moreEl").toggleClass("loading",a);c.toggleView(a)},_toggleMore:function(a){var c=
this.get("moreEl");!b.Lang.isValue(this.get("resultItemEls"))||""===this.get("searchQuery")?c.addClass("hide"):(a=a?this.get("resultEl").getData("count"):this.get("totalCount"),c.toggleClass("hide",0>=a-this.get("resultItemEls").size()))},_getResultsTemplate:function(){return b.Squarespace.UITemplates.render(d.TEMPLATE_RESULTS_NAME,this._getSearchDataModel())},_onKeyUp:function(a){b.Lang.isValue(this._searchTypingTimeout)&&this._searchTypingTimeout.cancel();if(37>a.keyCode||40<a.keyCode)this._searchTypingTimeout=
b.later(this.get("displayDelay"),this,function(){this.get("searchInputBox").onSubmit()})},_onResultClick:function(a){a.halt();a=a.target.ancestor(".search-result",!0);var c=a.getData("url");a=b.Lang.isValue(c)?c:this._getSearchItemUrl(a);this._redirect(a+"?"+b.QueryString.stringify({rq:this.get("searchQuery")}))},_updateHistory:function(){var a=b.Squarespace.Utils.getInnerTextFromHtml(this.get("searchQuery"));if(b.Lang.isValue(a)&&""!==a){var c=b.config.win.history,d=a+" - "+b.config.doc.title,e=
{};e.q=a;a=this.get("collectionFilter");""!==a&&(e.f_collectionId=a);c.pushState(e,d,"/search?"+b.QueryString.stringify(e))}},_onResize:function(){this._loadImages(!0)},_setSearchQuery:function(a){b.Lang.isValue(a)&&""!==a&&(a=b.Squarespace.Escaping.escapeForHtml(a+""));return b.Lang.isValue(a)?a:""}},{CSS_PREFIX:"sqs-search-page",TEMPLATE_RESULTS_NAME:"search-result.html",HTML_PARSER:{inputWrapper:".sqs-search-page-input",spinnerEls:[".spinner-wrapper"],outputEl:".sqs-search-page-output",noticeEl:".sqs-search-page-notice",
resultEl:".sqs-search-page-result",resultsWrapperEl:".sqs-search-page-list .search-results",resultItemEls:[".sqs-search-page-list .search-results .search-result"],moreEl:".sqs-search-page-more"},ATTRS:{searchQuery:{valueFn:function(){var a=b.QueryString.parse(b.config.doc.location.search.substring(1)).q;return this._setSearchQuery(a)},setter:"_setSearchQuery",validator:b.Squarespace.AttrValidators.isString},collectionFilter:{valueFn:function(){var a=b.QueryString.parse(b.config.doc.location.search.substring(1)).f_collectionId;
b.Lang.isValue(a)&&""!==a&&(a=b.Squarespace.Escaping.escapeForHtml(a+""));return b.Lang.isValue(a)?a:""},validator:b.Squarespace.AttrValidators.isNullOrString},inputWrapper:{value:null,validator:b.Squarespace.AttrValidators.isNullOrNode,writeOnce:"initOnly"},outputEl:{value:null,validator:b.Squarespace.AttrValidators.isNullOrNode,writeOnce:"initOnly"},noticeEl:{value:null,validator:b.Squarespace.AttrValidators.isNullOrNode,writeOnce:"initOnly"},spinnerEls:{value:null,validator:b.Squarespace.AttrValidators.isNullOrNodeList,
writeOnce:"initOnly"},resultEl:{value:null,validator:b.Squarespace.AttrValidators.isNullOrNode,writeOnce:"initOnly"},resultsWrapperEl:{value:null,validator:b.Squarespace.AttrValidators.isNullOrNode},resultItemEls:{value:null,validator:b.Squarespace.AttrValidators.isNullOrNodeList},moreEl:{value:null,validator:b.Squarespace.AttrValidators.isNullOrNode,writeOnce:"initOnly"},displayDelay:{value:500,validator:b.Squarespace.AttrValidators.isNumber},perPage:{value:20,validator:b.Squarespace.AttrValidators.isNumber,
writeOnce:"initOnly"}}});b.config.win.Squarespace.onInitialize(b,function(){b.all(".sqs-search-page").each(function(a){(new d({srcNode:a})).render()})})},"1.0",{requires:"base event datasource querystring autocomplete-plugin squarespace-ss-widget squarespace-census squarespace-animations squarespace-search squarespace-search-result-template squarespace-util".split(" ")})}});

}