YUI.add("gallery-selection-dialog-view",function(e,t){var n=require("lib/flog")(t);e.namespace("Views")[this.name]=e.Base.create("gallery-selection-dialog-view",e.Views["album-selection-dialog-view"],[],{langBundles:this.details.langBundles,initialLoad:function(){var t=this,n;return this.set("scrappy",this.appContext.flipper.isFlipped("enable-scrappy-photo-page")),n={albumList:this.appContext.getModel("person-galleries-models",this.appContext.auth.user.nsid)},this.get("scrappy")?n.galleriesThePhotoIsIn=t.appContext.getModel("photo-galleries-models",t.get("photoID")).then(function(e){return e.getListPageByContinuation(400).then(function(){return e.getValue("galleries").getList()})}):n.galleriesThePhotoIsIn=t.appContext.getModel("photo-contexts-models",t.get("photoID")).then(function(e){return e.registry.getContextsOfType(t.get("photoID"),"gallery-models")}),(new e.FlickrPromise(n)).then(function(e){t.set("albumList",e.albumList.getValue("galleries").toJSON()),t.set("albumListForPhoto",e.galleriesThePhotoIsIn)},function(e){throw t.onError({message:t.intlMessage({intlName:"photo-page-scrappy.ERROR_LOADING_GALLERIES"}),err:e,rejuvinate:!1}),e})},addPhoto:function(e){var t=this;return this.appContext.getModelRegistry("gallery-models").then(function(n){return n.remote.addPhoto({photoID:t.get("photoID"),galleryCompoundID:e},t.appContext).then(null,function(e){throw t.onError({message:t.intlMessage({intlName:"photo-page-scrappy.ERROR_ADDING_TO_GALLERY"}),err:e}),e})})},removePhoto:function(e){var t=this;return this.appContext.getModelRegistry("gallery-models").then(function(n){return n.remote.removePhoto({photoID:t.get("photoID"),galleryCompoundID:e},t.appContext).then(function(e){return e},function(e){throw t.onError({message:t.intlMessage({intlName:"photo-page-scrappy.ERROR_REMOVING_FROM_GALLERY"}),err:e}),e})})},createNewAndAddPhoto:function(e,t){var n=this;return this.appContext.getModelRegistry("gallery-models").then(function(r){return r.remote.create({photoID:n.get("photoID"),title:e,description:t},n.appContext).then(function(e){return e.getValue("primary")?e:(n.onError({message:n.intlMessage({intlName:"photo-page-scrappy.ERROR_PHOTO_NOT_ALLOWED_IN_GALLERY"}),err:{message:"Photo cannot be added to galleries.",stack:"gallery-selection-dialog"}}),e)},function(e){throw n.onError({message:n.intlMessage({intlName:"photo-page-scrappy.ERROR_CREATING_GALLERY"}),err:e}),e})})},onError:function(t){var r=this,i=this.get("container"),s,o,u=typeof t.rejuvinate=="undefined"?!0:t.rejuvinate;o=e.Views.dialog.getNewInstance("dialog-alert",{content:t.message,attrs:{title:this.intlMessage({intlName:"common.ERROR"}),level:"warning",confirmLabel:this.intlMessage({intlName:"common.OK"})},parent:r,visibleShim:!0,dialogClass:r.get("scrappy")?"scrappy-dialog":undefined}),o.show(),u&&o.on("dismiss",function(t){s=e.Views.dialog.getNewInstance("dialog-modal",{content:i,appContext:r.appContext,dialogClass:r.get("scrappy")?"scrappy-dialog":undefined}),s.show()}),n.error({err:t.err})}})},"@VERSION@",{requires:["flickr-view","album-selection-css","album-selection-dialog-view"],optional:["set-models"],langBundles:["common","groups","photo-page-scrappy"]});
YUI.add("sub-photo-galleries-view",function(e){function t(t,n){var r;return t===n?!0:t.length!==n.length?!1:(r=!0,e.Array.some(t,function(e,t){if(e!==n[t])return r=!1,!0}),r)}e.FlickrView.create(this.name,e.FlickrView,[],{langBundles:this.details.langBundles,initializer:function(e){this.photoId=e.photoId,this.list=[],this.loading=!1,this.removing={},this.startAmount=6,this.perPage=50,this.displayAmount=this.startAmount,this.addKeyShortcut="down:65",typeof this.getViewDataFromHistory("displayAmount")!="undefined"&&(this.startAmount=this.getViewDataFromHistory("displayAmount"),this.displayAmount=this.getViewDataFromHistory("displayAmount")),this.get("container").get("innerHTML")===""&&this.setContainerHTML("")},loadState:function(){var t=this,n;return n={photoGalleriesModel:this.appContext.getModel("photo-galleries-models",this.photoId),photoModel:this.appContext.getModel("photo-models",this.photoId),photoPrivacyModel:this.appContext.getModel("photo-privacy-models",this.photoId)},this.appContext.getViewer().signedIn&&this.appContext.getViewer().nsid===this._params.nsid&&(n.personGalleriesModel=this.appContext.getModel("person-galleries-models",this.appContext.getViewer().nsid)),(new e.FlickrPromise(n)).then(function(n){return e.Object.each(n,function(e,n){t.set(n,e)}),t.loadListData()})},loadListData:function(){var e=this;return this.loading=!0,this.getGalleries(this.displayAmount).then(function(n){var r=e.list,i=[],s;return e.loading=!1,i=n||[],i.length>e.displayAmount&&(i=i.slice(0,e.displayAmount)),t(r,i)?s=!1:(e.list=i,s=!0),{listChanged:s}})},getGalleries:function(t){var n=this.get("photoGalleriesModel"),r=n.getValue("galleries").getList(),i=n.getValue("total");return t>i&&(t=i),r.length<t?n.getListPageByContinuation(t-r.length).then(function(){return n.getValue("galleries").getList().slice(0,t)}):e.Promise.resolve(r.slice(0,t))},canViewerRemove:function(e){return this.appContext.getViewer().nsid===this._params.nsid||this.appContext.getViewer().nsid===e.getValue("owner").getValue("id")},canViewerAdd:function(){var e=this.get("photoModel").getValue("safetyLevel")===0,t=this.get("photoPrivacyModel").getValue("isPublic");return e&&t&&this.appContext.getViewer().nsid!==this._params.nsid&&this.appContext.getViewer().signedIn},listToJSON:function(){function t(t){var n=t.toJSON();return n.isGallery=!0,n.canRemove=e.canViewerRemove(t),n}var e=this;return this.list.map(t)},buildContainer:function(){var t=this.get("photoGalleriesModel").getValue("total"),n=t>this.displayAmount;this.setContainerWithTemplate("sub-photo-contexts-galleries",{empty:this.list.length===0?!0:!1,canAdd:this.canViewerAdd(),contexts:this.listToJSON(),showMore:n,total:t,totalFriendly:e.Number.format(t,{thousandsSeparator:","})})},activate:function(){var e=this,t=this.get("container"),n=this.appContext.getViewer().prefs.keyboardShortcutsEnabled;return this.canViewerAdd()&&(this.registerEventHandler(this.get("photoGalleriesModel").on("valuesChanged",this.handleListChanges.bind(this))),n&&this.attachKeyEvent(this.addKeyShortcut,function(t){t.preventDefault(),e.showAddDialog()})),this.registerEventHandler(t.on("click",this.handleContainerClick.bind(this))),this},handleListChanges:function(e){this.loading||this.reload()},handleContainerClick:function(e){var t;e.target.ancestor(".remove",!0)?(e.preventDefault(),t=e.target.ancestor("li"),this.removeFromContext(t.getAttribute("data-context-id"),t)):e.target.ancestor(".add-to",!0)?(e.preventDefault(),this.showAddDialog()):e.target.ancestor(".view-all-contexts-of-type a",!0)&&(e.preventDefault(),this.showMore())},showMore:function(){this.displayAmount===this.startAmount&&this.startAmount<this.perPage?this.displayAmount=this.perPage:this.displayAmount+=this.perPage,this.setViewDataOnHistory("displayAmount",this.displayAmount),this.reload()},reload:function(){var e=this;this.loadListData().then(function(t){t.listChanged&&e.buildContainer()})},removeFromContext:function(e,t){var n=this,r,i,s=this.get("photoGalleriesModel").getValue("galleries").getFromListByID(e).getValue("compoundId"),o={photoID:this.photoId,galleryCompoundID:s},u;if(this.removing[e])return;this.removing[e]=!0,t.setStyle("opacity","0"),r="gallery-models",i="removePhoto",u=this.get("photoGalleriesModel"),this.appContext.getModelRegistry(r).then(function(r){r.remote[i](o,n.appContext).then(function(t){delete n.removing[e],n.reload()},function(r){throw delete n.removing[e],t.setStyle("opacity","1"),r}).then(null,function(e){throw n.onError({message:n.intlMessage({intlName:"photo-page-scrappy.ERROR_REMOVING_FROM_GALLERY"}),err:e}),e})})},showAddDialog:function(){var t,n,r=this,i;t=new e.Views["gallery-selection-dialog-view"]({type:"galleries",titleSelect:this.intlMessage({intlName:"more-menu-view.ADD_PHOTO_TO_GALLERY"}),titleCreate:this.intlMessage({intlName:"more-menu-view.CREATE_NEW_GALLERY"}),loadingText:this.intlMessage({intlName:"more-menu-view.LOADING_GALLERIES"}),noneText:this.intlMessage({intlName:"more-menu-view.NO_GALLERIES"}),placeholderSearch:this.intlMessage({intlName:"photo-page-scrappy.SEARCH_GALLERIES"}),placeholderTitle:this.intlMessage({intlName:"more-menu-view.GALLERY_TITLE_PLACEHOLDER"}),placeholderDescription:this.intlMessage({intlName:"more-menu-view.GALLERY_DESCRIPTION_PLACEHOLDER"}),buttonTextSwitchCreate:this.intlMessage({intlName:"more-menu-view.CREATE_NEW_GALLERY"}),buttonTextCreate:this.intlMessage({intlName:"more-menu-view.CREATE_GALLERY"}),buttonTextComplete:this.intlMessage({intlName:"photo-page-scrappy.ADD_TO_GALLERY"}),buttonTextCancel:this.intlMessage({intlName:"more-menu-view.BACK_TO_GALLERIES"}),canCreateNew:!0,photoID:this.photoId,appContext:this.appContext}),this.appContext.flipper.isFlipped("enable-kill-scrappy-dialogjs")?i=(new e.Views.FluidModal({appContext:r.appContext,title:this.intlMessage({intlName:"more-menu-view.ADD_PHOTO_TO_GALLERY"}),subview:t,actionButtonLabel:r.intlMessage({intlName:"common.DONE"}),classList:"fluid-album-modal scrappy-dialog",showCancelButton:!1,showActionButton
:!1,dismissOnOverlayClick:!0,showFooter:!1,width:748,height:514})).show():(t.appContext=this.appContext,t.on("subviewViewEvent",function(e){e&&e.details&&e.details.length===2&&r.fire("subviewViewEvent",e.details[0],e.details[1])}),t.buildContainer(),n=t.get("container"),this.fire("subviewViewEvent","getDialogOffset",function(n){r.addToGalleryDialog=e.Views.dialog.getNewInstance("dialog-modal",{content:t.get("container"),appContext:r.appContext,offsetLeft:n,dialogClass:"scrappy-dialog"}),r.addToGalleryDialog.show(),t._params&&(t._params.keyEventScope=r.addToGalleryDialog.getKeyEventScope()),t.activate()})),e.rapidTracker.beacon(this.name,"addToGalleriesClick")},onError:function(t){var n=this;this.fire("subviewViewEvent","getDialogOffset",function(r){var i=e.Views.dialog.getNewInstance("dialog-alert",{content:t.message,attrs:{title:n.intlMessage({intlName:"common.ERROR"}),level:"warning",confirmLabel:n.intlMessage({intlName:"common.OK"})},parent:n,offsetLeft:r,dialogClass:"scrappy-dialog"});i.show()})}})},"@VERSION@",{requires:["array-extras","flickr-view","fluid-modal-view","flickr-promise","hermes-template-sub-photo-contexts-item","hermes-template-sub-photo-contexts-title-galleries","hermes-template-sub-photo-contexts-galleries","sub-photo-contexts-css","url-helper","gallery-selection-dialog-view"],optional:["photo-galleries-models","photo-models","person-galleries-models"],langBundles:["more-menu-view","photo-page-scrappy","common"]});
YUI.add("sub-photo-contexts-view",function(e){e.FlickrView.create(this.name,e.FlickrView,[],{initializer:function(e){return this.get("container").get("innerHTML")===""&&this.setContainerHTML(""),this},subviewConfig:{"sub-photo-groups-view":{requiredToShowOnClient:!0,requiredToShowOnServer:!1},"sub-photo-albums-view":{requiredToShowOnClient:!0,requiredToShowOnServer:!1},"sub-photo-galleries-view":{requiredToShowOnClient:!0,requiredToShowOnServer:!1}},loadState:function(){return e.Promise.resolve()},buildContainer:function(){return this.setContainerWithTemplate("sub-photo-contexts"),this},buildErrorContainer:function(){},activate:function(){return this}})},"@VERSION@",{requires:["flickr-view","hermes-template-sub-photo-contexts","sub-photo-contexts-css"],optional:["sub-photo-groups-view","sub-photo-albums-view","sub-photo-galleries-view"]});
YUI.add("hermes-template-sub-photo-date-view",function(e,t){var n=e.Template.Handlebars.revive({1:function(e,t,n,r,i){var s;return(s=(n.ifCond||t&&t.ifCond||n.helperMissing).call(t!=null?t:{},t!=null?t.wallArtButtonStyle:t,"!==","toolbar",{name:"ifCond",hash:{},fn:e.program(2,i,0),inverse:e.noop,data:i}))!=null?s:""},2:function(e,t,n,r,i){var s,o,u=e.lambda,a=e.escapeExpression,f=t!=null?t:{},l=n.helperMissing;return' <div class="marketplace-licensable">\n <a data-photoid="'+a(u((s=t!=null?t.photo:t)!=null?s.id:s,t))+'" data-ownerid="'+a(u((s=t!=null?t.owner:t)!=null?s.id:s,t))+'" data-track="subPhotoLicenseButtonClick" target="_blank" href="'+a((o=(o=n.marketplaceLicensingUrl||(t!=null?t.marketplaceLicensingUrl:t))!=null?o:l,typeof o=="function"?o.call(f,{name:"marketplaceLicensingUrl",hash:{},data:i}):o))+'" class="small butt photoListLicenseButton">\n'+((s=(n.ifCond||t&&t.ifCond||l).call(f,t!=null?t.wallArtButtonStyle:t,"===","buyButton",{name:"ifCond",hash:{},fn:e.program(3,i,0),inverse:e.noop,data:i}))!=null?s:"")+((s=(n.ifCond||t&&t.ifCond||l).call(f,t!=null?t.wallArtButtonStyle:t,"===","licenseButton",{name:"ifCond",hash:{},fn:e.program(5,i,0),inverse:e.noop,data:i}))!=null?s:"")+((s=(n.ifCond||t&&t.ifCond||l).call(f,t!=null?t.wallArtButtonStyle:t,"===","default",{name:"ifCond",hash:{},fn:e.program(7,i,0),inverse:e.noop,data:i}))!=null?s:"")+" </a>\n </div>\n"},3:function(e,t,n,r,i){return" "+e.escapeExpression((n.intlMessage||t&&t.intlMessage||n.helperMissing).call(t!=null?t:{},{name:"intlMessage",hash:{intlName:"common.BUY_PHOTO"},data:i}))+"\n"},5:function(e,t,n,r,i){return" "+e.escapeExpression((n.intlMessage||t&&t.intlMessage||n.helperMissing).call(t!=null?t:{},{name:"intlMessage",hash:{intlName:"common.LICENSE_PHOTO"},data:i}))+"\n"},7:function(e,t,n,r,i){return" "+e.escapeExpression((n.intlMessage||t&&t.intlMessage||n.helperMissing).call(t!=null?t:{},{name:"intlMessage",hash:{intlName:"common.BUY_LICENSE"},data:i}))+"\n"},9:function(e,t,n,r,i){return"editable"},11:function(e,t,n,r,i){var s,o=t!=null?t:{},u=n.helperMissing;return' <span class="date-taken-label" title="'+((s=(n.friendlyDateScrappySubphoto||t&&t.friendlyDateScrappySubphoto||u).call(o,t!=null?t.datePosted:t,false,false,{name:"friendlyDateScrappySubphoto",hash:{},fn:e.program(12,i,0),inverse:e.noop,data:i}))!=null?s:"")+'">\n'+((s=(n.friendlyDateScrappySubphoto||t&&t.friendlyDateScrappySubphoto||u).call(o,t!=null?t.datePosted:t,false,false,{name:"friendlyDateScrappySubphoto",hash:{},fn:e.program(14,i,0),inverse:e.noop,data:i}))!=null?s:"")+" </span>\n"},12: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}))},14: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"},16:function(e,t,n,r,i){var s,o=t!=null?t:{},u=n.helperMissing;return' <span class="date-taken-label" title="'+((s=(n.friendlyDateScrappySubphoto||t&&t.friendlyDateScrappySubphoto||u).call(o,t!=null?t.datePosted:t,false,false,{name:"friendlyDateScrappySubphoto",hash:{},fn:e.program(12,i,0),inverse:e.noop,data:i}))!=null?s:"")+'">\n'+((s=(n.friendlyDateScrappySubphoto||t&&t.friendlyDateScrappySubphoto||u).call(o,t!=null?t.dateTaken:t,t!=null?t.takenGranularity:t,true,{name:"friendlyDateScrappySubphoto",hash:{},fn:e.program(14,i,0),inverse:e.noop,data:i}))!=null?s:"")+" </span>\n"},18:function(e,t,n,r,i){return' <a href="#" class="edit-date-taken ui-icon-edit-date-taken" data-action="edit" title="'+e.escapeExpression((n.intlMessage||t&&t.intlMessage||n.helperMissing).call(t!=null?t:{},{name:"intlMessage",hash:{intlName:"common.EDIT"},data:i}))+'"></a>\n'},compiler:[7,">= 4.0.0"],main:function(e,t,n,r,i){var s,o=t!=null?t:{};return((s=n["if"].call(o,t!=null?t.isMarketplaceLicensable:t,{name:"if",hash:{},fn:e.program(1,i,0),inverse:e.noop,data:i}))!=null?s:"")+'\n<!-- Date take on -->\n<div class="date-taken clear-float '+((s=n["if"].call(o,t!=null?t.isOwner:t,{name:"if",hash:{},fn:e.program(9,i,0),inverse:e.noop,data:i}))!=null?s:"")+'">\n'+((s=n["if"].call(o,t!=null?t.isDateTakenUnknown:t,{name:"if",hash:{},fn:e.program(11,i,0),inverse:e.program(16,i,0),data:i}))!=null?s:"")+"\n"+((s=n["if"].call(o,t!=null?t.isOwner:t,{name:"if",hash:{},fn:e.program(18,i,0),inverse:e.noop,data:i}))!=null?s:"")+"</div>\n"},useData:!0}),r={};e.Array.each([],function(t){var n=e.Template.get("hermes/"+t);n&&(r[t]=n)}),e.Template.register("hermes/sub-photo-date-view",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-date-modify",function(e,t){var n=e.Template.Handlebars.revive({1:function(e,t,n,r,i){return'disabled="true"'},3:function(e,t,n,r,i){var s;return e.escapeExpression(e.lambda((s=t!=null?t.takenObj:t)!=null?s.day:s,t))},5:function(e,t,n,r,i){return"-"},7:function(e,t,n,r,i){var s;return e.escapeExpression(e.lambda((s=t!=null?t.takenObj:t)!=null?s.hour:s,t))},9:function(e,t,n,r,i){var s;return e.escapeExpression(e.lambda((s=t!=null?t.takenObj:t)!=null?s.minute:s,t))},11:function(e,t,n,r,i){var s;return e.escapeExpression(e.lambda((s=t!=null?t.takenObj:t)!=null?s.second:s,t))},compiler:[7,">= 4.0.0"],main:function(e,t,n,r,i){var s,o=t!=null?t:{},u=n.helperMissing,a=e.escapeExpression,f=e.lambda;return'<h2 class="date-modify-header">'+a((n.intlMessage||t&&t.intlMessage||u).call(o,{name:"intlMessage",hash:{intlName:"photo-page-scrappy.EDIT_DATES"},data:i}))+'</h2>\n\n<button class="ui-dialog-button ui-dialog-button-neutral ui-dialog-button-close hide-text"><span> </span></button>\n\n<h3 class="date-modify-header date-modify-taken-header">'+a((n.intlMessage||t&&t.intlMessage||u).call(o,{name:"intlMessage",hash:{intlName:"photo-page-scrappy.DATE_TAKEN_ON"},data:i}))+'</h3>\n\n<div class="date-taken-inputs date-inputs">\n <div class="month" data-monthName="'+a(f((s=t!=null?t.takenObj:t)!=null?s.monthNameEnglish:s,t))+'">\n <span class="date-value">'+a(f((s=t!=null?t.takenObj:t)!=null?s.monthName:s,t))+'</span>\n <span class="ui-dropdown-arrows"> </span>\n </div>\n <div class="day" '+((s=n.unless.call(o,(s=t!=null?t.takenObj:t)!=null?s.day:s,{name:"unless",hash:{},fn:e.program(1,i,0),inverse:e.noop,data:i}))!=null?s:"")+' data-day="'+((s=n["if"].call(o,(s=t!=null?t.takenObj:t)!=null?s.day:s,{name:"if",hash:{},fn:e.program(3,i,0),inverse:e.program(5,i,0),data:i}))!=null?s:"")+'">\n <span class="date-value">'+((s=n["if"].call(o,(s=t!=null?t.takenObj:t)!=null?s.day:s,{name:"if",hash:{},fn:e.program(3,i,0),inverse:e.program(5,i,0),data:i}))!=null?s:"")+'</span>\n <span class="ui-dropdown-arrows"> </span>\n </div>\n <div class="year" data-year="'+a(f((s=t!=null?t.takenObj:t)!=null?s.year:s,t))+'">\n <span class="date-value">'+a(f((s=t!=null?t.takenObj:t)!=null?s.year:s,t))+'</span>\n <span class="ui-dropdown-arrows"> </span>\n </div>\n <input type="text" placeholder="hh" class="date-hour" maxlength="2" value="'+((s=n["if"].call(o,(s=t!=null?t.takenObj:t)!=null?s.hour:s,{name:"if",hash:{},fn:e.program(7,i,0),inverse:e.program(5,i,0),data:i}))!=null?s:"")+'" />:\n <input type="text" placeholder="mm" class="date-minute" maxlength="2" value="'+((s=n["if"].call(o,(s=t!=null?t.takenObj:t)!=null?s.minute:s,{name:"if",hash:{},fn:e.program(9,i,0),inverse:e.program(5,i,0),data:i}))!=null?s:"")+'" />:\n <input type="text" placeholder="ss" class="date-second" maxlength="2" value="'+((s=n["if"].call(o,(s=t!=null?t.takenObj:t)!=null?s.second:s,{name:"if",hash:{},fn:e.program(11,i,0),inverse:e.program(5,i,0),data:i}))!=null?s:"")+'" />\n</div>\n\n<h3 class="date-modify-header date-modify-posted-header">'+a((n.intlMessage||t&&t.intlMessage||u).call(o,{name:"intlMessage",hash:{intlName:"photo-page-scrappy.DATE_UPLOADED_ON"},data:i}))+'</h3>\n\n<div class="date-posted-inputs date-inputs">\n <div class="month" data-monthName="'+a(f((s=t!=null?t.postedObj:t)!=null?s.monthNameEnglish:s,t))+'">\n <span class="date-value">'+a(f((s=t!=null?t.postedObj:t)!=null?s.monthName:s,t))+'</span>\n <span class="ui-dropdown-arrows"> </span>\n </div>\n <div class="day" '+((s=n.unless.call(o,(s=t!=null?t.postedObj:t)!=null?s.day:s,{name:"unless",hash:{},fn:e.program(1,i,0),inverse:e.noop,data:i}))!=null?s:"")+' data-day="'+a(f((s=t!=null?t.postedObj:t)!=null?s.day:s,t))+'">\n <span class="date-value">'+a(f((s=t!=null?t.postedObj:t)!=null?s.day:s,t))+'</span>\n <span class="ui-dropdown-arrows"> </span>\n </div>\n <div class="year" data-year="'+a(f((s=t!=null?t.postedObj:t)!=null?s.year:s,t))+'">\n <span class="date-value">'+a(f((s=t!=null?t.postedObj:t)!=null?s.year:s,t))+'</span>\n <span class="ui-dropdown-arrows"> </span>\n </div>\n <input type="text" placeholder="hh" class="date-hour" maxlength="2" value="'+a(f((s=t!=null?t.postedObj:t)!=null?s.hour:s,t))+'" />:\n <input type="text" placeholder="mm" class="date-minute" maxlength="2" value="'+a(f((s=t!=null?t.postedObj:t)!=null?s.minute:s,t))+'" />:\n <input type="text" placeholder="ss" class="date-second" maxlength="2" value="'+a(f((s=t!=null?t.postedObj:t)!=null?s.second:s,t))+'" />\n</div>\n\n<div class="date-modify-buttons">\n <button class="ui-dialog-button ui-dialog-button-neutral ui-dialog-button-done"><span>'+a((n.intlMessage||t&&t.intlMessage||u).call(o,{name:"intlMessage",hash:{intlName:"common.SAVE"},data:i}))+"</span></button>\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/date-modify",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-date-dropdown",function(e,t){var n=e.Template.Handlebars.revive({1:function(e,t,n,r,i){var s;return(s=n["if"].call(t!=null?t:{},t!=null?t.value:t,{name:"if",hash:{},fn:e.program(2,i,0),inverse:e.program(4,i,0),data:i}))!=null?s:""},2:function(e,t,n,r,i){var s=e.lambda,o=e.escapeExpression;return' <li value="'+o(s(t!=null?t.value:t,t))+'">'+o(s(t!=null?t.display:t,t))+'<span class="ui-dropdown-checked"> </span></li>\n'},4:function(e,t,n,r,i){var s=e.lambda,o=e.escapeExpression;return' <li value="'+o(s(t,t))+'">'+o(s(t,t))+'<span class="ui-dropdown-checked"> </span></li>\n'},compiler:[7,">= 4.0.0"],main:function(e,t,n,r,i){var s;return"<ul>\n"+((s=n.each.call(t!=null?t:{},t!=null?t.list:t,{name:"each",hash:{},fn:e.program(1,i,0),inverse:e.noop,data:i}))!=null?s:"")+"</ul>"},useData:!0}),r={};e.Array.each([],function(t){var n=e.Template.get("hermes/"+t);n&&(r[t]=n)}),e.Template.register("hermes/date-dropdown",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-validation-error",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="validation-error">\n <span class="validation-title">'+a((n.intlMessage||t&&t.intlMessage||u).call(o,{name:"intlMessage",hash:{intlName:"common.ERROR"},data:i}))+" - "+a((n.intlMessage||t&&t.intlMessage||u).call(o,{name:"intlMessage",hash:{intlName:"common.INVALID_DATE"},data:i}))+'</span>\n <br/><br/>\n <span class="validation-message">'+a((s=(s=n.message||(t!=null?t.message:t))!=null?s:u,typeof s=="function"?s.call(o,{name:"message",hash:{},data:i}):s))+" "+a((n.intlMessage||t&&t.intlMessage||u).call(o,{name:"intlMessage",hash:{intlName:"common.CHOOSE_VALID_DATE"},data:i}))+'</span>\n <button class="ui-dialog-button ui-dialog-button-neutral ui-dialog-button-done">\n <span>'+a((n.intlMessage||t&&t.intlMessage||u).call(o,{name:"intlMessage",hash:{intlName:"common.OK"},data:i}))+"</span>\n </button>\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/validation-error",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("scrappy-date-modify-dialog-view",function(e){e.namespace("Views")[this.name]=e.Base.create("scrappy-date-modify-dialog-view",e.FlickrView,[],{langBundles:this.details.langBundles,initializer:function(e){this.photoID=e.photoID,this.dateTaken=e.dateTaken,this.datePosted=e.datePosted,this.isDateTakenUnknown=e.isDateTakenUnknown,this.isDateTakenUnknown&&(this.dateTaken={}),this.granularityStrings={circa:"Circa",sometimeIn:"Sometime in"},this.months=[this.intlMessage({intlName:"common.CIRCA"}),this.intlMessage({intlName:"common.SOMETIME_IN"}),this.intlMessage({intlName:"common.JANUARY"}),this.intlMessage({intlName:"common.FEBRUARY"}),this.intlMessage({intlName:"common.MARCH"}),this.intlMessage({intlName:"common.APRIL"}),this.intlMessage({intlName:"common.MAY"}),this.intlMessage({intlName:"common.JUNE"}),this.intlMessage({intlName:"common.JULY"}),this.intlMessage({intlName:"common.AUGUST"}),this.intlMessage({intlName:"common.SEPTEMBER"}),this.intlMessage({intlName:"common.OCTOBER"}),this.intlMessage({intlName:"common.NOVEMBER"}),this.intlMessage({intlName:"common.DECEMBER"})],this.monthsEnglish=[this.granularityStrings.circa,this.granularityStrings.sometimeIn,"January","February","March","April","May","June","July","August","September","October","November","December"],this.dateTaken.monthName==="Circa"?(this.dateTaken.monthName=this.months[0],this.dateTaken.monthNameEnglish=this.monthsEnglish[0]):this.dateTaken.monthName==="Sometime in..."?(this.dateTaken.monthName=this.months[1],this.dateTaken.monthNameEnglish=this.monthsEnglish[1]):(this.dateTaken.monthName=this.months[parseInt(this.dateTaken.month,10)+1],this.dateTaken.monthNameEnglish=this.monthsEnglish[parseInt(this.dateTaken.month,10)+1]),this.datePosted.monthName=this.months[parseInt(this.datePosted.month,10)+1],this.datePosted.monthNameEnglish=this.monthsEnglish[parseInt(this.datePosted.month,10)+1];var t=1825,n=2004,r,i=[],s=[],o=parseInt((new Date).getFullYear(),10);while(o>=t)i.push(o.toString()),o--;o=parseInt((new Date).getFullYear(),10);while(o>=n)s.push(o.toString()),o--;this.takenYears=i,this.postedYears=s,this.days=["-"];for(r=1;r<32;r++)this.days.push(r);return this},buildContainer:function(){var e=this.dateTaken,t=this.datePosted,n=e.granularity===0,r,i;return e.granularity===8?r=0:e.granularity===6?r=1:e.month&&(r=parseInt(e.month,10)+1),e.year&&(i=this.takenYears.indexOf(e.year)),this.setContainerWithTemplate("date-modify",{showConfirmButton:!0,showCancelButton:!0,confirmButtonClass:"",cancelButtonClass:"",confirmButtonLabel:this.intlMessage({intlName:"common.SAVE"}),cancelButtonLabel:this.intlMessage({intlName:"common.CANCEL"}),takenObj:e,postedObj:t,notSureBtnLabel:n?this.unSureLabel:this.sureLabel,sure:n,unsure:{months:this.months,years:this.takenYears,selectedMonth:r,selectedYear:i}}),this.get("container").addClass("date-modify-view"),this},activate:function(){var e=this.get("container"),t=this;return e.delegate("click",function(e){t.handleDoneClick(e)},".ui-dialog-button-done"),e.delegate("click",function(e){t.handleCloseClick(e)},".ui-dialog-button-close"),e.all(".year").on("click",function(e){var n=e.target.ancestor(".date-inputs").hasClass("date-taken-inputs"),r=e.target.get("tagName")==="DIV"?e.target:e.target.ancestor("div");t.createDropdown(r,n?t.takenYears:t.postedYears,n?t.dateTaken:t.datePosted,134,11,"year")}),e.all(".month").on("click",function(e){var n=e.target.ancestor(".date-inputs").hasClass("date-taken-inputs"),r=e.target.get("tagName")==="DIV"?e.target:e.target.ancestor("div"),i=[],s;for(s=0;s<t.months.length;s++)i[s]={},i[s].value=t.monthsEnglish[s],i[s].display=t.months[s];t.createDropdown(r,n?i:i.slice(2),n?t.dateTaken:t.datePosted,134,11,"monthName")}),e.all(".day").on("click",function(e){var n=e.target.ancestor(".date-inputs").hasClass("date-taken-inputs"),r=e.target.get("tagName")==="DIV"?e.target:e.target.ancestor("div");t.createDropdown(r,n?t.days:t.days.slice(1),n?t.dateTaken:t.datePosted,134,11,"day")}),this.setRows(e.one(".day"),this.dateTaken),this},handleCloseClick:function(t){t.halt(),e.Views.dialog.close(),e.rapidTracker.beacon(this.name,this.get("type")+"DateModifyCancelClick")},handleDoneClick:function(t){t.halt();var n,r,i,s=this,o=[{selector:".month",value:"data-monthName",attributeValue:!0,dateFormat:"MMM"},{selector:".day",value:"data-day",attributeValue:!0,dateFormat:"DD"},{selector:".year",value:"data-year",attributeValue:!0,dateFormat:"YYYY"},{selector:".date-hour",value:"value",dateFormat:"HH",defaultValue:0,validate:!0,min:0,max:23},{selector:".date-minute",value:"value",dateFormat:"mm",validate:!0,min:0,max:59},{selector:".date-second",value:"value",dateFormat:"ss",validate:!0,min:0,max:59}],u,a="",f="",l="",c="",h=this.get("container"),p=h.one(".date-taken-inputs"),d=h.one(".date-posted-inputs"),v=this.appContext.getModel("photo-stats-models",this.photoID),m=this.appContext.getViewer().prefs.timezonePref,g,y,b,w=!0,E=!0,S;o.forEach(function(e){u=p.one(e.selector)[e.attributeValue?"getAttribute":"get"](e.value).trim();if(u===s.granularityStrings.circa||u===s.granularityStrings.sometimeIn||u==="-")u="";if(u!==""){if(e.validate){try{S=parseInt(u,10),w=w&&S>=e.min&&S<=e.max}catch(t){w=!1}if(!w)return!1}a+=u+" ",f+=e.dateFormat+" "}else e.defaultValue&&(a+=e.defaultValue+" ",f+=e.dateFormat+" ")});if(!w){this.onError(s.intlMessage({intlName:"photo-page-scrappy.DATE_TAKEN_FORMAT"}));return}n=e.moment(a,f),i=this.dateTaken.granularity,o.forEach(function(e){u=d.one(e.selector)[e.attributeValue?"getAttribute":"get"](e.value).trim();if(u!==""){if(e.validate){try{S=parseInt(u,10),E=E&&S>=e.min&&S<=e.max}catch(t){E=!1}if(!E)return!1}l+=u+" ",c+=e.dateFormat+" "}else e.defaultValue&&(l+=e.defaultValue+" ",c+=e.dateFormat+" ")});if(!E){this.onError(this.intlMessage({intlName:"photo-page-scrappy.DATE_TAKEN_FORMAT"}));return}m.name?r=e.moment.tz(l,c,m.name):r=e.moment(l,c);if(n&&n.isValid()&&r&&r.isValid()){if(r.diff(e.moment())>0){this.onError(this.intlMessage({intlName:"photo-page-scrappy.DATE_POSTED_FUTURE"
}));return}v.then(function(t){g=t.getValue("dateTaken"),y=t.getValue("takenGranularity"),b=t.getValue("datePosted");if(g!==n.format("YYYY-MM-DD HH:mm:ss")||y!==i)t.setValue("dateTaken",n.format("YYYY-MM-DD HH:mm:ss")),t.setValue("takenGranularity",i);t.setValue("datePosted",r.format("X")),t.setValue("isDateTakenUnknown",!1),t.remoteUpdate().then(function(){e.Views.dialog.close(),e.rapidTracker.beacon(s.name,s.get("type")+"DateModifyDoneClick")},function(e){t.setValue("dateTaken",g),t.setValue("takenGranularity",y),t.setValue("datePosted",b),e.message==="Invalid date_posted"?s.onError(s.intlMessage({intlName:"photo-page-scrappy.DATE_POSTED_FLICKR_JOIN"})):s.onError(s.intlMessage({intlName:"photo-page-scrappy.ERROR_SAVING_DATE"}))})})}else this.onError(s.intlMessage({intlName:"photo-page-scrappy.DATE_INVALID"}))},createDropdown:function(t,n,r,i,s,o){if(t.getAttribute("disabled")==="true")return;var u=e.Node.create("<div></div>"),a=e.Node.create("<div></div>"),f=this.get("container"),l=f.get("clientWidth"),c=f.get("clientHeight"),h=i,p=c-60,d=t.get("offsetLeft")+14,v=t.get("offsetTop"),m=13,g=5,y,b,w,E=this,S,x;y=this.templates("date-dropdown")({list:n}),u.setHTML(y),u.hide(),u.addClass("date-dropdown"),u.setStyle("width",h),u.setStyle("maxHeight",p),u.setY(v-g),u.setX(d-m),a.addClass("date-dropdown-curtain"),a.setStyle("width",l),a.setStyle("height",c),a.setStyle("top",0),f.append(a),a.append(u),b=u.delegate("click",function(e){E.onDropdownRowSelected(t,b,a,r,o,e)},"li"),a.on("click",function(e){E.onCloseDropdown(e,b,a)}),r[o]&&(w=u.one('li[value="'+r[o]+'"]'),w&&w.addClass("selected-item")),u.show(),r[o]&&w&&(x=w.getXY(),S=u.getXY(),x[1]-S[1]>=265&&(u.getDOMNode().scrollTop=x[1]-S[1]))},onDropdownRowSelected:function(e,t,n,r,i,s){s.target.get("tagName")==="SPAN"&&(s.target=s.target.ancestor("li"));if(!s.target.hasClass("selected-item")){var o=s.target.getAttribute("value"),u=s.target.get("text");e.one(".date-value").setHTML(u),e.setAttribute("data-"+i,o),r[i]=o,this.onCloseDropdown(s,t,n),this.setRows(e,r)}},onCloseDropdown:function(e,t,n){t.detach(),n.remove(!0)},setRows:function(e,t){var n=e.ancestor(".date-inputs"),r,i,s,o,u,a;n&&(r=n.one(".month").getAttribute("data-monthName"),i=n.one(".day"),u=n.hasClass("date-taken-inputs"),u&&(s=n.one(".date-hour"),o=n.one(".date-minute"),a=n.one(".date-second")),r===this.granularityStrings.circa||r===this.granularityStrings.sometimeIn?(t.granularity=r===this.granularityStrings.circa?8:6,i.one(".date-value").setHTML("-"),i.setAttribute("data-day","-"),t.day="-",i.setAttribute("disabled",!0),u&&(s.setAttribute("value","-"),s.setAttribute("disabled",!0),o.setAttribute("value","-"),o.setAttribute("disabled",!0),a.setAttribute("value","-"),a.setAttribute("disabled",!0))):(i.removeAttribute("disabled"),t.granularity=i.getAttribute("data-day")==="-"?4:0,u&&(s.setAttribute("value",t.hour||"-"),s.removeAttribute("disabled"),o.setAttribute("value",t.minute||"-"),o.removeAttribute("disabled"),a.setAttribute("value",t.second||"-"),a.removeAttribute("disabled"))))},onError:function(t){var n=e.Node.create(this.templates("validation-error")({message:t})),r=e.Node.create("<div></div>"),i=this.get("container"),s=20,o=i.get("clientWidth")+s,u=i.get("clientHeight")+s,a=500,f=120,l=o/2-(a+s)/2,c=u/2-(f+s)/2;n.setStyle("width",a),n.setStyle("height",f),n.setStyle("left",l),n.setStyle("top",c),r.setStyle("left",-s),r.setStyle("top",-s),r.setStyle("width",o+s),r.setStyle("height",u+s),r.addClass("validation-modal"),i.append(r),r.append(n),r.on("click",function(){r.remove(!0)})}})},"@VERSION@",{requires:["flickr-view","hermes-template-date-modify","hermes-template-date-dropdown","hermes-template-validation-error","validation-error-css","moment","moment-timezone"],langBundles:["common","photo-page-scrappy"]});
YUI.add("sub-photo-date-view",function(e,t){var n=require("lib/flog")(t),r=300;e.FlickrView.create(this.name,e.FlickrView,[],{langBundles:this.details.langBundles,initializer:function(e){return this.photoId=e.photoId,this.get("container").get("innerHTML")===""&&this.setContainerHTML(" "),this},loadState:function(){var t=this,n=[];return n.push((new e.FlickrPromise({photo:t.appContext.getModel("photo-models",t.photoId),stats:t.appContext.getModel("photo-stats-models",t.photoId)})).then(function(e){t.set("photo",e.photo),t.set("stats",e.stats)})),e.Promise.all(n)},buildContainer:function(){var e,t=this.get("photo"),n=this.get("stats"),r=t.getValue("owner").getValue("isMe");return e={isOwner:r,isMarketplaceLicensable:t.getValue("isMarketplaceLicensable"),marketplaceLicensingUrl:t.getValue("marketplaceLicensingUrl"),dateTaken:n.getDateObj("dateTaken"),datePosted:n.getDateObj("datePosted"),takenGranularity:n.getValue("takenGranularity"),isDateTakenUnknown:n.getValue("isDateTakenUnknown"),photo:t,owner:t.getValue("owner"),wallArtButtonStyle:this.appContext.flipper.getValue("licensing-button-placement")},this.setContainerWithTemplate("sub-photo-date-view",e),this},activate:function(){var e=this,t=this.get("stats"),n=this.get("container");return t&&this.registerEventHandler(t.on("valuesChanged",function(t){(t.dateTaken||t.datePosted||t.isCirca||t.isSometime||t.takenGranularity)&&e.buildContainer(),n.one(".edit-date-taken")&&n.one(".edit-date-taken").on("click",e.showDateEditor,e)})),n.one(".edit-date-taken")&&n.one(".edit-date-taken").on("click",e.showDateEditor,e),this.appContext.flipper.isFlipped("display-marketplace-licensable")&&n.one(".photoListLicenseButton")&&(this.registerEventHandler(n.one(".photoListLicenseButton").on("click",this.licenseButtonClick,this)),this.registerEventHandler(n.one(".photoListLicenseButton").on("mouseenter",this.licenseButtonHover,this)),this.registerEventHandler(n.one(".photoListLicenseButton").on("mouseleave",this.licenseButtonHover,this))),this},licenseButtonHover:function(t){t.halt();var n=t.type,i=this;if(n==="mouseenter"){if(e.StorageHelper.getItem("seenThirdParty"))return;this.tooltip&&this.tooltip.close(),clearTimeout(this.tooltipHoverTimer),this.isHovering=!0,this.tooltipHoverTimer=setTimeout(function(){i.isHovering&&(i.tooltip=new e.Views.FluidDroparound({appContext:i.appContext,showDropArrow:!0,dismissOnOverlayClick:!1,dismissOnActionClick:!1,observePageResize:!0,anchorElement:t.target,positionFixed:!0,closeOnScroll:!0,anchorOffsetHorizontal:0,newPosition:!0,hideModalOverlay:!0,invisibleOverlay:!0,autoSizeToContent:!0,useAnchorOffsetSize:!0,horizCenterToAnchor:!0,anchorPositionOffset:50,preferTop:!0,classList:"photo-license-pop-up",textMessage:i.intlMessage({intlName:"common.CLICK_BUTTON_THIRD_PARTY"})}),i.tooltip.show())},r)}else this.isHovering=!1,this.tooltip&&this.tooltip.close()},licenseButtonClick:function(t){var r={owner_id:t.target.getData("ownerid"),photo_id:t.target.getData("photoid")};this.appContext.callAPI("flickr.licensing.marketplace.addClick",r).then(function(){e.StorageHelper.setItem("seenThirdParty",1)},function(e){n.error("flickr.licensing.marketplace.addClick failed",{photoId:r.photo_id})})},showDateEditor:function(t){var n,r=this.get("stats"),i=this;t.preventDefault(),n=new e.Views["scrappy-date-modify-dialog-view"]({photoID:this.photoId,dateTaken:r.getDateObj("dateTaken"),datePosted:r.getDateObj("datePosted"),isDateTakenUnknown:r.getValue("isDateTakenUnknown"),appContext:this.appContext}),n.appContext=this.appContext,n.buildContainer(),n.on("subviewViewEvent",function(e){e&&e.details&&e.details.length===2&&i.fire("subviewViewEvent",e.details[0],e.details[1])}),this.fire("subviewViewEvent","getDialogOffset",function(t){i.editDateDialog=e.Views.dialog.getNewInstance("dialog-modal",{content:n.get("container"),appContext:i.appContext,offsetLeft:t,dialogClass:"scrappy-dialog edit-dates-dialog"}),i.editDateDialog.show(),n.activate()}),e.rapidTracker.beacon(this.name,"moreMenuEditDateClick")},destructor:function(){this.editDateDialog&&(this.editDateDialog.close(),this.editDateDialog=null)}})},"@VERSION@",{requires:["flickr-view","flickr-promise","dialog","hermes-template-sub-photo-date-view","scrappy-date-modify-dialog-view","scrappy-date-modify-css","fluid-droparound-view"],optional:["photo-models","photo-stats-models"],langBundles:["common","photo-page-scrappy"]});
YUI.add("hermes-template-sub-photo-additional-info",function(e,t){var n=e.Template.Handlebars.revive({1:function(e,t,n,r,i){var s,o=t!=null?t:{};return' <div class="ui-dropdown ui-dropdown-closed'+((s=n["if"].call(o,t!=null?t.dropUp:t,{name:"if",hash:{},fn:e.program(2,i,0),inverse:e.noop,data:i}))!=null?s:"")+'">\n <span class="ui-dialog-arrow"></span>\n <ul>\n'+((s=(n.eachConfigVal||t&&t.eachConfigVal||n.helperMissing).call(o,"privacy",{name:"eachConfigVal",hash:{},fn:e.program(4,i,0),inverse:e.noop,data:i}))!=null?s:"")+" </ul>\n </div>\n </li>\n"},2:function(e,t,n,r,i){return" drop-up"},4:function(e,t,n,r,i){var s,o=t!=null?t:{},u=n.helperMissing,a=e.escapeExpression;return' <li data-action="set" data-value="'+a((s=(s=n.value||(t!=null?t.value:t))!=null?s:u,typeof s=="function"?s.call(o,{name:"value",hash:{},data:i}):s))+'" data-text="'+a((n.intlMessage||t&&t.intlMessage||u).call(o,{name:"intlMessage",hash:{intlName:t!=null?t.key:t},data:i}))+'">'+a((n.intlMessage||t&&t.intlMessage||u).call(o,{name:"intlMessage",hash:{intlName:t!=null?t.key:t},data:i}))+"</li>\n"},6:function(e,t,n,r,i){var s;return' <span class="privacy-value">\n'+((s=(n.privacyString||t&&t.privacyString||n.helperMissing).call(t!=null?t:{},t!=null?t.privacySelected:t,{name:"privacyString",hash:{},fn:e.program(7,i,0),inverse:e.noop,data:i}))!=null?s:"")+" </span>\n"},7:function(e,t,n,r,i){return" "+e.escapeExpression((n.intlMessage||t&&t.intlMessage||n.helperMissing).call(t!=null?t:{},{name:"intlMessage",hash:{intlName:t!=null?t.key:t},data:i}))+"\n"},9:function(e,t,n,r,i){var s,o,u=t!=null?t:{},a=n.helperMissing,f=e.escapeExpression;return' <li class="commenting-permission">\n <i class="ui-icon-tiny-commentPermission'+f((o=(o=n.commentingPermission||(t!=null?t.commentingPermission:t))!=null?o:a,typeof o=="function"?o.call(u,{name:"commentingPermission",hash:{},data:i}):o))+'">\n <span class="charm-ui-error" title="'+f((n.intlMessage||t&&t.intlMessage||a).call(u,{name:"intlMessage",hash:{intlName:"photo-page-scrappy.COMMENT_PERMS_UPDATE_ERROR"},data:i}))+'"></span>\n </i>\n <span class="commenting-label">\n '+f((n.intlMessage||t&&t.intlMessage||a).call(u,{name:"intlMessage",hash:{intlName:"photo-page-scrappy.COMMENTING_ON_THIS_PHOTO"},data:i}))+'\n </span>\n <div class="ui-dropdown ui-dropdown-closed'+((s=n["if"].call(u,t!=null?t.dropUp:t,{name:"if",hash:{},fn:e.program(2,i,0),inverse:e.noop,data:i}))!=null?s:"")+'">\n <span class="ui-dialog-arrow"></span>\n <ul>\n'+((s=(n.eachConfigVal||t&&t.eachConfigVal||a).call(u,"commentingPermission",{name:"eachConfigVal",hash:{},fn:e.program(4,i,0),inverse:e.noop,data:i}))!=null?s:"")+" </ul>\n </div>\n </li>\n"},11:function(e,t,n,r,i){var s,o,u=t!=null?t:{},a=n.helperMissing,f=e.escapeExpression;return' <li class="add-meta-permission">\n <i class="ui-icon-tiny-metaPermission'+f((o=(o=n.addMetaPermission||(t!=null?t.addMetaPermission:t))!=null?o:a,typeof o=="function"?o.call(u,{name:"addMetaPermission",hash:{},data:i}):o))+'">\n <span class="charm-ui-error" title="'+f((n.intlMessage||t&&t.intlMessage||a).call(u,{name:"intlMessage",hash:{intlName:"photo-page-scrappy.META_PERMS_UPDATE_ERROR"},data:i}))+'"></span>\n </i>\n <span class="meta-permissions-label">\n '+f((n.intlMessage||t&&t.intlMessage||a).call(u,{name:"intlMessage",hash:{intlName:"photo-page-scrappy.ADD_META_TO_THIS_PHOTO"},data:i}))+'\n </span>\n <div class="ui-dropdown ui-dropdown-closed'+((s=n["if"].call(u,t!=null?t.dropUp:t,{name:"if",hash:{},fn:e.program(2,i,0),inverse:e.noop,data:i}))!=null?s:"")+'">\n <span class="ui-dialog-arrow"></span>\n <ul>\n'+((s=(n.eachConfigVal||t&&t.eachConfigVal||a).call(u,"addMetaPermission",{name:"eachConfigVal",hash:{},fn:e.program(4,i,0),inverse:e.noop,data:i}))!=null?s:"")+" </ul>\n </div>\n </li>\n"},13:function(e,t,n,r,i){var s,o,u=t!=null?t:{},a=n.helperMissing,f=e.escapeExpression;return' <li class="c-charm-item-safetylevel">\n <i class="ui-icon-tiny-safety-'+f((o=(o=n.safetyLevel||(t!=null?t.safetyLevel:t))!=null?o:a,typeof o=="function"?o.call(u,{name:"safetyLevel",hash:{},data:i}):o))+'">\n <span class="charm-ui-error" title="'+f((n.intlMessage||t&&t.intlMessage||a).call(u,{name:"intlMessage",hash:{intlName:"photo-page-scrappy.SAFETY_UPDATE_ERROR"},data:i}))+'"></span>\n </i>\n <span class="safety-label">\n '+f((n.intlMessage||t&&t.intlMessage||a).call(u,{name:"intlMessage",hash:{intlName:"photo-page-scrappy.SAFETY_LEVEL_OF_PHOTO"},data:i}))+"\n </span>\n"+((s=n["if"].call(u,t!=null?t.isOwner:t,{name:"if",hash:{},fn:e.program(14,i,0),inverse:e.program(22,i,0),data:i}))!=null?s:"")+" </li>\n"},14:function(e,t,n,r,i){var s,o=t!=null?t:{};return' <div class="ui-dropdown ui-dropdown-closed'+((s=n["if"].call(o,t!=null?t.dropUp:t,{name:"if",hash:{},fn:e.program(2,i,0),inverse:e.noop,data:i}))!=null?s:"")+'">\n <span class="ui-dialog-arrow"></span>\n <ul>\n'+((s=n["if"].call(o,t!=null?t.isVideo:t,{name:"if",hash:{},fn:e.program(15,i,0),inverse:e.program(19,i,0),data:i}))!=null?s:"")+" </ul>\n </div>\n"},15:function(e,t,n,r,i){var s;return(s=(n.eachConfigVal||t&&t.eachConfigVal||n.helperMissing).call(t!=null?t:{},"safetyLevel",{name:"eachConfigVal",hash:{},fn:e.program(16,i,0),inverse:e.noop,data:i}))!=null?s:""},16:function(e,t,n,r,i){var s;return(s=(n.ifCond||t&&t.ifCond||n.helperMissing).call(t!=null?t:{},t!=null?t.text:t,"!==","Restricted",{name:"ifCond",hash:{},fn:e.program(17,i,0),inverse:e.noop,data:i}))!=null?s:""},17:function(e,t,n,r,i){var s,o=t!=null?t:{},u=n.helperMissing,a=e.escapeExpression;return' <li data-action="set" data-value="'+a((s=(s=n.value||(t!=null?t.value:t))!=null?s:u,typeof s=="function"?s.call(o,{name:"value",hash:{},data:i}):s))+'" data-text="'+a((n.intlMessage||t&&t.intlMessage||u).call(o,{name:"intlMessage",hash:{intlName:t!=null?t.key:t},data:i}))+'">'+a((n.intlMessage||t&&t.intlMessage||u).call(o,{name:"intlMessage",hash:{intlName:t!=null?t.key:t},data:i}))+"</li>\n"
},19:function(e,t,n,r,i){var s;return(s=(n.eachConfigVal||t&&t.eachConfigVal||n.helperMissing).call(t!=null?t:{},"safetyLevel",{name:"eachConfigVal",hash:{},fn:e.program(20,i,0),inverse:e.noop,data:i}))!=null?s:""},20:function(e,t,n,r,i){var s,o=t!=null?t:{},u=n.helperMissing,a=e.escapeExpression;return' <li data-action="set" data-value="'+a((s=(s=n.value||(t!=null?t.value:t))!=null?s:u,typeof s=="function"?s.call(o,{name:"value",hash:{},data:i}):s))+'" data-text="'+a((n.intlMessage||t&&t.intlMessage||u).call(o,{name:"intlMessage",hash:{intlName:t!=null?t.key:t},data:i}))+'">'+a((n.intlMessage||t&&t.intlMessage||u).call(o,{name:"intlMessage",hash:{intlName:t!=null?t.key:t},data:i}))+"</li>\n"},22:function(e,t,n,r,i){var s;return' <span class="safety-value">\n'+((s=(n.safetyLevelString||t&&t.safetyLevelString||n.helperMissing).call(t!=null?t:{},t!=null?t.safetyLevel:t,{name:"safetyLevelString",hash:{},fn:e.program(23,i,0),inverse:e.noop,data:i}))!=null?s:"")+" </span>\n"},23:function(e,t,n,r,i){return" "+e.escapeExpression((n.intlMessage||t&&t.intlMessage||n.helperMissing).call(t!=null?t:{},{name:"intlMessage",hash:{intlName:t!=null?t.key:t},data:i}))+"\n"},25:function(e,t,n,r,i){var s=t!=null?t:{},o=n.helperMissing,u=e.escapeExpression;return' <li class="flag-photo-container">\n <a href = "#" class="flag-photo"><i class="ui-icon-tiny-flag-photo"><span class="charm-ui-error" title="'+u((n.intlMessage||t&&t.intlMessage||o).call(s,{name:"intlMessage",hash:{intlName:"photo-page-scrappy.FLAG_ERROR"},data:i}))+'"></span></i><span class="flag-label">'+u((n.intlMessage||t&&t.intlMessage||o).call(s,{name:"intlMessage",hash:{intlName:"photo-page-scrappy.FLAG_PHOTO"},data:i}))+"</span></a>\n </li>\n"},27:function(e,t,n,r,i){return' <li class="feedback-container">\n <a href="https://yahoo.uservoice.com/forums/252131" target="_blank" class="give-feedback"><i class="ui-icon-tiny-feedback"></i><span class="feedback-label">'+e.escapeExpression((n.intlMessage||t&&t.intlMessage||n.helperMissing).call(t!=null?t:{},{name:"intlMessage",hash:{intlName:"photo-page-scrappy.PROVIDE_FEEDBACK"},data:i}))+"</span></a>\n </li>\n"},compiler:[7,">= 4.0.0"],main:function(e,t,n,r,i){var s,o,u=t!=null?t:{},a=n.helperMissing,f=e.escapeExpression;return'<div class="additional-info">\n\n<h3>'+f((n.intlMessage||t&&t.intlMessage||a).call(u,{name:"intlMessage",hash:{intlName:"photo-page-scrappy.ADDITIONAL_INFO"},data:i}))+'</h3>\n<!-- Privacy -->\n<li class="c-charm-item-privacy">\n <i class="ui-icon-tiny-privacy'+f((o=(o=n.privacySelected||(t!=null?t.privacySelected:t))!=null?o:a,typeof o=="function"?o.call(u,{name:"privacySelected",hash:{},data:i}):o))+'">\n <span class="charm-ui-error" title="'+f((n.intlMessage||t&&t.intlMessage||a).call(u,{name:"intlMessage",hash:{intlName:"photo-page-scrappy.PRIVACY_UPDATE_ERROR"},data:i}))+'"></span>\n </i>\n <span class="privacy-label">\n '+f((n.intlMessage||t&&t.intlMessage||a).call(u,{name:"intlMessage",hash:{intlName:"photo-page-scrappy.VIEWING_THIS_PHOTO"},data:i}))+"\n </span>\n"+((s=n["if"].call(u,t!=null?t.isOwner:t,{name:"if",hash:{},fn:e.program(1,i,0),inverse:e.program(6,i,0),data:i}))!=null?s:"")+"\n<!-- Commenting Permissions -->\n"+((s=n["if"].call(u,t!=null?t.isOwner:t,{name:"if",hash:{},fn:e.program(9,i,0),inverse:e.noop,data:i}))!=null?s:"")+"\n<!-- Add Meta Permissions -->\n"+((s=n["if"].call(u,t!=null?t.isOwner:t,{name:"if",hash:{},fn:e.program(11,i,0),inverse:e.noop,data:i}))!=null?s:"")+"\n<!-- Permissions -->\n\n"+((s=(n.ifCond||t&&t.ifCond||a).call(u,t!=null?t.safetyLevel:t,"!==","none",{name:"ifCond",hash:{},fn:e.program(13,i,0),inverse:e.noop,data:i}))!=null?s:"")+"\n<!-- Flag Photo -->\n"+((s=n["if"].call(u,t!=null?t.showFlagPhoto:t,{name:"if",hash:{},fn:e.program(25,i,0),inverse:e.noop,data:i}))!=null?s:"")+"\n<!-- Feedback -->\n"+((s=n["if"].call(u,t!=null?t.showFeedback:t,{name:"if",hash:{},fn:e.program(27,i,0),inverse:e.noop,data:i}))!=null?s:"")+"</div>\n"},useData:!0}),r={};e.Array.each([],function(t){var n=e.Template.get("hermes/"+t);n&&(r[t]=n)}),e.Template.register("hermes/sub-photo-additional-info",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("privacy-helper",function(e){function t(e){var t,n,r,i,s;return t={isPublic:!1,isVisibleByFriends:!1,isVisibleByFamily:!1},n={isPublic:!0,isVisibleByFriends:!1,isVisibleByFamily:!1},r={isPublic:!1,isVisibleByFriends:!0,isVisibleByFamily:!1},i={isPublic:!1,isVisibleByFriends:!1,isVisibleByFamily:!0},s={isPublic:!1,isVisibleByFriends:!0,isVisibleByFamily:!0},typeof e=="object"?e.isPublic?"public":e.isVisibleByFriends&&e.isVisibleByFamily?"friendsandfamily":e.isVisibleByFamily?"family":e.isVisibleByFriends?"friends":"private":e==="public"?n:e==="friendsandfamily"?s:e==="friends"?r:e==="family"?i:t}e.PrivacyHelper={mapPrivacy:t}},"@VERSION@",{requires:[]});
YUI.add("hermes-template-flag-photo-dialog-content",function(e,t){var n=e.Template.Handlebars.revive({1:function(e,t,n,r,i){var s;return(s=n["if"].call(t!=null?t:{},t!=null?t.fallsWithinSettings:t,{name:"if",hash:{},fn:e.program(2,i,0),inverse:e.program(4,i,0),data:i}))!=null?s:""},2:function(e,t,n,r,i){return" "+e.escapeExpression((n.intlHTMLMessage||t&&t.intlHTMLMessage||n.helperMissing).call(t!=null?t:{},{name:"intlHTMLMessage",hash:{intlName:"photo-page-scrappy.FLAG_CONFIRMATION_SAFE_WITHIN"},data:i}))+"\n"},4:function(e,t,n,r,i){return" "+e.escapeExpression((n.intlHTMLMessage||t&&t.intlHTMLMessage||n.helperMissing).call(t!=null?t:{},{name:"intlHTMLMessage",hash:{intlName:"photo-page-scrappy.FLAG_CONFIRMATION_SAFE_OUTSIDE"},data:i}))+"\n"},6:function(e,t,n,r,i){var s;return(s=n["if"].call(t!=null?t:{},t!=null?t.fallsWithinSettings:t,{name:"if",hash:{},fn:e.program(7,i,0),inverse:e.program(9,i,0),data:i}))!=null?s:""},7:function(e,t,n,r,i){return" "+e.escapeExpression((n.intlHTMLMessage||t&&t.intlHTMLMessage||n.helperMissing).call(t!=null?t:{},{name:"intlHTMLMessage",hash:{intlName:"photo-page-scrappy.FLAG_CONFIRMATION_MODERATE_WITHIN"},data:i}))+"\n"},9:function(e,t,n,r,i){return" "+e.escapeExpression((n.intlHTMLMessage||t&&t.intlHTMLMessage||n.helperMissing).call(t!=null?t:{},{name:"intlHTMLMessage",hash:{intlName:"photo-page-scrappy.FLAG_CONFIRMATION_MODERATE_OUTSIDE"},data:i}))+"\n"},11:function(e,t,n,r,i){var s;return(s=n["if"].call(t!=null?t:{},t!=null?t.fallsWithinSettings:t,{name:"if",hash:{},fn:e.program(12,i,0),inverse:e.program(14,i,0),data:i}))!=null?s:""},12:function(e,t,n,r,i){return" "+e.escapeExpression((n.intlHTMLMessage||t&&t.intlHTMLMessage||n.helperMissing).call(t!=null?t:{},{name:"intlHTMLMessage",hash:{intlName:"photo-page-scrappy.FLAG_CONFIRMATION_RESTRICTED_WITHIN"},data:i}))+"\n"},14:function(e,t,n,r,i){return" "+e.escapeExpression((n.intlHTMLMessage||t&&t.intlHTMLMessage||n.helperMissing).call(t!=null?t:{},{name:"intlHTMLMessage",hash:{intlName:"photo-page-scrappy.FLAG_CONFIRMATION_RESTRICTED_OUTSIDE"},data:i}))+"\n"},compiler:[7,">= 4.0.0"],main:function(e,t,n,r,i){var s,o=t!=null?t:{};return((s=n["if"].call(o,t!=null?t.isSafe:t,{name:"if",hash:{},fn:e.program(1,i,0),inverse:e.noop,data:i}))!=null?s:"")+"\n"+((s=n["if"].call(o,t!=null?t.isModerate:t,{name:"if",hash:{},fn:e.program(6,i,0),inverse:e.noop,data:i}))!=null?s:"")+"\n"+((s=n["if"].call(o,t!=null?t.isRestricted:t,{name:"if",hash:{},fn:e.program(11,i,0),inverse:e.noop,data:i}))!=null?s:"")+"\n"+e.escapeExpression((n.intlHTMLMessage||t&&t.intlHTMLMessage||n.helperMissing).call(o,{name:"intlHTMLMessage",hash:{intlName:"photo-page-scrappy.FOR_MORE_INFORMATION_SAFESEARCH"},data:i}))},useData:!0}),r={};e.Array.each([],function(t){var n=e.Template.get("hermes/"+t);n&&(r[t]=n)}),e.Template.register("hermes/flag-photo-dialog-content",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("sub-photo-additional-info-view",function(e,t){var n=require("lib/flog")(t),r,i;i={debug:!1,css:{safetyLevel:".c-charm-item-safetylevel .ui-dropdown",privacy:".c-charm-item-privacy .ui-dropdown",commentingPermission:".commenting-permission .ui-dropdown",addMetaPermission:".add-meta-permission .ui-dropdown"},stateCSS:{working:"working",apiError:"api-error"}},r={log:function(){if(!i.debug||!console.log.apply)return;var e=new Array(arguments.length);for(var t=0;t<e.length;++t)e[t]=arguments[t];e.unshift("color: #FC0"),e.unshift("%c[CHARM-EXIF]"),console.log.apply(console,e)}},e.FlickrView.create(this.name,e.FlickrView,[],{langBundles:this.details.langBundles,initializer:function(e){return this.nsid=e.nsid,this.photoId=e.photoId,this.backToURL=e.backToURL,this.get("container").get("innerHTML")===""&&this.setContainerHTML(""),this},buildContainer:function(){var t,n=this.get("photo"),r=n.getValue("owner").getValue("isMe"),i=!1,s=!r&&this.appContext.getViewer().signedIn,o=!0;return t={safetyLevel:n?n.getValue("safetyLevel"):"none",privacy:this.get("privacy")?this.get("privacy").toJSON():{},commentingPermission:this.get("privacy").getValue("permComment"),addMetaPermission:this.get("privacy").getValue("permAddMeta"),privacySelected:this.get("privacy")?e.PrivacyHelper.mapPrivacy(this.get("privacy").toJSON()).toLowerCase():"",isOwner:r,dropUp:i,isVideo:n?n.getValue("isVideo"):!1,showFlagPhoto:s,showFeedback:o},this.setContainerWithTemplate("sub-photo-additional-info",t),this},setSafetyLevel:function(e){var t=this,r=this.get("photo"),s=r.getValue("safetyLevel"),o=this.get("container").one(".c-charm-item-safetylevel"),u=this.get("container").one(".c-charm-item-safetylevel i");r.setValue("safetyLevel",e),u.replaceClass("ui-icon-tiny-safety-"+s,"ui-icon-tiny-safety-"+e),o&&(o.addClass(i.stateCSS.working),o.removeClass(i.stateCSS.apiError)),e==="restricted"?this.fire("subviewViewEvent","disable-sharing"):this.fire("subviewViewEvent","enable-sharing"),r.remoteUpdate().then(function(){o&&o.removeClass(i.stateCSS.working)},function(a){r.setValue("safetyLevel",s),t.safetyLevelDd.select(s),u.replaceClass("ui-icon-tiny-safety-"+e,"ui-icon-tiny-safety-"+s),o&&(o.removeClass(i.stateCSS.working),o.addClass(i.stateCSS.apiError)),t.onError(t.intlMessage({intlName:"photo-page-scrappy.SAFETY_CHANGE_ERROR"})),n.error({err:a})})},changingToStricterPrivacy:function(t){var n=this.get("privacy"),r=e.PrivacyHelper.mapPrivacy(n.toJSON());return t!==r&&(t==="private"||r==="public"||t==="family"&&r==="friends"||t==="friends"&&r==="family"||t==="friendsandfamily"&&r==="friends"||t==="friends"&&r==="friendsandfamily"||t==="family"&&r==="friendsandfamily")},setPrivacy:function(t){var n=this.get("privacy"),r=!1,i=this;!i.stricterPrivacyChangeWarningDialog&&i.changingToStricterPrivacy(t)?(r=!0,i.stricterPrivacyChangeWarningDialog=new e.Views.FluidModal({appContext:i.appContext,dismissOnOverlayClick:!0,dismissOnActionClick:!0,showCancelButton:!0,title:i.intlMessage({intlName:"photo-page-scrappy.STRICTER_PRIVACY_CHANGE_DIALOG_TITLE"}),actionButtonLabel:i.intlMessage({intlName:"common.OK"}),cancelButtonLabel:i.intlMessage({intlName:"common.CANCEL"}),message:i.intlMessage({intlName:"photo-page-scrappy.STRICTER_PRIVACY_CHANGE_DIALOG_MESSAGE"})}),i.stricterPrivacyChangeWarningDialog.on("actionClick",function(e){i.changePrivacy(t,r)}),i.stricterPrivacyChangeWarningDialog.on("cancelClick",function(t){i.stricterPrivacyChangeWarningDialog=undefined,i.privacyDd.select(e.PrivacyHelper.mapPrivacy(n.toJSON()))}),i.stricterPrivacyChangeWarningDialog.show()):i.changePrivacy(t,r)},changePrivacy:function(t,r){var s=this.get("privacy"),o=this.get("container").one(".c-charm-item-privacy"),u=e.PrivacyHelper.mapPrivacy(t),a=e.PrivacyHelper.mapPrivacy(s.toJSON()),f=this.get("container").one(".c-charm-item-privacy i"),l=this;f.replaceClass(f.getDOMNode().className,"ui-icon-tiny-privacy"+t.toLowerCase()),o&&(o.removeClass(i.stateCSS.apiError),o.addClass(i.stateCSS.working)),Object.keys(u).forEach(function(e){s.setValue(e,u[e])}),s.remoteUpdate().then(function(){o&&(o.removeClass(i.stateCSS.working),o.removeClass(i.stateCSS.apiError)),r?e.config.win.location.reload():l.appContext.getModelRegistry("photostream-models").then(function(e){e.removeAll()})},function(t){Object.keys(u).forEach(function(e){s.revertValue(e)}),o&&(o.removeClass(i.stateCSS.working),o.addClass(i.stateCSS.apiError),e.config.win.setTimeout(function(){o&&o.addClass(i.stateCSS.apiError)},100)),a=e.PrivacyHelper.mapPrivacy(s.toJSON()),l.onError(l.intlMessage({intlName:"photo-page-scrappy.PRIVACY_CHANGE_ERROR"})),n.error({err:t})})},setCommentingPermission:function(e){var t=this,r=this.get("privacy"),s=r.getValue("permComment"),o=this.get("container").one(".commenting-permission"),u=this.get("container").one(".ui-icon-tiny-commentPermission"+s);r.setValue("permComment",e),u.replaceClass("ui-icon-tiny-commentPermission"+s,"ui-icon-tiny-commentPermission"+e),o&&(o.addClass(i.stateCSS.working),o.removeClass(i.stateCSS.apiError)),r.remoteUpdate().then(function(){o&&o.removeClass(i.stateCSS.working)},function(a){r.setValue("permComment",s),t.commentingPermissionDd.select(s),u.replaceClass("ui-icon-tiny-commentPermission"+e,"ui-icon-tiny-commentPermission"+s),o&&(o.removeClass(i.stateCSS.working),o.addClass(i.stateCSS.apiError)),t.onError(t.intlMessage({intlName:"photo-page-scrappy.COMMENT_PERMS_UPDATE_ERROR"})),n.error({err:a})})},setAddMetaPermission:function(e){var t=this,r=this.get("privacy"),s=r.getValue("permAddMeta"),o=this.get("container").one(".add-meta-permission"),u=this.get("container").one(".ui-icon-tiny-metaPermission"+s);r.setValue("permAddMeta",e),u.replaceClass("ui-icon-tiny-metaPermission"+s,"ui-icon-tiny-metaPermission"+e),o&&(o.addClass(i.stateCSS.working),o.removeClass(i.stateCSS.apiError)),r.remoteUpdate().then(function(){o&&o.removeClass(i.stateCSS.working)},function(a){r.setValue("permAddMeta",s),t.addMetaPermissionDd.select(s),u.replaceClass("ui-icon-tiny-metaPermission"+
e,"ui-icon-tiny-metaPermission"+s),o&&(o.removeClass(i.stateCSS.working),o.addClass(i.stateCSS.apiError)),t.onError(t.intlMessage({intlName:"photo-page-scrappy.META_PERMS_UPDATE_ERROR"})),n.error({err:a})})},handleFlagPhotoClick:function(t){t.preventDefault();var n=this.get("photo").getValue("safetyLevel"),r=this.get("personPreferences").getValue("safeSearch"),i,s,o,u=this;i=this.templates("flag-photo-dialog-content")({isSafe:n===0,isModerate:n===1,isRestricted:n===2,fallsWithinSettings:n<=r}),s=new e.Views["confirmation-dialog-view"]({photoID:this.photoId,appContext:this.appContext,title:this.intlMessage({intlName:"photo-page-scrappy.FLAG_PHOTO"}),icon:"ui-icon-modal-flag",content:i,confirmButtonLabel:this.intlMessage({intlName:"photo-page-scrappy.MARK_FOR_REVIEW"})}),s.render(),s.activate(),o=s.get("container"),o.all("a").on("click",function(){u.flagDialog.close(),u.flagDialog.destroy()}),s.registerEventHandler(o.one(".ui-dialog-button-confirm").on("click",this.handleFlagPhotoConfirmClick,this)),this.fire("subviewViewEvent","getDialogOffset",function(t){u.flagDialog=e.Views.dialog.getNewInstance("dialog-modal",{content:s.get("container"),appContext:u.appContext,offsetLeft:t,dialogClass:"scrappy-dialog"}),u.flagDialog.show()}),e.rapidTracker.beacon(this.name,"flagPhotoClick")},handleFlagPhotoConfirmClick:function(t){var n=this;e.rapidTracker.beacon(this.name,"flagPhotoConfirmationClick"),n.flagDialog.close(),n.flagDialog.destroy(),this.appContext.callAPI("flickr.moderation.flagPhoto",{photo_id:this.photoId,offensive:1}).then(function(e){n.get("container").one(".flag-photo").replace(n.intlMessage({intlName:"more-menu-view.PHOTO_HAS_BEEN_FLAGGED"}))},function(e){n.onError(n.intlMessage({intlName:"more-menu-view.PROBLEM_FLAGGING"}))})},handleError:function(e){return function(t){r.log(e,!t.toString||t.toString().match(/^\[object/)?t:t.toString())}},loadState:function(){var t=this,n={};return n.photo=this.appContext.getModel("photo-models",this.photoId),n.privacy=this.appContext.getModel("photo-privacy-models",this.photoId),this.appContext.getViewer().signedIn&&(n.personPreferences=this.appContext.getModel("person-preferences-models",this.appContext.getViewer().nsid)),(new e.FlickrPromise(n)).then(function(e){t.set("photo",e.photo),t.set("privacy",e.privacy),e.personPreferences&&t.set("personPreferences",e.personPreferences)})},activate:function(){var t=this,n=this.get("photo"),r=this.get("privacy"),s=n.getValue("owner").getValue("isMe"),o=this.get("container");return r&&this.registerEventHandler(r.on("valuesChanged",function(n){var i=e.PrivacyHelper.mapPrivacy(r.toJSON()),s=o.one(".c-charm-item-privacy i");s.hasClass("ui-icon-tiny-privacy"+i.toLowerCase())||t.privacyDd.select(i)})),o.one(".flag-photo")&&this.registerEventHandler(o.one(".flag-photo").on("click",this.handleFlagPhotoClick,this)),this.safetyLevelDd=new e.Views.Dropdown({appContext:this.appContext,container:o.one(i.css.safetyLevel),selected:n.getValue("safetyLevel"),disabled:!s}),this.safetyLevelDd.on("open",function(n){t.fire("subviewViewEvent","make in view",t.safetyLevelDd.get("container")),e.rapidTracker.beacon(t.name,"safetySettingMenuClick")}),this.safetyLevelDd.on("close",function(e){t.fire("subviewViewEvent","close in view")}),this.safetyLevelDd.on("selected",function(e){t.setSafetyLevel(e.clicked.value)}),this.privacyDd=new e.Views.Dropdown({appContext:this.appContext,container:o.one(i.css.privacy),selected:e.PrivacyHelper.mapPrivacy(this.get("privacy").toJSON()),disabled:!s}),this.privacyDd.on("open",function(n){t.fire("subviewViewEvent","make in view",t.privacyDd.get("container")),e.rapidTracker.beacon(t.name,"privacySettingMenuClick")}),this.privacyDd.on("close",function(e){t.fire("subviewViewEvent","close in view")}),this.privacyDd.on("selected",function(e){t.setPrivacy(e.clicked.value)}),this.commentingPermissionDd=new e.Views.Dropdown({appContext:this.appContext,container:o.one(i.css.commentingPermission),selected:this.get("privacy").getValue("permComment"),disabled:!s}),this.commentingPermissionDd.on("open",function(n){t.fire("subviewViewEvent","make in view",t.commentingPermissionDd.get("container")),e.rapidTracker.beacon(t.name,"photoCommentPermissionConfirmationClick")}),this.commentingPermissionDd.on("close",function(e){t.fire("subviewViewEvent","close in view")}),this.commentingPermissionDd.on("selected",function(e){t.setCommentingPermission(e.clicked.value)}),this.addMetaPermissionDd=new e.Views.Dropdown({appContext:this.appContext,container:o.one(i.css.addMetaPermission),selected:this.get("privacy").getValue("permAddMeta"),disabled:!s}),this.addMetaPermissionDd.on("open",function(n){t.fire("subviewViewEvent","make in view",t.addMetaPermissionDd.get("container")),e.rapidTracker.beacon(t.name,"photoAddMetaPermissionMenuClick")}),this.addMetaPermissionDd.on("close",function(e){t.fire("subviewViewEvent","close in view")}),this.addMetaPermissionDd.on("selected",function(e){t.setAddMetaPermission(e.clicked.value)}),this.on("destroy",function(){try{t.safetyLevelDd.destroy(),t.privacyDd.destroy(),t.commentingPermissionDd.destroy(),t.addMetaPermissionDd.destroy()}catch(e){}}),this}})},"@VERSION@",{requires:["flickr-view","flickr-promise","dialog","dropdown","hermes-template-sub-photo-additional-info","sub-photo-additional-info-view-css","privacy-helper","hermes-template-flag-photo-dialog-content"],optional:[],langBundles:["common","photo-page-scrappy","settings"]});
YUI.add("sub-photo-right-view",function(e){e.FlickrView.create(this.name,e.FlickrView,[],{initializer:function(e){return this.nsid=e.nsid,this.photoId=e.photoId,this.backToURL=e.backToURL,this.isOwner=e.isOwner,this.get("container").get("innerHTML")===""&&this.setContainerHTML(""),this},subviewConfig:{"photo-charm-exif-scrappy-view":{requiredToShowOnClient:!1,requiredToShowOnServer:!1},"sub-photo-right-stats-view":{requiredToShowOnClient:!1,requiredToShowOnServer:!0},"sub-photo-date-view":{requiredToShowOnClient:!1,requiredToShowOnServer:!0},"photo-license-view":{requiredToShowOnClient:!1,requiredToShowOnServer:!0},"sub-photo-tags-view":{requiredToShowOnClient:!1,requiredToShowOnServer:!1},"sub-photo-contexts-view":{requiredToShowOnClient:!1,requiredToShowOnServer:!1},"sub-photo-additional-info-view":{requiredToShowOnClient:!1,requiredToShowOnServer:!1}},loadState:function(){return e.Promise.resolve()},buildContainer:function(){return this.setContainerWithTemplate("sub-photo-right"),this},buildErrorContainer:function(){},activate:function(){return this}})},"@VERSION@",{requires:["flickr-view","hermes-template-sub-photo-right","sub-photo-right-css","photo-charm-exif-scrappy-view-css","url-helper"],optional:["photo-charm-exif-scrappy-view","sub-photo-right-stats-view","sub-photo-contexts-view","photo-license-view","sub-photo-date-view","sub-photo-additional-info-view"]});
YUI.add("hermes-template-sub-photo-keyboard-shortcuts",function(e,t){var n=e.Template.Handlebars.revive({1:function(e,t,n,r,i){var s,o=t!=null?t:{},u=n.helperMissing,a=e.escapeExpression;return' <div class="sub-photo-keyboard-shortcuts">\n'+((s=n["if"].call(o,t!=null?t.signedIn:t,{name:"if",hash:{},fn:e.program(2,i,0),inverse:e.noop,data:i}))!=null?s:"")+'\n <!--Search Shortcut -->\n <div class="key-container">\n <span class="search-key key">S</span>\n <span class="search-key-label key-label">'+a((n.intlMessage||t&&t.intlMessage||u).call(o,{name:"intlMessage",hash:{intlName:"common.SEARCH"},data:i}))+'</span>\n </div>\n\n <!--Photo Navigation Shortcut -->\n <div class="key-container">\n <span class="photo-navigation-key-left key"><i class="photo-navigation-key-icon-left"></i></span>\n <span class="photo-navigation-key-right key"><i class="photo-navigation-key-icon-right"></i></span>\n <span class="photo-navigation-key-label key-label">'+a((n.intlMessage||t&&t.intlMessage||u).call(o,{name:"intlMessage",hash:{intlName:"photo-page-scrappy.PHOTO_NAVIGATION"},data:i}))+'</span>\n </div>\n\n <!--Thumbnail Navigation Shortcut -->\n <div class="key-container">\n <span class="thumbnail-navigation-key-left key"> < </span>\n <span class="thumbnail-navigation-key-right key"> > </span>\n <span class="thumbnail-navigation-key-label key-label">'+a((n.intlMessage||t&&t.intlMessage||u).call(o,{name:"intlMessage",hash:{intlName:"photo-page-scrappy.THUMBNAIL_NAVIGATION"},data:i}))+"</span>\n </div>\n\n <!--Zoom Shortcut -->\n"+((s=n["if"].call(o,t!=null?t.enableZoom:t,{name:"if",hash:{},fn:e.program(5,i,0),inverse:e.program(7,i,0),data:i}))!=null?s:"")+'\n <!--Back to Context Shortcut -->\n <div class="key-container'+((s=n.unless.call(o,t!=null?t.canGoBackTo:t,{name:"unless",hash:{},fn:e.program(3,i,0),inverse:e.noop,data:i}))!=null?s:"")+'">\n <span class="back-to-context-key key">B</span>\n <span class="back-to-context-key-label key-label">'+a((n.intlMessage||t&&t.intlMessage||u).call(o,{name:"intlMessage",hash:{intlName:"photo-page-scrappy.BACK_TO_CONTEXT"},data:i}))+"</span>\n </div>\n\n"+((s=n["if"].call(o,t!=null?t.signedIn:t,{name:"if",hash:{},fn:e.program(9,i,0),inverse:e.noop,data:i}))!=null?s:"")+" </div>\n"},2:function(e,t,n,r,i){var s,o=t!=null?t:{},u=n.helperMissing,a=e.escapeExpression;return' <!--Favorite Shortcut -->\n <div class="key-container'+((s=n["if"].call(o,t!=null?t.isOwner:t,{name:"if",hash:{},fn:e.program(3,i,0),inverse:e.noop,data:i}))!=null?s:"")+'">\n <span class="favorite-key key">F</span>\n <span class="favorite-key-label key-label">'+a((n.intlMessage||t&&t.intlMessage||u).call(o,{name:"intlMessage",hash:{intlName:"common.FAVORITE"},data:i}))+'</span>\n </div>\n\n <!--Comment Shortcut -->\n <div class="key-container'+((s=n.unless.call(o,t!=null?t.canAddComment:t,{name:"unless",hash:{},fn:e.program(3,i,0),inverse:e.noop,data:i}))!=null?s:"")+'">\n <span class="comment-key key">C</span>\n <span class="comment-key-label key-label">'+a((n.intlMessage||t&&t.intlMessage||u).call(o,{name:"intlMessage",hash:{intlName:"photo-page-scrappy.COMMENT"},data:i}))+"</span>\n </div>\n"},3:function(e,t,n,r,i){return" disabled"},5:function(e,t,n,r,i){return' <div class="key-container">\n <span class="search-key key">Z</span>\n <span class="search-key-label key-label">'+e.escapeExpression((n.intlMessage||t&&t.intlMessage||n.helperMissing).call(t!=null?t:{},{name:"intlMessage",hash:{intlName:"photo-page-scrappy.ZOOM"},data:i}))+"</span>\n </div>\n"},7:function(e,t,n,r,i){return' <!--Lightbox Shortcut -->\n <div class="key-container">\n <span class="search-key key">L</span>\n <span class="search-key-label key-label">'+e.escapeExpression((n.intlHTMLMessage||t&&t.intlHTMLMessage||n.helperMissing).call(t!=null?t:{},{name:"intlHTMLMessage",hash:{intlName:"photo-page-scrappy.VIEW_IN_LIGHTBOX"},data:i}))+"</span>\n </div>\n"},9:function(e,t,n,r,i){var s,o=t!=null?t:{},u=n.helperMissing,a=e.escapeExpression;return"\n"+((s=n["if"].call(o,t!=null?t.isOwner:t,{name:"if",hash:{},fn:e.program(10,i,0),inverse:e.program(12,i,0),data:i}))!=null?s:"")+'\n <!--Tagging Shortcuts -->\n <div class="key-container'+((s=n.unless.call(o,t!=null?t.canAddMeta:t,{name:"unless",hash:{},fn:e.program(3,i,0),inverse:e.noop,data:i}))!=null?s:"")+'">\n <span class="add-tag-key key">T</span>\n <span class="add-tag-key-label key-label">'+a((n.intlMessage||t&&t.intlMessage||u).call(o,{name:"intlMessage",hash:{intlName:"photo-page-scrappy.ADD_TAG"},data:i}))+'</span>\n </div>\n\n <div class="key-container'+((s=n.unless.call(o,t!=null?t.canAddMeta:t,{name:"unless",hash:{},fn:e.program(3,i,0),inverse:e.noop,data:i}))!=null?s:"")+'">\n <span class="add-person-key key">P</span>\n <span class="add-person-key-label key-label">'+a((n.intlMessage||t&&t.intlMessage||u).call(o,{name:"intlMessage",hash:{intlName:"photo-page-scrappy.ADD_PERSON"},data:i}))+"</span>\n </div>\n"},10:function(e,t,n,r,i){var s,o=t!=null?t:{},u=n.helperMissing,a=e.escapeExpression;return'\n <!--Add to Group Shortcut -->\n <div class="key-container'+((s=n.unless.call(o,t!=null?t.canAddToGroup:t,{name:"unless",hash:{},fn:e.program(3,i,0),inverse:e.noop,data:i}))!=null?s:"")+'">\n <span class="add-to-group-key key">G</span>\n <span class="add-to-group-key-label key-label">'+a((n.intlMessage||t&&t.intlMessage||u).call(o,{name:"intlMessage",hash:{intlName:"photo-page-scrappy.ADD_TO_GROUP"},data:i}))+'</span>\n </div>\n\n <!--Add to album Shortcut -->\n <div class="key-container'+((s=n.unless.call(o,t!=null?t.canAddToAlbum:t,{name:"unless",hash:{},fn:e.program(3,i,0),inverse:e.noop,data:i}))!=null?s:"")+'">\n <span class="add-to-album-key key">A</span>\n <span class="add-to-album-key-label key-label">'+a((n.intlMessage||t&&t.intlMessage||u).call(o,{name:"intlMessage",hash:{intlName:"photo-page-scrappy.ADD_TO_ALBUM"},data:i}))+"</span>\n </div>\n\n"
},12:function(e,t,n,r,i){var s,o=t!=null?t:{},u=n.helperMissing,a=e.escapeExpression;return'\n <!--Invite to group Shortcut -->\n <div class="key-container'+((s=n.unless.call(o,t!=null?t.canInviteToGroup:t,{name:"unless",hash:{},fn:e.program(3,i,0),inverse:e.noop,data:i}))!=null?s:"")+'">\n <span class="add-to-group-key key">G</span>\n <span class="add-to-group-key-label key-label">'+a((n.intlMessage||t&&t.intlMessage||u).call(o,{name:"intlMessage",hash:{intlName:"photo-page-scrappy.INVITE_TO_GROUP"},data:i}))+'</span>\n </div>\n\n <!--Add to gallery Shortcut -->\n <div class="key-container'+((s=n.unless.call(o,t!=null?t.canAddToGallery:t,{name:"unless",hash:{},fn:e.program(3,i,0),inverse:e.noop,data:i}))!=null?s:"")+'">\n <span class="add-to-album-key key">A</span>\n <span class="add-to-album-key-label key-label">'+a((n.intlMessage||t&&t.intlMessage||u).call(o,{name:"intlMessage",hash:{intlName:"photo-page-scrappy.ADD_TO_GALLERY"},data:i}))+"</span>\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.keyboardShortcutsEnabled:t,{name:"if",hash:{},fn:e.program(1,i,0),inverse:e.noop,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/sub-photo-keyboard-shortcuts",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("sub-photo-keyboard-shortcuts-view",function(e){e.FlickrView.create(this.name,e.FlickrView,[],{langBundles:this.details.langBundles,initializer:function(e){return this.nsid=e.nsid,this.photoId=e.photoId,this.backToURL=e.backToURL,this.hideBackToLink=e.hideBackToLink,this.get("container").get("innerHTML")===""&&this.setContainerHTML(""),this},loadState:function(){var t=this,n=[];return n.push(t.appContext.getModel("photo-models",t.photoId).then(function(e){t.set("photo",e)})),n.push(t.appContext.getModel("photo-privacy-models",t.photoId).then(function(e){t.set("photoPrivacyModel",e)})),t.appContext.getViewer().signedIn&&n.push(t.appContext.getModel("person-groups-models",t.appContext.getViewer().nsid).then(function(e){t.set("personGroupsModel",e)})),e.Promise.all(n)},buildContainer:function(){return this.setContainerWithTemplate("sub-photo-keyboard-shortcuts",{signedIn:this.appContext.getViewer().signedIn,isOwner:this.get("photo").getValue("owner").getValue("isMe"),enableZoom:this.appContext.flipper.isFlipped("enable-scrappy-zoom"),canAddToAlbum:this.canAddToAlbum(),canAddToGallery:this.canAddToGallery(),canAddToGroup:this.canAddToGroup(),canInviteToGroup:this.canInviteToGroup(),canAddMeta:this.canAddMeta(),canAddComment:this.get("photo").getValue("canComment"),canGoBackTo:!this.hideBackToLink,keyboardShortcutsEnabled:this.appContext.getViewer().prefs.keyboardShortcutsEnabled}),this},canAddToGallery:function(){var e=this.get("photo").getValue("safetyLevel")===0,t=this.get("photoPrivacyModel").getValue("isPublic");return e&&t&&this.appContext.getViewer().nsid!==this._params.nsid&&this.appContext.getViewer().signedIn},canAddToAlbum:function(){return this.appContext.getViewer().nsid===this._params.nsid},canAddToGroup:function(){var e=this.appContext.getViewer().nsid,t=this.get("photo").getValue("owner").getValue("id"),n=this.get("personGroupsModel");return t===e&&n&&(this.get("personGroupsModel").getValue("memberCount")>0||this.get("personGroupsModel").getValue("adminCount")>0||this.get("personGroupsModel").getValue("moderatorCount")>0)},canInviteToGroup:function(){var e=this.appContext.getViewer().nsid,t=this.get("photo").getValue("owner").getValue("id"),n=this.get("personGroupsModel");return t!==e&&n&&n.getValue("adminCount")>0},canAddMeta:function(){var e=this.get("photo");return e.getValue("owner")||e.getValue("canAddMeta")},buildErrorContainer:function(){},activate:function(){return this}})},"@VERSION@",{requires:["flickr-view","hermes-template-sub-photo-keyboard-shortcuts","url-helper","sub-photo-keyboard-shortcuts-css"],optional:[],langBundles:["common","photo-page-scrappy"]});
YUI.add("sub-photo-view",function(e){e.FlickrView.create(this.name,e.FlickrView,[],{initializer:function(e){return this.nsid=e.nsid,this.photoId=e.photoId,this.backToURL=e.backToURL,this.get("container").get("innerHTML")===""&&this.setContainerHTML(""),this},subviewConfig:{"sub-photo-left-view":{requiredToShowOnClient:!0,requiredToShowOnServer:!0},"sub-photo-right-view":{requiredToShowOnClient:!0,requiredToShowOnServer:!0},"sub-photo-keyboard-shortcuts-view":{requiredToShowOnClient:!1,requiredToShowOnServer:!1}},loadState:function(){return e.Promise.resolve()},buildContainer:function(){return this.setContainerWithTemplate("sub-photo"),this},buildErrorContainer:function(){},activate:function(){return this}})},"@VERSION@",{requires:["flickr-view","hermes-template-sub-photo","sub-photo-css","url-helper"],optional:["sub-photo-left-view","sub-photo-right-view","sub-photo-keyboard-shortcuts-view"]});
YUI.add("hermes-template-signup-footer",function(e,t){var n=e.Template.Handlebars.revive({1:function(e,t,n,r,i){return"mini-footer"},3:function(e,t,n,r,i){return"large-footer"},5:function(e,t,n,r,i){return"has-logo"},7:function(e,t,n,r,i){return' <div class="close-x"></div>\n'},9:function(e,t,n,r,i){var s;return(s=(n.isFlipped||t&&t.isFlipped||n.helperMissing).call(t!=null?t:{},"mini-signup-footer-avatar",{name:"isFlipped",hash:{},fn:e.program(10,i,0),inverse:e.program(12,i,0),data:i}))!=null?s:""},10:function(e,t,n,r,i){var s;return' <div class="avatar person" style="background-image: url('+e.escapeExpression((s=(s=n.buddyIcon||(t!=null?t.buddyIcon:t))!=null?s:n.helperMissing,typeof s=="function"?s.call(t!=null?t:{},{name:"buddyIcon",hash:{},data:i}):s))+')"></div>\n'},12:function(e,t,n,r,i){return' <div class="logo"></div>\n'},14:function(e,t,n,r,i){return' <div class="logo"></div>\n'},16:function(e,t,n,r,i){return"mini"},18:function(e,t,n,r,i){return"large"},20:function(e,t,n,r,i){return"miniSignupFooterSignupClick"},22:function(e,t,n,r,i){return"signupFooterSignupClick"},24:function(e,t,n,r,i){return"miniSignupFooterSigninClick"},26:function(e,t,n,r,i){return"signupFooterSigninClick"},compiler:[7,">= 4.0.0"],main:function(e,t,n,r,i){var s,o,u=t!=null?t:{},a=n.helperMissing,f=e.escapeExpression;return'<div class="signup-footer '+((s=n["if"].call(u,t!=null?t.isMiniFooter:t,{name:"if",hash:{},fn:e.program(1,i,0),inverse:e.program(3,i,0),data:i}))!=null?s:"")+" "+((s=(n.isNotFlipped||t&&t.isNotFlipped||a).call(u,"mini-signup-footer-avatar",{name:"isNotFlipped",hash:{},fn:e.program(5,i,0),inverse:e.noop,data:i}))!=null?s:"")+'">\n'+((s=(n.isFlipped||t&&t.isFlipped||a).call(u,"mini-signup-footer-cancellable",{name:"isFlipped",hash:{},fn:e.program(7,i,0),inverse:e.noop,data:i}))!=null?s:"")+((s=n["if"].call(u,t!=null?t.isProfilePage:t,{name:"if",hash:{},fn:e.program(9,i,0),inverse:e.program(14,i,0),data:i}))!=null?s:"")+' <p class="truncate">'+f((o=(o=n.message||(t!=null?t.message:t))!=null?o:a,typeof o=="function"?o.call(u,{name:"message",hash:{},data:i}):o))+'</p>\n <a href="/signup" class="'+((s=n["if"].call(u,t!=null?t.isMiniFooter:t,{name:"if",hash:{},fn:e.program(16,i,0),inverse:e.program(18,i,0),data:i}))!=null?s:"")+' butt" data-track="'+((s=n["if"].call(u,t!=null?t.isMiniFooter:t,{name:"if",hash:{},fn:e.program(20,i,0),inverse:e.program(22,i,0),data:i}))!=null?s:"")+'">'+f((n.intlMessage||t&&t.intlMessage||a).call(u,{name:"intlMessage",hash:{intlName:"sohp.SIGN_UP_WITH_YAHOO"},data:i}))+'</a>\n <p class="signin">or <a href="/signin" data-track="'+((s=n["if"].call(u,t!=null?t.isMiniFooter:t,{name:"if",hash:{},fn:e.program(24,i,0),inverse:e.program(26,i,0),data:i}))!=null?s:"")+'">'+f((n.intlMessage||t&&t.intlMessage||a).call(u,{name:"intlMessage",hash:{intlName:"common.SIGN_IN"},data:i}))+"</a><p>\n</div>\n"},useData:!0}),r={};e.Array.each([],function(t){var n=e.Template.get("hermes/"+t);n&&(r[t]=n)}),e.Template.register("hermes/signup-footer",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("signup-footer-view",function(e,t){"use strict";var n=200;e.namespace("Views").SignUpFooterView=e.FlickrView.create(this.name,e.FlickrView,[],{langBundles:this.details.langBundles,initializer:function(e){this.set("pageNSID",e.nsid),this.set("groupID",e.groupId),this.set("pageType",e.pageType!==undefined?e.pageType:"profile"),this.set("messageIntlName",e.messageIntlName),this.set("query",e.searchTerm),this.appContext.flipper.isFlipped("enable-large-sign-up-footer")?(this.set("modalType",""),this.set("beaconPrefix","signupFooter")):(this.set("modalType","mini"),this.set("beaconPrefix","miniSignupFooter"))},loadState:function(){var t=this;return this.get("pageType")==="profile"?this.appContext.getModel("person-models",this.get("pageNSID")).then(function(e){t.set("personModel",e)}):this.get("pageType")==="group"?this.appContext.getModel("group-info-models",this.get("groupID")).then(function(e){t.set("groupModel",e)}):e.Promise.resolve()},buildContainer:function(){var t={isProfilePage:this.get("pageType")==="profile"||this.get("pageType")==="group"};return this.get("pageType")==="profile"?(t.buddyIcon=this.appContext.flipper.isFlipped("mini-signup-footer-avatar")?this.get("personModel").getValue("buddyicon").default:"",t.message=this.intlMessage({intlName:"growth.MINI_SIGNUP_FOOTER_MESSAGE",username:e.flutil.unescape(this.get("personModel").getValue("displayname"))})):this.get("pageType")==="explore"?t.message=this.intlMessage({intlName:"growth.MINI_SIGNUP_FOOTER_MESSAGE_EXPLORE"}):this.get("pageType")==="group"?(t.buddyIcon=this.appContext.flipper.isFlipped("mini-signup-footer-avatar")?this.get("groupModel").getValue("group").getValue("bestIconURL"):"",t.message=this.intlMessage({intlName:"growth.MINI_SIGNUP_FOOTER_MESSAGE",username:e.flutil.unescape(this.get("groupModel").getValue("group").getValue("title"))})):t.message=this.intlMessage({intlName:"growth.MINI_SIGNUP_FOOTER_MESSAGE_SEARCH",query:this.get("query")}),this.get("modalType")==="mini"&&(t.isMiniFooter=!0),this.setContainerWithTemplate("signup-footer",t),this},activate:function(){this.set("showPopup",!0),this.get("showPopup")&&(this.initialScroll=e.config.win.pageYOffset,this.signupFooterNode=this.get("container").one(".signup-footer"),this.signupFooterHeight=parseInt(this.signupFooterNode.getStyle("height"),10),this.registerEventHandler(e.globalEvents.subscribe("window:scroll:nothrottle",this.handleScroll.bind(this)))),this.appContext.flipper.isFlipped("mini-signup-footer-cancellable")&&this.get("container").one(".close-x")&&this.registerEventHandler(this.get("container").one(".close-x").on("click",this.handleCancelClick.bind(this))),this.footerContainer=e.one(".footer-full-view"),this.footer=this.footerContainer?e.one("footer.foot"):null},showMiniSignupFooter:function(){var t,n=e.StorageHelper.getItem("miniSignupFooterSeen"),r;return n?(n=e.moment(n,"x"),r=e.moment().subtract(1,"days"),r>n&&(t=!0)):t=!0,t},handleCancelClick:function(n){this.signupFooterNode&&(this.signupFooterNode.removeClass("show"),this.signupFooterNode.removeClass("footer-bottom")),e.rapidTracker.beacon(t,this.get("beaconPrefix")+"CancelClick"),this.set("showPopup",!1)},handleScroll:function(r){if(!this.get("showPopup"))return;var i=e.config.win.pageYOffset-this.initialScroll,s=i-n,o;Math.abs(i)>n||i<=0?Math.abs(this.signupFooterHeight-s)>=0&&i>0&&(this.signupFooterNode.hasClass("show")||(this.signupFooterNode.addClass("show"),e.rapidTracker.beacon(t,this.get("beaconPrefix")+"Show"))):this.signupFooterNode.hasClass("show")&&!this.appContext.flipper.isFlipped("mini-signup-footer-cancellable")&&(this.signupFooterNode.removeClass("show"),e.rapidTracker.beacon(t,this.get("beaconPrefix")+"Hide")),o=e.config.win.pageYOffset+this.appContext.viewportData.getHeight(),this.footerContainer.getComputedStyle("display")!=="none"&&o>=this.footer.getY()?this.signupFooterNode.hasClass("footer-bottom")||this.signupFooterNode.addClass("footer-bottom"):this.signupFooterNode.removeClass("footer-bottom")}},{ATTRS:{isActiveViewAgnostic:{value:!0}}})},"@VERSION@",{requires:["flickr-view","hermes-template-signup-footer","signup-footer-css","storage-helper","moment","flutil"],optionalRequires:["global-events"],langBundles:["common","sohp","growth"]});
YUI.add("hermes-lang-sohp",function(e,t){e.Intl.add("hermes/sohp","en-US",{MAIN_BUCKET_HEADLINE:["Flickr. The home for all your photos."],MAIN_BUCKET_HEADLINE_NEW:["The home for all your photos."],MAIN_BUCKET_BODY:["Upload, access, organize, edit, and share your photos from any device, from anywhere in the world."],SIGN_UP_WITH_YAHOO:["Sign up with Yahoo"],SPACE_BUCKET_HEADLINE:["Never delete a photo again"],SPACE_BUCKET_BODY:["Get 1,000GB of free photo storage. We\u2019ll even help you automatically backup your entire collection."],PLATFORMS_BUCKET_HEADLINE:["Your photos from anywhere"],PLATFORMS_BUCKET_BODY:["Wherever you go your photos will follow you. See, edit, and share with our award-winning apps."],LEARN_MORE:["Learn more"],SEARCH_BUCKET_HEADLINE:["A quantum leap in search"],SEARCH_BUCKET_BODY:["We've made strides with photo search. It's now the fastest, easiest way to find the exact photo you want."],INSPIRATION_BUCKET_HEADLINE:["Breath-taking inspiration"],INSPIRATION_BUCKET_BODY:["Find beautiful photos shared by a community of amateur and professional photographers."],TAKE_MY_BREATH_AWAY:["Take my breath away"],GET_STARTED_WITH_STORAGE:["Get started with your free 1,000GB of photo storage"],INSPIRE_ME:["Inspire me"],SIGN_IN:["sign in"],PAGE_TITLE:["Flickr | The home for all your photos | Get 1,000GB free photo storage"],PAGE_DESCRIPTION:["The home for all your photos. Upload, access, organize, edit, and share your photos from any device, from anywhere in the world. Get 1,000GB of photo storage free."],SOHP_COMMUNITY_HEADLINE:["Your home for inspiring photography."],SOHP_COMMUNITY_SUBTITLE:["Discover the most interesting photos in the world."],SOHP_COMMUNITY_TITLE_INSPIRE:["Get Inspired"],SOHP_COMMUNITY_BODY_INSPIRE:["Browse trending photos every day from some of the biggest names in the world like NASA, The White House, Cuba Gallery."],SOHP_COMMUNITY_TITLE_PASSION:["Explore your passion"],SOHP_COMMUNITY_BODY_PASSION:["Connect with a dynamic community to explore any interest you can imagine."],SOHP_COMMUNITY_TITLE_FIND:["Find the perfect photo"],SOHP_COMMUNITY_BODY_FIND:["Search over 12 billion photos like never before, by color, aesthetics, and licence type. Your presentations will thank you."],SOHP_COMMUNITY_FOOTER:["Join the world's largest photography community"],SOHP_MANAGEMENT_HEADLINE:["The home for all your photos"],SOHP_MANAGEMENT_SUBTITLE:["Private photo management for all your devices."],SOHP_MANAGEMENT_TITLE_STORAGE:["Expansive storage"],SOHP_MANAGEMENT_BODY_STORAGE:["Never delete a photo or video again with 1,000 GB of free storage."],SOHP_MANAGEMENT_TITLE_BACKUP:["Automated backup"],SOHP_MANAGEMENT_BODY_BACKUP:["Automatically back up your entire collection from your computer, iOS, and Android device."],SOHP_MANAGEMENT_TITLE_ORGANIZATION:["Simple organization"],SOHP_MANAGEMENT_BODY_ORGANIZATION:["Organize hundreds of photos and videos using the camera roll view."],SOHP_MANAGEMENT_TITLE_SEARCH:["Smart search"],SOHP_MANAGEMENT_BODY_SEARCH:["Easily find the exact photo you want with our intelligent photo search."],SOHP_MANAGEMENT_TITLE_ACCESS:["Easy access"],SOHP_MANAGEMENT_BODY_ACCESS:["Access your photos and videos from anywhere with our award-winning apps."],SOHP_MANAGEMENT_TITLE_SHARING:["Seamless sharing"],SOHP_MANAGEMENT_BODY_SHARING:["Share your memories privately on any social network."],SOHP_MANAGEMENT_FOOTER:["Get started with your free 1,000 GB of photo storage"]})},"@VERSION@",{requires:["intl"]});
YUI.add("photo-page-scrappy-view",function(e){e.FlickrView.create(this.name,e.FlickrView,[],{langBundles:this.details.langBundles,initializer:function(t){var n=this;this.backToURL=t.backToURL,this.hideBackToLink=t.hideBackToLink||!1,this.entryTypeIntlKey=t.entryTypeIntlKey,this.photoId=t.photoId,this.isOwner=t.isOwner,this.context=e.clone(t.context,!0),this.nsid=t.nsid,t.isOwner=this.isOwner,t.fullscreen?this.appContext.experiments.fullscreen.enableFullscreen():this.appContext.experiments.fullscreen.disableFullscreen(),this.appContext.getViewer().signedIn&&(t.signinPendingQueue=e.SigninHelper.checkPendingQueue(this.appContext));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.appContext.getModel("photo-models",this.photoId).then(function(t){t.on("valuesChanged",function(t){t.title&&e.one&&e.one("head title").set("text",n.intlMessage({intlName:"photo-page-scrappy.PAGE_TITLE",title:t.title.newVal}))})}),YUI.Env.isServer&&this.appContext&&this.appContext.flipper.isFlipped("enable-better-photo-page-seo")&&(this.appContext.forceServerRender=this.appContext._doForcedServerRender()),t.logViewTimings=!0,this},subviewConfig:{"photo-well-scrappy-view":{requiredToShowOnClient:!0,requiredToShowOnServer:!0,dealbreaker:!0},"photo-head-meta-view":{requiredToShowOnClient:!1,requiredToShowOnServer:!0},"global-nav-view":{requiredToShowOnClient:!1,requiredToShowOnServer:!0},"sub-photo-view":{requiredToShowOnClient:!0,requiredToShowOnServer:!0},"signup-footer-view":{requiredToShowOnClient:!1,requiredToShowOnServer:!1,disabled:function(e){return e.isMobile||!this.appContext.flipper.isFlipped("enable-mini-sign-up-footer")||this.appContext.getViewer().signedIn||this.appContext.lang!=="en-US"}},"footer-full-view":{requiredToShowOnClient:!1,requiredToShowOnServer:!0}},additionalViewClasses:function(){var e=[];return!this.appContext.getViewer().signedIn&&this.appContext.flipper.isFlipped("global-nav-enabled")&&e.push("has-global-nav"),e},loadState:function(){var e=this;return this.appContext.getModel("photo-models",e.photoId).then(function(t){e.set("photo",t)})},buildContainer:function(){var t,n=!1;return n?t="":t=this.subviews["global-nav-view"].get("container"),this.setContainerWithTemplate("photo-page-scrappy",{"global-nav-view":t,"photo-well-view":this.subviews["photo-well-scrappy-view"]?this.subviews["photo-well-scrappy-view"].get("container"):""}),e.fletrics.increment("test.photo.page.requests"),this},activate:function(){var t=this,n;return this.appContext.adManager.isEnabled()&&(this.appContext.adManager.updatePhotoAdsCounter(),this.appContext.adManager.fetchAdIfRequired({spaceid:this.get("spaceid")})),this.appContext.flipper.isFlipped("enable-curator-tools")&&this.appContext.getViewer().isInsecureGod&&(n=new e.Views["curator-photo-tools-view"]({nsid:t.nsid,photoId:t.photoId}),n.appContext=this.appContext,n.loadState().then(function(){n.buildContainer(),n.activate(),this.curatorPhotoToolsView=n}),this.curatorPhotoToolsView=n),this},closeDialog:function(t){e.config.win.location.href=this.backToURL},onSubviewEvent:function(e,t){var n;if(t&&t.length>0&&!(t[0]==="make in view"&&t.length>1)&&t[0]!=="close in view")if(t[0]==="getDialogOffset")t[1]&&typeof t[1]=="function"&&(n=this.subviews["photo-well-scrappy-view"].get("container"),n&&t[1](parseInt(n.getStyle("right").replace("px",""),10)/2));else if(t[0]==="setRedirect")this.get("container").all("input[name=redirect_url]").setAttribute("value",window.location.pathname),typeof t[1]=="function"&&t[1]();else{if(t[0]==="rightClickPhoto")return!1;t[0]==="photo:reload"?this.reload(["photo-models","photostream-models","photo-exif-models"],this.photoId):(t[0]==="disable-sharing"||t[0]==="enable-sharing")&&this.fire("parentViewEvent",t[0])}},getTrackingSegments:function(){return{context:this.context.modelName.replace("-models",""),vwrOwner:this.isOwner?1:0,licnsbl:this.get("photo").getValue("isMarketplaceLicensable")}},destructor:function(){clearTimeout(this.scrollTimeout),this.curatorPhotoToolsView&&this.curatorPhotoToolsView.destroy()},buildErrorContainer:function(){this.error&&this.error.is404&&this.appContext.flapp.navigate("/error/notfound")}},{ATTRS:{spaceid:{value:792600543}}}),e.Base.plug(e.Views[this.name],e.Plugin.FlickrView.TTFPRecorderPlugin,{selector:".main-photo"})},"@VERSION@",{requires:["flickr-view","hermes-template-photo-page-scrappy","photo-css","util-css","fletrics","ttfp-recorder-plugin","signin-helper","dialog","overflow-helper","url","fluid-css","curator-photo-tools-view"],optional:["photo-well-scrappy-view","photo-head-meta-view","global-nav-view","sub-photo-view","signup-footer-view"],langBundles:["common","photo-page-scrappy"]});
YUI.add("photo-route",function(e,t){function s(e){s.superclass.constructor.call(this,e)}var n=require("lib/helpers/type-validator"),r=require("lib/flog")(t),i={activity_feed:{backToIntlKey:"BACK_TO_ACTIVITY_FEED",usesWith:!1},album:{backToIntlKey:"BACK_TO_ALBUM",usesWith:!0},commons:{backToIntlKey:"BACK_TO_COMMONS",usesWith:!1},contacts_list:{backToIntlKey:"BACK_TO_CONTACTS_LIST",usesWith:!1},explore:{backToIntlKey:"BACK_TO_EXPLORE",usesWith:!0},favorites:{backToIntlKey:"BACK_TO_FAVORITES",usesWith:!0},gallery:{backToIntlKey:"BACK_TO_GALLERY",usesWith:!0},groups:{backToIntlKey:"BACK_TO_GROUPS"},group:{backToIntlKey:"BACK_TO_GROUP",usesWith:!0,withParamName:"pool/with"},map:{backToIntlKey:"BACK_TO_MAP",usesWith:!1},photostream:{backToIntlKey:"BACK_TO_PHOTOSTREAM",usesWith:!0},profile:{backToIntlKey:"BACK_TO_PROFILE",usesWith:!1},search:{backToIntlKey:"BACK_TO_SEARCH",usesWith:!1},shares:{backToIntlKey:"BACK_TO_SHARED_PHOTOS",usesWith:!1},tags:{backToIntlKey:"BACK_TO_TAG",usesWith:!1},tag:{backToIntlKey:"BACK_TO_TAG",usesWith:!1}};e.Routes[this.name]=s,e.extend(s,e.FlickrRoute,{langBundles:this.details.langBundles,run:function(t,i){var s=this,o=t.params.nsid_or_path_alias,u=t.params.photo_id,a=t.params.context,f=t.params.lightbox==="lightbox",l=t.params.vr==="vr",c=t.params.comment_id,h={id:u},p=t.query||{},d=!1,v;return c&&i.redirect(t.url.replace("/"+c,"")+"#"+c),n.nsid(o)?h.userId=o:h.pathAlias=o,v=s.parseContext(a,o,t),v&&v.params&&v.params.isSharedEntity?this.appContext.setGPCredentials({gp_code:v.params.gpCode,gp_owner:v.params.gpOwner,share_code:v.params.gpCode}):this.appContext.setGPCredentials(null),p&&p.cr!==undefined&&(d=!0),this.appContext.flipper.isFlipped("get-context-photos-in-photo-page-route")&&(v&&v.params&&v.modelName&&v.modelName!=="photostream-models"?h.context=a:h.context="photostream"),this.appContext.getModel("photo-models",h).then(function(n){var u,c,h,p,m,g,y,b,w,E,S;g=f?"photo-page-lightbox-scrappy-view":"photo-page-scrappy-view",y="scrolling",b="photo-page-ad-scrappy-view",w="scrolling",u=s.verifyPhotoIsViewable(n),m=s.detectRouteErrors(u);if(m.length)return s.displayRouteErrors(t,m);c=s.verifyPhotoIsOwnedByPerson(n,o),S=c,m=s.detectRouteErrors(c);if(m.length)return s.displayRouteErrors(t,m);var x=6,T=12;s.appContext.forceServerRender&&(x=2,T=0),s.detectBackToDestination(t,{person:o,photoId:u,context:a}),E=s.getBackToData();if(m.length)return s.displayRouteErrors(t,m);v.modelName==="photostream-models"&&(v.params.id=e.Models[v.modelName].buildCompoundId(c,v.params.orderBy,v.params.viewAs),S=v.params.id,delete v.params.pathAlias);if(s.appContext.adManager.isEnabled()&&s.appContext.adManager.adNext()&&!f&&!t.UA.isMobileBrowser){p=s.appContext.adManager.getAdJSON();if(p&&e.Lang.isObject(p))return h=p.brand||"",{view:b,params:{ad:!0,photoId:u,nsid:c,photostreamId:S,context:v,backToURL:E.path,hideBackToLink:d,entryTypeIntlKey:E.backToIntlKey,numberOfPositionsToPreFetch:x,numberOfPositionsToRefetchAt:T},title:h,layout:w,fluid:!0};r.error("Could not extract brand name from brand payload",{ad:p})}var N=!0,C=!1;return s.appContext.flipper.isFlipped("enable-new-mobile-photo-page")&&s.isProcessedAsMobileRequest(t,i)&&(g="mobile-photo-page-view",N=!1,C=!0),t.UA.isFacebook&&(g="photo-page-meta-tags-only",y="opengraph",N=!1),{view:g,params:{photoId:u,nsid:c,photostreamId:S,context:v,backToURL:E.path,hideBackToLink:d,entryTypeIntlKey:E.backToIntlKey,fullscreen:f,numberOfPositionsToPreFetch:x,numberOfPositionsToRefetchAt:T,isVR:l},title:n.getValue("title")||"Untitled",layout:y,fluid:!0,darkLoader:N,isMobile:C}},function(n){var r="Couldn't load photo page";t.UA.isMobileBrowser&&s.appContext.flipper.isFlipped("enable-new-mobile-photo-page")&&(r="Couldn't load mobile photo page"),n.message&&(r+=": "+n.message);if(n.code===1)return e.fletrics.increment("route.photo.route.404"),s.displayRouteErrors(t,new e.RouteError(404,r));if(n.code===2){if(!s.appContext.getViewer().signedIn)return e.Promise.resolve({redirect:"/signin/?redir="+t.url})}else if(!t.UA.isMobileBrowser)return{view:"empty-photo-page-view",params:{},title:s.intlMessage({intlName:"common.OOPS"}),layout:"scrolling",fluid:!0,darkLoader:!0,isMobile:!1};if(n.fatal)throw e.fletrics.increment("route.photo.route.500"),n;return e.fletrics.increment("route.photo.route.404"),s.displayRouteErrors(t,new e.RouteError(404,r))})},verifyPhotoIsViewable:function(t){var r=t.getValue("id");return n.photoId(r)?r:new e.RouteError(404,this.intlMessage({intlName:"photo-page-scrappy.NO_PHOTO_WITH_THAT_ID",photoId:r}))},verifyPhotoIsOwnedByPerson:function(t,r){var i=t.getValue("id"),s=n.nsid(r);return r===t.getValue("owner").getValue(s?"id":"pathAlias")?t.getValue("owner").getValue("id"):new e.RouteError(404,"Photo "+i+" is not owned by "+r)},parseContext:function(t,n,r){return t=t||"photostream",e.URLHelper.parseContextURL(t,n,this.appContext)},detectBackToDestination:function(t,n){var r,i,s,o,u;if(e.config.flickr.homerun&&(e.config.flickr.ycParam||t.query&&t.query.yc)){u=e.config.flickr.ycParam?e.config.flickr.ycParam:t.query.yc;if(e.config.flickr.homerun.yc.indexOf(u.replace(/https?\:\/\//,""))!==-1)return this.setBackToData({name:"Yahoo"},u.match(/https?:/)?u:"https://"+u,n)}if(YUI.Env.isServer){r=t.headers.referrer||t.headers.referer;if(/^https?:\/\/[^\/]*(?:flickr\.com|flic\.kr)(?:$|\/)/.test(r)){if(n.context)return i=e.URLHelper.getContextEntity(n.context,n.person),this.setBackToData(e.URLHelper.getSiteSectionByName(i.type),i.url,n);r="/"+r.split("/").slice(3).join("/"),o=e.URLHelper.getSiteSectionByURL(r);if(o)return this.setBackToData(o,o.match,n)}else if(n.context)return i=e.URLHelper.getContextEntity(n.context,n.person),this.setBackToData(e.URLHelper.getSiteSectionByName(i.type),i.url,n)}else{r=this.appContext.getPreviousURL(),s=this.appContext.flapp.get("activeView");if(["photo-page-scrappy-view","photo-page-lightbox-scrappy-view","minimal-photo-page-view","photo-page-ad-scrappy-view"].indexOf(s.name)>-1){if(s.backToURL){o=e.URLHelper.
getSiteSectionByURL(s.backToURL);if(o)return this.setBackToData(o,s.backToURL,n)}}else if(r!==e.config.win.location.pathname){o=e.URLHelper.getSiteSectionByURL(r);if(o)return this.setBackToData(o,o.match,n)}}return this.setBackToData(null,null,n)},setBackToData:function(t,n,r){var o=YUI.Env.isServer?this:s,u,a,f;u=t?i[t.name]:null,u||(t=e.URLHelper.getSiteSectionByName("photostream"),n="/photos/"+r.person,u=i.photostream),a=e.merge(u,t),f=a.withParamName||"with",n=this.stripPathSuffixes(n),a.usesWith&&(n=n.replace(/([^\/])$/,"$1/"),n+=f+"/"+r.photoId),n[n.length-1]!=="/"&&n.indexOf("?")===-1&&(n+="/"),o._entryType=a.name,o._entryPath=n,o._backToIntlKey=a.backToIntlKey},getBackToData:function(){var e=YUI.Env.isServer?this:s;return{type:e._entryType,path:e._entryPath,backToIntlKey:e._backToIntlKey}},stripPathSuffixes:function(e){return e=e.replace(/\/+/g,"/"),e=e.replace(/\/with\/\d+\/?$/,"/"),e=e.replace(/\/in\/[^\/]+\/?$/,"/"),e=this.filterURL(e,function(e){var t;if(e.length>=3)for(t=2;t<e.length;t++)e[t].match(/page\d+/)&&(e.splice(t,1),t--);return e}),e=this.filterURL(e,function(e){var t;if(e[0]==="groups"&&e.length>=3)for(t=2;t<e.length;t++)e[t]==="pool"&&(e.splice(t,1),t--);return e}),e},filterURL:function(e,t){var n,r;return r=e.split("/").filter(function(e){return!!e}),n="/"+t(r).join("/"),n[n.length-1]!=="/"&&e.indexOf("?")===-1&&(n+="/"),n}}),e.mix(s.prototype,e.Localizable),e.mix(s.prototype,e.Seo)},"@VERSION@",{requires:["flickr-route","url-helper","fletrics","localizable","seo"],optional:["photo-models","photostream-models","photo-page-scrappy-view","empty-photo-page-view","photo-page-lightbox-scrappy-view","mobile-photo-page-view"],langBundles:["photo-page-scrappy","common","attribution"]});
YUI.add("photo-well-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.isAd=!!t.ad,this.firstLoad=!!t.firstLoad,this.publisherUrl=t.publisherUrl,t.isFluid=!0,t.isOnDark=!0,this.get("container").get("innerHTML")===""&&this.setContainerHTML(""),this},subviewConfig:{"photo-well-media-view":{requiredToShowOnClient:!0,requiredToShowOnServer:!0},"photo-sidebar-toggle-view":{requiredToShowOnClient:!0,requiredToShowOnServer:!1},"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;return this.firstLoad||(this.subviews["photo-sidebar-actions-view"]&&this.subviews["photo-sidebar-actions-view"].get("container").addClass("is-hidden"),this.subviews["photo-sidebar-toggle-view"]&&this.subviews["photo-sidebar-toggle-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.firstLoad&&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("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")})))),this.setContainerWithTemplate("photo-well",{"is-video":this.get("photo").getValue("isVideo"),"is-hidden":(YUI.Env.isServer||!this.firstLoad)&&!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,"opt-out-enabled":this.appContext.experiments.optOut.enabled(),"attribution-view":t,enableZoom:this.appContext.flipper.isFlipped("enable-scrappy-zoom")}),YUI.Env.isServer&&(this.serverWidth=this.subviews["photo-well-media-view"].serverWidth,this.serverHeight=this.subviews["photo-well-media-view"].serverHeight),this},loadState:function(){var t=this,n=[];return n.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&&n.push(this.appContext.getModelRegistry(this.contextData.modelName).then(function(e){var n;if(e){n=e.attributeSearch(t.contextData.params);if(n&&n.length&&e.exists(n[0]))return t.appContext.getModel(t.contextData.modelName,n[0]).then(function(e){e&&t.set("contextModel",e)})}}).then(null,function(){return"whatever"})),e.Promise.all(n)},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.followViewOpen||(c.movingTimeout=setTimeout(c.hideUI.bind(c),s*2))},o))),!this.firstLoad&&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"),t&&c.firstLoad&&t.addClass("is-hidden"),u&&l&&(f&&f.addClass("is-hidden"),r&&r.addClass("is-hidden"),i&&i.addClass("is-hidden"))},s*2)},hideUI:function(){var e=this.get("container"),t=e.one(".photo-sidebar-actions-view"),n=e.one(".photo-sidebar-toggle-view"),r=e.one(".attribution-view");t&&t.addClass("is-hidden"),n&&n.addClass("is-hidden"),r&&r.addClass("is-hidden")},onSubviewEvent:function(e,t){var n=1500;n=(n-500)/2,e==="attribution-view"&&t[0]==="isOpen"?(this.followViewOpen=!0,clearTimeout(this.movingTimeout),clearTimeout(this.initialTimeout)):e==="attribution-view"&&t[0]==="isClosed"&&(this.followViewOpen=!1,this.movingTimeout=setTimeout(this.hideUI.bind(this),n*2))},activate:function(){var t=this,s=this.contextData,o=this.get("container"),u=0,a,f,l,c,h=".navigate-prev",p=".navigate-next";return YUI.Env.isServer||(f=e.getLocation(),l=f.protocol,c=f.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.all(h).hide(),e.all(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,o,a,f,d;return r.length>2&&r.some(function(e){return u++,e.getValue("id")===t.photoId})&&(o=r.slice(u-2,u-1),a=r.slice(u,u+1),o&&o.length>0&&(f=t.setupNavLink(o[0],h,"previous"),f&&(t.updateNavLinks(h,l,c,f),t.get("container").all(h).removeClass("no-click"))),a&&a.length>0&&(d=t.setupNavLink(a[0],p,"next"),d&&(t.updateNavLinks(p,l,c,d),t.get("container").all(p).removeClass("no-click")))),i=e.merge(s.params,{photoId:t.photoId,numNext:10,numPrev:10}),n.getContext(i)}).then(function(n){function s(s,o){var u=t.get("container").all(s),a,f,h,p,d,v,m=n&&n[o]&&n[o].length;if(!u.size())return;if(!m){u.remove();return}u.removeClass("no-click"),a=t.setupNavLink(n[o][0],s,o);if(t.isAd)h=t.appContext.adManager.origin,o===h.arrow?(u.setAttribute("href",h.url),u.removeClass("is-hidden")):(u.setAttribute("href",a),u.removeClass("is-hidden"));else{t.updateNavLinks(s,l,c,a),f=t.subviews["photo-well-media-view"].getCanvasSize();for(v=0;v<i;v++){if(!n[o][v])break;p=n[o][v].getSizeToFit(f,{includeSizes:["sq","q","t","s","n"]}),p&&p.url&&(d=new Image,d.src=p.url)}for(v=0;v<r;v++){if(!n[o][v])break;p=n[o][v].getSizeToFit(f),p&&p.url&&(d=new Image,e.LH.mark("mark_time_to_load_photo_only_start"),d.onload=function(){e.LH.mark("mark_time_to_load_photo_only");var t=e.LH.measure("time_to_load_photo_only",{startMark:"mark_time_to_load_photo_only_start",endMark:"mark_time_to_load_photo_only"});window.beaconError&&window.beaconError("time_to_load_photo_only",window.location.href,{duration:t.duration})},d.src=p.url)}}}t.appContext.adManager.updateContext({prev:n.previous[0],current:t.get("photo"),next:n.next[0],type:t.contextData.modelName}),s(p,"next"),s(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})}),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())),o&&o.one(".feedback-widget button")&&(this.registerEventHandler(o.one(".feedback-widget button").on("mousedown",t.handleFeedbackClick,t)),this.setupFeedbackDropdown(),e.Env.isServer||o.all("input[name=redirect_url]").setAttribute("value",e.config.win.location.pathname)),a={":ad":t.setLinkAsAdFriendly},t.attachEvents(a),this},setupNavLink:function(t,r,i){var s=this.get("container").all(r),o,u;if(!t&&s.size()){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"),lightbox:this.appContext.experiments.fullscreen.getMode()});if(!u||u==="#"){n.warn("Invalid next/prev URL",{url:u}),s.remove();return}return u},updateNavLinks:function(e,t,n,r){var i=this.get("container").all(e);i.setAttribute("href",t+"//"+n+r),this.firstLoad&&i.removeClass("is-hidden")},destructor:function(){clearTimeout(this.movingTimeout),clearTimeout(this.initialTimeout),this.movingTimeout=null,this.initialTimeout=null},setupFeedbackDropdown:function(){var t=this.get("container"),n,r,i;if(this.appContext.flipper.isFlipped("buckets"))switch(this.appContext.buckets.photo_page){case"bucket1":i="https://yahoo.uservoice.com/forums/230780-flickr-photo-page-beta/";break;case"bucket2":i="https://yahoo.uservoice.com/forums/230781-flickr-photo-page-beta-2/";break;case"bucket3":i="https://yahoo.uservoice.com/forums/230782-flickr-photo-page-beta-3/";break;case"bucket4":i="https://yahoo.uservoice.com/forums/230783-flickr-photo-page-beta-4/";break;case"bucket5":i="https://yahoo.uservoice.com/forums/230785-flickr-photo-page-beta-5";break;case"bucket6":i="https://yahoo.uservoice.com/forums/230786-flickr-photo-page-beta-6";break;case"bucket7":i="https://yahoo.uservoice.com/forums/230787-flickr-photo-page-beta-7/";break;case"bucket8":i="https://yahoo.uservoice.com/forums/230788-flickr-photo-page-beta-8/";break;default:i="https://yahoo.uservoice.com/forums/224533-flickr-photo-page-beta"}else i="https://yahoo.uservoice.com/forums/224533-flickr-photo-page-beta";r=[{buttonMarkup:new e.Handlebars.SafeString('<a href="'+i+'" data-track="helpFeedbackUserVoiceClick" class="ui-button" target="_blank"><span>Feedback</span></a>')},{buttonMarkup:new e.Handlebars.SafeString('<a href="//'+e.config.flickr.url.host+'/help/photos/#167391143" data-track="helpFeedbackFAQClick" class="ui-button" target="_blank"><span>FAQs</span></a>')}],n=this.templates("reboot-welcome-dialog-content")({"opt-out-enabled":this.appContext.experiments.optOut.enabled()}),this.appContext.experiments.optOut.enabled()&&r.push({buttonMarkup:new e.Handlebars.SafeString(this.templates("photo-opt-out")({"redirect-url":e.config.win.location.pathname}))}),this.feedbackDialog=e.Views.dialog.getNewInstance("dialog-cta",{attrs:{title:"Welcome to the beta of the new photo page!",hideConfirmButton:!0,verticalButtonList:!0,additionalButtons:r},content:n,parent:this,rootEl:t.ancestor()}),this.feedbackDialog.get("container").addClass("welcome-dialog")},handleFeedbackClick:function(t){if(t.target.ancestor(".ui-dialog",!0))return;t.halt(),this.feedbackDialog.toggle(),e.rapidTracker.beacon(this
.name,"helpFeedbackMenuClick")},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("subviewViewEvent","rightClickPhoto")}})},"@VERSION@",{requires:["yui-throttle","flickr-view","hermes-template-photo-well","photo-well-css","url-helper","better-throttle","hermes-template-reboot-welcome-dialog-content","hermes-template-photo-opt-out"],optional:["photo-well-media-view","photo-models","photo-route"],langBundles:["common"]});