YUI.add("hermes-template-sub-photo-tags-tag-section",function(a,t){var n=a.Template.Handlebars.revive({1:function(a,t,n,l,e){return'\t'+a.escapeExpression((n.intlMessage||t&&t.intlMessage||n.helperMissing).call(null!=t?t:{},{name:"intlMessage",hash:{intlName:"photo-page-scrappy.ADD_TAGS"},data:e}))+"\n"},3:function(a,t,n,l,e){var s,o=null!=t?t:{},r=n.helperMissing,i=a.escapeExpression;return'\t\n"},5:function(a,t,n,l,e){return'\t
\n"},7:function(a,t,n,l,e){return'\t\n\t\t\n\t\n'},9:function(a,t,n,l,e){return'\t\t\n'},11:function(a,t,n,l,e){var s,o,r=null!=t?t:{},i=n.helperMissing,u=a.escapeExpression;return'\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t'+u("function"==typeof(o=null!=(o=n.tagRaw||(null!=t?t.tagRaw:t))?o:i)?o.call(r,{name:"tagRaw",hash:{},data:e}):o)+"\n\t\t\n"},12:function(a,t,n,l,e){return"can-remove-tag"},14:function(a,t,n,l,e){var s;return null!=(s=n.if.call(null!=t?t:{},null!=t?t.duplicateAutotagId:t,{name:"if",hash:{},fn:a.program(15,e,0),inverse:a.noop,data:e}))?s:""},15:function(a,t,n,l,e){var s;return'data-autotag-id="'+a.escapeExpression("function"==typeof(s=null!=(s=n.duplicateAutotagId||(null!=t?t.duplicateAutotagId:t))?s:n.helperMissing)?s.call(null!=t?t:{},{name:"duplicateAutotagId",hash:{},data:e}):s)+'"'},17:function(a,t,n,l,e){var s;return null!=(s=n.if.call(null!=t?t:{},null!=t?t.duplicateAutotagId:t,{name:"if",hash:{},fn:a.program(18,e,0),inverse:a.program(20,e,0),data:e}))?s:""},18:function(a,t,n,l,e){return"remove-dual-tag"},20:function(a,t,n,l,e){return"remove-tag"},22:function(a,t,n,l,e){var s;return null!=(s=n.if.call(null!=t?t:{},null!=t?t.duplicateAutotagId:t,{name:"if",hash:{},fn:a.program(23,e,0),inverse:a.program(25,e,0),data:e}))?s:""},23:function(a,t,n,l,e){return"delete-dual-tag"},25:function(a,t,n,l,e){return"delete-tag"},27:function(a,t,n,l,e){var s;return a.escapeExpression("function"==typeof(s=null!=(s=n.url||(null!=t?t.url:t))?s:n.helperMissing)?s.call(null!=t?t:{},{name:"url",hash:{},data:e}):s)},29:function(a,t,n,l,e){var s;return a.escapeExpression("function"==typeof(s=null!=(s=n.searchUrl||(null!=t?t.searchUrl:t))?s:n.helperMissing)?s.call(null!=t?t:{},{name:"searchUrl",hash:{},data:e}):s)},31:function(a,t,n,l,e){var s;return null!=(s=n.each.call(null!=t?t:{},null!=t?t.autotags:t,{name:"each",hash:{},fn:a.program(32,e,0),inverse:a.noop,data:e}))?s:""},32:function(a,t,n,l,e){var s;return null!=(s=n.if.call(null!=t?t:{},null!=t?t.isPrivate:t,{name:"if",hash:{},fn:a.program(33,e,0),inverse:a.program(38,e,0),data:e}))?s:""},33:function(a,t,n,l,e){var s,o,r=null!=t?t:{},i=n.helperMissing,u=a.escapeExpression;return'\t\t\t\t\n'+(null!=(s=n.if.call(r,(s=e&&e.root)&&s.viewerIsOwner,{name:"if",hash:{},fn:a.program(34,e,0),inverse:a.noop,data:e}))?s:"")+'\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t'+u("function"==typeof(o=null!=(o=n.autotagValue||(null!=t?t.autotagValue:t))?o:i)?o.call(r,{name:"autotagValue",hash:{},data:e}):o)+"\n\t\t\t\t\n"},34:function(a,t,n,l,e){return'\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n'},36:function(a,t,n,l,e){var s,o,r=a.escapeExpression;return r(a.lambda((s=e&&e.root)&&s.tagPageURL,t))+r("function"==typeof(o=null!=(o=n.autotagValue||(null!=t?t.autotagValue:t))?o:n.helperMissing)?o.call(null!=t?t:{},{name:"autotagValue",hash:{},data:e}):o)},38:function(a,t,n,l,e){var s,o,r=null!=t?t:{},i=n.helperMissing,u=a.escapeExpression;return'\t\t\t\t\n'+(null!=(s=n.if.call(r,(s=e&&e.root)&&s.viewerIsOwner,{name:"if",hash:{},fn:a.program(34,e,0),inverse:a.noop,data:e}))?s:"")+'\t\t\t\t\t'+u("function"==typeof(o=null!=(o=n.autotagValue||(null!=t?t.autotagValue:t))?o:i)?o.call(r,{name:"autotagValue",hash:{},data:e}):o)+"\n\t\t\t\t\n"},40:function(a,t,n,l,e){var s,o,r=null!=t?t:{},i=n.helperMissing,u=a.escapeExpression;return'\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t'+u("function"==typeof(o=null!=(o=n.tagRaw||(null!=t?t.tagRaw:t))?o:i)?o.call(r,{name:"tagRaw",hash:{},data:e}):o)+"\n\t\t\t\n"},compiler:[7,">= 4.0.0"],main:function(a,t,n,l,e){var s,o=null!=t?t:{};return(null!=(s=n.if.call(o,null!=t?t.canAddMeta:t,{name:"if",hash:{},fn:a.program(1,e,0),inverse:a.noop,data:e}))?s:"")+"\n"+(null!=(s=n.if.call(o,null!=t?t.linkTagToTagsPage:t,{name:"if",hash:{},fn:a.program(3,e,0),inverse:a.program(5,e,0),data:e}))?s:"")+"\n"+(null!=(s=n.if.call(o,null!=t?t.showTagInfoBlock:t,{name:"if",hash:{},fn:a.program(7,e,0),inverse:a.noop,data:e}))?s:"")+'\n\n\n\n\n\n'},useData:!0}),l={};a.Array.each([],function(t){var n=a.Template.get("hermes/"+t);n&&(l[t]=n)}),a.Template.register("hermes/sub-photo-tags-tag-section",function(t,e){return e=e||{},e.partials=e.partials?a.merge(l,e.partials):l,n(t,e)})},"@VERSION@",{requires:["template-base","handlebars-base"]});YUI.add("hermes-template-sub-photo-tags-tag",function(a,e){var t=a.Template.Handlebars.revive({1:function(a,e,t,l,n){return'data-tag-might-exist="true"'},3:function(a,e,t,l,n){return"remove-dual-tag"},5:function(a,e,t,l,n){return"remove-tag"},7:function(a,e,t,l,n){return"delete-dual-tag"},9:function(a,e,t,l,n){return"delete-tag"},11:function(a,e,t,l,n){var r,s=null!=e?e:{},i=t.helperMissing,u=a.escapeExpression;return u("function"==typeof(r=null!=(r=t.tagPageURL||(null!=e?e.tagPageURL:e))?r:i)?r.call(s,{name:"tagPageURL",hash:{},data:n}):r)+u("function"==typeof(r=null!=(r=t.tagWithoutSlashes||(null!=e?e.tagWithoutSlashes:e))?r:i)?r.call(s,{name:"tagWithoutSlashes",hash:{},data:n}):r)},13:function(a,e,t,l,n){return a.escapeExpression((t.getTagSearchUrl||e&&e.getTagSearchUrl||t.helperMissing).call(null!=e?e:{},null!=e?e.tagValue:e,{name:"getTagSearchUrl",hash:{},data:n}))},compiler:[7,">= 4.0.0"],main:function(a,e,t,l,n){var r,s,i=null!=e?e:{},u=t.helperMissing,g=a.escapeExpression;return'\n\t\n\t\t\n\t\n\t'+g("function"==typeof(s=null!=(s=t.tagRaw||(null!=e?e.tagRaw:e))?s:u)?s.call(i,{name:"tagRaw",hash:{},data:n}):s)+"\n\n"},useData:!0}),l={};a.Array.each([],function(e){var t=a.Template.get("hermes/"+e);t&&(l[e]=t)}),a.Template.register("hermes/sub-photo-tags-tag",function(e,n){return n=n||{},n.partials=n.partials?a.merge(l,n.partials):l,t(e,n)})},"@VERSION@",{requires:["template-base","handlebars-base"]});YUI.add("hermes-template-tags-helper-text",function(e,a){var t=e.Template.Handlebars.revive({compiler:[7,">= 4.0.0"],main:function(e,a,t,s,r){var l=null!=a?a:{},n=t.helperMissing,i=e.escapeExpression;return'\n\t'+i((t.intlMessage||a&&a.intlMessage||n).call(l,{name:"intlMessage",hash:{intlName:"photo-page-scrappy.TAGS_HELP_TEXT"},data:r}))+'\n
\n'+i((t.intlMessage||a&&a.intlMessage||n).call(l,{name:"intlMessage",hash:{intlName:"common.LEARN_MORE"},data:r}))+"\n"},useData:!0}),s={};e.Array.each([],function(a){var t=e.Template.get("hermes/"+a);t&&(s[a]=t)}),e.Template.register("hermes/tags-helper-text",function(a,r){return r=r||{},r.partials=r.partials?e.merge(s,r.partials):s,t(a,r)})},"@VERSION@",{requires:["template-base","handlebars-base"]});YUI.add("sub-photo-tags-tag-view",function(t,e){var a=require("hermes-core/flog")(e),s={tagHoverMaxWidth:23};t.FlickrView.create(this.name,t.FlickrView,[],{langBundles:this.details.langBundles,initializer:function(e){return this.photoId=e.photoId,this.context=t.clone(e.context,!0),this.nsid=e.nsid,this.pathAlias=e.pathAlias,this.isMobileTags=e.isMobileTags||!1,""===this.get("container").get("innerHTML")&&this.setContainerHTML(""),this},loadState:function(){var e=this;return new t.FlickrPromise({photo:e.appContext.getModel("photo-models",e.photoId),photoTags:e.appContext.getModel("photo-tags-models",this.photoId),tagModel:e.appContext.getModelRegistry("tag-models"),photoAutotags:e.appContext.getModel("photo-autotags-models",e.photoId),autotagModel:e.appContext.getModelRegistry("autotag-models")}).then(function(t){e.set("photo",t.photo),e.set("photoTags",t.photoTags),e.set("tagModel",t.tagModel),e.set("photoAutotags",t.photoAutotags),e.set("autotagModel",t.autotagModel)})},buildContainer:function(){var t,e=this.get("photo"),a=this.get("photoTags").getValue("tags"),s=e.getValue("isOwner")||e.getValue("canAddMeta"),o=/^[a-zA-Z]\w*:[a-zA-Z]\w*=.+/,n=[],i=[],l=!1,g=!1,r=!1,h=this.get("photoAutotags").getValue("autotags"),d=e.getValue("isOwner"),u=!1,p=!this.isMobileTags,c=this.appContext.flipper.isFlipped("enable-tag-page-link-on-photo-page");if(a&&0!==(a=a.toJSON()).length)for(l=!0,t=0;t0?(a=t.indexOf("=")+1,s=t.substring(0,a)+'"'+t.substring(a)+'"',u.tagValue=s):u.tagValue=t,"none"===o.one(".machine-tags-section").getStyle("display")&&o.one(".machine-tags-section").setStyle("display","block"),e=d.templates("sub-photo-tags-tag")(u),n.prepend(e)):(u.tagValue=t.replace(/\s/g,""),e=d.templates("sub-photo-tags-tag")(u),r&&n.one("[data-autotag-content='"+t+"']").addClass("hidden"),n.one(".add-tag").insert(e,"after"))}),d.setupRollOverTagEvents()},setupRemoveTagEvents:function(){var e=this.get("container"),s=this.get("photoTags").getValue("tags"),o=this.get("tagModel"),n=this.get("photoAutotags").getValue("autotags"),i=this.get("autotagModel"),l={},g=e.one(".machine-tags-list"),r=this;this.registerEventHandler(e.all(".tags-list, .machine-tags-list").on("click",function(h){if(h.target.hasClass("remove-tag")||h.target.hasClass("delete-tag")||h.target.hasClass("remove-autotag")||h.target.hasClass("delete-autotag")||h.target.hasClass("remove-dual-tag")||h.target.hasClass("delete-dual-tag")){h.preventDefault();var d,u,p=h.target.ancestor(".tag",!0);p?(d=p.getAttribute("data-tag-id"),o.remoteDelete(d).then(function(){s.removeFromList(d,"id"),p.remove(!0),0===s.toJSON().length&&0===n.toJSON().length?(e.addClass("empty"),r.fire("subviewViewEvent","tagsTagView:tagsEmpty")):0===s.toJSON().length&&e.one(".add-tag").setStyle("display","none")},function(){r.onError(r.intlMessage({intlName:"photo-page-scrappy.ERROR_DELETING_TAG"}))}),h.target.hasClass("remove-dual-tag")||h.target.hasClass("delete-dual-tag")?(u=p.getAttribute("data-autotag-id"),l.photo_id=r.photoId,l.autotags=u,i.remoteDelete(l).then(function(){n.remove(u,"id")},function(){a.warn("deleting the corresponding autotag for this usertag failed")}),t.rapidTracker.beacon(r.name,"dualTagDeleteClick",{type:u})):t.rapidTracker.beacon(r.name,"tagDeleteClick")):(p=h.target.ancestor(".autotag",!0),u=p.getAttribute("data-autotag-id"),l.photo_id=r.photoId,l.autotags=u,i.remoteDelete(l).then(function(){n.remove(u,"id"),p.remove(!0),0===n.toJSON().length&&0===s.toJSON().length&&(e.one(".add-tag").setStyle("display","none"),e.addClass("empty"),r.fire("subviewViewEvent","tagsTagView:tagsEmpty"))},function(){r.onError(r.intlMessage({intlName:"photo-page-scrappy.ERROR_DELETING_TAG"}))}),t.rapidTracker.beacon(r.name,"autotagDeleteClick",{type:u})),g.getDOMNode().childElementCount||e.one(".machine-tags-section").setStyle("display","none"),e.one(".tags-list").all(".end-of-the-line").removeClass("end-of-the-line"),e.one(".tags-list").all(".not-eol").removeClass("not-eol"),"block"===e.one(".machine-tags-section").getStyle("display")&&(e.one(".machine-tags-list").all(".end-of-the-line").removeClass("end-of-the-line"),e.one(".machine-tags-list").all(".not-eol").removeClass("not-eol"))}}))},processTag:function(e){var a,s,o;o=e.replace(/"(.*?)"/g,function(t,e){return e=e.replace(/(,)/g,function(t,e){return"{COMMA}"}),e=e.replace(/(\s+)/g,function(t,e){return e="{WHITESPACE"+e.charCodeAt(0)+"}"})}),s=o.indexOf(",")>-1?o.split(/,/):o.split(/\s+/);for(a in s)s[a]=s[a].replace(/\{WHITESPACE([0-9]+)\}/g,function(t,e){return e=String.fromCharCode(e)}),s[a]=s[a].replace(/\{COMMA\}/g,function(t,e){return","});return t.Array.each(s,function(e,a){e=t.Lang.trim(e),s[a]=e}),s=t.Array.filter(s,function(t,e){if(t.length>0)return!0})},setupRollOverTagEvents:function(){var t,e=this.get("container");this.registerEventHandler(e.all(".tags-list, .machine-tags-list").on("mouseover",function(e){if((t=e.target.ancestor(".tag, .autotag",!0))&&t.hasClass("can-remove-tag")){var a=t.ancestor(".tags-list")?t.ancestor(".tags-list").getDOMNode().offsetLeft:t.ancestor(".machine-tags-list").getDOMNode().offsetLeft,o=t.getDOMNode().offsetLeft;(t.ancestor(".tags-list")?parseInt(t.ancestor(".tags-list").getComputedStyle("width"),10):parseInt(t.ancestor(".machine-tags-list").getComputedStyle("width"),10))-(o-a+parseInt(t.getComputedStyle("width"),10))<=s.tagHoverMaxWidth?(t.removeClass("not-eol"),t.addClass("end-of-the-line")):(t.removeClass("end-of-the-line"),t.addClass("not-eol"))}}))},showAutotagsHelper:function(e){var a=this.get("container").one(".autotags-helper-icon"),s=this.templates("tags-helper-text");new t.Views.FluidDroparound({appContext:this.appContext,dismissOnOverlayClick:!0,showDropArrow:!0,anchorOffsetHorizontal:12,width:240,observePageResize:!0,anchorElement:a,htmlMessage:s({})}).show()},onError:function(e){return this.errorDialog=new t.Views.FluidModal({appContext:this.appContext,dismissOnOverlayClick:!0,dismissOnActionClick:!0,showCancelButton:!1,title:this.intlMessage({intlName:"common.OOPS"}),actionButtonLabel:this.intlMessage({intlName:"common.OK"}),message:e,darkOverlay:!0}),this.errorDialog.show(),this.errorDialog}})},"@VERSION@",{requires:["flickr-view","hermes-template-sub-photo-tags-tag-section","hermes-template-sub-photo-tags-tag","hermes-template-tags-helper-text","hermes-template-head-meta","url-helper"],optional:[],langBundles:["common","photo-page-scrappy"]});YUI.add("hermes-template-sub-photo-person",function(a,e){var n=a.Template.Handlebars.revive({1:function(a,e,n,l,t){var s,r=a.lambda,i=a.escapeExpression;return"data-"+i(r(null!=(s=null!=e?e.dataAttr:e)?s.key:s,e))+'="'+i(r(null!=(s=null!=e?e.dataAttr:e)?s.value:s,e))+'"'},3:function(a,e,n,l,t){var s;return a.escapeExpression(a.lambda(null!=(s=null!=e?e.buddyicon:e)?s.default:s,e))},5:function(a,e,n,l,t){var s;return a.escapeExpression("function"==typeof(s=null!=(s=n.buddyicon||(null!=e?e.buddyicon:e))?s:n.helperMissing)?s.call(null!=e?e:{},{name:"buddyicon",hash:{},data:t}):s)},7:function(a,e,n,l,t){return" ("+a.escapeExpression((n.intlMessage||e&&e.intlMessage||n.helperMissing).call(null!=e?e:{},{name:"intlMessage",hash:{intlName:"common.DELETED_USER"},data:t}))+")"},9:function(a,e,n,l,t){var s;return null!=(s=n.if.call(null!=e?e:{},null!=e?e.isPro:e,{name:"if",hash:{},fn:a.program(10,t,0),inverse:a.noop,data:t}))?s:""},10:function(a,e,n,l,t){var s;return null!=(s=a.invokePartial(l["pro-badge"],e,{name:"pro-badge",hash:{badgeType:null!=e?e.proBadge:e},data:t,helpers:n,partials:l,decorators:a.decorators}))?s:""},12:function(a,e,n,l,t){return'\t\t\n'},compiler:[7,">= 4.0.0"],main:function(a,e,n,l,t){var s,r,i=null!=e?e:{},o=n.helperMissing,p="function",u=a.escapeExpression;return'\n\t\n\t\t\n"+(null!=(s=n.if.call(i,null!=e?e.showRemove:e,{name:"if",hash:{},fn:a.program(12,t,0),inverse:a.noop,data:t}))?s:"")+"\t
\n\n"},usePartial:!0,useData:!0}),l={};a.Array.each(["pro-badge"],function(e){var n=a.Template.get("hermes/"+e);n&&(l[e]=n)}),a.Template.register("hermes/sub-photo-person",function(e,t){return t=t||{},t.partials=t.partials?a.merge(l,t.partials):l,n(e,t)})},"@VERSION@",{requires:["template-base","handlebars-base","hermes-template-pro-badge"]});YUI.add("hermes-template-invite-person",function(e,a){var n=e.Template.Handlebars.revive({1:function(e,a,n,t,l){var i,s=e.lambda,r=e.escapeExpression;return"data-"+r(s(null!=(i=null!=a?a.dataAttr:a)?i.key:i,a))+'="'+r(s(null!=(i=null!=a?a.dataAttr:a)?i.value:i,a))+'"'},3:function(e,a,n,t,l){return'\t\t\n'},compiler:[7,">= 4.0.0"],main:function(e,a,n,t,l){var i,s,r=null!=a?a:{},o=n.helperMissing,c=e.escapeExpression;return'\n\t\n\t\t
\n\t\t\t

\n\t\t
\n\t\t
\n\t\t'+c("function"==typeof(s=null!=(s=n.email||(null!=a?a.email:a))?s:o)?s.call(r,{name:"email",hash:{},data:l}):s)+"\n\t\t
\n"+(null!=(i=n.if.call(r,null!=a?a.showRemove:a,{name:"if",hash:{},fn:e.program(3,l,0),inverse:e.noop,data:l}))?i:"")+"\t
\n\n"},useData:!0}),t={};e.Array.each([],function(a){var n=e.Template.get("hermes/"+a);n&&(t[a]=n)}),e.Template.register("hermes/invite-person",function(a,l){return l=l||{},l.partials=l.partials?e.merge(t,l.partials):t,n(a,l)})},"@VERSION@",{requires:["template-base","handlebars-base"]});