YUI.add("dropdown",function(e){"use strict";var t,n;t={css:{closed:"ui-dropdown-closed",shim:"ui-dropdown-shim",label:'span[data-action="toggle"]',items:"[data-value]",itemSelected:"ui-dropdown-item-selected",hasDialogArrow:"ui-dropdown-has-dialog-arrow",dialogArrow:"ui-dialog-arrow",useCheckMarks:"ui-dropdown-use-checkboxes"},options:{hasDialogArrow:!1,useCheckMarks:!1}},e.namespace("Views").Dropdown=n=e.Base.create("Dropdown",e.FlickrView,[],{initializer:function(e){if(e.activate===!1)return;this.activate()},activate:function(){var n=this,r=this.get("container"),i;this.close(),this._items={},e.Lang.isArray(this.get("selected"))||this.set("selected",[this.get("selected")]),r.all(t.css.items).each(function(e){var t=e.getData();n._items[t.value]={text:t.text||'no data-text for "'+t.value+'"',sub:t.sub,node:e}}),this.labelEl=r.one(t.css.label),this.labelEl||(this.labelEl=e.Node.create('<span class="truncate" data-action="toggle" />'),r.insert(this.labelEl,0)),i=this.get("staticLabel")||this.get("defaultLabel"),i&&(i===!0?this.labelEl.set("text","set staticLabel/defaultLabel to a string, not `true`"):this.labelEl.set("text",i)),this.get("hasDialogArrow")&&!r.hasClass(t.css.hasDialogArrow)&&r.addClass(t.css.hasDialogArrow),r.hasClass(t.css.hasDialogArrow)&&(this.dialogArrowEl=r.one(t.css.dialogArrow),this.dialogArrowEl||(this.dialogArrowEl=e.Node.create('<span class="ui-dialog-arrow" />'),r.insert(this.dialogArrowEl,1))),this.get("useCheckMarks")&&!r.hasClass(t.css.useCheckMarks)&&r.addClass(t.css.useCheckMarks),this.select();if(this.get("disabled"))return this.disable();this.attachEvents({":toggle":this.toggle.bind(this),":set":function(t,r){t.halt();if(!n.get("multiSelect")&&!n.get("multiSelectSub")&&e.Array.indexOf(n.get("selected"),r.value)>=0)return n.close();n.select(r.value,r)}})},select:function(n,r,i){var s=this,o=n?this._items[n]:null,u=!0,a=[],f;o&&e.Array.indexOf(this.get("selected"),n)>=0&&(this.get("multiSelect")||this.get("multiSelectSub"))?(a=this.get("selected"),!o.sub&&this.get("multiSelect")&&a.length>this.get("minimumSelected")?(a.splice(e.Array.indexOf(this.get("selected"),n),1),u=!1):o.sub&&(a.splice(e.Array.indexOf(this.get("selected"),n),1),u=!1),this.set("selected",a)):o&&(o.sub?(a.push(n),this.get("selectParent")&&a.push(o.sub),e.Array.each(this.get("selected"),function(e){s._items[e].sub===o.sub?a.push(e):s.get("multiSelect")&&!s._items[e].sub&&a.push(e)})):this.get("multiSelect")?(a=this.get("selected"),a.push(n)):a.push(n),this.set("selected",a)),i||this.close(),f={clicked:o?{text:o.text,value:n,sub:o.sub,itemEl:o.node,isChecked:u}:null,data:r,selections:a},this.fire("selected",f),this.update(n,f,t)},update:function(t,n,r){var i=this,s=n.clicked,o=this.get("selected"),u=this.get("defaultLabel")||"[Unable to select a default item]";this.get("staticLabel")||(this.get("labelFunction")?u=this.get("labelFunction").apply(this,[t]):s?n.data&&n.data.text&&n.data.text!==s.text?u=n.data.text:u=s.text:o.length>0&&i._items[o[0]]&&(u=i._items[o[0]].text),this.labelEl.set("textContent",u||"[!empty data-text!]")),this.get("container").all(r.css.items).removeClass(r.css.itemSelected),e.Array.each(o,function(e){i._items[e]&&i._items[e].node.addClass(r.css.itemSelected)})},toggle:function(e){e&&e.halt(),this._open?this.close(e):this.open(e)},open:function(e){var n=this.get("container"),r=0,i=0,s=30;this._open=!0,this.get("shouldCreateShim")&&this._shimUp(),n.removeClass(t.css.closed),this.get("autoSizeMenu")&&(r=parseInt(this.labelEl.getComputedStyle("width"),10),i=parseInt(n.one("ul").getComputedStyle("width"),10),r+s>i&&n.one("ul").setStyles({width:r+s})),(!e||!e.silent)&&this.fire("open",e)},close:function(e){e&&e.halt(),this._open=!1,this._shimUp(!1),this.fire("close",e),this.get("container").addClass(t.css.closed)},_shimUp:function(n){if(n===!1){if(!this._shim)return;this._shim.detach("click").remove(),this._shim=null;return}this._shim=e.Node.create("<div />"),this._shim.addClass(t.css.shim),this._shim.on("click",this.close.bind(this)),this.get("container").appendChild(this._shim)},disable:function(){var e=this.get("container");this.set("disabled",!0),this.close(),e.addClass(t.css.disabled),e.detach()},destructor:function(){this._shimUp(!1),this._items=null,this.labelEl=null,this.set("selected",null),this.detachAll()}},{ATTRS:{selected:{value:[]},disabled:{value:!1},hasDialogArrow:{value:!1},useCheckMarks:{value:!1},multiSelect:{value:!1},multiSelectSub:{value:!1},selectParent:{value:!0},minimumSelected:{value:0},staticLabel:{value:!1},defaultLabel:{value:!1},labelFunction:function(){},shouldCreateShim:{value:!0},autoSizeMenu:{value:!0}}})},"@VERSION@",{requires:["flickr-view","flickrui-css"]});
YUI.add("footer-full-view",function(e){var t=["en-US","zh-HK","de-DE","es-US","fr-FR","ko-KR","it-IT","pt-BR","vn-VN","id-ID"],n={"en-US":"English","de-DE":"Deutsch","es-US":"Espa\u00f1ol","fr-FR":"Fran\u00e7ais","ko-KR":"\ud55c\uae00","it-IT":"Italiano","pt-BR":"Portugu\u00eas","vn-VN":"Ti\u1ebfng Vi\u1ec7t","id-ID":"Bahasa Indonesia","zh-HK":"\u7e41\u9ad4\u4e2d\u6587"};e.FlickrView.create(this.name,e.FlickrView,[],{langBundles:this.details.langBundles,initializer:function(e){return this.get("container").get("innerHTML")===""&&this.setContainerHTML('<div class="footer-full-content"></div>'),this.appStateParams=e,this.set("hideOptOutBanner",e.hideOptOutBanner),this.set("showOptOutBanner",e.showOptOutBanner),this.set("hideMobileBanner",e.hideMobileBanner),this},subviewConfig:{},loadState:function(){var r,i,s;s=this.appContext.auth&&this.appContext.auth.csrf?this.appContext.auth.csrf:"",this.lang=this.appContext.lang,this.menuLangs=[],this.lang==="zh-Hant-HK"&&(this.lang="zh-HK"),this.lang.toLowerCase()==="vi-vn"&&(this.lang="vn-VN"),this.selectedLang={code:this.lang,name:n[this.lang],csrf:s};for(r=0,i=t.length;r<i;r++){if(t[r]===this.lang)continue;typeof t[r]=="string"&&this.menuLangs.push({code:t[r].toLowerCase(),name:n[t[r]],csrf:s})}return e.Promise.resolve()},buildContainer:function(){var t={},n={};return this.get("viewer")&&(t=e.merge(this.get("viewer").toJSON(),{urls:e.URLHelper.generatePersonUrls(this.get("viewer"))})),n={displayLangs:this.displayLangs,selectedLang:this.selectedLang,helpLocaleKey:this.selectedLang.code.replace("-","_")||"en_US",menuLangs:this.menuLangs},YUI.Env.isServer?n.pageUrl=this.appContext.request.url:n.pageUrl=window.location.pathname,this.appContext.getCookie("mobile_allow_www")&&!this.appStateParams.hideMobileBanner?n.isOptedOutOfMobile=!this.get("hideMobileBanner"):!this.appContext.getCookie("mobile_allow_www")&&this.get("hideMobileBanner")&&(n.hasNoOptOut=!0),this.setContainerWithTemplate("footer-full",n),this},activate:function(){var t=this.get("container"),n=t.one(".lang-switcher"),r=n.one("a"),i=t.one(".foot-mobile-banner a"),s=t.one(".opt-out-www");return this.menuLangsFormatted=this.menuLangs.map(function(e){return{href:"/change_language.gne?lang="+e.code+"&csrf="+e.csrf,text:e.name}}),this.registerEventHandler(n.on("click",function(t){t.preventDefault(),r.addClass("dimmed");var i=new e.Views.FluidDroparound({anchorOffsetHorizontal:15,appContext:this.appContext,showDropArrow:!0,observePageResize:!0,dismissOnOverlayClick:!0,anchorElement:n.one(".arrow"),classList:["lang-droparound"],menuItems:this.menuLangsFormatted});i.show(),this.registerEventHandler(i.on("closeDroparound",function(e){r.removeClass("dimmed")}),this)},this)),i&&this.registerEventHandler(i.on("click",function(e){this.appContext.removeCookie({cookieName:"mobile_allow_www",path:"/"})},this)),s&&this.registerEventHandler(s.on("click",function(e){this.appContext.setCookie({cookieName:"mobile_allow_www",path:"/",cookieValue:1})},this)),this}})},"@VERSION@",{requires:["flickr-view","hermes-template-footer-full","footer-full-css","url-helper","flickrui-css","flickrui-dialogs-css","dropdown","fluid-droparound-view"],langBundles:["common"]});
YUI.add("hermes-template-mobile-photo-well",function(e,t){var n=e.Template.Handlebars.revive({1:function(e,t,n,r,i){var s,o,u=t!=null?t:{},a=n.helperMissing,f="function",l=e.escapeExpression;return' <a class="main-image-wrapper" href="'+l((o=(o=n.videoURL||(t!=null?t.videoURL:t))!=null?o:a,typeof o===f?o.call(u,{name:"videoURL",hash:{},data:i}):o))+'" '+((s=n["if"].call(u,t!=null?t.isServer:t,{name:"if",hash:{},fn:e.program(2,i,0),inverse:e.noop,data:i}))!=null?s:"")+'>\n <div class="play-wrapper">\n <svg class="icon icon-play"><use xlink:href="#icon-play"></use></svg>\n </div>\n\n <img class="main-image" style="'+((s=n["if"].call(u,t!=null?t.isServer:t,{name:"if",hash:{},fn:e.program(4,i,0),inverse:e.noop,data:i}))!=null?s:"")+" max-width: 100%; max-height: "+l((o=(o=n.maxHeight||(t!=null?t.maxHeight:t))!=null?o:a,typeof o===f?o.call(u,{name:"maxHeight",hash:{},data:i}):o))+'px;" src="'+l((o=(o=n.url||(t!=null?t.url:t))!=null?o:a,typeof o===f?o.call(u,{name:"url",hash:{},data:i}):o))+'" onload="registerFirstPhoto(this)" />\n </a>\n'},2:function(e,t,n,r,i){var s;return' style="max-height: '+e.escapeExpression((s=(s=n.loadHeight||(t!=null?t.loadHeight:t))!=null?s:n.helperMissing,typeof s=="function"?s.call(t!=null?t:{},{name:"loadHeight",hash:{},data:i}):s))+'px;"'},4:function(e,t,n,r,i){return"width: 100%; "},6:function(e,t,n,r,i){var s,o,u=t!=null?t:{},a=n.helperMissing,f="function",l=e.escapeExpression;return' <div class="main-image-wrapper" '+((s=n["if"].call(u,t!=null?t.isServer:t,{name:"if",hash:{},fn:e.program(7,i,0),inverse:e.noop,data:i}))!=null?s:"")+'>\n <img class="main-image img" style="'+((s=n["if"].call(u,t!=null?t.isServer:t,{name:"if",hash:{},fn:e.program(4,i,0),inverse:e.noop,data:i}))!=null?s:"")+' max-width: 100%;" src="'+l((o=(o=n.url||(t!=null?t.url:t))!=null?o:a,typeof o===f?o.call(u,{name:"url",hash:{},data:i}):o))+'" onload="registerFirstPhoto(this)"/>\n </div>\n <div class="main-image-wrapper-underlay"></div>\n <script>\n var windowWidth = window.innerWidth;\n var aspect = '+l((o=(o=n.loadAspect||(t!=null?t.loadAspect:t))!=null?o:a,typeof o===f?o.call(u,{name:"loadAspect",hash:{},data:i}):o))+";\n\n if (aspect) {\n document.getElementsByClassName('main-image')[0].style.height = (windowWidth * aspect) + 'px';\n }\n </script>\n"},7:function(e,t,n,r,i){var s;return'style="max-height: '+e.escapeExpression((s=(s=n.loadHeight||(t!=null?t.loadHeight:t))!=null?s:n.helperMissing,typeof s=="function"?s.call(t!=null?t:{},{name:"loadHeight",hash:{},data:i}):s))+'px;"'},compiler:[7,">= 4.0.0"],main:function(e,t,n,r,i){var s;return'\n<a class="loading hide-nav-link prev-photo photo-link" href="#">\n <div class="arrow-overlay arrow-left">\n <svg class="tiny icon icon-nav_left prev-photo-icon"><use xlink:href="#icon-nav_left"></use></svg>\n </div>\n</a>\n\n'+((s=n["if"].call(t!=null?t:{},t!=null?t.isVideo:t,{name:"if",hash:{},fn:e.program(1,i,0),inverse:e.program(6,i,0),data:i}))!=null?s:"")+'\n\n<a class="loading hide-nav-link next-photo photo-link" href="#">\n <div class="arrow-overlay arrow-right">\n <svg class="tiny icon icon-nav_right next-photo-icon"><use xlink:href="#icon-nav_right"></use></svg>\n </div>\n</a>\n'},useData:!0}),r={};e.Array.each([],function(t){var n=e.Template.get("hermes/"+t);n&&(r[t]=n)}),e.Template.register("hermes/mobile-photo-well",function(t,i){return i=i||{},i.partials=i.partials?e.merge(r,i.partials):r,n(t,i)})},"@VERSION@",{requires:["template-base","handlebars-base"]});
YUI.add("matrix-math",function(e){e.MatrixMath={iterate:function(t,n,r,i){var s=[],o=t.length,u=t[0].length,a,f;for(a=0;a<o;a++){s[a]=[];if(u)for(f=0;f<u;f++)e.Lang.isArray(n)?s[a][f]=r.call(i,t[a][f],n[a][f]):s[a][f]=r.call(i,t[a][f],n);else e.Lang.isArray(n)?s[a]=r.call(i,t[a],n[a]):s[a]=r.call(i,t[a],n)}return s},add:function(e,t){return this.iterate(e,t,function(e,t){return e+t},this)},subtract:function(e,t){return this.iterate(e,t,function(e,t){return e-t},this)},divide:function(e,t){return this.iterate(e,t,function(e,t){return e/t})},multiply:function(e,t){return this.iterate(e,t,function(e,t){return e*t})},realMultiply:function(e,t){var n=[],r=e.length,i=e[0].length,s,o,u;for(s=0;s<r;s++){n[s]=[];for(o=0;o<i;o++)for(u=0;u<i;u++)n[s][o]+=e[s][u]*t[s][o]}return n},equality:function(e,t){var n=!0;if(e.length!==t.length)return!1;try{this.iterate(e,t,function(e,t){if(e!==t)return n=!1,0})}catch(r){n=!1}return n}}},"@VERSION@",{requires:[],optional:[]});
YUI.add("mrpinchy",function(e){function r(e){var t=e.length,n=0,r=0,i=0;for(i=0;i<t;i++)r+=e[i].pageY,n+=e[i].pageX;return[n/t,r/t]}function i(i){function _(t){E++,T&&T.cancel(),Date.now()-x>180?(E=1,T=e.later(200,this,function(){L.fire("mrpinchy:singletap",t)})):E===2&&(D(),E=0,L.fire("mrpinchy:doubletap"),L.fire("mrpinchy:reset")),x=Date.now()}function D(){s&&(s.setStyles({"-webkit-transition":"-webkit-"+O,"-moz-transition":"-moz-"+O,"-o-transition":"-o-"+O,"-ms-transition":"-ms-"+O,transition:O}),V([[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,1,1]],!0),s.setStyle("transform",M)),y=1,d=1}function H(e,t){var n=X(),r;t?r=e:r=y*e,n[0][0]=r,n[1][1]=r,V(n,!0),d=r}function B(e,t,r){var i,s,a,f,l,p,v,m=y*e;i=R(),s=[t[0]-i[0],t[1]-i[1]],a=[c,h],f=n.multiply(a,d),l=n.multiply(a,m),p=n.subtract(l,f),v=n.multiply(n.divide(s,l),p),U([v[0],-v[1]],!0),H(e);if(m>o&&!C||m<u&&!C)C={scale:e,translate:[X()[3][0],X()[3][1]]}}function j(e){if(e.touches&&e.touches.length>1){var t=Math.abs(e.touches[0].pageX-e.touches[1].pageX),n=Math.abs(e.touches[0].pageY-e.touches[1].pageY),r=Math.sqrt(t*t+n*n)/S;return r}return 1}function F(e){if(e.touches.length===2){m||L.fire("mrpinchy:startpinch"),m=1;var t=e.scale;t||(t=j(e)),B(t,r(e.touches))}}function I(e){var t,r,i,s,o,u={top:0,right:0,bottom:0,left:0},a={top:0,right:0,bottom:0,left:0};if(!v)return;var f=g[0]-v[0],l=g[1]-v[1];N&&(t=R(),i=[c,h],r=n.multiply(i,d),s=n.add(t,r),o=n.divide(r,2),o=n.add(o,t),t[1]<N[0][1]&&(a.top=1),t[0]<N[0][0]&&(a.left=1),s[0]>N[1][0]&&(a.right=1),s[1]>N[1][1]&&(a.bottom=1));var m=X();if(a.left||a.right||!N){var y=parseInt(m[3][0],10)+Math.round(f);y&&(m[3][0]=y)}if(a.bottom||a.top||!N)m[3][1]=parseInt(m[3][1],10)+Math.round(l);V(m),v=g,k=null,t[1]>N[0][1]&&a.bottom&&(u.bottom=1),s[1]<N[1][1]&&a.top&&(u.top=1),t[0]>N[0][0]&&a.right&&(u.right=1),s[0]<N[1][0]&&a.left&&(u.left=1),u.bottom&&u.right?k=n.subtract(N[0],p):u.bottom&&u.left?k=n.subtract([N[1][0],N[0][1]],[Math.round((p[0]+c)*d),p[1]]):u.top&&u.right?k=[N[0][0]-p[0],N[1][1]-(p[1]+r[1])]:u.top&&u.left?k=[N[1][0]-(p[0]+r[0]),N[1][1]-(p[1]+r[1])]:u.right?k=[N[0][0]-p[0],parseInt(m[3][1],10)+Math.round(l)]:u.left?k=[Math.round(N[1][0]-p[0]-r[0]),parseInt(m[3][1],10)+Math.round(l)]:u.bottom?k=[parseInt(m[3][0],10)+Math.round(f),Math.round(N[0][1]-p[1])]:u.top&&(k=[parseInt(m[3][0],10)+Math.round(f),N[1][1]-(p[1]+r[1])])}function q(e){w||(e.preventDefault(),P[e.type](e))}function R(){return s.getXY()}function U(e,t){var n=X();t?(n[3][0]-=e[0],n[3][1]+=e[1]):(n[3][0]=e[0],n[3][1]=e[1]),V(n)}function z(){var e=X(),t=[];t.push([e[0][0],e[0][1]]),t.push([e[1][0],e[1][1]]),t.push([e[3][0],e[3][1]]),s&&s.setStyle("transform","matrix( "+t.join(",")+")")}function W(){var e=X();V(e)}function X(){var e,n=[],r=[],i;if(a)return a;i=s.getStyle("transform");if(!i.match(t))return V([[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,1,1]],!0),a;e=i.match(t)[1],r=e.replace(/\s/g,"").split(",");var o=0,u;for(var f=0;f<4;f++){u=[];for(var l=0;l<4;l++)u.push(r[o++]);n.push(u)}return a=n,n}function V(e,t){if(!e)return;if(e.length!==4)return;a=e,t&&$()}function $(){var e=a;e&&s&&s.setStyle("transform","matrix3d("+e.join(",")+")")}function J(){return q}function K(){s=null,w=!0}var s=i.node,o=i.maxScale||10,u=i.minScale||.5,a,f,l=s.one(".img"),c=l.get("offsetWidth"),h=l.get("offsetHeight"),p=l.getXY(),d=1,v=[0,0],m=0,g=[0,0],y=1,b=0,w=!1,E=0,S,x=0,T,N,C,k,L=new e.EventTarget,A,O="transform 0.25s ease-out",M=s.getStyle("transform");i.boundingBox?N=i.boundingBox:N=[[0,0],[window.innerWidth,window.innerHeight]],s&&s.setStyles({"-webkit-transform-origin":"0 0","-moz-transform-origin":"0 0","-o-transform-origin":"0 0","-ms-transform-origin":"0 0","transform-origin":"0 0"}),A=s,s&&s.on("webkitTransitionEnd",function(){A.setStyles({"-webkit-transition":"","-moz-transition":"","-o-transition":"","-ms-transition":"",transition:""})});var P={touchstart:function(e){W(),g=r(e.touches),v=g,f=g,e.touches.length===1?b=Date.now():b=0;if(e.touches.length===2){var t=Math.abs(e.touches[0].pageX-e.touches[1].pageX),n=Math.abs(e.touches[0].pageY-e.touches[1].pageY);S=Math.sqrt(t*t+n*n)}},touchmove:function(e){g=r(e.touches),!m&&e.touches.length===1?d!==1&&I(e):e.touches.length===2&&(b=0,F(e)),$()},touchend:function(e){e.touches.length<1&&d!==1?(y=d,b?(Date.now()-b<100&&(_(e),b=0),b=0,k&&(s.setStyles({"-webkit-transition":"-webkit-"+O,"-moz-transition":"-moz-"+O,"-o-transition":"-o-"+O,"-ms-transition":"-ms-"+O,transition:O}),U(k),$(),k=null),L.fire("mrpinchy:endmove")):y>o?(H(o,!0),U(C.translate),d=o,y=o,s.setStyles({"-webkit-transition":"-webkit-"+O,"-moz-transition":"-moz-"+O,"-o-transition":"-o-"+O,"-ms-transition":"-ms-"+O,transition:O}),$(),C=null):y<u&&(H(u,!0),U([0,0]),d=u,y=u,s.setStyles({"-webkit-transition":"-webkit-"+O,"-moz-transition":"-moz-"+O,"-o-transition":"-o-"+O,"-ms-transition":"-ms-"+O,transition:O}),$(),L.fire("mrpinchy:reset",y),D(),C=null),L.fire("mrpinchy:endpinch",y),m=0,z()):d===1&&L.fire("mrpinchy:endpinch",1)}};return L.getTouchHandler=J,L.destroy=K,L.updateBoundingBox=function(e){N=e},L.updateImageSize=function(){c=l.get("offsetWidth"),h=l.get("offsetHeight")},L.resetTransform=function(){D()},L}var t=/matrix3d\(([^\)]+)\)/,n=e.MatrixMath;e.MrPinchy={init:function(e){return new i(e)}}},"@VERSION@",{requires:["matrix-math"],optional:[]});
YUI.add("mobile-photo-well-view",function(e){var t=3,n="https://m.flickr.com/photos/{nsid}/{photoid}/play/",r=500,i=500;e.namespace("Views")[this.name]=e.Base.create("mobile-photo-well-view",e.FlickrView,[],{langBundles:["common"],initializer:function(t){this.photoId=t.photoId,this.context=e.clone(t.context,!0);var n=this.appContext.getUA().os;this.nsid=t.nsid,this.disablePinchZooming=n==="windows",this.isAndroid=n==="android";if(this.context&&this.context.params&&this.context.params.isSharedEntity){var r=this.context.params;this.appContext.setGPCredentials({gp_code:r.gpCode,gp_owner:r.gpOwner,share_code:r.gpCode})}else this.appContext.setGPCredentials(null);return this},loadState:function(){var t=this,n=[];return n.push(this.appContext.getModel("photo-models",this.photoId).then(function(e){t.set("photoModel",e)})),e.Promise.all(n)},buildContainer:function(){var s,o,u=this.get("photoModel").getValue("isVideo"),a,f,l,c;if(YUI.Env.isServer)s=r,o=i,a=s/8,f=o/8;else{s=parseInt(e.StorageHelper.getItem("mobile-photo-well-width"),10),o=parseInt(e.StorageHelper.getItem("mobile-photo-well-height"),10);var h=this.getUsableAreaSize(),p=h.actualW,d=h.adjustedH;if(!s||isNaN(s)||s<50)s=p;if(!o||isNaN(o)||o<50)o=d;a=s,f=o}var v=this.get("photoModel").getSizeToFit({width:a,height:f},{cropToFit:!0});return this.set("bestImageSize",v),l=Math.max(v.height/t,o),c=v.height/v.width,this.setContainerWithTemplate("mobile-photo-well",{maxHeight:l,isServer:YUI.Env.isServer,loadAspect:c,loadHeight:c*s,url:v.url,videoURL:n.replace("{nsid}",this.nsid).replace("{photoid}",this.photoId),isVideo:u}),this},activate:function(){var e=this.get("container"),t=e.one(".main-image"),n=e.one(".main-image-wrapper"),r=this.get("photoModel"),i=this.get("photoModel").getValue("isVideo"),s=this;e.all(".photo-link.loading").removeClass("loading"),t.setStyle("width",null),n.setStyle("height",null),this.findBestPhoto(r,t),this.appContext.getViewCounter().queue(this.get("photoModel").getValue("id"),this.appContext.getReferrer()),this.loadAdjacentPhotos();var o=parseInt(n.getComputedStyle("height"),10);return this.get("container").setStyle("height",o+"px"),n.setStyle("position","absolute"),!i&&!this.disablePinchZooming&&this.addPinchy(),window.orientation&&(window.onorientationchange=function(){var e=window.innerWidth,t=window.innerHeight,n=e>t,r=[[0,0],[n?t:e,n?e:t]];s.transform.updateBoundingBox(r),s.transform.updateImageSize()}),this.context&&this.context.modelName&&this.context.params&&this.appContext.getModel(this.context.modelName,this.context.params).then(function(e){if(e)return s.set("contextModel",e),e.getValue("photoContextList").getContext({photoId:s.photoId}).then(function(){var t=-1,n=e.getValue("photoContextList").getList();n.some(function(e,n){return e.id===s.photoId&&(t=n),t>0});if(t>-1){var r,i,o,u,a="/in/"+e.getValue("urlSuffix");t>0&&(r=n[t-1],r&&(o=r.getValue("url")+a)),t<n.length-1&&(i=n[t+1],i&&(u=i.getValue("url")+a)),o&&s.get("container").one(".prev-photo").setAttribute("href",o).removeClass("hide-nav-link"),u&&s.get("container").one(".next-photo").setAttribute("href",u).removeClass("hide-nav-link")}})}),this},addPinchy:function(){var n=window.innerWidth,r=window.innerHeight,i=n>r,s=this.get("container").one(".main-image-wrapper"),o=this.get("container").one(".main-image-wrapper-underlay"),u=[[0,0],[i?r:n,i?n:r]],a=this,f;this.transform=e.MrPinchy.init({node:s,maxScale:i?2:t,minScale:1,boundingBox:u}),f=this.transform.getTouchHandler(),this.largeLoaded=!1,s.on("touchstart",function(t){f(t),a.largeLoaded||(a.largeLoaded=!0,a.findBestPhoto(a.get("photoModel"),s.one(".img"),!0,!0)),a.addZoomTimeout=setTimeout(function(){a.get("container").addClass("zoomed"),s.addClass("zoomed"),e.one("html").setStyle("position","fixed"),o.setStyle("display","block"),setTimeout(function(){o.addClass("show-overlay")},10)},200)}),s.on("touchmove",function(e){f(e)}),s.on("touchend",function(e){f(e)}),s.on("touchcancel",function(e){a.transform.resetTransform(),a.transform.fire("mrpinchy:reset")}),this.transform.on("mrpinchy:reset",function(){clearTimeout(a.addZoomTimeout),a.get("container").removeClass("zoomed"),s.removeClass("zoomed"),e.one("html").setStyle("position",null),o.removeClass("show-overlay"),setTimeout(function(){o.setStyle("display","none")},800)}),this.transform.on("mrpinchy:endpinch",function(t){t===1&&(clearTimeout(a.addZoomTimeout),a.get("container").removeClass("zoomed"),s.removeClass("zoomed"),e.one("html").setStyle("position",null),o.removeClass("show-overlay"),setTimeout(function(){o.setStyle("display","none")},800))})},getUsableAreaSize:function(){var e=window.innerWidth,t=window.innerHeight,n=t-50-50;return this.get("container").ancestor(".show-upsell-banner")&&(n-=50),{actualW:e,actualH:t,adjustedH:n}},findBestPhoto:function(n,r,i,s){var o=this.getUsableAreaSize(),u=o.actualW,a=o.adjustedH,f=n.getSizeToFit({width:i?u*t:u,height:i?a*t:a},{cropToFit:!0});a=Math.min(u/f.width*f.height,o.adjustedH);if(r)r.getAttribute("src")!==f.url&&r.setAttribute("src",f.url),this.set("bestImageSize",f),r.setStyle("height",a),this.get("container").setStyle("height",a),YUI.Env.isServer||(e.StorageHelper.setItem("mobile-photo-well-width",u),e.StorageHelper.setItem("mobile-photo-well-height",o.adjustedH));else{var l=new Image;l.src=f.url}},loadAdjacentPhotos:function(){var e=this.get("prevPhoto"),t=this.get("nextPhoto");t&&this.findBestPhoto(t),e&&this.findBestPhoto(e)}},{ATTRS:{}})},"@VERSION@",{requires:["flickr-view","flickr-promise","hermes-template-mobile-photo-well","viewport-data","storage-helper","mrpinchy"],langBundles:["common"]});
YUI.add("hermes-template-mobile-photo-engagement",function(e,t){var n=e.Template.Handlebars.revive({1:function(e,t,n,r,i){var s,o,u=t!=null?t:{},a=n.helperMissing,f=e.escapeExpression;return' <span class="fave-count-label" style="margin-left: '+f((o=(o=n.faveSvgMargin||(t!=null?t.faveSvgMargin:t))!=null?o:a,typeof o=="function"?o.call(u,{name:"faveSvgMargin",hash:{},data:i}):o))+'px">\n'+((s=n["if"].call(u,(s=t!=null?t.engagement:t)!=null?s.isFaved:s,{name:"if",hash:{},fn:e.program(2,i,0),inverse:e.program(4,i,0),data:i}))!=null?s:"")+" "+f((n.friendlyNumber||t&&t.friendlyNumber||a).call(u,(s=t!=null?t.engagement:t)!=null?s.faveCount:s,{name:"friendlyNumber",hash:{},data:i}))+"\n </span>\n"},2:function(e,t,n,r,i){return' <svg class="icon icon-fave"><use xlink:href="#icon-fave"></use></svg>\n'},4:function(e,t,n,r,i){return' <svg class="icon icon-fave_hollow"><use xlink:href="#icon-fave_hollow"></use></svg>\n'},6:function(e,t,n,r,i){var s;return' <span class="fave-count-label" style="margin-left: '+e.escapeExpression((s=(s=n.faveSvgMargin||(t!=null?t.faveSvgMargin:t))!=null?s:n.helperMissing,typeof s=="function"?s.call(t!=null?t:{},{name:"faveSvgMargin",hash:{},data:i}):s))+'px">\n <svg class="icon icon-fave_hollow"><use xlink:href="#icon-fave_hollow"></use></svg>\n 0\n </span>\n'},8:function(e,t,n,r,i){var s,o,u=t!=null?t:{},a=n.helperMissing,f=e.escapeExpression;return' <span class="comment-count-label" style="margin-left: '+f((o=(o=n.commentSvgMargin||(t!=null?t.commentSvgMargin:t))!=null?o:a,typeof o=="function"?o.call(u,{name:"commentSvgMargin",hash:{},data:i}):o))+'px">\n <svg class="icon icon-comment_hollow"><use xlink:href="#icon-comment_hollow"></use></svg>\n '+f((n.friendlyNumber||t&&t.friendlyNumber||a).call(u,(s=t!=null?t.engagement:t)!=null?s.commentCount:s,{name:"friendlyNumber",hash:{},data:i}))+"\n </span>\n"},10:function(e,t,n,r,i){var s;return' <span class="comment-count-label" style="margin-left: '+e.escapeExpression((s=(s=n.commentSvgMargin||(t!=null?t.commentSvgMargin:t))!=null?s:n.helperMissing,typeof s=="function"?s.call(t!=null?t:{},{name:"commentSvgMargin",hash:{},data:i}):s))+'px">\n <svg class="icon icon-comment_hollow"><use xlink:href="#icon-comment_hollow"></use></svg>\n 0</span>\n'},compiler:[7,">= 4.0.0"],main:function(e,t,n,r,i){var s,o=t!=null?t:{},u=n.helperMissing,a=e.escapeExpression;return'<div class="actions-container">\n <div class="fave-count">\n'+((s=n["if"].call(o,(s=t!=null?t.engagement:t)!=null?s.faveCount:s,{name:"if",hash:{},fn:e.program(1,i,0),inverse:e.program(6,i,0),data:i}))!=null?s:"")+' </div>\n\n <div class="comment-count">\n'+((s=n["if"].call(o,(s=t!=null?t.engagement:t)!=null?s.commentCount:s,{name:"if",hash:{},fn:e.program(8,i,0),inverse:e.program(10,i,0),data:i}))!=null?s:"")+' </div>\n\n <div class="share-container">\n <span class="share-container-icon">\n <svg class="icon icon-share_hollow"><use xlink:href="#icon-share_hollow"></use></svg>\n </span>\n </div>\n\n <div class="vr vr-container">\n <a href="#" title="'+a((n.intlMessage||t&&t.intlMessage||u).call(o,{name:"intlMessage",hash:{intlName:"photo-page-scrappy.IMMERSIFY"},data:i}))+'">\n <svg class="icon icon-vr_hollow"><use xlink:href="#icon-vr_hollow"></use></svg>\n </a>\n </div>\n '+a((n.outlet||t&&t.outlet||u).call(o,t!=null?t["vr-overlay-view"]:t,{name:"outlet",hash:{},data:i}))+"\n</div>"},useData:!0}),r={};e.Array.each([],function(t){var n=e.Template.get("hermes/"+t);n&&(r[t]=n)}),e.Template.register("hermes/mobile-photo-engagement",function(t,i){return i=i||{},i.partials=i.partials?e.merge(r,i.partials):r,n(t,i)})},"@VERSION@",{requires:["template-base","handlebars-base"]});
YUI.add("hermes-template-mobile-share-modal",function(e,t){var n=e.Template.Handlebars.revive({compiler:[7,">= 4.0.0"],main:function(e,t,n,r,i){var s,o=t!=null?t:{},u=n.helperMissing,a=e.escapeExpression;return'<div class="share">\n <p>'+a((n.intlMessage||t&&t.intlMessage||u).call(o,{name:"intlMessage",hash:{intlName:"share-modal.SHARE"},data:i}))+'</p>\n\n <form>\n <input type="text" value="'+a((s=(s=n.shortUrl||(t!=null?t.shortUrl:t))!=null?s:u,typeof s=="function"?s.call(o,{name:"shortUrl",hash:{},data:i}):s))+'" readonly>\n </form>\n</div>'},useData:!0}),r={};e.Array.each([],function(t){var n=e.Template.get("hermes/"+t);n&&(r[t]=n)}),e.Template.register("hermes/mobile-share-modal",function(t,i){return i=i||{},i.partials=i.partials?e.merge(r,i.partials):r,n(t,i)})},"@VERSION@",{requires:["template-base","handlebars-base"]});
YUI.add("hermes-template-stats-photo",function(e,t){var n=e.Template.Handlebars.revive({1:function(e,t,n,r,i){var s,o,u=t!=null?t:{},a=n.helperMissing,f="function",l=e.escapeExpression,c=e.lambda;return'\n <div class="photo-stats-basics">\n <div class="photo-stats-basics-left">\n <a href="'+l((o=(o=n.url||(t!=null?t.url:t))!=null?o:a,typeof o===f?o.call(u,{name:"url",hash:{},data:i}):o))+'" class="photo-thumbnail" style="background-image: url('+l((o=(o=n.photoUrl||(t!=null?t.photoUrl:t))!=null?o:a,typeof o===f?o.call(u,{name:"photoUrl",hash:{},data:i}):o))+');"></a>\n <div class="photo-info">\n <a href="'+l((o=(o=n.url||(t!=null?t.url:t))!=null?o:a,typeof o===f?o.call(u,{name:"url",hash:{},data:i}):o))+'" class="photo-title truncate">'+l((o=(o=n.title||(t!=null?t.title:t))!=null?o:a,typeof o===f?o.call(u,{name:"title",hash:{},data:i}):o))+'</a>\n <div class="photo-posted-date">\n'+((s=(n.friendlyDateScrappySubphoto||t&&t.friendlyDateScrappySubphoto||a).call(u,t!=null?t.datePosted:t,false,false,{name:"friendlyDateScrappySubphoto",hash:{},fn:e.program(2,i,0),inverse:e.noop,data:i}))!=null?s:"")+' </div>\n </div>\n </div>\n <div class="photo-stats-basics-right">\n <div class="view-count"><i></i> '+l(c((s=t!=null?t.basicStats:t)!=null?s.viewCount:s,t))+'</div>\n <div class="fave-count"><i></i> '+l(c((s=t!=null?t.basicStats:t)!=null?s.faveCount:s,t))+'</div>\n <div class="comment-count"><i></i> '+l(c((s=t!=null?t.basicStats:t)!=null?s.commentCount:s,t))+'</div>\n </div>\n </div>\n\n <div class="photo-stats-nav">\n <div class="nav-links">\n <div class="photo-stats-nav-link selected" data-link="views">'+l((n.intlMessage||t&&t.intlMessage||a).call(u,{name:"intlMessage",hash:{intlName:"stats.RECENT_VIEWS"},data:i}))+'</div>\n <div class="photo-stats-nav-link" data-link="sources">'+l((n.intlMessage||t&&t.intlMessage||a).call(u,{name:"intlMessage",hash:{intlName:"stats.SOURCES"},data:i}))+'</div>\n </div>\n <div class="photo-stats-nav-extras">\n <div class="date-picker">'+l((o=(o=n.prettyDateString||(t!=null?t.prettyDateString:t))!=null?o:a,typeof o===f?o.call(u,{name:"prettyDateString",hash:{},data:i}):o))+' <span></span></div>\n </div>\n </div>\n\n <div class="photo-stats-sections" data-showing="views">\n\n <div class="photo-stats-section" data-section="views">\n <div class="daily-views-graph">\n </div>\n </div>\n\n <div class="photo-stats-section" data-section="sources">\n\n <div class="source-breakdown-left'+((s=n.unless.call(u,t!=null?t.hasReferrers:t,{name:"unless",hash:{},fn:e.program(4,i,0),inverse:e.noop,data:i}))!=null?s:"")+'">\n <div class="no-sources">\n '+l((n.intlMessage||t&&t.intlMessage||a).call(u,{name:"intlMessage",hash:{intlName:"stats.NO_SOURCES_TODAY"},data:i}))+'\n </div>\n\n <div class="sources-pie-chart pie-chart"></div>\n </div>\n\n <div class="source-breakdown-right'+((s=n.unless.call(u,t!=null?t.hasReferrers:t,{name:"unless",hash:{},fn:e.program(4,i,0),inverse:e.noop,data:i}))!=null?s:"")+'">\n <div class="sources-breakdown">\n <div class="sources-breakdown-header">\n <div>'+l((n.intlMessage||t&&t.intlMessage||a).call(u,{name:"intlMessage",hash:{intlName:"stats.SOURCES"},data:i}))+"</div>\n <div>"+l((n.intlMessage||t&&t.intlMessage||a).call(u,{name:"intlMessage",hash:{intlName:"stats.VISITS"},data:i}))+'</div>\n <div>%</div>\n </div>\n <div class="sources-breakdown-list"></div>\n </div>\n </div>\n\n </div>\n\n </div>\n\n'},2:function(e,t,n,r,i){return" "+e.escapeExpression((n.intlMessage||t&&t.intlMessage||n.helperMissing).call(t!=null?t:{},{name:"intlMessage",hash:{intlDate:t!=null?t.intlDate:t,intlName:t!=null?t.intlName:t},data:i}))+"\n"},4:function(e,t,n,r,i){return" no-results"},6:function(e,t,n,r,i){return'\n <div class="no-stats-available">\n '+e.escapeExpression((n.intlMessage||t&&t.intlMessage||n.helperMissing).call(t!=null?t:{},{name:"intlMessage",hash:{intlName:"stats.NO_RECENT_PHOTO_STATS_AVAILABLE"},data:i}))+"\n </div>\n\n"},compiler:[7,">= 4.0.0"],main:function(e,t,n,r,i){var s;return(s=n["if"].call(t!=null?t:{},t!=null?t.actuallyHasSomeStats:t,{name:"if",hash:{},fn:e.program(1,i,0),inverse:e.program(6,i,0),data:i}))!=null?s:""},useData:!0}),r={};e.Array.each([],function(t){var n=e.Template.get("hermes/"+t);n&&(r[t]=n)}),e.Template.register("hermes/stats-photo",function(t,i){return i=i||{},i.partials=i.partials?e.merge(r,i.partials):r,n(t,i)})},"@VERSION@",{requires:["template-base","handlebars-base"]});
YUI.add("timezone-helper",function(e){"use strict";e.TimezoneHelper=function(t,n,r){r?(this.tz=r,this.dst=!1):(this.tz=t.getViewer().prefs.timezonePref.offset,this.dst=t.getViewer().prefs.timezonePref.dst),this.momentObject=e.moment(n,"X"),this.momentObject.utcOffset(this.tz),this.dst&&this.momentObject.isDST()&&this.momentObject.add(1,"hour")},e.TimezoneHelper.prototype.toFormat=function(e){return this.momentObject.format(e)}},"@VERSION@",{requires:["moment"]});
YUI.add("stats-helper",function(e){"use strict";var t;YUI.Env.isServer?t=require("querystring").stringify:t=function(e){var t=[],n,r,i;for(n in e)if(e.hasOwnProperty(n))if(Array.isArray(e[n]))for(r=0,i=e[n].length;r<i;r++)t.push(encodeURIComponent(n)+"="+encodeURIComponent(e[n][r]));else t.push(encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t.join("&")},e.StatsHelper=function(){},e.StatsHelper.prototype.moveToFrontOfArray=function(e,t){var n=-1;return e.forEach(function(e,r){e===t&&(n=r)}),n>-1&&e.unshift(e.splice(n,1)[0]),e},e.StatsHelper.prototype.moveToEndOfArray=function(e,t){var n=-1;return e.forEach(function(e,r){e===t&&(n=r)}),n>-1&&(e.push(e[n]),e.splice(n,1)),e},e.StatsHelper.prototype.whichChild=function(e){var t=0;while((e=e.previousElementSibling)!==null)++t;return t},e.StatsHelper.prototype.getRoundedRectanglePath=function(e,t,n,r,i,s,o){var u=e[0],a=e[1],f=t[0],l=t[1],c;return c="M"+(u+n)+","+a,c+="h"+(f-2*n),i?c+="a"+n+","+n+" 0 0 1 "+n+","+n:(c+="h"+n,c+="v"+n),c+="v"+(l-2*n),o?c+="a"+n+","+n+" 0 0 1 "+ -n+","+n:(c+="v"+n,c+="h"+ -n),c+="h"+(2*n-f),s?c+="a"+n+","+n+" 0 0 1 "+ -n+","+ -n:(c+="h"+ -n,c+="v"+ -n),c+="v"+(2*n-l),r?c+="a"+n+","+n+" 0 0 1 "+n+","+ -n:(c+="v"+ -n,c+="h"+n),c+="z",c},e.StatsHelper.prototype.getIdFromParams=function(e){var n=t(e);return n===""&&(n=1),n},e.StatsHelper.prototype.convertStorageTotalToRealNumber=function(e){var t=e;return e===-1&&(t=-1),t},e.StatsHelper.prototype.convertStorageAmountToRealNumber=function(e){var t,n,r,i=100;return e=parseInt(e,10)||1,t=Math.ceil(Math.log(e)/Math.LN10),n=Math.floor(t/3),r=e/Math.pow(10,n*3),r=Math.floor(r*i)/i,r},e.StatsHelper.prototype.convertNaturalLanguageDateToRealDateTimestamp=function(t,n){var r="",i;i=e.moment();switch(n){case"today":r=i;break;case"yesterday":r=i.subtract(1,"days");break;case"thisweek":case"week":r=i.startOf("week");break;case"lastweek":r=i.subtract(1,"weeks").startOf("week");break;case"twoweeksago":case"theweekbeforethat":r=i.subtract(2,"weeks").startOf("week");break;case"threeweeksago":case"theweekbeforetheweekbeforethat":r=i.subtract(3,"weeks").startOf("week")}return r!==""&&(r=(new e.TimezoneHelper(t,r.format("X"),"00:00")).toFormat("YYYY-MM-DD")),r}},"@VERSION@",{affinity:"",requires:["flickr-promise","event-custom","moment","timezone-helper"],optional:[]});
YUI.add("flickr-stats-photo-daily-views-fetcher",function(e,t){"use strict";function n(e){var t={id:e.id,photo_id:e.photoId};return t}function r(t,n){var r=t.apiResponse.stats,i=r.graphdata,s=t.modelRegistry,o,u={},a={},f=[],l,c,h,p,d;return d={views:0,favs:0,comments:0},o={id:n.id},i&&(u=i,f=Object.keys(i),f.forEach(function(e,t){!u[e].burp&&!u[e].nodot?(c?(c>e&&(c=e),p<e&&(p=e)):(c=e,p=e),u[e].views||(u[e].views=0),u[e].comments||(u[e].comments=0),u[e].favs||(u[e].favs=0),u[e].views=parseInt(u[e].views,10),u[e].favs=parseInt(u[e].favs,10),u[e].comments=parseInt(u[e].comments,10),d.views+=u[e].views,d.favs+=u[e].favs,d.comments+=u[e].comments):delete u[e]})),o.days=u,o.oldestDate=c,o.newestDate=p,o.totals=d,s.exists(o.id)?(a=s.getValue("days"),o.days=e.merge(o.days,a),l=s.getValue("oldestDate"),c>l&&(o.oldestDate=l),h=s.getValue("newestDate"),p>h&&(o.newestDate=h),o.totals+=e.merge(o.totals,s.getValue("totals")),s.setValues(o.id,o)):s.add(o),o}function i(n,r){var i=this;return(new e.FlickrPromise({apiResponse:r.callAPI("flickr.stats.photo.getGraphData",this._processParams(n)),modelRegistry:r.getModelRegistry("stats-photo-daily-views-models")})).then(function(e){return i._processResponse(e,n)},e.FetcherErrorLogger(t))}e.namespace("ModelFetchers")["flickr-stats-photo-daily-views"]={run:i,_processResponse:r,_processParams:n}},"@VERSION@",{requires:["flickr-promise","api-helper"],optional:["stats-photo-daily-views-models"]});
YUI.add("stats-photo-daily-views-models",function(e){function t(e){t.superclass.constructor.call(this,e)}e.Models[this.name]=t,e.extend(t,e.FlickrModelRegistry,{name:this.name,remote:{read:function(t){return e.ModelFetchers["flickr-stats-photo-daily-views"].run(t,this.appContext)}},attributes:{days:{},oldestDate:{},newestDate:{},totals:{}}})},"@VERSION@",{requires:["flickr-model-registry","flickr-promise","flickr-stats-photo-daily-views-fetcher"]});
YUI.add("flickr-stats-referrer-domains-fetcher",function(e,t){"use strict";function i(e){var t={id:e.id,date:e.date||"",photo_id:e.photoId||""};return t}function s(e,t){var n=e.apiResponse,i=e.modelRegistry,s,o={},u={},a=0,f,l,c=n.stat;s={id:t.id},delete n.stat,l=Object.keys(n),n.stat=c;if(l.length===0)throw f=new Error("[flickr-stats-referrer-domains-fetcher] api returned ok but did not contain the data needed"),f.fatal=!0,f;return l.forEach(function(e,t){var i=r[e.toLowerCase()],s,f=n[e];i||(i="other"),o[i]||(o[i]={}),u[i]||(u[i]=0),s=f.viewcount,o[i]=f,u[i]+=s,a+=s}),s.referrers=o,s.totals=u,s.total=a,i.addOrUpdate(s),s}function o(t,r){var i=this;return(new e.FlickrPromise({apiResponse:r.callAPI("flickr.stats.getReferrerCategoriesForDate",this._processParams(t)),modelRegistry:r.getModelRegistry("stats-referrer-domains-models")})).then(function(e){return i._processResponse(e,t)},function(e){if(e.code===2)return n.error({err:e,id:t.id,date:t.date}),r.getModelRegistry("stats-referrer-domains-models").then(function(e){e.addOrUpdate({id:t.id,missingData:!0})});throw e})}var n=require("lib/flog")(t),r={flickr:"flickr","search engine":"search",social:"social",yahoo:"search",google:"search",bing:"search",twitter:"social",facebook:"social",pinterest:"social",tumblr:"social","flickr embedr":"flickr embedr"};e.namespace("ModelFetchers")["flickr-stats-referrer-domains"]={run:o,_processResponse:s,_processParams:i}},"@VERSION@",{requires:["flickr-promise","api-helper"],optional:["stats-referrer-domains-models"]});
YUI.add("stats-referrer-domains-models",function(e){function t(e){t.superclass.constructor.call(this,e)}e.Models[this.name]=t,e.extend(t,e.FlickrModelRegistry,{name:this.name,remote:{read:function(t){return e.ModelFetchers["flickr-stats-referrer-domains"].run(t,this.appContext)}},attributes:{referrers:{defaultValue:{}},totals:{defaultValue:{}},total:{defaultValue:0},missingData:{defaultValue:!1}}})},"@VERSION@",{requires:["flickr-model-registry","flickr-promise","flickr-stats-referrer-domains-fetcher"]});
YUI.add("stats-photo-view",function(e){var t=500;e.FlickrView.create(this.name,e.FlickrView,[],{langBundles:this.details.langBundles,initializer:function(t){return this.statsHelper=new e.StatsHelper,this.photoId=t.photoId,this.dateString=t.dateString,this.prettyDateString=t.prettyDateString||t.dateString,this.realtimeDateString=t.realtimeDateString||t.dateString,this.isOwner=t.isOwner,this.nsid=t.nsid,this.isPro=!1,this.pickers={},this.tooltip,this.dateIntl={previousMonth:this.intlMessage({intlName:"pika-day.PREVIOUS_MONTH"}),nextMonth:this.intlMessage({intlName:"pika-day.NEXT_MONTH"})},this.dateIntl.weekdays=[this.intlMessage({intlName:"pika-day.SUNDAY"}),this.intlMessage({intlName:"pika-day.MONDAY"}),this.intlMessage({intlName:"pika-day.TUESDAY"}),this.intlMessage({intlName:"pika-day.WEDNESDAY"}),this.intlMessage({intlName:"pika-day.THURSDAY"}),this.intlMessage({intlName:"pika-day.FRIDAY"}),this.intlMessage({intlName:"pika-day.SATURDAY"})],this.dateIntl.weekdaysShort=[this.intlMessage({intlName:"pika-day.SUNDAY_SHORT"}),this.intlMessage({intlName:"pika-day.MONDAY_SHORT"}),this.intlMessage({intlName:"pika-day.TUESDAY_SHORT"}),this.intlMessage({intlName:"pika-day.WEDNESDAY_SHORT"}),this.intlMessage({intlName:"pika-day.THURSDAY_SHORT"}),this.intlMessage({intlName:"pika-day.FRIDAY_SHORT"}),this.intlMessage({intlName:"pika-day.SATURDAY_SHORT"})],this.dateIntl.months=[this.intlMessage({intlName:"pika-day.JANUARY"}),this.intlMessage({intlName:"pika-day.FEBRUARY"}),this.intlMessage({intlName:"pika-day.MARCH"}),this.intlMessage({intlName:"pika-day.APRIL"}),this.intlMessage({intlName:"pika-day.MAY"}),this.intlMessage({intlName:"pika-day.JUNE"}),this.intlMessage({intlName:"pika-day.JULY"}),this.intlMessage({intlName:"pika-day.AUGUST"}),this.intlMessage({intlName:"pika-day.SEPTEMBER"}),this.intlMessage({intlName:"pika-day.OCTOBER"}),this.intlMessage({intlName:"pika-day.NOVEMBER"}),this.intlMessage({intlName:"pika-day.DECEMBER"})],this.viewClass="",this.get("container").get("innerHTML")===""&&this.setContainerHTML('<div class="balls"></div>'),this},loadState:function(){if(!this.appContext.flipper.isFlipped("rebootify-stats")||!this.isOwner)return e.Promise.resolve();var t=this,n,r,i,s,o,u,a={};return this.isOwner?this.appContext.getModel("person-models",this.nsid).then(function(f){return t.isPro=f.getValue("isPro"),t.isPro?(n=e.moment().format("X"),r=new e.TimezoneHelper(t.appContext,n,"00:00"),t.dateString||(t.dateString=r.toFormat("YYYY-MM-DD"),t.prettyDateString=r.toFormat("MMM D, YYYY"),t.realtimeDateString=t.dateString),i={date:t.dateString,photoId:t.photoId},s={id:t.statsHelper.getIdFromParams(i)},a.dailyViewsModel=t.appContext.getModel("stats-photo-daily-views-models",s,i),o={date:t.dateString,photoId:t.photoId},u={id:t.statsHelper.getIdFromParams(o)},a.referrerDomainsModel=t.appContext.getModel("stats-referrer-domains-models",u,o),a.photoModel=t.appContext.getModel("photo-models",t.photoId),a.photoStatsModel=t.appContext.getModel("photo-stats-models",t.photoId),(new e.FlickrPromise(a)).then(function(e){t.dailyViewsModel=e.dailyViewsModel,t.referrerDomainsModel=e.referrerDomainsModel,t.photoModel=e.photoModel,t.photoModel.stats=e.photoStatsModel},function(e){console.log(e)})):e.Promise.resolve()}):e.Promise.resolve()},loadNewDateData:function(t){var n=this,r={},i,s;return s={date:t,photoId:n.photoId},i={id:this.statsHelper.getIdFromParams(s)},r.referrerDomainsModel=this.appContext.getModel("stats-referrer-domains-models",i,s),(new e.FlickrPromise(r)).then(function(e){t===n.dateString&&(n.referrerDomainsModel=e.referrerDomainsModel,n.refreshContent())},function(e){console.log(e)})},refreshContent:function(){var e,n=t,r=this.get("container");this.updateCurrentDatePoint(this.dateString,document.querySelector("circle.selectedPoint").getAttribute("key")),this.createReferrersGraphs(),e=r.one(".source-breakdown-right .sources-breakdown"),e&&(n=e.get("clientHeight")),r.setStyles({height:Math.max(t,n+60)+"px"})},buildContainer:function(){var e=!1;return this.isPro&&this.appContext.flipper.isFlipped("rebootify-stats")&&this.isOwner&&(e=this.referrerDomainsModel.getValue("total")>0?!0:!1),this.setContainerWithTemplate("stats-photo",{hasStats:this.isPro,hasReferrers:e,prettyDateString:this.dateString===this.realtimeDateString?this.intlMessage({intlName:"stats.TODAY"}):this.prettyDateString,photoUrl:this.photoModel.getSizeToFit({width:100,height:100}).url,url:this.photoModel.getValue("url"),title:this.photoModel.getValue("title"),basicStats:this.photoModel.getValue("engagement").toJSON(),datePosted:this.photoModel.stats.getDateObj("datePosted"),actuallyHasSomeStats:this.dailyViewsModel&&this.dailyViewsModel.getValue("totals").views>0&&this.isPro}),this},activate:function(){if(!this.appContext.flipper.isFlipped("rebootify-stats")||!this.isOwner||!this.isPro||!this.dailyViewsModel)return this;var t=this,n=this.get("container"),r={},i=n.all(".date-picker").getDOMNodes(),s=this.dailyViewsModel.getValue("oldestDate"),o=this.dailyViewsModel.getValue("newestDate"),u=this.dailyViewsModel.getValue("totals");return u.views>0&&this.isPro&&e.use("d3",function(){n.addClass("hasStats"),t.viewClass="."+n.getAttribute("class").replace(/\s/g,"."),t.createMainGraph(),r={i18n:t.dateIntl,position:"bottom right",reposition:!1,format:"YYYY-MM-DD",minDate:e.moment(s).toDate(),maxDate:e.moment(o).toDate(),yearRange:[parseInt(s.substring(0,4),10),parseInt(o.substring(0,4),10)],defaultDate:e.moment(t.dateString).toDate(),setDefaultDate:!0,onSelect:function(e){t.pickaNewDate(e,this.config().theme)},onOpen:function(){t.el&&(t.el.className+=" stats-photo")}},e.use("pika-day",function(e){i.forEach(function(n,i){t.pickers[i]=new e.Pikaday(e.merge(r,{field:n,theme:"picker-"+i}))})}),t.createReferrersGraphs(),t.registerEventHandler(n.all(".photo-stats-nav-link").on("click",t.handleNavItemClick,t)),t.registerEventHandler(n.one(".source-breakdown-left").on("click",t.handleSourceBreakdownClick,t)),t.registerEventHandler(n.one(".source-breakdown-right"
).on("click",t.handleSourceBreakdownClick,t)),t.registerEventHandler(n.one(".source-breakdown-right").on("mouseover",t.handleSourceBreakdownListItemMouseover,t)),t.registerEventHandler(n.one(".source-breakdown-right").on("mouseout",t.handleSourceBreakdownListItemMouseout,t))}),this},handleNavItemClick:function(n){var r=n.target,i=r.getData("link"),s=this.get("container"),o,u=t,a=!1;r.hasClass("selected")||(s.all(".photo-stats-nav-link").removeClass("selected"),r.addClass("selected"),s.one(".photo-stats-sections").getDOMNode().setAttribute("data-showing",i),i==="sources"?(o=s.one(".source-breakdown-right .sources-breakdown"),o&&(u=o.get("clientHeight"),a=e.config.win.innerWidth<=700,a&&(u=u+140+100+70-60)),s.setStyles({height:Math.max(t,u+60)+"px"})):s.setStyles({height:t+"px"}))},handleSourceBreakdownClick:function(n){var r=n.target,i=r.ancestor(),s=r.getDOMNode(),o=r.getData(),u,a,f=this.get("container"),l,c,h,p,d=".sources-pie-chart",v=f.one(d),m=f.one(".source-breakdown-right"),g,y,b=t,w,E=!1,S,x;if(s.tagName.toLowerCase()==="path")S=this.statsHelper.whichChild(s),i.getDOMNode().classList[0]==="overall"?x=m.all(".referrer-row"):x=m.all(".referrer-row-breakdown-row"),i.getAttribute("referrerkey")!=="other"&&i.getAttribute("referrerkey")!=="flickr embedr"&&x.getDOMNodes()[S].querySelector(".header").click();else if(r.hasClass("header")){o=i.getData(),g={margin:{top:0,right:0,bottom:0,left:0}},g.width=v.get("clientWidth")-g.margin.left-g.margin.right,g.height=v.get("clientHeight")-g.margin.top-g.margin.bottom,l=this.referrerDomainsModel,c=l.getValue("referrers"),h=l.getValue("totals"),p=Object.keys(h),this.statsHelper.moveToFrontOfArray(p,"flickr"),f.all(".referrer-row-breakdown-row-breakdown-row.shown").replaceClass("shown","not-shown"),f.all(".referrer-row-breakdown-row-breakdown .show-whole-list").removeClass("no-show");if(o.category){y=m.getData("showing"),u=o.category,m.all(".referrer-row").removeClass("selected");if(e.AttributeHelpers.coerceBoolean(o.isempty)){y!=="NOPE"&&this.createOverallPieChart(g,p,h,null,null,!1),e.d3.selectAll(this.viewClass+" .sources-pie-chart .first-level").remove(),e.d3.selectAll(this.viewClass+" .sources-pie-chart .second-level").remove(),m.all(".referrer-row-breakdown-row").removeClass("selected"),m.setData("showing","NOPE"),m.setData("subshowing","NOPE");return}y!==u?(i.addClass("selected"),m.setData("showing",u),f.one(".first-level")&&(e.d3.selectAll(this.viewClass+" .sources-pie-chart .first-level").remove(),e.d3.selectAll(this.viewClass+" .sources-pie-chart .second-level").remove(),m.all(".referrer-row-breakdown-row").removeClass("selected"),m.setData("subshowing","NOPE")),this.createOverallPieChart(g,p,h,!0),u==="other"||u==="flickr embedr"?this.createPieChart("first-level",g,Object.keys(c[u].items),c[u].items,u):this.createPieChart("first-level",g,Object.keys(c[u]),c[u],u)):(m.setData("showing","NOPE"),this.createOverallPieChart(g,p,h,null,null,!1),u==="other"||u==="flickr embedr"?this.createPieChart("first-level",g,Object.keys(c[u].items),c[u].items,u,null,!0):this.createPieChart("first-level",g,Object.keys(c[u]),c[u],u,null,!0),e.d3.selectAll(this.viewClass+" .sources-pie-chart .second-level").remove(),m.setData("subshowing","NOPE"))}else if(o.referrer){y=m.getData("subshowing"),u=o.referrer,a=o.parentcategory,m.all(".referrer-row-breakdown-row").removeClass("selected");if(e.AttributeHelpers.coerceBoolean(o.isempty)){m.setData("subshowing","NOPE"),y!=="NOPE"&&(this.createPieChart("first-level",g,Object.keys(c[a]),c[a],a,null,"fakeOpen"),this.createPieChart("second-level",g,Object.keys(c[a][y].items),c[a][y].items,y,a,!0));return}y!==u?(i.addClass("selected"),m.setData("subshowing",u),f.one(".first-level")&&e.d3.selectAll(this.viewClass+" .sources-pie-chart .second-level").remove(),this.createPieChart("first-level",g,Object.keys(c[a]),c[a],a,null,"fakeClose"),this.createPieChart("second-level",g,Object.keys(c[a][u].items),c[a][u].items,u,a)):(m.setData("subshowing","NOPE"),this.createPieChart("first-level",g,Object.keys(c[a]),c[a],a,null,"fakeOpen"),this.createPieChart("second-level",g,Object.keys(c[a][u].items),c[a][u].items,u,a,!0))}w=f.one(".source-breakdown-right .sources-breakdown"),b=w.get("clientHeight"),E=e.config.win.innerWidth<=700,E&&(b=b+140+100+70-60),f.setStyles({height:Math.max(t,b+60)+"px"})}else r.hasClass("show-whole-list")&&(f.all(".referrer-row-breakdown-row-breakdown-row.not-shown").replaceClass("not-shown","shown"),f.all(".referrer-row-breakdown-row-breakdown .show-whole-list").addClass("no-show"))},handleSourceBreakdownListItemMouseover:function(e){var t=e.target,n=t.ancestor(),r=this.get("container"),i,s;n.hasClass("referrer-row")?(i=this.statsHelper.whichChild(n.getDOMNode()),s=r.one(".source-breakdown-left").all(".pie-chart .overall path"),s.setAttribute("class","not-selected"),s.getDOMNodes()[i].setAttribute("class","")):n.hasClass("referrer-row-breakdown-row")?(i=this.statsHelper.whichChild(n.getDOMNode()),s=r.one(".source-breakdown-left").all(".pie-chart .first-level path"),s.setAttribute("class","not-selected"),s.getDOMNodes()[i].setAttribute("class","")):t.hasClass("referrer-row-breakdown-row-breakdown-row")&&(i=this.statsHelper.whichChild(t.getDOMNode()),s=r.one(".source-breakdown-left").all(".pie-chart .second-level path"),s.setAttribute("class","not-selected"),s.getDOMNodes()[i].setAttribute("class",""))},handleSourceBreakdownListItemMouseout:function(e){var t=e.target;t.getDOMNode().getAttribute("class")!=="pie"&&t.getDOMNode().tagName!=="path"&&this.get("container").all(".source-breakdown-left .pie-chart path").setAttribute("class","")},pickaNewDate:function(t,n){var r=new e.TimezoneHelper(this.appContext,t.getTime()/1e3+Math.abs(t.getTimezoneOffset()*60),"00:00"),i,s;this.dateString=r.toFormat("YYYY-MM-DD"),this.prettyDateString=r.toFormat("MMM D, YYYY");for(i in this.pickers)this.dateString===this.realtimeDateString?s=this.intlMessage({intlName:"stats.TODAY"}):s=this.prettyDateString,s+=" <span></span>",this.pickers
[i]._o.field.innerHTML=s,i!==n&&this.pickers[i].setMoment(r.momentObject,!0);this.loadNewDateData(this.dateString)},createMainGraph:function(){function b(t){t.each(function(){var t=e.d3.select(this),n=t.text().split(/\s+/).reverse(),r,i=[],s=0,o=1.1,u=t.attr("y"),a=parseFloat(t.attr("dy")),f=t.text(null).append("tspan").attr("x",0).attr("y",u).attr("dy",a+"em"),l=n.length;while(r=n.pop())i.push(r),f.text(i.join(" ")),l>1&&(i.pop(),f.text(i.join(" ")),i=[r],r!==""&&r!==" "&&(f=t.append("tspan").attr("x",0).attr("y",u).attr("dy",s++*o+a+"em").text(r)))})}var t=this.dailyViewsModel,n=t.getValue("days"),r=Object.keys(n),i=t.getValue("newestDate"),s=e.d3.time.format("%Y-%m-%d").parse,o=this,u=this.get("container"),a=".daily-views-graph",f=u.one(a),l,c,h,p,d,v=[],m,g,y="linear";this.daysKeys=r,h={margin:{top:15,right:15,bottom:90,left:60}},h.width=f.get("clientWidth")-h.margin.left-h.margin.right,h.height=f.get("clientHeight")-h.margin.top-h.margin.bottom,o.createYStuff=function(t){var i={};return i.yMin=0,i.yMax=e.d3.max(r,function(e,r){return+n[e][t]}),i.yMax=Math.ceil(i.yMax*1.2),i.yMaxLength=i.yMax.toString().length,i.yAxisDivisor=Math.pow(10,Math.max(0,i.yMaxLength-2)),i.yMax=Math.ceil(i.yMax*.2/i.yAxisDivisor)*i.yAxisDivisor*5,i.yAxisValues=[0,Math.ceil(i.yMax*.2/i.yAxisDivisor)*i.yAxisDivisor,Math.ceil(i.yMax*.4/i.yAxisDivisor)*i.yAxisDivisor,Math.ceil(i.yMax*.6/i.yAxisDivisor)*i.yAxisDivisor,Math.ceil(i.yMax*.8/i.yAxisDivisor)*i.yAxisDivisor,Math.ceil(i.yMax/i.yAxisDivisor)*i.yAxisDivisor],i.y=e.d3.scale.linear().range([h.height,0]).domain([i.yMin,i.yMax]),i.yAxis=e.d3.svg.axis().scale(i.y).orient("left").tickSubdivide(!1).tickValues(i.yAxisValues).tickFormat(function(e,t){var n=e;return t===0&&(n=""),n}),i},g={views:o.createYStuff("views"),favs:o.createYStuff("favs"),comments:o.createYStuff("comments")},r.forEach(function(e,t){v.push(s(e))}),d=e.d3.extent(r,function(e,t){return s(e)}),p=e.d3.time.scale().range([0,h.width]).domain(d),m=e.d3.svg.axis().scale(p).orient("bottom").tickValues(v).tickFormat(function(t,n){var r="";if(n%2===0){r=parseInt(e.d3.time.format("%e")(t),10);if(n===0||r===1||r===2)r+=" "+e.d3.time.format("%b")(t)}return r}),l=e.d3.select(o.viewClass+" "+a).append("svg").attr("class","main-graph").attr("width",h.width+h.margin.left+h.margin.right).attr("height",h.height+h.margin.top+h.margin.bottom).on("mouseleave",function(){e.d3.select(o.viewClass+" .selectedPoint").attr("cx",-100).attr("cy",-100)}),c=l.append("defs"),c.append("linearGradient").attr("id","photoDailyViewsViews").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%").selectAll("stop").data([{offset:"0%",color:"#24d9d7"},{offset:"100%",color:"#00aaff"}]).enter().append("stop").attr("offset",function(e){return e.offset}).attr("stop-color",function(e){return e.color}),l.append("g").attr("class","weekends").attr("transform","translate("+h.margin.left+", "+h.margin.top+")").attr("width",h.width).attr("height",h.height).selectAll("rect").data(r).enter().append("rect").attr("class",function(e,t){var n=s(e),r=n.getDay(),i="";if(r===0||r===6)i="weekend";return i}).attr("y",0).attr("x",function(e,t){var n=p(s(e));return t>0&&(n-=h.width/r.length/2),n}).attr("height",h.height).attr("width",function(e,t){var n=h.width/r.length;if(t===0||t===r.length-1)n/=2;return n}),l.append("g").attr("class","gridlines").attr("transform","translate(0, "+h.margin.top+")").selectAll("line").data(g.views.yAxisValues).enter().append("line").attr("x1",0).attr("x2",h.width+h.margin.left+h.margin.right).attr("y1",function(e){return g.views.y(e)}).attr("y2",function(e){return g.views.y(e)}),o.createYAxis=function(t,n){var r=!1;r=e.d3.selectAll(o.viewClass+" .y.axis"),r&&r.remove(),t.insert("g",".x.axis").attr("class","y axis").attr("transform","translate("+h.margin.left+", "+h.margin.top+")").call(g[n].yAxis).selectAll("text").attr("x","-10").attr("y","12")},o.createYAxis(l,"views"),l.append("g").attr("class","x axis").attr("transform","translate("+h.margin.left+", "+(h.height+h.margin.top)+")").call(m).selectAll("text").attr("y","10").call(b),o.createFlatLine=function(){return e.d3.svg.line().x(function(e){return p(s(e))}).y(function(e){return g.views.y(0)})},o.createLine=function(t){return e.d3.svg.line().interpolate(y).x(function(e){return p(s(e))}).y(function(e){return g[t].y(n[e][t])})},o.createArea=function(t){return e.d3.svg.area().interpolate(y).x(function(e){return p(s(e))}).y0(h.height).y1(function(e){return g[t].y(n[e][t])})},l.append("path").attr("class","main-line views").attr("transform","translate("+h.margin.left+", "+h.margin.top+")").attr("d",o.createFlatLine()(r)).attr("stroke","url(#photoDailyViewsViews)").transition().delay(500).duration(500).attr("d",o.createLine("views")(r)),o.updatePoint=function(t,r,i,u){var a=e.d3.select(o.viewClass+" "+t),f=a.attr("cx"),l=a.attr("cy"),c=p(s(r))+h.margin.left,d=g[i].y(n[r][i])+h.margin.top;return u?a.transition().duration(500).attr("cx",c).attr("cy",d).attr("date",r).attr("key",i):a.attr("cx",c).attr("cy",d).attr("date",r).attr("key",i),{point:a,oldXY:[f,l],newXY:[c,d]}},o.updateCurrentDatePoint=function(e,t,n){o.updatePoint(".currentDatePoint",e,t,n)},o.updateSelectedPoint=function(t,n,r){o.updatePoint(".selectedPoint",t,n,r);var i,s,u={};return i={date:t,photoId:o.photoId},s={id:o.statsHelper.getIdFromParams(i)},u.referrerDomainsModel=this.appContext.getModel("stats-referrer-domains-models",s,i),(new e.FlickrPromise(u)).then(function(e){},function(e){console.log(e)})},o.createVoronoi=function(t){var n=!1;n=e.d3.selectAll(o.viewClass+" g.voronoi"),n&&n.remove(),l.insert("g",".selectedPoint").attr("class","voronoi").attr("transform","translate("+h.margin.left+", "+h.margin.top+")").attr("width",h.width+h.width/r.length).attr("height",h.height).selectAll("rect").data(r).enter().append("rect").attr("y",0).attr("x",function(e,t){var n=p(s(e));return n-=h.width/r.length/2,n}).attr("height",h.height).attr("width",function(e,t){return h.width/r.length}).on("mouseenter",function(
e,n){o.updateSelectedPoint(r[n],t)})},l.append("circle").attr("class","currentDatePoint").attr("date",i).attr("key","views").attr("r",7).attr("cx",function(e,t){var n=0;return i===o.dateString?n=p(s(i))+h.margin.left:n=p(s(o.dateString))+h.margin.left,n}).attr("cy",g.views.y(0)+h.margin.top).transition().delay(500).duration(500).attr("cy",function(e,t){var r=0;return i===o.dateString?r=g.views.y(n[i].views)+h.margin.top:r=g.views.y(n[o.dateString].views)+h.margin.top,r}),l.append("circle").attr("class","selectedPoint").attr("cx",-100).attr("cy",-100).attr("r",4).attr("date",i).attr("key","views").on("click",function(){o.pickaNewDate(new Date(this.getAttribute("date")))}).on("mouseenter",function(t,r){var i=this.getAttribute("date"),s=n[i],a=new Date(i),f=new e.TimezoneHelper(o.appContext,a.getTime()/1e3+Math.abs(a.getTimezoneOffset()*60),"00:00"),l=f.toFormat("MMMM D"),c,h=150,p,d=s.views;s.favs>d&&(d=s.favs),s.comments>d&&(d=s.comments),h+=(d.toString().length-1)*20,p=-(h/2)+3,c='<div class="date">'+l+"</div>"+'<div class="stats">'+'<div class="stat">'+'<i class="icon" data-type="views"></i>'+o.intlMessage({intlName:"stats.NUMBER",num:s.views})+"</div>"+'<div class="stat">'+'<i class="icon" data-type="faves"></i>'+o.intlMessage({intlName:"stats.NUMBER",num:s.favs})+"</div>"+'<div class="stat">'+'<i class="icon" data-type="comments"></i>'+o.intlMessage({intlName:"stats.NUMBER",num:s.comments})+"</div>"+"</div>",o.tooltip?o.tooltip.updateHTMLMessage(c):(o.tooltip=new e.Views.FluidDroparound({appContext:o.appContext,dismissOnOverlayClick:!1,dismissOnActionClick:!1,showDropArrow:!0,preferTop:!0,preferLeft:!0,width:h,height:60,classList:"photo-daily-stats-tooltip over-modal",anchorElement:u.one(".selectedPoint"),hideModalOverlay:!0,invisibleOverlay:!0,htmlMessage:c,contentPadding:0,anchorOffsetHorizontal:24,anchorOffsetVertical:10,closeOnScroll:!0}),o.tooltip.show())}).on("mouseleave",function(e){o.tooltip&&(o.tooltip.close(),o.tooltip=undefined)}),o.createVoronoi("views")},createReferrersGraphs:function(){var e=this,t=this.referrerDomainsModel,n=t.getValue("referrers"),r,i=t.getValue("total"),s=t.getValue("totals"),o,u=this.get("container"),a=".sources-pie-chart",f=u.one(a),l=u.one(".source-breakdown-left"),c=u.one(".source-breakdown-right"),h=f.one(".overall"),p,d,v="";c.setData("showing","NOPE"),c.setData("subshowing","NOPE"),parseInt(i,10)===0?(l.addClass("no-results"),c.addClass("no-results")):(l.removeClass("no-results"),c.removeClass("no-results"),r=Object.keys(n),this.statsHelper.moveToFrontOfArray(r,"flickr"),this.statsHelper.moveToEndOfArray(r,"other"),o=Object.keys(s),this.statsHelper.moveToFrontOfArray(o,"flickr"),this.statsHelper.moveToEndOfArray(o,"other"),d={margin:{top:0,right:0,bottom:0,left:0}},d.width=f.get("clientWidth")-d.margin.left-d.margin.right,d.height=f.get("clientHeight")-d.margin.top-d.margin.bottom,this.set("outerRadius",d.height/2),h?p=e.createOverallPieChart(d,o,s,!1,!0):p=e.createOverallPieChart(d,o,s),v='<div class="referrer-rows">',o.forEach(function(t,n){t==="search"&&s[t]===0?v+='<div class="referrer-row" data-category="'+t+'" data-isempty="true">':v+='<div class="referrer-row" data-category="'+t+'" data-isempty="false">',v+='<div class="header">',t==="search"&&s[t]===0?v+='<div><span class="dot"></span>'+t+"</div>":v+='<div><span class="dot"></span>'+t+'<span class="caret"></span></div>',v+="<div>"+e.intlMessage({intlName:"stats.NUMBER",num:s[t]})+"</div>",v+="<div>"+Math.round(s[t]/i*100)+"%</div>",v+="</div>",v+="</div>"}),v+="</div>",c.one(".sources-breakdown-list").empty().append(v),r.forEach(function(t,r){var i="",o,u,a;t==="other"||t==="flickr embedr"?(o=n[t].items,u=Object.keys(o),a=s[t],typeof a.viewcount!="undefined"&&(a=a.viewcount),i='<div class="referrer-row-breakdown" data-index="'+r+'" data-group="'+t+'">'+e.createOtherReferrerListRowsHTML(u,o,a,t)+"</div>"):(o=n[t],u=Object.keys(o),a=s[t],i='<div class="referrer-row-breakdown" data-index="'+r+'" data-group="'+t+'">'+e.createReferrerListRowsHTML(u,o,a,t)+"</div>"),c.one('.referrer-row[data-category="'+t+'"]').append(i)}))},createOverallPieChart:function(t,n,r,i,s){i||(i=!1);var o,u,a,f,l=this.get("outerRadius"),c=this.get("innerRadius"),h=501,p=this.get("container"),d=".sources-pie-chart",v=p.one(d).one("svg .overall"),m,g=0;n.forEach(function(e){var t=r[e];typeof t.viewcount!="undefined"&&(t=t.viewcount),g+=t}),m=e.d3.scale.linear().domain([1,n.length]).range(["#00aaff","#18297f"]),u=e.d3.svg.arc().innerRadius(c).outerRadius(l),s&&v&&(e.d3.select(this.viewClass+" "+d+" svg").remove(),v=!1),v?i?(a=e.d3.layout.pie().startAngle(0*Math.PI).endAngle(-2*Math.PI).value(function(e,t){var n=r[e];return typeof n.viewcount!="undefined"&&(n=n.viewcount),n}).sort(null),o=e.d3.select(this.viewClass+" "+d+" svg .overall"),f=o.datum(n).selectAll("path").call(function(t){t.transition().delay(function(e,t){var i=0,s=0,o=0;if(t>0){for(o=t-1;o>=0;--o)typeof r[n[o]].viewcount!="undefined"?s+=r[n[o]].viewcount:s+=r[n[o]];i=s/g*h}return i}).duration(function(e,t){var n=0;return n=e.value/g*h,n}).ease("linear").attrTween("d",function(t){var n=e.d3.interpolate(t.startAngle,t.endAngle);return function(e){return t.startAngle=n(e),u(t)}})})):(a=e.d3.layout.pie().startAngle(2*Math.PI).endAngle(0*Math.PI).value(function(e,t){var n=r[e];return typeof n.viewcount!="undefined"&&(n=n.viewcount),n}).sort(null),o=e.d3.select(this.viewClass+" "+d+" svg .overall"),f=o.selectAll("path"),f.data().map(function(e,t){e.startAngle=e.originalStartAngle,e.endAngle=e.originalEndAngle}),f.call(function(t){t.transition().delay(function(e,t){var i=0,s=0,o=0;for(o=t+1;o<n.length;o++)typeof r[n[o]].viewcount!="undefined"?s+=r[n[o]].viewcount:s+=r[n[o]];return i=s/g*h,i}).duration(function(e,t){var n=0;return n=e.value/g*h,n}).ease("linear").attrTween("d",function(t){var n=e.d3.interpolate(t.endAngle,t.startAngle);return function(e){return t.startAngle=n(e),u(t)}})}),e.d3.select(this.viewClass+" "+d+" svg text").text(g)):(a=e.d3.layout.pie().
startAngle(0*Math.PI).endAngle(2*Math.PI).value(function(e,t){var n=r[e];return typeof n.viewcount!="undefined"&&(n=n.viewcount),n}).sort(null),o=e.d3.select(this.viewClass+" "+d).append("svg").attr("class","pie").attr("width",t.width+t.margin.left+t.margin.right).attr("height",t.height+t.margin.top+t.margin.bottom).append("g").attr("class","overall").attr("height",t.height+t.margin.top+t.margin.bottom).attr("width",l*2).attr("transform","translate("+t.width/2+", "+l+")"),f=o.datum(n).selectAll("path").data(a).enter().append("path").attr("data-source",function(e){return e.data}).on("mouseenter",function(e,t){var n=this.get("container"),r,i;r=n.all(".source-breakdown-right .referrer-row"),i=n.all(".source-breakdown-left .pie-chart .overall path"),r.removeClass("temp-selected"),r.getDOMNodes()[t].setAttribute("class",r.getDOMNodes()[t].getAttribute("class")+" temp-selected"),i.setAttribute("class","not-selected"),i.getDOMNodes()[t].setAttribute("class","")}.bind(this)).on("mouseleave",function(e,t){var n=this.get("container"),r,i;r=n.all(".source-breakdown-right .referrer-row"),i=n.all(".source-breakdown-left .pie-chart .overall path"),r.removeClass("temp-selected"),i.setAttribute("class","")}.bind(this)).transition().delay(function(e,t){var i=0,s=0,o=0;if(t>0){for(o=t-1;o>=0;--o)typeof r[n[o]].viewcount!="undefined"?s+=r[n[o]].viewcount:s+=r[n[o]];i=s/g*h}return i}).duration(function(e,t){var n=0;return n=e.value/g*h,n}).ease("linear").attrTween("d",function(t){var n=e.d3.interpolate(t.startAngle,t.endAngle);return function(e){return t.endAngle=n(e),u(t)}}).each("end",function(e,t){e.originalStartAngle=e.startAngle,e.originalEndAngle=e.endAngle}),o.append("text").attr("transform","translate(0, 5)").attr("fill-opacity",0).text(g).transition().delay(h/2).duration(h/2).attr("fill-opacity",1))},createPieChart:function(t,n,r,i,s,o,u){u||(u=!1);var a,f,l,c,h=this.get("outerRadius"),p=this.get("innerRadius"),d=501,v=this.get("container"),m=".sources-pie-chart",g=v.one(m).one("svg ."+t),y,b=0,w=r.length;return r.forEach(function(e){var t=i[e];typeof t.viewcount!="undefined"&&(t=t.viewcount),b+=t}),y=e.d3.scale.linear().domain([1,r.length]).range(["#00aaff","#18297f"]),f=e.d3.svg.arc().innerRadius(p).outerRadius(h),g?u===!0?b===0?(l=e.d3.layout.pie().startAngle(0*Math.PI).endAngle(2*Math.PI).value(function(e,t){return 1}).sort(null),a=e.d3.select(this.viewClass+" "+m+" svg ."+t),c=a.datum(r).selectAll("path").call(function(t){t.transition().delay(function(e,t){var n=0,i=0,s=0;for(s=t+1;s<r.length;s++)i+=1;return n=i/w*d,n}).duration(function(e,t){var n=0;return n=e.value/w*d,n}).ease("linear").attrTween("d",function(t){var n=e.d3.interpolate(t.endAngle,t.startAngle);return function(e){return t.endAngle=n(e),f(t)}}).each("end",function(e,t){e.originalStartAngle=e.startAngle,e.originalEndAngle=e.endAngle})})):(l=e.d3.layout.pie().startAngle(0*Math.PI).endAngle(2*Math.PI).value(function(e,t){var n=i[e];return typeof n.viewcount!="undefined"&&(n=n.viewcount),n}).sort(null),a=e.d3.select(this.viewClass+" "+m+" svg ."+t),c=a.datum(r).selectAll("path").call(function(t){t.transition().delay(function(e,t){var n=0,s=0,o=0;for(o=t+1;o<r.length;o++)typeof i[r[o]].viewcount!="undefined"?s+=i[r[o]].viewcount:s+=i[r[o]];return n=s/b*d,n}).duration(function(e,t){var n=0;return n=e.value/b*d,n}).ease("linear").attrTween("d",function(t){var n=e.d3.interpolate(t.endAngle,t.startAngle);return function(e){return t.endAngle=n(e),f(t)}}).each("end",function(e,t){e.originalStartAngle=e.startAngle,e.originalEndAngle=e.endAngle})})):u==="fakeClose"?(l=e.d3.layout.pie().startAngle(0*Math.PI).endAngle(-2*Math.PI).value(function(e,t){var n=i[e];return typeof n.viewcount!="undefined"&&(n=n.viewcount),n}).sort(null),a=e.d3.select(this.viewClass+" "+m+" svg ."+t),c=a.datum(r).selectAll("path").call(function(t){t.transition().delay(function(e,t){var n=0,s=0,o=0;if(t>0){for(o=t-1;o>=0;--o)typeof i[r[o]].viewcount!="undefined"?s+=i[r[o]].viewcount:s+=i[r[o]];n=s/b*d}return n}).duration(function(e,t){var n=0;return n=e.value/b*d,n}).ease("linear").attrTween("d",function(t){var n=e.d3.interpolate(t.startAngle,t.endAngle);return function(e){return t.startAngle=n(e),f(t)}})})):(l=e.d3.layout.pie().startAngle(2*Math.PI).endAngle(0*Math.PI).value(function(e,t){var n=i[e];return typeof n.viewcount!="undefined"&&(n=n.viewcount),n}).sort(null),a=e.d3.select(this.viewClass+" "+m+" svg ."+t),c=a.selectAll("path"),c.data().map(function(e,t){e.startAngle=e.originalStartAngle,e.endAngle=e.originalEndAngle}),c.call(function(t){t.transition().delay(function(e,t){var n=0,s=0,o=0;for(o=t+1;o<r.length;o++)typeof i[r[o]].viewcount!="undefined"?s+=i[r[o]].viewcount:s+=i[r[o]];return n=s/b*d,n}).duration(function(e,t){var n=0;return n=e.value/b*d,n}).ease("linear").attrTween("d",function(t){var n=e.d3.interpolate(t.endAngle,t.startAngle);return function(e){return t.startAngle=n(e),f(t)}})}),e.d3.select(this.viewClass+" "+m+" svg text").text(b)):(b===0?(l=e.d3.layout.pie().startAngle(0*Math.PI).endAngle(2*Math.PI).value(function(e,t){return 1}).sort(null),a=e.d3.select(this.viewClass+" "+m+" svg").append("g").attr("class",t).attr("referrerkey",s).attr("parentreferrerkey",o).attr("height",n.height+n.margin.top+n.margin.bottom).attr("width",h*2).attr("transform","translate("+n.width/2+", "+h+")"),c=a.datum(r).selectAll("path").data(l).enter().append("path").attr("data-source",function(e){var t=e.data;if(s==="flickr"||s==="other"||s==="flickr embedr")t="";return t}).attr("fill",function(e,t){var n="";if(s==="flickr"||s==="other"||s==="flickr embedr"||o)n=y(t);return n}).transition().delay(function(e,t){var n=0,r=0,i=0;if(t>0){for(i=t-1;i>=0;--i)r+=1;n=r/w*d}return n}).duration(function(e,t){var n=0;return n=e.value/w*d,n}).ease("linear").attrTween("d",function(t){var n=e.d3.interpolate(t.startAngle,t.endAngle);return function(e){return t.endAngle=n(e),f(t)}}).each("end",function(e,t){e.originalStartAngle=e.startAngle,e.originalEndAngle=e.endAngle})):(l=e.d3.
layout.pie().startAngle(0*Math.PI).endAngle(2*Math.PI).value(function(e,t){var n=i[e];return typeof n.viewcount!="undefined"&&(n=n.viewcount),n}).sort(null),a=e.d3.select(this.viewClass+" "+m+" svg").append("g").attr("class",t).attr("referrerkey",s).attr("parentreferrerkey",o).attr("height",n.height+n.margin.top+n.margin.bottom).attr("width",h*2).attr("transform","translate("+n.width/2+", "+h+")"),c=a.datum(r).selectAll("path").data(l).enter().append("path").attr("data-source",function(e){var t=e.data;if(s==="flickr"||s==="other"||s==="flickr embedr")t="";return t}).attr("fill",function(e,t){var n="";if(s==="flickr"||s==="other"||s==="flickr embedr"||o)n=y(t);return n}).on("mouseenter",function(e,n){var r=this.get("container"),i,u,a;o?(i=r.all('.source-breakdown-right .referrer-row .referrer-row-breakdown-row[data-parentcategory="'+o+'"][data-referrer="'+s+'"] .referrer-row-breakdown-row-breakdown-row:not(.not-shown)'),u=r.all(".source-breakdown-left .pie-chart ."+t+'[referrerkey="'+s+'"] path'),i.removeClass("selected"),a=i.getDOMNodes()[n],a&&a.setAttribute("class","referrer-row-breakdown-row-breakdown-row temp-selected")):(i=r.all('.source-breakdown-right .referrer-row .referrer-row-breakdown[data-group="'+s+'"] .referrer-row-breakdown-row'),u=r.all(".source-breakdown-left .pie-chart ."+t+'[referrerkey="'+s+'"] path'),i.removeClass("selected"),i.getDOMNodes()[n].setAttribute("class","referrer-row-breakdown-row temp-selected")),u.setAttribute("class","not-selected"),u.getDOMNodes()[n].setAttribute("class","")}.bind(this)).on("mouseleave",function(e,n){var r=this.get("container"),i,u;o?(i=r.all('.source-breakdown-right .referrer-row .referrer-row-breakdown-row[data-parentcategory="'+o+'"][data-referrer="'+s+'"] .referrer-row-breakdown-row-breakdown-row'),u=r.all(".source-breakdown-left .pie-chart ."+t+'[referrerkey="'+s+'"] path')):(i=r.all('.source-breakdown-right .referrer-row .referrer-row-breakdown[data-group="'+s+'"] .referrer-row-breakdown-row'),u=r.all(".source-breakdown-left .pie-chart ."+t+'[referrerkey="'+s+'"] path')),i.removeClass("temp-selected"),u.setAttribute("class","")}.bind(this)).transition().delay(function(e,t){var n=0,s=0,o=0;if(t>0){for(o=t-1;o>=0;--o)typeof i[r[o]].viewcount!="undefined"?s+=i[r[o]].viewcount:s+=i[r[o]];n=s/b*d}return n}).duration(function(e,t){var n=0;return n=e.value/b*d,n}).ease("linear").attrTween("d",function(t){var n=e.d3.interpolate(t.startAngle,t.endAngle);return function(e){return t.endAngle=n(e),f(t)}}).each("end",function(e,t){e.originalStartAngle=e.startAngle,e.originalEndAngle=e.endAngle})),e.d3.select(this.viewClass+" "+m+" svg text").text(b)),a},createReferrerBreakdownListRowsHTML:function(t,n,r,i){var s=this,o="",u,a,f=5;return u=Object.keys(t),a=e.d3.scale.linear().domain([0,u.length-1]).range(["#00aaff","#18297f"]),o='<div class="referrer-row-breakdown-row-breakdown">',u.forEach(function(r,i){var u,l,c,h="",p=!1,d=t[r].viewcount;u="referrer-row-breakdown-row-breakdown-row",i>=f&&(u+=" not-shown"),l=e.Escape.html(t[r].displaytext);if(l.toLowerCase()==="direct"||l==="/")t[r].platform&&(l=t[r].platform.split(".")[1]),t[r].link&&t[r].link!==""&&t[r].link!=="/"&&(l=t[r].link);t[r].link&&t[r].link!==""&&t[r].link!=="/"&&(p=!0,c=e.Escape.html(t[r].link)),h=' style="background: '+a(i)+';"',p?o+='<a class="'+u+'" title="'+l+'" href="'+c+'" target="_blank">':o+='<div class="'+u+'" title="'+l+'">',o+='<div><span class="dot"'+h+"></span>"+l+"</div>",o+="<div>"+s.intlMessage({intlName:"stats.NUMBER",num:d})+"</div>",o+="<div>"+Math.round(d/n*100)+"%</div>",p?o+="</a>":o+="</div>"}),u.length>f&&(o+='<div class="show-whole-list">'+s.intlMessage({intlName:"stats.SHOW_ALL"})+"</div>"),o+="</div>",o},createReferrerListRowsHTML:function(t,n,r,i){var s="",o=this,u,a="";return u=e.d3.scale.linear().domain([0,t.length-1]).range(["#00aaff","#18297f"]),t.forEach(function(e,t){var f=n[e],l=e;l.toLowerCase()==="sets"&&(l="Albums"),typeof f.viewcount!="undefined"&&(f=f.viewcount);if(i==="flickr"||i==="other"||i==="flickr embedr")a=' style="background: '+u(t)+';"';s+='<div class="referrer-row-breakdown-row" title="'+l+'" data-parentcategory="'+i+'" data-referrer="'+e+'" data-isempty="'+!n[e].items+'">',s+='<div class="header">',n[e].items?s+='<div><span class="dot"'+a+"></span>"+l+'<span class="caret"></span></div>':s+='<div><span class="dot"'+a+"></span>"+l+"</div>",s+="<div>"+o.intlMessage({intlName:"stats.NUMBER",num:f})+"</div>",r>0?s+="<div>"+Math.round(f/r*100)+"%</div>":s+="<div>0%</div>",s+="</div>",n[e].items&&(s+=o.createReferrerBreakdownListRowsHTML(n[e].items,f,i,e)),s+="</div>"}),s},createOtherReferrerListRowsHTML:function(t,n,r,i){var s=this,o="",u;return u=e.d3.scale.linear().domain([0,t.length-1]).range(["#00aaff","#18297f"]),t.forEach(function(t,a){var f,l,c="",h=!1,p=n[t].viewcount;f=e.Escape.html(n[t].displaytext);if(f.toLowerCase()==="direct"||f==="/")n[t].platform&&(f=n[t].platform.split(".")[1]),n[t].link&&n[t].link!==""&&n[t].link!=="/"&&(f=n[t].link);n[t].link&&n[t].link!==""&&n[t].link!=="/"&&(h=!0,l=e.Escape.html(n[t].link)),c=' style="background: '+u(a)+';"',h?o+='<a class="referrer-row-breakdown-row" title="'+f+'" href="'+l+'" target="_blank" data-parentcategory="'+i+'">':o+='<div class="referrer-row-breakdown-row" title="'+f+'" data-parentcategory="'+i+'">',o+='<div class="header">',o+='<div><span class="dot"'+c+"></span>"+f+'<span class="caret"></span></div>',o+="<div>"+s.intlMessage({intlName:"stats.NUMBER",num:p})+"</div>",o+="<div>"+Math.round(p/r*100)+"%</div>",o+="</div>",h?o+="</a>":o+="</div>"}),o},destructor:function(){this.tooltip&&(this.showTooltip=!1,this.tooltip.close(),this.tooltip=undefined)}},{ATTRS:{innerRadius:{value:29},outerRadius:{value:0}}})},"@VERSION@",{requires:["flickr-view","flickrui-css","hermes-template-stats-photo","photo-sidebar-actions-css","stats-photo-css","pika-day-css","moment","timezone-helper","stats-helper","photo-models","photo-engagement-models","photo-stats-models","stats-photo-daily-views-models"
,"stats-referrer-domains-models"],optional:[],langBundles:["common","stats","pika-day","photo-page-scrappy"]});
YUI.add("hermes-lang-stats",function(e,t){e.Intl.add("hermes/stats","en-US",{STATS:["Stats"],NUMBER:[{type:"number",valueName:"num"}],NUMBER_VIEWS:[{type:"number",valueName:"num"}," views"],NUMBER_FAVES:[{type:"number",valueName:"num"}," faves"],NUMBER_COMMENTS:[{type:"number",valueName:"num"}," comments"],VIEW_COUNTS:["View Counts"],SO_FAR_TODAY:["So far today"],SO_FAR_TODAY_DOT_DOT_DOT:["So far today..."],YESTERDAY:["Yesterday"],ALL_TIME:["All time"],PHOTOS_AND_VIDEOS:["Photos and Videos"],PHOTOS:["Photos"],VIDEOS:["Videos"],PHOTOSTREAM:["Photostream"],ALBUMS:["Albums"],COLLECTIONS:["Collections"],GALLERIES:["Galleries"],TOTAL:["Total"],TOP_PHOTOS_AND_VIDEOS:["Top photos and videos"],CONTENT_BREAKDOWN:["Content Breakdown <span>(",{type:"number",valueName:"num"}," items)</span>"],VIEWS:["Views"],ALL_TIME_VIEWS:["All Time views"],ALL_TIME_FAVES:["All time faves"],ALL_TIME_COMMENTS:["All time comments"],DATE:["Date"],INTERESTINGNESS:["Interestingness"],FAVORITES:["Favorites"],COMMENTS:["Comments"],RECENT_VIEWS:["Recent views"],RECENT_FAVES:["Recent faves"],RECENT_COMMENTS:["Recent comments"],BACK_TO_STATS:["Back to Stats"],SOURCE_BREAKDOWN:["Source breakdown"],ALL_PHOTO_AND_VIDEOS_LINK:["All photos and videos"],VISITS:["Visits"],PRO_UNTIL_DATE:["PRO until ","${date}"],PRO_SINCE_DATE:["PRO since ","${date}"],PRO_SINCE_MONTHYEAR:["PRO since ",{type:"date",valueName:"intlDate",format:"monthYear"}],PRO_UNTIL_MONTHYEAR:["PRO until ",{type:"date",valueName:"intlDate",format:"monthYear"}],LEARN_MORE:["Learn more"],CURRENT_STATS_DATE:["Stats are shown in GMT, where it's currently ","${time}"," on ","${date}"],CURRENT_STATS_LONGDATE:["Stats are shown in GMT, where it's currently ","${time}"," on ",{type:"date",valueName:"intlDate",format:"long"}],SPACE_USED_LIMITED:["${used}"," of ","${total}"," used"],SPACE_USED_UNLIMITED:["${used}"," of unlimited used"],PUBLIC:["Public"],FRIENDS:["Friends"],FAMILY:["Family"],FF:["Friends and Family"],PRIVATE:["Private"],TAGGED:["Tagged"],GEOTAGGED:["Geotagged"],IN_ALBUMS:["In albums"],IN_GROUPS:["In groups"],VIEWED:["Viewed"],FAVED:["Faved"],COMMENTED:["Commented"],NO_SOURCES_TODAY:["No sources for this day"],NO_VIEWS_TODAY:["No photos have been viewed today"],PERCENTAGE_OF_VIEWS:[{type:"number",valueName:"num"},"% of views"],PERCENTAGE_OF_FAVES:[{type:"number",valueName:"num"},"% of faves"],PERCENTAGE_OF_COMMENTS:[{type:"number",valueName:"num"},"% of comments"],TODAY:["Today"],SOURCES:["Sources"],LOAD_MORE:["Load more"],NEXT:["Next"],PREVIOUS:["Previous"],MEDIA:["Media"],VISIBILITY:["Visibility"],ALPHA_LABEL:["Stats Alpha"],BETA_LABEL:["Stats Beta"],SHOW_ALL:["Show all"],PHOTO_STATS:["Photo stats"],EXPAND_ALL:["Expand all"],COLLAPSE_ALL:["Collapse all"],NO_PHOTO_STATS_AVAILABLE:["No stats available for this photo"],NO_RECENT_PHOTO_STATS_AVAILABLE:["No recent stats available for this photo"],WELCOME_TO_STATS:["Welcome to stats"],WELCOME_MODAL_SCREEN_1:["Easily see your all time data"],WELCOME_MODAL_SCREEN_2:["More powerful navigation"],WELCOME_MODAL_SCREEN_3:["More meaningful data, categories, and social sources"],WELCOME_MODAL_SCREEN_2_QUICK:["Quickly access your data with improved navigation"],WORKING_ON_IT:["We're working on it"],STATS_LOADING:["We're having some trouble displaying stats at the moment. Please try again."]})},"@VERSION@",{requires:["intl"]});
YUI.add("hermes-lang-pika-day",function(e,t){e.Intl.add("hermes/pika-day","en-US",{DATE_FORMAT:["MM-DD-YYYY"],PREVIOUS_MONTH:["Previous Month"],NEXT_MONTH:["Next Month"],JANUARY:["January"],FEBRUARY:["February"],MARCH:["March"],APRIL:["April"],MAY:["May"],JUNE:["June"],JULY:["July"],AUGUST:["August"],SEPTEMBER:["September"],OCTOBER:["October"],NOVEMBER:["November"],DECEMBER:["December"],SUNDAY:["Sunday"],MONDAY:["Monday"],TUESDAY:["Tuesday"],WEDNESDAY:["Wednesday"],THURSDAY:["Thursday"],FRIDAY:["Friday"],SATURDAY:["Saturday"],SUNDAY_SHORT:["S"],MONDAY_SHORT:["M"],TUESDAY_SHORT:["T"],WEDNESDAY_SHORT:["W"],THURSDAY_SHORT:["T"],FRIDAY_SHORT:["F"],SATURDAY_SHORT:["S"]})},"@VERSION@",{requires:["intl"]});
YUI.add("mobile-photo-engagement-view",function(e,t){var n=require("lib/flog")(t);e.FlickrView.create(this.name,e.FlickrView,[],{langBundles:this.details.langBundles,subviewConfig:{"vr-overlay-view":{requiredToShowOnClient:!0,requiredToShowOnServer:!0,isMobile:!0,disabled:function(){return!this.appContext.flipper.isFlipped("enable-vr")}}},initializer:function(e){return this.photoId=e.photoId,this.isOwner=e.isOwner,this.nsid=e.nsid,this},loadState:function(){var t=this,r={};return r.photoEngagement=this.appContext.getModel("photo-engagement-models",this.photoId),r.photo=this.appContext.getModel("photo-models",this.photoId),this.isOwner&&(r.personModel=this.appContext.getModel("person-models",this.nsid)),(new e.FlickrPromise(r)).then(function(e){t.set("photo-engagement",e.photoEngagement),t.set("photo",e.photo)},function(e){n.error("Error loadState",{err:e})})},buildContainer:function(){var e=this.get("photo-engagement"),t=e.toJSON(),n=!1,r=25,i=25;return t.commentCount>100&&(i=45),t.faveCount>100&&(r=45),this.isOwner&&this.appContext.flipper.isFlipped("rebootify-stats")&&this.isPro&&this.dailyViewsModel&&this.dailyViewsModel.getValue("totals").views>0&&(n=!0),this.setContainerWithTemplate("mobile-photo-engagement",{engagement:e.toJSON(),isMobileStats:this.isMobileStats,commentSvgMargin:i,faveSvgMargin:r,showMoreStatsLink:n}),this},activate:function(){var t=this.get("photo-engagement"),n=this.get("container"),r=this;return this.registerEventHandler(n.delegate("click",this.onFaveClick.bind(this),".fave-count")),this.registerEventHandler(n.delegate("click",this.onShareClick.bind(this),".share-container")),this.registerEventHandler(n.delegate("click",this.onCommentClick.bind(this),".comment-count")),t&&this.registerEventHandler(t.on("valuesChanged",function(n){var i,s=typeof n.faveCount!="undefined"||typeof n.isFaved!="undefined"||typeof n.canFave!="undefined";if(!s){typeof n["commentCount"]!="undefined"&&r.buildContainer();return}r.processingFave=!0,r.buildContainer(),i=t.remoteUpdate(),i.then(function(){r.processingFave=!1},function(i){if(i.code!==3){i.code!==5&&e.Object.each(n,function(e,n){t.setValue(n,e.prevVal)});var s=e.Views.dialog.getInstance("dialog-alert",{content:r.intlMessage({intlName:"fave-view.COULDNT_FAVE"}),attrs:{title:r.intlMessage({intlName:"common.ERROR"}),level:"warning",confirmLabel:r.intlMessage({intlName:"common.OK"})},appContext:r.appContext,dialogClass:"scrappy-dialog"});s.show()}r.processingFave=!1}).then(null,function(e){r.processingFave=!1})},r.photoId)),this.subviews["vr-overlay-view"].get("canVr")&&(n.one(".actions-container").addClass("enable-vr"),this.registerEventHandler(n.delegate("click",function(){r.fire("parentViewEvent","vrIconClicked")},".vr-container"))),this},onFaveClick:function(t,n){var r=this,i=this.get("photo-engagement"),s=this.appContext.getUA().os,o=this.appContext.getUA().isWebview,u="photos/"+this.nsid+"/"+this.photoId;t.preventDefault();if(this.processingFave)return;this.processingFave=!0,this.appContext.getViewer().signedIn?i.getValue("canFave")&&(i.registry.toggleFave(this.photoId),e.rapidTracker.beacon(this.name,"faveStarActionBarButtonClick")):(e.use("mobile-actions-helper",function(e){e.MobileActionsHelper.redirectToAppOrStore({os:s,isWebview:o,pageURL:u,beacon:{name:"mpp_fave_signedout",section:"mpp_fave"},viewName:r.name})}),this.processingFave=!1)},onShareClick:function(){var t=this.subviews["vr-overlay-view"]?this.subviews["vr-overlay-view"].get("canVr"):!1,n=50;t&&(n=100);var r=new e.Views.FluidDroparound({appContext:this.appContext,preferLeft:!0,anchorOffsetVertical:-36,mirrorArrowAdjustment:36,anchorOffsetHorizontal:n,showDropArrow:!0,observePageResize:!0,anchorElement:this.get("container").one(".share-container svg"),htmlMessage:this.templates("mobile-share-modal")({shortUrl:e.URLHelper.getShortURL(this.photoId)})});this.registerEventHandler(r.on("activated",function(){var e=r.get("container").one("input")._node;e&&(e.focus(),setTimeout(function(){e.setSelectionRange(0,999)},0))},this)),r.show()},onCommentClick:function(){var t=e.one(".new-comment-text"),n=50,r=this,i=this.appContext.getUA().os,s=this.appContext.getUA().isWebview,o="photos/"+this.nsid+"/"+this.photoId;this.get("container").ancestor(".show-upsell-banner")&&(n=120),this.appContext.getViewer().signedIn?t&&(e.config.win.scrollTo(t.getX(),t.getY()-n),t.focus()):e.use("mobile-actions-helper",function(e){e.MobileActionsHelper.redirectToAppOrStore({os:i,isWebview:s,pageURL:o,beacon:{name:"mpp_comment_signedout",section:"mpp_comment"},viewName:r.name})})}})},"@VERSION@",{requires:["flickr-view","flickrui-css","hermes-template-mobile-photo-engagement","hermes-template-mobile-share-modal","photo-sidebar-actions-css","fluid-modal-view","fluid-droparound-view","stats-photo-view","stats-helper","url-helper"],optional:["photo-engagement-models"],langBundles:["common","photo-page-scrappy","fave-view","settings","info-charm","share-modal"]});
YUI.add("hermes-lang-fave-view",function(e,t){e.Intl.add("hermes/fave-view","en-US",{COULDNT_FAVE:["We couldn't fave at this time"],SIGN_IN_TO_FAVE:["You must be signed in to fave. Please sign in now."],LOADING_FAVES:["Loading Faves..."],UNFAVE_PHOTO:["Unfave this photo"],FAVE_PHOTO:["Fave this photo"],WHO_FAVED:["Who faved this photo"],SIGN_IN_BEFORE_FAVE_TITLE:["You found a photo to fave!"],SIGN_IN_BEFORE_FAVE_MESSAGE:["That's great. Just sign in to fave it."],SIGN_IN_AND_FAVE:["Sign in and fave"],JOIN_FLICKR_AND_FAVE:["Join Flickr to add this photo to your favorites."]})},"@VERSION@",{requires:["intl"]});
YUI.add("hermes-lang-settings",function(e,t){e.Intl.add("hermes/settings","en-US",{SAFE:["Safe"],MODERATE:["Moderate"],RESTRICTED:["Restricted"],PUBLIC:["Public"],PRIVATE:["Private"],ANYONE:["Anyone"],FRIENDS:["Friends"],FAMILY:["Family"],FRIENDS_AND_FAMILY:["Friends & Family"],ONLY_YOU:["Only you"],PEOPLE_YOU_FOLLOW:["People you follow"],ANY_FLICKR_MEMBER:["Any Flickr member"],SOME_RIGHTS_RESERVED:["Some rights reserved"],ALL_RIGHTS_RESERVED:["All rights reserved"],ATTRIBUTION:["Attribution"],ATTRIBUTION_SHAREALIKE:["Attribution-ShareAlike"],ATTRIBUTION_NODERIVS:["Attribution-NoDerivs"],ATTRIBUTION_NONCOMMERCIAL:["Attribution-NonCommercial"],ATTRIBUTION_NONCOMMERCIAL_SHAREALIKE:["Attribution-NonCommercial-ShareAlike"],ATTRIBUTION_NONCOMMERCIAL_NODERIVS:["Attribution-NonCommercial-NoDerivs"],NO_COPYRIGHT_RESTRICTIONS:["No known copyright restrictions"],US_GOV_WORK:["United States government work"],PUBLIC_DOMAIN_DEDICATION:["Public Domain Dedication (CC0)"],PUBLIC_DOMAIN_WORK:["Public Domain Work"]})},"@VERSION@",{requires:["intl"]});
YUI.add("hermes-lang-info-charm",function(e,t){e.Intl.add("hermes/info-charm","en-US",{CHANGE_PRIVACY_ERROR:["There was a problem changing your photo's privacy"],CHANGE_LICENSE_ERROR:["There was a problem changing your photo's license"],CHANGE_SAFETLY_ERROR:["There was a problem changing your photo's safety level"],PUBLIC_PHOTO:["This photo is public"],FRIENDS_AND_FAMILY_PHOTO:["This photo is visible by friends and family"],FRIENDS_PHOTO:["This photo is visible by friends"],FAMILY_PHOTO:["This photo is visible by family"],PRIVATE_PHOTO:["This photo is private"],PUBLIC:["Public"],"FRIENDS AND FAMILY":["Friends & Family"],FAMILY:["Family"],FRIENDS:["Friends"],PRIVATE:["Private"]})},"@VERSION@",{requires:["intl"]});
YUI.add("mobile-photo-page-view",function(e){e.FlickrView.create(this.name,e.FlickrView,[],{langBundles:this.details.langBundles,initializer:function(e){return this.photoId=e.photoId,this.nsid=e.nsid,this.shouldDeferSubviews=!0,this},subviewConfig:{"global-nav-view":{requiredToShowOnClient:!0,requiredToShowOnServer:!0,enableMobileNav:!0},"mobile-attribution-view":{requiredToShowOnClient:!0,requiredToShowOnServer:!0,additionalViewClasses:["clear-float","mobile-photopage-attribution"]},"sub-photo-title-desc-view":{requiredToShowOnClient:!0,isMobile:!0,requiredToShowOnServer:!0},"mobile-photo-engagement-view":{requiredToShowOnClient:!0,requiredToShowOnServer:!0},"mobile-sub-photo-stats-view":{requiredToShowOnClient:!0,requiredToShowOnServer:!0},"mobile-photo-well-view":{requiredToShowOnClient:!0,requiredToShowOnServer:!0},"sub-photo-comments-view":{isOnMobile:!0,canDefer:!0},"photo-charm-exif-scrappy-view":{isMobileExif:!0,additionalViewClasses:["light-background-view"],canDefer:!0},"mobile-sub-photo-license-privacy-view":{additionalViewClasses:["light-background-view"],canDefer:!0},"sub-photo-tags-tag-view":{isMobileTags:!0,additionalViewClasses:["light-background-view"],canDefer:!0},"footer-full-view":{hideMobileBanner:!0,canDefer:!0}},loadState:function(){return e.Promise.resolve()},buildContainer:function(){return this.setContainerWithTemplate("mobile-photo-page"),this},buildHeadContainer:function(){var e=this.templates("head-meta")({isName:!0,metaName:"viewport",metaValue:"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"});this.set("headContainer",e),YUI.Env.isServer||this.updateHead()},activate:function(){return e.FastClick&&e.FastClick.attach(document.body),this},onSubviewEvent:function(e,t){t&&t[0]==="noTags"&&this.get("container").addClass("no-tags")},getTrackingSegments:function(){return{vwrOwner:this.isOwner?1:0}}},{ATTRS:{spaceid:{value:954010555}}}),e.Base.plug(e.Views[this.name],e.Plugin.FlickrView.TTFPRecorderPlugin,{selector:".main-image"})},"@VERSION@",{requires:["flutil","flickr-view","flickr-promise","hermes-template-head-meta","hermes-template-mobile-photo-page","attribution-view","footer-full-view","mobile-photo-well-view","mobile-photo-engagement-view","flickr-view","global-nav-view","url","browser-support","mobile-photo-page-css","ttfp-recorder-plugin"],langBundles:[],optionalRequires:["fastclick"]});
YUI.add("fastclick",function(e,t){(function(){"use strict";function e(t,r){function s(e,t){return function(){return e.apply(t,arguments)}}var i;r=r||{},this.trackingClick=!1,this.trackingClickStart=0,this.targetElement=null,this.touchStartX=0,this.touchStartY=0,this.lastTouchIdentifier=0,this.touchBoundary=r.touchBoundary||10,this.layer=t,this.tapDelay=r.tapDelay||200,this.tapTimeout=r.tapTimeout||700;if(e.notNeeded(t))return;var o=["onMouse","onClick","onTouchStart","onTouchMove","onTouchEnd","onTouchCancel"],u=this;for(var a=0,f=o.length;a<f;a++)u[o[a]]=s(u[o[a]],u);n&&(t.addEventListener("mouseover",this.onMouse,!0),t.addEventListener("mousedown",this.onMouse,!0),t.addEventListener("mouseup",this.onMouse,!0)),t.addEventListener("click",this.onClick,!0),t.addEventListener("touchstart",this.onTouchStart,!1),t.addEventListener("touchmove",this.onTouchMove,!1),t.addEventListener("touchend",this.onTouchEnd,!1),t.addEventListener("touchcancel",this.onTouchCancel,!1),Event.prototype.stopImmediatePropagation||(t.removeEventListener=function(e,n,r){var i=Node.prototype.removeEventListener;e==="click"?i.call(t,e,n.hijacked||n,r):i.call(t,e,n,r)},t.addEventListener=function(e,n,r){var i=Node.prototype.addEventListener;e==="click"?i.call(t,e,n.hijacked||(n.hijacked=function(e){e.propagationStopped||n(e)}),r):i.call(t,e,n,r)}),typeof t.onclick=="function"&&(i=t.onclick,t.addEventListener("click",function(e){i(e)},!1),t.onclick=null)}var t=navigator.userAgent.indexOf("Windows Phone")>=0,n=navigator.userAgent.indexOf("Android")>0&&!t,r=/iP(ad|hone|od)/.test(navigator.userAgent)&&!t,i=r&&/OS 4_\d(_\d)?/.test(navigator.userAgent),s=r&&/OS [6-7]_\d/.test(navigator.userAgent),o=navigator.userAgent.indexOf("BB10")>0;e.prototype.needsClick=function(e){switch(e.nodeName.toLowerCase()){case"button":case"select":case"textarea":if(e.disabled)return!0;break;case"input":if(r&&e.type==="file"||e.disabled)return!0;break;case"label":case"iframe":case"video":return!0}return/\bneedsclick\b/.test(e.className)},e.prototype.needsFocus=function(e){switch(e.nodeName.toLowerCase()){case"textarea":return!0;case"select":return!n;case"input":switch(e.type){case"button":case"checkbox":case"file":case"image":case"radio":case"submit":return!1}return!e.disabled&&!e.readOnly;default:return/\bneedsfocus\b/.test(e.className)}},e.prototype.sendClick=function(e,t){var n,r;document.activeElement&&document.activeElement!==e&&document.activeElement.blur(),r=t.changedTouches[0],n=document.createEvent("MouseEvents"),n.initMouseEvent(this.determineEventType(e),!0,!0,window,1,r.screenX,r.screenY,r.clientX,r.clientY,!1,!1,!1,!1,0,null),n.forwardedTouchEvent=!0,e.dispatchEvent(n)},e.prototype.determineEventType=function(e){return n&&e.tagName.toLowerCase()==="select"?"mousedown":"click"},e.prototype.focus=function(e){var t;r&&e.setSelectionRange&&e.type.indexOf("date")!==0&&e.type!=="time"&&e.type!=="month"?(t=e.value.length,e.setSelectionRange(t,t)):e.focus()},e.prototype.updateScrollParent=function(e){var t,n;t=e.fastClickScrollParent;if(!t||!t.contains(e)){n=e;do{if(n.scrollHeight>n.offsetHeight){t=n,e.fastClickScrollParent=n;break}n=n.parentElement}while(n)}t&&(t.fastClickLastScrollTop=t.scrollTop)},e.prototype.getTargetElementFromEventTarget=function(e){return e.nodeType===Node.TEXT_NODE?e.parentNode:e},e.prototype.onTouchStart=function(e){var t,n,s;if(e.targetTouches.length>1)return!0;t=this.getTargetElementFromEventTarget(e.target),n=e.targetTouches[0];if(r){s=window.getSelection();if(s.rangeCount&&!s.isCollapsed)return!0;if(!i){if(n.identifier&&n.identifier===this.lastTouchIdentifier)return e.preventDefault(),!1;this.lastTouchIdentifier=n.identifier,this.updateScrollParent(t)}}return this.trackingClick=!0,this.trackingClickStart=e.timeStamp,this.targetElement=t,this.touchStartX=n.pageX,this.touchStartY=n.pageY,e.timeStamp-this.lastClickTime<this.tapDelay&&e.preventDefault(),!0},e.prototype.touchHasMoved=function(e){var t=e.changedTouches[0],n=this.touchBoundary;return Math.abs(t.pageX-this.touchStartX)>n||Math.abs(t.pageY-this.touchStartY)>n?!0:!1},e.prototype.onTouchMove=function(e){if(!this.trackingClick)return!0;if(this.targetElement!==this.getTargetElementFromEventTarget(e.target)||this.touchHasMoved(e))this.trackingClick=!1,this.targetElement=null;return!0},e.prototype.findControl=function(e){return e.control!==undefined?e.control:e.htmlFor?document.getElementById(e.htmlFor):e.querySelector("button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea")},e.prototype.onTouchEnd=function(e){var t,o,u,a,f,l=this.targetElement;if(!this.trackingClick)return!0;if(e.timeStamp-this.lastClickTime<this.tapDelay)return this.cancelNextClick=!0,!0;if(e.timeStamp-this.trackingClickStart>this.tapTimeout)return!0;this.cancelNextClick=!1,this.lastClickTime=e.timeStamp,o=this.trackingClickStart,this.trackingClick=!1,this.trackingClickStart=0,s&&(f=e.changedTouches[0],l=document.elementFromPoint(f.pageX-window.pageXOffset,f.pageY-window.pageYOffset)||l,l.fastClickScrollParent=this.targetElement.fastClickScrollParent),u=l.tagName.toLowerCase();if(u==="label"){t=this.findControl(l);if(t){this.focus(l);if(n)return!1;l=t}}else if(this.needsFocus(l)){if(e.timeStamp-o>100||r&&window.top!==window&&u==="input")return this.targetElement=null,!1;this.focus(l),this.sendClick(l,e);if(!r||u!=="select")this.targetElement=null,e.preventDefault();return!1}if(r&&!i){a=l.fastClickScrollParent;if(a&&a.fastClickLastScrollTop!==a.scrollTop)return!0}return this.needsClick(l)||(e.preventDefault(),this.sendClick(l,e)),!1},e.prototype.onTouchCancel=function(){this.trackingClick=!1,this.targetElement=null},e.prototype.onMouse=function(e){return this.targetElement?e.forwardedTouchEvent?!0:e.cancelable?!this.needsClick(this.targetElement)||this.cancelNextClick?(e.stopImmediatePropagation?e.stopImmediatePropagation():e.propagationStopped=!0,e.stopPropagation(),e.preventDefault(),!1):!0:!0:!0},e.prototype.onClick=function(e){var t;return this.trackingClick?
(this.targetElement=null,this.trackingClick=!1,!0):e.target.type==="submit"&&e.detail===0?!0:(t=this.onMouse(e),t||(this.targetElement=null),t)},e.prototype.destroy=function(){var e=this.layer;n&&(e.removeEventListener("mouseover",this.onMouse,!0),e.removeEventListener("mousedown",this.onMouse,!0),e.removeEventListener("mouseup",this.onMouse,!0)),e.removeEventListener("click",this.onClick,!0),e.removeEventListener("touchstart",this.onTouchStart,!1),e.removeEventListener("touchmove",this.onTouchMove,!1),e.removeEventListener("touchend",this.onTouchEnd,!1),e.removeEventListener("touchcancel",this.onTouchCancel,!1)},e.notNeeded=function(e){var t,r,i,s;if(typeof window.ontouchstart=="undefined")return!0;r=+(/Chrome\/([0-9]+)/.exec(navigator.userAgent)||[,0])[1];if(r){if(!n)return!0;t=document.querySelector("meta[name=viewport]");if(t){if(t.content.indexOf("user-scalable=no")!==-1)return!0;if(r>31&&document.documentElement.scrollWidth<=window.outerWidth)return!0}}if(o){i=navigator.userAgent.match(/Version\/([0-9]*)\.([0-9]*)/);if(i[1]>=10&&i[2]>=3){t=document.querySelector("meta[name=viewport]");if(t){if(t.content.indexOf("user-scalable=no")!==-1)return!0;if(document.documentElement.scrollWidth<=window.outerWidth)return!0}}}if(e.style.msTouchAction==="none"||e.style.touchAction==="manipulation")return!0;s=+(/Firefox\/([0-9]+)/.exec(navigator.userAgent)||[,0])[1];if(s>=27){t=document.querySelector("meta[name=viewport]");if(t&&(t.content.indexOf("user-scalable=no")!==-1||document.documentElement.scrollWidth<=window.outerWidth))return!0}return e.style.touchAction==="none"||e.style.touchAction==="manipulation"?!0:!1},e.attach=function(t,n){return new e(t,n)},typeof define=="function"&&typeof define.amd=="object"&&define.amd?define(function(){return e}):typeof module!="undefined"&&module.exports?(module.exports=e.attach,module.exports.FastClick=e):window.FastClick=e})(),
/*!
Copyright (c) 2014 The Financial Times Ltd.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/
e.FastClick=window.FastClick},"@VERSION@",{affinity:"client"});
YUI.add("photo-well-scrappy-view",function(e,t){var n=require("lib/flog")(t),r=1,i=5;e.FlickrView.create(this.name,e.FlickrView,[],{langBundles:this.details.langBundles,initializer:function(t){return this.photoId=t.photoId,this.contextData=e.clone(t.context,!0),this.entryURL=t.backToURL,this.entryTypeIntlKey=t.entryTypeIntlKey,this.isAd=!!t.ad,this.hideBackToLink=t.hideBackToLink||!1,this.publisherUrl=t.publisherUrl,this.get("container").get("innerHTML")===""&&this.setContainerHTML(""),this.numberOfPositionsToPreFetch=t.numberOfPositionsToPreFetch,this.numberOfPositionsToRefetchAt=t.numberOfPositionsToRefetchAt,this},additionalViewClasses:["centered-content"],subviewConfig:{"photo-well-media-scrappy-view":{requiredToShowOnClient:!0,requiredToShowOnServer:!0},"photo-notes-scrappy-view":{requiredToShowOnClient:!1,requiredToShowOnServer:!1,disabled:function(){return!this.appContext.flipper.isFlipped("enable-scrappy-notes")}},"photo-engagement-view":{requiredToShowOnClient:!1,requiredToShowOnServer:!1},"context-slider-scrappy-view":{requiredToShowOnClient:!1,requiredToShowOnServer:!1},"photo-sidebar-toggle-view":{requiredToShowOnClient:!1,requiredToShowOnServer:!1,neverShowOnServer:!0},"attribution-view":{requiredToShowOnClient:!1,requiredToShowOnServer:!1,additionalViewClasses:["is-real-fullscreen","photo-attribution"]},"photo-sidebar-actions-view":{requiredToShowOnClient:!1,requiredToShowOnServer:!1,additionalViewClasses:["is-real-fullscreen"],disabled:function(){return this.appContext.experiments.fullscreen.disableRealFullscreenButtons()}},"people-notes-view":{requiredToShowOnClient:!1,requiredToShowOnServer:!1,disabled:!0}},buildContainer:function(){var e=this,t="",n,r=0,i,s,o=".navigate-prev",u=".navigate-next",a,f,l,c,h,p;return this.subviews["photo-sidebar-actions-view"]&&this.subviews["photo-sidebar-actions-view"].get("container").addClass("is-hidden"),this.appContext.experiments.fullscreen.getMode()?this.subviews["attribution-view"]&&(YUI.Env.isServer||this.subviews["attribution-view"].get("container").removeClass("is-always-hidden"),this.contextData.modelName!=="photoList-models"&&this.contextData.modelName!=="explore-models"&&this.subviews["attribution-view"].get("container").addClass("is-hidden"),t=this.subviews["attribution-view"].get("container")):this.subviews["attribution-view"]&&(this.subviews["attribution-view"].get("container").addClass("is-always-hidden"),t=this.subviews["attribution-view"].get("container")),this.get("contextModel")&&(n=this.get("contextModel").getValue("photoContextList").getList(),n.length>2&&n.some(function(t){return r++,t.getValue("id")===e.photoId})&&(i=n.slice(r-2,r-1),s=n.slice(r,r+1),i&&i.length>0&&(a=e.setupNavLink(i[0],o,"previous"),i[0].getValue("owner")&&(i[0].getValue("title").trim()===""?l=e.intlMessage({intlName:"common.UNTITLED"}):l=i[0].getValue("title"),l+=" | "+e.intlMessage({intlName:"common.BY_USER",user:i[0].getValue("owner").getValue("username")}))),s&&s.length>0&&(f=e.setupNavLink(s[0],u,"next"),s[0].getValue("owner")&&(s[0].getValue("title").trim()===""?c=e.intlMessage({intlName:"common.UNTITLED"}):c=s[0].getValue("title"),c+=" | "+e.intlMessage({intlName:"common.BY_USER",user:s[0].getValue("owner").getValue("username")}))))),h=this.getPhotoWellHeight(),p=h-70,this.setContainerWithTemplate("photo-well-scrappy",{"photo-sidebar-actions-view":this.subviews["photo-sidebar-actions-view"]?this.subviews["photo-sidebar-actions-view"].get("container"):"","photo-well-media-view":this.subviews["photo-well-media-scrappy-view"]?this.subviews["photo-well-media-scrappy-view"].get("container"):"","context-slider-view":this.subviews["context-slider-scrappy-view"]?this.subviews["context-slider-scrappy-view"].get("container"):"","is-hidden":!a&&!f,"prev-is-not-clickable":!a,"next-is-not-clickable":!f,"prev-url":a,"next-url":f,"prev-title":l,"next-title":c,"is-ad":this.isAd,"attribution-view":t,height:h,navHeight:p,entryURL:this.entryURL,backToLabel:this.intlMessage({intlName:"photo-page-scrappy."+this.entryTypeIntlKey}),enableZoom:this.appContext.flipper.isFlipped("enable-scrappy-zoom"),hideBackToLink:this.hideBackToLink}),YUI.Env.isServer||(this.subviews["photo-well-media-scrappy-view"]&&this.subviews["photo-well-media-scrappy-view"].fire("parentViewEvent","photoWellResized"),this.subviews["photo-notes-scrappy-view"]&&this.subviews["photo-notes-scrappy-view"].fire("parentViewEvent","photoWellResized")),YUI.Env.isServer&&(this.serverWidth=this.subviews["photo-well-media-scrappy-view"].serverWidth,this.serverHeight=this.subviews["photo-well-media-scrappy-view"].serverHeight),this},loadState:function(){var t=this,r=[];return r.push(this.appContext.getModel("photo-models",this.photoId).then(function(e){if(!e)throw new Error("[photo-well-view] Invalid photoModel returned from getModel");t.set("photo",e)})),this.contextData&&this.contextData.modelName&&this.contextData.params&&r.push(this.appContext.getModelRegistry(this.contextData.modelName).then(function(e){var r;if(e){r=e.attributeSearch(t.contextData.params);if(r&&r.length&&e.exists(r[0]))return t.appContext.getModel(t.contextData.modelName,r[0]).then(function(e){e&&t.set("contextModel",e)},function(e){return n.error("photo not found in context. Loading photostream instead.",{err:e}),t.loadPhotostreamContext()})}}).catch(function(){return"whatever"})),e.Promise.all(r)},buildHeadContainer:function(){var e=this.templates("photo-page-right-size-express")({photoWidth:this.get("photo").getLargestSize().width,photoHeight:this.get("photo").getLargestSize().height});return this.set("headContainer",e),this},setLinkAsAdFriendly:function(e){var t=e.currentTarget;t.hasClass("navigate-next")?this.appContext.adManager.setAdCouldBeShown(!0,"next",t.getAttribute("href")):this.appContext.adManager.setAdCouldBeShown(!0,"previous",t.getAttribute("href"))},animateNavigation:function(){var t=e.all(".navigate-target"),n=this.get("container"),r=n.one(".photo-sidebar-toggle-view"),i=n.one(".attribution-view"),s=1500,o=250,u=!1
,a=!1,f,l=!0,c=this;s=(s-500)/2,u=!0,a=this.appContext.experiments.fullscreen.getMode(),this.registerEventHandler(this.get("container").on("mousemove",e.betterThrottle(function(e){f=n.one(".photo-sidebar-actions-view"),t&&l&&t.removeClass("is-hidden"),u&&l&&(f&&f.removeClass("is-hidden"),r&&r.removeClass("is-hidden"),i&&i.removeClass("is-hidden")),clearTimeout(c.movingTimeout),clearTimeout(c.initialTimeout),l=!0,c.movingTimeout=setTimeout(function(){f=n.one(".photo-sidebar-actions-view"),u&&(f&&f.addClass("is-hidden"),i&&i.addClass("is-hidden"))},s*2)},o))),this.contextData.modelName!=="photoList-models"&&this.contextData.modelName!=="explore-models"&&(l=!1),c.initialTimeout=setTimeout(function(){l=!0,f=n.one(".photo-sidebar-actions-view"),u&&l&&(f&&f.addClass("is-hidden"),i&&i.addClass("is-hidden"))},s*2)},activate:function(){var t=this,s=this.contextData,o=0,u,a,f,l,c,h=".navigate-prev",p=".navigate-next",d=this.appContext.getViewer().prefs.keyboardShortcutsEnabled;return YUI.Env.isServer||(a=e.getLocation(),f=a.protocol,l=a.hostname,t.appContext.getModel(s.modelName,s.params).then(function(e){t.set("contextModel",e)},function(n){if(!n.getModelFailure&&n.code!==1||s.modelName==="photostream-models")throw e.one(h).hide(),e.one(p).hide(),n;return t.contextData.modelName="photostream-models",t.contextData.params.id=t.get("photo").getValue("owner").getValue("nsid"),t.appContext.getModel("photostream-models",t.contextData.params).then(function(e){t.set("contextModel",e)})}).then(function(){var n=t.get("contextModel").getValue("photoContextList"),r=n.getList(),i,u,a,d;return r.length>2&&r.some(function(e){return o++,e.getValue("id")===t.photoId})&&(i=r.slice(o-2,o-1),u=r.slice(o,o+1),i&&i.length>0&&(a=t.setupNavLink(i[0],h,"previous"),a&&(t.updateNavLinks(t.get("container").one(h),f,l,a),t.get("container").one(h).removeClass("no-click"))),u&&u.length>0&&(d=t.setupNavLink(u[0],p,"next"),d&&(t.updateNavLinks(t.get("container").one(p),f,l,d),t.get("container").one(p).removeClass("no-click")))),c=e.merge(s.params,{photoId:t.photoId,numNext:t.numberOfPositionsToPreFetch,numPrev:t.numberOfPositionsToPreFetch,refetchAt:t.numberOfPositionsToRefetchAt}),n.getContext(c)}).then(function(s){function o(o,u){var a=t.get("container").one(o),c,h,p,d,v,m,g=s&&s[u]&&s[u].length,y;if(!a)return;if(!g){a.remove();return}a.removeClass("no-click"),c=t.setupNavLink(s[u][0],o,u);if(t.isAd)p=t.appContext.adManager.origin,u===p.arrow?(a.setAttribute("href",p.url),a.removeClass("is-hidden")):(a.setAttribute("href",c),a.removeClass("is-hidden"));else{t.updateNavLinks(a,f,l,c),h=t.subviews["photo-well-media-scrappy-view"].getCanvasSize();for(m=0;m<i;m++){if(!s[u][m])break;d=s[u][m].getSizeToFit(h,{includeSizes:["sq","q","t","s","n"]}),d&&d.url&&(v=new Image,v.src=d.url)}for(m=0;m<r;m++){if(!s[u][m])break;d=s[u][m].getSizeToFit(h),d&&d.url&&(v=new Image,y=e.guid(),e.LH&&e.LH.mark("mark_time_to_load_photo_only_start"+y),v.onload=function(){if(v.onloadFired)return;v.onloadFired=!0;try{e.LH.mark("mark_time_to_load_photo_only"+y);var t=e.LH.measure("time_to_load_photo_only",{startMark:"mark_time_to_load_photo_only_start"+y,endMark:"mark_time_to_load_photo_only"+y});window.beaconError&&window.beaconError("time_to_load_photo_only",window.location.href,{duration:t.duration})}catch(r){n.warn("time to load photo: Missing start mark",{err:r})}}),v.src=d.url,v.complete&&(v.onloadFired=!0)}}}t.appContext.adManager.updateContext({prev:s.previous[0],current:t.get("photo"),next:s.next[0],type:t.contextData.modelName,entryURL:t.entryURL}),o(p,"next"),o(h,"previous"),t.animateNavigation(),t.isAd&&t.appContext.adManager.markAdAsSeen()},function(e){if(e.notInContext||e.code===99)return t.get("contextModel").setValue("photoContextList",[]),t.contextData.modelName="photostream-models",t.contextData.params.id=t.get("photo").getValue("owner").getValue("nsid"),t.activate();throw e}).then(null,function(e){n.warn("There was a problem initializing the next/previous controls.",{err:e})}),d&&this.attachKeyEvent("down:37,75,39,74",t.handlePrevNextKeys.bind(t)),this.get("photo").getValue("isOwner")||this.appContext.getViewCounter().queue(this.get("photo").getValue("id"),this.publisherUrl||this.appContext.getReferrer())),u={":ad":t.setLinkAsAdFriendly},d&&!this.hideBackToLink&&this.attachKeyEvent("down:66",function(n){n.preventDefault(),e.rapidTracker.beacon(t.name,"backToContextKeyPress"),t.appContext.flapp.hasRoute(t.entryURL)?t.appContext.flapp.navigate(t.entryURL):e.config.win.location.href=t.entryURL}),t.registerEventHandler(e.on("resize",e.betterThrottle(function(e){t.set("canvasSizeIsDirty",!0),t.buildContainer()},16))),t.buildContainer(),t.attachEvents(u),this},getPhotoWellHeight:function(){var e=500,t=this.appContext.viewportData.getWidth(),n=this.appContext.viewportData.getHeight()-50,r=1,i=2.3,s=2.75,o=120,u=t/r+o,a=t/i+o,f=t/s,l;return n>u?l=t/r:n>a?l=n-o:n>f?l=n-o+o*(n-a)/(f-a):l=n,Math.max(e,Math.round(l))},setupNavLink:function(t,r,i){var s=this.get("container").one(r),o,u;if(!t){s.remove();return}o=t,u=e.URLHelper.getPhotoPage({photoId:o.getValue("id"),pathAlias:o.getValue("owner").getValue("pathAlias"),contextSuffix:this.get("contextModel").getValue("urlSuffix")});if(!u||u==="#"){n.warn("Invalid next/prev URL",{url:u}),s.remove();return}return u},updateNavLinks:function(e,t,n,r){e.setAttribute("href",t+"//"+n+r),e.removeClass("is-hidden")},destructor:function(){clearTimeout(this.movingTimeout),clearTimeout(this.initialTimeout),this.movingTimeout=null,this.initialTimeout=null},handlePrevNextKeys:function(t){var r=this,i,s,o,u=50;if(t.button===37||t.button===75)s=".navigate-prev",o="previous",e.rapidTracker.beacon(this.name,"prevPhotoKeyPress");else if(t.button===39||t.button===74)s=".navigate-next",o="next",e.rapidTracker.beacon(this.name,"nextPhotoKeyPress");s&&r.get("container").one(s)&&(t.preventDefault(),i=r.get("container").one(s).getAttribute("href"),i&&i!=="#"&&(r.keyboardNavigation&&r.keyboardNavigation.url&&i===r.keyboardNavigation
.url&&(new Date).getTime()-r.keyboardNavigation.time<u?n.log("Ignoring duplicate keyboard navigation",{url:i}):(r.keyboardNavigation={url:i,time:(new Date).getTime()},this.appContext.adManager.setAdCouldBeShown(!0,o,i),r.appContext.flapp.navigate(i))))},handleContextMenu:function(e){e.preventDefault(),this.fire("parentViewEvent","rightClickPhoto")}})},"@VERSION@",{requires:["yui-throttle","flickr-view","hermes-template-photo-well-scrappy","photo-well-scrappy-css","url-helper","better-throttle","hermes-template-photo-page-right-size-express"],optional:["photo-well-media-scrappy-view","context-slider-scrappy-view","photo-engagement-view","photo-models","photo-route"],langBundles:["common","photo-page-scrappy"]});