!function(l){var d=function(){var r={cipher:{},hash:{},keyexchange:{},mode:{},misc:{},codec:{},exception:{corrupt:function(t){this.toString=function(){return"CORRUPT: "+this.message},this.message=t},invalid:function(t){this.toString=function(){return"INVALID: "+this.message},this.message=t},bug:function(t){this.toString=function(){return"BUG: "+this.message},this.message=t},notReady:function(t){this.toString=function(){return"NOT READY: "+this.message},this.message=t}}};function i(t){var e,i;if(Array.isArray(t)||(e=t)&&"object"==typeof e&&"[object Object]"===Object.prototype.toString.call(e))try{return i=function(t,e){e||(e={}),"function"==typeof e&&(e={cmp:e});var n,l="boolean"==typeof e.cycles&&e.cycles,d=e.cmp&&(n=e.cmp,function(s){return function(t,e){var i={key:t,value:s[t]},o={key:e,value:s[e]};return n(i,o)}}),c=[];return function t(e){if(e&&e.toJSON&&"function"==typeof e.toJSON&&(e=e.toJSON()),void 0!==e){if("number"==typeof e)return isFinite(e)?""+e:"null";if("object"!=typeof e)return JSON.stringify(e);var i,o;if(Array.isArray(e)){for(o="[",i=0;i<e.length;i++)i&&(o+=","),o+=t(e[i])||"null";return o+"]"}if(null===e)return"null";if(-1!==c.indexOf(e)){if(l)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var s=c.push(e)-1,n=Object.keys(e).sort(d&&d(e));for(o="",i=0;i<n.length;i++){var a=n[i],r=t(e[a]);r&&(o&&(o+=","),o+=JSON.stringify(a)+":"+r)}return c.splice(s,1),"{"+o+"}"}}(t)}(t),r.codec.hex.fromBits(r.hash.sha256.hash(i))}catch(t){}}function t(t,e){return!(!e&&"string"==typeof e)&&i(t)===e}if(r.bitArray={bitSlice:function(t,e,i){return t=r.bitArray._shiftRight(t.slice(e/32),32-(31&e)).slice(1),void 0===i?t:r.bitArray.clamp(t,i-e)},extract:function(t,e,i){var o=Math.floor(-e-i&31);return(-32&(e+i-1^e)?t[e/32|0]<<32-o^t[e/32+1|0]>>>o:t[e/32|0]>>>o)&(1<<i)-1},concat:function(t,e){if(0===t.length||0===e.length)return t.concat(e);var i=t[t.length-1],o=r.bitArray.getPartial(i);return 32===o?t.concat(e):r.bitArray._shiftRight(e,o,0|i,t.slice(0,t.length-1))},bitLength:function(t){var e,i=t.length;return 0===i?0:(e=t[i-1],32*(i-1)+r.bitArray.getPartial(e))},clamp:function(t,e){if(32*t.length<e)return t;var i=(t=t.slice(0,Math.ceil(e/32))).length;return e&=31,0<i&&e&&(t[i-1]=r.bitArray.partial(e,t[i-1]&2147483648>>e-1,1)),t},partial:function(t,e,i){return 32===t?e:(i?0|e:e<<32-t)+1099511627776*t},getPartial:function(t){return Math.round(t/1099511627776)||32},equal:function(t,e){if(r.bitArray.bitLength(t)!==r.bitArray.bitLength(e))return!1;var i,o=0;for(i=0;i<t.length;i++)o|=t[i]^e[i];return 0===o},_shiftRight:function(t,e,i,o){var s,n,a;for(void 0===o&&(o=[]);32<=e;e-=32)o.push(i),i=0;if(0===e)return o.concat(t);for(s=0;s<t.length;s++)o.push(i|t[s]>>>e),i=t[s]<<32-e;return n=t.length?t[t.length-1]:0,a=r.bitArray.getPartial(n),o.push(r.bitArray.partial(e+a&31,32<e+a?i:o.pop(),1)),o},_xor4:function(t,e){return[t[0]^e[0],t[1]^e[1],t[2]^e[2],t[3]^e[3]]},byteswapM:function(t){var e,i;for(e=0;e<t.length;++e)i=t[e],t[e]=i>>>24|i>>>8&65280|(65280&i)<<8|i<<24;return t}},r.codec.utf8String={fromBits:function(t){var e,i,o="",s=r.bitArray.bitLength(t);for(e=0;e<s/8;e++)0==(3&e)&&(i=t[e/4]),o+=String.fromCharCode(i>>>8>>>8>>>8),i<<=8;return decodeURIComponent(escape(o))},toBits:function(t){t=unescape(encodeURIComponent(t));var e,i=[],o=0;for(e=0;e<t.length;e++)o=o<<8|t.charCodeAt(e),3==(3&e)&&(i.push(o),o=0);return 3&e&&i.push(r.bitArray.partial(8*(3&e),o)),i}},r.codec.hex={fromBits:function(t){var e,i="";for(e=0;e<t.length;e++)i+=(0xf00000000000+(0|t[e])).toString(16).substr(4);return i.substr(0,r.bitArray.bitLength(t)/4)},toBits:function(t){var e,i,o=[];for(i=(t=t.replace(/\s|0x/g,"")).length,t+="00000000",e=0;e<t.length;e+=8)o.push(0^parseInt(t.substr(e,8),16));return r.bitArray.clamp(o,4*i)}},r.hash.sha256=function(t){this._key[0]||this._precompute(),t?(this._h=t._h.slice(0),this._buffer=t._buffer.slice(0),this._length=t._length):this.reset()},r.hash.sha256.hash=function(t){return(new r.hash.sha256).update(t).finalize()},r.hash.sha256.prototype={blockSize:512,reset:function(){return this._h=this._init.slice(0),this._buffer=[],this._length=0,this},update:function(t){"string"==typeof t&&(t=r.codec.utf8String.toBits(t));var e,i=this._buffer=r.bitArray.concat(this._buffer,t),o=this._length,s=this._length=o+r.bitArray.bitLength(t);if(9007199254740991<s)throw new r.exception.invalid("Cannot hash more than 2^53 - 1 bits");if("undefined"!=typeof Uint32Array){var n=new Uint32Array(i),a=0;for(e=512+o-(512+o&511);e<=s;e+=512)this._block(n.subarray(16*a,16*(a+1))),a+=1;i.splice(0,16*a)}else for(e=512+o-(512+o&511);e<=s;e+=512)this._block(i.splice(0,16));return this},finalize:function(){var t,e=this._buffer,i=this._h;for(t=(e=r.bitArray.concat(e,[r.bitArray.partial(1,1)])).length+2;15&t;t++)e.push(0);for(e.push(Math.floor(this._length/4294967296)),e.push(0|this._length);e.length;)this._block(e.splice(0,16));return this.reset(),i},_init:[],_key:[],_precompute:function(){var t,e,i=0,o=2;function s(t){return 4294967296*(t-Math.floor(t))|0}for(;i<64;o++){for(e=!0,t=2;t*t<=o;t++)if(o%t==0){e=!1;break}e&&(i<8&&(this._init[i]=s(Math.pow(o,.5))),this._key[i]=s(Math.pow(o,1/3)),i++)}},_block:function(t){var e,i,o,s,n=this._h,a=this._key,r=n[0],l=n[1],d=n[2],c=n[3],h=n[4],u=n[5],p=n[6],_=n[7];for(e=0;e<64;e++)i=(i=e<16?t[e]:(o=t[e+1&15],s=t[e+14&15],t[15&e]=(o>>>7^o>>>18^o>>>3^o<<25^o<<14)+(s>>>17^s>>>19^s>>>10^s<<15^s<<13)+t[15&e]+t[e+9&15]|0))+_+(h>>>6^h>>>11^h>>>25^h<<26^h<<21^h<<7)+(p^h&(u^p))+a[e],_=p,p=u,u=h,h=c+i|0,c=d,d=l,r=i+((l=r)&d^c&(l^d))+(l>>>2^l>>>13^l>>>22^l<<30^l<<19^l<<10)|0;n[0]=n[0]+r|0,n[1]=n[1]+l|0,n[2]=n[2]+d|0,n[3]=n[3]+c|0,n[4]=n[4]+h|0,n[5]=n[5]+u|0,n[6]=n[6]+p|0,n[7]=n[7]+_|0}},"undefined"==typeof module||!module.exports)return{verify:t,generate:i};module.exports.verify=t,module.exports.generate=i}(),c="data-collections",n="data-collections-thumbs",h=null,u=null;function p(t){return null!=t}function _(t,e,i){var o,s=t.attr(i?n:c);if(s){if(o=atob(s),!1===e)return o;try{return JSON.parse(o)}catch(t){console.log("failed to parse "+s+" attribute, ",t)}}}function m(t,o,e){var i,s,n=l.makeArray(arguments).slice(3),a=n.shift(),r=n.shift();return l.isFunction(a)&&!p(r)&&(r=a,a=void 0),h&&u?((i={query:e,layouts:{}}).layouts[o]=null,a&&(i.design=a,i.design.useDeferredLoading&&(i.design.useDeferredLoading=!1),i.design.mosaicColSpans=null),(s=d.generate({siteId:u,type:t,params:i}))?void l.ajax({type:"POST",url:h.replace("{type}",t)+"/"+s,data:JSON.stringify(i),contentType:"application/json",dataType:"json"}).done(function(t){var e,i=!1;t&&(e=t[o])&&t.__sys&&(i=!0===t.__sys.additional),r(null,e,i)}).fail(function(t){r(t)}):r(new Error("Failed to generate version"))):r(new Error("Invalid collections API"))}function f(i,t){var o;return t&&(l.isArray(t.tags)&&(l.isArray(i.tags)?(o=i.tags.length?[i.tags]:[],l.each(t.tags,function(t,e){-1===l.inArray(e,i.tags)&&o.push(l.isArray(e)?e:[e])}),i.tags=o):i.tags=t.tags),t.skip&&(i.skip=t.skip)),i}function i(t){if(!t)return console.error("A container must be specified for the pagination block");this._dom={},this._dom.container=t,this._dom.controls=t.find(".paginationControls"),this._dom.progressSpinner=t.find(".progressSpinner"),this._isLoading=!1,this._isAnimating=!1,this._queuedItems=null,this._queuedThumbs=null,this._hasSearch=0<t.find(".collectionSearch").length,this._isManual="true"===t.attr("data-manual"),this._isSlideshow=t.hasClass("hasSlideshow"),this._hasThumbs=t.hasClass("hasThumbs"),this._isCarousel=t.hasClass("hasCarousel"),this._isImgGrid=t.hasClass("hasGridGallery"),this._isImgRows=t.hasClass("hasRowGallery"),this._isImgStack=t.hasClass("hasStackedGallery"),this._dom.itemsContainer=t.find(".itemsCollectionContent").length?t.find(".itemsCollectionContent"):t.find(".galleryWrapper"),this._isResources=t.hasClass("resourcesCollection"),this._isResources&&(this._dom.itemsContainer=t.find(".resources")),this._animationType=t.attr("data-pagination-anim"),this._isSlideshow&&(this._dom.slider=t.find(".flexslider")),this._hasThumbs&&(this._dom.thumbs=t.find(".flexNavigator")),this._isCarousel&&(this._dom.slider=t.find(".carousel"))}i.prototype.setup=function(){this._isSlideshow||this._isCarousel?(this._setupSlideshow(this._dom.slider),this._hasThumbs&&this._setupSlideshow(this._dom.thumbs)):this._hasSearch?this._setupSearch():imagesLoaded(this._dom.container.find("img"),this._setupEndlessScroll.bind(this))},i.prototype._setupSearch=function(){this._dom.form=this._dom.container.find(".collectionSearch-form"),this._dom.input=this._dom.container.find(".collectionSearch-input"),this._dom.form.on("submit",l.proxy(this._submitSearch,this))},i.prototype._submitSearch=function(t){t.preventDefault();var e=this._dom.input.val().trim();e&&(this._searchTerm=e,this._dom.itemsContainer.empty(),this._dom.container.attr("data-pagenum",0),this._addEndlessScrollItems(!0),this._observer||this._isManual||imagesLoaded(this._dom.container.find("img"),this._setupEndlessScroll.bind(this)))},i.prototype._addQueuedSliderItems=function(t,e){this._queuedItems&&0<this._queuedItems.length&&(this._addSlides(this._queuedItems,t),this._queuedItems=null),e&&this._queuedThumbs&&0<this._queuedThumbs.length&&(this._addSlides(this._queuedThumbs,t),this._queuedThumbs=null)},i.prototype._setupSlideshow=function(t){var a=this,e=a._isSlideshow?"scFlexsliderAdded":null,i=a._isSlideshow?"scFlexsliderBefore":"scCarouselBefore",o=a._isSlideshow?"scFlexsliderAfter":"scCarouselNavigatedTo",r=t.hasClass("flexNavigator");t.on(i,function(){a._isAnimating=!0}),a._isSlideshow&&t.on(e,function(t,e){"fade"===e.vars.animation&&e.slides.css({opacity:0,display:"block",zIndex:1}).eq(e.currentSlide).css({zIndex:2}).css({opacity:1})}),t.on(o,function(t,i){var o=a._isSlideshow?i.directionNav:i.$nav;if(a._isAnimating=!1,a._queuedItems&&0<a._queuedItems.length||r&&a._queuedThumbs&&0<a._queuedThumbs.length)a._addQueuedSliderItems(i,r);else if(a._canAddToSlideshow(i)&&(a._isLoading=!0,o.filter(".galleryArrow--next").addClass("loading"),a._getNextPage(r,function(t,e){if(o.filter(".galleryArrow--next").removeClass("loading"),t)return a._isLoading=!1,void console.error(t);e&&0<e.length&&(a._isAnimating?r?a._queuedThumbs=e:a._queuedItems=e:a._addSlides(e,i))}),a._hasThumbs)){var s=r?a._dom.slider.data("flexslider"):a._dom.thumbs.data("flexslider"),n=s.directionNav;n.filter(".galleryArrow--next").addClass("loading"),a._getNextPage(!r,function(t,e){if(n.filter(".galleryArrow--next").removeClass("loading"),t)return a._isLoading=!1,void console.error(t);e&&0<e.length&&(a._isAnimating?r?a._queuedThumbs=e:a._queuedItems=e:a._addSlides(e,s))})}}),r&&t.on("scFlexsliderStart",function(t,e){1===e.pagingCount&&e.trigger(o,[e])})},i.prototype._addSlides=function(t,e){e.addSlide(t),this._dom.itemsContainer.trigger("afterAddItems"),window.scSetupImageShapes(this._dom.itemsContainer),(this._isCarousel||this._isSlideshow&&!1===e.hasClass("flexNavigator"))&&this._updatePageNum(),this._isLoading=!1},i.prototype._canAddToSlideshow=function(t){if(!this._isLoading)return this._isCarousel?t._currentSlide>=t._slideCount-1:this._isSlideshow?t.currentSlide>=t.last-1:void 0},i.prototype._setupEndlessScroll=function(){this._observer=new IntersectionObserver(this._handleIntersection.bind(this),{root:null,rootMargin:"0% 0% 50% 0%",threshold:[0]}),this._observer.observe(this._dom.controls[0])},i.prototype._handleIntersection=function(t){this._isIntersecting=t[0].isIntersecting,this._addEndlessScrollItems()},i.prototype._addEndlessScrollItems=function(t){var i=this;(t||i._isIntersecting&&!i._isLoading)&&(i._isLoading=!0,i._showSpinner(),i._getNextPage(!1,function(e,t){if(i._hideSpinner(),e)return i._isLoading=!1,void console.error(e);t?i._appendPageResults(t,function(t){i._isLoading=!1,e?console.error(t):setTimeout(i._addEndlessScrollItems.bind(i),1500)}):i._isLoading=!1}))},i.prototype._getNextPage=function(t,o){var s=this,e=_(this._dom.container.find("["+(t?n:c)+"]"),!0,t),i=e.params.query;this._hasSearch&&this._searchTerm&&(i.search=this._searchTerm,i.fulltext=!0),f(i,{skip:this._getPageNum()*i.limit}),m(e.type,e.params.layout,i,e.params.design,function(t,e){if(t)return o(t),void s._showPaginationMessage();if(!p(e))return s._hideSpinner(),s._showNoneMessage("There are no more items"),void o();var i=l(e).filter(function(){return p(this.innerText)});s._isResources||s._isCarousel||s._isSlideshow||i.addClass("item--tombstone"),o(null,i)})},i.prototype._appendPageResults=function(t,e){var i=this,o=i._dom.itemsContainer.hasClass("masonryGrid")||i._dom.itemsContainer.hasClass("masonryImgGallery");i._dom.container.removeClass("deferredLoadGallery"),i._isImgRows&&i._dom.itemsContainer.trigger("beforeAddItems"),i._updatePageNum(),o?(t.each(function(t,e){l(e).addClass("packeryItem")}),i._dom.itemsContainer.append(t).packery("appended",t).packery()):i._dom.itemsContainer.append(t),imagesLoaded(t,function(){i._dom.itemsContainer.trigger("afterAddItems"),window.scSetupImageShapes(i._dom.itemsContainer),i._addLoadedClass(t),e&&e()})},i.prototype._addLoadedClass=function(t){if("sequential"===this._animationType)var e=t.toArray(),i=setInterval(function(){0!==e.length?l(e.shift()).addClass("loaded"):clearInterval(i)},100);else t.addClass("loaded")},i.prototype._getPageNum=function(){return this._dom.container.attr("data-pagenum")},i.prototype._updatePageNum=function(){this._dom.container.attr("data-pagenum",Number(this._dom.container.attr("data-pagenum"))+1)},i.prototype._showPaginationMessage=function(){this._dom.controls.find(".paginationError").removeClass("scHidden")},i.prototype._showNoneMessage=function(){this._dom.controls.find(".paginationNoneLeft").removeClass("scHidden")},i.prototype._showSpinner=function(){this._dom.progressSpinner.removeClass("scInvisible")},i.prototype._hideSpinner=function(){this._dom.progressSpinner.addClass("scInvisible")},l.fn.scPaginationBlock=function(){this.each(function(t,e){new i(l(e)).setup()})};function o(t){i.call(this,t),this._isComplete=!1,this._categoryId=this._dom.container.attr("data-category-id")}function s(t){if(!t)return console.error("A container must be specified for the image downloader");this._showingPanel=!1,this._dom={},this._dom.container=t,this._dom.categories=t.find(".pfColl-category"),this._dom.gallery=t.find(".galleryWrapper"),this._dom.trigger=t.find(".imageDownloader-trigger"),this._strings=JSON.parse(unescape(this._dom.container.attr("data-download-strings")))}function a(t){var e;return t?(e=_(t.find(".blockContent"),!0))?(this._type=e.type,this._params=e.params,this._dom={},this._dom.$container=t,this._dom.$layout=t.find(".locFinder-layout"),this._dom.$countWrap=t.find(".locFinder-countWrap"),this._dom.$count=t.find(".locFinder-count"),this._dom.$list=t.find(".locFinder-list"),this._dom.$toggles=t.find(".locFinder-viewToggle"),this._dom.$form=t.find(".locFinder-searchControls"),this._dom.$searchTerm=t.find(".locFinder-input"),this._dom.$acResults=t.find(".locFinder-acResults"),this._dom.$radius=t.find(".locFinder-select"),this._dom.$locate=t.find(".locFinder-geolocate"),this._dom.$mapWrap=t.find(".scInteractiveMap"),this._autocompletion={},this._iconType=t.attr("data-map-icon"),this._country=this._dom.$searchTerm.attr("data-country"),this._boundAutocompleteResults=l.proxy(this._autocompleteResults,this),void(this._boundSearch=l.proxy(this._search,this))):console.error("Invalid location finder configuration"):console.error("A container must be specified for the location finder block")}((o.prototype=Object.create(i.prototype)).constructor=o).prototype.setup=function(){this._dom.container.find("img[data-src]").closest(".imgGridItem").css("visiblity","hidden"),imagesLoaded(this._dom.container.find("img"),this._setupEndlessScroll.bind(this))},o.prototype._addEndlessScrollItems=function(){if(this._isIntersecting&&!this._isLoading&&!this._isComplete&&"true"!==this._dom.container.attr("aria-hidden")){var t=this;this._isLoading=!0;var e=this._dom.container,o=e.find(".packery"),i=e.find("img[data-src]").slice(0,16);i.each(function(t,e){var i=l(e);i.closest(".imgGridItem").addClass("item--tombstone").css("visibility","visible"),i.on("load",function(){o.packery("layout"),i.off("load")}),i.attr("src",i.attr("data-src")),i.removeAttr("data-src")}),i.length?imagesLoaded(e[0],function(){e.find(".item--tombstone").removeClass("item--tombstone"),o.packery("layout"),t._isLoading=!1,t._addEndlessScrollItems()}):(this._isLoading=!1,this._isComplete=!0)}},l.fn.scCategoryPagination=function(){this.each(function(t,e){new o(l(e)).setup()})},l.fn.filterCollection=function(){var t,e,i,o=l.makeArray(arguments),a=o.shift(),r=o.shift();if(l.isFunction(a)&&!p(r)&&(r=a,a=void 0),p(r)){if(!l.isFunction(r))throw new TypeError("Invalid callback function")}else r=l.noop;return p(a)||(a={}),e=a,(t=l.isPlainObject(e)?(l.each(e,function(t,e){if("tags"===t?l.isArray(e)||(i=new TypeError('Invalid filter "tags" value')):"page"===t?l.isNumeric(e)&&0<e||(i=new TypeError('Invalid filter "page" value')):i=new TypeError('Invalid filter "'+t+'"'),i)return!1}),i):new TypeError("Invalid filter"))?r(t):this.each(function(){var t,e,s=l(this),n=s.find("["+c+"]");if(n&&n.length&&(t=_(n)),!(t&&t.type&&t.params))return r(new Error("Invalid collection block"),s);f(e=t.params.query||{},a),m(t.type,t.params.layout,e,t.params.design,function(t,e,i){var o={elem:s,container:n,hasResults:!1,hasAdditional:!1};e?(o.hasResults=!0,o.hasAdditional=!0===i,n.html(e)):n.empty(),r(t,o)})})},s.prototype.setup=function(){var e=this;this._dom.trigger.on("click.scImageDownloader",function(t){t.preventDefault(),e._showingPanel?e._disposePanel():(e._showingPanel=!0,e._buildPanel())})},s.prototype._bindImageHandler=function(){this._dom.gallery.find("[data-asset]").on("click.scImageDownloader",{self:this},function(t){t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),l(t.currentTarget).parents(".imgGridItem, .imgRowItem, .fs-item, .carousel-slide, .stackedGallery-item").toggleClass("selectedForDownload"),t.data.self._updateCount()})},s.prototype._selectCurrentCategory=function(){this._dom.categories.filter('[aria-hidden="false"]').find("[data-dl-id]").addClass("selectedForDownload"),this._updateCount()},s.prototype._downloadSelected=function(){var n=this;this._dom.dlSelectionBtn[0].disabled=!0,this._dom.catSelectBtn[0].disabled=!0,this._dom.selectAllBtn[0].disabled=!0,this._selections=[],this._dom.categories.each(function(t,e){var i,o=l(e).find("[data-dl-id]"),s=o.filter(".selectedForDownload");s.length&&(i=s.length===o.length||s.map(function(){return this.getAttribute("data-dl-id")}).get(),n._selections.push({id:e.getAttribute("data-category-id"),images:i}))}),this._getDownloadUrl(this._selections)},s.prototype._downloadAll=function(){var i=this;this._dom.dlSelectionBtn[0].disabled=!0,this._dom.catSelectBtn[0].disabled=!0,this._dom.selectAllBtn[0].disabled=!0,this._selections=[],this._dom.categories.each(function(t,e){i._selections.push({id:e.getAttribute("data-category-id"),images:!0})}),this._getDownloadUrl(this._selections)},s.prototype._panelClickDelegate=function(t){if(!t.target.getAttribute("data-reload")){t.preventDefault();var e=t.data.self,i=l(t.target);i.is(".dlPanel-close")||i.closest(".dlPanel-close").length?e._disposePanel():i.is(".dlPanel-selectCat")?e._selectCurrentCategory():i.is(".dlPanel-all")?e._downloadAll():i.is(".dlPanel-dlSelection")&&e._downloadSelected()}},s.prototype._buildPanel=function(){this._selections=[];var t='<div class="dlPanel pfColl-dlPanel">';t+='<a class="dlPanel-close" href="#"><svg viewBox="0 0 48 48" width="100%" height="100%"><path d="M38 12.83l-2.83-2.83-11.17 11.17-11.17-11.17-2.83 2.83 11.17 11.17-11.17 11.17 2.83 2.83 11.17-11.17 11.17 11.17 2.83-2.83-11.17-11.17z"></path></svg></a>',t+='<h2 class="contentTitle">'+this._strings.download+"</h2>",t+='<p class="dlPanel-intro">'+this._strings.selectInstr+"</p>",t+='<div class="dlPanel-selection">',t+='<p class="dlPanel-countWrap"><span class="dlPanel-count">0</span> '+this._strings.selected+"</p>",t+='<button class="dlPanel-dlSelection" disabled>'+this._strings.selectBtn+"</button>",t+="</div>",t+='<button class="button--linky dlPanel-selectCat">'+this._strings.selectCategory+"</button>",t+='<div><button class="dlPanel-all">'+this._strings.allBtn+"</button></div>",t+="</div>",this._dom.panel=l(t).appendTo("body").on("click.scImageDownloader",{self:this},this._panelClickDelegate),this._dom.panelTitle=this._dom.panel.find(".contentTitle"),this._dom.panelIntro=this._dom.panel.find(".dlPanel-intro"),this._dom.panelSelection=this._dom.panel.find(".dlPanel-selection").hide(),this._dom.count=this._dom.panel.find(".dlPanel-count"),this._dom.dlSelectionBtn=this._dom.panel.find(".dlPanel-dlSelection"),this._dom.catSelectBtn=this._dom.panel.find(".dlPanel-selectCat"),this._dom.selectAllBtn=this._dom.panel.find(".dlPanel-all"),this._bindImageHandler(),l("body").trigger("scSelectionModeEntered")},s.prototype._updateCount=function(){var t=this._dom.gallery.find(".selectedForDownload").length;this._dom.count.html(t),this._dom.panelTitle.html(this._strings.selectTitle),this._dom.dlSelectionBtn[0].disabled=0===t,0===t?(this._dom.panelIntro.show(),this._dom.panelSelection.hide()):(this._dom.panelIntro.hide(),this._dom.panelSelection.show())},s.prototype._getDownloadUrl=function(){this._dom.gallery.find("[data-asset]").off(".scImageDownloader"),l("body").trigger("scSelectionModeExited"),this._dom.panelTitle.text(this._strings.inProgress),this._dom.panel.find("p, button, div").remove(),this._dom.spinner=l('<div class="progressSpinner"></div>').appendTo(this._dom.panel);var t=/^\/preview/,e=document.location.pathname;t.test(e)&&(e=e.replace(t,""));var i=l("body").attr("data-ajax-prefix")+"/download"+e,o=this;this._downloadUrlRequest=l.post({url:i,data:JSON.stringify({categories:o._selections}),contentType:"application/json",dataType:"json",cache:!1,success:l.proxy(o._getDownloadUrlSuccess,o),error:l.proxy(o._getDownloadUrlFailure,o),timeout:1e4})},s.prototype._getDownloadUrlSuccess=function(t,e){var i;this._downloadUrlRequest=null,t.url&&t.categories?(i=Math.random().toString(36).substring(2,15)+"-"+Date.now(),this._dom["iframe_"+i]=l("<iframe>",{name:i}).hide().appendTo(l("body")),this._dom.form=l("<form>",{method:"POST",action:t.url,target:i}).appendTo(this._dom.panel),l("<input>",{type:"hidden",name:"categories",value:JSON.stringify(t.categories)}).appendTo(this._dom.form),this._dom.form.submit(),this._disposePanel()):console.error("download url or category data not defined")},s.prototype._getDownloadUrlFailure=function(t,e){if(this._downloadUrlRequest=null,"abort"!==e){var i=403===t.status?"<p>We're sorry, your login to this page has expired. Please <a href=\""+document.location.href+'" data-reload="true">reload</a> and try again.</p>':null;this._renderError(i)}},s.prototype._renderError=function(t){t||(t="<p>We're sorry, an error occurred. Please try again later or contact the site owner.</p>"),this._dom.spinner.remove(),this._dom.panelTitle.html("Download Error").after(t)},s.prototype._disposePanel=function(){this._downloadUrlRequest&&(this._downloadUrlRequest.abort(),this._downloadUrlRequest=null),this._showingPanel=!1,this._dom.gallery.find("[data-asset]").off(".scImageDownloader"),this._dom.gallery.find(".selectedForDownload").removeClass("selectedForDownload"),this._dom.panel.off(".scImageDownloader").remove(),this._images&&this._images.off(".scImageDownloader"),this._selections=null,l("body").trigger("scSelectionModeExited")},l.fn.scImageDownloader=function(){this.each(function(t,e){new s(l(e)).setup()})},a.prototype._createMap=function(t){return this._map?this._map:t&&l.fn.scInteractiveMap&&l.fn.scInteractiveMap.utils.isLocation(t)?this._dom.$mapWrap.scInteractiveMap(l.extend({},t)).data("scInteractiveMap"):void 0},a.prototype._initializeMap=function(t,e){var i;this._map?this._map.ready(e):(i=this._dom.$mapWrap.data("scInteractiveMap")||this._createMap(t))&&(this._map=i,this._map.ready(e))},a.prototype._updateMarkers=function(){var o=this,t=this._dom.$list.find("li[data-location-id][data-lat][data-lng]").map(function(t,e){var i=l(e);return{id:i.attr("data-location-id"),lat:o._map.utils.convertToNumber(i.attr("data-lat")),lng:o._map.utils.convertToNumber(i.attr("data-lng")),popup:i.find(".locFinder-searchResultContent").get(0).outerHTML}}).get();this._map.addMarkers(t)},a.prototype._updateCount=function(){var t=this._dom.$list.find("> .locFinder-searchResult").length;return this._dom.$count.text(t),this._dom.$countWrap.toggleClass("scInvisible",0===t),this._dom.$toggles.on("click",l.proxy(this._toggleClickHandler,this)),t},a.prototype._addListeners=function(){l("body").on("click",l.proxy(this._bodyClickHandler,this)),this._dom.$locate.on("click",l.proxy(this._locateHandler,this)),this._dom.$list.on("mouseenter","li",l.proxy(this._overHandler,this)),this._dom.$list.on("mouseleave","li",l.proxy(this._outHandler,this)),this._dom.$searchTerm.on("focus",l.debounce(100,l.proxy(this._searchFieldFocused,this))),this._dom.$searchTerm.on("input",l.debounce(100,l.proxy(this._autocomplete,this))),this._dom.$acResults.on("click",".locFinder-acResult",l.proxy(this._autocompleteResultSelected,this)),this._dom.$radius.on("input",l.proxy(this._radiusChanged,this))},a.prototype.setup=function(){var t=this;this._updateCount()?this._initializeMap(null,function(){t._updateMarkers(),t._addListeners()}):(this._addListeners(),this._locate())},a.prototype._toggleClickHandler=function(t){t.preventDefault();var e=t.currentTarget.getAttribute("data-target");this._dom.$layout.attr("data-show",e)},a.prototype._update=function(t){var o=this;if(o._params&&t){var s=l.extend(!0,{},o._params.query,{geo:t});this._initializeMap(s.geo.coordinates[0],function(){m(o._type,o._params.layout,s,o._params.design,function(t,e){var i=s.geo.coordinates[0];o._params.query=s,o._dom.$list.html(e||""),window.scSetupImageShapes&&window.scSetupImageShapes(o._dom.$list),o._updateCount(),o._map.removeMarkers(),o._map.setCenter(i,!1),o._dom.$mapWrap.attr("data-lat",i.lat).attr("data-lng",i.lng),o._updateMarkers()})})}},a.prototype._search=function(t){var e;return this._params&&t&&(e={lat:Number(t.lat),lng:Number(t.lng)}),!(!l.fn.scInteractiveMap||!l.fn.scInteractiveMap.utils.isLocation(e))&&(this._update({coordinates:[e]}),!0)},a.prototype._locate=function(){var i=this;window.scGeo&&window.scGeo.getCurrentLocation(function(t,e){i._search(e)&&i._dom.$searchTerm.val("")})},a.prototype._locateHandler=function(t){t.preventDefault(),this._locate()},a.prototype._overHandler=function(t){this._map.highlightMarker(l(t.currentTarget).attr("data-location-id"))},a.prototype._outHandler=function(){this._map.highlightMarker()},a.prototype._radiusChanged=function(){var t;this._params&&this._params.query&&this._params.query.geo&&(t=parseInt(this._dom.$radius.val(),10))!==this._params.query.geo.radius&&this._update({radius:t})},a.prototype._autocompleteResults=function(t){var e=this._autocompletion.dirty;if(this._autocompletion.active=!1,this._autocompletion.dirty=!1,e&&this._dom.$searchTerm.val()!==this._autocompletion.query)this._autocomplete();else if(t.results&&t.results.length){var i="";l.each(t.results,function(t,e){i+='<li><button class="locFinder-acResult button--linky" data-id="'+e.id+'">'+e.value+"</button></li>"}),this._dom.$acResults.empty().append(i).removeClass("scHidden")}else this._dom.$acResults.addClass("scHidden")},a.prototype._autocompleteResultSelected=function(t){t.preventDefault(),this._dom.$acResults.addClass("scHidden");var e=t.currentTarget.getAttribute("data-id");e&&this._selectLocation(e)},a.prototype._searchFieldFocused=function(){this._dom.$acResults.children().length&&this._dom.$acResults.removeClass("scHidden")},a.prototype._bodyClickHandler=function(){document.activeElement!==this._dom.$searchTerm[0]&&this._dom.$acResults.addClass("scHidden")},a.prototype._autocomplete=function(){var t,e=this._dom.$searchTerm.val();e!==this._autocompletion.query&&(this._autocompletion.active?this._autocompletion.dirty=!0:""===e?this._dom.$acResults.empty().addClass("scHidden"):(this._autocompletion.active=!0,t={q:this._autocompletion.query=e},this._country&&(t.c=this._country),l.post({url:l("body").attr("data-ajax-prefix")+"/g/a",data:JSON.stringify(t),contentType:"application/json",dataType:"json",timeout:5e3}).done(this._boundAutocompleteResults).fail(this._boundAutocompleteResults)))},a.prototype._selectLocation=function(t){t&&l.post({url:l("body").attr("data-ajax-prefix")+"/g/l",data:JSON.stringify({q:t}),contentType:"application/json",dataType:"json",timeout:5e3}).done(this._boundSearch).fail(this._boundSearch)},l.fn.scLocationFinder=function(){this.each(function(t,e){new a(l(e)).setup()})},l(document).ready(function(){var t;(h=_(l("script["+c+"]"),!1))&&(t=/\/([a-f0-9]{32})\//i.exec(h))&&t.length&&(u=t[1]),0<l(".hasPagination").length&&l(".hasPagination").scPaginationBlock(),0<l(".hasCategoryPagination").length&&l(".hasCategoryPagination").scCategoryPagination(),0<l(".hasImageDownloader").length&&l(".hasImageDownloader").scImageDownloader(),0<l(".locFinder").length&&l(".locFinder").scLocationFinder(),0<l(".blockWrap_proofsheetsCollection").length&&l(".blockWrap_proofsheetsCollection").on("tabChanged",function(t,e,i){i.find(".packery").packery("layout")}),window.collections={search:function(t,e){var i,o,s=l.makeArray(arguments).slice(2),n=s.shift(),a=s.shift(),r=!1;if(l.isFunction(n)&&!p(a)&&(a=n,n=void 0),"function"!=typeof a)throw new TypeError("Invalid callback function");if(!t||"string"!=typeof t)return a(new TypeError("Invalid collection type"));if(void 0===n&&l.isPlainObject(e)&&(n=e,e=void 0),e&&"string"==typeof e?r=!0:!p(e)&&n&&l.isPlainObject(n.query)&&(r=!0),!r)return a(new TypeError("Invalid search query"));if(!h||!u)return a(new TypeError("Invalid collections API"));if(n||(n={}),n.layout){if("string"!=typeof n.layout)return a(new TypeError("Invalid layout"));i=n.layout}else i="search";if(o={sort:!1,asc:!0},e?o.search=e:o=l.extend(o,n.query),n.limit){if(!("number"==typeof n.limit&&0<n.limit))return a(new TypeError("Invalid limit"));o.limit=n.limit}n.design?m(t,i,o,n.design,a):m(t,i,o,a)}}})}(jQuery);