define(["jquery","text!lib/photoswipe/photoswipe.html","jquery-ui-modules/widget","jquery-ui-modules/core"],function(e,t){"use strict";var n,o=(n=function(e,t,n,o){var i={features:null,bind:function(e,t,n,o){var i=(o?"remove":"add")+"EventListener";t=t.split(" ");for(var a=0;a0&&(r=parseInt(r[1],10),r>=1&&r<8&&(o.isOldIOSPhone=!0))}var l=a.match(/Android\s([0-9\.]*)/),s=l?l[1]:0;s=parseFloat(s),s>=1&&(s<4.4&&(o.isOldAndroid=!0),o.androidVersion=s),o.isMobileOpera=/opera mini|opera mobi/i.test(a)}for(var u,c,d=["transform","perspective","animationName"],p=["","webkit","Moz","ms","O"],m=0;m<4;m++){n=p[m];for(var f=0;f<3;f++)u=d[f],c=n+(n?u.charAt(0).toUpperCase()+u.slice(1):u),!o[u]&&c in t&&(o[u]=c);n&&!o.raf&&(n=n.toLowerCase(),o.raf=window[n+"RequestAnimationFrame"],o.raf&&(o.caf=window[n+"CancelAnimationFrame"]||window[n+"CancelRequestAnimationFrame"]))}if(!o.raf){var h=0;o.raf=function(e){var t=(new Date).getTime(),n=Math.max(0,16-(t-h)),o=window.setTimeout(function(){e(t+n)},n);return h=t+n,o},o.caf=function(e){clearTimeout(e)}}return o.svg=!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect,i.features=o,o}};i.detectFeatures(),i.features.oldIE&&(i.bind=function(e,t,n,o){t=t.split(" ");for(var i,a=(o?"detach":"attach")+"Event",r=function(){n.handleEvent.call(n)},l=0;lt-1?e-t:e<0?t+e:e},Se={},Ee=function(e,t){return Se[e]||(Se[e]=[]),Se[e].push(t)},De=function(e){var t=Se[e];if(t){var n=Array.prototype.slice.call(arguments);n.shift();for(var o=0;oa.currItem.fitRatio?Ie||(dn(a.currItem,!1,!0),Ie=!0):Ie&&(dn(a.currItem),Ie=!1)),Oe(oe,fe.x,fe.y,w))},Ae=function(e){e.container&&Oe(e.container.style,e.initialPosition.x,e.initialPosition.y,e.initialZoomLevel,e)},Re=function(e,t){t[M]=y+e+"px, 0px"+b},Le=function(e,t){if(!s.loop&&t){var n=p+(we.x*ve-e)/we.x,o=Math.round(e-wt.x);(n<0&&o>0||n>=Qt()-1&&o<0)&&(e=wt.x+o*s.mainScrollEndFriction)}wt.x=e,Re(e,m)},Pe=function(e,t){var n=xt[e]-ge[e];return me[e]+pe[e]+n-n*(t/x)},Ze=function(e,t){e.x=t.x,e.y=t.y,t.id&&(e.id=t.id)},ze=function(e){e.x=Math.round(e.x),e.y=Math.round(e.y)},Ne=null,Ue=function(){Ne&&(i.unbind(document,"mousemove",Ue),i.addClass(e,"pswp--has_mouse"),s.mouseUsed=!0,De("mouseUsed")),Ne=setTimeout(function(){Ne=null},100)},Ke=function(){i.bind(document,"keydown",a),N.transform&&i.bind(a.scrollWrap,"click",a),s.mouseUsed||i.bind(document,"mousemove",Ue),i.bind(window,"resize scroll orientationchange",a),De("bindEvents")},He=function(){i.unbind(window,"resize scroll orientationchange",a),i.unbind(window,"scroll",g.scroll),i.unbind(document,"keydown",a),i.unbind(document,"mousemove",Ue),N.transform&&i.unbind(a.scrollWrap,"click",a),Y&&i.unbind(window,h,a),clearTimeout(U),De("unbindEvents")},We=function(e,t){var n=ln(a.currItem,he,e);return t&&(ne=n),n},Be=function(e){return e||(e=a.currItem),e.initialZoomLevel},qe=function(e){return e||(e=a.currItem),e.w>0?s.maxSpreadZoom:1},Ge=function(e,t,n,o){return o===a.currItem.initialZoomLevel?(n[e]=a.currItem.initialPosition[e],!0):(n[e]=Pe(e,o),n[e]>t.min[e]?(n[e]=t.min[e],!0):n[e]1?1:e.fitRatio,n=e.container.style,o=t*e.w,i=t*e.h;n.width=o+"px",n.height=i+"px",n.left=e.initialPosition.x+"px",n.top=e.initialPosition.y+"px"},Fe=function(){if(oe){var e=oe,t=a.currItem,n=t.fitRatio>1?1:t.fitRatio,o=n*t.w,i=n*t.h;e.width=o+"px",e.height=i+"px",e.left=fe.x+"px",e.top=fe.y+"px"}}},Ve=function(e){var t="";s.escKey&&27===e.keyCode?t="close":s.arrowKeys&&(37===e.keyCode?t="prev":39===e.keyCode&&(t="next")),t&&(e.ctrlKey||e.altKey||e.shiftKey||e.metaKey||(e.preventDefault?e.preventDefault():e.returnValue=!1,a[t]()))},Xe=function(e){e&&(j||X||ie||q)&&(e.preventDefault(),e.stopPropagation())},je=function(){a.setScrollOffset(0,i.getScrollY())},$e={},Je=0,Qe=function(e){$e[e]&&($e[e].raf&&R($e[e].raf),Je--,delete $e[e])},et=function(e){$e[e]&&Qe(e),$e[e]||(Je++,$e[e]={})},tt=function(){for(var e in $e)$e.hasOwnProperty(e)&&Qe(e)},nt=function(e,t,n,o,i,a,r){var l,s=ke();et(e);var u=function(){if($e[e]){if(l=ke()-s,l>=o)return Qe(e),a(n),void(r&&r());a((n-t)*i(l/o)+t),$e[e].raf=A(u)}};u()},ot={shout:De,listen:Ee,viewportSize:he,options:s,isMainScrollAnimating:function(){return ie},getZoomLevel:function(){return w},getCurrentIndex:function(){return p},isDragging:function(){return Y},isZooming:function(){return ee},setScrollOffset:function(e,t){ge.x=e,z=ge.y=t,De("updateScrollOffset",ge)},applyZoomPan:function(e,t,n,o){fe.x=t,fe.y=n,w=e,Fe(o)},init:function(){if(!u&&!c){var n;a.framework=i,a.template=e,a.bg=i.getChildByClass(e,"pswp__bg"),L=e.className,u=!0,N=i.detectFeatures(),A=N.raf,R=N.caf,M=N.transform,Z=N.oldIE,a.scrollWrap=i.getChildByClass(e,"pswp__scroll-wrap"),a.container=i.getChildByClass(a.scrollWrap,"pswp__container"),m=a.container.style,a.itemHolders=T=[{el:a.container.children[0],wrap:0,index:-1},{el:a.container.children[1],wrap:0,index:-1},{el:a.container.children[2],wrap:0,index:-1}],T[0].el.style.display=T[2].el.style.display="none",Ye(),g={resize:a.updateSize,orientationchange:function(){clearTimeout(U),U=setTimeout(function(){he.x!==a.scrollWrap.clientWidth&&a.updateSize()},500)},scroll:je,keydown:Ve,click:Xe};var o=N.isOldIOSPhone||N.isOldAndroid||N.isMobileOpera;for(N.animationName&&N.transform&&!o||(s.showAnimationDuration=s.hideAnimationDuration=0),n=0;n=Qt())&&(p=0),a.currItem=Jt(p),(N.isOldIOSPhone||N.isOldAndroid)&&(ye=!1),e.setAttribute("aria-hidden","false"),s.modal&&(ye?e.style.position="fixed":(e.style.position="absolute",e.style.top=i.getScrollY()+"px")),void 0===z&&(De("initialLayout"),z=P=i.getScrollY());var d="pswp--open ";for(s.mainClass&&(d+=s.mainClass+" "),s.showHideOpacity&&(d+="pswp--animate_opacity "),d+=F?"pswp--touch":"pswp--notouch",d+=N.animationName?" pswp--css_animation":"",d+=N.svg?" pswp--svg":"",i.addClass(e,d),a.updateSize(),f=-1,xe=null,n=0;nne.min.x?e=ne.min.x:ene.min.y?t=ne.min.y:t=l&&(f+=xe+(xe>0?-l:l),n=l);for(var o=0;o0?(t=T.shift(),T[l-1]=t,f++,Re((f+2)*we.x,t.el.style),a.setContent(t,p-n+o+1+1)):(t=T.pop(),T.unshift(t),f--,Re(f*we.x,t.el.style),a.setContent(t,p+n-o-1-1));if(oe&&1===Math.abs(xe)){var i=Jt(_);i.initialZoomLevel!==w&&(ln(i,he),dn(i),Ae(i))}xe=0,a.updateCurrZoomItem(),_=p,De("afterChange")}}},updateSize:function(t){if(!ye&&s.modal){var n=i.getScrollY();if(z!==n&&(e.style.top=n+"px",z=n),!t&&Ce.x===window.innerWidth&&Ce.y===window.innerHeight)return;Ce.x=window.innerWidth,Ce.y=window.innerHeight,e.style.height=Ce.y+"px"}if(he.x=a.scrollWrap.clientWidth,he.y=a.scrollWrap.clientHeight,je(),we.x=he.x+Math.round(he.x*s.spacing),we.y=he.y,Le(we.x*ve),De("beforeResize"),void 0!==f){for(var o,r,u,c=0;c2&&(u=_e(u)),r=Jt(u),r&&(I||r.needsUpdate||!r.bounds)?(a.cleanSlide(r),a.setContent(o,u),1===c&&(a.currItem=r,a.updateCurrZoomItem(!0)),r.needsUpdate=!1):-1===o.index&&u>=0&&a.setContent(o,u),r&&r.container&&(ln(r,he),dn(r),Ae(r));I=!1}x=w=a.currItem.initialZoomLevel,ne=a.currItem.bounds,ne&&(fe.x=ne.center.x,fe.y=ne.center.y,Fe(!0)),De("resize")},zoomTo:function(e,t,n,o,a){t&&(x=w,xt.x=Math.abs(t.x)-fe.x,xt.y=Math.abs(t.y)-fe.y,Ze(me,fe));var r=We(e,!1),l={};Ge("x",r,l,e),Ge("y",r,l,e);var s=w,u={x:fe.x,y:fe.y};ze(l);var c=function(t){1===t?(w=e,fe.x=l.x,fe.y=l.y):(w=(e-s)*t+s,fe.x=(l.x-u.x)*t+u.x,fe.y=(l.y-u.y)*t+u.y),a&&a(t),Fe(1===t)};n?nt("customZoomTo",0,1,n,o||i.easing.sine.inOut,c):c(1)}},it=30,at=10,rt={},lt={},st={},ut={},ct={},dt=[],pt={},mt=[],ft={},ht=0,vt=de(),gt=0,wt=de(),xt=de(),yt=de(),bt=function(e,t){return e.x===t.x&&e.y===t.y},Ct=function(e,t){return Math.abs(e.x-t.x)-1)&&(t(e)?e:Et(e.parentNode,t))},Dt={},kt=function(e,t){return Dt.prevent=!Et(e.target,s.isClickableElement),De("preventDragEvent",e,t,Dt),Dt.prevent},Mt=function(e,t){return t.x=e.pageX,t.y=e.pageY,t.id=e.identifier,t},Ot=function(e,t,n){n.x=.5*(e.x+t.x),n.y=.5*(e.y+t.y)},Ft=function(e,t,n){if(e-H>50){var o=mt.length>2?mt.shift():{};o.x=t,o.y=n,mt.push(o),H=e}},At=function(){var e=fe.y-a.currItem.initialPosition.y;return 1-Math.abs(e/(he.y/2))},Rt={},Lt={},Pt=[],Zt=function(e){for(;Pt.length>0;)Pt.pop();return O?(ce=0,dt.forEach(function(e){0===ce?Pt[0]=e:1===ce&&(Pt[1]=e),ce++})):e.type.indexOf("touch")>-1?e.touches&&e.touches.length>0&&(Pt[0]=Mt(e.touches[0],Rt),e.touches.length>1&&(Pt[1]=Mt(e.touches[1],Lt))):(Rt.x=e.pageX,Rt.y=e.pageY,Rt.id="",Pt[0]=Rt),Pt},zt=function(e,t){var n,o,i,r,l=fe[e]+t[e],u=t[e]>0,c=wt.x+t.x,d=wt.x-pt.x;return n=l>ne.min[e]||lne.min[e]&&(n=s.panEndFriction,ne.min[e]-l,o=ne.min[e]-me[e]),(o<=0||d<0)&&Qt()>1?(r=c,d<0&&c>pt.x&&(r=pt.x)):ne.min.x!==ne.max.x&&(i=l)):(l0)&&Qt()>1?(r=c,d>0&&ca.currItem.fitRatio&&(fe[e]+=t[e]*n)):(void 0!==r&&(Le(r,!0),J=r!==pt.x),ne.min.x!==ne.max.x&&(void 0!==i?fe.x=i:J||(fe.x+=t.x*n)),void 0!==r)},Nt=function(e){if(!("mousedown"===e.type&&e.button>0)){if($t)return void e.preventDefault();if(!G||"mousedown"!==e.type){if(kt(e,!0)&&e.preventDefault(),De("pointerDown"),O){var t=i.arraySearch(dt,e.pointerId,"id");t<0&&(t=dt.length),dt[t]={x:e.pageX,y:e.pageY,id:e.pointerId}}var n=Zt(e),o=n.length;Q=null,tt(),Y&&1!==o||(Y=re=!0,i.bind(window,h,a),B=ue=le=q=J=j=V=X=!1,ae=null,De("firstTouchStart",n),Ze(me,fe),pe.x=pe.y=0,Ze(ut,n[0]),Ze(ct,ut),pt.x=we.x*ve,mt=[{x:ut.x,y:ut.y}],H=K=ke(),We(w,!0),Tt(),_t()),!ee&&o>1&&!ie&&!J&&(x=w,X=!1,ee=V=!0,pe.y=pe.x=0,Ze(me,fe),Ze(rt,n[0]),Ze(lt,n[1]),Ot(rt,lt,yt),xt.x=Math.abs(yt.x)-fe.x,xt.y=Math.abs(yt.y)-fe.y,te=It(rt,lt))}}},Ut=function(e){if(e.preventDefault(),O){var t=i.arraySearch(dt,e.pointerId,"id");if(t>-1){var n=dt[t];n.x=e.pageX,n.y=e.pageY}}if(Y){var o=Zt(e);if(ae||j||ee)Q=o;else if(wt.x!==we.x*ve)ae="h";else{var a=Math.abs(o[0].x-ut.x)-Math.abs(o[0].y-ut.y);Math.abs(a)>=at&&(ae=a>0?"h":"v",Q=o)}}},Kt=function(){if(Q){var e=Q.length;if(0!==e)if(Ze(rt,Q[0]),st.x=rt.x-ut.x,st.y=rt.y-ut.y,ee&&e>1){if(ut.x=rt.x,ut.y=rt.y,!st.x&&!st.y&&bt(Q[1],lt))return;Ze(lt,Q[1]),X||(X=!0,De("zoomGestureStarted"));var t=It(rt,lt),n=Gt(t);n>a.currItem.initialZoomLevel+a.currItem.initialZoomLevel/15&&(ue=!0);var o=1,i=Be(),r=qe();if(n1&&(o=1),n=i-o*(i/3);else n>r&&(o=(n-r)/(6*i),o>1&&(o=1),n=r+o*i);o<0&&(o=0),t,Ot(rt,lt,vt),pe.x+=vt.x-yt.x,pe.y+=vt.y-yt.y,Ze(yt,vt),fe.x=Pe("x",n),fe.y=Pe("y",n),B=n>w,w=n,Fe()}else{if(!ae)return;if(re&&(re=!1,Math.abs(st.x)>=at&&(st.x-=Q[0].x-ct.x),Math.abs(st.y)>=at&&(st.y-=Q[0].y-ct.y)),ut.x=rt.x,ut.y=rt.y,0===st.x&&0===st.y)return;if("v"===ae&&s.closeOnVerticalDrag&&!St()){pe.y+=st.y,fe.y+=st.y;var c=At();return q=!0,De("onVerticalDrag",c),Me(c),void Fe()}Ft(ke(),rt.x,rt.y),j=!0,ne=a.currItem.bounds;var d=zt("x",st);d||(zt("y",st),ze(fe),Fe())}}},Ht=function(e){if(N.isOldAndroid){if(G&&"mouseup"===e.type)return;e.type.indexOf("touch")>-1&&(clearTimeout(G),G=setTimeout(function(){G=0},600))}var t;if(De("pointerUp"),kt(e,!1)&&e.preventDefault(),O){var n=i.arraySearch(dt,e.pointerId,"id");if(n>-1)if(t=dt.splice(n,1)[0],navigator.msPointerEnabled){var o={4:"mouse",2:"touch",3:"pen"};t.type=o[e.pointerType],t.type||(t.type=e.pointerType||"mouse")}else t.type=e.pointerType||"mouse"}var r,l=Zt(e),u=l.length;if("mouseup"===e.type&&(u=0),2===u)return Q=null,!0;1===u&&Ze(ct,l[0]),0!==u||ae||ie||(t||("mouseup"===e.type?t={x:e.pageX,y:e.pageY,type:"mouse"}:e.changedTouches&&e.changedTouches[0]&&(t={x:e.changedTouches[0].pageX,y:e.changedTouches[0].pageY,type:"touch"})),De("touchRelease",e,t));var c=-1;if(0===u&&(Y=!1,i.unbind(window,h,a),Tt(),ee?c=0:-1!==gt&&(c=ke()-gt)),gt=1===u?ke():-1,r=-1!==c&&c<150?"zoom":"swipe",ee&&u<2&&(ee=!1,1===u&&(r="zoomPointerUp"),De("zoomGestureEnded")),Q=null,j||X||ie||q)if(tt(),W||(W=Wt()),W.calculateSwipeSpeed("x"),q){var d=At();if(da.currItem.fitRatio&&Bt(W))}},Wt=function(){var e,t,n={lastFlickOffset:{},lastFlickDist:{},lastFlickSpeed:{},slowDownRatio:{},slowDownRatioReverse:{},speedDecelerationRatio:{},speedDecelerationRatioAbs:{},distanceOffset:{},backAnimDestination:{},backAnimStarted:{},calculateSwipeSpeed:function(o){mt.length>1?(e=ke()-H+50,t=mt[mt.length-2][o]):(e=ke()-K,t=ct[o]),n.lastFlickOffset[o]=ut[o]-t,n.lastFlickDist[o]=Math.abs(n.lastFlickOffset[o]),n.lastFlickDist[o]>20?n.lastFlickSpeed[o]=n.lastFlickOffset[o]/e:n.lastFlickSpeed[o]=0,Math.abs(n.lastFlickSpeed[o])<.1&&(n.lastFlickSpeed[o]=0),n.slowDownRatio[o]=.95,n.slowDownRatioReverse[o]=1-n.slowDownRatio[o],n.speedDecelerationRatio[o]=1},calculateOverBoundsAnimOffset:function(e,t){n.backAnimStarted[e]||(fe[e]>ne.min[e]?n.backAnimDestination[e]=ne.min[e]:fe[e]it&&(u||t.lastFlickOffset.x>20)?o=-1:l<-it&&(u||t.lastFlickOffset.x<-20)&&(o=1)}o&&(p+=o,p<0?(p=s.loop?Qt()-1:0,r=!0):p>=Qt()&&(p=s.loop?0:Qt()-1,r=!0),r&&!s.loop||(xe+=o,ve-=o,n=!0));var c,d=we.x*ve,m=Math.abs(d-wt.x);return n||d>wt.x==t.lastFlickSpeed.x>0?(c=Math.abs(t.lastFlickSpeed.x)>0?m/Math.abs(t.lastFlickSpeed.x):333,c=Math.min(c,400),c=Math.max(c,250)):c=333,ht===p&&(n=!1),ie=!0,De("mainScrollAnimStart"),nt("mainScroll",wt.x,d,c,i.easing.cubic.out,Le,function(){tt(),ie=!1,ht=-1,(n||ht!==p)&&a.updateCurrItem(),De("mainScrollAnimComplete")}),n&&a.updateCurrItem(!0),n},Gt=function(e){return 1/te*e*x},Yt=function(){var e=w,t=Be(),n=qe();wn&&(e=n);var o,r=1,l=se;return le&&!B&&!ue&&w1||navigator.msMaxTouchPoints>1),a.likelyTouchDevice=F,g[S]=Nt,g[E]=Ut,g[D]=Ht,k&&(g[k]=g[D]),N.touch&&(v+=" mousedown",h+=" mousemove mouseup",g.mousedown=g[S],g.mousemove=g[E],g.mouseup=g[D]),F||(s.allowPanToNext=!1)}}});var Vt,Xt,jt,$t,Jt,Qt,en=function(t,n,o,r){var l;Vt&&clearTimeout(Vt),$t=!0,jt=!0,t.initialLayout?(l=t.initialLayout,t.initialLayout=null):l=s.getThumbBoundsFn&&s.getThumbBoundsFn(p);var u=o?s.hideAnimationDuration:s.showAnimationDuration,c=function(){Qe("initialZoom"),o?(a.template.removeAttribute("style"),a.bg.removeAttribute("style")):(Me(1),n&&(n.style.display="block"),i.addClass(e,"pswp--animated-in"),De("initialZoom"+(o?"OutEnd":"InEnd"))),r&&r(),$t=!1};if(!u||!l||void 0===l.x)return De("initialZoom"+(o?"Out":"In")),w=t.initialZoomLevel,Ze(fe,t.initialPosition),Fe(),e.style.opacity=o?0:1,Me(1),void(u?setTimeout(function(){c()},u):c());var m=function(){var n=d,r=!a.currItem.src||a.currItem.loadError||s.showHideOpacity;t.miniImg&&(t.miniImg.style.webkitBackfaceVisibility="hidden"),o||(w=l.w/t.w,fe.x=l.x,fe.y=l.y-P,a[r?"template":"bg"].style.opacity=.001,Fe()),et("initialZoom"),o&&!n&&i.removeClass(e,"pswp--animated-in"),r&&(o?i[(n?"remove":"add")+"Class"](e,"pswp--animate_opacity"):setTimeout(function(){i.addClass(e,"pswp--animate_opacity")},30)),Vt=setTimeout(function(){if(De("initialZoom"+(o?"Out":"In")),o){var a=l.w/t.w,s={x:fe.x,y:fe.y},d=w,p=se,m=function(t){1===t?(w=a,fe.x=l.x,fe.y=l.y-z):(w=(a-d)*t+d,fe.x=(l.x-s.x)*t+s.x,fe.y=(l.y-z-s.y)*t+s.y),Fe(),r?e.style.opacity=1-t:Me(p-t*p)};n?nt("initialZoom",0,1,u,i.easing.cubic.out,m,c):(m(1),Vt=setTimeout(c,u+20))}else w=t.initialZoomLevel,Ze(fe,t.initialPosition),Fe(),Me(1),r?e.style.opacity=1:Me(1),Vt=setTimeout(c,u+20)},o?25:90)};m()},tn={},nn=[],on={index:0,errorMsg:'
The image could not be loaded.
',forceProgressiveLoading:!1,preload:[1,1],getNumItemsFn:function(){return Xt.length}},an=function(){return{center:{x:0,y:0},max:{x:0,y:0},min:{x:0,y:0}}},rn=function(e,t,n){var o=e.bounds;o.center.x=Math.round((tn.x-t)/2),o.center.y=Math.round((tn.y-n)/2)+e.vGap.top,o.max.x=t>tn.x?Math.round(tn.x-t):o.center.x,o.max.y=n>tn.y?Math.round(tn.y-n)+e.vGap.top:o.center.y,o.min.x=t>tn.x?0:o.center.x,o.min.y=n>tn.y?e.vGap.top:o.center.y},ln=function(e,t,n){if(e.src&&!e.loadError){var o=!n;if(o&&(e.vGap||(e.vGap={top:0,bottom:0}),De("parseVerticalMargin",e)),tn.x=t.x,tn.y=t.y-e.vGap.top-e.vGap.bottom,o){var i=tn.x/e.w,a=tn.y/e.h;e.fitRatio=i1&&(n=1),e.initialZoomLevel=n,e.bounds||(e.bounds=an())}if(!n)return;return rn(e,e.w*n,e.h*n),o&&n===e.initialZoomLevel&&(e.initialPosition=e.bounds.center),e.bounds}return e.w=e.h=0,e.initialZoomLevel=e.fitRatio=1,e.bounds=an(),e.initialPosition=e.bounds.center,e.bounds},sn=function(e,t,n,o,i,r){t.loadError||o&&(t.imageAppended=!0,dn(t,o,t===a.currItem&&Ie),n.appendChild(o),r&&setTimeout(function(){t&&t.loaded&&t.placeholder&&(t.placeholder.style.display="none",t.placeholder=null)},500))},un=function(e){e.loading=!0,e.loaded=!1;var t=e.img=i.createEl("pswp__img","img"),n=function(){e.loading=!1,e.loaded=!0,e.loadComplete?e.loadComplete(e):e.img=null,t.onload=t.onerror=null,t=null};return t.onload=n,t.onerror=function(){e.loadError=!0,n()},t.src=e.src,t},cn=function(e,t){if(e.src&&e.loadError&&e.container)return t&&(e.container.innerHTML=""),e.container.innerHTML=s.errorMsg.replace("%url%",e.src),!0},dn=function(e,t,n){if(e.src){t||(t=e.container.lastChild);var o=n?e.w:Math.round(e.w*e.fitRatio),i=n?e.h:Math.round(e.h*e.fitRatio);e.placeholder&&!e.loaded&&(e.placeholder.style.width=o+"px",e.placeholder.style.height=i+"px"),t.style.width=o+"px",t.style.height=i+"px"}},pn=function(){if(nn.length){for(var e,t=0;t=0,i=Math.min(n[0],Qt()),r=Math.min(n[1],Qt());for(t=1;t<=(o?r:i);t++)a.lazyLoadItem(p+t);for(t=1;t<=(o?i:r);t++)a.lazyLoadItem(p-t)}),Ee("initialLayout",function(){a.currItem.initialLayout=s.getThumbBoundsFn&&s.getThumbBoundsFn(p)}),Ee("mainScrollAnimComplete",pn),Ee("initialZoomInEnd",pn),Ee("destroy",function(){for(var e,t=0;t=0&&void 0!==Xt[e]&&Xt[e]},allowProgressiveImg:function(){return s.forceProgressiveLoading||!F||s.mouseUsed||screen.width>1200},setContent:function(e,t){s.loop&&(t=_e(t));var n=a.getItemAt(e.index);n&&(n.container=null);var o,r=a.getItemAt(t);if(r){De("gettingData",t,r),e.index=t,e.item=r;var l=r.container=i.createEl("pswp__zoom-wrap");if(!r.src&&r.html&&(r.html.tagName?l.appendChild(r.html):l.innerHTML=r.html),cn(r),ln(r,he),!r.src||r.loadError||r.loaded)r.src&&!r.loadError&&(o=i.createEl("pswp__img","img"),o.style.opacity=1,o.src=r.src,dn(r,o),sn(t,r,l,o,!0));else{if(r.loadComplete=function(n){if(u){if(e&&e.index===t){if(cn(n,!0))return n.loadComplete=n.img=null,ln(n,he),Ae(n),void(e.index===p&&a.updateCurrZoomItem());n.imageAppended?!$t&&n.placeholder&&(n.placeholder.style.display="none",n.placeholder=null):N.transform&&(ie||$t)?nn.push({item:n,baseDiv:l,img:n.img,index:t,holder:e,clearPlaceholder:!0}):sn(t,n,l,n.img,ie||$t,!0)}n.loadComplete=null,n.img=null,De("imageLoadComplete",t,n)}},i.features.transform){var c="pswp__img pswp__img--placeholder";c+=r.msrc?"":" pswp__img--placeholder--blank";var d=i.createEl(c,r.msrc?"img":"");r.msrc&&(d.src=r.msrc),dn(r,d),l.appendChild(d),r.placeholder=d}r.loading||un(r),a.allowProgressiveImg()&&(!jt&&N.transform?nn.push({item:r,baseDiv:l,img:r.img,index:t,holder:e}):sn(t,r,l,r.img,!0,!0))}jt||t!==p?Ae(r):(oe=l.style,en(r,o||r.img)),e.el.innerHTML="",e.el.appendChild(l)}else e.el.innerHTML=""},cleanSlide:function(e){e.img&&(e.img.onload=e.img.onerror=null),e.loaded=e.loading=e.img=e.imageAppended=!1}}});var mn,fn,hn={},vn=function(e,t,n){var o=document.createEvent("CustomEvent"),i={origEvent:e,target:e.target,releasePoint:t,pointerType:n||"touch"};o.initCustomEvent("pswpTap",!0,!0,i),e.target.dispatchEvent(o)};Te("Tap",{publicMethods:{initTap:function(){Ee("firstTouchStart",a.onTapStart),Ee("touchRelease",a.onTapRelease),Ee("destroy",function(){hn={},mn=null})},onTapStart:function(e){e.length>1&&(clearTimeout(mn),mn=null)},onTapRelease:function(e,t){if(t&&!j&&!V&&!Je){var n=t;if(mn&&(clearTimeout(mn),mn=null,Ct(n,hn)))return void De("doubleTap",n);if("mouse"===t.type)return void vn(e,t,"mouse");var o=e.target.tagName.toUpperCase();if("BUTTON"===o||i.hasClass(e.target,"pswp__single-tap"))return void vn(e,t);Ze(hn,n),mn=setTimeout(function(){vn(e,t),mn=null},300)}}}}),Te("DesktopZoom",{publicMethods:{initDesktopZoom:function(){Z||(F?Ee("mouseUsed",function(){a.setupDesktopZoom()}):a.setupDesktopZoom(!0))},setupDesktopZoom:function(t){fn={};var n="wheel mousewheel DOMMouseScroll";Ee("bindEvents",function(){i.bind(e,n,a.handleMouseWheel)}),Ee("unbindEvents",function(){fn&&i.unbind(e,n,a.handleMouseWheel)}),a.mouseZoomedIn=!1;var o,r=function(){a.mouseZoomedIn&&(i.removeClass(e,"pswp--zoomed-in"),a.mouseZoomedIn=!1),w<1?i.addClass(e,"pswp--zoom-allowed"):i.removeClass(e,"pswp--zoom-allowed"),l()},l=function(){o&&(i.removeClass(e,"pswp--dragging"),o=!1)};Ee("resize",r),Ee("afterChange",r),Ee("pointerDown",function(){a.mouseZoomedIn&&(o=!0,i.addClass(e,"pswp--dragging"))}),Ee("pointerUp",l),t||r()},handleMouseWheel:function(e){if(w<=a.currItem.fitRatio)return s.modal&&(!s.closeOnScroll||Je||Y?e.preventDefault():M&&Math.abs(e.deltaY)>2&&(d=!0,a.close())),!0;if(e.stopPropagation(),fn.x=0,"deltaX"in e)1===e.deltaMode?(fn.x=18*e.deltaX,fn.y=18*e.deltaY):(fn.x=e.deltaX,fn.y=e.deltaY);else if("wheelDelta"in e)e.wheelDeltaX&&(fn.x=-.16*e.wheelDeltaX),e.wheelDeltaY?fn.y=-.16*e.wheelDeltaY:fn.y=-.16*e.wheelDelta;else{if(!("detail"in e))return;fn.y=e.detail}We(w,!0);var t=fe.x-fn.x,n=fe.y-fn.y;(s.modal||t<=ne.min.x&&t>=ne.max.x&&n<=ne.min.y&&n>=ne.max.y)&&e.preventDefault(),a.panTo(t,n)},toggleDesktopZoom:function(t){t=t||{x:he.x/2+ge.x,y:he.y/2+ge.y};var n=s.getDoubleTapZoom(!0,a.currItem),o=w===n;a.mouseZoomedIn=!o,a.zoomTo(o?a.currItem.initialZoomLevel:n,t,333),i[(o?"remove":"add")+"Class"](e,"pswp--zoomed-in")}}});var gn,wn,xn,yn,bn,Cn,In,Tn,_n,Sn={history:!0,galleryUID:1},En=function(){return Tn.hash.substring(1)},Dn=function(){gn&&clearTimeout(gn),wn&&clearTimeout(wn)},kn=function(){var e=En(),t={};if(e.length<5)return t;var n,o=e.split("&");for(n=0;n-1&&(bn=bn.substring(0,t),"&"===bn.slice(-1)&&(bn=bn.slice(0,-1))),setTimeout(function(){u&&i.bind(window,"hashchange",a.onHashChange)},40)}},onHashChange:function(){return En()===bn?(Cn=!0,void a.close()):void(xn||(!0,a.goTo(kn().pid),!1))},updateURL:function(){Dn()}}}),i.extend(a,ot)},n),i=function(){var e=function(e,t){var n,o,i,a,r,l,s,u,c,d,p,m,f,h,v,g,w,x,y=this,b=!1,C=!0,I=!0,T={barsSize:{top:44,bottom:"auto"},closeElClasses:["item","caption","zoom-wrap","ui","top-bar"],timeToIdle:4e3,timeToIdleOutside:1e3,loadingIndicatorDelay:1e3,addCaptionHTMLFn:function(e,t){return e.title?(t.children[0].innerHTML=e.title,!0):(t.children[0].innerHTML="",!1)},closeEl:!0,captionEl:!0,fullscreenEl:!0,zoomEl:!0,shareEl:!0,counterEl:!0,arrowEl:!0,preloaderEl:!0,tapToClose:!1,tapToToggleControls:!0,clickToCloseNonZoomable:!0,shareButtons:[{id:"facebook",label:"Share on Facebook",url:"https://www.facebook.com/sharer/sharer.php?u={{url}}"},{id:"twitter",label:"Tweet",url:"https://twitter.com/intent/tweet?text={{text}}&url={{url}}"},{ id:"pinterest",label:"Pin it",url:"http://www.pinterest.com/pin/create/button/?url={{url}}&media={{image_url}}&description={{text}}"},{id:"download",label:"Download image",url:"{{raw_image_url}}",download:!0}],getImageURLForShare:function(){return e.currItem.src||""},getPageURLForShare:function(){return window.location.href},getTextForShare:function(){return e.currItem.title||""},indexIndicatorSep:" / ",fitControlsWidth:1200},_=function(e){if(g)return!0;e=e||window.event,v.timeToIdle&&v.mouseUsed&&!c&&L();for(var n,o,i=e.target||e.srcElement,a=i.getAttribute("class")||"",r=0;r-1&&(n.onTap(),o=!0);if(o){e.stopPropagation&&e.stopPropagation(),g=!0;var l=t.features.isOldAndroid?600:30;setTimeout(function(){g=!1},l)}},S=function(){return!e.likelyTouchDevice||v.mouseUsed||screen.width>v.fitControlsWidth},E=function(e,n,o){t[(o?"add":"remove")+"Class"](e,"pswp__"+n)},D=function(){var e=1===v.getNumItemsFn();e!==h&&(E(o,"ui--one-slide",e),h=e)},k=function(){E(s,"share-modal--hidden",I)},M=function(){return I=!I,I?(t.removeClass(s,"pswp__share-modal--fade-in"),setTimeout(function(){I&&k()},300)):(k(),setTimeout(function(){I||t.addClass(s,"pswp__share-modal--fade-in")},30)),I||F(),!1},O=function(t){t=t||window.event;var n=t.target||t.srcElement;return e.shout("shareLinkClick",t,n),!(!n.href||!n.hasAttribute("download")&&(window.open(n.href,"pswp_share","scrollbars=yes,resizable=yes,toolbar=no,location=yes,width=550,height=420,top=100,left="+(window.screen?Math.round(screen.width/2-275):100)),I||M(),1))},F=function(){for(var e,t,n,o,i,a="",r=0;r