/*1360089943,178142523*/

if (self.CavalryLogger) { CavalryLogger.start_js(["h9fqQ"]); }

__d("flash-js",["copyProperties"],function(a,b,c,d,e,f){var g=b('copyProperties');function h(){}g(h,{INIT:'flash/init',READY:'flash/ready',FAILED:'flash/failed'});e.exports=h;});
__d("legacy:flash-js",["flash-js"],function(a,b,c,d){a.Flash=b('flash-js');},3);
__d("PhotoTagApproval",["array-extensions","Event","Arbiter","CSS","copyProperties","DOM","Parent","PhotosConst","ge"],function(a,b,c,d,e,f){b('array-extensions');var g=b('Event'),h=b('Arbiter'),i=b('CSS'),j=b('copyProperties'),k=b('DOM'),l=b('Parent'),m=b('PhotosConst'),n=b('ge');function o(p){this.viewer=p;this.units=[];this.currentUnit=0;var q=p.getVersionConst();if(q==m.VIEWER_SNOWLIFT){this._root=n('fbPhotoSnowliftTagApproval');}else this._root=n('fbPhotoPageTagApproval');h.subscribe(p.getEventString('DATA_CHANGE'),this.restartTagApproval.bind(this));g.listen(this._root,'click',this.handleClick.bind(this));g.listen(this._root,'mousemove',function(r){this.hiliteCurrentPendingTag();g.kill(r);}.bind(this));this.restartTagApproval();}j(o.prototype,{handleClick:function(event){var p=event.getTarget();if(i.hasClass(p,'nextPager')&&i.hasClass(p,'enabled')){this.showNextUnit();}else if(i.hasClass(p,'prevPager')&&i.hasClass(p,'enabled')){this.showPrevUnit();}else if(l.byClass(p,'fbPhotoApprovalPendingButtons')){var q=this.units[this.currentUnit],r=this.getTagNameID(q);if(r){var s=l.byClass(p,'approve');h.inform('PhotoTagApproval.UPDATE_TAG_BOX',{id:r,approve:s,version:this.viewer.getVersionConst()});}this.removeSelectedUnit.bind(this).defer();}return true;},loadUnits:function(p){this.units=k.scry(this._root,'div.fbPhotoApprovalUnit');if(this.units.length){i.show(this._root);this.showUnit(p);i.conditionClass(this._root,'hidePagers',this.units.length==1);}else{i.hide(this._root);h.inform('PhotoTagApproval.HILITE_TAG',{tag:null,version:this.viewer.getVersionConst()});}},restartTagApproval:function(){this.loadUnits(0);},removeSelectedUnit:function(){var p=this.units[this.currentUnit];k.remove(p);this.loadUnits(this.currentUnit);},showNextUnit:function(){this.showUnit(this.currentUnit+1);},showPrevUnit:function(){this.showUnit(this.currentUnit-1);},getTagNameID:function(p){var q=p.id.indexOf(':');return p.id.slice(q+1);},showUnit:function(p){this.units.forEach(i.hide);this.currentUnit=(p+this.units.length)%this.units.length;var q=this.units[this.currentUnit];i.show(q);this.hiliteCurrentPendingTag();i.conditionClass(k.find(this._root,'a.prevPager'),'enabled',this.currentUnit>0);i.conditionClass(k.find(this._root,'a.nextPager'),'enabled',this.currentUnit<this.units.length-1);},hiliteCurrentPendingTag:function(){var p=this.units[this.currentUnit],q=this.getTagNameID(p);h.inform('PhotoTagApproval.HILITE_TAG',{tag:q,version:this.viewer.getVersionConst()});}});e.exports=o;});
__d("legacy:photo-tag-approval",["PhotoTagApproval"],function(a,b,c,d){a.PhotoTagApproval=b('PhotoTagApproval');},3);
__d("PhotoTagStore",["AsyncRequest","copyProperties","isEmpty"],function(a,b,c,d,e,f){var g=b('AsyncRequest'),h=b('copyProperties'),i=b('isEmpty');function j(){this._tagList={};this._textTagList={};this._originalTagList={};this._dirtyPhotosByUid={};j.instance=this;}j.instance=null;j.getInstance=function(){if(j.instance===null)new j();return j.instance;};h(j.prototype,{getPhotoTags:function(k){return this._tagList[k]||{};},clear:function(){this._tagList={};this._textTagList={};this._originalTagList={};this._dirtyPhotosByUid={};},revert:function(k){for(var l in this._tagList)if(!this._originalTagList[l][k]){delete this._tagList[l][k];}else this._tagList[l][k]=this._originalTagList[l][k];this._dirtyPhotosByUid={};},hasNewTags:function(){return !i(this._tagList)||!i(this._textTagList);},userHasDirtyTags:function(k){return !i(this._dirtyPhotosByUid[k]);},handleTagFetch:function(k){for(var l in k)this.loadTagInfo(l,k[l]);},saveAlbumTagsForUser:function(k,l){var m={},n=[],o=this._dirtyPhotosByUid[k]||{};for(var p in o){var q=this._tagList[p][k];if(q===undefined){n[n.length]=p;continue;}m[p]={x:q.x,y:q.y};}var r={subject:k,action:'save',save_tags:m,remove_from:n};new g().setURI('/ajax/photos/album/tags.php').setData(r).setHandler(function(s){l(s.payload);}).setAllowCrossPageTransition(true).send();delete this._dirtyPhotosByUid[k];},getTagsFromList:function(k){var l=[];for(var m in k)if(k.hasOwnProperty(m))for(var n in k[m])if(k[m].hasOwnProperty(n))l.push(k[m][n]);return l;},getAllTags:function(){var k=this.getTagsFromList(this._tagList),l=this.getTagsFromList(this._textTagList);return k.concat(l);},removeTag:function(k,l){var m=this._tagList[k],n=this._originalTagList[k]||{};if(n[l]){this._dirtyPhotosByUid[l]=this._dirtyPhotosByUid[l]||{};this._dirtyPhotosByUid[l][k]=true;}else delete this._dirtyPhotosByUid[l][k];for(var o in m)if(o==l){delete this._tagList[k][o];if(i(this._tagList[k]))delete this._tagList[k];}},removeTextTag:function(k,l){var m=this._textTagList[k];if(!i(m[l])){delete this._textTagList[k][l];if(i(this._textTagList[k]))delete this._textTagList[k];}},removeAllTagsFromPhoto:function(k){if(!i(this._tagList[k]))for(var l in this._tagList[k]){if(!this._tagList[k].hasOwnProperty(l))continue;this.removeTag(k,l);}if(!i(this._textTagList[k]))for(var m in this._textTagList[k]){if(!this._textTagList[k].hasOwnProperty(m))continue;this.removeTextTag(k,m);}},storeTag:function(k,l,m,n,o){this.storeTagWithOptions(k,l,m,n,{can_remove:o});},storeTagWithOptions:function(k,l,m,n,o){this._dirtyPhotosByUid[l]=this._dirtyPhotosByUid[l]||{};this._dirtyPhotosByUid[l][k]=true;var p={x:m,y:n};h(p,o);if(!l){this._textTagList[k]=this._textTagList[k]||{};this._textTagList[k][p.name]=p;}else{this._tagList[k]=this._tagList[k]||{};this._tagList[k][l]=p;}},loadTagInfo:function(k,l){this._tagList[k]={};this._originalTagList[k]={};for(var m=0;m<l.length;m++){var n=l[m];this._tagList[k][n.subject]=n;this._originalTagList[k][n.subject]=n;}}});e.exports=j;});
__d("PhotosTaggingWaterfall",["AsyncSignal","copyProperties"],function(a,b,c,d,e,f){var g=b('AsyncSignal'),h=b('copyProperties');function i(j){i._queueName=j||i._queueName;}h(i,{BEGIN:"begin",TAG_FACE:"tag_face",HOVER_TAG_FACE:"hover_tag_face",ADD_NAME:"add_name",TAG_CONFIRMED:"tag_confirmed",FINISH:"finish",TYPE_NAME:'type_name',SELECT_NAME:'select_name',_queueName:null,sendSignal:function(j,k){new g('/ajax/photos/tag_waterfall.php',{data:JSON.stringify(j)}).setHandler(k).send();}});e.exports=i;});
__d("PhotoPermalink",["array-extensions","Event","function-extensions","Arbiter","AsyncRequest","Bootloader","Class","CSS","DOM","KeyEventController","Keys","PageTransitions","Parent","PhotosConst","PhotoSessionLog","PhotoStreamCache","PhotosUtils","PhotoViewer","Style","UserAgent","Vector","$","copyProperties","createArrayFrom","emptyFunction","ge","goURI"],function(a,b,c,d,e,f){b('array-extensions');var g=b('Event');b('function-extensions');var h=b('Arbiter'),i=b('AsyncRequest'),j=b('Bootloader'),k=b('Class'),l=b('CSS'),m=b('DOM'),n=b('KeyEventController'),o=b('Keys'),p=b('PageTransitions'),q=b('Parent'),r=b('PhotosConst'),s=b('PhotoSessionLog'),t=b('PhotoStreamCache'),u=b('PhotosUtils'),v=b('PhotoViewer'),w=b('Style'),x=b('UserAgent'),y=b('Vector'),z=b('$'),aa=b('copyProperties'),ba=b('createArrayFrom'),ca=b('emptyFunction'),da=b('ge'),ea=b('goURI');function fa(){this.parent.construct(this);this.encodingMode=false;this._uriStack=[];this.replaceUrl=false;}aa(fa,{STATE_ERROR:'error',STATE_HTML:'html',STATE_IMAGE_DATA:'image',MIN_TAG_DISTANCE:80,_instance:null,getInstance:function(){if(!fa._instance)fa._instance=new fa();return fa._instance;},addPhotoFbids:function(ga,ha,ia){fa.getInstance().addPhotoFbids(ga,ha,ia);},attachTagger:function(ga){fa.getInstance().attachTagger(ga);},disableAjaxPipeForVideo:function(){var ga=fa.getInstance();if(ga.stream)ga.stream.setUseAjaxPipe(false);},init:function(){fa.getInstance().init();},recacheData:function(ga){fa.getInstance().recacheData(ga);},saveTagsFromPayload:function(ga){fa.getInstance().saveTagsFromPayload(ga);},saveTagsFromPayloadDelayed:function(ga){fa.saveTagsFromPayload.curry(ga).defer(2000);},handleServerError:function(ga,ha){fa.getInstance().handleServerError(ga,ha);},setHasLocation:function(ga){fa.getInstance().setHasLocation(ga);},storeFromData:function(ga){fa.getInstance().storeFromData(ga);},swapData:function(){fa.getInstance().swapData();},touchMarkup:ca,updateTotalCount:function(ga,ha,ia){fa.getInstance().updateTotalCount(ga,ha,ia);},isInVideoEncodingMode:function(){return fa.getInstance().isInVideoEncodingMode();},disableAutoRefresh:function(){fa.getInstance().disableAutoRefresh();},enableAutoRefresh:function(ga){fa.getInstance().enableAutoRefresh(ga);},hiliteAllTags:function(){fa.getInstance().hiliteAllTags();}});k.extend(fa,v);aa(fa.prototype,{sessionPhotosHilited:{},init:function(){this.stream=new t();this.stream.init(r.VIEWER_PERMALINK,'PhotoViewerPagelet');this.reset();this.root=z('fbPhotoPageContainer');this.header=z('fbPhotoPageHeader');this.stageWrapper=m.find(this.root,'.stageContainer');this.videoStage=m.find(this.stageWrapper,'div.videoStage');this.buttonActions=m.find(this.root,'div.stageButtons');this.feedback=da('fbPhotoPageFeedback');this.image=da('fbPhotoImage');this.errorBox=da('fbPhotoPageError');this.actionList=da('fbPhotoPageActions');this.stageActions=m.find(this.root,'div.stageActions');this.loadingStates={image:false,html:false};this.unhiliteTimer=null;this.pageHandlers=[g.listen(this.root,'mouseout',this.mouseOutListener.bind(this)),g.listen(this.root,'mousemove',this.mouseMoveListener.bind(this)),g.listen(this.stageWrapper,'click',this.stageClickListener.bind(this)),g.listen(this.stageWrapper,'dragstart',this.killDrag.bind(this)),g.listen(this.stageWrapper,'selectstart',this.killDrag.bind(this)),g.listen(this.buttonActions,'click',this.buttonListener.bind(this)),g.listen(this.actionList,'click',this.rotateListener.bind(this)),g.listen(this.feedback,'click',function(event){if(q.byClass(event.getTarget(),'like_link'))l.toggleClass(m.find(this.buttonActions,'div.likeCommentGroup'),'viewerLikesThis');}.bind(this))];p.registerHandler(this.transitionHandler.bind(this));n.registerKey('LEFT',this.goNav.bind(this));n.registerKey('RIGHT',this.goNav.bind(this));s.initLogging(s.PERMALINK);h.subscribe('PhotoTagApproval.HILITE_TAG',this.onHiliteTag.bind(this));h.subscribe('PhotoTagApproval.UPDATE_TAG_BOX',this.onUpdateTagBox.bind(this));},getEventPrefix:function(){return 'PhotoPermalink';},getSourceString:function(){return 'permalink';},getVersionConst:function(){return r.VIEWER_PERMALINK;},saveTagsFromPayload:function(ga){this.storeFromData(ga);if('data' in ga&&this.stream.getCursor() in ga.data)this.swapData();},goNav:function(event){var ga=g.getKeyCode(event)||event.getTarget(),ha=event.type==='click'&&q.byClass(ga,'stageWrapper')&&!q.byClass(ga,'tagBoxPending')&&!q.byClass(ga,'tagBoxPendingResponse')&&!q.byClass(ga,'uiButtonGroup');if(ha&&l.hasClass(this.root,'taggingMode'))return false;if(ga==o.LEFT){this.page(-1);}else if(ga==o.RIGHT||ha)this.page(1);return false;},pagerClick:function(ga){if(ga=='prev'){this.page(-1);}else if(ga=='next')this.page(1);return false;},setLoadingState:function(ga,ha){switch(ga){case fa.STATE_IMAGE_DATA:this.loadingStates[ga]=ha;l.conditionClass(this.root,'imageLoading',ha);break;case fa.STATE_HTML:this.loadingStates[ga]=ha;l.conditionClass(this.root,'dataLoading',ha);break;}},checkState:function(ga){if(ga!=fa.STATE_ERROR&&!this.loadingStates[ga])return;switch(ga){case fa.STATE_IMAGE_DATA:var ha=this.stream.getCurrentImageData();if(ha){if(ha.url){this.switchImage(ha.url,true);}else if(ha.video)this.switchVideo(ha.video,true);this.setLoadingState(ga,false);}break;case fa.STATE_HTML:if(this.stream.getCurrentHtml()){this.swapData();this.setLoadingState(ga,false);}break;default:if(this.stream.errorInCurrent()){l.hide(this.image);l.show(this.errorBox);}break;}},reHilitePendingTag:function(){var ga=da(this.hilitedTag);if(ga&&l.hasClass(ga,'showPendingTagName'))return;var ha=m.scry(this.root,'div.tagsWrapper div.showPendingTagName')[0];if(ha)this.switchHilitedTags(ha.id);},isPagingAllowed:function(ga){return this.stream.isValidMovement(ga)&&!l.hasClass(this.root,'croppingMode');},page:function(ga,ha){if(!this.isPagingAllowed(ga))return;this.unhiliteAllTags();var ia=this.getVideoOnStage();if(ia)this.switchVideo(ia,false);this.recacheData();this.stream.moveCursor(ga);l.hide(this.image);if(this.stream.errorInCurrent()){this.setLoadingState(fa.STATE_HTML,true);l.show(this.errorBox);return;}var ja=this.stream.getCurrentImageData();if(ja){if(ja.url){this.switchImage(ja.url,true);}else if(ja.video)this.switchVideo(ja.video,true);if(!ha){this.replaceUrl=true;ea(ja.info.permalink);}}else{this.waitForLoadCount++;this.setLoadingState(fa.STATE_IMAGE_DATA,true);}if(this.stream.getCurrentHtml()){this.swapData();}else this.setLoadingState(fa.STATE_HTML,true);h.inform('PhotoPermalink.PAGE');},transitionHandler:function(ga){if(ga.getPath()!=='/photo.php')return false;if(ga.getQueryData().makeprofile&&ga.getQueryData().fbid==this.stream.getCursor()&&!this.getVideoOnStage()){j.loadModules(['PhotoCropper'],function(ka){ka.start();});p.transitionComplete();return true;}if(this.replaceUrl){this.replaceUrl=false;this._uriStack.push(ga.getQualifiedURI().toString());p.transitionComplete();return true;}var ha=this._uriStack.length;if(ha>=2&&this._uriStack[ha-2]==ga.getQualifiedURI().toString())this._uriStack.pop();var ia=this.stream.getCursorForURI(ga.getUnqualifiedURI().toString());if(ia){var ja=this.stream.getRelativeMovement(ia);this.page(ja,true);p.transitionComplete();return true;}return false;},recacheData:function(ga){if(!this.loadingStates.html){var ha=this.stream.getCurrentHtml();for(var ia in ha){ha[ia]=ba(z(ia).childNodes);if(ga!==true&&ia!=='fbPhotoPageHeader')m.empty(z(ia));}}},getCurrentPhotoInfo:function(){var ga=this.stream.getCurrentImageData();return ga&&ga.info;},getVideoOnStage:function(){var ga=this.stream.getCurrentImageData();return ga&&ga.video;},switchImage:function(ga,ha){l.hide(this.image);l.hide(this.errorBox);var ia=this.stream&&this.stream.getCurrentImageData();if(ia)s.addPhotoView(ia.info);var ja=m.create('img',{id:'fbPhotoImage',className:'fbPhotoImage',alt:'',src:ga});m.replace(this.image,ja);this.image=ja;if(ha)this.stream.preloadImages();},switchVideo:function(ga,ha){var ia='swf_'+ga;if(ha){l.addClass(this.stageWrapper,'showVideo');this.videoStage.id=ga;if(window[ia]&&!da(ia))window[ia].write(ga);}else{this.videoStage.id='fbPageVideoStage';window[ia].addVariable('video_autoplay',0);m.empty(this.videoStage);l.removeClass(this.stageWrapper,'showVideo');}},swapData:function(){if(this.dataLoadTimer){this.setLoadingState(fa.STATE_HTML,true);clearTimeout(this.dataLoadTimer);this.dataLoadTimer=setTimeout(this.clearTimer.bind(this,true),100);return;}var ga,ha=this.stream.getCurrentHtml();if(ha){for(var ia in ha){ga=da(ia);ga&&m.setContent(ga,ha[ia]);}h.inform('PhotoPermalink.DATA_CHANGE',this.stream.getCurrentImageData().info,h.BEHAVIOR_STATE);if(this.stream.getCurrentExtraData())h.inform('PhotoPermalink.EXTRA_DATA_CHANGE',this.stream.getCurrentExtraData(),h.BEHAVIOR_STATE);this.setLoadingState(fa.STATE_HTML,false);this.dataLoadTimer=setTimeout(this.clearTimer.bind(this,false),100);}this.adjustForNewData();if(this.showFlashTags)this.hiliteAllTags();},clearTimer:function(ga){this.dataLoadTimer=false;ga&&this.swapData();},adjustForNewData:function(){if(!this.image)return;var ga=m.scry(this.stageWrapper,'div.tagsWrapper')[0],ha=y.getElementDimensions(this.image);if(ga){w.set(ga,'width',ha.x+'px');w.set(ga,'height',ha.y+'px');if(x.ie()<=7){var ia=m.scry(this.root,'div.tagContainer')[0];if(ia)l.conditionClass(ga,'ie7VerticalFix',y.getElementDimensions(ia).y>ha.y);}}},fetchInitBucket:function(ga){if(!this.stream.isLoaded())return;this.stream.fetch(ga,true);},addPhotoFbids:function(ga,ha,ia){var ja=this.stream.getCursor()===null;this.stream.attachToFbidsList(ga,ha,ia);if(ia&&ja)this.page(0);},attachTagger:function(ga){m.appendContent(this.stageActions,ga);},storeFromData:function(ga){var ha=this.stream.storeToCache(ga);if('init' in ga){s.setPhotoSet(this.stream.getPhotoSet());s.setLogFbids(true);s.addPhotoView(this.stream.getCurrentImageData().info);this.showFlashTags=!!ga.init.flashtags;}if('error' in ha){this.checkState(fa.STATE_ERROR);return;}if('image' in ha)this.checkState(fa.STATE_IMAGE_DATA);if('data' in ha)this.checkState(fa.STATE_HTML);},handleServerError:function(ga,ha){m.setContent(this.errorBox,ga);this.storeFromData(ha);},updateTotalCount:function(ga,ha,ia){var ja=da('fbPhotoPagePositionAndCount');ja&&m.setContent(ja,ia);this.stream.setTotalCount(ga);this.stream.setFirstCursorIndex(ha);},buttonListener:function(event){var ga=event.getTarget();if(q.byClass(ga,'likeButton')){var ha=m.scry(this.feedback,'button.like_link')[0];if(!ha){ha=m.scry(this.feedback,'a.UFILikeLink')[0];l.toggleClass(m.find(ga,'^div.likeCommentGroup'),'viewerLikesThis');}ha&&ha.click();}else if(q.byClass(ga,'commentButton')){var ia=m.scry(this.feedback,'div.commentBox textarea')[0];if(!ia)ia=m.scry(this.feedback,'li.UFIAddComment textarea')[0];if(ia){ia.focus();this.root.scrollTop=this.root.scrollHeight;}}},rotateListener:function(event){var ga=event.getTarget();if(q.byClass(ga,'rotateRight')){this.rotate('right');}else if(q.byClass(ga,'rotateLeft'))this.rotate('left');},stageClickListener:function(event){var ga=event.getTarget();if(q.byClass(ga,'fbPhotoTagApprovalBox')||q.byClass(ga,'videoStage')||q.byClass(ga,'tag')){return true;}else if(q.byClass(ga,'fbPhotoViewLarger')){j.loadModules(['PhotoSnowlift'],function(ha){ha.bootstrap(window.location,ga);});}else this.goNav(event);},rotate:function(ga){var ha=this.stream.getCursor();if(this.getVideoOnStage()){var ia=(ga=='left')?270:90;j.loadModules(['VideoRotate'],function(ka){new ka(ha,this.actionList).motionRotate(ia);}.bind(this));return;}var ja=aa({fbid:ha,cs_ver:r.VIEWER_PERMALINK},this.stream.getPhotoSetQuery());ja[ga]=1;this.setLoadingState(fa.STATE_IMAGE_DATA,true);l.hide(this.image);new i('/ajax/photos/photo/rotate/').setMethod('POST').setAllowCrossPageTransition(true).setReadOnly(false).setData(ja).setFinallyHandler(this.rotateComplete.bind(this,ha)).send();},rotateComplete:function(ga,ha){if(ga==this.stream.getCursor()){this.setLoadingState(fa.STATE_IMAGE_DATA,false);this.switchImage(this.stream.getCurrentImageData().url);this.swapData();}},mouseOutListener:function(event){var ga=event.getTarget(),ha=event.getRelatedTarget(),ia=q.byClass(ga,'stageActions'),ja=q.byClass(ga,'stageWrapper'),ka=q.byClass(ha,'stageActions'),la=q.byClass(ha,'stageWrapper'),ma=q.byClass(ha,'uiContextualLayer'),na=(!la&&!ma&&(ja&&!ka)||(ia&&!la));if(na)this.unhiliteAllTags(true);},mouseMoveListener:function(event){var ga=event.getTarget();if(!q.byClass(ga,'stageActions')&&!q.byClass(ga,'stageWrapper'))return;this.hiliteTagsOnMouseMove(event);},hiliteAllTags:function(){var ga=this.stream.getCurrentImageData().info.fbid;if(this.sessionPhotosHilited[ga])return;m.scry(this.stageWrapper,'div.tagsWrapper div.tagBox').forEach(function(ha){l.addClass(ha,'hover');});this.sessionPhotosHilited[ga]=true;this.temporaryHiliteTimer=this.unhiliteAllTags.bind(this).defer(2000,true);},unhiliteAllTags:function(ga,event){clearTimeout(this.temporaryHiliteTimer);m.scry(this.stageWrapper,'div.tagsWrapper div.hover').forEach(function(ha){if(ga&&l.hasClass(ha,'tagBoxPending'))return;l.removeClass(ha,'hover');});if(ga)return;if(this.unhiliteTimer!==null){clearTimeout(this.unhiliteTimer);this.unhiliteTimer=null;}this.hilitedTag=null;},switchHilitedTags:function(ga,ha){this.unhiliteAllTags();var ia=da(ga);if(ia){this.hilitedTag=ga;l.addClass(ia,'hover');if(l.hasClass(ia,'tagBoxPending')&&!l.hasClass(ia,'showPendingTagName')&&ha===true){m.scry(this.stageWrapper,'div.tagsWrapper div.showPendingTagName').forEach(function(ja){l.removeClass(ja,'showPendingTagName');});l.addClass(ia,'showPendingTagName');}}},hiliteTagsOnMouseMove:function(event){if(!this.stream.getCurrentExtraData()||this.getVideoOnStage())return;if(this.unhiliteTimer!==null)return;var ga=event.getTarget();if(q.byClass(ga,'fbPhotoPageTagApproval')||q.byClass(ga,'tagPointer'))return;var ha=q.byClass(ga,'tagBoxPending'),ia=(this.hilitedTag&&l.hasClass(z(this.hilitedTag),'tagBoxPending')),ja=((!this.hilitedTag&&ha)||(!ia&&ha));if(ja){this.switchHilitedTags(ha.id);return;}if(ha&&(ha.id==this.hilitedTag))return;var ka=250,la=u.absoluteToNormalizedPosition(this.image,y.getEventPosition(event)),ma=u.getNearestBox(this.stream.getCurrentExtraData().tagRects,la);if(!ma){if(!ia){this.unhiliteAllTags();this.reHilitePendingTag();}return;}var na=null;if(ia){var oa={};oa[this.hilitedTag]=this.stream.getCurrentExtraData().tagRects[this.hilitedTag];na=u.getNearestBox(oa,la);}if(na!==null&&ia)return;if(this.hilitedTag!=ma)if(ia){this.unhiliteTimer=this.unhiliteAllTags.bind(this,false,event).defer(ka);}else this.switchHilitedTags(ma);},updateTagBox:function(ga,ha){this.unhiliteAllTags();var ia=da(ga);if(!ia)return;l.addClass(ia,'tagBox');l.addClass(ia,'tagBoxPendingResponse');l.removeClass(ia,'tagBoxPending');l.hide(m.find(ia,'span.tagForm'));if(ha){l.show(m.find(ia,'span.tagApproved'));}else l.show(m.find(ia,'span.tagIgnored'));},killDrag:function(){if(l.hasClass(this.root,'taggingMode'))return false;},reset:function(){while(this.pageHandlers&&this.pageHandlers.length)this.pageHandlers.pop().remove();n.getInstance().resetHandlers();},onHiliteTag:function(ga,ha){if(ha.version!=r.VIEWER_PERMALINK)return;var ia=ha.tag;if(ia){this.switchHilitedTags(ia,true);}else this.unhiliteAllTags();},onUpdateTagBox:function(ga,ha){if(ha.version==r.VIEWER_PERMALINK)this.updateTagBox(ha.id,ha.approve);},disableAutoRefresh:function(){clearTimeout(this.timerId);},isInVideoEncodingMode:function(){return this.encodingMode;},enableAutoRefresh:function(ga){this.encodingMode=true;this.timerId=window.location.reload.bind(window.location).defer(ga);},setHasLocation:function(ga){l.conditionClass(this.root,'hasLocation',ga);}});e.exports=fa;});
__d("PhotoTagger",["Event","array-extensions","function-extensions","Arbiter","AsyncRequest","CSS","DOM","ErrorDialog","Hovercard","Keys","Parent","PhotosConst","PhotosUtils","PhotosTaggingWaterfall","Style","Vector","PhotoTagStore","copyProperties","ge","userAction"],function(a,b,c,d,e,f){var g=b('Event');b('array-extensions');b('function-extensions');var h=b('Arbiter'),i=b('AsyncRequest'),j=b('CSS'),k=b('DOM'),l=b('ErrorDialog'),m=b('Hovercard'),n=b('Keys'),o=b('Parent'),p=b('PhotosConst'),q=b('PhotosUtils'),r=b('PhotosTaggingWaterfall'),s=b('Style'),t=b('Vector'),u=b('PhotoTagStore'),v=b('copyProperties'),w=b('ge'),x=b('userAction');function y(aa,ba){return ((aa%ba)+ba)%ba;}function z(aa,ba){this.viewer=aa;this.version=aa.getVersionConst();this.tagHoverFacebox=ba;this.datasources={};this.photoData={};this.tagRects={};this.ajaxURIs={tagsInit:'/ajax/photos/photo/tags/tags_init.php',tagsAlbum:'/ajax/photos/photo/tags/tags_album.php',fetchDatasource:'/ajax/photos/photo/tags/fetch_datasource.php',tagAction:'/ajax/photo_tagging_ajax.php',tagWithAction:'/ajax/with_tagging_ajax.php'};z.instances[this.version]=this;}v(z,{instances:{},getInstance:function(aa){return z.instances[aa];},resetAlbumTaggingSuggestions:function(aa){var ba=z.getInstance(aa);ba&&ba.resetAlbumTaggingSuggestions();}});v(z.prototype,{TAG_BOX_SIZE:100,EPSILON:.0025,elemNames:{6:{addTagLink:'div.fbPhotosPhotoOwnerButtons',overlayActions:'div.snowliftOverlayBar'}},initSnowlift:function(aa,ba,ca){this._init(aa,ba,ca,this.viewer.container);},initPermalink:function(aa,ba,ca){this._init(aa,ba,ca,this.viewer.actionList);},_init:function(aa,ba,ca,da){this.setupUserActionLogging();this.root=this.viewer.getRoot();this.tagger=aa;this.tokenizer=ba;this._qn=null;this.typeahead=ba.getTypeahead();this.userId=ca;this.makeProfilePicMenuContainer=da;this.faceboxes=[];this.currentFacebox=null;this.revokedFaceboxes=[];this.requestFaceboxNextTag=false;this.clickState=k.find(this.root,'div.stageActions');this.newTagBox=k.find(this.clickState,'div.newTagBox');this.addTagLink=k.find(this.root,this.elemNames[this.version].addTagLink);this.overlayActions=k.find(this.root,this.elemNames[this.version].overlayActions);this.setupHandlers();this.hideNewTagTimer=null;this.addedSuggestions=[];this.featuredSuggestions=[];this.albumSuggestions=[];this.friendSuggestions=[];this.suggestionAlbum=-1;this.needAlbumSuggestionsFetch=true;this.fetchTaggingSuggestions({owner:this.photoData.owner});this.setDataSource(this.typeahead.getData());this.updateFaceboxes();this.tagAccumulating=false;return this;},setTagAccumulator:function(aa){this.tagAccumulating=aa;},setupUserActionLogging:function(){this.ua=x(this.viewer.getSourceString()).uai('init','tagging').add_event('init');},logUserActionEvent:function(aa){this.ua.add_event(aa);},fetchTaggingSuggestions:function(aa){this.logUserActionEvent('sugg_fetch');new i().setURI(this.ajaxURIs.tagsInit).setData(aa).setOption('retries',1).setAllowCrossPageTransition(true).setHandler(function(ca){var da=ca.getPayload();this.featuredSuggestions=da.featuredTaggees;this.friendSuggestions=da.friendTaggees;this.updateTypeaheadSuggestions();this.logUserActionEvent('sugg_fetch_done');}.bind(this)).send();var ba=this.typeahead.subscribe('bootstrap',function(ca,da){if(da&&!da.bootstrapping){if(this.taggingMode)this.updateWithSuggestions();this.typeahead.unsubscribe(ba);this.typeahead.subscribe('focus',function(){if(this.taggingMode)this.updateWithSuggestions();}.bind(this));this.typeahead.subscribe('click',function(){if(!this.taggingMode)this.updateWithSuggestions();}.bind(this));this.tokenizer.subscribe('removeToken',this.updateWithSuggestions.bind(this));this.tokenizer.subscribe('addToken',this.addSuggestion.bind(this));this.typeahead.subscribe('respond',function(ea,fa){if(this.taggingMode&&fa&&!fa.results.length)this.updateWithSuggestions();}.bind(this));}}.bind(this));},fetchAlbumTaggingSuggestions:function(){this.logUserActionEvent('sugg_album_fetch');new i().setURI(this.ajaxURIs.tagsAlbum).setData({cachedAlbum:this.suggestionAlbum,photo:this.photoData.fbid}).setOption('retries',1).setAllowCrossPageTransition(true).setHandler(function(aa){this.needAlbumSuggestionsFetch=false;var ba=aa.getPayload();if(ba.length===0)return;this.suggestionAlbum=ba.album;this.albumSuggestions=ba.taggees;this.updateTypeaheadSuggestions();this.logUserActionEvent('sugg_album_fetch_done');}.bind(this)).send();},resetAlbumTaggingSuggestions:function(){this.needAlbumSuggestionsFetch=true;this.updateTypeaheadSuggestions();},updateTypeaheadSuggestions:function(){this.typeahead.getView().setSuggestions(this.addedSuggestions.concat(this.featuredSuggestions,this.needAlbumSuggestionsFetch?[]:this.albumSuggestions,this.friendSuggestions));},saveClickPosition:function(aa,ba){var ca=t.getElementPosition(aa),da=t.getElementDimensions(aa);this.clickPercentToPhoto=new t((ba.x-ca.x)/da.x,(ba.y-ca.y)/da.y);},getCalculatedClickPosition:function(aa){var ba=t.getElementPosition(aa),ca=t.getElementDimensions(aa);if(ca.x===0||ca.y===0)return null;return new t(this.clickPercentToPhoto.x*ca.x+ba.x,this.clickPercentToPhoto.y*ca.y+ba.y,'document');},repositionTagger:function(){if(this.clickPercentToPhoto){var aa=this.viewer.getImage(),ba=this.getCalculatedClickPosition(aa);if(!ba)return;this.addTagFromClickPos(ba);}},setupHandlers:function(){this.handlers=[g.listen(this.clickState,'click',this.addTag.bind(this)),g.listen(this.addTagLink,'click',this.checkActions.bind(this)),g.listen(this.overlayActions,'click',this.checkActions.bind(this))];g.listen(document.documentElement,'keydown',function(event){if(!this.taggingMode)return;var aa=g.getKeyCode(event);if(aa===n.ESC){this.deactivateTagging();}else if(aa===n.TAB)this.addNextTagFromFacebox(event.shiftKey?-1:1);}.bind(this));this.subscriptions=[h.subscribe(this.viewer.getEventString('PAGE'),this.restartTagging.bind(this)),h.subscribe(this.viewer.getEventString('DATA_CHANGE'),this.setPhotoData.bind(this)),h.subscribe(this.viewer.getEventString('EXTRA_DATA_CHANGE'),this.setExtraData.bind(this)),h.subscribe(this.viewer.getEventString('CLOSE'),this.deactivateTagging.bind(this))];this.tokenizer.subscribe('addToken',this.saveTag.bind(this));this.tokenizer.subscribe('removeToken',this.removeTag.bind(this));this.tokenizer.subscribe('markTagAsSpam',this.markTagAsSpam.bind(this));},updateWithSuggestions:function(aa,ba){var ca=this.typeahead.getData().buildUids(' ',this.typeahead.getView().getSuggestions(),this.typeahead.getCore().getExclusions());if(!ca.length)return;var da=this.typeahead.getData().respond('',ca);for(var ea=0;ea<da.length;ea++)da[ea].index=-1000+ea;},addSuggestion:function(aa,ba){var ca=ba.info&&ba.info.uid;if(ca){this.addedSuggestions.unshift(ca);this.updateTypeaheadSuggestions();}},setQueueName:function(aa){this._qn=aa;return this;},_sendWaterfallLogSignal:function(aa){r.sendSignal({qn:this._qn,source:this.viewer.getSourceString(),step:aa,pid:this.photoData.pid});},_bumpQueueName:function(){if(this._qn)this._qn+=1;},activateTagging:function(){this.logUserActionEvent('activate');h.inform('PhotoTagger.ACTIVATE_TAGGING');if(this.getDataSource()){this.dataSourceFetched(this.getDataSource());}else new i(this.ajaxURIs.fetchDatasource).setData({fbid:this.photoData.fbid,version:this.version}).send();if(this.needAlbumSuggestionsFetch)this.fetchAlbumTaggingSuggestions();},restartTagging:function(){this.hideNewTag();this.hideTagger();this.revokedFaceboxes=[];this.setCurrentFacebox(null);if(this.taggingMode){this.requestFaceboxNextTag=true;this.activateTagging();}},getDataSource:function(){return this.datasources[this.getDataSourceKey()];},getDataSourceKey:function(){if(this.photoData.ownertype=='user'&&!this.photoData.obj_id)return 'friends';return this.photoData.obj_id||this.photoData.owner;},setDataSource:function(aa){if(this.typeahead.getData()!=aa)this.typeahead.swapData(aa);this.datasources[this.getDataSourceKey()]=aa;},dataSourceFetched:function(aa){this.taggingMode=true;j.addClass(this.root,'taggingMode');h.inform('PhotoTagger.ACTIVATED_TAGGING');this._bumpQueueName();this._sendWaterfallLogSignal(r.BEGIN);this.setDataSource(aa);},deactivateTagging:function(){this.logUserActionEvent('deactivate');if(this.taggingMode===true)this._sendWaterfallLogSignal(r.FINISH);this.taggingMode=false;this.hideNewTag();this.hideTagger();this.setCurrentFacebox(null);j.removeClass(this.root,'taggingMode');h.inform('PhotoTagger.DEACTIVATED_TAGGING');},checkActions:function(event){var aa=event.getTarget();if(o.byClass(aa,'fbPhotosPhotoActionsTag'))if(this.taggingMode){this.deactivateTagging();}else{this.activateTagging();this.addNextTagFromFacebox(1);}},hideTagger:function(){j.hide(this.tagger);this.clickPercentToPhoto=null;var aa=k.scry(this.tagger,'input.textInput')[0];if(aa)aa.blur();},showTagger:function(){j.show(this.tagger);(function(){k.find(this.tagger,'input.textInput').focus();}).bind(this).defer();this.hideNewTag();h.inform('reflow');},showNewTag:function(aa){if(!this.newTagBox)return;k.setContent(k.find(this.newTagBox,'div.tagName'),k.create('span',null,aa));j.show(this.newTagBox);this.hideNewTagTimer=setTimeout(this.hideNewTag.bind(this),3000);},hideNewTag:function(){if(!this.newTagBox)return;if(this.hideNewTagTimer!==null){clearTimeout(this.hideNewTagTimer);this.hideNewTagTimer=null;}j.hide(this.newTagBox);},getTaggerPositioningOrigin:function(){return t.getElementPosition(this.clickState,'document');},setClickPosAndFacebox:function(aa){var ba=this.viewer.getImage();this.saveClickPosition(ba,aa);var ca=q.absoluteToNormalizedPosition(ba,aa);this.setCurrentFacebox(this.findNearestFacebox(ca));},addTagFromClickPos:function(aa){if(this.currentFacebox){this.addTagFromFaceboxDontSave(this.currentFacebox);}else{j.removeClass(k.find(this.tagger,'.faceBox'),'faceBoxHidden');this.addTagFromPosition(aa,this.TAG_BOX_SIZE);}},addTag:function(event){var aa=event.getTarget(),ba=o.byClass(aa,'fbPhotosPhotoButtons');if(!this.taggingMode||(ba&&aa!==ba)||o.byClass(aa,'fbPhotosPhotoActions')||o.byClass(aa,'photoTagTypeahead'))return;var ca=t.getEventPosition(event);this.setClickPosAndFacebox(ca);this.addTagFromClickPos(ca);},findNearestFacebox:function(aa){var ba=Infinity,ca=null;this.faceboxes.forEach(function(da){if(da.rect.contains(aa)){var ea=aa.distanceTo(da.rect.getCenter());if(ea<ba){ba=ea;ca=da;}}});return ca;},addNextTagFromFacebox:function(aa){if(this.faceboxes.length===0)return;if(!this.currentFacebox){this.setCurrentFacebox(this.faceboxes[0]);}else{var ba=this.faceboxes.indexOf(this.currentFacebox),ca=y(ba+aa,this.faceboxes.length);if(ca===ba)return;this.setCurrentFacebox(this.faceboxes[ca]);}this.addTagFromFacebox(this.currentFacebox);},addTagFromFaceboxDontSave:function(aa){j.addClass(aa.node,'active');j.addClass(k.find(this.tagger,'.faceBox'),'faceBoxHidden');var ba=aa.rect.getCenter(),ca=this.viewer.getImage(),da=q.normalizedToAbsolutePosition(ca,ba),ea=(aa.rect.w()/100)*t.getElementDimensions(ca).x;this.addTagFromPosition(da,ea);return da;},addTagFromFacebox:function(aa){var ba=this.addTagFromFaceboxDontSave(aa),ca=this.viewer.getImage();this.saveClickPosition(ca,ba);},addTagFromPosition:function(aa,ba){var ca=this.viewer.getImage(),da=this.calcTaggerPosition(ca,aa,ba);this.calcClickPoint(ca,aa);if(!da){this.hideTagger();return;}da.setElementPosition(this.tagger);if(this.newTagBox){da.setElementPosition(this.newTagBox);new t(ba,ba).setElementDimensions(this.newTagBox);}var ea=t.getElementPosition(ca),fa=t.getElementDimensions(ca);if(aa.y>ea.y+fa.y*3/4){j.addClass(this.tagger,'fbPhotoTaggerFlipped');}else j.removeClass(this.tagger,'fbPhotoTaggerFlipped');this.showTagger();if(this.taggingMode){this._sendWaterfallLogSignal(r.TAG_FACE);}else this._sendWaterfallLogSignal(r.HOVER_TAG_FACE);},calcTaggerPosition:function(aa,ba,ca){var da=t.getElementPosition(aa),ea=t.getElementDimensions(aa),fa=new t(ca/2,ca/2),ga=ba.sub(da);for(var ha in {x:1,y:1}){if(ba[ha]<da[ha]||ba[ha]>da[ha]+ea[ha])return null;if(ga[ha]<(ca/2)){fa[ha]=ga[ha];}else if(ea[ha]<ga[ha]+(ca/2))fa[ha]=ca-(ea[ha]-ga[ha]);}var ia=3,ja=k.find(this.tagger,'.faceBox');s.set(ja,'width',(ca-ia*2)+'px');s.set(ja,'height',(ca-ia*2)+'px');var ka=ba.sub(this.getTaggerPositioningOrigin());return ka.sub(fa.x,fa.y);},calcClickPoint:function(aa,ba){var ca=t.getElementDimensions(aa),da=t.getElementPosition(aa),ea=ba.sub(da);this.clickPoint={x:ea.x/ca.x,y:ea.y/ca.y};},saveTag:function(aa,ba){var ca=this.getTaggingData('add',ba.isFreeform()?'':ba.getValue(),ba.getText());ca.x=this.clickPoint.x*100;ca.y=this.clickPoint.y*100;ca.from_facebox=!!this.currentFacebox;ca.tagging_mode=!!this.taggingMode;this.logUserActionEvent('save');if(this.tagAccumulating){u.getInstance().storeTagWithOptions(this.photoData.fbid,ca.subject,ca.x,ca.y,ca);}else new i().setURI(this.ajaxURIs.tagAction).setMethod('POST').setData(ca).setAllowCrossPageTransition(true).setHandler(this.tagsChangeHandler.bind(this)).setErrorHandler(this.checkError.bind(this,ba)).send();if(this.userId===parseInt(ca.subject,10)){var da=k.scry(this.makeProfilePicMenuContainer,'[data-picid="'+this.viewer.getCurrentPhotoInfo().fbid+'"]');if(da.length===1){var ea=da[0];j.removeClass(ea,'hide');}}this.showNewTag(ba.getText());this.hideTagger();var fa=this.currentFacebox;if(fa){if(this.taggingMode)this.addNextTagFromFacebox(1);this.removeFacebox(fa);}},getTaggingData:function(aa,ba,ca){return {cs_ver:this.version,pid:this.photoData.pid,fbid:this.photoData.fbid,id:this.photoData.owner,subject:ba,name:ca,action:aa,source:this.viewer.getSourceString(),qn:this._qn,position:this.getPosition()};},getPosition:function(){return this.viewer.getPosition();},tagsChangeHandler:function(aa){this.logUserActionEvent('save_done');},checkError:function(aa,ba){if(ba.getPayload()&&ba.getPayload().clear_tag){aa.already_untagged=true;this.tokenizer.removeToken(aa);}l.showAsyncError(ba);},removeTag:function(aa,ba,ca){if(ba.already_untagged)return;var da='remove';if(k.scry(ba.element,'a.pending')[0])da='retract';if(ba.blockUser)da='remove_block';this.logUserActionEvent('save');if(this.tagAccumulating){if(ba.isFreeform()){u.getInstance().removeTextTag(this.photoData.fbid,ba.getInfo().text);}else u.getInstance().removeTag(this.photoData.fbid,ba.getInfo().uid);}else new i().setURI(this.ajaxURIs.tagAction).setMethod('POST').setData(this.getTaggingData(da,ba.isFreeform()?'':ba.getInfo().uid,ba.getInfo().text)).setHandler(function(ga){this.tagsChangeHandler(ga);ca&&ca();}.bind(this)).setAllowCrossPageTransition(true).send();if(this.userId===parseInt(ba.getValue(),10)&&this.userId!==this.viewer.getCurrentPhotoInfo().owner){var ea=k.scry(this.makeProfilePicMenuContainer,'[data-picid="'+this.viewer.getCurrentPhotoInfo().fbid+'"]');if(ea.length===1){var fa=ea[0];j.addClass(fa,'hide');}h.inform('PhotoTagger.REMOVED_MAKE_PROFILE_PIC_OPTION');}},removeTagByID:function(aa,ba,ca){var da=this.tokenizer.tokens;for(var ea=0;ea<da.length;ea++)if(da[ea].info.uid==ba)return this.removeTag(null,da[ea],ca);},removeTagByIDFromHovercardLink:function(aa,ba,ca){this.removeTagByID(aa,ba,function(){if(m.contains(ca))m.hide(true);});},removeWithTag:function(aa,ba){new i().setURI(this.ajaxURIs.tagWithAction).setMethod('POST').setData({action:'remove_with',taggee:ba,tag:aa,version:this.version,fbid:this.photoData.fbid}).setHandler(function(ca){this.tagsChangeHandler(ca);if(window.Hovercard)window.Hovercard.hide(true);}.bind(this)).setAllowCrossPageTransition(true).send();},setPhotoData:function(aa,ba){this.clickPercentToPhoto=null;this.photoData=ba;return this;},setExtraData:function(aa,ba){this.tagRects=ba.tagRects;this.updateFaceboxes();return this;},markTagAsSpam:function(aa,ba){new i().setURI(this.ajaxURIs.tagAction).setMethod('POST').setData(this.getTaggingData('mark_as_spam',ba,null)).send();},removeFacebox:function(aa){if(aa===null)return;this.revokedFaceboxes.push(aa.rect.getCenter());this.faceboxes.remove(aa);k.remove(aa.node);if(aa===this.currentFacebox)this.setCurrentFacebox(null);},setCurrentFacebox:function(aa){if(this.currentFacebox)j.removeClass(this.currentFacebox.node,'active');this.currentFacebox=aa;},updateRevokedFaceboxes:function(){this.revokedFaceboxes=this.revokedFaceboxes.filter(function(aa){for(var ba=0;ba<this.faceboxes.length;++ba){var ca=this.faceboxes[ba],da=aa.distanceTo(ca.rect.getCenter());if(da<this.EPSILON)return true;}return false;}.bind(this));this.revokedFaceboxes.forEach(function(aa){var ba=this.findNearestFacebox(aa);this.faceboxes.remove(ba);k.remove(ba.node);}.bind(this));},updateFaceboxes:function(){if(this.version!==p.VIEWER_SNOWLIFT)return;this.faceboxes=[];for(var aa in this.tagRects)if(q.isFacebox(aa))this.faceboxes.push({node:w(aa),id:aa,rect:this.tagRects[aa]});this.updateRevokedFaceboxes();this.faceboxes.sort(function(ca,da){return ca.rect.getCenter().x-da.rect.getCenter().x;});if(this.currentFacebox){var ba=this.currentFacebox.rect.getCenter();this.setCurrentFacebox(this.findNearestFacebox(ba));j.addClass(this.currentFacebox.node,'active');}if(this.requestFaceboxNextTag){this.addNextTagFromFacebox(1);this.requestFaceboxNextTag=false;}},getFacebox:function(aa){for(var ba=0;ba<this.faceboxes.length;++ba)if(this.faceboxes[ba].id===aa)return this.faceboxes[ba];return null;}});e.exports=z;});
__d("PhotoPermalinkTagger",["Arbiter","Class","Event","PhotoPermalink","PhotoTagger","$","copyProperties"],function(a,b,c,d,e,f){var g=b('Arbiter'),h=b('Class'),i=b('Event'),j=b('PhotoPermalink'),k=b('PhotoTagger'),l=b('$'),m=b('copyProperties');function n(o){this.parent.construct(this,j.getInstance());this.photoData=o;}h.extend(n,k);m(n.prototype,{elemNames:{0:{addTagLink:'div.fbPhotosPhotoActions',overlayActions:'div.fbPhotosPhotoButtons'}},setupHandlers:function(){var o=l('imagestage'),p=l('fbPhotoPageTagBoxes');this.handlers=[i.listen(this.clickState,'click',this.addTag.bind(this)),i.listen(o,'click',this.addTag.bind(this)),i.listen(p,'click',this.addTag.bind(this)),i.listen(this.addTagLink,'click',this.checkActions.bind(this)),i.listen(this.overlayActions,'click',this.checkActions.bind(this))];this.subscriptions=[g.subscribe('PhotoPermalink.PAGE',this.restartTagging.bind(this)),g.subscribe('PhotoPermalink.DATA_CHANGE',this.setPhotoData.bind(this))];this.tokenizer.subscribe('addToken',this.saveTag.bind(this));this.tokenizer.subscribe('removeToken',this.removeTag.bind(this));this.tokenizer.subscribe('markTagAsSpam',this.markTagAsSpam.bind(this));},setDataForTokenizer:function(){this.tokenizer.setup(null,this.photoData);return this;}});e.exports=n;});
__d("legacy:PhotoPermalinkTagger",["PhotoPermalinkTagger"],function(a,b,c,d){a.PhotoPermalinkTagger=b('PhotoPermalinkTagger');},3);
__d("PhotoCropper",["Event","function-extensions","Arbiter","CSS","DOM","Form","Dialog","Keys","tx","Photocrop2","PhotoPermalink","ProfilePicRequestCreator","copyProperties"],function(a,b,c,d,e,f){var g=b('Event');b('function-extensions');var h=b('Arbiter'),i=b('CSS'),j=b('DOM'),k=b('Form'),l=b('Dialog'),m=b('Keys'),n=b('tx'),o=b('Photocrop2'),p=b('PhotoPermalink'),q=b('ProfilePicRequestCreator'),r=b('copyProperties'),s={initialize:function(t){this.clickHandlers=[];if(this.photocrop)this.destroy(false);this.photoPermalink=p.getInstance();this.root=this.photoPermalink.getRoot();this.options=t||{};this.registerClickHandler();this.registerEscapeKeyHandler();h.subscribe('PhotoPermalink.PAGE',function(){this.registerClickHandler();this.registerEscapeKeyHandler();this.destroy(false);}.bind(this),h.SUBSCRIBE_NEW);h.subscribe('PhotoTagger.REMOVED_MAKE_PROFILE_PIC_OPTION',this.destroy.bind(this,false));},registerEscapeKeyHandler:function(){g.listen(document.documentElement,'keydown',function(event){if(g.getKeyCode(event)===m.ESC)this.destroy(false);}.bind(this));},registerClickHandler:function(){this.actionLinks=j.find(this.root,'div.fbPhotosPhotoActions');var t=j.scry(this.actionLinks,'a.fbPhotoActionsCrop');if(t.length===0)return;var u=j.find(t[0],'.startCropping');if(this.clickHandlers.indexOf(u)!==-1)return;g.listen(u,'click',function(){this.start();return false;}.bind(this));this.clickHandlers.push(u);},start:function(){if(this.photocrop)return;this.cropLink=j.find(this.actionLinks,'a.fbPhotoActionsCrop');if(i.hasClass(this.cropLink,'profileAlbum')){new l().setTitle("D\u00e9finir comme photo de mon profil").setBody("Vous avez d\u00e9j\u00e0 utilis\u00e9 cette photo comme photo du profil. Voulez-vous l\u2019utiliser \u00e0 nouveau\u00a0?").setButtons([l.CONFIRM,l.CANCEL]).setModal(true).setHandler(function(){this.reuseProfilePic.bind(this).defer();return false;}.bind(this)).setCancelHandler(function(){this.cancelAndStopEvent();}.bind(this)).show();return false;}i.addClass(this.cropLink,'croppingModeOn');i.addClass(this.root,'croppingMode');var t=j.find(this.root,'img.fbPhotoImage'),u=j.find(this.root,'a.doneCroppingLink'),v=j.find(this.root,'a.cancelCroppingLink'),w=j.find(this.cropLink,'.doneCropping');this.wrapper=j.create('div');i.addClass(this.wrapper,'stageCropper');j.find(this.root,'.stageWrapper').appendChild(this.wrapper);this.wrapper.style.marginTop=t.parentNode.style.marginTop;g.listen(this.wrapper,'click',function(event){g.kill(event);});g.listen(u,'click',this.done.bind(this));g.listen(v,'click',this.cancelAndStopEvent.bind(this));g.listen(w,'click',this.done.bind(this));var x={target:this.wrapper,min_width:this.options.min_width},y=(function(){this.photocrop=new o(t,x);}).bind(this);if(t.complete){y();}else g.listen(t,'load',y);return false;},done:function(){var t=p.getInstance().getCurrentPhotoInfo(),u=this.getProfilePicTarget(t).id,v=this.destroy(true);if(!v)return false;new q(t.fbid,t.owner,u,v).setSuccessURI('profile.php?id='+u).setErrorURI('photo.php?pid='+t.pid+'&id='+t.owner).send();return false;},cancelAndStopEvent:function(){this.destroy(false);return false;},destroy:function(t){if(!this.photocrop){if(!t&&this.wrapper){j.remove(this.wrapper);this.wrapper=null;}return null;}i.removeClass(this.cropLink,'croppingModeOn');i.removeClass(this.root,'croppingMode');if(t){i.addClass(this.root,'profilePicSavingMode');}else{j.remove(this.wrapper);this.wrapper=null;}var u=this.photocrop.done(t);this.photocrop=null;return u;},reuseProfilePic:function(){var t=p.getInstance().getCurrentPhotoInfo(),u=this.getProfilePicTarget(t),v=r({pid:t.pid,owner:t.owner,id:u.id,type:u.type,profile_pic_id:u.id});k.post('/pic_upload.php',v);return false;},getProfilePicTarget:function(t){if(i.hasClass(this.cropLink,'makePageProfile'))return {id:t.owner,type:'object'};return {id:this.options.uid,type:'profile'};}};e.exports=s;});
__d("legacy:fb-photos-permalink-js",["PhotoPermalink"],function(a,b,c,d){a.PhotoPermalink=b('PhotoPermalink');},3);
__d("PhotoTags",["array-extensions","Event","Arbiter","CSS","DOM","Parent","PhotosConst","copyProperties","cx","ge"],function(a,b,c,d,e,f){b('array-extensions');var g=b('Event'),h=b('Arbiter'),i=b('CSS'),j=b('DOM'),k=b('Parent'),l=b('PhotosConst'),m=b('copyProperties'),n=b('cx'),o=b('ge');function p(q,r,s){this.tagTargets=q;this.tagBox=r;this.version=s||l.VIEWER_PERMALINK;this.handlers=[];this.tagTargets.forEach(function(t){this.handlers.push(g.listen(t,{mouseover:this.showTag.bind(this),mouseout:this.hideTags.bind(this)}));}.bind(this));this.subscriptions=[];if(this.version==l.VIEWER_SNOWLIFT)this.subscriptions.push(h.subscribe("PhotoSnowlift.PAGE",this.hideTags.bind(this)));}m(p.prototype,{showTag:function(event){var q=event.getTarget(),r=i.hasClass(q,'taggee'),s=i.hasClass(q,"_rx"),t=null;if(r){t=q.getAttribute('data-tag');}else if(s){var u=k.byTag(q,'a');t=u&&u.getAttribute('data-tag');}if(!t){q=k.byClass(q,'taggee');if(q)t=q.getAttribute('data-tag');}var v=this.version==l.VIEWER_PERMALINK?'perm:tag:'+t:'tag:'+t,w=v&&o(v);if(w){i.addClass(w,'showTag');i.addClass(this.tagBox,'showingTag');}},hideTags:function(){i.removeClass(this.tagBox,'showingTag');j.scry(this.tagBox,'div.showTag').forEach(function(q){i.removeClass(q,'showTag');});},destroy:function(){for(var q in this.handlers)this.handlers[q].remove();this.subscriptions.forEach(h.unsubscribe.bind(h));}});e.exports=p;});
__d("legacy:PhotoTags",["PhotoTags"],function(a,b,c,d){a.PhotoTags=b('PhotoTags');},3);
__d("TagToken",["Class","DOM","Token","copyProperties"],function(a,b,c,d,e,f){var g=b('Class'),h=b('DOM'),i=b('Token'),j=b('copyProperties');function k(l){this.parent.construct(this,l,'tag');}g.extend(k,i);j(k.prototype,{createElement:function(){var l=this.isFreeform(),m=h.create('span',{className:'separator'},', '),n=h.create(l?'span':'a',{className:'taggee','data-tag':this.getValue()},this.getText());if(!l)n.href=this.getInfo().path;return h.create('span',{className:'tagItem'},[m,n]);}});e.exports=k;});
__d("TagTokenizer",["Arbiter","Class","CSS","DOM","Parent","TagToken","Tokenizer","copyProperties","createObjectFrom","ge","tx"],function(a,b,c,d,e,f){var g=b('Arbiter'),h=b('Class'),i=b('CSS'),j=b('DOM'),k=b('Parent'),l=b('TagToken'),m=b('Tokenizer'),n=b('copyProperties'),o=b('createObjectFrom'),p=b('ge'),q=b('tx');function r(s,t,u,v){this.parent.construct(this,u,v);g.subscribe('PhotoInlineEditor.CANCEL_INLINE_EDITING',this.updateTokenareaVisibility.bind(this),g.SUBSCRIBE_NEW);this.appphoto=t;g.subscribe(s.getInstance().getEventString('DATA_CHANGE'),this.setup.bind(this),g.SUBSCRIBE_NEW);}h.extend(r,m);n(r.prototype,{setup:function(s,t){this.appphoto=t.byapp;this.byowner=t.isowner;return this.reset();},reset:function(){var s=this.getTokenElements().map(this.getTokenDataFromTag.bind(this));this.withTagKeys={};var t=this.getWithTagTokenElements().map(function(u){return this._tokenKey(this.getTokenDataFromTag(u));}.bind(this));this.withTagKeys=o(t);return this.parent.reset(s);},processEvents:function(event,s,t){if(k.byClass(s,'remove')){var u=this.getTokenFromElement(t);u=this.addTokenData(u,s);this.removeToken(u);event.kill();}},insertToken:function(s){return null;},removeToken:function(s){if(this.appphoto){return this.replaceToken(s);}else{this.inform('removeToken',s);g.inform('Form/change',{node:this.element});}},addTokenData:function(s,t){if(k.byClass(t,'blockuser'))s.blockUser=true;return s;},getTokenDataFromTag:function(s){return {uid:j.find(s,'input').value,text:j.getText(j.find(s,'.taggee'))};},getTokenElementFromTarget:function(s){return k.byClass(s,'tagItem');},getTokenElements:function(){return j.scry(this.tokenarea,'span.tagItem').filter(this.filterNonTokenElements.bind(this));},getWithTagTokenElements:function(){return j.scry(this.tokenarea,'span.withTagItem');},filterNonTokenElements:function(s){return !i.hasClass(s,'markasspam')&&!i.hasClass(s,'reported')&&!i.hasClass(s,'withTagItem');},createToken:function(s,t){var u=this.getToken(this._tokenKey(s));u=u||new l(s);t&&u.setElement(t);return u;},updateTokenareaVisibility:function(){var s=this.getTokenElements().filter(function(v){return i.shown(v);}),t=this.getWithTagTokenElements(),u=j.scry(this.tokenarea,'span.ogTagItem');i.conditionShow(this.tokenarea,s.length!==0||t.length!==0||u.length!==0);},replaceToken:function(s){if(!s)return;var t=this.tokens.indexOf(s);if(t<0)return;this.tokens.splice(this.tokens.indexOf(s),1);delete this.unique[this._tokenKey(s.getInfo())];var u=p('tagspam'+s.getValue());u&&j.remove(u);var v=[' [',"Identification retir\u00e9e.",' '];v.push(j.create('a',{onclick:this.markAsSpam.bind(this,s.getValue())},"Marquer l\u2019identification comme ind\u00e9sirable"));v.push('] ');var w=j.create('span',{className:'fbPhotosTaglistTag tagItem markasspam',id:'tagspam'+s.getValue()},v);j.replace(s.getElement(),w);this.updateTokenarea();this.inform('removeToken',s);g.inform('Form/change',{node:this.element});},markAsSpam:function(s){var t=p('tagspam'+s),u=[' [',"Identification signal\u00e9e",'] '],v=j.create('span',{className:'fbPhotosTaglistTag tagItem reported',id:'tagspam'+s},u);j.replace(t,v);this.inform('markTagAsSpam',s);}});e.exports=r;});
__d("TagTypeaheadView",["AsyncRequest","Class","ContextualTypeaheadView","CSS","DOM","Parent","copyProperties"],function(a,b,c,d,e,f){var g=b('AsyncRequest'),h=b('Class'),i=b('ContextualTypeaheadView'),j=b('CSS'),k=b('DOM'),l=b('Parent'),m=b('copyProperties');function n(o,p){this.parent.construct(this,o,p);this.hintText=p.hintText;this.userEd=p.userEd;this.origAutoSelect=p.autoSelect;this.setSuggestions(p.suggestions);}h.extend(n,i);m(n.prototype,{init:function(){j.addClass(this.element,'uiTagTypeaheadView');this.parent.init();},buildResults:function(o){if(!this.value)o.unshift({subtext:this.hintText,type:'hintText'});if(this.userEd){new g().setURI('/ajax/fof/user_education.php').setData({increment:1}).send();o.unshift({subtext:this.userEd,type:'userEdText'});}var p=this.parent.buildResults(o);if(this.userEd)o.shift();if(!this.value)o.shift();return p;},show:function(){var o=k.find(this.context,'.typeaheadBackdrop');j.addClass(o,'resultsPresent');return this.parent.show();},hide:function(){var o=k.find(this.context,'.typeaheadBackdrop');j.removeClass(o,'resultsPresent');return this.parent.hide();},render:function(o,p,q){this.autoSelect=this.origAutoSelect&&o.length;this.disableAutoSelect=o.length===0;this.parent.render(o,p,q);},getItems:function(){var o=this.parent.getItems();if(!this.value)o.shift();if(this.userEd)o.shift();return o;},getSuggestions:function(){return this.suggestions;},setSuggestions:function(o){this.suggestions=o||[];this.visible=!!this.suggestions;},addSuggestion:function(o){this.suggestions.unshift(o);},getContext:function(){return l.byClass(this.element,'typeaheadContainer');}});e.exports=n;});
__d("legacy:swfobject",["swfobject"],function(a,b,c,d){var e=b('swfobject');a.deconcept=e;a.SWFObject=e.SWFObject;a.showFlashErrorDialog=e.showFlashErrorDialog;},3);
__d("legacy:FreeformTokenizerBehavior",["FreeformTokenizerBehavior"],function(a,b,c,d){var e=b('FreeformTokenizerBehavior');if(!a.TokenizerBehaviors)a.TokenizerBehaviors={};a.TokenizerBehaviors.freeform=e;},3);
__d("TypeaheadHintText",["copyProperties","emptyFunction"],function(a,b,c,d,e,f){var g=b('copyProperties'),h=b('emptyFunction');function i(j){this._typeahead=j;}g(i.prototype,{enable:function(){this._typeahead.getCore().resetOnKeyup=false;},disable:h});e.exports=i;});
__d("legacy:HintTextTypeaheadBehavior",["TypeaheadHintText"],function(a,b,c,d){var e=b('TypeaheadHintText');if(!a.TypeaheadBehaviors)a.TypeaheadBehaviors={};a.TypeaheadBehaviors.hintText=function(f){f.enableBehavior(e);};},3);